Print this page

        

@@ -71,18 +71,11 @@
 #include <sys/elf.h>
 #include <libproc.h>
 #include <wctype.h>
 #include <widec.h>
 #include <elfcap.h>
-#include <libgen.h>
 
-typedef enum pargs_cmd {
-        PARGS_ARGV,
-        PARGS_ENV,
-        PARGS_AUXV
-} pargs_cmd_t;
-
 typedef struct pargs_data {
         struct ps_prochandle *pd_proc;  /* target proc handle */
         psinfo_t *pd_psinfo;            /* target psinfo */
         char *pd_locale;                /* target process locale */
         int pd_conv_flags;              /* flags governing string conversion */

@@ -1288,48 +1281,37 @@
         int aflag = 0, cflag = 0, eflag = 0, xflag = 0, lflag = 0;
         int errflg = 0, retc = 0;
         int opt;
         int error = 1;
         core_content_t content = 0;
-        pargs_cmd_t cmd = PARGS_ARGV;
 
         (void) setlocale(LC_ALL, "");
 
-        command = basename(argv[0]);
+        if ((command = strrchr(argv[0], '/')) != NULL)
+                command++;
+        else
+                command = argv[0];
 
-        if (strcmp(command, "penv") == 0)
-                cmd = PARGS_ENV;
-        else if (strcmp(command, "pauxv") == 0)
-                cmd = PARGS_AUXV;
-
         while ((opt = getopt(argc, argv, "acelxF")) != EOF) {
                 switch (opt) {
                 case 'a':               /* show process arguments */
                         content |= CC_CONTENT_STACK;
                         aflag++;
-                        if (cmd != PARGS_ARGV)
-                                errflg++;
                         break;
                 case 'c':               /* force 7-bit ascii */
                         cflag++;
                         break;
                 case 'e':               /* show environment variables */
                         content |= CC_CONTENT_STACK;
                         eflag++;
-                        if (cmd != PARGS_ARGV)
-                                errflg++;
                         break;
                 case 'l':
                         lflag++;
                         aflag++;        /* -l implies -a */
-                        if (cmd != PARGS_ARGV)
-                                errflg++;
                         break;
                 case 'x':               /* show aux vector entries */
                         xflag++;
-                        if (cmd != PARGS_ARGV)
-                                errflg++;
                         break;
                 case 'F':
                         /*
                          * Since we open the process read-only, there is no need
                          * for the -F flag.  It's a documented flag, so we

@@ -1342,24 +1324,13 @@
                 }
         }
 
         /* -a is the default if no options are specified */
         if ((aflag + eflag + xflag + lflag) == 0) {
-                switch (cmd) {
-                case PARGS_ARGV:
                         aflag++;
                         content |= CC_CONTENT_STACK;
-                        break;
-                case PARGS_ENV:
-                        content |= CC_CONTENT_STACK;
-                        eflag++;
-                        break;
-                case PARGS_AUXV:
-                        xflag++;
-                        break;
                 }
-        }
 
         /* -l cannot be used with the -x or -e flags */
         if (lflag && (xflag || eflag)) {
                 (void) fprintf(stderr, "-l is incompatible with -x and -e\n");
                 errflg++;