From ad76ac32a0d3a2ad6e94f0138248ab00a56a7118 Mon Sep 17 00:00:00 2001 From: Kolja Waschk Date: Tue, 26 Feb 2008 09:35:09 +0000 Subject: [PATCH] [ 1901877 ] allow people to disable startup message git-svn-id: https://urjtag.svn.sourceforge.net/svnroot/urjtag/trunk@1098 b68d4a1b-bc3d-0410-92ed-d4ac073336b7 --- jtag/ChangeLog | 4 ++++ jtag/src/jtag.c | 22 ++++++++++++++++------ 2 files changed, 20 insertions(+), 6 deletions(-) diff --git a/jtag/ChangeLog b/jtag/ChangeLog index dbb7e6bd..291d6f8d 100644 --- a/jtag/ChangeLog +++ b/jtag/ChangeLog @@ -1,3 +1,7 @@ +2008-02-24 Mike Frysinger + + * src/jtag.c: allow people to disable startup message (1901877) + 2008-02-25 Arnim Laeuger * src/bus/fjmem.c (fjmem_bus_new): accept 'len' parameter to suppress diff --git a/jtag/src/jtag.c b/jtag/src/jtag.c index 7a67986a..05d002b0 100644 --- a/jtag/src/jtag.c +++ b/jtag/src/jtag.c @@ -341,7 +341,8 @@ main( int argc, char *const argv[] ) int norc = 0; int help = 0; int version = 0; - + int quiet = 0; + if(geteuid()==0 && getuid()!=0) { printf (_("'%s' must not be run suid root!\n"), "jtag"); @@ -363,13 +364,14 @@ main( int argc, char *const argv[] ) {"norc", no_argument, 0, 'n'}, {"interactive", no_argument, 0, 'i'}, {"help", no_argument, 0, 'h'}, + {"quiet", no_argument, 0, 'q'}, {0, 0, 0, 0} }; /* `getopt_long' stores the option index here. */ int option_index = 0; - c = getopt_long (argc, argv, "vnhi", + c = getopt_long (argc, argv, "vnhiq", long_options, &option_index); /* Detect the end of the options. */ @@ -394,6 +396,10 @@ main( int argc, char *const argv[] ) default: help = 1; break; + + case 'q': + quiet = 1; + break; } } @@ -411,6 +417,7 @@ main( int argc, char *const argv[] ) printf ("\n"); printf (_(" -n, --norc disable reading ~/.jtag/rc on startup\n")); printf (_(" -i, --interactive enter interactive mode after reading files\n")); + printf (_(" -q, --quiet Do not print help on startup\n")); printf ("\n"); printf (_(" [FILE] file containing commands to execute\n")); printf ("\n"); @@ -482,7 +489,8 @@ main( int argc, char *const argv[] ) } /* interactive */ - printf( + if (!quiet) + printf( _("\n%s #%s\n" "Copyright (C) 2002, 2003 ETC s.r.o.\n" "Copyright (C) 2007, 2008 Kolja Waschk and the respective authors\n\n" @@ -490,7 +498,7 @@ main( int argc, char *const argv[] ) "welcome to change it and/or distribute copies of it under certain conditions.\n" "There is absolutely no warranty for %s.\n\n"), PACKAGE_STRING, SVN_REVISION, PACKAGE_NAME, PACKAGE_NAME - ); + ); chain = chain_alloc(); if (!chain) { @@ -498,8 +506,10 @@ main( int argc, char *const argv[] ) return -1; } - printf( _("WARNING: %s may damage your hardware!\n"), PACKAGE_NAME ); - printf( _("Type \"quit\" to exit, \"help\" for help.\n\n") ); + if (!quiet) { + printf( _("WARNING: %s may damage your hardware!\n"), PACKAGE_NAME ); + printf( _("Type \"quit\" to exit, \"help\" for help.\n\n") ); + } /* Create ~/.jtag */ jtag_create_jtagdir();