summaryrefslogtreecommitdiff
path: root/usr.bin/sendbug
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2008-10-06 04:58:38 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2008-10-06 04:58:38 +0000
commit109a29e932a80cab04694a851ffe8f725c40d683 (patch)
tree1cd5a0574c75ccc1da66bfc1fa3aa8a4f359c9fc /usr.bin/sendbug
parenta7619a363c6dd7f9584d7311a94986f650cf5e73 (diff)
parse all arguments before going and doing the job requested by -P
(slight change made to check argc == 0) from Daniel Dickman
Diffstat (limited to 'usr.bin/sendbug')
-rw-r--r--usr.bin/sendbug/sendbug.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/usr.bin/sendbug/sendbug.c b/usr.bin/sendbug/sendbug.c
index ba9a5a6f107..bcbafb01115 100644
--- a/usr.bin/sendbug/sendbug.c
+++ b/usr.bin/sendbug/sendbug.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sendbug.c,v 1.57 2008/06/14 20:45:45 pvalchev Exp $ */
+/* $OpenBSD: sendbug.c,v 1.58 2008/10/06 04:58:37 deraadt Exp $ */
/*
* Written by Ray Lai <ray@cyth.net>.
@@ -58,7 +58,7 @@ const char *comment[] = {
struct passwd *pw;
char os[BUFSIZ], rel[BUFSIZ], mach[BUFSIZ], details[BUFSIZ];
char *fullname, *tmppath;
-int Dflag, wantcleanup;
+int Dflag, Pflag, wantcleanup;
__dead void
usage(void)
@@ -97,9 +97,8 @@ main(int argc, char *argv[])
printf("%s\n\n", categories);
exit(0);
case 'P':
- init();
- template(stdout);
- exit(0);
+ Pflag = 1;
+ break;
case 'V':
printf("%s\n", version);
exit(0);
@@ -112,6 +111,12 @@ main(int argc, char *argv[])
if (argc > 0)
usage();
+ if (Pflag) {
+ init();
+ template(stdout);
+ exit(0);
+ }
+
if ((tmpdir = getenv("TMPDIR")) == NULL || tmpdir[0] == '\0')
tmpdir = _PATH_TMP;
if (asprintf(&tmppath, "%s%sp.XXXXXXXXXX", tmpdir,