return try;
}
+// strstr but returns pointer after match
+char *strafter(char *haystack, char *needle)
+{
+ char *s = strstr(haystack, needle);
+
+ return s ? s+strlen(needle) : s;
+}
+
// Remove trailing \n
char *chomp(char *s)
{
long atolx_range(char *numstr, long low, long high);
int stridx(char *haystack, char needle);
char *strlower(char *s);
+char *strafter(char *haystack, char *needle);
char *chomp(char *s);
int unescape(char c);
int strstart(char **a, char *b);
xreadfile(name = vmstuff[i], toybuf, sizeof(toybuf));
continue;
- } else {
- if (!(p = strstr(toybuf, vmstuff[i]))) goto error;
- p += strlen(vmstuff[i]);
- }
+ } else if (!(p = strafter(toybuf, vmstuff[i]))) goto error;
if (1 != sscanf(p, "%"PRIu64"%n", new++, &j)) goto error;
p += j;
}
if (!loop) {
char *s = toybuf;
- xreadfile("/proc/uptime", toybuf, sizeof(toybuf)-1);
+ xreadfile("/proc/uptime", toybuf, sizeof(toybuf));
while (*(s++) > ' ');
sscanf(s, "%"PRIu64, &units);
} else units = loop_delay;