top: provide extensive, generalized nls support

Reviewed-by: Sami Kerola <kerolasa@iki.fi>
Signed-off-by: Jim Warner <james.warner@comcast.net>
This commit is contained in:
Jim Warner
2011-10-11 14:02:59 -05:00
committed by Craig Small
parent 35cf8a4adc
commit 32a9adbc13
11 changed files with 925 additions and 363 deletions

26
top/Makefile.am Normal file
View File

@ -0,0 +1,26 @@
AM_CPPFLAGS = -include $(top_builddir)/config.h
AM_CFLAGS = -I../proc -I../include
AM_LDFLAGS = ../proc/libprocfs.la
if WITH_NCURSES
usrbin_exec_PROGRAMS = \
top
top_SOURCES = \
top.h \
top.c \
top_nls.h \
top_nls.c
dist_man_MANS = \
top.1
top_LDADD = @NCURSES_LIBS@
endif
EXTRA_DIST =
procpsngdir = $(docdir)
dist_procpsng_DATA = \
README.top

327
top/README.top Normal file
View File

@ -0,0 +1,327 @@
This file summarizes changes to the top program and supporting documentation
introduced on March 31, 2011.
Contents:
DOCUMENT Changes
INTERNAL Improvements
EXTERNAL Improvements
BUGS Previously Fixed and Preserved
BUGS Newly/Nearly Fixed
BUGS/WISH-LISTS That Should Go Bye-bye
BUGS FIXED You Didn't Know You Had
OTHER Changes, Hopefully They Won't Bite You
BENCHMARKS
DOCUMENT Changes =========================================================
. The entire file was cleaned up, standardized and expanded to include:
- a new section "2. SUMMARY Display" added for symmetry with Fields
- nine new fields were added to section "3a. DESCRIPTIONS of Fields"
- a new section "3b. MANAGING Fields" replaced the obsolete section
"2b. SELECTING and ORDERING Columns"
- section "5c. SCROLLING a Window" was added for that new feature
. I don't know when the explanations for CODE and DATA were changed to
show 'virtual' memory, but I think there's a reason their alternate
names contain the word 'resident'. Thus they were changed back to
say 'physical memory'.
. And as I indicated in a previous email, the former string identifier
'ME' was restored as were the 'h' key/command conventions (vs. <h>).
Oops, the 'h' key/command conventions remain restored, but subsequent
testing revealed problems with the .ME string identifier. Thus, it was
changed to .WE (along with the companion .Me/.We id).
. Also previously mentioned, the 'man2html' program translates top.1 to
HTML with near perfect fidelity. I take that to mean there should be
no problems with the top.1 source on most other platforms.
To further improve translation to HTML, several .Bd and .Ed macros
were added to preserve literal (fixed width) spacing.
INTERNAL Improvements ====================================================
. The old restriction of 26 fields has been lifted. With this new-top
100+ fields are now possible. It currently supports up to 55, of
which 35 are in use. Adding a new field is almost too easy.
. Task row construction has been considerably improved -- both from
a programming perspective and a performance perspective.
. The column highlighting costs for sort field visibility were
virtually eliminated.
An optional define (USE_X_COLHDR) can be enabled to completely
eliminate any costs associated with the 'x' command toggle.
. The management of the HST_t structures, used for %cpu calculations,
was optimized with a hashing scheme. Thus the need for a qsort then
a binary search in each frame was completely eliminated.
An optional define can restore the former qsort/bsearch approach but
with an internal inlined binary search function offering substantially
better performance than the old top.
. This far more capable new-top executable is no larger than old top.
. The above combine to produce substantially improved performance
whose details are documented below under BENCHMARKS.
EXTERNAL Improvements ====================================================
. Field management has been completely redesigned. It's now embodied
on a single screen where display-ability, position and sort selection
can be handled in one place -- for all windows at one time!
This function is dependent on cursor motion keys and should a device
not have the customary arrow keys, alternatives are provided and
documented under "Operation" near the beginning of the man page.
. The following new fields have been added:
Group Id
Minor Page Faults
Number of Threads
Process Group Id
Real User Id
Saved User Id
Saved User Name
Session Id
Tty Process Group Id
. Scrolling keys now allow one to move the view of any window vertically
or horizontally to reveal any desired task or column. Previously, only
some tasks were viewable even with reversible, selectable sort columns.
Each of the four windows is capable of maintaining its own scrolled
coordinates and an optional toggle ('C') displays a message aiding
navigation within the available tasks and displayable fields.
. User interactive line oriented input now provides for true line
editing supported by these new keys:
Left/Right arrow keys, Delete key, Backspace and
Home/End keys (likely limited to xterm, not terminal)
. User filtering via the -u | -U interactive commands is now window
based which means that different windows could be used to filter
different users.
. Signal handling has been normalized and is now consistent regardless
of the particular top screen a user may have been using.
. The 'i' toggle now shows any task that has used *some* cpu since the
last screen update. It's no longer limited to just running tasks.
. The summary area 'task states' line now reflects either 'Threads'
or 'Tasks' depending on the -H toggle.
BUGS Previously Fixed and Preserved ======================================
( but not necessarily literally)
. 228822, suspending top leaves xterm in slightly messed-up state
. 256376, segfaults, if the xterm is to small
. 320289, segv on sigwinch
. 351065, wrong highlight 1st column (escape characters displayed)
. 358724, accepts extra numeric args
. 378695, seg fault if "/proc" is not mounted
. 426782, UID field is too narrow
. 458986, should check xterm for EOF/EIO
. 459890, Irix mode should use %#4.1f when threads shown
BUGS Newly/Nearly Fixed ==================================================
. 225542, 'Unknown command' message blocks further commands
The message is now displayed using usleep for 1.25 seconds, instead
of the former full 2 seconds. And while it still blocks further
commands, the delay is much more tolerable.
Can we consider this bug 'nearly' fixed?
. 410292, interface error when using backspace
Full line editing was added but could be disabled via a #define.
And via that define, even under basic termios support, the backspace
problem was cured.
. 567509, top idle command ('i') not working for threaded programs
Since the 'i' command now reflects tasks that have used *some* cpu,
and is no longer dependent on an 'R' state, I *believe/hope* this
bug has been swatted.
BUGS/WISH-LISTS That Should Go Bye-bye ===================================
. 340751, wish for hostname to benefit multiple top sessions
Craig's suggestion regarding symlinks is the perfect solution.
How dare Craig say that the solution was "not ideal" !
. 586497, wish for graceful degradation on small screen sizes
This objective could be accomplished by setting up 2 symlinks for
top, personalizing them for the 2 tiny phone displays, then writing
the respective configuration files.
I shudder at the programming effort suggested by Paul. And when it
was done you'd find everybody else would have different criteria.
BUGS FIXED You Didn't Know You Had =======================================
. Without amplifying the dirty details, the long standing occasionally
reported display corruption, and an unreported source of performance
degradation, has been eliminated. The cure is in the elimination of
the Pseudo_cols variable and the improved PUFF macro.
. Line oriented input was not sensitive to screen width. Thus a user
could hold down any key and ultimately line wrap, overwriting the
columns header and the entire screen. New top prevents this.
. User filtering (-u|-U) via a user ID (not name) now validates that
number. The old-top just made sure it was numeric, then blindly
displayed no matching users (i.e. an empty window).
. The threads toggle ('H') is no longer window based but more properly
applies to all windows. The previous implementation produced the
following aberration if multiple windows were being shown:
. -H would be acknowledged and applied to all visible windows
. keying 'a' or 'w' would silently turn it off
. then keying -H would turn it back on, but the user expected off
. If you hit ^Z on any help or fields screen to suspend old-top, after
issuing 'fg' you would then be left with a seemingly hung application
inviting ^C. In truth, one could recover with the space bar, but that
was far from intuitive.
. The old-top consistently writes 1 extra byte for each task row or 1
byte too few for columns headers, depending on your perspective.
The new top writes the same number of bytes for each.
. By failing to clear to eol, old top left the display in a terrible
state after exiting a 'fields' screen when only a few columns were
being displayed.
. The old-top used a zero value for the L_NONE library flag which could
cause repeated rebuilding of columns headers with each frame. In truth,
this was not likely to happen in real life since only two fields actually
used that flag. However, if it did happen, performance could be degraded
by 800%.
OTHER Changes, Hopefully They Won't Bite You =============================
. The undocumented TOPRC environment variable is no longer supported.
Any similar need can be met through a symlink alias.
. The use of environment variables to override terminal size is now
off by default but could be enabled through '#define TTYGETENVYES'.
. The global 'bold enable' toggle is active by default and thus agrees
with the documentation. It's been wrong ever since Al's wholesale
'cosmetic' changes in procps-3.2.2.
. Task defaults now show bold (not reverse) and row highlighting.
This agrees with what was always stated in the documentation.
. The 'H' toggle (thread mode) is not persistent. Persistence can be
achieved with a simple shell script employing the -H switch.
. Then 'g' and 'G' commands were reversed to reflect their likely use.
BENCHMARKS ===============================================================
Tested as root with nice -10 and using only common fields
( on a pretty old, slow laptop under Debian Lenny )
but rcfiles specified identical sort fields and identical
settings for the 'B', 'b', 'x' and 'y' toggles (even though
the defaults are not necessarily identical).
In every case new-top outperforms old-top, but I've shown %
improvements for only the most significant. Those cases mostly
involve colors with both row & column highlighting. I suggested
above that the highlighting cost was virtually eliminated in
new-top, and these tests bare that out.
Note the much smaller differences for new-top between the 24x80
window results and full screen (but don't mix apples_terminal
with oranges_xterm). This is a reflection of the simplification
of task row construction, also mentioned above.
It's always been the case that any top in an xterm outperforms
that top under the terminal application, even when the xterm
provides additional rows and columns. It's true below with
Gnome and it was true nine years ago under KDE.
----------------------------------------------------------
The following comparisons were run with:
100 tasks & 160 threads
-d0 -n5000
new-top old-top
xterm 24x80
a 1 win, lflgs_none 11.2 secs 51.8 secs + 462.6%
1 win, default 61.0 secs 66.8 secs
1 win, colors w/ x+y 61.3 secs 83.0 secs + 135.4%
1 win, thread mode 88.3 secs 94.2 secs
b 1 win, every field on 99.7 secs 106.0 secs
1 win, cmdline 71.2 secs 76.6 secs
4 wins, defaults 101.3 secs 107.2 secs
4 wins, colors w/ x+y 101.5 secs 122.8 secs + 121.0%
xterm, full screen (53x170)
a 1 win, lflgs_none 15.9 secs 54.2 secs + 340.9%
1 win, default 70.0 secs 73.2 secs
1 win, colors w/ x+y 69.4 secs 131.3 secs + 189.2%
1 win, thread mode 97.6 secs 102.6 secs
c 1 win, every field on 122.1 secs 128.1 secs
1 win, cmdline 80.8 secs 83.7 secs
4 wins, defaults 111.4 secs 115.8 secs
4 wins, colors w/ x+y 112.0 secs 172.9 secs + 154.4%
terminal 24x80
a 1 win, lflgs_none 8.9 secs 58.6 secs + 658.4%
1 win, default 70.1 secs 80.3 secs
1 win, colors w/ x+y 70.6 secs 157.3 secs + 222.8%
1 win, thread mode 104.7 secs 120.5 secs
b 1 win, every field on 111.2 secs 134.5 secs
1 win, cmdline 83.8 secs 94.5 secs
4 wins, defaults 125.6 secs 146.7 secs
4 wins, colors w/ x+y 125.6 secs 206.9 secs + 176.7%
terminal, full screen (39x125)
a 1 win, lflgs_none 9.1 secs 60.6 secs + 665.9%
1 win, default 74.3 secs 88.0 secs
1 win, colors w/ x+y 73.9 secs 314.5 secs + 425.6%
1 win, thread mode 113.0 secs 140.9 secs
b 1 win, every field on 117.7 secs 154.9 secs
1 win, cmdline 87.4 secs 107.2 secs
4 wins, defaults 139.1 secs 166.7 secs
4 wins, colors w/ x+y 157.3 secs 423.2 secs + 269.0%
----------------------------------------------------------
The following comarisons were run with:
300 tasks & 360 threads
-d0 -n3000
new-top old-top
xterm, full screen (53x170)
a 1 win, lflgs_none 14.3 secs 79.0 secs + 552.4%
1 win, default 101.1 secs 104.5 secs
1 win, colors w/ x+y 101.3 secs 140.0 secs + 138.2%
1 win, thread mode 120.1 secs 123.1 secs
c 1 win, every field on 179.8 secs 185.6 secs
1 win, cmdline 124.9 secs 132.8 secs
4 wins, defaults 174.8 secs 179.2 secs
4 wins, colors w/ x+y 175.0 secs 215.2 secs + 123.0%
terminal, full screen (39x125)
a 1 win, lflgs_none 12.3 secs 98.5 secs + 800.8%
1 win, default 117.4 secs 134.0 secs
1 win, colors w/ x+y 111.6 secs 296.1 secs + 265.3%
1 win, thread mode 141.3 secs 155.3 secs
b 1 win, every field on 197.7 secs 204.8 secs
1 win, cmdline 143.9 secs 157.3 secs
4 wins, defaults 204.0 secs 226.2 secs
4 wins, colors w/ x+y 216.9 secs 434.5 secs + 200.3%
. . . . . . . . . . . . . . . . . . . . . . . . . . . . .
notes:
a these results represent the library flags L_NONE zero value and
thus the hidden cost of rebuilding column headers w/ every frame
b while every common field was turned on, not all fields could be
displayed due to limited screen width
c only in a full screen xterm window could all common fields
actually be displayed

