From fec0b29826d4007d9916d8584b2b57d5b2473de3 Mon Sep 17 00:00:00 2001 From: Kolja Waschk Date: Thu, 7 Feb 2008 07:18:28 +0000 Subject: [PATCH] Fix 1887179, and add new command line option "-i" git-svn-id: https://urjtag.svn.sourceforge.net/svnroot/urjtag/trunk@999 b68d4a1b-bc3d-0410-92ed-d4ac073336b7 --- jtag/ChangeLog | 6 ++++++ jtag/doc/jtag.1 | 3 +++ jtag/src/jtag.c | 16 +++++++++++----- 3 files changed, 20 insertions(+), 5 deletions(-) diff --git a/jtag/ChangeLog b/jtag/ChangeLog index 3f692d55..aac05684 100644 --- a/jtag/ChangeLog +++ b/jtag/ChangeLog @@ -1,3 +1,9 @@ +2008-02-07 Kolja Waschk + + * src/jtag.c, doc/jtag.1: Fix dropthrough to caller if -n was given + (fixes [1887179] reported by A.Dyer), add command line option "-i" + to run interactive mode even after executing commands from files + 2008-02-07 Arnim Laeuger * src/tap/cable/ft2232.c (ft2232_connect): check parport driver setting diff --git a/jtag/doc/jtag.1 b/jtag/doc/jtag.1 index 6ab47a2b..1c45ba3d 100644 --- a/jtag/doc/jtag.1 +++ b/jtag/doc/jtag.1 @@ -17,6 +17,9 @@ UrJTAG is a software package which enables working with JTAG-aware (IEEE .I \-h, \-\-help Display a short help text and exit .TP +.I \-i, \-\-interactive +Enter interactive mode after executing commands from files (this is the default if no files are named on the command line) +.TP .I \-n, \-\-norc Disable reading ~/.jtag/rc on startup .TP diff --git a/jtag/src/jtag.c b/jtag/src/jtag.c index d3ce9495..44caa1fd 100644 --- a/jtag/src/jtag.c +++ b/jtag/src/jtag.c @@ -336,6 +336,7 @@ main( int argc, char *const argv[] ) int i; int c; int norc = 0; + int interactive = 0; int help = 0; int version = 0; @@ -358,6 +359,7 @@ main( int argc, char *const argv[] ) { {"version", no_argument, 0, 'v'}, {"norc", no_argument, 0, 'n'}, + {"interactive", no_argument, 0, 'i'}, {"help", no_argument, 0, 'h'}, {0, 0, 0, 0} }; @@ -365,7 +367,7 @@ main( int argc, char *const argv[] ) /* `getopt_long' stores the option index here. */ int option_index = 0; - c = getopt_long (argc, argv, "vnh", + c = getopt_long (argc, argv, "vnhi", long_options, &option_index); /* Detect the end of the options. */ @@ -382,6 +384,10 @@ main( int argc, char *const argv[] ) norc = 1; break; + case 'i': + interactive = 1; + break; + case 'h': default: help = 1; @@ -401,10 +407,9 @@ main( int argc, char *const argv[] ) printf (_(" -h, --help display this help and exit\n")); printf (_(" -v, --version display version information and exit\n")); printf ("\n"); - printf (_(" -n, --norc disable reading ~/.jtag/rc on startup\n")); + printf (_(" -i, --interactive enter interactive mode after reading files\n")); printf ("\n"); - printf (_(" [FILE] file containing commands to execute\n")); printf ("\n"); @@ -455,7 +460,8 @@ main( int argc, char *const argv[] ) break; } } - return 0; + + if(!interactive) return 0; } /* input from stdin */ @@ -497,7 +503,7 @@ main( int argc, char *const argv[] ) jtag_create_jtagdir(); /* Parse and execute the RC file */ - if(!norc) go = jtag_parse_rc(); + go = norc ? 1 : jtag_parse_rc(); if (go) {