version 1.13, 1997/09/04 20:44:04 |
version 1.14, 1997/11/14 00:23:47 |
|
|
*/ |
*/ |
void |
void |
setptr(ibuf, offset) |
setptr(ibuf, offset) |
register FILE *ibuf; |
FILE *ibuf; |
off_t offset; |
off_t offset; |
{ |
{ |
register int c, count; |
int c, count; |
register char *cp, *cp2; |
char *cp, *cp2; |
struct message this; |
struct message this; |
FILE *mestmp; |
FILE *mestmp; |
int maybe, inhead; |
int maybe, inhead, omsgCount; |
char linebuf[LINESIZE], pathbuf[PATHSIZE]; |
char linebuf[LINESIZE], pathbuf[PATHSIZE]; |
int omsgCount; |
|
|
|
/* Get temporary file. */ |
/* Get temporary file. */ |
(void)snprintf(pathbuf, sizeof(pathbuf), "%s/mail.XXXXXXXXXX", tmpdir); |
(void)snprintf(pathbuf, sizeof(pathbuf), "%s/mail.XXXXXXXXXX", tmpdir); |
|
|
char *linebuf; |
char *linebuf; |
int outlf; |
int outlf; |
{ |
{ |
register int c; |
int c; |
|
|
c = strlen(linebuf); |
c = strlen(linebuf); |
(void)fwrite(linebuf, sizeof(*linebuf), c, obuf); |
(void)fwrite(linebuf, sizeof(*linebuf), c, obuf); |
|
|
char *linebuf; |
char *linebuf; |
int linesize; |
int linesize; |
{ |
{ |
register int n; |
int n; |
|
|
clearerr(ibuf); |
clearerr(ibuf); |
if (fgets(linebuf, linesize, ibuf) == NULL) |
if (fgets(linebuf, linesize, ibuf) == NULL) |
|
|
*/ |
*/ |
FILE * |
FILE * |
setinput(mp) |
setinput(mp) |
register struct message *mp; |
struct message *mp; |
{ |
{ |
|
|
fflush(otf); |
fflush(otf); |
if (fseek(itf, (long)positionof(mp->m_block, mp->m_offset), 0) < 0) { |
if (fseek(itf, (long)positionof(mp->m_block, mp->m_offset), 0) < 0) |
warn("fseek"); |
err(1, "fseek"); |
panic("temporary file seek"); |
|
} |
|
return(itf); |
return(itf); |
} |
} |
|
|
|
|
FILE *f; |
FILE *f; |
int omsgCount; |
int omsgCount; |
{ |
{ |
register size_t size = (msgCount + 1) * sizeof(struct message); |
size_t size = (msgCount + 1) * sizeof(struct message); |
|
|
if (omsgCount) { |
if (omsgCount) { |
message = (struct message *)realloc(message, size); |
message = (struct message *)realloc(message, size); |
if (message == 0) |
if (message == 0) |
panic("Insufficient memory for %d messages\n", msgCount); |
errx(1, "Insufficient memory for %d messages\n", |
|
msgCount); |
} else { |
} else { |
if (message != 0) |
if (message != 0) |
(void)free(message); |
(void)free(message); |
if ((message = (struct message *)malloc(size)) == NULL) |
if ((message = (struct message *)malloc(size)) == NULL) |
panic("Insufficient memory for %d messages", msgCount); |
errx(1, "Insufficient memory for %d messages", |
|
msgCount); |
dot = message; |
dot = message; |
} |
} |
size -= (omsgCount + 1) * sizeof(struct message); |
size -= (omsgCount + 1) * sizeof(struct message); |
fflush(f); |
fflush(f); |
(void)lseek(fileno(f), (off_t)sizeof(*message), 0); |
(void)lseek(fileno(f), (off_t)sizeof(*message), 0); |
if (read(fileno(f), (void *) &message[omsgCount], size) != size) |
if (read(fileno(f), (void *) &message[omsgCount], size) != size) |
panic("Message temporary file corrupted"); |
errx(1, "Message temporary file corrupted"); |
message[msgCount].m_size = 0; |
message[msgCount].m_size = 0; |
message[msgCount].m_lines = 0; |
message[msgCount].m_lines = 0; |
(void)Fclose(f); |
(void)Fclose(f); |
|
|
*/ |
*/ |
char * |
char * |
expand(name) |
expand(name) |
register char *name; |
char *name; |
{ |
{ |
char xname[PATHSIZE]; |
char xname[PATHSIZE]; |
char cmdbuf[PATHSIZE]; /* also used for file names */ |
char cmdbuf[PATHSIZE]; /* also used for file names */ |
register int pid, l; |
int pid, l; |
register char *cp, *shell; |
char *cp, *shell; |
int pivec[2]; |
int pivec[2]; |
struct stat sbuf; |
struct stat sbuf; |
extern int wait_status; |
extern int wait_status; |
|
|
char * |
char * |
getdeadletter() |
getdeadletter() |
{ |
{ |
register char *cp; |
char *cp; |
|
|
if ((cp = value("DEAD")) == NULL || (cp = expand(cp)) == NULL) |
if ((cp = value("DEAD")) == NULL || (cp = expand(cp)) == NULL) |
cp = expand("~/dead.letter"); |
cp = expand("~/dead.letter"); |