int main(int argc, char **argv)
{
int c, flags = 0, unit_set = 0;
- char *endptr;
struct commandline_arguments args;
/*
/////////////////////////////////////////////////////////////////////////
static void statm2proc(const char* s, proc_t *restrict P) {
- int num;
- num = sscanf(s, "%ld %ld %ld %ld %ld %ld %ld",
+ sscanf(s, "%ld %ld %ld %ld %ld %ld %ld",
&P->size, &P->resident, &P->share,
&P->trs, &P->lrs, &P->drs, &P->dt);
-/* fprintf(stderr, "statm2proc converted %d fields.\n",num); */
}
static int file2str(const char *directory, const char *what, struct utlbuf_s *ub) {
static int pr_context(char *restrict const outbuf, const proc_t *restrict const pp){
static void (*ps_freecon)(char*) = 0;
static int (*ps_getpidcon)(pid_t pid, char **context) = 0;
- static int (*ps_is_selinux_enabled)(void) = 0;
- static int tried_load = 0;
- static int selinux_enabled = 0;
+ static int selinux_enabled = 0;;
size_t len;
char *context;
#if ENABLE_LIBSELINUX
+ static int (*ps_is_selinux_enabled)(void) = 0;
+ static int tried_load = 0;
+
if(!ps_getpidcon && !tried_load){
void *handle = dlopen("libselinux.so.1", RTLD_NOW);
if(handle){
{'z', "vsz", "VSZ"},
{'~', "~", "~"} /* NULL would ruin alphabetical order */
};
-static const int aix_array_count = sizeof(aix_array)/sizeof(aix_struct);
+//static const int aix_array_count = sizeof(aix_array)/sizeof(aix_struct);
/********************* sorting ***************************/
{'y', "priority" }, /* nice */
{'~', "~" } /* NULL would ruin alphabetical order */
};
-static const int shortsort_array_count = sizeof(shortsort_array)/sizeof(shortsort_struct);
+//static const int shortsort_array_count = sizeof(shortsort_array)/sizeof(shortsort_struct);
/*********** print format_array **********/
if((tmp>='a') && (tmp<='z')) return ARG_GNU;
if((tmp>='A') && (tmp<='Z')) return ARG_GNU;
if(tmp=='\0') return ARG_END;
- return ARG_FAIL;
+ return ARG_FAIL;
}
/* First assume sysv, because that is the POSIX and Unix98 standard. */
need_item=0;
}
} while (*++walk);
-out:
+
if(!items){
free(buf);
goto empty;
}
/************/
+#if 0
static void stack_trace_sigsegv(int signum){
(void)signum;
debug(STACK_TRACE, stored_prog_name);
}
+#endif
/************/
#ifdef DEBUG
if (buf[0] == '\0')
set_ansi_attribute(0);
- for (endptr = numstart = buf; *endptr != '\0'; numstart = endptr + 1) {
- if (!set_ansi_attribute(strtol(numstart, &endptr, 10)))
+ for (endptr = numstart = buf; *endptr != '\0'; numstart = endptr + 1) {
+ if (!set_ansi_attribute(strtol(numstart, &endptr, 10)))
break;
}
}