summaryrefslogtreecommitdiff
path: root/usr.bin/sendbug/sendbug.c
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2007-03-23 02:28:15 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2007-03-23 02:28:15 +0000
commit2d704b1cb791b24cdc6ab056f0b127eceec2ec49 (patch)
tree3147669d0836c6926a890c1dab02e3cd2e105cfe /usr.bin/sendbug/sendbug.c
parent5dc89c88785eae07a367cea62f4dde587e6646d1 (diff)
handle the -L and -P options; ok ray
Diffstat (limited to 'usr.bin/sendbug/sendbug.c')
-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) {