ps: generalize help text logic, add related translator hints

This commit represents an experiment in nls help text support.

The word --help itself been made translatable along with the
help section names and their abbreviations.  Thus, the work of
the translators will ultimately alter program run-time behavior.

Perhaps someday all "long" options can behave in a similar way
which could offer a considerable benefit to other languages.
Instead of translationg just option descriptions, the long
forms of those options could also be transalated.

This commit also:
 . includes the section abbreviations in --help output
 . isolates all --help support in the ps/help.c module
 . provides (hopefully) meaningful Translator guidance
 . removes --help support from the ps/common.h header
 . removes --help support from the ps/parser.c module
 . eliminates tabs in line with the style of other ps modules
 . eliminates the need for the include/c.h header file
This commit is contained in:
Jim Warner
2012-01-02 01:33:34 -06:00
committed by Craig Small
parent b8c3288594
commit 4fb48c0bdb
5 changed files with 214 additions and 131 deletions

View File

@@ -12,7 +12,6 @@
#ifndef PROCPS_PS_H
#define PROCPS_PS_H
#include "../include/c.h"
#include "../include/nls.h"
#include "../proc/procps.h"
#include "../proc/escape.h"
@@ -27,17 +26,6 @@
/***************** GENERAL DEFINE ********************/
/* usage output sections */
enum {
USAGE_DEFAULT,
USAGE_ALL,
USAGE_SELECTION,
USAGE_LIST,
USAGE_OUTPUT,
USAGE_THREADS,
USAGE_MISC
};
/* selection list */
#define SEL_RUID 1
#define SEL_EUID 2
@@ -325,9 +313,13 @@ extern unsigned thread_flags;
extern int unix_f_option;
extern int user_is_number;
extern int wchan_is_number;
extern const char *the_word_help;
/************************* PS GLOBALS *********************/
/* display.c */
extern char *myname;
/* sortformat.c */
extern int defer_sf_option(const char *arg, int source);
extern const char *process_sf_options(int localbroken);
@@ -338,7 +330,7 @@ extern int want_this_proc(proc_t *buf);
extern const char *select_bits_setup(void);
/* help.c */
extern void usage(FILE * out, int section) NORETURN;
extern void do_help(const char *opt, int rc) NORETURN;
/* global.c */
extern void self_info(void);