=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/sendbug/sendbug.c,v retrieving revision 1.58 retrieving revision 1.59 diff -u -r1.58 -r1.59 --- src/usr.bin/sendbug/sendbug.c 2008/10/06 04:58:37 1.58 +++ src/usr.bin/sendbug/sendbug.c 2008/12/14 07:46:24 1.59 @@ -1,4 +1,4 @@ -/* $OpenBSD: sendbug.c,v 1.58 2008/10/06 04:58:37 deraadt Exp $ */ +/* $OpenBSD: sendbug.c,v 1.59 2008/12/14 07:46:24 ray Exp $ */ /* * Written by Ray Lai . @@ -39,17 +39,9 @@ int sendmail(const char *); void template(FILE *); -const char *categories = "system user library documentation kernel " - "alpha amd64 arm hppa i386 m68k m88k mips64 powerpc sh sparc sparc64 vax"; char *version = "4.2"; const char *comment[] = { "", - "<[ non-critical | serious | critical ] (one line)>", - "<[ low | medium | high ] (one line)>", - "", - "<[ sw-bug | doc-bug | change-request | support ] (one line)>", - "", - "", "", "", "" @@ -65,7 +57,7 @@ { extern char *__progname; - fprintf(stderr, "usage: %s [-DLPV]\n", __progname); + fprintf(stderr, "usage: %s [-DPV]\n", __progname); exit(1); } @@ -87,15 +79,11 @@ time_t mtime; FILE *fp; - while ((ch = getopt(argc, argv, "DLPV")) != -1) + while ((ch = getopt(argc, argv, "DPV")) != -1) switch (ch) { case 'D': Dflag = 1; break; - case 'L': - printf("Known categories:\n"); - printf("%s\n\n", categories); - exit(0); case 'P': Pflag = 1; break; @@ -537,31 +525,21 @@ { FILE *fp; size_t len; - int category, class, priority, release, severity, synopsis; + int rval = 0; char *buf; if ((fp = fopen(pathname, "r")) == NULL) { warn("%s", pathname); return (0); } - category = class = priority = release = severity = synopsis = 0; while ((buf = fgetln(fp, &len))) { - if (matchline(">Category:", buf, len)) - category = 1; - else if (matchline(">Class:", buf, len)) - class = 1; - else if (matchline(">Priority:", buf, len)) - priority = 1; - else if (matchline(">Release:", buf, len)) - release = 1; - else if (matchline(">Severity:", buf, len)) - severity = 1; - else if (matchline(">Synopsis:", buf, len)) - synopsis = 1; + if (matchline(">Synopsis:", buf, len)) { + rval = 1; + break; + } } fclose(fp); - return (category && class && priority && release && severity && - synopsis); + return (rval); } void @@ -571,41 +549,24 @@ fprintf(fp, "SENDBUG: Lines starting with `SENDBUG' will" " be removed automatically.\n"); fprintf(fp, "SENDBUG:\n"); - fprintf(fp, "SENDBUG: Choose from the following categories:\n"); - fprintf(fp, "SENDBUG:\n"); - fprintf(fp, "SENDBUG: %s\n", categories); - fprintf(fp, "SENDBUG:\n"); - fprintf(fp, "SENDBUG:\n"); fprintf(fp, "To: %s\n", "gnats@openbsd.org"); fprintf(fp, "Subject: \n"); fprintf(fp, "From: %s\n", pw->pw_name); fprintf(fp, "Cc: %s\n", pw->pw_name); fprintf(fp, "Reply-To: %s\n", pw->pw_name); - fprintf(fp, "X-sendbug-version: %s\n", version); fprintf(fp, "\n"); - fprintf(fp, "\n"); - fprintf(fp, ">Submitter-Id:\tnet\n"); - fprintf(fp, ">Originator:\t%s\n", fullname); - fprintf(fp, ">Organization:\n"); - fprintf(fp, "net\n"); fprintf(fp, ">Synopsis:\t%s\n", comment[0]); - fprintf(fp, ">Severity:\t%s\n", comment[1]); - fprintf(fp, ">Priority:\t%s\n", comment[2]); - fprintf(fp, ">Category:\t%s\n", comment[3]); - fprintf(fp, ">Class:\t\t%s\n", comment[4]); - fprintf(fp, ">Release:\t%s\n", comment[5]); fprintf(fp, ">Environment:\n"); - fprintf(fp, "\t%s\n", comment[6]); fprintf(fp, "\tSystem : %s %s\n", os, rel); fprintf(fp, "\tDetails : %s\n", details); fprintf(fp, "\tArchitecture: %s.%s\n", os, mach); fprintf(fp, "\tMachine : %s\n", mach); fprintf(fp, ">Description:\n"); - fprintf(fp, "\t%s\n", comment[7]); + fprintf(fp, "\t%s\n", comment[1]); fprintf(fp, ">How-To-Repeat:\n"); - fprintf(fp, "\t%s\n", comment[8]); + fprintf(fp, "\t%s\n", comment[2]); fprintf(fp, ">Fix:\n"); - fprintf(fp, "\t%s\n", comment[9]); + fprintf(fp, "\t%s\n", comment[3]); if (!Dflag) dmesg(fp);