projects
/
unix-history
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
tags
|
clone url
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
do chmod last in install
[unix-history]
/
usr
/
src
/
usr.bin
/
mail
/
aux.c
diff --git
a/usr/src/usr.bin/mail/aux.c
b/usr/src/usr.bin/mail/aux.c
index
bf19be8
..
65432d4
100644
(file)
--- a/
usr/src/usr.bin/mail/aux.c
+++ b/
usr/src/usr.bin/mail/aux.c
@@
-2,7
+2,6
@@
#include "rcv.h"
#include <sys/stat.h>
#include "rcv.h"
#include <sys/stat.h>
-#include <sgtty.h>
#include <ctype.h>
/*
#include <ctype.h>
/*
@@
-11,7
+10,7
@@
* Auxiliary functions.
*/
* Auxiliary functions.
*/
-static char *SccsId = "@(#)aux.c
1.7
%G%";
+static char *SccsId = "@(#)aux.c
2.3
%G%";
/*
* Return a pointer to a dynamic copy of the argument.
/*
* Return a pointer to a dynamic copy of the argument.
@@
-480,14
+479,9
@@
alter(name)
time_p[1] = statb.st_mtime;
utime(name, time_p);
#else
time_p[1] = statb.st_mtime;
utime(name, time_p);
#else
- if ((pid = fork()) != 0)
- return;
- clrbuf(stdout);
- clrbuf(stderr);
- clrbuf(stdin);
sleep(1);
if ((f = open(name, 0)) < 0)
sleep(1);
if ((f = open(name, 0)) < 0)
-
exit(1)
;
+
return
;
read(f, &w, 1);
exit(0);
#endif
read(f, &w, 1);
exit(0);
#endif
@@
-518,8
+512,18
@@
char *
nameof(mp, reptype)
register struct message *mp;
{
nameof(mp, reptype)
register struct message *mp;
{
+ register char *cp, *cp2;
- return(skin(name1(mp, reptype)));
+ cp = skin(name1(mp, reptype));
+ if (reptype != 0 || charcount(cp, '!') < 2)
+ return(cp);
+ cp2 = rindex(cp, '!');
+ cp2--;
+ while (cp2 > cp && *cp2 != '!')
+ cp2--;
+ if (*cp2 == '!')
+ return(cp2 + 1);
+ return(cp);
}
/*
}
/*
@@
-646,11
+650,25
@@
newname:
return(savestr(namebuf));
}
return(savestr(namebuf));
}
+/*
+ * Count the occurances of c in str
+ */
+charcount(str, c)
+ char *str;
+{
+ register char *cp;
+ register int i;
+
+ for (i = 0, cp = str; *cp; cp++)
+ if (*cp == c)
+ i++;
+ return(i);
+}
+
/*
* Find the rightmost pointer to an instance of the
* character in the string and return it.
*/
/*
* Find the rightmost pointer to an instance of the
* character in the string and return it.
*/
-
char *
rindex(str, c)
char str[];
char *
rindex(str, c)
char str[];