add --count (print number of messages and bytes at beginning)
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@7535 ec53bebd-3082-4978-b11e-865c3cabbd6b
This commit is contained in:
@@ -50,6 +50,7 @@ static int do_leave;
|
|||||||
static int do_version;
|
static int do_version;
|
||||||
static int do_help;
|
static int do_help;
|
||||||
static int do_from;
|
static int do_from;
|
||||||
|
static int do_count;
|
||||||
static char *header_str;
|
static char *header_str;
|
||||||
|
|
||||||
struct getargs args[] = {
|
struct getargs args[] = {
|
||||||
@@ -72,6 +73,7 @@ struct getargs args[] = {
|
|||||||
{ "from", 0, arg_flag, &do_from, "Behave like from",
|
{ "from", 0, arg_flag, &do_from, "Behave like from",
|
||||||
NULL },
|
NULL },
|
||||||
{ "header", 0, arg_string, &header_str, "Header string to print", NULL },
|
{ "header", 0, arg_string, &header_str, "Header string to print", NULL },
|
||||||
|
{ "count", 'c', arg_flag, &do_count, "Print number of messages", NULL},
|
||||||
{ "version", 0, arg_flag, &do_version, "Print version",
|
{ "version", 0, arg_flag, &do_version, "Print version",
|
||||||
NULL },
|
NULL },
|
||||||
{ "help", 0, arg_flag, &do_help, NULL,
|
{ "help", 0, arg_flag, &do_help, NULL,
|
||||||
@@ -392,10 +394,16 @@ doit(int s,
|
|||||||
} else if (++state == STAT) {
|
} else if (++state == STAT) {
|
||||||
if(sscanf (beg + 4, "%u %u", &count, &bytes) != 2)
|
if(sscanf (beg + 4, "%u %u", &count, &bytes) != 2)
|
||||||
errx(1, "Bad STAT-line: %.*s", (int)(p - beg), beg);
|
errx(1, "Bad STAT-line: %.*s", (int)(p - beg), beg);
|
||||||
if (verbose)
|
if (verbose) {
|
||||||
fprintf (stderr, "%u message(s) (%u bytes). "
|
fprintf (stderr, "%u message(s) (%u bytes). "
|
||||||
"fetching... ",
|
"fetching... ",
|
||||||
count, bytes);
|
count, bytes);
|
||||||
|
if (do_from)
|
||||||
|
fprintf (stderr, "\n");
|
||||||
|
} else if (do_count) {
|
||||||
|
fprintf (stderr, "%u message(s) (%u bytes).\n",
|
||||||
|
count, bytes);
|
||||||
|
}
|
||||||
if (count == 0) {
|
if (count == 0) {
|
||||||
state = QUIT;
|
state = QUIT;
|
||||||
net_write (s, "QUIT\r\n", 6);
|
net_write (s, "QUIT\r\n", 6);
|
||||||
|
Reference in New Issue
Block a user