2022
top/top.1 Normal file

File diff suppressed because it is too large Load Diff

3798
top/top.c Normal file

File diff suppressed because it is too large Load Diff

606
top/top.h Normal file
View File

@ -0,0 +1,606 @@
/* top.h - Header file: show Linux processes */
/*
* Copyright (c) 2002-2011, by: James C. Warner
* All rights reserved. 8921 Hilloway Road
* Eden Prairie, Minnesota 55347 USA
*
* 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.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Library General Public License for more details.
*/
/* For contributions to this program, the author wishes to thank:
* Craig Small, <csmall@small.dropbear.id.au>
* Albert D. Cahalan, <albert@users.sf.net>
* Sami Kerola, <kerolasa@iki.fi>
*/
#ifndef _Itop
#define _Itop
#include "proc/readproc.h"
/* Development/Debugging defines ----------------------------------- */
//#define ATEOJ_RPTHSH /* report on hash specifics, at end-of-job */
//#define ATEOJ_RPTSTD /* report on misc stuff, at end-of-job */
//#define CASEUP_HEXES /* show any hex values in upper case */
//#define CASEUP_SUFIX /* show time/mem/cnts suffix in upper case */
//#define EQUCOLHDRYES /* yes, do equalize column header lengths */
//#define OFF_HST_HASH /* use BOTH qsort+bsrch vs. hashing scheme */
//#define OFF_STDIOLBF /* disable our own stdout _IOFBF override */
//#define OOMEM_ENABLE /* enable the SuSE out-of-memory additions */
//#define PRETEND2_5_X /* pretend we're linux 2.5.x (for IO-wait) */
//#define PRETEND4CPUS /* pretend we're smp with 4 ticsers (sic) */
//#define PRETENDNOCAP /* use a terminal without essential caps */
//#define RCFILE_NOERR /* rcfile errs silently default, vs. fatal */
//#define RMAN_IGNORED /* don't consider auto right margin glitch */
//#define STRCMPNOCASE /* use strcasecmp vs. strcmp when sorting */
//#define TERMIOS_ONLY /* just limp along with native input only */
//#define TREE_NORESET /* sort keys do NOT force forest view OFF */
//#define TREE_ONEPASS /* for speed, tolerate dangling children */
//#define USE_X_COLHDR /* emphasize header vs. whole col, for 'x' */
/*###### Notes, etc. ###################################################*/
/* The following convention is used to identify those areas where
adaptations for hotplugging are to be found ...
*** hotplug_acclimated ***
( hopefully libproc will also be supportive of our efforts ) */
/* And there are still some of these lurking here and there...
FIXME - blah, blah... */
/* For introducing inaugural cgroup support, thanks to:
Jan Gorig <jgorig@redhat.com> - April, 2011 */
/* For the motivation and path to nls support, thanks to:
Sami Kerola, <kerolasa@iki.fi> */
/* There are still some short strings that may yet be candidates
for nls support inclusion. They're identified with:
// nls_maybe */
#ifdef PRETEND2_5_X
#define linux_version_code LINUX_VERSION(2,5,43)
#endif
#ifdef STRCMPNOCASE
#define STRSORTCMP strcasecmp
#else
#define STRSORTCMP strcmp
#endif
/*###### Some Miscellaneous constants ##################################*/
/* The default delay twix updates */
#define DEF_DELAY 3.0
/* Length of time a message is displayed and the duration
of a 'priming' wait during library startup (in microseconds) */
#define MSG_USLEEP (useconds_t)1250000
#define LIB_USLEEP (useconds_t)150000
/* Specific process id monitoring support (command line only) */
#define MONPIDMAX 20
/* Output override minimums (the -w switch and/or env vars) */
#define W_MIN_COL 3
#define W_MIN_ROW 3
/* Miscellaneous buffers with liberal values and some other defines
-- mostly just to pinpoint source code usage/dependancies */
#define SCREENMAX 512
/* the above might seem pretty stingy, until you consider that with every
one of top's fields displayed it's less than 200 bytes of column header
-- so SCREENMAX provides for all fields plus a 300+ byte command line */
#define CAPBUFSIZ 32
#define CLRBUFSIZ 64
#define PFLAGSSIZ 64
#define SMLBUFSIZ 128
#define MEDBUFSIZ 256
#define LRGBUFSIZ 512
#define OURPATHSZ 1024
#define BIGBUFSIZ 2048
/* in addition to the actual display data, our row might have to accomodate
many termcap/color transitions - these definitions ensure we have room */
#define ROWMINSIZ ( SCREENMAX + 4 * (CAPBUFSIZ + CLRBUFSIZ) )
#define ROWMAXSIZ ( SCREENMAX + 16 * (CAPBUFSIZ + CLRBUFSIZ) )
// support for keyboard stuff (cursor motion keystrokes, mostly)
#define kbd_ENTER '\n'
#define kbd_ESC '\033'
#define kbd_SPACE ' '
#define kbd_UP '\x81'
#define kbd_DOWN '\x82'
#define kbd_RIGHT '\x83'
#define kbd_LEFT '\x84'
#define kbd_PGUP '\x85'
#define kbd_PGDN '\x86'
#define kbd_END '\x87'
#define kbd_HOME '\x88'
#define kbd_BKSP '\x89'
#define kbd_INS '\x8a'
#define kbd_DEL '\x8b'
/* ##### Enum's and Typedef's ############################################ */
/* Flags for each possible field (and then some) --
these MUST be kept in sync with the FLD_t Fieldstab[] array !! */
enum pflag {
P_PID = 0, P_PPD,
P_UED, P_UEN, P_URD, P_URN, P_USD, P_USN,
P_GID, P_GRP, P_PGD, P_TTY, P_TPG, P_SID,
P_PRI, P_NCE, P_THD,
P_CPN, P_CPU, P_TME, P_TM2,
P_MEM, P_VRT, P_SWP, P_RES, P_COD, P_DAT, P_SHR,
P_FL1, P_FL2, P_DRT,
P_STA, P_CMD, P_WCH, P_FLG, P_CGR,
P_SGD, P_SGN, P_TGD,
#ifdef OOMEM_ENABLE
P_OOA, P_OOM,
#endif
#ifdef USE_X_COLHDR
// not really pflags, used with tbl indexing
P_MAXPFLGS
#else
// not really pflags, used with tbl indexing & col highlighting
P_MAXPFLGS, X_XON, X_XOF
#endif
};
/* The scaling 'type' used with scale_num() -- this is how
the passed number is interpreted should scaling be necessary */
enum scale_num {
SK_no, SK_Kb, SK_Mb, SK_Gb, SK_Tb
};
/* This typedef just ensures consistent 'process flags' handling */
typedef unsigned char FLG_t;
/* These typedefs attempt to ensure consistent 'ticks' handling */
typedef unsigned long long TIC_t;
typedef long long SIC_t;
/* Sort support, callback function signature */
typedef int (*QFP_t)(const void *, const void *);
/* This structure consolidates the information that's used
in a variety of display roles. */
typedef struct FLD_t {
const char *head; // name for col heads + toggle/reorder fields
const char *fmts; // snprintf format string for field display
const int width; // field width, if applicable
const int scale; // scale_num type, if applicable
const QFP_t sort; // sort function
const int lflg; // PROC_FILLxxx flag(s) needed by this field
const char *desc; // description for fields management
} FLD_t;
#ifdef OFF_HST_HASH
/* This structure supports 'history' processing and ultimately records
one piece of critical information from one frame to the next --
we don't calc and save data that goes unused like the old top. */
typedef struct HST_t {
TIC_t tics; // last frame's tics count
int pid; // record 'key'
} HST_t;
#else
/* This structure supports 'history' processing and ultimately records
one piece of critical information from one frame to the next --
we don't calc and save data that goes unused like the old top nor
do we incure the overhead of sorting to support a binary search
(or worse, a friggin' for loop) when retrieval is necessary! */
typedef struct HST_t {
TIC_t tics; // last frame's tics count
int pid; // record 'key'
int lnk; // next on hash chain
} HST_t;
#endif
/* This structure stores a frame's cpu tics used in history
calculations. It exists primarily for SMP support but serves
all environments. */
typedef struct CPU_t {
/* other kernels: u == user/us, n == nice/ni, s == system/sy, i == idle/id
2.5.41 kernel: w == IO-wait/wa (io wait time)
2.6.0 kernel: x == hi (hardware irq time), y == si (software irq time)
2.6.11 kernel: z == st (virtual steal time) */
TIC_t u, n, s, i, w, x, y, z; // as represented in /proc/stat
TIC_t u_sav, s_sav, n_sav, i_sav, w_sav, x_sav, y_sav, z_sav; // in the order of our display
unsigned id; // the CPU ID number
} CPU_t;
/* /////////////////////////////////////////////////////////////// */
/* Special Section: multiple windows/field groups --------------- */
/* ( kind of a header within a header: constants, types & macros ) */
#define CAPTABMAX 9 /* max entries in each win's caps table */
#define GROUPSMAX 4 /* the max number of simultaneous windows */
#define WINNAMSIZ 4 /* size of RCW_t winname buf (incl '\0') */
#define GRPNAMSIZ WINNAMSIZ+2 /* window's name + number as in: '#:...' */
/* The Persistent 'Mode' flags!
These are preserved in the rc file, as a single integer and the
letter shown is the corresponding 'command' toggle */
// 'View_' flags affect the summary (minimum), taken from 'Curwin'
#define View_CPUSUM 0x008000 // '1' - show combined cpu stats (vs. each)
#define View_LOADAV 0x004000 // 'l' - display load avg and uptime summary
#define View_STATES 0x002000 // 't' - display task/cpu(s) states summary
#define View_MEMORY 0x001000 // 'm' - display memory summary
#define View_NOBOLD 0x000008 // 'B' - disable 'bold' attribute globally
#define View_SCROLL 0x080000 // 'C' - enable coordinates msg w/ scrolling
// 'Show_' & 'Qsrt_' flags are for task display in a visible window
#define Show_COLORS 0x000800 // 'z' - show in color (vs. mono)
#define Show_HIBOLD 0x000400 // 'b' - rows and/or cols bold (vs. reverse)
#define Show_HICOLS 0x000200 // 'x' - show sort column emphasized
#define Show_HIROWS 0x000100 // 'y' - show running tasks highlighted
#define Show_CMDLIN 0x000080 // 'c' - show cmdline vs. name
#define Show_CTIMES 0x000040 // 'S' - show times as cumulative
#define Show_IDLEPS 0x000020 // 'i' - show idle processes (all tasks)
#define Show_TASKON 0x000010 // '-' - tasks showable when Mode_altscr
#define Show_FOREST 0x000002 // 'V' - show cmd/cmdlines with ascii art
#define Qsrt_NORMAL 0x000004 // 'R' - reversed column sort (high to low)
// these flag(s) have no command as such - they're for internal use
#define EQUWINS_xxx 0x000001 // rebalance all wins & tasks (off 'i'/ 'n')
// Default flags if there's no rcfile to provide user customizations
#define DEF_WINFLGS ( View_LOADAV | View_STATES | View_CPUSUM | View_MEMORY \
| Show_HIBOLD | Show_HIROWS | Show_IDLEPS | Show_TASKON | Qsrt_NORMAL )
/* These are used to direct wins_reflag */
enum reflag_enum {
Flags_TOG, Flags_SET, Flags_OFF
};
/* These are used to direct win_warn */
enum warn_enum {
Warn_ALT, Warn_VIZ
};
/* This type helps support both a window AND the rcfile */
typedef struct RCW_t { // the 'window' portion of an rcfile
FLG_t sortindx; // sort field, represented as a procflag
int winflags, // 'view', 'show' and 'sort' mode flags
maxtasks, // user requested maximum, 0 equals all
summclr, // color num used in summ info
msgsclr, // " in msgs/pmts
headclr, // " in cols head
taskclr; // " in task rows
char winname [WINNAMSIZ], // window name, user changeable
fieldscur [PFLAGSSIZ]; // fields displayed and ordered
} RCW_t;
/* This represents the complete rcfile */
typedef struct RCF_t {
int mode_altscr; // 'A' - Alt display mode (multi task windows)
int mode_irixps; // 'I' - Irix vs. Solaris mode (SMP-only)
float delay_time; // 'd'/'s' - How long to sleep twixt updates
int win_index; // Curwin, as index
RCW_t win [GROUPSMAX]; // a 'WIN_t.rc' for each window
} RCF_t;
/* This structure stores configurable information for each window.
By expending a little effort in its creation and user requested
maintainence, the only real additional per frame cost of having
windows is an extra sort -- but that's just on pointers! */
typedef struct WIN_t {
FLG_t pflgsall [PFLAGSSIZ], // all 'active/on' fieldscur, as enum
procflgs [PFLAGSSIZ]; // fieldscur subset, as enum
RCW_t rc; // stuff that gets saved in the rcfile
int winnum, // a window's number (array pos + 1)
winlines, // current task window's rows (volatile)
maxpflgs, // number of displayed procflgs ("on" in fieldscur)
totpflgs, // total of displayable procflgs in pflgsall array
begpflg, // scrolled beginning pos into pflgsall array
endpflg, // scrolled ending pos into pflgsall array
begtask, // scrolled beginning pos into Frame_maxtask
varcolsz, // max length of variable width column(s)
usrseluid, // validated uid for 'u/U' user selection
usrseltyp, // the basis for matching above uid
hdrcaplen; // column header xtra caps len, if any
char capclr_sum [CLRBUFSIZ], // terminfo strings built from
capclr_msg [CLRBUFSIZ], // RCW_t colors (& rebuilt too),
capclr_pmt [CLRBUFSIZ], // but NO recurring costs !
capclr_hdr [CLRBUFSIZ], // note: sum, msg and pmt strs
capclr_rowhigh [CLRBUFSIZ], // are only used when this
capclr_rownorm [CLRBUFSIZ], // window is the 'Curwin'!
cap_bold [CAPBUFSIZ], // support for View_NOBOLD toggle
grpname [GRPNAMSIZ], // window number:name, printable
#ifdef USE_X_COLHDR
columnhdr [ROWMINSIZ], // column headings for procflgs
#else
columnhdr [SCREENMAX], // column headings for procflgs
#endif
*eolcap, // window specific eol termcap
*captab [CAPTABMAX]; // captab needed by show_special()
proc_t **ppt; // this window's proc_t ptr array
struct WIN_t *next, // next window in window stack
*prev; // prior window in window stack
} WIN_t;
// Used to test/manipulate the window flags
#define CHKw(q,f) (int)((q)->rc.winflags & (f))
#define TOGw(q,f) (q)->rc.winflags ^= (f)
#define SETw(q,f) (q)->rc.winflags |= (f)
#define OFFw(q,f) (q)->rc.winflags &= ~(f)
#define ALTCHKw (Rc.mode_altscr ? 1 : win_warn(Warn_ALT))
#define VIZISw(q) (!Rc.mode_altscr || CHKw(q,Show_TASKON))
#define VIZCHKw(q) (VIZISw(q)) ? 1 : win_warn(Warn_VIZ)
#define VIZTOGw(q,f) (VIZISw(q)) ? TOGw(q,(f)) : win_warn(Warn_VIZ)
// Used to test/manipulte fieldscur values
#define FLDget(q,i) ((FLG_t)((q)->rc.fieldscur[i] & 0x7f) - FLD_OFFSET)
#define FLDtog(q,i) ((q)->rc.fieldscur[i] ^= 0x80)
#define FLDviz(q,i) ((q)->rc.fieldscur[i] & 0x80)
#define ENUchk(w,E) (NULL != strchr((w)->rc.fieldscur, (E + FLD_OFFSET) | 0x80))
#define ENUset(w,E) do { char *t; \
if ((t = strchr((w)->rc.fieldscur, E + FLD_OFFSET))) \
*t = (E + FLD_OFFSET) | 0x80; \
/* else fieldscur char already has high bit on! */ \
} while (0)
#define ENUviz(w,E) (NULL != memchr((w)->procflgs, E, (w)->maxpflgs))
#define ENUpos(w,E) ((int)((FLG_t*)memchr((w)->pflgsall, E, (w)->totpflgs) - (w)->pflgsall))
/* Special Section: end ------------------------------------------ */
/* /////////////////////////////////////////////////////////////// */
/*###### Some Miscellaneous Macro definitions ##########################*/
/* Yield table size as 'int' */
#define MAXTBL(t) (int)(sizeof(t) / sizeof(t[0]))
/* A null-terminating strncpy, assuming strlcpy is not available.
( and assuming callers don't need the string length returned ) */
#define STRLCPY(dst,src) { strncpy(dst, src, sizeof(dst)); dst[sizeof(dst) - 1] = '\0'; }
/* Used to clear all or part of our Pseudo_screen */
#define PSU_CLREOS(y) memset(&Pseudo_screen[ROWMAXSIZ*y], '\0', Pseudo_size-(ROWMAXSIZ*y))
/* Used as return arguments in *some* of the sort callbacks */
#define SORT_lt ( Frame_srtflg > 0 ? 1 : -1 )
#define SORT_gt ( Frame_srtflg > 0 ? -1 : 1 )
#define SORT_eq 0
/* Used to create *most* of the sort callback functions
note: some of the callbacks are NOT your father's callbacks, they're
highly optimized to save them ol' precious cycles! */
#define SCB_NAME(f) sort_P_ ## f
#define SCB_NUM1(f,n) \
static int SCB_NAME(f) (const proc_t **P, const proc_t **Q) { \
if ( (*P)->n < (*Q)->n ) return SORT_lt; \
if ( (*P)->n > (*Q)->n ) return SORT_gt; \
return SORT_eq; }
#define SCB_NUMx(f,n) \
static int SCB_NAME(f) (const proc_t **P, const proc_t **Q) { \
return Frame_srtflg * ( (*Q)->n - (*P)->n ); }
#define SCB_STRS(f,s) \
static int SCB_NAME(f) (const proc_t **P, const proc_t **Q) { \
if (!(*P)->s || !(*Q)->s) return SORT_eq; \
return Frame_srtflg * STRSORTCMP((*Q)->s, (*P)->s); }
#define SCB_STRV(f,b,v,s) \
static int SCB_NAME(f) (const proc_t **P, const proc_t **Q) { \
if (b) { \
if (!(*P)->v || !(*Q)->v) return SORT_eq; \
return Frame_srtflg * STRSORTCMP((*Q)->v[0], (*P)->v[0]); } \
return Frame_srtflg * STRSORTCMP((*Q)->s, (*P)->s); }
#define SCB_STRX(f,s) \
int strverscmp(const char *s1, const char *s2); \
static int SCB_NAME(f) (const proc_t **P, const proc_t **Q) { \
if (!(*P)->s || !(*Q)->s) return SORT_eq; \
return Frame_srtflg * strverscmp((*Q)->s, (*P)->s); }
/*
* The following two macros are used to 'inline' those portions of the
* display process requiring formatting, while protecting against any
* potential embedded 'millesecond delay' escape sequences.
*/
/** PUTT - Put to Tty (used in many places)
. for temporary, possibly interactive, 'replacement' output
. may contain ANY valid terminfo escape sequences
. need NOT represent an entire screen row */
#define PUTT(fmt,arg...) do { \
char _str[ROWMAXSIZ]; \
snprintf(_str, sizeof(_str), fmt, ## arg); \
putp(_str); \
} while (0)
/** PUFF - Put for Frame (used in only 3 places)
. for more permanent frame-oriented 'update' output
. may NOT contain cursor motion terminfo escapes
. assumed to represent a complete screen ROW
. subject to optimization, thus MAY be discarded */
#define PUFF(fmt,arg...) do { \
char _str[ROWMAXSIZ], *_eol; \
_eol = _str + snprintf(_str, sizeof(_str), fmt, ## arg); \
if (Batch) { \
while (*(--_eol) == ' '); *(++_eol) = '\0'; putp(_str); } \
else { \
char *_ptr = &Pseudo_screen[Pseudo_row * ROWMAXSIZ]; \
if (Pseudo_row + 1 < Screen_rows) ++Pseudo_row; \
if (!strcmp(_ptr, _str)) putp("\n"); \
else { \
strcpy(_ptr, _str); \
putp(_ptr); } } \
} while (0)
/* Orderly end, with any sort of message - see fmtmk */
#define debug_END(s) { \
static void error_exit (const char *); \
fputs(Cap_clr_scr, stdout); \
error_exit(s); \
}
/* A poor man's breakpoint, if he's too lazy to learn gdb */
#define its_YOUR_fault { *((char *)0) = '!'; }
/*###### Display Support *Data* ########################################*/
/*###### Some Display Support *Data* ###################################*/
/* ( see module top_nls.c for the nls translatable data ) */
/* Configuration files support */
#define SYS_RCFILESPEC "/etc/toprc"
#define RCF_EYECATCHER "Config File (Linux processes with windows)\n"
#define RCF_VERSION_ID 'f'
/* The default fields displayed and their order, if nothing is
specified by the loser, oops user.
note: any *contiguous* ascii sequence can serve as fieldscur
characters as long as the initial value is coordinated
with that specified for FLD_OFFSET
( we're providing for up to 55 fields initially, )
( with values chosen to avoid the need to escape ) */
#define FLD_OFFSET '%'
// seq_fields "%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ["
#define DEF_FIELDS "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ķ<EFBFBD><C4B7><EFBFBD>&')*+,-./012568<>?ABCFGHIJKLMNOPQRSTUVWXYZ["
/* Pre-configured windows/field groups */
#define JOB_FIELDS "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ļ<EFBFBD><C4BB><EFBFBD><EFBFBD>()*+,-./012568>?@ABCFGHIJKLMNOPQRSTUVWXYZ["
#define MEM_FIELDS "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ij<EFBFBD><C4B3><EFBFBD>&'()*+,-./0125689BFGHIJKLMNOPQRSTUVWXYZ["
#define USR_FIELDS "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>)+,-./1234568;<=>?@ABCFGHIJKLMNOPQRSTUVWXYZ["
/* The default values for the local config file */
#define DEF_RCFILE { \
0, 1, DEF_DELAY, 0, { \
{ P_CPU, DEF_WINFLGS, 0, \
COLOR_RED, COLOR_RED, COLOR_YELLOW, COLOR_RED, \
"Def", DEF_FIELDS }, \
{ P_PID, DEF_WINFLGS, 0, \
COLOR_CYAN, COLOR_CYAN, COLOR_WHITE, COLOR_CYAN, \
"Job", JOB_FIELDS }, \
{ P_MEM, DEF_WINFLGS, 0, \
COLOR_MAGENTA, COLOR_MAGENTA, COLOR_BLUE, COLOR_MAGENTA, \
"Mem", MEM_FIELDS }, \
{ P_UEN, DEF_WINFLGS, 0, \
COLOR_YELLOW, COLOR_YELLOW, COLOR_GREEN, COLOR_YELLOW, \
"Usr", USR_FIELDS } \
} }
/* The format string used with variable width columns --
see 'calibrate_fields' for supporting logic. */
#define VARCOL_fmts "%-*.*s "
/* Summary Lines specially formatted string(s) --
see 'show_special' for syntax details + other cautions. */
#define LOADAV_line "%s -%s\n"
#define LOADAV_line_alt "%s\06 -%s\n"
/*###### For Piece of mind #############################################*/
/* just sanity check(s)... */
#if defined(ATEOJ_RPTHSH) && defined(OFF_HST_HASH)
# error 'ATEOJ_RPTHSH' conflicts with 'OFF_HST_HASH'
#endif
#if (LRGBUFSIZ < SCREENMAX)
# error 'LRGBUFSIZ' must NOT be less than 'SCREENMAX'
#endif
/*###### Some Prototypes (ha!) #########################################*/
/* These 'prototypes' are here mostly for documentation purposes -- */
/* for now, the only essential one is task_show needed by find_string */
/*------ Sort callbacks ------------------------------------------------*/
/* for each possible field, in the form of: */
/*atic int sort_P_XXX (const proc_t **P, const proc_t **Q); */
/*------ Tiny useful routine(s) ----------------------------------------*/
//atic const char *fmtmk (const char *fmts, ...);
//atic inline char *scat (char *dst, const char *src);
#ifdef TERMIOS_ONLY
//atic char *strim (char *str);
#endif
//atic const char *tg2 (int x, int y);
/*------ Exit/Interrput routines ---------------------------------------*/
//atic void bye_bye (const char *str);
//atic void error_exit (const char *str);
//atic void library_err (const char *fmts, ...);
//atic void pause_pgm (void);
//atic void sig_abexit (int sig);
//atic void sig_endpgm (int dont_care_sig);
//atic void sig_paused (int dont_care_sig);
//atic void sig_resize (int dont_care_sig);
/*------ Misc Color/Display support ------------------------------------*/
//atic void capsmk (WIN_t *q);
//atic void show_msg (const char *str);
//atic int show_pmt (const char *str);
//atic inline void show_scroll (void);
//atic void show_special (int interact, const char *glob);
/*------ Low Level Memory/Keyboard support -----------------------------*/
//atic void *alloc_c (size_t num);
//atic void *alloc_r (void *ptr, size_t num);
//atic int chin (int ech, char *buf, unsigned cnt);
//atic int keyin (int init);
//atic char *linein (const char *prompt);
/*------ Small Utility routines ----------------------------------------*/
//atic float get_float (const char *prompt);
//atic int get_int (const char *prompt);
//atic const char *scale_num (unsigned long num, const int width, const int type);
//atic const char *scale_tics (TIC_t tics, const int width);
//atic const char *user_certify (WIN_t *q, const char *str, char typ);
//atic inline int user_matched (WIN_t *q, const proc_t *p);
/*------ Fields Management support -------------------------------------*/
/*atic FLD_t Fieldstab[] = { ... } */
//atic void adj_geometry (void);
//atic void calibrate_fields (void);
//atic void display_fields (int focus, int extend);
//atic void fields_utility (void);
//atic void zap_fieldstab (void);
/*------ Library Interface ---------------------------------------------*/
//atic CPU_t *cpus_refresh (CPU_t *cpus);
#ifdef OFF_HST_HASH
//atic inline HST_t *hstbsrch (HST_t *hst, int max, int pid);
#else
//atic inline HST_t *hstget (int pid);
//atic inline void hstput (unsigned idx);
#endif
//atic void prochlp (proc_t *p);
//atic void procs_refresh (void);
//atic void sysinfo_refresh (int forced);
/*------ Startup routines ----------------------------------------------*/
//atic void before (char *me);
//atic void configs_read (void);
//atic void parse_args (char **args);
//atic void whack_terminal (void);
/*------ Windows/Field Groups support ----------------------------------*/
//atic void win_names (WIN_t *q, const char *name);
//atic WIN_t *win_select (char ch);
//atic int win_warn (int what);
//atic void winsclrhlp (WIN_t *q, int save);
//atic void wins_colors (void);
//atic void wins_reflag (int what, int flg);
//atic void wins_stage_1 (void);
//atic void wins_stage_2 (void);
/*------ Interactive Input support (do_key helpers) --------------------*/
//atic void file_writerc (void);
//atic void find_string (int ch);
//atic void help_view (void);
//atic void keys_global (int ch);
//atic void keys_summary (int ch);
//atic void keys_task (int ch);
//atic void keys_window (int ch);
//atic void keys_xtra (int ch);
/*------ Forest View support -------------------------------------------*/
//atic void forest_add (const int self, const int level);
//atic void forest_create (WIN_t *q);
//atic inline const char *forest_display (const WIN_t *q, const proc_t *p);
/*------ Main Screen routines ------------------------------------------*/
//atic void do_key (int ch);
//atic void summaryhlp (CPU_t *cpu, const char *pfx);
//atic void summary_show (void);
static void task_show (const WIN_t *q, const proc_t *p, char *ptr);
//atic int window_show (WIN_t *q, int wmax);
/*------ Entry point plus two ------------------------------------------*/
//atic void framehlp (int wix, int max);
//atic void frame_make (void);
// int main (int dont_care_argc, char **argv);
#endif /* _Itop */

