return i;
}
+/*
+ ***************************************************************************
+ * Get pointer on task's command string.
+ *
+ * IN:
+ * @pst Pointer on structure with process stats and command line.
+ ***************************************************************************
+ */
+char *get_tcmd(struct pid_stats *pst)
+{
+ if (DISPLAY_CMDLINE(pidflag) && strlen(pst->cmdline))
+ /* Option "-l" used */
+ return pst->cmdline;
+ else
+ return pst->comm;
+}
+
/*
***************************************************************************
* Display process command name or command line.
{
char *p;
- if (DISPLAY_CMDLINE(pidflag) && strlen(pst->cmdline)) {
- p = pst->cmdline;
- }
- else {
- p = pst->comm;
- }
+ /* Get pointer on task's command string */
+ p = get_tcmd(pst);
if (pst->tgid) {
cprintf_s(IS_ZERO, " |__%s\n", p);
int q, rc;
regex_t regex;
struct passwd *pwdent;
+ char *pc;
*pstc = st_pid_list[curr] + p;
/* Error in preparing regex structure */
return -1;
- rc = regexec(®ex, (*pstc)->comm, 0, NULL, 0);
+ pc = get_tcmd(*pstc); /* Get pointer on task's command string */
+ rc = regexec(®ex, pc, 0, NULL, 0);
regfree(®ex);
if (rc)
return -1;
}
- rc = regexec(®ex, (*pstc)->comm, 0, NULL, 0);
+ pc = get_tcmd(*pstc); /* Get pointer on task's command string */
+ rc = regexec(®ex, pc, 0, NULL, 0);
regfree(®ex);
if (rc) {