61 "Usage: %s [-d] [-v] [-h]\n"
62 " -d enable debugging.\n"
63 " -h this message\n\n",
70 int opt, had_error = 0;
73 while (-1 != (opt =
getopt(argc, argv,
"hd"))) {
85 fprintf(stderr,
"unknown option: -%c. Exiting\n", opt);
95main(
int argc,
char *argv[])
100 setbuf(stdout,
nullptr);
101 setbuf(stderr,
nullptr);
112 if ((p = strchr(buf,
'\n')) !=
nullptr) {
116 buflen = strlen(buf);
118 debug(
"Got %d bytes '%s' from Squid\n", buflen, buf);
121 int64_t channelId =
strtoll(buf, &p, 10);
124 fprintf(stdout,
"ERR\n");
127 fprintf(stdout,
"%" PRId64 " ERR\n", channelId);
int main(int argc, char *argv[])
#define HELPER_INPUT_BUFFER
void debug(const char *format,...)
int getopt(int nargc, char *const *nargv, const char *ostr)
static void process_options(int argc, char *argv[])
int64_t strtoll(const char *nptr, char **endptr, int base)