mdoc version three/bsd copyright
[unix-history] / usr / src / libexec / bugfiler / bugfiler.c
index bace888..5e0a698 100644 (file)
@@ -1,28 +1,34 @@
 /*
 /*
- * Copyright (c) 1983, 1986 Regents of the University of California.
- * All rights reserved.  The Berkeley software License Agreement
- * specifies the terms and conditions for redistribution.
+ * Copyright (c) 1983, 1986, 1987 Regents of the University of California.
+ * All rights reserved.
+ *
+ * %sccs.include.redist.c%
  */
 
 #ifndef lint
 char copyright[] =
  */
 
 #ifndef lint
 char copyright[] =
-"@(#) Copyright (c) 1983, 1986 Regents of the University of California.\n\
+"@(#) Copyright (c) 1983, 1986, 1987 Regents of the University of California.\n\
  All rights reserved.\n";
  All rights reserved.\n";
-#endif not lint
+#endif /* not lint */
 
 #ifndef lint
 
 #ifndef lint
-static char sccsid[] = "@(#)bugfiler.c 5.11 (Berkeley) 87/07/21";
-#endif not lint
+static char sccsid[] = "@(#)bugfiler.c 5.16 (Berkeley) %G%";
+#endif /* not lint */
 
 /*
  * Bug report processing program, designed to be invoked
  * through aliases(5).
  */
 
 /*
  * Bug report processing program, designed to be invoked
  * through aliases(5).
  */
-#include <bug.h>
+#include <sys/param.h>
 #include <sys/time.h>
 #include <sys/time.h>
-#include <sys/file.h>
+#include <sys/stat.h>
+#include <dirent.h>
 #include <pwd.h>
 #include <pwd.h>
+#include <unistd.h>
 #include <stdio.h>
 #include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include "bug.h"
 
 char   bfr[MAXBSIZE],                  /* general I/O buffer */
        tmpname[sizeof(TMP_BUG) + 5];   /* temp bug file */
 
 char   bfr[MAXBSIZE],                  /* general I/O buffer */
        tmpname[sizeof(TMP_BUG) + 5];   /* temp bug file */
@@ -36,9 +42,8 @@ main(argc, argv)
        register int    ch;             /* getopts char */
        int     do_ack,                 /* acknowledge bug report */
                do_redist;              /* redistribut BR */
        register int    ch;             /* getopts char */
        int     do_ack,                 /* acknowledge bug report */
                do_redist;              /* redistribut BR */
-       char    *argversion,            /* folder name provided */
-               *strcpy();
-       struct passwd   *getpwnam();
+       char    *argversion;            /* folder name provided */
+       static void logit(), make_copy();
 
        do_ack = do_redist = YES;
        argversion = NULL;
 
        do_ack = do_redist = YES;
        argversion = NULL;
@@ -55,6 +60,7 @@ main(argc, argv)
                        break;
                case '?':
                default:
                        break;
                case '?':
                default:
+                       fputs("usage: bugfiler [-ar] [-v version]\n", stderr);
                        error("usage: bugfiler [-ar] [-v version]", CHN);
                }
 
                        error("usage: bugfiler [-ar] [-v version]", CHN);
                }
 
@@ -78,7 +84,7 @@ main(argc, argv)
 
        process();
 
 
        process();
 
-       if (setuid(0, 0))
+       if (setuid(0))
                error("can't set id to root.", CHN);
        if (do_ack)
                reply();
                error("can't set id to root.", CHN);
        if (do_ack)
                reply();
@@ -92,17 +98,15 @@ main(argc, argv)
  * make_copy --
  *     make a copy of bug report in error folder
  */
  * make_copy --
  *     make a copy of bug report in error folder
  */
-static
+static void
 make_copy()
 {
        register int    cnt,                    /* read return value */
                        tfd;                    /* temp file descriptor */
        char    *strcpy();
 
 make_copy()
 {
        register int    cnt,                    /* read return value */
                        tfd;                    /* temp file descriptor */
        char    *strcpy();
 
-       if (access(TMP_DIR, F_OK)) {
-               (void)mkdir(TMP_DIR);
-               (void)chmod(TMP_DIR, 0775);
-       }
+       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)
        (void)strcpy(tmpname, TMP_BUG);
        if (tfd = mkstemp(tmpname)) {
                while ((cnt = read(fileno(stdin), bfr, sizeof(bfr))) != ERR && cnt)
@@ -117,7 +121,7 @@ make_copy()
  * logit --
  *     log this run of the bugfiler
  */
  * logit --
  *     log this run of the bugfiler
  */
-static
+static void
 logit()
 {
        struct timeval  tp;
 logit()
 {
        struct timeval  tp;