int main(int argc, char **argv) { int o; struct VSM_data *vd; vd = VSM_New(); VSL_Setup(vd); while ((o = getopt(argc, argv, VSL_ARGS "Vw:")) != -1) { switch (o) { case 'V': varnish_version("varnishsizes"); exit(0); case 'w': delay = atoi(optarg); break; default: if (VSL_Arg(vd, o, optarg) > 0) break; usage(); } } if (VSL_Open(vd, 1)) exit(1); log_ten = log(10.0); do_curses(vd); exit(0); }
int main(int argc, char **argv) { int c; struct varnish_stats *VSL_stats; int delay = 1, once = 0, xml = 0; const char *n_arg = NULL; const char *fields = NULL; while ((c = getopt(argc, argv, "1f:ln:Vw:x")) != -1) { switch (c) { case '1': once = 1; break; case 'f': fields = optarg; break; case 'l': list_fields(); exit(0); case 'n': n_arg = optarg; break; case 'V': varnish_version("varnishstat"); exit(0); case 'w': delay = atoi(optarg); break; case 'x': xml = 1; break; default: usage(); } } if ((VSL_stats = VSL_OpenStats(n_arg)) == NULL) exit(1); if (fields != NULL && !valid_fields(fields)) { usage(); exit(1); } if (xml) do_xml(VSL_stats, fields); else if (once) do_once(VSL_stats, fields); else do_curses(VSL_stats, delay, fields); exit(0); }