From: boyd@sdgm.net
To: fixes@sdgm.net, 9fans@cse.psu.edu
Subject: [9fans] nedmail.c
Date: Mon, 28 Jul 2003 20:15:02 -0400 [thread overview]
Message-ID: <a3a56bf6f2401fc08deea08098e41ad9@sdgm.net> (raw)
this includes dan's fix and i've added a function so it pluralises
message/messages correctly. diff follows:
brahma% ape/diff -c /n/sources/plan9/sys/src/cmd/upas/ned nedmail.c
*** /n/sources/plan9/sys/src/cmd/upas/ned/nedmail.c Sun Jun 15 14:52:38 2003
--- 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;
}
next reply other threads:[~2003-07-29 0:15 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-07-29 0:15 boyd [this message]
2003-07-29 13:49 ` [9fans] drawterm - connection from linux Erik Jahn
2003-07-29 13:52 ` Sape Mullender
2003-07-29 13:55 ` andrey mirtchovski
2003-08-04 21:07 [9fans] nedmail.c boyd
2003-08-05 0:01 ` David Presotto
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=a3a56bf6f2401fc08deea08098e41ad9@sdgm.net \
--to=boyd@sdgm.net \
--cc=9fans@cse.psu.edu \
--cc=fixes@sdgm.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).