summaryrefslogtreecommitdiff
path: root/clients
diff options
context:
space:
mode:
authorGravatar John Kohl <jtkohl@mit.edu>1989-05-10 12:53:48 +0000
committerGravatar John Kohl <jtkohl@mit.edu>1989-05-10 12:53:48 +0000
commitb788ec092b05fdf1ca04c9496784388ba0a2c844 (patch)
tree237477006ea689c6db196233ef018ceb877c91a9 /clients
parent2b413fc6d29f57ce76ef0d0e4f3e4fb3a8c7ca2f (diff)
support multiple recipients on the same line.
Diffstat (limited to 'clients')
-rw-r--r--clients/zpopnotify/zpopnotify.c38
1 files changed, 20 insertions, 18 deletions
diff --git a/clients/zpopnotify/zpopnotify.c b/clients/zpopnotify/zpopnotify.c
index b9054e8..7da685d 100644
--- a/clients/zpopnotify/zpopnotify.c
+++ b/clients/zpopnotify/zpopnotify.c
@@ -34,6 +34,7 @@ main(argc,argv)
ZNotice_t notice;
struct hostent *hent;
int retval;
+ register int i;
char *whoami,*ptr,myhost[MAXHOSTNAMELEN],mysender[BUFSIZ];
char *lines[2];
@@ -44,17 +45,11 @@ main(argc,argv)
exit(1);
}
- if (argc != 2) {
+ if (argc < 2) {
usage(whoami);
exit(1);
}
- ptr = (char *)rindex(argv[1],'/');
- if (ptr)
- ptr++;
- else
- ptr = argv[1];
-
if (gethostname(myhost,MAXHOSTNAMELEN) == -1) {
com_err(whoami,errno,"Can't get hostname");
exit(1);
@@ -75,23 +70,30 @@ main(argc,argv)
(void) strcpy(mysender,"pop@");
(void) strcat(mysender,ZGetRealm());
- (void) bzero((char *)&notice, sizeof(notice));
- notice.z_kind = UNSAFE;
- notice.z_class = MAIL_CLASS;
- notice.z_class_inst = MAIL_INSTANCE;
- notice.z_opcode = "";
- notice.z_sender = mysender;
- notice.z_recipient = ptr;
- notice.z_default_format = "From Post Office $1:\n$2";
+ for (i = 1; i < argc; i++) {
+ (void) bzero((char *)&notice, sizeof(notice));
+ notice.z_kind = UNSAFE;
+ notice.z_class = MAIL_CLASS;
+ notice.z_class_inst = MAIL_INSTANCE;
+ notice.z_opcode = "";
+ notice.z_sender = mysender;
+ notice.z_default_format = "From Post Office $1:\n$2";
- if ((retval = ZSendList(&notice,lines,2,ZNOAUTH)) != ZERR_NONE) {
+ notice.z_recipient = (char *)rindex(argv[1],'/');
+ if (notice.z_recipient)
+ notice.z_recipient++;
+ else
+ notice.z_recipient = argv[i];
+
+ if ((retval = ZSendList(&notice,lines,2,ZNOAUTH)) != ZERR_NONE) {
com_err(whoami,retval,"while sending notice");
exit(1);
- }
+ }
+ }
}
usage(whoami)
char *whoami;
{
- printf("Usage: %s username\n",whoami);
+ printf("Usage: %s username [ username ... ]\n",whoami);
}