10Sstevel@tonic-gate /*
20Sstevel@tonic-gate * CDDL HEADER START
30Sstevel@tonic-gate *
40Sstevel@tonic-gate * The contents of this file are subject to the terms of the
5*2538Sesaxe * Common Development and Distribution License (the "License").
6*2538Sesaxe * You may not use this file except in compliance with the License.
70Sstevel@tonic-gate *
80Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
90Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing.
100Sstevel@tonic-gate * See the License for the specific language governing permissions
110Sstevel@tonic-gate * and limitations under the License.
120Sstevel@tonic-gate *
130Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each
140Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
150Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the
160Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying
170Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner]
180Sstevel@tonic-gate *
190Sstevel@tonic-gate * CDDL HEADER END
200Sstevel@tonic-gate */
2118Srobbin
2218Srobbin /*
23*2538Sesaxe * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
2418Srobbin * Use is subject to license terms.
2518Srobbin */
2618Srobbin
270Sstevel@tonic-gate /* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
280Sstevel@tonic-gate /* All Rights Reserved */
290Sstevel@tonic-gate
300Sstevel@tonic-gate /*
310Sstevel@tonic-gate * University Copyright- Copyright (c) 1982, 1986, 1988
320Sstevel@tonic-gate * The Regents of the University of California
330Sstevel@tonic-gate * All Rights Reserved
340Sstevel@tonic-gate *
350Sstevel@tonic-gate * University Acknowledgment- Portions of this document are derived from
360Sstevel@tonic-gate * software developed by the University of California, Berkeley, and its
370Sstevel@tonic-gate * contributors.
380Sstevel@tonic-gate */
390Sstevel@tonic-gate
400Sstevel@tonic-gate #pragma ident "%Z%%M% %I% %E% SMI"
410Sstevel@tonic-gate
420Sstevel@tonic-gate #include "rcv.h"
430Sstevel@tonic-gate #ifndef preSVr4
440Sstevel@tonic-gate #include <locale.h>
450Sstevel@tonic-gate #endif
460Sstevel@tonic-gate
470Sstevel@tonic-gate /*
480Sstevel@tonic-gate * mailx -- a modified version of a University of California at Berkeley
490Sstevel@tonic-gate * mail program
500Sstevel@tonic-gate *
510Sstevel@tonic-gate * Startup -- interface with user.
520Sstevel@tonic-gate */
530Sstevel@tonic-gate
540Sstevel@tonic-gate static void hdrstop(int);
550Sstevel@tonic-gate
560Sstevel@tonic-gate static jmp_buf hdrjmp;
570Sstevel@tonic-gate
58*2538Sesaxe const char *const version = "mailx version 5.0";
59*2538Sesaxe
600Sstevel@tonic-gate /*
610Sstevel@tonic-gate * Find out who the user is, copy his mail file (if exists) into
620Sstevel@tonic-gate * /tmp/Rxxxxx and set up the message pointers. Then, print out the
630Sstevel@tonic-gate * message headers and read user commands.
640Sstevel@tonic-gate *
650Sstevel@tonic-gate * Command line syntax:
660Sstevel@tonic-gate * mailx [ -i ] [ -r address ] [ -h number ] [ -f [ name ] ]
670Sstevel@tonic-gate * or:
680Sstevel@tonic-gate * mailx [ -i ] [ -r address ] [ -h number ] people ...
690Sstevel@tonic-gate *
700Sstevel@tonic-gate * and a bunch of other options.
710Sstevel@tonic-gate */
720Sstevel@tonic-gate
730Sstevel@tonic-gate int
main(int argc,char ** argv)740Sstevel@tonic-gate main(int argc, char **argv)
750Sstevel@tonic-gate {
760Sstevel@tonic-gate register char *ef;
770Sstevel@tonic-gate register int argp;
780Sstevel@tonic-gate int mustsend, f, goerr = 0;
790Sstevel@tonic-gate void (*prevint)(int);
800Sstevel@tonic-gate int loaded = 0;
810Sstevel@tonic-gate struct termio tbuf;
820Sstevel@tonic-gate struct termios tbufs;
830Sstevel@tonic-gate int c;
840Sstevel@tonic-gate char *cwd, *mf;
850Sstevel@tonic-gate
860Sstevel@tonic-gate /*
870Sstevel@tonic-gate * Set up a reasonable environment.
880Sstevel@tonic-gate * Figure out whether we are being run interactively, set up
890Sstevel@tonic-gate * all the temporary files, buffer standard output, and so forth.
900Sstevel@tonic-gate */
910Sstevel@tonic-gate
920Sstevel@tonic-gate #ifndef preSVr4
930Sstevel@tonic-gate (void)setlocale(LC_ALL, "");
940Sstevel@tonic-gate #endif
950Sstevel@tonic-gate #if !defined(TEXT_DOMAIN) /* Should be defined by cc -D */
960Sstevel@tonic-gate #define TEXT_DOMAIN "SYS_TEST" /* Use this only if it weren't */
970Sstevel@tonic-gate #endif
980Sstevel@tonic-gate (void) textdomain(TEXT_DOMAIN);
990Sstevel@tonic-gate
1000Sstevel@tonic-gate #ifdef SIGCONT
1010Sstevel@tonic-gate sigset(SIGCONT, SIG_DFL);
1020Sstevel@tonic-gate #endif
1030Sstevel@tonic-gate rpterr = 0; /* initialize; set when we output to stderr */
1040Sstevel@tonic-gate progname = argv[0];
1050Sstevel@tonic-gate if (progname[strlen(progname) - 1] != 'x') {
1060Sstevel@tonic-gate assign("bsdcompat", "");
1070Sstevel@tonic-gate assign("escapeok", ""); /* XXX */
1080Sstevel@tonic-gate }
1090Sstevel@tonic-gate myegid = getegid();
1100Sstevel@tonic-gate myrgid = getgid();
1110Sstevel@tonic-gate myeuid = geteuid();
1120Sstevel@tonic-gate myruid = getuid();
1130Sstevel@tonic-gate mypid = getpid();
1140Sstevel@tonic-gate setgid(myrgid);
1150Sstevel@tonic-gate setuid(myruid);
1160Sstevel@tonic-gate inithost();
1170Sstevel@tonic-gate intty = isatty(0);
1180Sstevel@tonic-gate if (ioctl(1, TCGETS, &tbufs) < 0) {
1190Sstevel@tonic-gate if (ioctl(1, TCGETA, &tbuf)==0) {
1200Sstevel@tonic-gate outtty = 1;
1210Sstevel@tonic-gate baud = tbuf.c_cflag & CBAUD;
1220Sstevel@tonic-gate } else
1230Sstevel@tonic-gate baud = B9600;
1240Sstevel@tonic-gate } else {
1250Sstevel@tonic-gate outtty = 1;
1260Sstevel@tonic-gate baud = cfgetospeed(&tbufs);
1270Sstevel@tonic-gate }
1280Sstevel@tonic-gate image = -1;
1290Sstevel@tonic-gate
1300Sstevel@tonic-gate /*
1310Sstevel@tonic-gate * Now, determine how we are being used.
1320Sstevel@tonic-gate * We successively pick off instances of -r, -h, -f, and -i.
1330Sstevel@tonic-gate * If called as "rmail" we note this fact for letter sending.
1340Sstevel@tonic-gate * If there is anything left, it is the base of the list
1350Sstevel@tonic-gate * of users to mail to. Argp will be set to point to the
1360Sstevel@tonic-gate * first of these users.
1370Sstevel@tonic-gate */
1380Sstevel@tonic-gate
1390Sstevel@tonic-gate ef = NOSTR;
1400Sstevel@tonic-gate argp = -1;
1410Sstevel@tonic-gate mustsend = 0;
1420Sstevel@tonic-gate if (argc > 0 && **argv == 'r')
1430Sstevel@tonic-gate rmail++;
1440Sstevel@tonic-gate while ((c = getopt(argc, argv, "b:Bc:defFh:HiInNr:s:u:UtT:vV~")) != EOF)
1450Sstevel@tonic-gate switch (c) {
1460Sstevel@tonic-gate case 'e':
1470Sstevel@tonic-gate /*
1480Sstevel@tonic-gate * exit status only
1490Sstevel@tonic-gate */
1500Sstevel@tonic-gate exitflg++;
1510Sstevel@tonic-gate break;
1520Sstevel@tonic-gate
1530Sstevel@tonic-gate case 'r':
1540Sstevel@tonic-gate /*
1550Sstevel@tonic-gate * Next argument is address to be sent along
1560Sstevel@tonic-gate * to the mailer.
1570Sstevel@tonic-gate */
1580Sstevel@tonic-gate mustsend++;
1590Sstevel@tonic-gate rflag = optarg;
1600Sstevel@tonic-gate break;
1610Sstevel@tonic-gate
1620Sstevel@tonic-gate case 'T':
1630Sstevel@tonic-gate /*
1640Sstevel@tonic-gate * Next argument is temp file to write which
1650Sstevel@tonic-gate * articles have been read/deleted for netnews.
1660Sstevel@tonic-gate */
1670Sstevel@tonic-gate Tflag = optarg;
1680Sstevel@tonic-gate if ((f = creat(Tflag, TEMPPERM)) < 0) {
1690Sstevel@tonic-gate perror(Tflag);
1700Sstevel@tonic-gate exit(1);
1710Sstevel@tonic-gate }
1720Sstevel@tonic-gate close(f);
1730Sstevel@tonic-gate /* fall through for -I too */
1740Sstevel@tonic-gate /* FALLTHROUGH */
1750Sstevel@tonic-gate
1760Sstevel@tonic-gate case 'I':
1770Sstevel@tonic-gate /*
1780Sstevel@tonic-gate * print newsgroup in header summary
1790Sstevel@tonic-gate */
1800Sstevel@tonic-gate newsflg++;
1810Sstevel@tonic-gate break;
1820Sstevel@tonic-gate
1830Sstevel@tonic-gate case 'u':
1840Sstevel@tonic-gate /*
1850Sstevel@tonic-gate * Next argument is person's mailbox to use.
1860Sstevel@tonic-gate * Treated the same as "-f /var/mail/user".
1870Sstevel@tonic-gate */
1880Sstevel@tonic-gate {
1890Sstevel@tonic-gate static char u[PATHSIZE];
1900Sstevel@tonic-gate snprintf(u, sizeof (u), "%s%s", maildir, optarg);
1910Sstevel@tonic-gate ef = u;
1920Sstevel@tonic-gate break;
1930Sstevel@tonic-gate }
1940Sstevel@tonic-gate
1950Sstevel@tonic-gate case 'i':
1960Sstevel@tonic-gate /*
1970Sstevel@tonic-gate * User wants to ignore interrupts.
1980Sstevel@tonic-gate * Set the variable "ignore"
1990Sstevel@tonic-gate */
2000Sstevel@tonic-gate assign("ignore", "");
2010Sstevel@tonic-gate break;
2020Sstevel@tonic-gate
2030Sstevel@tonic-gate case 'U':
2040Sstevel@tonic-gate UnUUCP++;
2050Sstevel@tonic-gate break;
2060Sstevel@tonic-gate
2070Sstevel@tonic-gate case 'd':
2080Sstevel@tonic-gate assign("debug", "");
2090Sstevel@tonic-gate break;
2100Sstevel@tonic-gate
2110Sstevel@tonic-gate case 'h':
2120Sstevel@tonic-gate /*
2130Sstevel@tonic-gate * Specified sequence number for network.
2140Sstevel@tonic-gate * This is the number of "hops" made so
2150Sstevel@tonic-gate * far (count of times message has been
2160Sstevel@tonic-gate * forwarded) to help avoid infinite mail loops.
2170Sstevel@tonic-gate */
2180Sstevel@tonic-gate mustsend++;
2190Sstevel@tonic-gate hflag = atoi(optarg);
2200Sstevel@tonic-gate if (hflag == 0) {
2210Sstevel@tonic-gate fprintf(stderr,
2220Sstevel@tonic-gate gettext("-h needs non-zero number\n"));
2230Sstevel@tonic-gate goerr++;
2240Sstevel@tonic-gate }
2250Sstevel@tonic-gate break;
2260Sstevel@tonic-gate
2270Sstevel@tonic-gate case 's':
2280Sstevel@tonic-gate /*
2290Sstevel@tonic-gate * Give a subject field for sending from
2300Sstevel@tonic-gate * non terminal
2310Sstevel@tonic-gate */
2320Sstevel@tonic-gate mustsend++;
2330Sstevel@tonic-gate sflag = optarg;
2340Sstevel@tonic-gate break;
2350Sstevel@tonic-gate
2360Sstevel@tonic-gate case 'c': /* Cc: from command line */
2370Sstevel@tonic-gate mustsend++;
2380Sstevel@tonic-gate cflag = optarg;
2390Sstevel@tonic-gate break;
2400Sstevel@tonic-gate
2410Sstevel@tonic-gate case 'b': /* Bcc: from command line */
2420Sstevel@tonic-gate mustsend++;
2430Sstevel@tonic-gate bflag = optarg;
2440Sstevel@tonic-gate break;
2450Sstevel@tonic-gate
2460Sstevel@tonic-gate case 'f':
2470Sstevel@tonic-gate /*
2480Sstevel@tonic-gate * User is specifying file to "edit" with mailx,
2490Sstevel@tonic-gate * as opposed to reading system mailbox.
2500Sstevel@tonic-gate * If no argument is given after -f, we read his/her
2510Sstevel@tonic-gate * $MBOX file or mbox in his/her home directory.
2520Sstevel@tonic-gate */
2530Sstevel@tonic-gate ef = (argc == optind || *argv[optind] == '-')
2540Sstevel@tonic-gate ? "" : argv[optind++];
2550Sstevel@tonic-gate if (*ef && *ef != '/' && *ef != '+')
2560Sstevel@tonic-gate cwd = getcwd(NOSTR, PATHSIZE);
2570Sstevel@tonic-gate break;
2580Sstevel@tonic-gate
2590Sstevel@tonic-gate case 'F':
2600Sstevel@tonic-gate Fflag++;
2610Sstevel@tonic-gate mustsend++;
2620Sstevel@tonic-gate break;
2630Sstevel@tonic-gate
2640Sstevel@tonic-gate case 'n':
2650Sstevel@tonic-gate /*
2660Sstevel@tonic-gate * User doesn't want to source
2670Sstevel@tonic-gate * /etc/mail/mailx.rc
2680Sstevel@tonic-gate */
2690Sstevel@tonic-gate nosrc++;
2700Sstevel@tonic-gate break;
2710Sstevel@tonic-gate
2720Sstevel@tonic-gate case 'N':
2730Sstevel@tonic-gate /*
2740Sstevel@tonic-gate * Avoid initial header printing.
2750Sstevel@tonic-gate */
2760Sstevel@tonic-gate noheader++;
2770Sstevel@tonic-gate break;
2780Sstevel@tonic-gate
2790Sstevel@tonic-gate case 'H':
2800Sstevel@tonic-gate /*
2810Sstevel@tonic-gate * Print headers and exit
2820Sstevel@tonic-gate */
2830Sstevel@tonic-gate Hflag++;
2840Sstevel@tonic-gate break;
2850Sstevel@tonic-gate
2860Sstevel@tonic-gate case 'V':
2870Sstevel@tonic-gate puts(version);
2880Sstevel@tonic-gate return 0;
2890Sstevel@tonic-gate
2900Sstevel@tonic-gate case '~':
2910Sstevel@tonic-gate /*
2920Sstevel@tonic-gate * Permit tildas no matter where
2930Sstevel@tonic-gate * the input is coming from.
2940Sstevel@tonic-gate */
2950Sstevel@tonic-gate assign("escapeok", "");
2960Sstevel@tonic-gate break;
2970Sstevel@tonic-gate
2980Sstevel@tonic-gate case 'v':
2990Sstevel@tonic-gate /*
3000Sstevel@tonic-gate * Send mailer verbose flag
3010Sstevel@tonic-gate */
3020Sstevel@tonic-gate assign("verbose", "");
3030Sstevel@tonic-gate break;
3040Sstevel@tonic-gate
3050Sstevel@tonic-gate case 'B':
3060Sstevel@tonic-gate /*
3070Sstevel@tonic-gate * Don't buffer output
3080Sstevel@tonic-gate * (Line buffered is good enough)
3090Sstevel@tonic-gate */
3100Sstevel@tonic-gate setvbuf(stdout, NULL, _IOLBF, BUFSIZ);
3110Sstevel@tonic-gate setvbuf(stderr, NULL, _IOLBF, BUFSIZ);
3120Sstevel@tonic-gate break;
3130Sstevel@tonic-gate
3140Sstevel@tonic-gate case 't':
3150Sstevel@tonic-gate /*
3160Sstevel@tonic-gate * Like sendmail -t, read headers from text
3170Sstevel@tonic-gate */
3180Sstevel@tonic-gate tflag++;
3190Sstevel@tonic-gate mustsend++;
3200Sstevel@tonic-gate break;
3210Sstevel@tonic-gate
3220Sstevel@tonic-gate case '?':
3230Sstevel@tonic-gate default:
3240Sstevel@tonic-gate goerr++;
3250Sstevel@tonic-gate break;
3260Sstevel@tonic-gate }
3270Sstevel@tonic-gate
3280Sstevel@tonic-gate if (optind != argc)
3290Sstevel@tonic-gate argp = optind;
3300Sstevel@tonic-gate
3310Sstevel@tonic-gate /*
3320Sstevel@tonic-gate * Check for inconsistent arguments.
3330Sstevel@tonic-gate */
3340Sstevel@tonic-gate
3350Sstevel@tonic-gate if (newsflg && ef==NOSTR) {
3360Sstevel@tonic-gate fprintf(stderr, gettext("Need -f with -I flag\n"));
3370Sstevel@tonic-gate goerr++;
3380Sstevel@tonic-gate }
3390Sstevel@tonic-gate if (ef != NOSTR && argp != -1) {
3400Sstevel@tonic-gate fprintf(stderr,
3410Sstevel@tonic-gate gettext("Cannot give -f and people to send to.\n"));
3420Sstevel@tonic-gate goerr++;
3430Sstevel@tonic-gate }
3440Sstevel@tonic-gate if (exitflg && (mustsend || argp != -1))
3450Sstevel@tonic-gate exit(1); /* nonsense flags involving -e simply exit */
3460Sstevel@tonic-gate if (tflag && argp != -1) {
3470Sstevel@tonic-gate fprintf(stderr,
3480Sstevel@tonic-gate gettext("Ignoring recipients on command line with -t\n"));
3490Sstevel@tonic-gate argp = -1;
3500Sstevel@tonic-gate } else if (!tflag && mustsend && argp == -1) {
3510Sstevel@tonic-gate fprintf(stderr,
3520Sstevel@tonic-gate gettext("The flags you gave are used only when sending mail.\n"));
3530Sstevel@tonic-gate goerr++;
3540Sstevel@tonic-gate }
3550Sstevel@tonic-gate if (goerr) {
3560Sstevel@tonic-gate fprintf(stderr,
3570Sstevel@tonic-gate gettext("Usage: %s -eiIUdFntBNHvV~ -T FILE -u USER -h hops -r address\n"),
3580Sstevel@tonic-gate progname);
3590Sstevel@tonic-gate fprintf(stderr,
3600Sstevel@tonic-gate gettext("\t\t-s SUBJECT -f FILE users\n"));
3610Sstevel@tonic-gate exit(1);
3620Sstevel@tonic-gate }
3630Sstevel@tonic-gate tinit();
3640Sstevel@tonic-gate input = stdin;
3650Sstevel@tonic-gate rcvmode = !tflag && argp == -1;
3660Sstevel@tonic-gate if (!nosrc)
3670Sstevel@tonic-gate load(MASTER);
3680Sstevel@tonic-gate
3690Sstevel@tonic-gate if (!rcvmode) {
3700Sstevel@tonic-gate load(Getf("MAILRC"));
3710Sstevel@tonic-gate if (tflag)
3720Sstevel@tonic-gate tmail();
3730Sstevel@tonic-gate else
3740Sstevel@tonic-gate mail(&argv[argp]);
3750Sstevel@tonic-gate exit(senderr ? senderr : rpterr);
3760Sstevel@tonic-gate }
3770Sstevel@tonic-gate
3780Sstevel@tonic-gate /*
3790Sstevel@tonic-gate * Ok, we are reading mail.
3800Sstevel@tonic-gate * Decide whether we are editing a mailbox or reading
3810Sstevel@tonic-gate * the system mailbox, and open up the right stuff.
3820Sstevel@tonic-gate *
3830Sstevel@tonic-gate * Do this before sourcing the MAILRC, because there might be
3840Sstevel@tonic-gate * a 'chdir' there that breaks the -f option. But if the
3850Sstevel@tonic-gate * file specified with -f is a folder name, go ahead and
3860Sstevel@tonic-gate * source the MAILRC anyway so that "folder" will be defined.
3870Sstevel@tonic-gate */
3880Sstevel@tonic-gate
3890Sstevel@tonic-gate nstrcpy(origname, PATHSIZE, mailname);
3900Sstevel@tonic-gate editfile = mailname;
3910Sstevel@tonic-gate
3920Sstevel@tonic-gate if (ef != NOSTR) {
3930Sstevel@tonic-gate if (ef == NOSTR || *ef == '\0' || *ef == '+') {
3940Sstevel@tonic-gate load(Getf("MAILRC"));
3950Sstevel@tonic-gate loaded++;
3960Sstevel@tonic-gate }
3970Sstevel@tonic-gate ef = *ef ? safeexpand(ef) : Getf("MBOX");
3980Sstevel@tonic-gate nstrcpy(origname, PATHSIZE, ef);
3990Sstevel@tonic-gate if (ef[0] != '/') {
4000Sstevel@tonic-gate if (cwd == NOSTR)
4010Sstevel@tonic-gate cwd = getcwd(NOSTR, PATHSIZE);
4020Sstevel@tonic-gate nstrcat(cwd, PATHSIZE, "/");
4030Sstevel@tonic-gate nstrcat(cwd, PATHSIZE, ef);
4040Sstevel@tonic-gate ef = cwd;
4050Sstevel@tonic-gate }
4060Sstevel@tonic-gate editfile = ef;
4070Sstevel@tonic-gate edit++;
4080Sstevel@tonic-gate }
4090Sstevel@tonic-gate
4100Sstevel@tonic-gate if (setfile(editfile, edit) < 0)
4110Sstevel@tonic-gate exit(1);
4120Sstevel@tonic-gate
4130Sstevel@tonic-gate if (!loaded)
4140Sstevel@tonic-gate load(Getf("MAILRC"));
4150Sstevel@tonic-gate if (msgCount > 0 && !noheader && value("header") != NOSTR) {
4160Sstevel@tonic-gate if (setjmp(hdrjmp) == 0) {
4170Sstevel@tonic-gate if ((prevint = sigset(SIGINT, SIG_IGN)) != SIG_IGN)
4180Sstevel@tonic-gate sigset(SIGINT, hdrstop);
4190Sstevel@tonic-gate announce();
4200Sstevel@tonic-gate fflush(stdout);
4210Sstevel@tonic-gate sigset(SIGINT, prevint);
4220Sstevel@tonic-gate }
4230Sstevel@tonic-gate }
4240Sstevel@tonic-gate if (Hflag || (!edit && msgCount == 0)) {
4250Sstevel@tonic-gate if (!Hflag) {
4260Sstevel@tonic-gate fprintf(stderr, gettext("No mail for %s\n"), myname);
4270Sstevel@tonic-gate Verhogen();
4280Sstevel@tonic-gate }
4290Sstevel@tonic-gate fflush(stdout);
4300Sstevel@tonic-gate exit(rpterr);
4310Sstevel@tonic-gate }
4320Sstevel@tonic-gate commands();
4330Sstevel@tonic-gate sigset(SIGHUP, SIG_IGN);
4340Sstevel@tonic-gate sigset(SIGINT, SIG_IGN);
4350Sstevel@tonic-gate sigset(SIGQUIT, SIG_IGN);
4360Sstevel@tonic-gate if (!outtty)
4370Sstevel@tonic-gate sigset(SIGPIPE, SIG_IGN);
4380Sstevel@tonic-gate if (edit)
4390Sstevel@tonic-gate edstop(0);
4400Sstevel@tonic-gate else {
4410Sstevel@tonic-gate quit(0);
4420Sstevel@tonic-gate Verhogen();
4430Sstevel@tonic-gate }
44418Srobbin return (rpterr);
4450Sstevel@tonic-gate }
4460Sstevel@tonic-gate
4470Sstevel@tonic-gate /*
4480Sstevel@tonic-gate * Interrupt printing of the headers.
4490Sstevel@tonic-gate */
4500Sstevel@tonic-gate static void
4510Sstevel@tonic-gate #ifdef __cplusplus
hdrstop(int)4520Sstevel@tonic-gate hdrstop(int)
4530Sstevel@tonic-gate #else
4540Sstevel@tonic-gate /* ARGSUSED */
4550Sstevel@tonic-gate hdrstop(int s)
4560Sstevel@tonic-gate #endif
4570Sstevel@tonic-gate {
4580Sstevel@tonic-gate
4590Sstevel@tonic-gate fflush(stdout);
4600Sstevel@tonic-gate fprintf(stderr, gettext("\nInterrupt\n"));
4610Sstevel@tonic-gate # ifdef OLD_BSD_SIGS
4620Sstevel@tonic-gate sigrelse(SIGINT);
4630Sstevel@tonic-gate # endif
4640Sstevel@tonic-gate longjmp(hdrjmp, 1);
4650Sstevel@tonic-gate }
466