/*
* Copyright (c) 1980 Regents of the University of California.
- * All rights reserved. The Berkeley software License Agreement
- * specifies the terms and conditions for redistribution.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms are permitted
+ * provided that this notice is preserved and that due credit is given
+ * to the University of California at Berkeley. The name of the University
+ * may not be used to endorse or promote products derived from this
+ * software without specific prior written permission. This software
+ * is provided ``as is'' without express or implied warranty.
*/
-#ifndef lint
-static char *sccsid = "@(#)cmd3.c 5.4 (Berkeley) %G%";
-#endif not lint
+#ifdef notdef
+static char sccsid[] = "@(#)cmd3.c 5.10 (Berkeley) %G%";
+#endif /* notdef */
#include "rcv.h"
#include <sys/stat.h>
strcpy(buf, cp);
}
np = elide(extract(buf, GTO));
- mapf(np, rcv);
/*
* Delete my name from the reply list,
* and with it, all my alternate names.
cp = skin(hfield("cc", mp));
if (cp != NOSTR) {
np = elide(extract(cp, GCC));
- mapf(np, rcv);
np = delname(np, myname, icequal);
if (altnames != 0)
for (ap = altnames; *ap; ap++)
}
}
head.h_bcc = NOSTR;
+ head.h_smopts = NOSTR;
mail1(&head);
return(0);
}
{
if (sourcing)
return(1);
- if (Tflag != NOSTR)
- close(creat(Tflag, 0600));
exit(e);
/*NOTREACHED*/
}
*/
file(argv)
- char **argv;
+ register char **argv;
{
register char *cp;
- int edit;
if (argv[0] == NOSTR) {
newfileinfo();
- return(0);
+ return 0;
}
-
- /*
- * Acker's! Must switch to the new file.
- * We use a funny interpretation --
- * # -- gets the previous file
- * % -- gets the invoker's post office box
- * %user -- gets someone else's post office box
- * & -- gets invoker's mbox file
- * string -- reads the given file
- */
-
- cp = getfilename(argv[0], &edit);
- if (cp == NOSTR)
- return(-1);
- if (setfile(cp, edit)) {
+ if ((cp = expand(*argv)) == NOSTR)
+ return -1;
+ strcpy(prevfile, mailname);
+ if (setfile(cp, **argv != '%')) {
perror(cp);
- return(-1);
+ return -1;
}
- announce(0);
+ announce();
return 0;
}
-/*
- * Evaluate the string given as a new mailbox name.
- * Ultimately, we want this to support a number of meta characters.
- * Possibly:
- * % -- for my system mail box
- * %user -- for user's system mail box
- * # -- for previous file
- * & -- get's invoker's mbox file
- * file name -- for any other file
- */
-
-char prevfile[PATHSIZE];
-
-char *
-getfilename(name, aedit)
- char *name;
- int *aedit;
-{
- register char *cp;
- char savename[BUFSIZ];
- char oldmailname[BUFSIZ];
-
- /*
- * Assume we will be in "edit file" mode, until
- * proven wrong.
- */
- *aedit = 1;
- switch (*name) {
- case '%':
- *aedit = 0;
- strcpy(prevfile, mailname);
- if (name[1] != 0) {
- strcpy(savename, myname);
- strcpy(oldmailname, mailname);
- strncpy(myname, name+1, PATHSIZE-1);
- myname[PATHSIZE-1] = 0;
- findmail();
- cp = savestr(mailname);
- strcpy(myname, savename);
- strcpy(mailname, oldmailname);
- return(cp);
- }
- strcpy(oldmailname, mailname);
- findmail();
- cp = savestr(mailname);
- strcpy(mailname, oldmailname);
- return(cp);
-
- case '#':
- if (name[1] != 0)
- goto regular;
- if (prevfile[0] == 0) {
- printf("No previous file\n");
- return(NOSTR);
- }
- cp = savestr(prevfile);
- strcpy(prevfile, mailname);
- return(cp);
-
- case '&':
- strcpy(prevfile, mailname);
- if (name[1] == 0)
- return(mbox);
- /* Fall into . . . */
-
- default:
-regular:
- strcpy(prevfile, mailname);
- cp = expand(name);
- return(cp);
- }
-}
-
/*
* Expand file names like echo
*/
for (ap = argv; *ap != NOSTR; ap++) {
cp = *ap;
- if ((cp = expand(cp)) != NOSTR)
- printf("%s ", cp);
+ if ((cp = expand(cp)) != NOSTR) {
+ if (ap != argv)
+ putchar(' ');
+ printf("%s", cp);
+ }
}
+ putchar('\n');
+
return(0);
}
head.h_seq++;
head.h_cc = NOSTR;
head.h_bcc = NOSTR;
+ head.h_smopts = NOSTR;
mail1(&head);
return(0);
}