Subject: misc/19797: config(8) will print build directory
To: None <gnats-bugs@gnats.netbsd.org>
From: None <tor@stormwall.org>
List: netbsd-bugs
Date: 01/11/2003 13:49:38
>Number:         19797
>Category:       misc
>Synopsis:       config(8) will print build directory
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    misc-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sat Jan 11 13:50:00 PST 2003
>Closed-Date:
>Last-Modified:
>Originator:     Tor Stormwall
>Release:        
>Organization:
>Environment:
NetBSD ring 1.6L NetBSD 1.6L (GENERIC) #0: Sat Jan 11 18:43:34 CET 2003     root@ring:/usr/src/sys/arch/i386/compile/GENERIC i386
>Description:
config(8) does not print the build directory. Creating a help() function instead of using the goto-statements. 
>How-To-Repeat:

>Fix:
--- ../config.orgi/main.c       Sat Jan 11 22:10:23 2003
+++ main.c      Sat Jan 11 22:20:32 2003
@@ -84,6 +84,7 @@
 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);
@@ -147,7 +148,7 @@
                        (void)fputs(
                            "-g is obsolete (use makeoptions DEBUG=\"-g\")\n",
                            stderr);
-                       goto usage;
+                       usage();
 
                case 'p':
                        /*
@@ -177,16 +178,14 @@
 
                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);
-               exit(1);
+               usage();
        }
        conffile = (argc == 1) ? argv[0] : "CONFIG";
        if (firstfile(conffile)) {
@@ -313,8 +312,16 @@
        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);
+       exit(1);
 }
 
 /*

>Release-Note:
>Audit-Trail:
>Unformatted: