From 7235c776e441772c85cd80e12135440a701fc7a1 Mon Sep 17 00:00:00 2001 From: Emanuele Aliberti Date: Sun, 10 Dec 2000 16:23:15 +0000 Subject: [PATCH] I added the -p option to make buildno simply print the current build number, but not generate the reactos/buildno.h file. svn path=/trunk/; revision=1463 --- reactos/apps/utils/buildno/buildno.c | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/reactos/apps/utils/buildno/buildno.c b/reactos/apps/utils/buildno/buildno.c index 11ad3b3b715..933c9d91929 100644 --- a/reactos/apps/utils/buildno/buildno.c +++ b/reactos/apps/utils/buildno/buildno.c @@ -1,4 +1,4 @@ -/* $Id: buildno.c,v 1.4 2000/06/29 23:35:09 dwelch Exp $ +/* $Id: buildno.c,v 1.5 2000/12/10 16:23:15 ea Exp $ * * buildno - Generate the build number for ReactOS * @@ -29,6 +29,9 @@ * 2000-01-22 (ea) * Fixed bugs: tm_year is (current_year - 1900), * tm_month is 0-11 not 1-12 and code ignored TZ. + * 2000-12-10 (ea) + * Added -p option to make it simply print the + * version number, but skip buildno.h generation. */ #include #include @@ -156,7 +159,7 @@ usage (void) { fprintf ( stderr, - "Usage: %s [-q]\n\n -q quiet mode\n", + "Usage: %s [-{p|q}]\n\n -p print version number and exit\n -q run in quiet mode\n", argv0 ); exit (EXIT_SUCCESS); @@ -166,6 +169,7 @@ usage (void) int main (int argc, char * argv []) { + int print_only = FALSE; int quiet = FALSE; int year = 0; @@ -191,6 +195,10 @@ main (int argc, char * argv []) { quiet = TRUE; } + else if (argv[1][1] == 'p') + { + print_only = TRUE; + } else { usage (); @@ -305,9 +313,17 @@ Last release: %4d-%02d-%02d\n", ); } /* - * (Over)write the include file. + * (Over)write the include file, unless + * the user switched on -p. */ - write_h (build); + if (FALSE == print_only) + { + write_h (build); + } + else + { + printf ("%s: no code generated", argv [0]); + } return EXIT_SUCCESS; }