From cd7ea9388cec77a5f8029b2176677485f4884e6f Mon Sep 17 00:00:00 2001 From: Kolja Waschk Date: Sat, 15 Dec 2007 21:34:41 +0000 Subject: [PATCH] Replaced several strcmps by strcasecmps, fixes 1845811 Case sensitivity in shell git-svn-id: https://urjtag.svn.sourceforge.net/svnroot/urjtag/trunk@848 b68d4a1b-bc3d-0410-92ed-d4ac073336b7 --- jtag/ChangeLog | 4 ++++ jtag/libbrux/cmd/cmd.c | 2 +- jtag/libbrux/cmd/help.c | 2 +- jtag/src/cmd/dr.c | 4 ++-- jtag/src/cmd/initbus.c | 2 +- jtag/src/cmd/instruction.c | 2 +- jtag/src/cmd/part.c | 2 +- jtag/src/cmd/setdevice.c | 2 +- jtag/src/cmd/svf.c | 2 +- jtag/src/cmd/test.c | 2 +- jtag/src/part/part.c | 4 ++-- 11 files changed, 16 insertions(+), 12 deletions(-) diff --git a/jtag/ChangeLog b/jtag/ChangeLog index 6e6d025f..5048d214 100644 --- a/jtag/ChangeLog +++ b/jtag/ChangeLog @@ -7,6 +7,10 @@ patches from F. Rysanek, adding C5 stepping of PXA270 and a few few functions that resolve the PXA270 address space into the 6 default nCS windows per 64MB. (Enhancement req. 1849493) + * cmd/part.c, cmd/setdevice.c, cmd/instruction.c, cmd/svf.c, + cmd/dr.c, cmd/initbus.c, cmd/test.c, part/part.c, libbrux/cmd/cmd.c, + libbrux/cmd/help.c: Make command string comparisons case-insensitive + (fixes 1845811 "Case sensitivity in shell") 2007-12-14 Kolja Waschk diff --git a/jtag/libbrux/cmd/cmd.c b/jtag/libbrux/cmd/cmd.c index a78d3732..4b26bb1e 100644 --- a/jtag/libbrux/cmd/cmd.c +++ b/jtag/libbrux/cmd/cmd.c @@ -38,7 +38,7 @@ cmd_run( char *params[] ) return 1; for (i = 0; cmds[i]; i++) - if (strcmp( cmds[i]->name, params[0] ) == 0) { + if (strcasecmp( cmds[i]->name, params[0] ) == 0) { int r = cmds[i]->run( params ); if (r < 0) printf( _("%s: syntax error!\n"), params[0] ); diff --git a/jtag/libbrux/cmd/help.c b/jtag/libbrux/cmd/help.c index 02b0ad2f..21785d2b 100644 --- a/jtag/libbrux/cmd/help.c +++ b/jtag/libbrux/cmd/help.c @@ -48,7 +48,7 @@ cmd_help_run( char *params[] ) /* search and print help for a particular command */ for (i = 0; cmds[i]; i++) - if (strcmp( cmds[i]->name, params[1] ) == 0) { + if (strcasecmp( cmds[i]->name, params[1] ) == 0) { if (cmds[i]->help) cmds[i]->help(); return 1; diff --git a/jtag/src/cmd/dr.c b/jtag/src/cmd/dr.c index 6dfa18f0..89a4b243 100644 --- a/jtag/src/cmd/dr.c +++ b/jtag/src/cmd/dr.c @@ -64,9 +64,9 @@ cmd_dr_run( char *params[] ) } if (params[1]) { - if (strcmp( params[1], "in" ) == 0) + if (strcasecmp( params[1], "in" ) == 0) dir = 0; - else if (strcmp( params[1], "out" ) == 0) + else if (strcasecmp( params[1], "out" ) == 0) dir = 1; else { unsigned int bit; diff --git a/jtag/src/cmd/initbus.c b/jtag/src/cmd/initbus.c index 27fbf378..c93bc9d0 100644 --- a/jtag/src/cmd/initbus.c +++ b/jtag/src/cmd/initbus.c @@ -53,7 +53,7 @@ cmd_initbus_run( char *params[] ) } for (i = 0; bus_drivers[i] != NULL; i++) { - if (strcmp( bus_drivers[i]->name, params[1] ) == 0) { + if (strcasecmp( bus_drivers[i]->name, params[1] ) == 0) { bus_t *bus = bus_drivers[i]->new_bus(); if (bus == NULL) { printf( _("bus initialization failed!\n") ); diff --git a/jtag/src/cmd/instruction.c b/jtag/src/cmd/instruction.c index 498c1808..11f573d6 100644 --- a/jtag/src/cmd/instruction.c +++ b/jtag/src/cmd/instruction.c @@ -62,7 +62,7 @@ cmd_instruction_run( char *params[] ) if (cmd_params( params ) == 3) { unsigned int len; - if (strcmp( params[1], "length" ) != 0) + if (strcasecmp( params[1], "length" ) != 0) return -1; if (part->instructions != NULL) { diff --git a/jtag/src/cmd/part.c b/jtag/src/cmd/part.c index a531a008..7a21f0ea 100644 --- a/jtag/src/cmd/part.c +++ b/jtag/src/cmd/part.c @@ -68,7 +68,7 @@ part_t *part; for(i=0;iparts->len;i++) { a = chain->parts->parts[i]->alias; - if(a && strcmp(a,params[1]) == 0)break; + if(a && strcasecmp(a,params[1]) == 0)break; } if(i < chain->parts->len)n = i; diff --git a/jtag/src/cmd/setdevice.c b/jtag/src/cmd/setdevice.c index ab63de1f..43281be4 100644 --- a/jtag/src/cmd/setdevice.c +++ b/jtag/src/cmd/setdevice.c @@ -38,7 +38,7 @@ static int cmd_setdevice_run( char *params[] ) { if(cmd_params(params) != 2) return -1; - if (strcmp( params[1], "sharc21065L" ) == 0) + if (strcasecmp( params[1], "sharc21065L" ) == 0) { #if 0 buses_free(); diff --git a/jtag/src/cmd/svf.c b/jtag/src/cmd/svf.c index a058303b..9527ef61 100644 --- a/jtag/src/cmd/svf.c +++ b/jtag/src/cmd/svf.c @@ -42,7 +42,7 @@ cmd_svf_run( char *params[] ) if ((SVF_FILE = fopen(params[1], "r")) != NULL) { if (num_params == 3) { - if (strcmp(params[2], "stop") == 0) { + if (strcasecmp(params[2], "stop") == 0) { svf_run(SVF_FILE, 1); result = 1; } diff --git a/jtag/src/cmd/test.c b/jtag/src/cmd/test.c index cde92e2f..e75f8b77 100644 --- a/jtag/src/cmd/test.c +++ b/jtag/src/cmd/test.c @@ -44,7 +44,7 @@ cmd_test_run( char *params[] ) if (cmd_params( params ) != 4) return -1; - if (strcmp( params[1], "signal") != 0) + if (strcasecmp( params[1], "signal") != 0) return -1; if (!cmd_test_cable()) diff --git a/jtag/src/part/part.c b/jtag/src/part/part.c index 8fd361c3..f49ad5e7 100644 --- a/jtag/src/part/part.c +++ b/jtag/src/part/part.c @@ -150,14 +150,14 @@ part_find_signal( part_t *p, const char *signalname ) s = p->signals; while (s) { - if (strcmp( signalname, s->name ) == 0) + if (strcasecmp( signalname, s->name ) == 0) return s; s = s->next; } sa = p->saliases; while (sa) { - if (strcmp( signalname, sa->name ) == 0) + if (strcasecmp( signalname, sa->name ) == 0) return sa->signal; sa = sa->next; }