ps: add k and -x
This commit is contained in:
@@ -117,6 +117,8 @@
|
||||
#define PER_NO_DEFAULT_g 0x0080
|
||||
#define PER_ZAP_ADDR 0x0100
|
||||
#define PER_SANE_USER 0x0200
|
||||
#define PER_HPUX_x 0x0400
|
||||
#define PER_SVR4_x 0x0800
|
||||
|
||||
/* Simple selections by bit mask */
|
||||
#define SS_B_x 0x01
|
||||
|
14
ps/global.c
14
ps/global.c
@@ -171,6 +171,7 @@ static const char *set_personality(void){
|
||||
{"sgi", &&case_sgi},
|
||||
{"solaris2", &&case_solaris2},
|
||||
{"sunos4", &&case_sunos4},
|
||||
{"svr4", &&case_svr4},
|
||||
{"sysv", &&case_sysv},
|
||||
{"tru64", &&case_tru64},
|
||||
{"unix", &&case_unix},
|
||||
@@ -304,10 +305,17 @@ static const char *set_personality(void){
|
||||
|
||||
case_hp:
|
||||
case_hpux:
|
||||
case_posix:
|
||||
case_sco:
|
||||
case_solaris2:
|
||||
personality = PER_BROKEN_o | PER_HPUX_x;
|
||||
return NULL;
|
||||
|
||||
case_svr4:
|
||||
case_sysv:
|
||||
case_sco:
|
||||
personality = PER_BROKEN_o | PER_SVR4_x;
|
||||
return NULL;
|
||||
|
||||
case_posix:
|
||||
case_solaris2:
|
||||
case_unix95:
|
||||
case_unix98:
|
||||
case_unix:
|
||||
|
@@ -13,9 +13,6 @@
|
||||
* The help message must not become longer, because it must fit
|
||||
* on an 80x24 screen _with_ the error message and command prompt.
|
||||
*/
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
const char *help_message =
|
||||
"********* simple selection ********* ********* selection by list *********\n"
|
||||
|
@@ -38,9 +38,6 @@
|
||||
*
|
||||
* Table 5 could go in a file with the output functions.
|
||||
*/
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <ctype.h>
|
||||
#include <fcntl.h>
|
||||
|
45
ps/parser.c
45
ps/parser.c
@@ -12,9 +12,6 @@
|
||||
/* Ought to have debug print stuff like this:
|
||||
* #define Print(fmt, args...) printf("Debug: " fmt, ## args)
|
||||
*/
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
@@ -432,12 +429,20 @@ static const char *parse_sysv_option(void){
|
||||
trace("-w wide output.\n");
|
||||
w_count++;
|
||||
break;
|
||||
#ifdef NOBODY_HAS_BSD_HABITS_ANYMORE
|
||||
case 'x': /* Same as -y, but for System V Release 4 MP */
|
||||
trace("-x works like Sun Solaris & SCO Unixware -y option\n");
|
||||
format_modifiers |= FM_x;
|
||||
break;
|
||||
#endif
|
||||
case 'x': /* behind personality until "ps -ax" habit is uncommon */
|
||||
if(personality & PER_SVR4_x){
|
||||
// Same as -y, but for System V Release 4 MP
|
||||
trace("-x works like Sun Solaris & SCO Unixware -y option\n");
|
||||
format_modifiers |= FM_y;
|
||||
break;
|
||||
}
|
||||
if(personality & PER_HPUX_x){
|
||||
trace("-x extends the command line\n");
|
||||
w_count += 2;
|
||||
unix_f_option = 1;
|
||||
break;
|
||||
}
|
||||
return "Must set personality to get -x option.";
|
||||
case 'y': /* Sun's -l hack (also: Irix "lnode" resource control info) */
|
||||
trace("-y Print lnone info in UID/USER column or do Sun -l hack.\n");
|
||||
format_modifiers |= FM_y;
|
||||
@@ -445,7 +450,7 @@ static const char *parse_sysv_option(void){
|
||||
#if 0
|
||||
case 'z': /* alias of Mandatory Access Control level info */
|
||||
trace("-z shows aliased MAC info\n");
|
||||
return "Don't understand MAC on Linux.";
|
||||
return "Don't understand MAC aliases on Linux.";
|
||||
break;
|
||||
#endif
|
||||
case '-':
|
||||
@@ -601,11 +606,16 @@ static const char *parse_bsd_option(void){
|
||||
trace("j job control format\n");
|
||||
format_flags |= FF_Bj;
|
||||
break;
|
||||
#if 0
|
||||
case 'k': // OpenBSD: don't hide "kernel threads" -- like the swapper?
|
||||
trace("k Print LWP (thread) info.\n"); // was: Use /vmcore as c-dumpfile\n");
|
||||
break;
|
||||
#endif
|
||||
case 'k':
|
||||
// OpenBSD: don't hide "kernel threads" -- like the swapper?
|
||||
// trace("k Print LWP (thread) info.\n"); // was: Use /vmcore as c-dumpfile\n");
|
||||
|
||||
// NetBSD, and soon (?) FreeBSD: sort-by-keyword
|
||||
trace("k Specify sorting keywords.\n");
|
||||
arg=get_opt_arg();
|
||||
if(!arg) return "Long sort specification must follow 'k'.";
|
||||
defer_sf_option(arg, SF_G_sort);
|
||||
return NULL; /* can't have any more options */
|
||||
case 'l':
|
||||
trace("l Display long format\n");
|
||||
format_flags |= FF_Bl;
|
||||
@@ -1178,6 +1188,11 @@ try_bsd:
|
||||
// get seriously confused. Ask yourself if users would freak out
|
||||
// about "ps -aux" suddenly changing behavior if a user "x" were
|
||||
// added to the system.
|
||||
//
|
||||
// Also, a "-x" option is coming. It's already there in fact,
|
||||
// for some non-default personalities. So "ps -ax" will parse
|
||||
// as SysV options... and you're screwed if you've been patching
|
||||
// out the friendly warning. Cut-over is likely to be in 2005.
|
||||
if(!(personality & PER_FORCE_BSD))
|
||||
fprintf(stderr, "Warning: bad syntax, perhaps a bogus '-'? See http://procps.sf.net/faq.html\n");
|
||||
// Remember: contact albert@users.sf.net or procps-feedback@lists.sf.net
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 1998-2002 by Albert Cahalan; all rights resered.
|
||||
* Copyright 1998-2004 by Albert Cahalan; all rights resered.
|
||||
* This file may be used subject to the terms and conditions of the
|
||||
* GNU Library General Public License Version 2, or any later version
|
||||
* at your option, as published by the Free Software Foundation.
|
||||
@@ -8,9 +8,6 @@
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Library General Public License for more details.
|
||||
*/
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
|
Reference in New Issue
Block a user