diff --git a/libexec/bugfiler/Makefile b/libexec/bugfiler/Makefile deleted file mode 100644 index 90018001ce10..000000000000 --- a/libexec/bugfiler/Makefile +++ /dev/null @@ -1,18 +0,0 @@ -# from: @(#)Makefile 5.17 (Berkeley) 5/24/90 -# $Id: Makefile,v 1.4 1993/08/01 05:39:43 mycroft Exp $ - -PROG= bugfiler -CFLAGS+=-I${.CURDIR} -D"BUGS_HOME=\"owner-386bsd_bugs@sun-lamp.cs.berkeley.edu\"" -SRCS= bugfiler.c error.c gethead.c process.c redist.c reply.c -BINOWN= root -BINMODE=4555 -MAN1= sendbug.0 -MAN8= bugfiler.0 - -beforeinstall: - install -c -o bin -g ${BINGRP} -m 555 \ - ${.CURDIR}/sendbug.sh ${DESTDIR}/usr/bin/sendbug - install -c -o bin -g ${BINGRP} -m 444 ${.CURDIR}/bugformat \ - ${DESTDIR}/usr/share/misc - -.include diff --git a/libexec/bugfiler/bug.h b/libexec/bugfiler/bug.h deleted file mode 100644 index ca25362b6462..000000000000 --- a/libexec/bugfiler/bug.h +++ /dev/null @@ -1,97 +0,0 @@ -/* - * Copyright (c) 1986, 1987 Regents of the University of California. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * from: @(#)bug.h 5.10 (Berkeley) 2/25/91 - * $Id: bug.h,v 1.3 1993/08/01 18:31:30 mycroft Exp $ - * - * 4/01/93 Fixed BUGS_HOME so it can be defined from the Makefile - rgrimes - */ - -#ifndef BUGS_HOME -#define BUGS_HOME "owner-bugs@ucbvax.Berkeley.EDU" -#endif /* BUGS_HOME */ -#define BUGS_ID "bugs" - -/* - * the METOO definition has the bugfiler exit with an error (-1) status - * if there's a problem. This causes sendmail to send off a copy of the - * report (as failed mail) to the "owner" of the mail alias that executed - * the bugfiler. This is great if you would have otherwise lost the bug - * report. It's not so great if you get a whole bunch of mail that you - * really don't want. - */ -#define METOO - -/* files */ -#define ACK_FILE "bug:ack" /* acknowledge file */ -#define DIST_FILE "bug:redist" /* redistribution file */ -#define ERROR_FILE "log" /* error file */ -#define LOCK_FILE "bug:lock" /* lock file name */ -#define SUMMARY_FILE "summary" /* summary file */ -#define TMP_BUG "errors/BUG_XXXXXX" /* tmp bug report */ -#define TMP_DIR "errors" /* tmp directory */ - -#define CHN (char *)NULL /* null arg string */ -#define COMMENT '#' /* comment in redist file */ -#define EOS (char)NULL /* end of string */ -#define ERR -1 /* error return */ -#define MAXLINELEN 200 /* max line length in message */ -#define NO 0 /* no/false */ -#define OK 0 /* okay return */ -#define YES 1 /* yes/true */ - -typedef struct { - short found, /* line number if found */ - redist; /* if part of redist headers */ - int (*valid)(); /* validation routine */ - short len; /* length of tag */ - char *tag, /* leading tag */ - *line; /* actual line */ -} HEADER; -extern HEADER mailhead[]; - -#define DATE_TAG 0 /* "Date:" offset */ -#define FROM_TAG 1 /* "From " offset */ -#define CFROM_TAG 2 /* "From:" offset */ -#define INDX_TAG 3 /* "Index:" offset */ -#define MSG_TAG 4 /* "Message-Id:" offset */ -#define RPLY_TAG 5 /* "Reply-To:" offset */ -#define RET_TAG 6 /* "Return-Path:" offset */ -#define SUBJ_TAG 7 /* "Subject:" offset */ -#define TO_TAG 8 /* "To:" offset */ -#define APPAR_TO_TAG 9 /* "Apparently-To:" offset */ - -/* so sizeof doesn't return 0 */ -extern char bfr[MAXBSIZE], /* general I/O buffer */ - dir[MAXNAMLEN], /* subject and folder */ - folder[MAXNAMLEN], - tmpname[sizeof(TMP_BUG) + 5]; /* temp bug file */ diff --git a/libexec/bugfiler/bugfiler.8 b/libexec/bugfiler/bugfiler.8 deleted file mode 100644 index 0e547deed035..000000000000 --- a/libexec/bugfiler/bugfiler.8 +++ /dev/null @@ -1,295 +0,0 @@ -.\" Copyright (c) 1983, 1991 The Regents of the University of California. -.\" All rights reserved. -.\" -.\" Redistribution and use in source and binary forms, with or without -.\" modification, are permitted provided that the following conditions -.\" are met: -.\" 1. Redistributions of source code must retain the above copyright -.\" notice, this list of conditions and the following disclaimer. -.\" 2. Redistributions in binary form must reproduce the above copyright -.\" notice, this list of conditions and the following disclaimer in the -.\" documentation and/or other materials provided with the distribution. -.\" 3. All advertising materials mentioning features or use of this software -.\" must display the following acknowledgement: -.\" This product includes software developed by the University of -.\" California, Berkeley and its contributors. -.\" 4. Neither the name of the University nor the names of its contributors -.\" may be used to endorse or promote products derived from this software -.\" without specific prior written permission. -.\" -.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND -.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE -.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -.\" SUCH DAMAGE. -.\" -.\" from: @(#)bugfiler.8 6.11 (Berkeley) 3/16/91 -.\" $Id: bugfiler.8,v 1.2 1993/08/01 07:40:30 mycroft Exp $ -.\" -.Dd March 16, 1991 -.Dt BUGFILER 8 -.Os BSD 4.2 -.Sh NAME -.Nm bugfiler -.Nd file bug reports in folders automatically -.Sh SYNOPSIS -.Nm bugfiler -.Op Fl ar -.Op Fl v Ar version -.Sh DESCRIPTION -.Nm Bugfiler -is a program to automatically intercept, acknowledge, -redistribute and store bug reports. -.Nm Bugfiler -is normally invoked -by the mail delivery program with a line similar to the following in -.Pa /etc/aliases . -.Bd -literal -offset indent -bugs: "|bugfiler" -.Ed -.Pp -It should be noted that the login -.Dq bugs -must exist for the bugfiler -to run. Unless otherwise noted all paths used by -.Nm bugfiler -are -relative to the home directory of this login. -.Nm Bugfiler -also -expects all of its files and directories to be owned by -.Dq bugs . -.Pp -Available options. -.Bl -tag -width Ds -.It Fl a -Do not send automatic mail acknowledgement to the bug report filer. -(The default is to send the acknowledgement with the file -.Pa ~bugs/version/bug:ack -appended). -.It Fl r -Do not redistribute. -.It Fl v Ar version -Override the -.Ar version -provided within the bug report itself. -.El -.Pp -For the bug report to be correctly filed, it must contain a line -in the following format: -.Pp -.Bd -filled -offset indent -compact -.Bl -column Index folder -.It Index: Ta Em folder Ta Ar version -.El -.Ed -.Pp -The directories -.Pa ~bugs/ Ns Ar version -and -.Pa ~bugs/ Ns Ar version/ Ns Em folder -must exist before -.Nm bugfiler -attempts to store the bug report. Bug -reports will be stored in files named by the concatenation of -.Ar version , -.Em folder , -and sequential numbers, i.e. if -.Ar version -is -.Dq 4.3 Tn BSD -and -.Em folder -is -.Dq ucb -the first bug report will be placed in -.Pa ~bugs/4.3BSD/ucb/1 . -If -.Em folder -contains more than one component only -the first one will be used, e.g. if -.Em folder -is -.Dq bin/from.c -or -.Dq bin/adb/con.c -it will be treated as if it were simply -.Dq bin . -.Pp -.Pp -If the -.Fl r -flag is not supplied, redistribution of the bug reports -is done as specified in the file -.Pa ~bugs/version/bug:redist . -This file -is in the format of the -.Xr aliases 5 -file, including comments and -entries requiring multiple lines, with the single exception that the -.Em folder -component of the -.Dq Index: -line replaces the name to alias. -The special folder -.Dq all: -receives a redistribution of all bug reports -sent to this -.Ar version . -For example, the -.Pa bug:redist -file -.Pp -.Bd -literal -offset indent -compact -# bigbug gets a copy of everything -all: bigbug -# ucb folder redistribution list -ucb: karels, kjd@coke.berkeley.edu - ra@beno.css.gov -.Ed -.Pp -will send copies of all bug reports with -.Dq ucb -as the -.Em folder -to bigbug, karels, kjd, and ra. -.Pp -Reports that cannot be filed, due to an invalid -.Dq Index: -line or -some other error, are placed in the directory -.Pa ~bugs/errors . -The -.Nm bugfiler -maintainer should correct these bug reports and then -run -.Nm bugfiler , -with the corrected report as its standard input, -as bug reports with errors are neither acknowledged or redistributed. -All reports that -.Nm bugfiler -handles are logged in -.Pa ~bugs/log. -.Pp -Valid bugs are also logged in the file -.Pa ~bugs/version/summary. -This file has an entry for each bug report for -.Ar version -in the -format: -.Pp -.Bd -literal -offset indent -compact -Filename Date - Subject: - Index: - Owner: Bugs Bunny - Status: Received -.Ed -.Pp -.Li Filename -is the concatenation of -.Ar version , -.Em folder , -and a number -as described above. -.Xr Date -is the date as reported by the system -clock, using -.Xr ctime 3 . -.Li The Subject: -and -.Li Index: -lines are -The -.Dq Subject: -and -.Dq Index: -lines are -copies of the -.Dq Subject: -and -.Dq index: -lines contained in the bug -report. The -.Li Owner -and -.Li Status -fields are intended to provide a -rudimentary method of tracking the status of bug reports. -.Pp -The file -.Pa ~bugs/bug:lock -is the focus of all locking for -.Nm bugfiler . -If you wish to manipulate any of the log or error files, rename or remove -it and -.Nm bugfiler -will treat all bug reports that it receives as if -they were incorrectly formatted, i.e. it will place them in the directory -.Pa ~bugs/errors , -for later recovery by the -.Nm bugfiler -maintainer. -Obviously, this file must be created when you first install -.Nm bugfiler . -.Pp -All errors that occur before -.Pa ~bugs/log -is found are logged into the system -log file, using -.Xr syslog 8 . -.Sh FILES -.Bl -tag -width /usr/share/misc/bugformatxx -compact -.It Pa ~bugs/bug:ack -the acknowledgement message -.It Pa ~bugs/bug:redist -the redistribution list -.It Pa ~bugs/bug:lock -the locking file -.It Pa ~bugs/errors/BUG_?????? -bug reports with format errors -.It Pa ~bugs/log -the log file -.It Pa ~bugs/folder/summary -the summary files -.It Pa /usr/sbin/sendmail -the mail delivery program -.It Pa /usr/share/misc/bugformat -a sample bug report format -.El -.Sh SEE ALSO -.Xr sendbug 1 , -.Xr aliases 5 , -.Xr syslog 8 -.Sh BUGS -Since mail can be forwarded in a number of different ways, -.Nm bugfiler -does not recognize forwarded mail and will acknowledge to the forwarder -instead of the original sender unless there is a -.Dq Reply-To -field in the -header. -.Pp -This version of -.Nm bugfiler -is not compatible with the version -released with -.Bx 4.3 -in that it doesn't complain to the sender about -incorrectly formatted bug reports. -Frankly, we got tired of the profanity, not to mention the extended -conversations -.Nm bugfiler -was holding with -.Xr vacation 1 . -.Sh HISTORY -The -.Nm -command appeared in -.Bx 4.2 . diff --git a/libexec/bugfiler/bugfiler.c b/libexec/bugfiler/bugfiler.c deleted file mode 100644 index 7df9a3cd3c47..000000000000 --- a/libexec/bugfiler/bugfiler.c +++ /dev/null @@ -1,163 +0,0 @@ -/* - * Copyright (c) 1983, 1986, 1987 Regents of the University of California. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#ifndef lint -char copyright[] = -"@(#) Copyright (c) 1983, 1986, 1987 Regents of the University of California.\n\ - All rights reserved.\n"; -#endif /* not lint */ - -#ifndef lint -/*static char sccsid[] = "from: @(#)bugfiler.c 5.16 (Berkeley) 2/25/91";*/ -static char rcsid[] = "$Id: bugfiler.c,v 1.2 1993/08/01 18:31:27 mycroft Exp $"; -#endif /* not lint */ - -/* - * Bug report processing program, designed to be invoked - * through aliases(5). - */ -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "bug.h" - -char bfr[MAXBSIZE], /* general I/O buffer */ - tmpname[sizeof(TMP_BUG) + 5]; /* temp bug file */ - -main(argc, argv) - int argc; - char **argv; -{ - extern char *optarg; /* getopt arguments */ - register struct passwd *pwd; /* bugs password entry */ - register int ch; /* getopts char */ - int do_ack, /* acknowledge bug report */ - do_redist; /* redistribut BR */ - char *argversion; /* folder name provided */ - static void logit(), make_copy(); - - do_ack = do_redist = YES; - argversion = NULL; - while ((ch = getopt(argc, argv, "av:r")) != EOF) - switch((char)ch) { - case 'a': - do_ack = NO; - break; - case 'v': - argversion = optarg; - break; - case 'r': - do_redist = NO; - break; - case '?': - default: - fputs("usage: bugfiler [-ar] [-v version]\n", stderr); - error("usage: bugfiler [-ar] [-v version]", CHN); - } - - if (!(pwd = getpwnam(BUGS_ID))) - error("can't find bugs login.", BUGS_ID); - - if (chdir(pwd->pw_dir)) /* change to bugs home directory */ - error("can't chdir to %s.", pwd->pw_dir); - - if (setreuid(0, pwd->pw_uid)) - error("can't set id to %s.", BUGS_ID); - - (void)umask(02); /* everything is 664 */ - seterr(); /* redirect to log file */ - logit(); /* log report arrival */ - make_copy(); /* save copy in case */ - gethead(do_redist); - - if (argversion) /* specific folder requested */ - (void)strcpy(dir, argversion); - - process(); - - if (setuid(0)) - error("can't set id to root.", CHN); - if (do_ack) - reply(); - if (do_redist) - redist(); - (void)unlink(tmpname); - exit(OK); -} - -/* - * make_copy -- - * make a copy of bug report in error folder - */ -static void -make_copy() -{ - register int cnt, /* read return value */ - tfd; /* temp file descriptor */ - char *strcpy(); - - if (access(TMP_DIR, F_OK)) - (void)mkdir(TMP_DIR, S_IRWXU|S_IRWXG|S_IROTH|S_IXOTH); - (void)strcpy(tmpname, TMP_BUG); - if (tfd = mkstemp(tmpname)) { - while ((cnt = read(fileno(stdin), bfr, sizeof(bfr))) != ERR && cnt) - write(tfd, bfr, cnt); - (void)close(tfd); - return; - } - error("can't make copy using %s.", tmpname); -} - -/* - * logit -- - * log this run of the bugfiler - */ -static void -logit() -{ - struct timeval tp; - char *C1, *C2, - *ctime(); - - if (gettimeofday(&tp, (struct timezone *)NULL)) - error("can't get time of day.", CHN); - for (C1 = C2 = ctime(&tp.tv_sec); *C1 && *C1 != '\n'; ++C1); - *C1 = EOS; - fputs(C2, stderr); -} diff --git a/libexec/bugfiler/bugformat b/libexec/bugfiler/bugformat deleted file mode 100644 index 071827185c24..000000000000 --- a/libexec/bugfiler/bugformat +++ /dev/null @@ -1,39 +0,0 @@ -Subject: Short summary of the problem (please make this meaningful!) -Index: folder 386BSD-0.1.2.3 - -Description: - Detailed description of the problem, suggestion, or complaint. -Repeat-By: - Describe the sequence of events that causes the problem - to occur. If you can provide a shell script or program do - duplicate the problem please do so. -Fix: - Description of how to fix the problem. If you don't know a - fix for the problem, don't include this section. If you can - provide context diffs (diff -c oldfile newfile) please do so. - --------- Remove this line and what's below it, for reference only. -------- - -To ensure that your bug report is handled correctly by bugfiler(8), -you must replace "folder" (on the line above starting with "Index:") -with one of the following values: - - folder ::= bin | doc | etc | games | ideas | include | lib - | libexec | man | misc | sbin | share | sys.386bsd - | usr.bin | usr.sbin - -This value should match the part of directory that the bug is in -under /usr/src. If it appears in more than one directory, use the -first one on the list. If the place that it appears is not on the list -use the "misc" value. If it is a suggestion use the "ideas" value. If -it is a manual page problem use the "man" value. - -If you're not running 386BSD-0.1.2.3, you should also replace -"386BSD-0.1.2.3" on the same line with one of the following values. - - version ::= 386BSD-0.1 | 386BSD-0.1.1 | 386BSD-0.1.2 | 386BSD-0.1.2.1 - | 386BSD-0.1.2.2 | 386BSD-0.1.2.3 - -For example, if your bug concerns the program "/usr/bin/file" and -you're currently running 386BSD-0.1.2.4, you should replace "folder" -with "usr.bin/file", and "386BSD-0.1.2.3" with "386BSD-0.1.2.4". diff --git a/libexec/bugfiler/error.c b/libexec/bugfiler/error.c deleted file mode 100644 index 80eadae63f6d..000000000000 --- a/libexec/bugfiler/error.c +++ /dev/null @@ -1,85 +0,0 @@ -/* - * Copyright (c) 1986, 1987 Regents of the University of California. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#ifndef lint -/*static char sccsid[] = "from: @(#)error.c 5.8 (Berkeley) 2/25/91";*/ -static char rcsid[] = "$Id: error.c,v 1.2 1993/08/01 18:31:25 mycroft Exp $"; -#endif /* not lint */ - -#include -#include -#include -#include -#include -#include "bug.h" - -static short err_redir; /* stderr redirected */ - -/* - * seterr -- - * redirect stderr for error processing - */ -seterr() -{ - if (!freopen(ERROR_FILE, "a", stderr)) - error("can't open error file %s.", ERROR_FILE); - err_redir = YES; -} - -/* - * error -- - * write errors to log file and die - */ -error(fmt, arg) - register char *fmt, - *arg; -{ - static char logmsg[MAXLINELEN]; /* syslog message */ - char *strcpy(), *strcat(); - - if (err_redir) { - /* don't combine these, "fmt" may not require "arg" */ - fprintf(stderr, "\t%s\n\t", tmpname); - fprintf(stderr, fmt, arg); - fputc('\n', stderr); - } - else { - sprintf(logmsg, "bugfiler: %s", fmt); - syslog(LOG_ERR, logmsg, arg); - } -#ifdef METOO - exit(ERR); -#else - exit(OK); -#endif -}