66 const char *strp = string;
70 if (major) *major = 0;
71 if (minor) *minor = 0;
72 if (micro) *micro = 0;
74 for (; *strp !=
'\0'; ++strp) {
76 while ((*strp !=
'\0') && !isdigit(*strp)) ++strp;
78 if (*strp ==
'\0')
break;
80 nfound = sscanf(strp,
"%d.%d.%d",
81 &version[0], &version[1], &version[2]);
84 nfound = sscanf(strp,
"%d.%d-%d",
85 &version[0], &version[1], &version[2]);
88 if (nfound >= 2)
break;
95 if (major && (nfound >= 1)) *major = version[0];
96 if (minor && (nfound >= 2)) *minor = version[1];
97 if (micro && (nfound >= 3)) *micro = version[2];
117 const char *s1 = *(
const char **)str1;
118 const char *s2 = *(
const char **)str2;
123 while (*s1 && !isdigit(*s1)) s1++;
124 while (*s2 && !isdigit(*s2)) s2++;
128 n1 = strtol(s1, (
char **)&s1, 10);
129 n2 = strtol(s2, (
char **)&s2, 10);
131 if (n1 > n2)
return(1);
132 else if (n1 < n2)
return(-1);
134 else if (*s1)
return(1);
135 else if (*s2)
return(-1);
137 return(strcmp(*(
const char **)str1, *(
const char **)str2));
152 return(strcmp(*(
const char **)str1, *(
const char **)str2));
172 char *copy = strdup(
string);
177 "Could not copy string: '%s'\n"
178 " -> memory allocation error\n",
string);
206 va_start(args, format);
213 "Could not create string for format string: '%s'\n"
214 " -> memory allocation error\n", format);
244 "Could not create string for format string: '%s'\n"
245 " -> memory allocation error\n", format);
270 char *endp = (
char *)NULL;
274 for (strp =
string; *strp !=
'\0'; ++strp) {
276 while(*strp ==
' ') ++strp;
277 if (*strp ==
'\0')
break;
281 while(*endp ==
'*') ++endp;
285 value = strtod(strp, &endp);
291 buffer[nvals] = value;
295 if (*strp ==
'\0')
break;
321 char *endp = (
char *)NULL;
325 for (strp =
string; *strp !=
'\0'; ++strp) {
327 while(*strp ==
' ') ++strp;
328 if (*strp ==
'\0')
break;
332 while(*endp ==
'*') ++endp;
336 value = strtod(strp, &endp);
342 buffer[nvals] = (float)value;
346 if (*strp ==
'\0')
break;
372 char *endp = (
char *)NULL;
376 for (strp =
string; *strp !=
'\0'; ++strp) {
378 while(*strp ==
' ') ++strp;
379 if (*strp ==
'\0')
break;
383 while(*endp ==
'*') ++endp;
387 value = strtol(strp, &endp, 0);
393 buffer[nvals] = (int)value;
397 if (*strp ==
'\0')
break;
423 char *endp = (
char *)NULL;
427 for (strp =
string; *strp !=
'\0'; ++strp) {
429 while(*strp ==
' ') ++strp;
430 if (*strp ==
'\0')
break;
434 while(*endp ==
'*') ++endp;
438 value = strtol(strp, &endp, 0);
444 buffer[nvals] = value;
448 if (*strp ==
'\0')
break;
476 cp = (
char *)strchr(
string,
':');
478 for (cp++; (*cp ==
' ') && (*cp !=
'\0'); cp++);
480 strncpy(buffer, cp, buflen);
481 buffer[buflen-1] =
'\0';
483 cp = (
char *)strrchr(buffer,
'$');
485 for (cp--; (*cp ==
' ') && (cp != buffer); cp--);
512 chrp = &
string[strlen(
string)-1];
513 while (isspace(*chrp) && chrp !=
string) *chrp-- =
'\0';