Show command line arguments in Linux
This commit is contained in:
13
ChangeLog
13
ChangeLog
@@ -1,3 +1,16 @@
|
||||
2009-09-09 Mike Massonnet <mmassonnet@xfce.org>
|
||||
|
||||
* Show command line arguments in Linux.
|
||||
|
||||
2009-09-08 Mike Massonnet <mmassonnet@xfce.org>
|
||||
|
||||
* Update Solaris patch from Peter Tribble.
|
||||
* Check for the lib kstat in the autoconf script.
|
||||
* Build with the correct file for Solaris in the automake script.
|
||||
* Fixed the xfce_err messages and switched to g_snprintf for the
|
||||
command strings.
|
||||
* Updated the TODO file.
|
||||
|
||||
2009-09-03 Mike Massonnet <mmassonnet@xfce.org>
|
||||
|
||||
* Add support for Solaris from Peter Tribble
|
||||
|
||||
1
TODO
1
TODO
@@ -1,4 +1,3 @@
|
||||
+ drop old gtk_tooltips
|
||||
+ support multi core (show cpu usage per process)
|
||||
+ move get_cpu_usage() out from functions.c, it is an os-dependant function
|
||||
+ change priority numbers against an enum with text labels Low Medium Normal
|
||||
|
||||
@@ -31,8 +31,9 @@ static void get_cmdline(gint pid, gchar *cmdline, gint length, gchar *cmdline_fu
|
||||
FILE *file;
|
||||
char filename[255];
|
||||
char *p;
|
||||
char *args = NULL;
|
||||
int c;
|
||||
int i = 0;
|
||||
int i = 0, j = 0;
|
||||
char buffer[4096];
|
||||
int idummy;
|
||||
|
||||
@@ -47,6 +48,9 @@ static void get_cmdline(gint pid, gchar *cmdline, gint length, gchar *cmdline_fu
|
||||
if (c != 0) {
|
||||
cmdline_full[i++] = c;
|
||||
} else {
|
||||
if (args == NULL) {
|
||||
args = cmdline_full + i;
|
||||
}
|
||||
cmdline_full[i++] = ' ';
|
||||
}
|
||||
|
||||
@@ -60,6 +64,9 @@ static void get_cmdline(gint pid, gchar *cmdline, gint length, gchar *cmdline_fu
|
||||
cmdline_full[i] = '\0';
|
||||
}
|
||||
|
||||
if (args != NULL && args[0] == '\0')
|
||||
args = NULL;
|
||||
|
||||
fclose (file);
|
||||
|
||||
/* daemon processes and kernel processes don't have a cmdline */
|
||||
@@ -105,6 +112,13 @@ static void get_cmdline(gint pid, gchar *cmdline, gint length, gchar *cmdline_fu
|
||||
}
|
||||
}
|
||||
|
||||
if (args != NULL) {
|
||||
for (i = strlen(cmdline), j = 0; args[j] != '\0' && i < length - 1; i++, j++) {
|
||||
cmdline[i] = args[j];
|
||||
}
|
||||
cmdline[i] = '\0';
|
||||
}
|
||||
|
||||
if (cmdline[0] == '-') {
|
||||
for (i = 0; cmdline[i] != '\0'; i++) {
|
||||
cmdline[i] = cmdline[i+1];
|
||||
|
||||
Reference in New Issue
Block a user