]> granicus.if.org Git - psmisc/commitdiff
pstree.x11 and icons
authorCraig Small <csmall@users.sourceforge.net>
Tue, 16 Sep 2003 11:26:27 +0000 (11:26 +0000)
committerCraig Small <csmall@users.sourceforge.net>
Tue, 16 Sep 2003 11:26:27 +0000 (11:26 +0000)
12 files changed:
ChangeLog
README
doc/killall.1
doc/pstree.1
icons/psmisc16.gif [new file with mode: 0644]
icons/psmisc32.gif [new file with mode: 0644]
icons/pstree16.xpm [new file with mode: 0644]
icons/pstree32.xpm [new file with mode: 0644]
src/Makefile.am
src/killall.c
src/pstree.c
src/pstree.x11 [new file with mode: 0755]

index 146778b900fb3b5280887a621a8bfdff2de4f2c1..f92b972686ea07c15074e6258eda65e9674e0041 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -5,6 +5,8 @@ not yet released Craig Small <csmall@small.dropbear.id.au>
        * fuser -ki now tells user default is N Closes Debian: #197356
        * pstree -a doesn't print space at end of line Closes Debian: #182099
        * Works with new sort flags +2 -> -k 3 Thankyou Andrew Walrond
+       * pstree.x11 now just pstree with a trick Closes Debian: #201042
+       * Icons for pstree, thankyou Tatlin! Closes Debian: #192636
 
 Changes in 21.3
 ===============
diff --git a/README b/README
index 60c7031e4e1d7baf3485e7e52344a710a9a21d28..9c1e98c1099c3de075e32b22a9b11b94195ca32d 100644 (file)
--- a/README
+++ b/README
@@ -23,4 +23,9 @@ files to make psmisc speak different languages.  If your language is not
 supported then let me know, all it takes is translating one file in 
 a certain manner.
 
+Icons
+-----
+The pstree icons were drawn by Tatlin at Coresis who has given permission
+for them to be used for psmisc.
+
   - Craig
index 840ad055cd751f9d2335f53c2c62d03514ebf351..6a63a45f22d905450fbafc4f4c75fccaa3e29e6c 100644 (file)
@@ -92,5 +92,5 @@ Werner Almesberger <Werner.Almesberger@epfl.ch> wrote the original version
 of psmisc.  Since version 20 Craig Small <csmall@small.dropbear.id.au> 
 can be blamed.
 .SH "SEE ALSO"
-.BR kill (1), fuser (1), pgrep (1), pidof (1), ps (1), kill (2)
+.BR kill (1), fuser (1), pgrep (1), pidof (1), pkill (1), ps (1), kill (2)
 .\"{{{}}}
index 5f9f3d114db6e956697445eb9d8a4aedb3d3901e..0ad6065d77af3c928d6f66fedf76e7695f868473 100644 (file)
@@ -3,7 +3,7 @@
 pstree \- display a tree of processes
 .SH SYNOPSIS
 .ad l
-.B pstree
+.B pstree 
 .RB [ \-a ]
 .RB [ \-c ]
 .RB [ \-h | \-H \fIpid\fB ]
@@ -39,6 +39,11 @@ becomes
     init\-\-\-4*[getty]
 .sp
 .fi
+.PP
+If \fBpstree\fR is called as \fBpstree.x11\fR then it will prompt the user
+at the end of the line to press return and will not return until that
+has happened.  This is useful for when \fBpstree\fR is run in a xterminal.
+
 .SH OPTIONS
 .IP \fB\-a\fP
 Show command line arguments. If the command line of a process is swapped out,
@@ -82,8 +87,9 @@ Display version information.
 .nf
 /proc  location of the proc file system
 .fi
-.SH AUTHOR
+.SH AUTHORS
 Werner Almesberger <Werner.Almesberger@epfl.ch>
+Craig Small <csmall@small.dropbear.id.au>
 .SH "SEE ALSO"
 ps(1), top(1)
 .\"{{{}}}
