pretty_print(char *string)
{
char *s = NULL;
- if (((s = index(string, '\n')) == NULL) && (strlen(string) < 60)) {
+ if (((s = strchr(string, '\n')) == NULL) && (strlen(string) < 60)) {
printf("%s\n", string);
return;
} else
printf(" %s\n", string);
*s = '\n';
string = s + 1;
- s = index(string, '\n');
+ s = strchr(string, '\n');
}
printf(" %s\n", string);
}
if ((l = strdup(location)) == NULL)
fatal(NULL);
s = l;
- if ((e = index(s, ':')) == NULL)
+ if ((e = strchr(s, ':')) == NULL)
goto invalid_location;
*e = '\0';
type = atoi(s);
/* Latitude and longitude */
for (i = 0; i < 2; i++) {
s = e+1;
- if ((e = index(s, ':')) == NULL)
+ if ((e = strchr(s, ':')) == NULL)
goto invalid_location;
*e = '\0';
ll = atof(s);
s = e + 1;
- if ((e = index(s, ':')) == NULL)
+ if ((e = strchr(s, ':')) == NULL)
goto invalid_location;
*e = '\0';
intpart = (int)ll;
/* Altitude */
s = e+1;
- if ((e = index(s, ':')) == NULL)
+ if ((e = strchr(s, ':')) == NULL)
goto invalid_location;
*e = '\0';
altitude = atof(s);
s = e+1;
- if ((e = index(s, ':')) == NULL)
+ if ((e = strchr(s, ':')) == NULL)
goto invalid_location;
*e = '\0';
if (altitude < 0) {
/* Datum */
s = e + 1;
- if (index(s, ':') != NULL)
+ if (strchr(s, ':') != NULL)
goto invalid_location;
*(u_int8_t *)data = atoi(s);
break;
/* Civic address */
port->p_med_location[1].data_len = 4;
s = e+1;
- if ((s = index(s, ':')) == NULL)
+ if ((s = strchr(s, ':')) == NULL)
goto invalid_location;
s = s+1;
do {
- if ((s = index(s, ':')) == NULL)
+ if ((s = strchr(s, ':')) == NULL)
break;
s = s+1;
/* s is the beginning of the word */
- if ((n = index(s, ':')) == NULL)
+ if ((n = strchr(s, ':')) == NULL)
n = s + strlen(s);
/* n is the end of the word */
port->p_med_location[1].data_len += (n - s) + 2;
- if ((s = index(s, ':')) == NULL)
+ if ((s = strchr(s, ':')) == NULL)
break;
s = s+1;
} while (1);
data++;
*(u_int8_t *)data = 2; /* Client location */
data++;
- if ((e = index(s, ':')) == NULL)
+ if ((e = strchr(s, ':')) == NULL)
goto invalid_location;
if ((e - s) != 2)
goto invalid_location;
data += 2;
while (*e != '\0') {
s=e+1;
- if ((e = index(s, ':')) == NULL)
+ if ((e = strchr(s, ':')) == NULL)
goto invalid_location;
*e = '\0';
*(u_int8_t *)data = atoi(s);
data++;
s=e+1;
- if ((e = index(s, ':')) == NULL)
+ if ((e = strchr(s, ':')) == NULL)
e = s + strlen(s);
*(u_int8_t *)data = e - s;
data++;