From d9791f82a068346b89935bdf4fad95eba64f5bf4 Mon Sep 17 00:00:00 2001 From: jrf Date: Wed, 2 Jul 2003 16:47:53 +0000 Subject: [PATCH] This addresses PR 19797, a small patch made by Tor Stormwall to add a simple print statement showing the build directory location after running config and creating a usage() function instead of using the goto usage statement. Approved by christos@ and thanks to Tor for the suggestions and patch. --- usr.sbin/config/main.c | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/usr.sbin/config/main.c b/usr.sbin/config/main.c index 252488f58e49..ec2b010b22c2 100644 --- a/usr.sbin/config/main.c +++ b/usr.sbin/config/main.c @@ -1,4 +1,4 @@ -/* $NetBSD: main.c,v 1.80 2003/06/27 18:42:11 heas Exp $ */ +/* $NetBSD: main.c,v 1.81 2003/07/02 16:47:53 jrf Exp $ */ /* * Copyright (c) 1992, 1993 @@ -91,6 +91,7 @@ static struct nvlist **nextopt; static struct nvlist **nextmkopt; static struct nvlist **nextfsopt; +static void usage(void); static void dependopts(void); static void do_depend(struct nvlist *); static void stop(void); @@ -158,7 +159,7 @@ main(int argc, char **argv) (void)fputs( "-g is obsolete (use makeoptions DEBUG=\"-g\")\n", stderr); - goto usage; + usage(); case 'p': /* @@ -192,18 +193,14 @@ main(int argc, char **argv) case '?': default: - goto usage; + usage(); } } argc -= optind; argv += optind; if (argc > 1) { - usage: - (void)fputs("usage: config [-Ppv] [-s srcdir] [-b builddir] " - "[sysname]\n", stderr); - (void)fputs(" config -x [kernel-file]\n", stderr); - exit(1); + usage(); } if (xflag && (builddir != NULL || srcdir != NULL || Pflag || pflag || @@ -394,10 +391,20 @@ main(int argc, char **argv) if (mksymlinks() || mkmakefile() || mkheaders() || mkswap() || mkioconf() || (do_devsw ? mkdevsw() : 0) || mkident()) stop(); + (void)printf("Build directory is %s\n", builddir); (void)printf("Don't forget to run \"make depend\"\n"); exit(0); } +static void +usage(void) +{ + (void)fputs("usage: config [-Ppv] [-s srcdir] [-b builddir] " + "[sysname]\n", stderr); + (void)fputs(" config -x [kernel-file]\n", stderr); + exit(1); +} + /* * Set any options that are implied by other options. */