diff options
author | Marc Espie <espie@cvs.openbsd.org> | 2013-10-29 15:37:57 +0000 |
---|---|---|
committer | Marc Espie <espie@cvs.openbsd.org> | 2013-10-29 15:37:57 +0000 |
commit | 31ed7e18b08e745aaa31739e2586a3e286ffc7a8 (patch) | |
tree | 690fe4f21ad348ea543ccff13a55a7dcd0d3f2f9 /usr.sbin/config/main.c | |
parent | d27d2bbd07142ea16543bca223129a40fb06f6d2 (diff) |
emit an extra "config" convenience target that allows one
to rerun config without changing directories.
Lots of inputs by deraadt@, who wanted it to work for movable
relative directories.
Diffstat (limited to 'usr.sbin/config/main.c')
-rw-r--r-- | usr.sbin/config/main.c | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/usr.sbin/config/main.c b/usr.sbin/config/main.c index 531c2438915..e1926c7b984 100644 --- a/usr.sbin/config/main.c +++ b/usr.sbin/config/main.c @@ -1,4 +1,4 @@ -/* $OpenBSD: main.c,v 1.44 2012/06/22 22:02:29 guenther Exp $ */ +/* $OpenBSD: main.c,v 1.45 2013/10/29 15:37:56 espie Exp $ */ /* $NetBSD: main.c,v 1.22 1997/02/02 21:12:33 thorpej Exp $ */ /* @@ -93,13 +93,19 @@ usage(void) exit(1); } +int pflag = 0; +char *sflag = NULL; +char *bflag = NULL; +char *startdir; + int main(int argc, char *argv[]) { char *p; const char *last_component; char *outfile = NULL; - int pflag, ch, eflag, uflag, fflag; + int ch, eflag, uflag, fflag; + char dirbuffer[PATH_MAX]; pflag = eflag = uflag = fflag = 0; while ((ch = getopt(argc, argv, "egpfb:s:o:u")) != -1) { @@ -148,10 +154,12 @@ main(int argc, char *argv[]) break; case 'b': + bflag = optarg; builddir = optarg; break; case 's': + sflag = optarg; srcdir = optarg; break; @@ -163,7 +171,15 @@ main(int argc, char *argv[]) argc -= optind; argv += optind; if (argc > 1 || (eflag && argv[0] == NULL)) + usage(); + if (bflag) { + startdir = getcwd(dirbuffer, sizeof dirbuffer); + if (startdir == NULL) + warn("Use of -b and can't getcwd, no make config"); + } else { + startdir = "../../conf"; + } if (eflag) { #ifdef MAKE_BOOTSTRAP |