diff --git a/icons/psmisc16.gif b/icons/psmisc16.gif
new file mode 100644 (file)
index 0000000..2143306
Binary files /dev/null and b/icons/psmisc16.gif differ
diff --git a/icons/psmisc32.gif b/icons/psmisc32.gif
new file mode 100644 (file)
index 0000000..567041d
Binary files /dev/null and b/icons/psmisc32.gif differ
diff --git a/icons/pstree16.xpm b/icons/pstree16.xpm
new file mode 100644 (file)
index 0000000..4f7e412
--- /dev/null
@@ -0,0 +1,50 @@
+/* XPM */
+static char * icon_16x16_xpm[] = {
+"16 16 31 1",
+"      c None",
+".     c #4E1C0D",
+"+     c #A1CDA4",
+"@     c #73F91C",
+"#     c #D4880C",
+"$     c #8D320A",
+"%     c #DE8F69",
+"&     c #67FC03",
+"*     c #AA6D53",
+"=     c #99F56C",
+"-     c #AA9177",
+";     c #AA4509",
+">     c #6CF10A",
+",     c #CB7502",
+"'     c #3B7529",
+")     c #D06938",
+"!     c #A5610F",
+"~     c #86D83B",
+"{     c #CC8346",
+"]     c #B97428",
+"^     c #864909",
+"/     c #7FF432",
+"(     c #C65707",
+"_     c #709081",
+":     c #BD300E",
+"<     c #68FC04",
+"[     c #A44C36",
+"}     c #757408",
+"|     c #60E804",
+"1     c #927136",
+"2     c #6D473C",
+"                ",
+"                ",
+"     ,,,  _     ",
+"    ,#%{,):     ",
+"    ###,]!({    ",
+"    %#{#,*;(:)  ",
+"   ##{]][^]$$;  ",
+" ,,{]#{());$:$1 ",
+" {,*:!^22:^%)$- ",
+" {)$-)^;:!$2.%1 ",
+" !(2._[!$$.*((+ ",
+"  {[*1}$..$!-   ",
+"       ^.       ",
+"       .'       ",
+"     _'.''      ",
+"                "};
diff --git a/icons/pstree32.xpm b/icons/pstree32.xpm
new file mode 100644 (file)
index 0000000..ed79a82
--- /dev/null
@@ -0,0 +1,66 @@
+/* XPM */
+static char * icon_32x32_xpm[] = {
+"32 32 31 1",
+"      c None",
+".     c #4E1C0D",
+"+     c #A1CDA4",
+"@     c #73F91C",
+"#     c #D4880C",
+"$     c #8D320A",
+"%     c #DE8F69",
+"&     c #67FC03",
+"*     c #AA6D53",
+"=     c #99F56C",
+"-     c #AA9177",
+";     c #AA4509",
+">     c #6CF10A",
+",     c #CB7502",
+"'     c #3B7529",
+")     c #D06938",
+"!     c #A5610F",
+"~     c #86D83B",
+"{     c #CC8346",
+"]     c #B97428",
+"^     c #864909",
+"/     c #7FF432",
+"(     c #C65707",
+"_     c #709081",
+":     c #BD300E",
+"<     c #68FC04",
+"[     c #A44C36",
+"}     c #757408",
+"|     c #60E804",
+"1     c #927136",
+"2     c #6D473C",
+"                                ",
+"                                ",
+"                                ",
+"                                ",
+"            ! - -               ",
+"           ,(,,,)    _          ",
+"         ],{#{,,,)  ]:1         ",
+"         ,###%{{#,()(::         ",
+"         ###{###],,,(($1        ",
+"         ######,]]]!](;{  1     ",
+"         %%##{{#,(;)*;;([[:_    ",
+"        %%%##{###,)*;;;(;::)-   ",
+"       %%###%){,)))$^!);;:$;:   ",
+"      %####{{]{]*[$^*];$$$;;$   ",
+"   -]%)####,,!!!{1!]];:;^;;$:{  ",
+"  -,,,({]]]##{,()){);;;$$:;$;1  ",
+"  +{,,,!,]*]!!]])(;;;)$22:*^[+  ",
+"   {,,!**:$!1^.2-2[:!^[%{):$[-  ",
+"   {))$*--[[1.$.[;!;^$[[$$.[$1  ",
+"   {%)[$1-))[^[;;:;!:$22..*%11  ",
+"  {#)[{-;$22$!$;(;;;$[_22[::-+  ",
+"  #!(((2$.__.[$!!$$$$.$*)(:({+  ",
+"   }^*;$![.[!$!$$2...$::(;^}}1  ",
+"    #{_[[*21#}$$....^$$!2-      ",
+"    },:11}    }2..2+ __ _       ",
+"               ^..              ",
+"              }^^}              ",
+"              '..'              ",
+"              '.''''            ",
+"           _ ''.''''' +         ",
+"        +++___''''_+++_+++      ",
+"                                "};
index 4a8e2d6411a8f328a131085448f4d179dec41e73..d3d0396dfa6689b596afce7a5370798dbb9c47c8 100644 (file)
@@ -3,6 +3,8 @@ AM_CFLAGS = -Wall -DLOCALEDIR=\"/usr/share/locale\"
 
 bin_PROGRAMS = fuser killall pstree
 
+bin_SCRIPTS = pstree.x11
+
 fuser_SOURCES = fuser.c comm.h signals.c signals.h signames.h loop.h
 
 killall_SOURCES = killall.c comm.h signals.c signals.h signames.h
@@ -15,7 +17,7 @@ pstree_LDADD = @TERMCAP_LIB@ @FLASK_LIB@
 
 BUILT_SOURCES = signames.h
 
-EXTRA_DIST = signames.c
+EXTRA_DIST = signames.c pstree.x11
 
 CLEANFILES = signames.h
 
index 44402bf819d729a7ac8a2a8661c7c0d80a6d2db4..4bc08503cb3c9f538f4a490992a3bd2594da1e5c 100644 (file)
@@ -64,99 +64,6 @@ ask (char *name, pid_t pid)
   return ch == 'y' || ch == 'Y';
 }
 
