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
changed method of holding SIGCONT to just catch signal or
[unix-history]
/
usr
/
src
/
usr.bin
/
mail
/
collect.c
diff --git
a/usr/src/usr.bin/mail/collect.c
b/usr/src/usr.bin/mail/collect.c
index
3a2d81b
..
6da9751
100644
(file)
--- a/
usr/src/usr.bin/mail/collect.c
+++ b/
usr/src/usr.bin/mail/collect.c
@@
-7,7
+7,7
@@
* ~ escapes.
*/
* ~ escapes.
*/
-static char *SccsId = "@(#)collect.c
1
.5 %G%";
+static char *SccsId = "@(#)collect.c
2
.5 %G%";
#include "rcv.h"
#include <sys/stat.h>
#include "rcv.h"
#include <sys/stat.h>
@@
-40,13
+40,13
@@
collect(hp)
struct header *hp;
{
FILE *ibuf, *fbuf, *obuf;
struct header *hp;
{
FILE *ibuf, *fbuf, *obuf;
- int lc, cc, escape, collrub(), intack(),
stopdot, collhup, collcont()
;
+ int lc, cc, escape, collrub(), intack(),
collhup, collcont(), eof
;
register int c, t;
char linebuf[LINESIZE], *cp;
extern char tempMail[];
register int c, t;
char linebuf[LINESIZE], *cp;
extern char tempMail[];
+ int notify();
noreset++;
noreset++;
- stopdot = (value("dot") != NOSTR) && intty;
ibuf = obuf = NULL;
if (value("ignore") != NOSTR)
hf = 1;
ibuf = obuf = NULL;
if (value("ignore") != NOSTR)
hf = 1;
@@
-93,15
+93,26
@@
collect(hp)
escape = ESCAPE;
if ((cp = value("escape")) != NOSTR)
escape = *cp;
escape = ESCAPE;
if ((cp = value("escape")) != NOSTR)
escape = *cp;
+ eof = 0;
for (;;) {
setjmp(coljmp);
sigrelse(SIGINT);
sigrelse(SIGHUP);
flush();
for (;;) {
setjmp(coljmp);
sigrelse(SIGINT);
sigrelse(SIGHUP);
flush();
- if (readline(stdin, linebuf) <= 0)
+ if (readline(stdin, linebuf) <= 0) {
+ if (intty && value("ignoreeof") != NOSTR) {
+ if (++eof > 35)
+ break;
+ printf("Use \".\" to terminate letter\n",
+ escape);
+ continue;
+ }
break;
break;
+ }
+ eof = 0;
hadintr = 0;
hadintr = 0;
- if (stopdot && equal(".", linebuf))
+ if (intty && equal(".", linebuf) &&
+ (value("dot") != NOSTR || value("ignoreeof") != NOSTR))
break;
if (linebuf[0] != escape || rflag != NOSTR) {
if ((t = putline(obuf, linebuf)) < 0)
break;
if (linebuf[0] != escape || rflag != NOSTR) {
if ((t = putline(obuf, linebuf)) < 0)
@@
-370,6
+381,7
@@
eof:
rewind(ibuf);
sigset(SIGINT, savesig);
sigset(SIGHUP, savehup);
rewind(ibuf);
sigset(SIGINT, savesig);
sigset(SIGHUP, savehup);
+ sigset(SIGCONT, savecont);
noreset = 0;
return(ibuf);
noreset = 0;
return(ibuf);
@@
-460,12
+472,13
@@
mesedit(ibuf, obuf, c)
int pid, s;
FILE *fbuf;
register int t;
int pid, s;
FILE *fbuf;
register int t;
- int (*sig)();
+ int (*sig)()
, (*scont)(), foonly()
;
struct stat sbuf;
extern char tempMail[], tempEdit[];
register char *edit;
sig = sigset(SIGINT, SIG_IGN);
struct stat sbuf;
extern char tempMail[], tempEdit[];
register char *edit;
sig = sigset(SIGINT, SIG_IGN);
+ scont = sigset(SIGCONT, foonly);
if (stat(tempEdit, &sbuf) >= 0) {
printf("%s: file exists\n", tempEdit);
goto out;
if (stat(tempEdit, &sbuf) >= 0) {
printf("%s: file exists\n", tempEdit);
goto out;
@@
-535,11
+548,19
@@
mesedit(ibuf, obuf, c)
fix:
perror(tempEdit);
out:
fix:
perror(tempEdit);
out:
+ sigset(SIGCONT, scont);
sigset(SIGINT, sig);
newi = ibuf;
return(obuf);
}
sigset(SIGINT, sig);
newi = ibuf;
return(obuf);
}
+/*
+ * Currently, Berkeley virtual VAX/UNIX will not let you change the
+ * disposition of SIGCONT, except to trap it somewhere new.
+ * Hence, sigset(SIGCONT, foonly) is used to ignore continue signals.
+ */
+foonly() {}
+
/*
* Pipe the message through the command.
* Old message is on stdin of command;
/*
* Pipe the message through the command.
* Old message is on stdin of command;
@@
-736,13
+757,11
@@
collrub(s)
register FILE *dbuf;
register int c;
register FILE *dbuf;
register int c;
- if (s == SIGINT)
- sigset(SIGCONT, collrub);
if (s == SIGINT && hadintr == 0) {
hadintr++;
clrbuf(stdout);
printf("\n(Interrupt -- one more to kill letter)\n");
if (s == SIGINT && hadintr == 0) {
hadintr++;
clrbuf(stdout);
printf("\n(Interrupt -- one more to kill letter)\n");
- sig
set(s, collrub
);
+ sig
relse(s
);
longjmp(coljmp, 1);
}
fclose(newo);
longjmp(coljmp, 1);
}
fclose(newo);
@@
-778,7
+797,6
@@
done:
intack(s)
{
intack(s)
{
- sigrelse(SIGCONT);
puts("@");
fflush(stdout);
clearerr(stdin);
puts("@");
fflush(stdout);
clearerr(stdin);