[ 972649 ] make jtag more tolerant of case

git-svn-id: https://urjtag.svn.sourceforge.net/svnroot/urjtag/trunk@685 b68d4a1b-bc3d-0410-92ed-d4ac073336b7
master
Kolja Waschk 17 years ago
parent 88b4dec9bd
commit 6097369485

@ -82,19 +82,24 @@ cmd_bit_run( char *params[] )
if (strlen( params[2] ) != 1)
return -1;
switch (params[2][0]) {
case 'I':
case 'I':
case 'i':
type = BSBIT_INPUT;
break;
case 'O':
case 'o':
type = BSBIT_OUTPUT;
break;
case 'B':
case 'b':
type = BSBIT_BIDIR;
break;
case 'C':
case 'c':
type = BSBIT_CONTROL;
break;
case 'X':
case 'x':
type = BSBIT_INTERNAL;
break;
default:
@ -134,7 +139,7 @@ cmd_bit_run( char *params[] )
part->bsbits[bit]->control_value = (params[6][0] == '1') ? 1 : 0;
/* control state */
if ((strlen( params[7] ) != 1) || (params[7][0] != 'Z'))
if (strcasecmp(params[7], "Z"))
return -1;
part->bsbits[bit]->control_state = BSBIT_STATE_Z;

@ -47,7 +47,7 @@ cmd_cable_run( char *params[] )
/* search connection type driver */
for (i = 0; parport_drivers[i]; i++)
if (strcmp( params[1], parport_drivers[i]->type ) == 0)
if (strcasecmp( params[1], parport_drivers[i]->type ) == 0)
break;
if (!parport_drivers[i]) {
printf( _("Unknown connection type: %s\n"), params[1] );

@ -55,9 +55,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
return -1;

@ -46,11 +46,11 @@ cmd_endian_run( char *params[] )
}
if (strcmp( params[1], "little" ) == 0) {
if (strcasecmp( params[1], "little" ) == 0) {
big_endian = 0;
return 1;
}
if (strcmp( params[1], "big" ) == 0) {
if (strcasecmp( params[1], "big" ) == 0) {
big_endian = 1;
return 1;
}

@ -48,11 +48,11 @@ cmd_flashmem_run( char *params[] )
return 1;
}
msbin = strcmp( "msbin", params[1] ) == 0;
msbin = strcasecmp( "msbin", params[1] ) == 0;
if (!msbin && cmd_get_number( params[1], &adr ))
return -1;
f = fopen( params[2], "r" );
f = fopen( params[2], "rb" );
if (!f) {
printf( _("Unable to open file `%s'!\n"), params[2] );
return 1;

@ -42,7 +42,7 @@ cmd_get_run( char *params[] )
if (cmd_params( params ) != 3)
return -1;
if (strcmp( params[1], "signal") != 0)
if (strcasecmp( params[1], "signal") != 0)
return -1;
if (!cmd_test_cable())

@ -58,9 +58,9 @@ cmd_print_run( char *params[] )
}
if (cmd_params( params ) == 2) {
if ((strcmp( params[1], "chain" ) != 0) && (strcmp( params[1], "bus") != 0))
if ((strcasecmp( params[1], "chain" ) != 0) && (strcasecmp( params[1], "bus") != 0))
return -1;
if (strcmp( params[1], "bus") == 0)
if (strcasecmp( params[1], "bus") == 0)
noheader = 1;
}
@ -118,7 +118,7 @@ cmd_print_run( char *params[] )
return 1;
}
if (strcmp( params[1], "chain" ) == 0) {
if (strcasecmp( params[1], "chain" ) == 0) {
parts_print( chain->parts );
return 1;
}

@ -76,7 +76,7 @@ cmd_register_run( char *params[] )
part->data_registers = dr;
/* Boundary Scan Register */
if (strcmp( dr->name, "BSR" ) == 0) {
if (strcasecmp( dr->name, "BSR" ) == 0) {
int i;
part->boundary_length = len;
@ -90,7 +90,7 @@ cmd_register_run( char *params[] )
}
/* Device Identification Register */
if (strcmp( dr->name, "DIR" ) == 0)
if (strcasecmp( dr->name, "DIR" ) == 0)
register_init( dr->out, register_get_string( part->id ) );
return 1;

@ -43,7 +43,7 @@ cmd_set_run( char *params[] )
if (cmd_params( params ) < 4 || cmd_params( params ) > 5)
return -1;
if (strcmp( params[1], "signal" ) != 0)
if (strcasecmp( params[1], "signal" ) != 0)
return -1;
if (!cmd_test_cable())
@ -60,10 +60,10 @@ cmd_set_run( char *params[] )
}
/* direction */
if (strcmp( params[3], "in" ) != 0 && strcmp( params[3], "out" ) != 0)
if (strcasecmp( params[3], "in" ) != 0 && strcasecmp( params[3], "out" ) != 0)
return -1;
dir = (strcmp( params[3], "in" ) == 0) ? 0 : 1;
dir = (strcasecmp( params[3], "in" ) == 0) ? 0 : 1;
if (dir) {
if (cmd_get_number( params[4], &data ))

@ -41,11 +41,11 @@ cmd_shift_run( char *params[] )
if (!cmd_test_cable())
return 1;
if (strcmp( params[1], "ir" ) == 0) {
if (strcasecmp( params[1], "ir" ) == 0) {
chain_shift_instructions( chain );
return 1;
}
if (strcmp( params[1], "dr" ) == 0) {
if (strcasecmp( params[1], "dr" ) == 0) {
chain_shift_data_registers( chain, 1 );
return 1;
}

@ -111,7 +111,7 @@ part_find_instruction( part_t *p, const char *iname )
i = p->instructions;
while (i) {
if (strcmp( iname, i->name ) == 0)
if (strcasecmp( iname, i->name ) == 0)
break;
i = i->next;
}
@ -129,7 +129,7 @@ part_find_data_register( part_t *p, const char *drname )
dr = p->data_registers;
while (dr) {
if (strcmp( drname, dr->name ) == 0)
if (strcasecmp( drname, dr->name ) == 0)
break;
dr = dr->next;
}

@ -152,6 +152,7 @@ static cable_t *
direct_connect( const char **par, int parnum )
{
int i;
long int port_scan_val;
unsigned int port;
port_node_t *pn = ports;
parport_t *parport;
@ -162,11 +163,16 @@ direct_connect( const char **par, int parnum )
return NULL;
}
if ((sscanf( par[0], "0x%x", &port ) != 1) && (sscanf( par[0], "%d", &port ) != 1)) {
port_scan_val = strtol(par[0], NULL, 0);
// if ((sscanf( par[0], "0x%x", &port ) != 1) && (sscanf( par[0], "%d", &port ) != 1)) {
if (port_scan_val < 0 || (port_scan_val + 3) > 0xffff) {
printf( _("Invalid port address!\n") );
return NULL;
}
port = (unsigned int )port_scan_val;
while (pn)
for (pn = ports; pn; pn = pn->next) {
unsigned int aport;
@ -179,13 +185,13 @@ direct_connect( const char **par, int parnum )
}
}
if (strcmp( par[1], "none" ) == 0) {
if (strcasecmp( par[1], "none" ) == 0) {
printf( _("Changed cable to 'none'\n") );
return NULL;
}
for (i = 0; cable_drivers[i]; i++)
if (strcmp( par[1], cable_drivers[i]->name ) == 0)
if (strcasecmp( par[1], cable_drivers[i]->name ) == 0)
break;
if (!cable_drivers[i]) {

@ -126,7 +126,7 @@ ppdev_connect( const char **par, int parnum )
break;
}
if (strcmp( par[1], "none" ) == 0) {
if (strcasecmp( par[1], "none" ) == 0) {
printf( _("Changed cable to 'none'\n") );
return NULL;
}

Loading…
Cancel
Save