-/* $OpenBSD: msgs.c,v 1.8 1997/04/02 17:21:24 deraadt Exp $ */
+/* $OpenBSD: msgs.c,v 1.9 1997/04/28 05:48:32 downsj Exp $ */
/* $NetBSD: msgs.c,v 1.7 1995/09/28 06:57:40 tls Exp $ */
/*-
#if 0
static char sccsid[] = "@(#)msgs.c 8.2 (Berkeley) 4/28/95";
#else
-static char rcsid[] = "$OpenBSD: msgs.c,v 1.8 1997/04/02 17:21:24 deraadt Exp $";
+static char rcsid[] = "$OpenBSD: msgs.c,v 1.9 1997/04/28 05:48:32 downsj Exp $";
#endif
#endif /* not lint */
#define OBJECT /* will object to messages without Subjects */
#define REJECT /* will reject messages without Subjects
(OBJECT must be defined also) */
-/* #define UNBUFFERED /* use unbuffered output */
+#undef UNBUFFERED /* use unbuffered output */
#include <sys/param.h>
#include <sys/ioctl.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include <term.h>
#include <termios.h>
#include <time.h>
#include <unistd.h>
time_t t;
time_t keep;
-char *nxtfld();
-void onintr();
-void onsusp();
+void prmesg __P((int));
+void onintr __P((int));
+void onsusp __P((int));
+int linecnt __P((FILE *));
+int next __P((char *));
+void ask __P((char *));
+void gfrsub __P((FILE *));
+char *nxtfld __P((char *));
/* option initialization */
bool hdrs = NO;
bool lastcmd = NO;
jmp_buf tstpbuf;
+int
main(argc, argv)
-int argc; char *argv[];
+ int argc;
+ char *argv[];
{
bool newrc, already;
int rcfirst = 0; /* first message to print (from .rc) */
exit(0);
}
+void
prmesg(length)
int length;
{
}
void
-onintr()
+onintr(unused)
+ int unused;
{
signal(SIGINT, onintr);
if (mailing)
* We have just gotten a susp. Suspend and prepare to resume.
*/
void
-onsusp()
+onsusp(unused)
+ int unused;
{
-
signal(SIGTSTP, SIG_DFL);
sigsetmask(0);
kill(0, SIGTSTP);
longjmp(tstpbuf, 0);
}
+int
linecnt(f)
-FILE *f;
+ FILE *f;
{
off_t oldpos = ftell(f);
int l = 0;
return (l);
}
+int
next(buf)
-char *buf;
+ char *buf;
{
int i;
sscanf(buf, "%d", &i);
return(--i);
}
+void
ask(prompt)
-char *prompt;
+ char *prompt;
{
char inch;
int n, cmsg, fd;
return;
}
- while (n = fread(inbuf, 1, sizeof inbuf, cpfrom))
+ while ((n = fread(inbuf, 1, sizeof inbuf, cpfrom)))
fwrite(inbuf, 1, n, cpto);
fclose(cpfrom);
}
}
+void
gfrsub(infile)
-FILE *infile;
+ FILE *infile;
{
off_t frompos;
char *
nxtfld(s)
-char *s;
+ char *s;
{
if (*s) while (*s && *s > ' ') s++; /* skip over this field */
if (*s) while (*s && *s <= ' ') s++; /* find start of next field */