[BACK]Return to sendbug.c CVS log [TXT][DIR] Up to [local] / src / usr.bin / sendbug

Diff for /src/usr.bin/sendbug/sendbug.c between version 1.9 and 1.10

version 1.9, 2007/03/23 03:30:52 version 1.10, 2007/03/23 03:35:01
Line 47 
Line 47 
 main(int argc, char *argv[])  main(int argc, char *argv[])
 {  {
         const char *editor, *tmpdir;          const char *editor, *tmpdir;
         char *argp[] = {"sh", "-c", NULL, NULL}, *tmppath = NULL;          char *argp[] = {"sh", "-c", NULL, NULL}, *tmppath = NULL, *pr_form;
         int ch, c, fd, ret = 1;          int ch, c, fd, ret = 1;
         struct stat sb;          struct stat sb;
         time_t mtime;          time_t mtime;
Line 94 
Line 94 
         if (init() == -1)          if (init() == -1)
                 goto cleanup;                  goto cleanup;
   
         template(fp);          pr_form = getenv("PR_FORM");
           if (pr_form) {
                   char buf[BUFSIZ];
                   size_t len;
                   FILE *frfp;
   
                   frfp = fopen(pr_form, "r");
                   if (frfp == NULL) {
                           fprintf(stderr, "sendbug: can't seem to read your"
                               " template file (`%s'), ignoring PR_FORM\n",
                               pr_form);
                           template(fp);
                   } else {
                           while (!feof(frfp)) {
                                   len = fread(buf, 1, sizeof buf, frfp);
                                   if (len == 0)
                                           break;
                                   if (fwrite(buf, 1, len, fp) != len)
                                           break;
                           }
                           fclose(frfp);
                   }
           } else
                   template(fp);
   
         if (fflush(fp) == EOF || fstat(fd, &sb) == -1 || fclose(fp) == EOF) {          if (fflush(fp) == EOF || fstat(fd, &sb) == -1 || fclose(fp) == EOF) {
                 warn("error creating template");                  warn("error creating template");

Legend:
Removed from v.1.9  
changed lines
  Added in v.1.10