move sigar_getword to sigar_util
This commit is contained in:
1 parent
14f00b4b7c
commit
9ca64171c2
3 files changed
+26
-54
No files matched your search
@@ -362,33 +362,6 @@ int sigar_proc_state_get(sigar_t *sigar, sigar_pid_t pid,
|
||||
return SIGAR_OK;
|
||||
}
|
||||
|
||||
/* XXX: could be useful elsewhere */
|
||||
static char *sigar_getword(char **line, char stop)
|
||||
{
|
||||
char *pos = *line;
|
||||
int len;
|
||||
char *res;
|
||||
|
||||
while ((*pos != stop) && *pos) {
|
||||
++pos;
|
||||
}
|
||||
|
||||
len = pos - *line;
|
||||
res = (char *)malloc(len + 1);
|
||||
memcpy(res, *line, len);
|
||||
res[len] = 0;
|
||||
|
||||
if (stop) {
|
||||
while (*pos == stop) {
|
||||
++pos;
|
||||
}
|
||||
}
|
||||
|
||||
*line = pos;
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
/*
|
||||
* XXX: pst_cmd is only 64 chars of the command args.
|
||||
* according to HP forums there isn't a way to get them
|
||||
|
||||
Reference in new issue
Block a user