xref: /csrg-svn/libexec/bugfiler/bug.h (revision 30160)
1*30160Sbostic /*
2*30160Sbostic  * Copyright (c) 1986 Regents of the University of California.
3*30160Sbostic  * All rights reserved.  The Berkeley software License Agreement
4*30160Sbostic  * specifies the terms and conditions for redistribution.
5*30160Sbostic  *
6*30160Sbostic  *	@(#)bug.h	1.1 (Berkeley) 11/25/86
7*30160Sbostic  */
8*30160Sbostic 
9*30160Sbostic #define BUGS_HOME	"owner-bugs@ucbvax.BERKELEY.EDU"
10*30160Sbostic #define BUGS_ID		"bugs"
11*30160Sbostic #define MAIL_CMD	"/usr/lib/sendmail -i -t -F \"Bugs Bunny\" -f owner-bugs@ucbvax.BERKELEY.EDU"
12*30160Sbostic 
13*30160Sbostic /*
14*30160Sbostic  * the METOO definition has the bugfiler exit with an error (-1) status
15*30160Sbostic  * if there's a problem.  Sendmail then mails off a copy of the problem
16*30160Sbostic  * mail to "owner-bugs".  This is great if you would have otherwise lost
17*30160Sbostic  * the bug report.  It's not so great if you get a whole bunch of mail
18*30160Sbostic  * that you really don't want.
19*30160Sbostic  */
20*30160Sbostic #define METOO
21*30160Sbostic 
22*30160Sbostic #include <sys/file.h>
23*30160Sbostic #define GET_LOCK { \
24*30160Sbostic 	if (flock(lfd,LOCK_EX)) { \
25*30160Sbostic 		perror(LOCK_FILE); \
26*30160Sbostic 		exit(ERR); \
27*30160Sbostic 	} \
28*30160Sbostic }
29*30160Sbostic 
30*30160Sbostic #define REL_LOCK { \
31*30160Sbostic 	if (flock(lfd,LOCK_UN)) { \
32*30160Sbostic 		perror(LOCK_FILE); \
33*30160Sbostic 		exit(ERR); \
34*30160Sbostic 	} \
35*30160Sbostic }
36*30160Sbostic 
37*30160Sbostic /* files */
38*30160Sbostic #define ACK_FILE	".ack"			/* acknowledge file */
39*30160Sbostic #define DEF_DIR		"mail"			/* top-level directory */
40*30160Sbostic #define DIST_FILE	".redist"		/* redistribution file */
41*30160Sbostic #define ERROR_FILE	"log"			/* error file */
42*30160Sbostic #define LOCK_FILE	"bug:lock"		/* lock file name */
43*30160Sbostic #define SUMMARY_FILE	"summary"		/* summary file */
44*30160Sbostic #define TMP_BUG		"errors/BUG_XXXXXX"	/* tmp bug report */
45*30160Sbostic #define TMP_FILE	"/tmp/BUG_XXXXXX"	/* tmp file name */
46*30160Sbostic 
47*30160Sbostic /* permissions */
48*30160Sbostic #define DIR_MODE	0750		/* directory creation mode */
49*30160Sbostic #define FILE_MODE	0644		/* file creation mode */
50*30160Sbostic 
51*30160Sbostic #define CHN		(char *)NULL	/* null arg string */
52*30160Sbostic #define COMMENT		'#'		/* comment in redist file */
53*30160Sbostic #define EOS		(char)NULL	/* end of string */
54*30160Sbostic #define ERR		-1		/* error return */
55*30160Sbostic #define MAXLINELEN	200		/* max line length in message */
56*30160Sbostic #define NO		0		/* no/false */
57*30160Sbostic #define OK		0		/* okay return */
58*30160Sbostic #define YES		1		/* yes/true */
59*30160Sbostic 
60*30160Sbostic typedef struct {
61*30160Sbostic 	short	found,			/* line number if found */
62*30160Sbostic 		redist;			/* if part of redist headers */
63*30160Sbostic 	int	(*valid)();		/* validation routine */
64*30160Sbostic 	short	len;			/* length of tag */
65*30160Sbostic 	char	*tag,			/* leading tag */
66*30160Sbostic 		*line;			/* actual line */
67*30160Sbostic } HEADER;
68*30160Sbostic 
69*30160Sbostic #define DATE_TAG	0		/* "Date:" offset */
70*30160Sbostic #define FROM_TAG	1		/* "From " offset */
71*30160Sbostic #define CFROM_TAG	2		/* "From:" offset */
72*30160Sbostic #define INDX_TAG	3		/* "Index:" offset */
73*30160Sbostic #define MSG_TAG		4		/* "Message-Id:" offset */
74*30160Sbostic #define RPLY_TAG	5		/* "Reply-To:" offset */
75*30160Sbostic #define RET_TAG		6		/* "Return-Path:" offset */
76*30160Sbostic #define SUBJ_TAG	7		/* "Subject:" offset */
77*30160Sbostic #define TO_TAG		8		/* "To:" offset */
78*30160Sbostic 
79*30160Sbostic /* so sizeof doesn't return 0 */
80*30160Sbostic #include <sys/param.h>
81*30160Sbostic extern char	bfr[MAXBSIZE];		/* general I/O buffer */
82