From mboxrd@z Thu Jan 1 00:00:00 1970 Message-ID: <1450f0a4c5f10e8a355290f54d4f148d@sdgm.net> From: boyd@sdgm.net To: 9fans@cse.psu.edu MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit Subject: [9fans] nedmail.c Date: Mon, 4 Aug 2003 17:07:15 -0400 Topicbox-Message-UUID: 10a07da2-eacc-11e9-9e20-41e7f4b1d025 doesn't look right to me: brahma% 9fs sources !Adding key: dom=outside.plan9.bell-labs.com proto=p9sk1 user[boyd]: password: ! brahma% ls -l /n/sources/plan9/sys/src/cmd/upas/ned/nedmail.c --rw-rw-r-- M 2478 glenda sys 42722 Jun 15 14:52 /n/sources/plan9/sys/src/cmd/upas/ned/nedmail.c brahma% ape/diff -c /n/sources/plan9/sys/src/cmd/upas/ned/nedmail.c src/upas/ned *** /n/sources/plan9/sys/src/cmd/upas/ned/nedmail.c Sun Jun 15 14:52:38 2003 --- src/upas/ned/nedmail.c Mon Jul 28 20:05:26 2003 *************** *** 123,129 **** { "u", 0, ucmd, "u remove deletion mark" }, { "w", 1, wcmd, "w file store message contents as file" }, { "x", 0, xcmd, "x exit without flushing deleted messages" }, ! { "y", 0, ycmd, "x synchronize with mail box" }, { "=", 1, eqcmd, "= print current message number" }, { "|", 1, pipecmd, "|cmd pipe message body to a command" }, { "||", 1, rpipecmd, "|cmd pipe raw message to a command" }, --- 123,129 ---- { "u", 0, ucmd, "u remove deletion mark" }, { "w", 1, wcmd, "w file store message contents as file" }, { "x", 0, xcmd, "x exit without flushing deleted messages" }, ! { "y", 0, ycmd, "y synchronize with mail box" }, { "=", 1, eqcmd, "= print current message number" }, { "|", 1, pipecmd, "|cmd pipe message body to a command" }, { "||", 1, rpipecmd, "|cmd pipe raw message to a command" }, *************** *** 191,196 **** --- 191,205 ---- noted(NDFLT); } + char * + plural(int n) + { + if (n == 1) + return ""; + + return "s"; + } + void main(int argc, char **argv) { *************** *** 270,276 **** n = dir2message(&top, reverse); if(n < 0) sysfatal("can't read %s", s_to_c(top.path)); ! Bprint(&out, "%d messages\n", n); } notify(catchnote); --- 279,285 ---- n = dir2message(&top, reverse); if(n < 0) sysfatal("can't read %s", s_to_c(top.path)); ! Bprint(&out, "%d message%s\n", n, plural(n)); } notify(catchnote); *************** *** 1152,1158 **** i = 0; for(; m != nil; m = m->next) i++; ! Bprint(&out, "%d messages\n", i); } Message* --- 1161,1167 ---- i = 0; for(; m != nil; m = m->next) i++; ! Bprint(&out, "%d message%s\n", i, plural(i)); } Message* *************** *** 1488,1494 **** Bprint(&out, "!1 message deleted\n"); break; default: ! Bprint(&out, "!%d messages deleted\n", deld); break; } --- 1497,1503 ---- Bprint(&out, "!1 message deleted\n"); break; default: ! Bprint(&out, "!%d message%s deleted\n", deld, plural(deld)); break; } *************** *** 1569,1575 **** n = dir2message(&top, reverse); if(n > 0) ! Bprint(&out, "%d new messages\n", n); return m; } --- 1578,1584 ---- n = dir2message(&top, reverse); if(n > 0) ! Bprint(&out, "%d new message%s\n", n, plural(n)); return m; }