-#define MAX_PATHNAME  (NAME_MAX * 2 + 14 + 1)
-#define MAX_TESTPATH  (NAME_MAX + 14 + 1)
-int getuserprocs(int mysignal, int names, char **namelist)
-{ 
-       int i;
-       int j;
-       int waitpid = 0;
-       DIR *dir;
-       pid_t pidkilled;
-       pid_t* killedarray;
-       struct dirent *de;
-       char pathname[MAX_PATHNAME + 1];
-       char testpath[MAX_TESTPATH + 1 ]; /* /proc//environ\0 15 chars */
-       struct stat statbuf;
-       int maxnum = 100;
-       char answer;
-       
-       if(!namelist) exit(1);
-       if(!(killedarray = malloc( 100 * sizeof(pid_t) )))
-       {
-               perror("malloc");
-               exit(1);
-       }
-       for ( i = 0; i < names; i++)
-       {
-               if (exact) 
-               {
-                        for(j = 0; j < strlen(namelist[i]); j++)
-                        {
-                                if  ( (namelist[i][j] == '*')  || (namelist[i][j] =='?') )
-                                {
-                                        printf("Error, cannot match wildcards in exact mode\n");
-                                        exit(1);
-                                }
-                        } 
-               }
-               if (!(dir = opendir (PROC_BASE)))
-               {       
-                       perror (PROC_BASE);
-                       exit (1);
-               } 
-               while ( (de = readdir(dir)) !=  NULL)
-               {
-                       snprintf(testpath, NAME_MAX+14, "/proc/%s/environ", de->d_name);
-                       if (!stat(testpath, &statbuf) )
-                       {
-                               if(S_ISREG(statbuf.st_mode) )
-                               {
-                                       sprintf(pathname, "cat /proc/%s/environ | grep LOGNAME=%s > /dev/null ", de->d_name, namelist[i]); 
-                                       if ( system (pathname) == 0) 
-                                       {
-                                               pidkilled = (pid_t)atoi(de->d_name);
-                                               killedarray[waitpid++] = pidkilled;
-                                               if ( waitpid == maxnum)
-                                               {
-                                                       maxnum *= 2;
-                                                       if (!(killedarray = realloc(killedarray, maxnum * sizeof(pid_t))))
-                                                       {
-                                                               perror("realloc");
-                                                               exit(1);
-                                                       }
-                                               }
-                                       }
-                               }
-                       }
-               }
-       }
-       closedir(dir);
-       for (i = 0; i < waitpid; i++)
-       {
-               if (interactive)
-               {
-                       printf("Kill %d (y/n)?", (int)killedarray[i]);  
-                       scanf("%s", &answer);
-               }     
-               if ( ( (interactive) && ( (answer == 'y') || (answer == 'Y') ) ) || !(interactive) )
-               {               
-                       if(kill (process_group? -killedarray[i]: killedarray[i], mysignal ) == 0)
-                       {
-                               if(verbose) printf("Pid %d killed with signal %d\n",  (int)killedarray[i], mysignal);
-                               if(wait_until_dead)
-                               {
-                                       kill(process_group? -killedarray[i]: killedarray[i], mysignal);
-                                       sleep(1);                                                       
-                                       }
-
-                       }   
-               }  
-       } 
-       free(killedarray);
-       return 0;       
-       
-}
 #ifdef FLASK_LINUX
 static int
 kill_all(int signal, int names, char **namelist, security_id_t sid )
index 4e2f4fb4ca9cffdc217ba6a53f9d9524b6875c73..4b8a8e89f2ab8f5351774f71d64e6731d0df9728 100644 (file)
@@ -105,7 +105,7 @@ sym_ascii =
 static PROC *list = NULL;
 static int width[MAX_DEPTH], more[MAX_DEPTH];
 static int print_args = 0, compact = 1, user_change = 0, pids = 0, by_pid = 0,
-  trunc = 1;
+  trunc = 1, wait_end = 0;
 #ifdef FLASK_LINUX
 static int show_sids    = 0;
 static int show_scontext = 0;
@@ -756,6 +756,7 @@ main (int argc, char **argv)
   pid_t pid, highlight;
   char termcap_area[1024];
   int c;
+  char *tmpstr;
 
   if (ioctl (1, TIOCGWINSZ, &winsz) >= 0)
     if (winsz.ws_col)
@@ -766,6 +767,13 @@ main (int argc, char **argv)
   
   setlocale(LC_ALL, "");
   
+  if ( (tmpstr = strrchr(argv[0],'/'))) {
+    tmpstr++;
+    if (strcmp(tmpstr, "pstree.x11") ==0)
+      wait_end=1;
+  }
+
+
 #ifdef FLASK_LINUX
   while ((c = getopt (argc, argv, "acGhH:npluUVsx")) != EOF)
 #else  /*FLASK_LINUX*/
@@ -874,5 +882,10 @@ main (int argc, char **argv)
          return 1;
        }
     }
+  if (wait_end == 1) {
+    fprintf(stderr, "Press return to close\n");
+    (void)getchar();
+  }
+
   return 0;
 }
diff --git a/src/pstree.x11 b/src/pstree.x11
new file mode 100755 (executable)
index 0000000..03eb9fd
Binary files /dev/null and b/src/pstree.x11 differ