summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--usr.bin/sendbug/sendbug.c31
1 files changed, 29 insertions, 2 deletions
diff --git a/usr.bin/sendbug/sendbug.c b/usr.bin/sendbug/sendbug.c
index da9e0c17504..45b29a0e8a4 100644
--- a/usr.bin/sendbug/sendbug.c
+++ b/usr.bin/sendbug/sendbug.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sendbug.c,v 1.2 2007/03/23 02:11:00 deraadt Exp $ */
+/* $OpenBSD: sendbug.c,v 1.3 2007/03/23 02:28:14 deraadt Exp $ */
/*
* Written by Ray Lai <ray@cyth.net>.
@@ -37,16 +37,43 @@ const char *categories = "system user library documentation ports kernel "
char os[BUFSIZ], rel[BUFSIZ], mach[BUFSIZ];
char *fullname;
+void
+usage(void)
+{
+ fprintf(stderr, "usage: sendbug [-LP]\n");
+}
+
int
main(int argc, char *argv[])
{
const char *editor, *tmpdir;
char *tmppath = NULL;
- int c, fd, ret = 1;
+ int ch, c, fd, ret = 1;
struct stat sb;
time_t mtime;
FILE *fp;
+ while ((ch = getopt(argc, argv, "LP")) != -1)
+ switch (ch) {
+ case 'L':
+ printf("Known categories:\n");
+ printf("%s\n\n", categories);
+ exit(0);
+ case 'P':
+ if (init() == -1)
+ exit(1);
+ template(stdout);
+ exit(0);
+ default:
+ usage();
+ exit(1);
+ }
+
+ if (argc > 1) {
+ usage();
+ exit(1);
+ }
+
if ((tmpdir = getenv("TMPDIR")) == NULL || tmpdir[0] == '\0')
tmpdir = _PATH_TMP;
if (asprintf(&tmppath, "%s/p.XXXXXXXXXX", tmpdir) == -1) {