Changeset View
Changeset View
Standalone View
Standalone View
contrib/gdb/gdb/remote-utils.c
Show First 20 Lines • Show All 107 Lines • ▼ Show 20 Lines | sr_scan_args (char *proto, char *args) | ||||
int n; | int n; | ||||
char *p, *q; | char *p, *q; | ||||
/* if no args, then nothing to do. */ | /* if no args, then nothing to do. */ | ||||
if (args == NULL || *args == '\0') | if (args == NULL || *args == '\0') | ||||
return; | return; | ||||
/* scan off white space. */ | /* scan off white space. */ | ||||
for (p = args; isspace (*p); ++p);; | for (p = args; isspace (*p); ++p); | ||||
; | |||||
/* find end of device name. */ | /* find end of device name. */ | ||||
for (q = p; *q != '\0' && !isspace (*q); ++q);; | for (q = p; *q != '\0' && !isspace (*q); ++q); | ||||
; | |||||
/* check for missing or empty device name. */ | /* check for missing or empty device name. */ | ||||
CHECKDONE (p, q); | CHECKDONE (p, q); | ||||
sr_set_device (savestring (p, q - p)); | sr_set_device (savestring (p, q - p)); | ||||
/* look for baud rate. */ | /* look for baud rate. */ | ||||
n = strtol (q, &p, 10); | n = strtol (q, &p, 10); | ||||
/* check for missing or empty baud rate. */ | /* check for missing or empty baud rate. */ | ||||
CHECKDONE (p, q); | CHECKDONE (p, q); | ||||
baud_rate = n; | baud_rate = n; | ||||
/* look for debug value. */ | /* look for debug value. */ | ||||
n = strtol (p, &q, 10); | n = strtol (p, &q, 10); | ||||
/* check for missing or empty debug value. */ | /* check for missing or empty debug value. */ | ||||
CHECKDONE (p, q); | CHECKDONE (p, q); | ||||
sr_set_debug (n); | sr_set_debug (n); | ||||
/* scan off remaining white space. */ | /* scan off remaining white space. */ | ||||
for (p = q; isspace (*p); ++p);; | for (p = q; isspace (*p); ++p); | ||||
; | |||||
/* if not end of string, then there's unrecognized junk. */ | /* if not end of string, then there's unrecognized junk. */ | ||||
if (*p != '\0') | if (*p != '\0') | ||||
usage (proto, p); | usage (proto, p); | ||||
return; | return; | ||||
} | } | ||||
▲ Show 20 Lines • Show All 461 Lines • Show Last 20 Lines |