558
top/top_nls.c Normal file
View File

@ -0,0 +1,558 @@
/* top_nls.c - provide the basis for future nls translations */
/*
* Copyright (c) 2011, by: James C. Warner
* All rights reserved. 8921 Hilloway Road
* Eden Prairie, Minnesota 55347 USA
*
* 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.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Library General Public License for more details.
*/
/* For contributions to this program, the author wishes to thank:
* Craig Small, <csmall@small.dropbear.id.au>
* Sami Kerola, <kerolasa@iki.fi>
*/
#include <stdio.h>
#include <string.h>
#include "top.h"
#include "top_nls.h"
/*
* These are our three string tables with the following contents:
* Desc : fields descriptions not to exceed 20 screen positions
* Norm : regular text possibly also containing c-format specifiers
* Uniq : show_special specially formatted strings
*
* The latter table presents the greates translation challenge !
*/
const char *Desc_nlstab[P_MAXPFLGS];
const char *Norm_nlstab[norm_MAX];
const char *Uniq_nlstab[uniq_MAX];
/*
* This routine builds the nls table containing plain text only
* used as the field descriptions. Each translated line MUST be
* kept to a maximum of 20 characters or less! */
static void build_desc_nlstab (void) {
char buf[SMLBUFSIZ];
snprintf(buf, sizeof(buf), "%s", _(
"-------------------------------------------------------------------------------\n"
"Note for Translators:\n"
" This group of single lines contains plain text only used as the\n"
" field descriptions. Each translated line MUST be kept to a length\n"
" of 20 characters or less.\n"
"\n"
"( this text is for information only and need never be translated )\n"
""));
snprintf(buf, sizeof(buf), "%s", _("Process Id"));
Desc_nlstab[P_PID] = strdup(buf);
snprintf(buf, sizeof(buf), "%s", _("Parent Process pid"));
Desc_nlstab[P_PPD] = strdup(buf);
snprintf(buf, sizeof(buf), "%s", _("Effective User Id"));
Desc_nlstab[P_UED] = strdup(buf);
snprintf(buf, sizeof(buf), "%s", _("Effective User Name"));
Desc_nlstab[P_UEN] = strdup(buf);
snprintf(buf, sizeof(buf), "%s", _("Real User Id"));
Desc_nlstab[P_URD] = strdup(buf);
snprintf(buf, sizeof(buf), "%s", _("Real User Name"));
Desc_nlstab[P_URN] = strdup(buf);
snprintf(buf, sizeof(buf), "%s", _("Saved User Id"));
Desc_nlstab[P_USD] = strdup(buf);
snprintf(buf, sizeof(buf), "%s", _("Saved User Name"));
Desc_nlstab[P_USN] = strdup(buf);
snprintf(buf, sizeof(buf), "%s", _("Group Id"));
Desc_nlstab[P_GID] = strdup(buf);
snprintf(buf, sizeof(buf), "%s", _("Group Name"));
Desc_nlstab[P_GRP] = strdup(buf);
snprintf(buf, sizeof(buf), "%s", _("Process Group Id"));
Desc_nlstab[P_PGD] = strdup(buf);
snprintf(buf, sizeof(buf), "%s", _("Controlling Tty"));
Desc_nlstab[P_TTY] = strdup(buf);
snprintf(buf, sizeof(buf), "%s", _("Tty Process Grp Id"));
Desc_nlstab[P_TPG] = strdup(buf);
snprintf(buf, sizeof(buf), "%s", _("Session Id"));
Desc_nlstab[P_SID] = strdup(buf);
snprintf(buf, sizeof(buf), "%s", _("Priority"));
Desc_nlstab[P_PRI] = strdup(buf);
snprintf(buf, sizeof(buf), "%s", _("Nice Value"));
Desc_nlstab[P_NCE] = strdup(buf);
snprintf(buf, sizeof(buf), "%s", _("Number of Threads"));
Desc_nlstab[P_THD] = strdup(buf);
snprintf(buf, sizeof(buf), "%s", _("Last Used Cpu (SMP)"));
Desc_nlstab[P_CPN] = strdup(buf);
snprintf(buf, sizeof(buf), "%s", _("CPU Usage"));
Desc_nlstab[P_CPU] = strdup(buf);
snprintf(buf, sizeof(buf), "%s", _("CPU Time"));
Desc_nlstab[P_TME] = strdup(buf);
snprintf(buf, sizeof(buf), "%s", _("CPU Time, hundredths"));
Desc_nlstab[P_TM2] = strdup(buf);
snprintf(buf, sizeof(buf), "%s", _("Memory Usage (RES)"));
Desc_nlstab[P_MEM] = strdup(buf);
snprintf(buf, sizeof(buf), "%s", _("Virtual Image (kb)"));
Desc_nlstab[P_VRT] = strdup(buf);
snprintf(buf, sizeof(buf), "%s", _("Swapped Size (kb)"));
Desc_nlstab[P_SWP] = strdup(buf);
snprintf(buf, sizeof(buf), "%s", _("Resident Size (kb)"));
Desc_nlstab[P_RES] = strdup(buf);
snprintf(buf, sizeof(buf), "%s", _("Code Size (kb)"));
Desc_nlstab[P_COD] = strdup(buf);
snprintf(buf, sizeof(buf), "%s", _("Data+Stack Size (kb)"));
Desc_nlstab[P_DAT] = strdup(buf);
snprintf(buf, sizeof(buf), "%s", _("Shared Mem Size (kb)"));
Desc_nlstab[P_SHR] = strdup(buf);
snprintf(buf, sizeof(buf), "%s", _("Major Page Faults"));
Desc_nlstab[P_FL1] = strdup(buf);
snprintf(buf, sizeof(buf), "%s", _("Minor Page Faults"));
Desc_nlstab[P_FL2] = strdup(buf);
snprintf(buf, sizeof(buf), "%s", _("Dirty Pages Count"));
Desc_nlstab[P_DRT] = strdup(buf);
snprintf(buf, sizeof(buf), "%s", _("Process Status"));
Desc_nlstab[P_STA] = strdup(buf);
snprintf(buf, sizeof(buf), "%s", _("Command Name/Line"));
Desc_nlstab[P_CMD] = strdup(buf);
snprintf(buf, sizeof(buf), "%s", _("Sleeping in Function"));
Desc_nlstab[P_WCH] = strdup(buf);
snprintf(buf, sizeof(buf), "%s", _("Task Flags <sched.h>"));
Desc_nlstab[P_FLG] = strdup(buf);
snprintf(buf, sizeof(buf), "%s", _("Control Groups"));
Desc_nlstab[P_CGR] = strdup(buf);
snprintf(buf, sizeof(buf), "%s", _("Supp Groups IDs"));
Desc_nlstab[P_SGD] = strdup(buf);
snprintf(buf, sizeof(buf), "%s", _("Supp Groups Names"));
Desc_nlstab[P_SGN] = strdup(buf);
snprintf(buf, sizeof(buf), "%s", _("Thread Group Id"));
#ifdef OOMEM_ENABLE
Desc_nlstab[P_TGD] = strdup(buf);
snprintf(buf, sizeof(buf), "%s", _("oom_adjustment (2^X)"));
Desc_nlstab[P_OOA] = strdup(buf);
snprintf(buf, sizeof(buf), "%s", _("oom_score (badness)"));
Desc_nlstab[P_OOM] = strdup(buf);
#endif
}
/*
* This routine builds the nls table containing both plain text
* and regular c-format strings. */
static void build_norm_nlstab (void) {
char buf[MEDBUFSIZ];
snprintf(buf, sizeof(buf), "%s", _(
"-------------------------------------------------------------------------------\n"
"Note for Translators:\n"
" This group of lines contains both plain text and c-format strings.\n"
" Some strings reflect switches used to affect the running program\n"
" and should not be translated without also making corresponding\n"
" c-code logic changes.\n"
"\n"
"( this text is for information only and need never be translated )\n"
""));
snprintf(buf, sizeof(buf), "%s", _(
"\n"
"\tsignal %d (%s) was caught by %s, please\n"
"\tsee http://www.debian.org/Bugs/Reporting\n"
""));
Norm_nlstab[EXIT_signals_fmt] = strdup(buf);
snprintf(buf, sizeof(buf), "%s", _(
"inappropriate '%s'\n"
"usage:\t%s%s"
""));
Norm_nlstab[WRONG_switch_fmt] = strdup(buf);
snprintf(buf, sizeof(buf), "%s", _(
"\t%s\n"
"usage:\t%s%s"
""));
Norm_nlstab[HELP_cmdline_fmt] = strdup(buf);
snprintf(buf, sizeof(buf), "%s", _("failed /proc/stat open: %s"));
Norm_nlstab[FAIL_statopn_fmt] = strdup(buf);
snprintf(buf, sizeof(buf), "%s", _("failed openproc: %s"));
Norm_nlstab[FAIL_openlib_txt] = strdup(buf);
snprintf(buf, sizeof(buf), "%s", _("bad delay interval '%s'"));
Norm_nlstab[BAD_delayint_fmt] = strdup(buf);
snprintf(buf, sizeof(buf), "%s", _("bad iterations argument '%s'"));
Norm_nlstab[BAD_niterate_arg] = strdup(buf);
snprintf(buf, sizeof(buf), "%s", _("pid limit (%d) exceeded"));
Norm_nlstab[LIMIT_exceed_fmt] = strdup(buf);
snprintf(buf, sizeof(buf), "%s", _("bad pid '%s'"));
Norm_nlstab[BAD_mon_pids_fmt] = strdup(buf);
snprintf(buf, sizeof(buf), "%s", _("-%c requires argument"));
Norm_nlstab[MISSING_args_fmt] = strdup(buf);
snprintf(buf, sizeof(buf), "%s", _("bad width arg '%s', must > %d"));
Norm_nlstab[BAD_widtharg_fmt] = strdup(buf);
snprintf(buf, sizeof(buf), "%s", _(
"unknown option '%c'\n"
"usage:\t%s%s"
""));
Norm_nlstab[UNKNOWN_opts_fmt] = strdup(buf);
snprintf(buf, sizeof(buf), "%s", _("-d disallowed in \"secure\" mode"));
Norm_nlstab[DELAY_secure_txt] = strdup(buf);
snprintf(buf, sizeof(buf), "%s", _("-d requires positive argument"));
Norm_nlstab[DELAY_badarg_txt] = strdup(buf);
snprintf(buf, sizeof(buf), "%s", _("On"));
Norm_nlstab[ON_word_only_txt] = strdup(buf);
snprintf(buf, sizeof(buf), "%s", _("Off"));
Norm_nlstab[OFF_one_word_txt] = strdup(buf);
snprintf(buf, sizeof(buf), "%s", _(" -hv | -bcHiSs -d delay -n limit -u|U user | -p pid[,pid] -w [cols]"));
Norm_nlstab[USAGE_abbrev_txt] = strdup(buf);
snprintf(buf, sizeof(buf), "%s", _("failed /proc/stat read"));
Norm_nlstab[FAIL_statget_txt] = strdup(buf);
snprintf(buf, sizeof(buf), "%s", _("Forest mode %s"));
Norm_nlstab[FOREST_modes_fmt] = strdup(buf);
snprintf(buf, sizeof(buf), "%s", _("failed tty get"));
Norm_nlstab[FAIL_tty_get_txt] = strdup(buf);
snprintf(buf, sizeof(buf), "%s", _("failed Tty_tweaked set: %s"));
Norm_nlstab[FAIL_tty_mod_fmt] = strdup(buf);
snprintf(buf, sizeof(buf), "%s", _("failed Tty_raw set: %s"));
Norm_nlstab[FAIL_tty_raw_fmt] = strdup(buf);
snprintf(buf, sizeof(buf), "%s", _("Choose field group (1 - 4)"));
Norm_nlstab[CHOOSE_group_txt] = strdup(buf);
snprintf(buf, sizeof(buf), "%s", _("Command disabled, 'A' mode required"));
Norm_nlstab[DISABLED_cmd_fmt] = strdup(buf);
snprintf(buf, sizeof(buf), "%s", _("Command disabled, activate %s with '-' or '_'"));
Norm_nlstab[DISABLED_win_fmt] = strdup(buf);
snprintf(buf, sizeof(buf), "%s", _("No colors to map!"));
Norm_nlstab[COLORS_nomap_txt] = strdup(buf);
snprintf(buf, sizeof(buf), "%s", _("Failed '%s' open: %s"));
Norm_nlstab[FAIL_rc_open_fmt] = strdup(buf);
snprintf(buf, sizeof(buf), "%s", _("Wrote configuration to '%s'"));
Norm_nlstab[WRITE_rcfile_fmt] = strdup(buf);
snprintf(buf, sizeof(buf), "%s", _("Change delay from %.1f to"));
Norm_nlstab[DELAY_change_fmt] = strdup(buf);
snprintf(buf, sizeof(buf), "%s", _("Show threads %s"));
Norm_nlstab[THREADS_show_fmt] = strdup(buf);
snprintf(buf, sizeof(buf), "%s", _("Irix mode %s"));
Norm_nlstab[IRIX_curmode_fmt] = strdup(buf);
snprintf(buf, sizeof(buf), "%s", _("pid to signal/kill"));
Norm_nlstab[GET_pid2kill_txt] = strdup(buf);
snprintf(buf, sizeof(buf), "%s", _("Send pid %d signal [%d/sigterm]"));
Norm_nlstab[GET_sigs_num_fmt] = strdup(buf);
snprintf(buf, sizeof(buf), "%s", _("Failed signal pid '%d' with '%d': %s"));
Norm_nlstab[FAIL_signals_fmt] = strdup(buf);
snprintf(buf, sizeof(buf), "%s", _("Invalid signal"));
Norm_nlstab[BAD_signalid_txt] = strdup(buf);
snprintf(buf, sizeof(buf), "%s", _("PID to renice"));
Norm_nlstab[GET_pid2nice_txt] = strdup(buf);
snprintf(buf, sizeof(buf), "%s", _("Renice PID %d to value"));
Norm_nlstab[GET_nice_num_fmt] = strdup(buf);
snprintf(buf, sizeof(buf), "%s", _("Failed renice of PID %d to %d: %s"));
Norm_nlstab[FAIL_re_nice_fmt] = strdup(buf);
snprintf(buf, sizeof(buf), "%s", _("Rename window '%s' to (1-3 chars)"));
Norm_nlstab[NAME_windows_fmt] = strdup(buf);
snprintf(buf, sizeof(buf), "%s", _("Cumulative time %s"));
Norm_nlstab[TIME_accumed_fmt] = strdup(buf);
snprintf(buf, sizeof(buf), "%s", _("Maximum tasks = %d, change to (0 is unlimited)"));
Norm_nlstab[GET_max_task_fmt] = strdup(buf);
snprintf(buf, sizeof(buf), "%s", _("Invalid maximum"));
Norm_nlstab[BAD_max_task_txt] = strdup(buf);
snprintf(buf, sizeof(buf), "%s", _("Nothing to highlight!"));
Norm_nlstab[HILIGHT_cant_txt] = strdup(buf);
snprintf(buf, sizeof(buf), "%s", _("Which user (blank for all)"));
Norm_nlstab[GET_user_ids_txt] = strdup(buf);
snprintf(buf, sizeof(buf), "%s", _("Unknown command - try 'h' for help"));
Norm_nlstab[UNKNOWN_cmds_txt] = strdup(buf);
snprintf(buf, sizeof(buf), "%s", _("scroll coordinates: y = %d/%d (tasks), x = %d/%d (fields)"));
Norm_nlstab[SCROLL_coord_fmt] = strdup(buf);
snprintf(buf, sizeof(buf), "%s", _("failed memory allocate"));
Norm_nlstab[FAIL_alloc_c_txt] = strdup(buf);
snprintf(buf, sizeof(buf), "%s", _("failed memory re-allocate"));
Norm_nlstab[FAIL_alloc_r_txt] = strdup(buf);
snprintf(buf, sizeof(buf), "%s", _("Unacceptable floating point"));
Norm_nlstab[BAD_numfloat_txt] = strdup(buf);
snprintf(buf, sizeof(buf), "%s", _("Invalid user"));
Norm_nlstab[BAD_username_txt] = strdup(buf);
snprintf(buf, sizeof(buf), "%s", _("failed sigprocmask, SIG_BLOCK: %s"));
Norm_nlstab[FAIL_sigstop_fmt] = strdup(buf);
snprintf(buf, sizeof(buf), "%s", _("failed sigprocmask, SIG_SETMASK: %s"));
Norm_nlstab[FAIL_sigmask_fmt] = strdup(buf);
snprintf(buf, sizeof(buf), "%s", _("forest view"));
Norm_nlstab[FOREST_views_txt] = strdup(buf);
snprintf(buf, sizeof(buf), "%s", _("failed pid maximum size test"));
Norm_nlstab[FAIL_widepid_txt] = strdup(buf);
snprintf(buf, sizeof(buf), "%s", _("failed number of cpus test"));
Norm_nlstab[FAIL_widecpu_txt] = strdup(buf);
snprintf(buf, sizeof(buf), "%s", _("incompatible rcfile, you should delete '%s'"));
Norm_nlstab[RC_bad_files_fmt] = strdup(buf);
snprintf(buf, sizeof(buf), "%s", _("window entry #%d corrupt, please delete '%s'"));
Norm_nlstab[RC_bad_entry_fmt] = strdup(buf);
snprintf(buf, sizeof(buf), "%s", _("Unavailable in secure mode"));
Norm_nlstab[NOT_onsecure_txt] = strdup(buf);
snprintf(buf, sizeof(buf), "%s", _("Only 1 cpu detected"));
Norm_nlstab[NOT_smp_cpus_txt] = strdup(buf);
snprintf(buf, sizeof(buf), "%s", _("Unacceptable integer"));
Norm_nlstab[BAD_integers_txt] = strdup(buf);
snprintf(buf, sizeof(buf), "%s", _("conflicting process selections (U/p/u)"));
Norm_nlstab[SELECT_clash_txt] = strdup(buf);
snprintf(buf, sizeof(buf), "%s", _("Kb"));
Norm_nlstab[AMT_kilobyte_txt] = strdup(buf);
snprintf(buf, sizeof(buf), "%s", _("Mb"));
Norm_nlstab[AMT_megabyte_txt] = strdup(buf);
snprintf(buf, sizeof(buf), "%s", _("Gb"));
Norm_nlstab[AMT_gigabyte_txt] = strdup(buf);
snprintf(buf, sizeof(buf), "%s", _("Threads"));
Norm_nlstab[WORD_threads_txt] = strdup(buf);
snprintf(buf, sizeof(buf), "%s", _("Tasks"));
Norm_nlstab[WORD_process_txt] = strdup(buf);
}
/*
* This routine builds the nls table containing specially
* formatted strings designed to fit within an 80x24 terminal. */
static void build_uniq_nsltab (void) {
char buf[BIGBUFSIZ];
snprintf(buf, sizeof(buf), "%s", _(
"-------------------------------------------------------------------------------\n"
"Note for Translators:\n"
" The next 11 text groups contain unprintable characters used to\n"
" index a capabilities table at run-time. You may need a special\n"
" editor which can accomodate such data without altering it.\n"
"\n"
" Please see the comments in the source file for additional\n"
" information and guidance regarding these strings.\n"
"\n"
"( this text is for information only and need never be translated )\n"
""));
/*
* These lines contain special formatting elements and are very
* carefully designed to fit within a 80x24 terminal window.
* The special formatting consists of:
* "some text <_delimiter_> some more text <_delimiter_>...\n"
* Where <_delimiter_> is a single byte in the range of:
* \01 through \10 (in decimalizee, 1 - 8)
* and is used to select an 'attribute' from a capabilities table
* which is then applied to the *preceding* substring.
* Once recognized, the delimiter is replaced with a null character
* and viola, we've got a substring ready to output! Strings or
* substrings without delimiters will receive the Cap_norm attribute.
*
* note: the following is an example of the capabilities
* table for which the unprintable characters are
* used as an index.
* +------------------------------------------------------+
* | char *captab[] = { : Cap's/Delim's |
* | Cap_norm, Cap_norm, = \00, \01, |
* | cap_bold, capclr_sum, = \02, \03, |
* | capclr_msg, capclr_pmt, = \04, \05, |
* | capclr_hdr, = \06, |
* | capclr_rowhigh, = \07, |
* | capclr_rownorm }; = \10 [octal!] |
* +------------------------------------------------------+ */
snprintf(buf, sizeof(buf), "%s", _(
"Help for Interactive Commands\02 - %s\n"
"Window \01%s\06: \01Cumulative mode \03%s\02. \01System\06: \01Delay \03%.1f secs\02; \01Secure mode \03%s\02.\n"
"\n"
" Z\05,\01B\05 Global: '\01Z\02' change color mappings; '\01B\02' disable/enable bold\n"
" l,t,m Toggle Summaries: '\01l\02' load avg; '\01t\02' task/cpu stats; '\01m\02' mem info\n"
" 1,I Toggle SMP view: '\0011\02' single/separate states; '\01I\02' Irix/Solaris mode\n"
" f,F Manage Fields: add/remove; change order; select sort field\n"
"\n"
" <,> . Move sort field: '\01<\02' next col left; '\01>\02' next col right\n"
" R,H,V . Toggle: '\01R\02' norm/rev sort; '\01H\02' show threads; '\01V\02' forest view\n"
" c,i,S . Toggle: '\01c\02' cmd name/line; '\01i\02' idle tasks; '\01S\02' cumulative time\n"
" x\05,\01y\05 . Toggle highlights: '\01x\02' sort field; '\01y\02' running tasks\n"
" z\05,\01b\05 . Toggle: '\01z\02' color/mono; '\01b\02' bold/reverse (only if 'x' or 'y')\n"
" u,U . Show: '\01u\02' effective user; '\01U\02' real, saved, file or effective user\n"
" n or # . Set maximum tasks displayed\n"
" C,... . Toggle scroll coordinates msg for: \01up\02,\01down\02,\01left\02,right\02,\01home\02,\01end\02\n"
"\n"
"%s"
" W Write configuration file\n"
" q Quit\n"
" ( commands shown with '.' require a \01visible\02 task display \01window\02 ) \n"
"Press '\01h\02' or '\01?\02' for help with \01Windows\02,\n"
"any other key to continue "
""));
Uniq_nlstab[KEYS_helpbas_fmt] = strdup(buf);
snprintf(buf, sizeof(buf), "%s", _(
" k,r Manipulate tasks: '\01k\02' kill; '\01r\02' renice\n"
" d or s Set update interval\n"
""));
Uniq_nlstab[KEYS_helpext_fmt] = strdup(buf);
snprintf(buf, sizeof(buf), "%s", _(
"Help for Windows / Field Groups\02 - \"Current Window\" = \01 %s \06\n"
"\n"
". Use multiple \01windows\02, each with separate config opts (color,fields,sort,etc)\n"
". The 'current' window controls the \01Summary Area\02 and responds to your \01Commands\02\n"
" . that window's \01task display\02 can be turned \01Off\02 & \01On\02, growing/shrinking others\n"
" . with \01NO\02 task display, some commands will be \01disabled\02 ('i','R','n','c', etc)\n"
" until a \01different window\02 has been activated, making it the 'current' window\n"
". You \01change\02 the 'current' window by: \01 1\02) cycling forward/backward;\01 2\02) choosing\n"
" a specific field group; or\01 3\02) exiting the color mapping or fields screens\n"
". Commands \01available anytime -------------\02\n"
" A . Alternate display mode toggle, show \01Single\02 / \01Multiple\02 windows\n"
" g . Choose another field group and make it 'current', or change now\n"
" by selecting a number from: \01 1\02 =%s;\01 2\02 =%s;\01 3\02 =%s; or\01 4\02 =%s\n"
". Commands \01requiring\02 '\01A\02' mode\01 -------------\02\n"
" G . Change the \01Name\05 of the 'current' window/field group\n"
" \01*\04 a , w . Cycle through all four windows: '\01a\05' Forward; '\01w\05' Backward\n"
" \01*\04 - , _ . Show/Hide: '\01-\05' \01Current\02 window; '\01_\05' all \01Visible\02/\01Invisible\02\n"
" The screen will be divided evenly between task displays. But you can make\n"
" some \01larger\02 or \01smaller\02, using '\01n\02' and '\01i\02' commands. Then later you could:\n"
" \01*\04 = , + . Rebalance tasks: '\01=\05' \01Current\02 window; '\01+\05' \01Every\02 window\n"
" (this also forces the \01current\02 or \01every\02 window to become visible)\n"
"\n"
"In '\01A\02' mode, '\01*\04' keys are your \01essential\02 commands. Please try the '\01a\02' and '\01w\02'\n"
"commands plus the 'g' sub-commands NOW. Press <Enter> to make 'Current' "
""));
Uniq_nlstab[WINDOWS_help_fmt] = strdup(buf);
snprintf(buf, sizeof(buf), "%s", _(
"Help for color mapping\02 - %s\n"
"current window: \01%s\06\n"
"\n"
" color - 04:25:44 up 8 days, 50 min, 7 users, load average:\n"
" Tasks:\03 64 \02total,\03 2 \03running,\03 62 \02sleeping,\03 0 \02stopped,\03\n"
" %%Cpu(s):\03 76.5 \02user,\03 11.2 \02system,\03 0.0 \02nice,\03 12.3 \02idle\03\n"
" \01 Nasty Message! \04 -or- \01Input Prompt\05\n"
" \01 PID TTY PR NI %%CPU TIME+ VIRT SWAP S COMMAND \06\n"
" 17284 \10pts/2 \07 8 0 0.0 0:00.75 1380 0 S /bin/bash \10\n"
" \01 8601 pts/1 7 -10 0.4 0:00.03 916 0 R color -b -z\07\n"
" 11005 \10? \07 9 0 0.0 0:02.50 2852 1008 S amor -sessi\10\n"
" available toggles: \01B\02 =disable bold globally (\01%s\02),\n"
" \01z\02 =color/mono (\01%s\02), \01b\02 =tasks \"bold\"/reverse (\01%s\02)\n"
"\n"
"Select \01target\02 as upper case letter:\n"
" S\02 = Summary Data,\01 M\02 = Messages/Prompts,\n"
" H\02 = Column Heads,\01 T\02 = Task Information\n"
"Select \01color\02 as number:\n"
" 0\02 = black,\01 1\02 = red, \01 2\02 = green,\01 3\02 = yellow,\n"
" 4\02 = blue, \01 5\02 = magenta,\01 6\02 = cyan, \01 7\02 = white\n"
"\n"
"Selected: \01target\02 \01 %c \04; \01color\02 \01 %d \04\n"
" press 'q' to abort changes to window '\01%s\02'\n"
" press 'a' or 'w' to commit & change another, <Enter> to commit and end "
""));
Uniq_nlstab[COLOR_custom_fmt] = strdup(buf);
snprintf(buf, sizeof(buf), "%s", _(
"Fields Management\02 for window \01%s\06, whose current sort field is \01%s\02\n"
" Navigate with Up/Dn, Right selects for move then <Enter> or Left commits,\n"
" 'd' or <Space> toggles display, 's' sets sort. Use 'q' or <Esc> to end! "
""));
Uniq_nlstab[FIELD_header_fmt] = strdup(buf);
snprintf(buf, sizeof(buf), "%s", _("%s:\03"
" %3u \02total,\03 %3u \02running,\03 %3u \02sleeping,\03 %3u \02stopped,\03 %3u \02zombie\03\n"
""));
Uniq_nlstab[STATE_line_1_fmt] = strdup(buf);
snprintf(buf, sizeof(buf), "%s", _("%%%s\03"
" %#5.1f \02user,\03 %#5.1f \02system,\03 %#5.1f \02nice,\03 %#5.1f \02idle\03\n"
""));
Uniq_nlstab[STATE_lin2x4_fmt] = strdup(buf);
/* These are the meanings for abbreviations used below:
* lnx 2.5.x, procps-3.0.5 : IO-wait = i/o wait time
* lnx 2.6.x, procps-3.1.12 : IO-wait now wa, hi = hard irq, si = soft irq
* lnx 2.7.x, procps-3.2.7 : st = steal time */
snprintf(buf, sizeof(buf), "%s", _("%%%s\03"
" %#5.1f \02user,\03 %#5.1f \02system,\03 %#5.1f \02nice,\03 %#5.1f \02idle,\03 %#5.1f \02IO-wait\03\n"
""));
Uniq_nlstab[STATE_lin2x5_fmt] = strdup(buf);
snprintf(buf, sizeof(buf), "%s", _("%%%s\03"
" %#5.1f \02us,\03 %#5.1f \02sy,\03 %#5.1f \02ni,\03 %#5.1f \02id,\03 %#5.1f \02wa,\03 %#5.1f \02hi,\03 %#5.1f \02si\03\n"
""));
Uniq_nlstab[STATE_lin2x6_fmt] = strdup(buf);
snprintf(buf, sizeof(buf), "%s", _("%%%s\03"
"%#5.1f \02us,\03%#5.1f \02sy,\03%#5.1f \02ni,\03%#5.1f \02id,\03%#5.1f \02wa,\03%#5.1f \02hi,\03%#5.1f \02si,\03%#5.1f \02st\03\n"
""));
Uniq_nlstab[STATE_lin2x7_fmt] = strdup(buf);
snprintf(buf, sizeof(buf), "%s", _(
"%s Mem: \03 %8lu \02total,\03 %8lu \02used,\03 %8lu \02free,\03 %8lu \02buffers\03\n"
"%s Swap:\03 %8lu \02total,\03 %8lu \02used,\03 %8lu \02free,\03 %8lu \02cached\03\n"
""));
Uniq_nlstab[MEMORY_lines_fmt] = strdup(buf);
}
/*
* Duh... */
void initialize_nsl (void) {
build_desc_nlstab();
build_norm_nlstab();
build_uniq_nsltab();
}

