Author: uwe Date: 2007-10-03 01:32:21 +0200 (Wed, 03 Oct 2007) New Revision: 2818
Modified: trunk/util/superiotool/superiotool.c Log: Print superiotool version when run with --verbose.
Signed-off-by: Robinson P. Tryon bishop.robinson@gmail.com Acked-by: Uwe Hermann uwe@hermann-uwe.de
Modified: trunk/util/superiotool/superiotool.c =================================================================== --- trunk/util/superiotool/superiotool.c 2007-10-02 15:49:25 UTC (rev 2817) +++ trunk/util/superiotool/superiotool.c 2007-10-02 23:32:21 UTC (rev 2818) @@ -169,10 +169,19 @@ port, inb(port), inb(port + 1)); }
+static void print_version(void) +{ + char tmp[80]; + + strncpy((char *)&tmp, + (const char *)&SUPERIOTOOL_VERSION[6], + strlen(SUPERIOTOOL_VERSION) - 8); + printf("superiotool r%s\n", (char *)&tmp); +} + int main(int argc, char *argv[]) { int i, j, opt, option_index; - char tmp[80];
const static struct option long_options[] = { {"dump", no_argument, NULL, 'd'}, @@ -193,13 +202,12 @@ dump_readable = 1; break; case 'V': + /* Print version in --verbose mode. */ + print_version(); verbose = 1; break; case 'v': - strncpy((char *)&tmp, - (const char *)&SUPERIOTOOL_VERSION[6], - strlen(SUPERIOTOOL_VERSION) - 8); - printf("superiotool r%s\n", (char *)&tmp); + print_version(); exit(0); break; case 'h':