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
include aculib in cleanup
[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
a89360f
..
d7c85d6
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 2.
8
%G%";
+static char *SccsId = "@(#)collect.c 2.
14
%G%";
#include "rcv.h"
#include <sys/stat.h>
#include "rcv.h"
#include <sys/stat.h>
@@
-58,9
+58,9
@@
collect(hp)
hadintr = 0;
# ifdef VMUNIX
if ((savesig = sigset(SIGINT, SIG_IGN)) != SIG_IGN)
hadintr = 0;
# ifdef VMUNIX
if ((savesig = sigset(SIGINT, SIG_IGN)) != SIG_IGN)
- sigset(SIGINT, hf ? intack : collrub), sig
hold(SIGINT
);
+ sigset(SIGINT, hf ? intack : collrub), sig
block(mask(SIGINT)
);
if ((savehup = sigset(SIGHUP, SIG_IGN)) != SIG_IGN)
if ((savehup = sigset(SIGHUP, SIG_IGN)) != SIG_IGN)
- sigset(SIGHUP, collrub), sig
hold(SIGHUP
);
+ sigset(SIGHUP, collrub), sig
block(mask(SIGHUP)
);
savecont = sigset(SIGCONT, collcont);
# else VMUNIX
savesig = signal(SIGINT, SIG_IGN);
savecont = sigset(SIGCONT, collcont);
# else VMUNIX
savesig = signal(SIGINT, SIG_IGN);
@@
-103,10
+103,11
@@
collect(hp)
escape = *cp;
eof = 0;
for (;;) {
escape = *cp;
eof = 0;
for (;;) {
+ int omask = sigblock(0) &~ (mask(SIGINT)|mask(SIGHUP));
+
setjmp(coljmp);
# ifdef VMUNIX
setjmp(coljmp);
# ifdef VMUNIX
- sigrelse(SIGINT);
- sigrelse(SIGHUP);
+ sigsetmask(omask);
# else VMUNIX
if (savesig != SIG_IGN)
signal(SIGINT, hf ? intack : collintsig);
# else VMUNIX
if (savesig != SIG_IGN)
signal(SIGINT, hf ? intack : collintsig);
@@
-175,6
+176,7
@@
collect(hp)
*/
execute(&linebuf[2], 1);
*/
execute(&linebuf[2], 1);
+ printf("(continue)\n");
break;
case '.':
break;
case '.':
@@
-331,7
+333,7
@@
collect(hp)
case '?':
if ((fbuf = fopen(THELPFILE, "r")) == NULL) {
case '?':
if ((fbuf = fopen(THELPFILE, "r")) == NULL) {
- p
rintf("No help just now.\n"
);
+ p
error(THELPFILE
);
break;
}
t = getc(fbuf);
break;
}
t = getc(fbuf);
@@
-398,6
+400,7
@@
eofl:
sigset(SIGHUP, savehup);
# ifdef VMUNIX
sigset(SIGCONT, savecont);
sigset(SIGHUP, savehup);
# ifdef VMUNIX
sigset(SIGCONT, savecont);
+ sigsetmask(0);
# endif VMUNIX
noreset = 0;
return(ibuf);
# endif VMUNIX
noreset = 0;
return(ibuf);
@@
-411,6
+414,7
@@
err:
sigset(SIGHUP, savehup);
# ifdef VMUNIX
sigset(SIGCONT, savecont);
sigset(SIGHUP, savehup);
# ifdef VMUNIX
sigset(SIGCONT, savecont);
+ sigsetmask(0);
# endif VMUNIX
noreset = 0;
return(NULL);
# endif VMUNIX
noreset = 0;
return(NULL);
@@
-491,14
+495,14
@@
mesedit(ibuf, obuf, c)
int pid, s;
FILE *fbuf;
register int t;
int pid, s;
FILE *fbuf;
register int t;
- int (*sig)(), (*scont)(),
foonly
();
+ int (*sig)(), (*scont)(),
signull
();
struct stat sbuf;
extern char tempMail[], tempEdit[];
register char *edit;
sig = sigset(SIGINT, SIG_IGN);
# ifdef VMUNIX
struct stat sbuf;
extern char tempMail[], tempEdit[];
register char *edit;
sig = sigset(SIGINT, SIG_IGN);
# ifdef VMUNIX
- scont = sigset(SIGCONT,
foonly
);
+ scont = sigset(SIGCONT,
signull
);
# endif VMUNIX
if (stat(tempEdit, &sbuf) >= 0) {
printf("%s: file exists\n", tempEdit);
# endif VMUNIX
if (stat(tempEdit, &sbuf) >= 0) {
printf("%s: file exists\n", tempEdit);
@@
-527,6
+531,7
@@
mesedit(ibuf, obuf, c)
edit = c == 'e' ? EDITOR : VISUAL;
pid = vfork();
if (pid == 0) {
edit = c == 'e' ? EDITOR : VISUAL;
pid = vfork();
if (pid == 0) {
+ sigchild();
if (sig != SIG_IGN)
sigsys(SIGINT, SIG_DFL);
execl(edit, edit, tempEdit, 0);
if (sig != SIG_IGN)
sigsys(SIGINT, SIG_DFL);
execl(edit, edit, tempEdit, 0);
@@
-577,13
+582,6
@@
out:
return(obuf);
}
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;
@@
-628,6
+626,7
@@
mespipe(ibuf, obuf, cmd)
* stdout = new message.
*/
* stdout = new message.
*/
+ sigchild();
close(0);
dup(fileno(ibuf));
close(1);
close(0);
dup(fileno(ibuf));
close(1);
@@
-674,7
+673,6
@@
err:
* the message temporary. The flag argument is 'm' if we
* should shift over and 'f' if not.
*/
* the message temporary. The flag argument is 'm' if we
* should shift over and 'f' if not.
*/
-
forward(ms, obuf, f)
char ms[];
FILE *obuf;
forward(ms, obuf, f)
char ms[];
FILE *obuf;
@@
-700,12
+698,12
@@
forward(ms, obuf, f)
touch(*ip);
printf(" %d", *ip);
if (f == 'm') {
touch(*ip);
printf(" %d", *ip);
if (f == 'm') {
- if (transmit(&message[*ip-1], obuf) < 0) {
+ if (transmit(&message[*ip-1], obuf) < 0
L
) {
perror(tempMail);
return(-1);
}
} else
perror(tempMail);
return(-1);
}
} else
- if (send(&message[*ip-1], obuf) < 0) {
+ if (send(&message[*ip-1], obuf
, 0
) < 0) {
perror(tempMail);
return(-1);
}
perror(tempMail);
return(-1);
}
@@
-721,28
+719,30
@@
forward(ms, obuf, f)
* on error.
*/
* on error.
*/
+long
transmit(mailp, obuf)
struct message *mailp;
FILE *obuf;
{
register struct message *mp;
transmit(mailp, obuf)
struct message *mailp;
FILE *obuf;
{
register struct message *mp;
- register int c, ch;
- int n, bol;
+ register int ch;
+ long c, n;
+ int bol;
FILE *ibuf;
mp = mailp;
ibuf = setinput(mp);
FILE *ibuf;
mp = mailp;
ibuf = setinput(mp);
- c = m
size(mp)
;
+ c = m
p->m_size
;
n = c;
bol = 1;
n = c;
bol = 1;
- while (c-- > 0) {
+ while (c-- > 0
L
) {
if (bol) {
bol = 0;
putc('\t', obuf);
n++;
if (ferror(obuf)) {
perror("/tmp");
if (bol) {
bol = 0;
putc('\t', obuf);
n++;
if (ferror(obuf)) {
perror("/tmp");
- return(-1);
+ return(-1
L
);
}
}
ch = getc(ibuf);
}
}
ch = getc(ibuf);
@@
-751,7
+751,7
@@
transmit(mailp, obuf)
putc(ch, obuf);
if (ferror(obuf)) {
perror("/tmp");
putc(ch, obuf);
if (ferror(obuf)) {
perror("/tmp");
- return(-1);
+ return(-1
L
);
}
}
return(n);
}
}
return(n);
@@
-798,9
+798,6
@@
collrub(s)
hadintr++;
clrbuf(stdout);
printf("\n(Interrupt -- one more to kill letter)\n");
hadintr++;
clrbuf(stdout);
printf("\n(Interrupt -- one more to kill letter)\n");
-# ifdef VMUNIX
- sigrelse(s);
-# endif VMUNIX
longjmp(coljmp, 1);
}
fclose(newo);
longjmp(coljmp, 1);
}
fclose(newo);