84
top/top_nls.h Normal file
View File

@ -0,0 +1,84 @@
/* top_nls.h - provide the basis for future nls translations */
/*
* Copyright (c) 2011 by: James C. Warner
* All rights reserved. 8921 Hilloway Road
* Eden Prairie, Minnesota 55347 USA
*
* 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.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Library General Public License for more details.
*/
/* For contributions to this program, the author wishes to thank:
* Craig Small, <csmall@small.dropbear.id.au>
* Sami Kerola, <kerolasa@iki.fi>
*/
#ifndef _Itop_nls
#define _Itop_nls
//#include "../include/c.h"
#include "nls.h"
/*
* These are our three string tables with the following contents:
* Desc : field descriptions not to exceed 20 screen positions
* Norm : regular text possibly also containing c-format specifiers
* Uniq : show_special specially formatted strings
* The latter table presents the greatest translation challenge !
*/
extern const char *Desc_nlstab[];
extern const char *Norm_nlstab[];
extern const char *Uniq_nlstab[];
/*
* Simle optional macros to ease table access.
* The N_txt and N_fmt macros are interchangeable but
* highlight the two types of strings found in Norm_nlstable.
*/
#define N_fld(e) Desc_nlstab[e]
#define N_txt(e) Norm_nlstab[e]
#define N_fmt(e) Norm_nlstab[e]
#define N_unq(e) Uniq_nlstab[e]
/*
* These enums are the means to access two of our three tables.
* The Desc_nlstab is accessed with standard top pflag enums.
*
* The norm_nls enums carry a suffix distinguishing plain text
* from any text also containiing c-format specifiers.
*/
enum norm_nls {
AMT_kilobyte_txt, AMT_megabyte_txt, AMT_gigabyte_txt, BAD_delayint_fmt,
BAD_integers_txt, BAD_max_task_txt, BAD_mon_pids_fmt, BAD_niterate_arg,
BAD_numfloat_txt, BAD_signalid_txt, BAD_username_txt, BAD_widtharg_fmt,
CHOOSE_group_txt, COLORS_nomap_txt, DELAY_badarg_txt, DELAY_change_fmt,
DELAY_secure_txt, DISABLED_cmd_fmt, DISABLED_win_fmt, EXIT_signals_fmt,
FAIL_alloc_c_txt, FAIL_alloc_r_txt, FAIL_openlib_txt, FAIL_rc_open_fmt,
FAIL_re_nice_fmt, FAIL_sigmask_fmt, FAIL_signals_fmt, FAIL_sigstop_fmt,
FAIL_statget_txt, FAIL_statopn_fmt, FAIL_tty_get_txt, FAIL_tty_mod_fmt,
FAIL_tty_raw_fmt, FAIL_widecpu_txt, FAIL_widepid_txt, FOREST_modes_fmt,
FOREST_views_txt, GET_max_task_fmt, GET_nice_num_fmt, GET_pid2kill_txt,
GET_pid2nice_txt, GET_sigs_num_fmt, GET_user_ids_txt, HELP_cmdline_fmt,
HILIGHT_cant_txt, IRIX_curmode_fmt, LIMIT_exceed_fmt, MISSING_args_fmt,
NAME_windows_fmt, NOT_onsecure_txt, NOT_smp_cpus_txt, OFF_one_word_txt,
ON_word_only_txt, RC_bad_entry_fmt, RC_bad_files_fmt, SCROLL_coord_fmt,
SELECT_clash_txt, THREADS_show_fmt, TIME_accumed_fmt, UNKNOWN_cmds_txt,
UNKNOWN_opts_fmt, USAGE_abbrev_txt, WORD_process_txt, WORD_threads_txt,
WRITE_rcfile_fmt, WRONG_switch_fmt,
norm_MAX
};
enum uniq_nls {
KEYS_helpbas_fmt, KEYS_helpext_fmt, WINDOWS_help_fmt, COLOR_custom_fmt,
FIELD_header_fmt, MEMORY_lines_fmt, STATE_line_1_fmt, STATE_lin2x4_fmt,
STATE_lin2x5_fmt, STATE_lin2x6_fmt, STATE_lin2x7_fmt,
uniq_MAX
};
void initialize_nsl (void);
#endif /* _Itop_nls */