Mon, 16 May 2016 00:01:59 +0200 Jeremie Courreges-Anglas
<[email protected]>
> "trondd" <[email protected]> writes:
>
> > On Sun, May 15, 2016 1:22 pm, Juan Francisco Cantero Hurtado wrote:
> >> On Sun, May 15, 2016 at 06:43:16PM +0200, Jeremie Courreges-Anglas wrote:
> >>> "Ted Unangst" <[email protected]> writes:
> >>>
> >>> > i'm tired of seeing bug reports with no subject. i also get a fair bit
> >>> of spam
> >>> > with no subject and i am easily confused. something is better than
> >>> nothing.
> >>>
> >>> I fear that after that change all bug reports will only have [bug
> >>> report] as Subject. Something that wouldn't catch the eye of people
> >>> that might be able to understand and fix the problem.
> >>
> >
> > Why not make Subject a required field? Might want to also add a comment
> > there like Category and Synopsis have.
>
> I like this idea, but those are not "required" fields. Also I don't
> find the warning message helpful.
>
> Here's a patch that builds up on Tim's diff. Tell the user which fields
> should be filled in, in the order where they are found in the bugreport.
An idea, how about form it Subject: [bugrep] subject, or whatever you
would prefer in the brackets, to discern the subjects when intermixed.
Apologies for not backing this humble useless suggestion with a patch.
> Index: sendbug.c
> ===================================================================
> RCS file: /cvs/src/usr.bin/sendbug/sendbug.c,v
> retrieving revision 1.74
> diff -u -p -p -u -r1.74 sendbug.c
> --- sendbug.c 17 Mar 2016 19:40:43 -0000 1.74
> +++ sendbug.c 15 May 2016 21:53:39 -0000
> @@ -30,7 +30,7 @@
> #define BEGIN64 "begin-base64 "
> #define END64 "===="
>
> -int checkfile(const char *);
> +void checkfile(const char *);
> void debase(void);
> void dmesg(FILE *);
> int editit(const char *);
> @@ -164,8 +164,7 @@ main(int argc, char *argv[])
> errx(1, "report unchanged, nothing sent");
>
> prompt:
> - if (!checkfile(tmppath))
> - fprintf(stderr, "fields are blank, must be filled in\n");
> + checkfile(tmppath);
> c = prompt();
> switch (c) {
> case 'a':
> @@ -508,26 +507,37 @@ matchline(const char *s, const char *lin
> /*
> * Are all required fields filled out?
> */
> -int
> +void
> checkfile(const char *pathname)
> {
> FILE *fp;
> size_t len;
> - int category = 0, synopsis = 0;
> + int category = 0, synopsis = 0, subject = 0;
> char *buf;
>
> if ((fp = fopen(pathname, "r")) == NULL) {
> warn("%s", pathname);
> - return (0);
> + return;
> }
> while ((buf = fgetln(fp, &len))) {
> if (matchline(">Category:", buf, len))
> category = 1;
> else if (matchline(">Synopsis:", buf, len))
> synopsis = 1;
> + else if (matchline("Subject:", buf, len))
> + subject = 1;
> }
> fclose(fp);
> - return (category && synopsis);
> + if (!category || !synopsis || !subject) {
> + fprintf(stderr, "Some fields are blank, please fill them in: ");
> + if (!subject)
> + fprintf(stderr, "Subject ");
> + if (!synopsis)
> + fprintf(stderr, "Synopsis ");
> + if (!category)
> + fprintf(stderr, "Category ");
> + fputc('\n', stderr);
> + }
> }
>
> void
>