ps: unify cases and remove trailing dots in messages

Strings with lower caps & no trailing dots have greater change to
have multiple occurences, meaning less effort for translators, than
strings with them.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
This commit is contained in:
Sami Kerola 2012-01-13 22:38:47 +01:00
parent 0e8c4659de
commit 79ceb30b5c
12 changed files with 188 additions and 187 deletions

View File

@ -327,7 +327,7 @@ static void simple_spew(void){
ptp = openproc(needs_for_format | needs_for_sort | needs_for_select | needs_for_threads); ptp = openproc(needs_for_format | needs_for_sort | needs_for_select | needs_for_threads);
if(!ptp) { if(!ptp) {
fprintf(stderr, _("Error: can not access /proc.\n")); fprintf(stderr, _("error: can not access /proc\n"));
exit(1); exit(1);
} }
switch(thread_flags & (TF_show_proc|TF_loose_tasks|TF_show_task)){ switch(thread_flags & (TF_show_proc|TF_loose_tasks|TF_show_task)){
@ -375,7 +375,7 @@ static void prep_forest_sort(void){
if(!sort_list) { /* assume start time order */ if(!sort_list) { /* assume start time order */
incoming = search_format_array("start_time"); incoming = search_format_array("start_time");
if(!incoming) { fprintf(stderr, _("Could not find start_time!\n")); exit(1); } if(!incoming) { fprintf(stderr, _("could not find start_time\n")); exit(1); }
tmp_list = malloc(sizeof(sort_node)); tmp_list = malloc(sizeof(sort_node));
tmp_list->reverse = 0; tmp_list->reverse = 0;
tmp_list->typecode = '?'; /* what was this for? */ tmp_list->typecode = '?'; /* what was this for? */
@ -386,7 +386,7 @@ static void prep_forest_sort(void){
} }
/* this is required for the forest option */ /* this is required for the forest option */
incoming = search_format_array("ppid"); incoming = search_format_array("ppid");
if(!incoming) { fprintf(stderr, _("Could not find ppid!\n")); exit(1); } if(!incoming) { fprintf(stderr, _("could not find ppid\n")); exit(1); }
tmp_list = malloc(sizeof(sort_node)); tmp_list = malloc(sizeof(sort_node));
tmp_list->reverse = 0; tmp_list->reverse = 0;
tmp_list->typecode = '?'; /* what was this for? */ tmp_list->typecode = '?'; /* what was this for? */
@ -500,7 +500,7 @@ static void fancy_spew(void){
ptp = openproc(needs_for_format | needs_for_sort | needs_for_select | needs_for_threads); ptp = openproc(needs_for_format | needs_for_sort | needs_for_select | needs_for_threads);
if(!ptp) { if(!ptp) {
fprintf(stderr, _("Error: can not access /proc.\n")); fprintf(stderr, _("error: can not access /proc\n"));
exit(1); exit(1);
} }

View File

@ -158,7 +158,7 @@ static void set_screen_size(void){
} }
if((screen_cols<9) || (screen_rows<2)) if((screen_cols<9) || (screen_rows<2))
fprintf(stderr,_("Your %dx%d screen size is bogus. Expect trouble.\n"), fprintf(stderr,_("your %dx%d screen size is bogus. expect trouble\n"),
screen_cols, screen_rows screen_cols, screen_rows
); );
} }
@ -231,11 +231,11 @@ static const char *set_personality(void){
if(!s || !*s) s="unknown"; /* "Do The Right Thing[tm]" */ if(!s || !*s) s="unknown"; /* "Do The Right Thing[tm]" */
if(getenv("I_WANT_A_BROKEN_PS")) s="old"; if(getenv("I_WANT_A_BROKEN_PS")) s="old";
sl = strlen(s); sl = strlen(s);
if(sl > 15) return _("Environment specified an unknown personality."); if(sl > 15) return _("environment specified an unknown personality");
strncpy(buf, s, sl); strncpy(buf, s, sl);
buf[sl] = '\0'; buf[sl] = '\0';
if ((saved_personality_text = strdup(buf))==NULL) { if ((saved_personality_text = strdup(buf))==NULL) {
fprintf(stderr, "Cannot strdup() personality text.\n"); fprintf(stderr, _("cannot strdup() personality text\n"));
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
@ -243,7 +243,7 @@ static const char *set_personality(void){
sizeof(personality_table_struct), compare_personality_table_structs sizeof(personality_table_struct), compare_personality_table_structs
); );
if(!found) return _("Environment specified an unknown personality."); if(!found) return _("environment specified an unknown personality");
goto *(found->jump); /* See gcc extension info. :-) */ goto *(found->jump); /* See gcc extension info. :-) */

View File

@ -1848,7 +1848,7 @@ void show_one_proc(const proc_t *restrict const p, const format_node *restrict f
} }
} }
did_stuff = 1; did_stuff = 1;
if(unlikely(active_cols>(int)OUTBUF_SIZE)) fprintf(stderr,_("Fix bigness error.\n")); if(unlikely(active_cols>(int)OUTBUF_SIZE)) fprintf(stderr,_("fix bigness error\n"));
/* print row start sequence */ /* print row start sequence */
for(;;){ for(;;){
@ -1996,7 +1996,7 @@ void init_output(void){
case 32768: page_shift = 15; break; case 32768: page_shift = 15; break;
case 16384: page_shift = 14; break; case 16384: page_shift = 14; break;
case 8192: page_shift = 13; break; case 8192: page_shift = 13; break;
default: fprintf(stderr, _("Unknown page size! (assume 4096)\n")); default: fprintf(stderr, _("unknown page size (assume 4096)\n"));
case 4096: page_shift = 12; break; case 4096: page_shift = 12; break;
case 2048: page_shift = 11; break; case 2048: page_shift = 11; break;
case 1024: page_shift = 10; break; case 1024: page_shift = 10; break;

View File

@ -73,9 +73,9 @@ static const char *parse_pid(char *str, sel_union *ret){
char *endp; char *endp;
unsigned long num; unsigned long num;
num = strtoul(str, &endp, 0); num = strtoul(str, &endp, 0);
if(*endp != '\0') return _("Process ID list syntax error."); if(*endp != '\0') return _("process ID list syntax error");
if(num<1) return _("Process ID out of range."); if(num<1) return _("process ID out of range");
if(num > 0x7fffffffUL) return _("Process ID out of range."); if(num > 0x7fffffffUL) return _("process ID out of range");
ret->pid = num; ret->pid = num;
return 0; return 0;
} }
@ -87,10 +87,10 @@ static const char *parse_uid(char *str, sel_union *ret){
num = strtoul(str, &endp, 0); num = strtoul(str, &endp, 0);
if(*endp != '\0'){ /* hmmm, try as login name */ if(*endp != '\0'){ /* hmmm, try as login name */
passwd_data = getpwnam(str); passwd_data = getpwnam(str);
if(!passwd_data) return _("User name does not exist."); if(!passwd_data) return _("user name does not exist");
num = passwd_data->pw_uid; num = passwd_data->pw_uid;
} }
if(num > 0xfffffffeUL) return _("User ID out of range."); if(num > 0xfffffffeUL) return _("user ID out of range");
ret->uid = num; ret->uid = num;
return 0; return 0;
} }
@ -102,10 +102,10 @@ static const char *parse_gid(char *str, sel_union *ret){
num = strtoul(str, &endp, 0); num = strtoul(str, &endp, 0);
if(*endp != '\0'){ /* hmmm, try as login name */ if(*endp != '\0'){ /* hmmm, try as login name */
group_data = getgrnam(str); group_data = getgrnam(str);
if(!group_data) return _("Group name does not exist."); if(!group_data) return _("group name does not exist");
num = group_data->gr_gid; num = group_data->gr_gid;
} }
if(num > 0xfffffffeUL) return _("Group ID out of range."); if(num > 0xfffffffeUL) return _("group ID out of range");
ret->gid = num; ret->gid = num;
return 0; return 0;
} }
@ -121,7 +121,7 @@ static const char *parse_tty(char *str, sel_union *ret){
char path[4096]; char path[4096];
if(str[0]=='/'){ if(str[0]=='/'){
if(stat(str, &sbuf) >= 0) goto found_it; if(stat(str, &sbuf) >= 0) goto found_it;
return _("TTY could not be found.");; return _("TTY could not be found");;
} }
#define lookup(p) \ #define lookup(p) \
snprintf(path,4096,p,str); \ snprintf(path,4096,p,str); \
@ -145,9 +145,9 @@ static const char *parse_tty(char *str, sel_union *ret){
return 0; return 0;
} }
#undef lookup #undef lookup
return _("TTY could not be found.");; return _("TTY could not be found");;
found_it: found_it:
if(!S_ISCHR(sbuf.st_mode)) return _("List member was not a TTY."); if(!S_ISCHR(sbuf.st_mode)) return _("list member was not a TTY");
ret->tty = sbuf.st_rdev; ret->tty = sbuf.st_rdev;
return 0; return 0;
} }
@ -172,7 +172,7 @@ static const char *parse_list(const char *arg, const char *(*parse_fn)(char *, s
need_item = 1; /* true */ need_item = 1; /* true */
items = 0; items = 0;
walk = buf; walk = buf;
err = _("Improper list."); err = _("improper list");
do{ do{
switch(*walk){ switch(*walk){
case ' ': case ',': case '\t': case '\0': case ' ': case ',': case '\t': case '\0':
@ -226,13 +226,13 @@ static const char *parse_sysv_option(void){
switch(*flagptr){ switch(*flagptr){
case 'A': case 'A':
trace("-A selects all processes.\n"); trace("-A selects all processes\n");
all_processes = 1; all_processes = 1;
break; break;
case 'C': /* end */ case 'C': /* end */
trace("-C select by process name.\n"); /* Why only HP/UX and us? */ trace("-C select by process name\n"); /* Why only HP/UX and us? */
arg=get_opt_arg(); arg=get_opt_arg();
if(!arg) return _("List of command names must follow -C."); if(!arg) return _("list of command names must follow -C");
err=parse_list(arg, parse_cmd); err=parse_list(arg, parse_cmd);
if(err) return err; if(err) return err;
selection_list->typecode = SEL_COMM; selection_list->typecode = SEL_COMM;
@ -246,20 +246,20 @@ static const char *parse_sysv_option(void){
case 'G': /* end */ case 'G': /* end */
trace("-G select by RGID (supports names)\n"); trace("-G select by RGID (supports names)\n");
arg=get_opt_arg(); arg=get_opt_arg();
if(!arg) return _("List of real groups must follow -G."); if(!arg) return _("list of real groups must follow -G");
err=parse_list(arg, parse_gid); err=parse_list(arg, parse_gid);
if(err) return err; if(err) return err;
selection_list->typecode = SEL_RGID; selection_list->typecode = SEL_RGID;
return NULL; /* can't have any more options */ return NULL; /* can't have any more options */
case 'H': /* another nice HP/UX feature */ case 'H': /* another nice HP/UX feature */
trace("-H Process hierarchy (like ASCII art forest option)\n"); trace("-H process hierarchy (like ASCII art forest option)\n");
forest_type = 'u'; forest_type = 'u';
break; break;
#if 0 #if 0
case 'J': // specify list of job IDs in hex (IRIX) -- like HP "-R" maybe? case 'J': // specify list of job IDs in hex (IRIX) -- like HP "-R" maybe?
trace("-J select by job ID\n"); // want a JID ("jid") for "-j" too trace("-J select by job ID\n"); // want a JID ("jid") for "-j" too
arg=get_opt_arg(); arg=get_opt_arg();
if(!arg) return _("List of jobs must follow -J."); if(!arg) return _("list of jobs must follow -J");
err=parse_list(arg, parse_jid); err=parse_list(arg, parse_jid);
if(err) return err; if(err) return err;
selection_list->typecode = SEL_JID; selection_list->typecode = SEL_JID;
@ -272,22 +272,22 @@ static const char *parse_sysv_option(void){
* Zombies are the only exception, with NLWP==0 and 1 output line. * Zombies are the only exception, with NLWP==0 and 1 output line.
* SCO UnixWare uses -L too. * SCO UnixWare uses -L too.
*/ */
trace("-L Print LWP (thread) info.\n"); trace("-L print LWP (thread) info\n");
thread_flags |= TF_U_L; thread_flags |= TF_U_L;
// format_modifiers |= FM_L; // format_modifiers |= FM_L;
break; break;
case 'M': // typically the SE Linux context case 'M': // typically the SE Linux context
trace("-M Print security label for Mandatory Access Control.\n"); trace("-M print security label for Mandatory Access Control\n");
format_modifiers |= FM_M; format_modifiers |= FM_M;
break; break;
case 'N': case 'N':
trace("-N negates.\n"); trace("-N negates\n");
negate_selection = 1; negate_selection = 1;
break; break;
case 'O': /* end */ case 'O': /* end */
trace("-O is preloaded -o.\n"); trace("-O is preloaded -o\n");
arg=get_opt_arg(); arg=get_opt_arg();
if(!arg) return _("Format or sort specification must follow -O."); if(!arg) return _("format or sort specification must follow -O");
defer_sf_option(arg, SF_U_O); defer_sf_option(arg, SF_U_O);
return NULL; /* can't have any more options */ return NULL; /* can't have any more options */
case 'P': /* SunOS 5 "psr" or unknown HP/UX feature */ case 'P': /* SunOS 5 "psr" or unknown HP/UX feature */
@ -298,7 +298,7 @@ static const char *parse_sysv_option(void){
case 'R': // unknown HP/UX feature, like IRIX "-J" maybe? case 'R': // unknown HP/UX feature, like IRIX "-J" maybe?
trace("-R select by PRM group\n"); trace("-R select by PRM group\n");
arg=get_opt_arg(); arg=get_opt_arg();
if(!arg) return _("List of PRM groups must follow -R."); if(!arg) return _("list of PRM groups must follow -R");
err=parse_list(arg, parse_prm); err=parse_list(arg, parse_prm);
if(err) return err; if(err) return err;
selection_list->typecode = SEL_PRM; selection_list->typecode = SEL_PRM;
@ -315,15 +315,15 @@ static const char *parse_sysv_option(void){
// format_modifiers |= FM_T; // format_modifiers |= FM_T;
break; break;
case 'U': /* end */ case 'U': /* end */
trace("-U select by RUID (supports names).\n"); trace("-U select by RUID (supports names)\n");
arg=get_opt_arg(); arg=get_opt_arg();
if(!arg) return _("List of real users must follow -U."); if(!arg) return _("list of real users must follow -U");
err=parse_list(arg, parse_uid); err=parse_list(arg, parse_uid);
if(err) return err; if(err) return err;
selection_list->typecode = SEL_RUID; selection_list->typecode = SEL_RUID;
return NULL; /* can't have any more options */ return NULL; /* can't have any more options */
case 'V': /* single */ case 'V': /* single */
trace("-V prints version.\n"); trace("-V prints version\n");
exclusive("-V"); exclusive("-V");
display_version(); display_version();
exit(0); exit(0);
@ -334,20 +334,20 @@ static const char *parse_sysv_option(void){
format_modifiers |= FM_M; format_modifiers |= FM_M;
break; break;
case 'a': case 'a':
trace("-a select all with a tty, but omit session leaders.\n"); trace("-a select all with a tty, but omit session leaders\n");
simple_select |= SS_U_a; simple_select |= SS_U_a;
break; break;
case 'c': case 'c':
/* HP-UX and SunOS 5 scheduling info modifier */ /* HP-UX and SunOS 5 scheduling info modifier */
trace("-c changes scheduling info.\n"); trace("-c changes scheduling info\n");
format_modifiers |= FM_c; format_modifiers |= FM_c;
break; break;
case 'd': case 'd':
trace("-d select all, but omit session leaders.\n"); trace("-d select all, but omit session leaders\n");
simple_select |= SS_U_d; simple_select |= SS_U_d;
break; break;
case 'e': case 'e':
trace("-e selects all processes.\n"); trace("-e selects all processes\n");
all_processes = 1; all_processes = 1;
break; break;
case 'f': case 'f':
@ -358,7 +358,7 @@ static const char *parse_sysv_option(void){
case 'g': /* end */ case 'g': /* end */
trace("-g selects by session leader OR by group name\n"); trace("-g selects by session leader OR by group name\n");
arg=get_opt_arg(); arg=get_opt_arg();
if(!arg) return _("List of session leaders OR effective group names must follow -g."); if(!arg) return _("list of session leaders OR effective group names must follow -g");
err=parse_list(arg, parse_pid); err=parse_list(arg, parse_pid);
if(!err){ if(!err){
selection_list->typecode = SEL_SESS; selection_list->typecode = SEL_SESS;
@ -369,26 +369,26 @@ static const char *parse_sysv_option(void){
selection_list->typecode = SEL_EGID; selection_list->typecode = SEL_EGID;
return NULL; /* can't have any more options */ return NULL; /* can't have any more options */
} }
return _("List of session leaders OR effective group IDs was invalid."); return _("list of session leaders OR effective group IDs was invalid");
case 'j': case 'j':
trace("-j jobs format.\n"); trace("-j jobs format\n");
/* old Debian used RD_j and Digital uses JFMT */ /* old Debian used RD_j and Digital uses JFMT */
if(sysv_j_format) format_flags |= FF_Uj; if(sysv_j_format) format_flags |= FF_Uj;
else format_modifiers |= FM_j; else format_modifiers |= FM_j;
break; break;
case 'l': case 'l':
trace("-l long format.\n"); trace("-l long format\n");
format_flags |= FF_Ul; format_flags |= FF_Ul;
break; break;
case 'm': case 'm':
trace("-m shows threads.\n"); trace("-m shows threads\n");
/* note that AIX shows 2 lines for a normal process */ /* note that AIX shows 2 lines for a normal process */
thread_flags |= TF_U_m; thread_flags |= TF_U_m;
break; break;
case 'n': /* end */ case 'n': /* end */
trace("-n sets namelist file.\n"); trace("-n sets namelist file\n");
arg=get_opt_arg(); arg=get_opt_arg();
if(!arg) return _("Alternate System.map file must follow -n."); if(!arg) return _("alternate System.map file must follow -n");
namelist_file = arg; namelist_file = arg;
return NULL; /* can't have any more options */ return NULL; /* can't have any more options */
case 'o': /* end */ case 'o': /* end */
@ -397,15 +397,15 @@ static const char *parse_sysv_option(void){
/* The result must be 2 columns: "PID NICE,tty=TERMINAL,comm" */ /* The result must be 2 columns: "PID NICE,tty=TERMINAL,comm" */
/* Yes, the second column has the name "NICE,tty=TERMINAL,comm" */ /* Yes, the second column has the name "NICE,tty=TERMINAL,comm" */
/* This parser looks for any excuse to ignore that braindamage. */ /* This parser looks for any excuse to ignore that braindamage. */
trace("-o user-defined format.\n"); trace("-o user-defined format\n");
arg=get_opt_arg(); arg=get_opt_arg();
if(!arg) return _("Format specification must follow -o."); if(!arg) return _("format specification must follow -o");
not_pure_unix |= defer_sf_option(arg, SF_U_o); not_pure_unix |= defer_sf_option(arg, SF_U_o);
return NULL; /* can't have any more options */ return NULL; /* can't have any more options */
case 'p': /* end */ case 'p': /* end */
trace("-p select by PID.\n"); trace("-p select by PID\n");
arg=get_opt_arg(); arg=get_opt_arg();
if(!arg) return _("List of process IDs must follow -p."); if(!arg) return _("list of process IDs must follow -p");
err=parse_list(arg, parse_pid); err=parse_list(arg, parse_pid);
if(err) return err; if(err) return err;
selection_list->typecode = SEL_PID; selection_list->typecode = SEL_PID;
@ -413,36 +413,36 @@ static const char *parse_sysv_option(void){
#if 0 #if 0
case 'r': case 'r':
trace("-r some Digital Unix thing about warnings...\n"); trace("-r some Digital Unix thing about warnings...\n");
trace(" or SCO's option to chroot() for new /proc and /dev.\n"); trace(" or SCO's option to chroot() for new /proc and /dev\n");
return _("The -r option is reserved."); return _("the -r option is reserved");
break; break;
#endif #endif
case 's': /* end */ case 's': /* end */
trace("-s Select processes belonging to the sessions given.\n"); trace("-s select processes belonging to the sessions given\n");
arg=get_opt_arg(); arg=get_opt_arg();
if(!arg) return _("List of session IDs must follow -s."); if(!arg) return _("list of session IDs must follow -s");
err=parse_list(arg, parse_pid); err=parse_list(arg, parse_pid);
if(err) return err; if(err) return err;
selection_list->typecode = SEL_SESS; selection_list->typecode = SEL_SESS;
return NULL; /* can't have any more options */ return NULL; /* can't have any more options */
case 't': /* end */ case 't': /* end */
trace("-t select by tty.\n"); trace("-t select by tty\n");
arg=get_opt_arg(); arg=get_opt_arg();
if(!arg) return _("List of terminals (pty, tty...) must follow -t."); if(!arg) return _("list of terminals (pty, tty...) must follow -t");
err=parse_list(arg, parse_tty); err=parse_list(arg, parse_tty);
if(err) return err; if(err) return err;
selection_list->typecode = SEL_TTY; selection_list->typecode = SEL_TTY;
return NULL; /* can't have any more options */ return NULL; /* can't have any more options */
case 'u': /* end */ case 'u': /* end */
trace("-u select by user effective ID (supports names).\n"); trace("-u select by user effective ID (supports names)\n");
arg=get_opt_arg(); arg=get_opt_arg();
if(!arg) return _("List of users must follow -u."); if(!arg) return _("list of users must follow -u");
err=parse_list(arg, parse_uid); err=parse_list(arg, parse_uid);
if(err) return err; if(err) return err;
selection_list->typecode = SEL_EUID; selection_list->typecode = SEL_EUID;
return NULL; /* can't have any more options */ return NULL; /* can't have any more options */
case 'w': case 'w':
trace("-w wide output.\n"); trace("-w wide output\n");
w_count++; w_count++;
break; break;
case 'x': /* behind personality until "ps -ax" habit is uncommon */ case 'x': /* behind personality until "ps -ax" habit is uncommon */
@ -458,9 +458,9 @@ static const char *parse_sysv_option(void){
unix_f_option = 1; unix_f_option = 1;
break; break;
} }
return _("Must set personality to get -x option."); return _("must set personality to get -x option");
case 'y': /* Sun's -l hack (also: Irix "lnode" resource control info) */ 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"); trace("-y print lnone info in UID/USER column or do Sun -l hack\n");
format_modifiers |= FM_y; format_modifiers |= FM_y;
break; break;
#if 0 #if 0
@ -473,20 +473,20 @@ static const char *parse_sysv_option(void){
case 'z': /* select by zone */ case 'z': /* select by zone */
trace("-z secects by zone\n"); trace("-z secects by zone\n");
arg=get_opt_arg(); arg=get_opt_arg();
if(!arg) return _("List of zones (contexts, labels, whatever?) must follow -z."); if(!arg) return _("list of zones (contexts, labels, whatever?) must follow -z");
err=parse_list(arg, parse_zone); err=parse_list(arg, parse_zone);
if(err) return err; if(err) return err;
selection_list->typecode = SEL_ZONE; selection_list->typecode = SEL_ZONE;
return NULL; /* can't have any more options */ return NULL; /* can't have any more options */
#endif #endif
case '-': case '-':
return _("Embedded '-' among SysV options makes no sense."); return _("embedded '-' among SysV options makes no sense");
break; break;
case '\0': case '\0':
catastrophic_failure(__FILE__, __LINE__, _("please report this bug")); catastrophic_failure(__FILE__, __LINE__, _("please report this bug"));
break; break;
default: default:
return _("Unsupported SysV option."); return _("unsupported SysV option");
} /* switch */ } /* switch */
} /* while */ } /* while */
return NULL; return NULL;
@ -499,20 +499,20 @@ static const char *parse_bsd_option(void){
flagptr = ps_argv[thisarg]; /* assume we _have_ a '-' */ flagptr = ps_argv[thisarg]; /* assume we _have_ a '-' */
if(flagptr[0]=='-'){ if(flagptr[0]=='-'){
if(!force_bsd) return _("Can't happen! Problem #1."); if(!force_bsd) return _("cannot happen - problem #1");
}else{ }else{
flagptr--; /* off beginning, will increment before use */ flagptr--; /* off beginning, will increment before use */
if(personality & PER_FORCE_BSD){ if(personality & PER_FORCE_BSD){
if(!force_bsd) return _("Can't happen! Problem #2."); if(!force_bsd) return _("cannot happen - problem #2");
}else{ }else{
if(force_bsd) return _("2nd chance parse failed, not BSD or SysV."); if(force_bsd) return _("second chance parse failed, not BSD or SysV");
} }
} }
while(*++flagptr){ while(*++flagptr){
switch(*flagptr){ switch(*flagptr){
case '0' ... '9': /* end */ case '0' ... '9': /* end */
trace("0..9 Old BSD-style select by process ID\n"); trace("0..9 pld BSD-style select by process ID\n");
arg=flagptr; arg=flagptr;
err=parse_list(arg, parse_pid); err=parse_list(arg, parse_pid);
if(err) return err; if(err) return err;
@ -521,22 +521,22 @@ static const char *parse_bsd_option(void){
#if 0 #if 0
case 'A': case 'A':
/* maybe this just does a larger malloc() ? */ /* maybe this just does a larger malloc() ? */
trace("A Increases the argument space (Digital Unix)\n"); trace("A increases the argument space (Digital Unix)\n");
return _("Option A is reserved."); return _("option A is reserved");
break; break;
case 'C': case 'C':
/* should divide result by 1-(e**(foo*log(bar))) */ /* should divide result by 1-(e**(foo*log(bar))) */
trace("C Use raw CPU time for %%CPU instead of decaying ave\n"); trace("C use raw CPU time for %%CPU instead of decaying ave\n");
return _("Option C is reserved."); return _("option C is reserved");
break; break;
#endif #endif
case 'H': // The FreeBSD way (NetBSD:s OpenBSD:k FreeBSD:H -- NIH???) case 'H': // The FreeBSD way (NetBSD:s OpenBSD:k FreeBSD:H -- NIH???)
trace("H Print LWP (thread) info.\n"); // was: Use /vmcore as c-dumpfile\n"); trace("H print LWP (thread) info\n"); // was: Use /vmcore as c-dumpfile\n");
thread_flags |= TF_B_H; thread_flags |= TF_B_H;
//format_modifiers |= FM_L; // FIXME: determine if we need something like this //format_modifiers |= FM_L; // FIXME: determine if we need something like this
break; break;
case 'L': /* single */ case 'L': /* single */
trace("L List all format specifiers\n"); trace("L list all format specifiers\n");
exclusive("L"); exclusive("L");
print_format_specifiers(); print_format_specifiers();
exit(0); exit(0);
@ -545,15 +545,15 @@ static const char *parse_bsd_option(void){
thread_flags |= TF_B_m; thread_flags |= TF_B_m;
break; break;
case 'N': /* end */ case 'N': /* end */
trace("N Specify namelist file\n"); trace("N specify namelist file\n");
arg=get_opt_arg(); arg=get_opt_arg();
if(!arg) return _("Alternate System.map file must follow N."); if(!arg) return _("alternate System.map file must follow N");
namelist_file = arg; namelist_file = arg;
return NULL; /* can't have any more options */ return NULL; /* can't have any more options */
case 'O': /* end */ case 'O': /* end */
trace("O Like o + defaults, add new columns after PID. Also sort.\n"); trace("O like o + defaults, add new columns after PID, also sort\n");
arg=get_opt_arg(); arg=get_opt_arg();
if(!arg) return _("Format or sort specification must follow O."); if(!arg) return _("format or sort specification must follow O");
defer_sf_option(arg, SF_B_O); defer_sf_option(arg, SF_B_O);
return NULL; /* can't have any more options */ return NULL; /* can't have any more options */
break; break;
@ -562,7 +562,7 @@ static const char *parse_bsd_option(void){
include_dead_children = 1; include_dead_children = 1;
break; break;
case 'T': case 'T':
trace("T Select all processes on this terminal\n"); trace("T select all processes on this terminal\n");
/* put our tty on a tiny list */ /* put our tty on a tiny list */
{ {
selection_node *node; selection_node *node;
@ -576,9 +576,9 @@ static const char *parse_bsd_option(void){
} }
break; break;
case 'U': /* end */ case 'U': /* end */
trace("U Select processes for specified users.\n"); trace("U select processes for specified users\n");
arg=get_opt_arg(); arg=get_opt_arg();
if(!arg) return _("List of users must follow U."); if(!arg) return _("list of users must follow U");
err=parse_list(arg, parse_uid); err=parse_list(arg, parse_uid);
if(err) return err; if(err) return err;
selection_list->typecode = SEL_EUID; selection_list->typecode = SEL_EUID;
@ -590,18 +590,18 @@ static const char *parse_bsd_option(void){
exit(0); exit(0);
case 'W': case 'W':
trace("W N/A get swap info from ... not /dev/drum.\n"); trace("W N/A get swap info from ... not /dev/drum.\n");
return _("Obsolete W option not supported. (You have a /dev/drum?)"); return _("obsolete W option not supported (you have a /dev/drum?)");
break; break;
case 'X': case 'X':
trace("X Old Linux i386 register format\n"); trace("X old Linux i386 register format\n");
format_flags |= FF_LX; format_flags |= FF_LX;
break; break;
case 'Z': /* FreeBSD does MAC like SGI's Irix does it */ case 'Z': /* FreeBSD does MAC like SGI's Irix does it */
trace("Z Print security label for Mandatory Access Control.\n"); trace("Z print security label for Mandatory Access Control.\n");
format_modifiers |= FM_M; format_modifiers |= FM_M;
break; break;
case 'a': case 'a':
trace("a Select all w/tty, including other users\n"); trace("a select all w/tty, including other users\n");
simple_select |= SS_B_a; simple_select |= SS_B_a;
break; break;
case 'c': case 'c':
@ -621,12 +621,12 @@ static const char *parse_bsd_option(void){
forest_type = 'b'; forest_type = 'b';
break; break;
case 'g': case 'g':
trace("g _all_, even group leaders!.\n"); trace("g _all_, even group leaders\n");
simple_select |= SS_B_g; simple_select |= SS_B_g;
break; break;
case 'h': case 'h':
trace("h Repeat header... yow.\n"); trace("h repeat header\n");
if(header_type) return _("Only one heading option may be specified."); if(header_type) return _("only one heading option may be specified");
if(personality & PER_BSD_h) header_type = HEAD_MULTI; if(personality & PER_BSD_h) header_type = HEAD_MULTI;
else header_type = HEAD_NONE; else header_type = HEAD_NONE;
break; break;
@ -639,13 +639,13 @@ static const char *parse_bsd_option(void){
// trace("k Print LWP (thread) info.\n"); // was: Use /vmcore as c-dumpfile\n"); // trace("k Print LWP (thread) info.\n"); // was: Use /vmcore as c-dumpfile\n");
// NetBSD, and soon (?) FreeBSD: sort-by-keyword // NetBSD, and soon (?) FreeBSD: sort-by-keyword
trace("k Specify sorting keywords.\n"); trace("k specify sorting keywords\n");
arg=get_opt_arg(); arg=get_opt_arg();
if(!arg) return _("Long sort specification must follow 'k'."); if(!arg) return _("long sort specification must follow 'k'");
defer_sf_option(arg, SF_G_sort); defer_sf_option(arg, SF_G_sort);
return NULL; /* can't have any more options */ return NULL; /* can't have any more options */
case 'l': case 'l':
trace("l Display long format\n"); trace("l display long format\n");
format_flags |= FF_Bl; format_flags |= FF_Bl;
break; break;
case 'm': case 'm':
@ -661,35 +661,35 @@ static const char *parse_bsd_option(void){
thread_flags |= TF_B_m; thread_flags |= TF_B_m;
break; break;
case 'n': case 'n':
trace("n Numeric output for WCHAN, and USER replaced by UID\n"); trace("n numeric output for WCHAN, and USER replaced by UID\n");
wchan_is_number = 1; wchan_is_number = 1;
user_is_number = 1; user_is_number = 1;
/* TODO add tty_is_number too? */ /* TODO add tty_is_number too? */
break; break;
case 'o': /* end */ case 'o': /* end */
trace("o Specify user-defined format\n"); trace("o specify user-defined format\n");
arg=get_opt_arg(); arg=get_opt_arg();
if(!arg) return _("Format specification must follow o."); if(!arg) return _("format specification must follow o");
defer_sf_option(arg, SF_B_o); defer_sf_option(arg, SF_B_o);
return NULL; /* can't have any more options */ return NULL; /* can't have any more options */
case 'p': /* end */ case 'p': /* end */
trace("p Select by process ID\n"); trace("p select by process ID\n");
arg=get_opt_arg(); arg=get_opt_arg();
if(!arg) return _("List of process IDs must follow p."); if(!arg) return _("list of process IDs must follow p");
err=parse_list(arg, parse_pid); err=parse_list(arg, parse_pid);
if(err) return err; if(err) return err;
selection_list->typecode = SEL_PID; selection_list->typecode = SEL_PID;
return NULL; /* can't have any more options */ return NULL; /* can't have any more options */
case 'r': case 'r':
trace("r Select running processes\n"); trace("r select running processes\n");
running_only = 1; running_only = 1;
break; break;
case 's': case 's':
trace("s Display signal format\n"); trace("s display signal format\n");
format_flags |= FF_Bs; format_flags |= FF_Bs;
break; break;
case 't': /* end */ case 't': /* end */
trace("t Select by tty.\n"); trace("t select by tty\n");
/* List of terminals (tty, pty...) _should_ follow t. */ /* List of terminals (tty, pty...) _should_ follow t. */
arg=get_opt_arg(); arg=get_opt_arg();
if(!arg){ if(!arg){
@ -709,11 +709,11 @@ static const char *parse_bsd_option(void){
selection_list->typecode = SEL_TTY; selection_list->typecode = SEL_TTY;
return NULL; /* can't have any more options */ return NULL; /* can't have any more options */
case 'u': case 'u':
trace("u Display user-oriented\n"); trace("u display user-oriented\n");
format_flags |= FF_Bu; format_flags |= FF_Bu;
break; break;
case 'v': case 'v':
trace("v Display virtual memory\n"); trace("v display virtual memory\n");
format_flags |= FF_Bv; format_flags |= FF_Bv;
break; break;
case 'w': case 'w':
@ -721,17 +721,17 @@ static const char *parse_bsd_option(void){
w_count++; w_count++;
break; break;
case 'x': case 'x':
trace("x Select processes without controlling ttys\n"); trace("x select processes without controlling ttys\n");
simple_select |= SS_B_x; simple_select |= SS_B_x;
break; break;
case '-': case '-':
return _("Embedded '-' among BSD options makes no sense."); return _("embedded '-' among BSD options makes no sense");
break; break;
case '\0': case '\0':
catastrophic_failure(__FILE__, __LINE__, _("please report this bug")); catastrophic_failure(__FILE__, __LINE__, _("please report this bug"));
break; break;
default: default:
return _("Unsupported option (BSD syntax)"); return _("unsupported option (BSD syntax)");
} /* switch */ } /* switch */
} /* while */ } /* while */
return NULL; return NULL;
@ -816,7 +816,7 @@ static const char *parse_gnu_option(void){
s = ps_argv[thisarg]+2; s = ps_argv[thisarg]+2;
sl = strcspn(s,":="); sl = strcspn(s,":=");
if(sl > 15) return _("Unknown gnu long option."); if(sl > 15) return _("unknown gnu long option");
strncpy(buf, s, sl); strncpy(buf, s, sl);
buf[sl] = '\0'; buf[sl] = '\0';
flagptr = s+sl; flagptr = s+sl;
@ -828,7 +828,7 @@ static const char *parse_gnu_option(void){
if(!found) { if(!found) {
if (!strcmp(buf, the_word_help)) if (!strcmp(buf, the_word_help))
goto case_help; goto case_help;
return _("Unknown gnu long option."); return _("unknown gnu long option");
} }
goto *(found->jump); /* See gcc extension info. :-) */ goto *(found->jump); /* See gcc extension info. :-) */
@ -836,7 +836,7 @@ static const char *parse_gnu_option(void){
case_Group: case_Group:
trace("--Group\n"); trace("--Group\n");
arg = grab_gnu_arg(); arg = grab_gnu_arg();
if(!arg) return _("List of real groups must follow --Group."); if(!arg) return _("list of real groups must follow --Group");
err=parse_list(arg, parse_gid); err=parse_list(arg, parse_gid);
if(err) return err; if(err) return err;
selection_list->typecode = SEL_RGID; selection_list->typecode = SEL_RGID;
@ -844,7 +844,7 @@ static const char *parse_gnu_option(void){
case_User: case_User:
trace("--User\n"); trace("--User\n");
arg = grab_gnu_arg(); arg = grab_gnu_arg();
if(!arg) return _("List of real users must follow --User."); if(!arg) return _("list of real users must follow --User");
err=parse_list(arg, parse_uid); err=parse_list(arg, parse_uid);
if(err) return err; if(err) return err;
selection_list->typecode = SEL_RUID; selection_list->typecode = SEL_RUID;
@ -863,15 +863,15 @@ static const char *parse_gnu_option(void){
return NULL; return NULL;
} }
} }
return _("Number of columns must follow --cols, --width, or --columns."); return _("number of columns must follow --cols, --width, or --columns");
case_cumulative: case_cumulative:
trace("--cumulative\n"); trace("--cumulative\n");
if(s[sl]) return _("Option --cumulative does not take an argument."); if(s[sl]) return _("option --cumulative does not take an argument");
include_dead_children = 1; include_dead_children = 1;
return NULL; return NULL;
case_deselect: case_deselect:
trace("--deselect\n"); trace("--deselect\n");
if(s[sl]) return _("Option --deselect does not take an argument."); if(s[sl]) return _("option --deselect does not take an argument");
negate_selection = 1; negate_selection = 1;
return NULL; return NULL;
case_no_header: case_no_header:
@ -883,8 +883,8 @@ static const char *parse_gnu_option(void){
case_noheading: case_noheading:
case_noheadings: case_noheadings:
trace("--noheaders\n"); trace("--noheaders\n");
if(s[sl]) return _("Option --no-heading does not take an argument."); if(s[sl]) return _("option --no-heading does not take an argument");
if(header_type) return _("Only one heading option may be specified."); if(header_type) return _("only one heading option may be specified");
header_type = HEAD_NONE; header_type = HEAD_NONE;
return NULL; return NULL;
case_header: case_header:
@ -892,25 +892,25 @@ static const char *parse_gnu_option(void){
case_heading: case_heading:
case_headings: case_headings:
trace("--headers\n"); trace("--headers\n");
if(s[sl]) return _("Option --heading does not take an argument."); if(s[sl]) return _("option --heading does not take an argument");
if(header_type) return _("Only one heading option may be specified."); if(header_type) return _("only one heading option may be specified");
header_type = HEAD_MULTI; header_type = HEAD_MULTI;
return NULL; return NULL;
case_forest: case_forest:
trace("--forest\n"); trace("--forest\n");
if(s[sl]) return _("Option --forest does not take an argument."); if(s[sl]) return _("option --forest does not take an argument");
forest_type = 'g'; forest_type = 'g';
return NULL; return NULL;
case_format: case_format:
trace("--format\n"); trace("--format\n");
arg=grab_gnu_arg(); arg=grab_gnu_arg();
if(!arg) return _("Format specification must follow --format."); if(!arg) return _("format specification must follow --format");
defer_sf_option(arg, SF_G_format); defer_sf_option(arg, SF_G_format);
return NULL; return NULL;
case_group: case_group:
trace("--group\n"); trace("--group\n");
arg = grab_gnu_arg(); arg = grab_gnu_arg();
if(!arg) return _("List of effective groups must follow --group."); if(!arg) return _("list of effective groups must follow --group");
err=parse_list(arg, parse_gid); err=parse_list(arg, parse_gid);
if(err) return err; if(err) return err;
selection_list->typecode = SEL_EGID; selection_list->typecode = SEL_EGID;
@ -928,7 +928,7 @@ static const char *parse_gnu_option(void){
case_pid: case_pid:
trace("--pid\n"); trace("--pid\n");
arg = grab_gnu_arg(); arg = grab_gnu_arg();
if(!arg) return _("List of process IDs must follow --pid."); if(!arg) return _("list of process IDs must follow --pid");
err=parse_list(arg, parse_pid); err=parse_list(arg, parse_pid);
if(err) return err; if(err) return err;
selection_list->typecode = SEL_PID; selection_list->typecode = SEL_PID;
@ -936,7 +936,7 @@ static const char *parse_gnu_option(void){
case_ppid: case_ppid:
trace("--ppid\n"); trace("--ppid\n");
arg = grab_gnu_arg(); arg = grab_gnu_arg();
if(!arg) return _("List of process IDs must follow --ppid."); if(!arg) return _("list of process IDs must follow --ppid");
err=parse_list(arg, parse_pid); err=parse_list(arg, parse_pid);
if(err) return err; if(err) return err;
selection_list->typecode = SEL_PPID; selection_list->typecode = SEL_PPID;
@ -954,11 +954,11 @@ static const char *parse_gnu_option(void){
return NULL; return NULL;
} }
} }
return _("Number of rows must follow --rows or --lines."); return _("number of rows must follow --rows or --lines");
case_sid: case_sid:
trace("--sid\n"); trace("--sid\n");
arg = grab_gnu_arg(); arg = grab_gnu_arg();
if(!arg) return _("Some sid thing(s) must follow --sid."); if(!arg) return _("some sid thing(s) must follow --sid");
err=parse_list(arg, parse_pid); err=parse_list(arg, parse_pid);
if(err) return err; if(err) return err;
selection_list->typecode = SEL_SESS; selection_list->typecode = SEL_SESS;
@ -966,13 +966,13 @@ static const char *parse_gnu_option(void){
case_sort: case_sort:
trace("--sort\n"); trace("--sort\n");
arg=grab_gnu_arg(); arg=grab_gnu_arg();
if(!arg) return _("Long sort specification must follow --sort."); if(!arg) return _("long sort specification must follow --sort");
defer_sf_option(arg, SF_G_sort); defer_sf_option(arg, SF_G_sort);
return NULL; return NULL;
case_tty: case_tty:
trace("--tty\n"); trace("--tty\n");
arg = grab_gnu_arg(); arg = grab_gnu_arg();
if(!arg) return _("List of ttys must follow --tty."); if(!arg) return _("list of ttys must follow --tty");
err=parse_list(arg, parse_tty); err=parse_list(arg, parse_tty);
if(err) return err; if(err) return err;
selection_list->typecode = SEL_TTY; selection_list->typecode = SEL_TTY;
@ -980,7 +980,7 @@ static const char *parse_gnu_option(void){
case_user: case_user:
trace("--user\n"); trace("--user\n");
arg = grab_gnu_arg(); arg = grab_gnu_arg();
if(!arg) return _("List of effective users must follow --user."); if(!arg) return _("list of effective users must follow --user");
err=parse_list(arg, parse_uid); err=parse_list(arg, parse_uid);
if(err) return err; if(err) return err;
selection_list->typecode = SEL_EUID; selection_list->typecode = SEL_EUID;
@ -1111,11 +1111,11 @@ static const char *parse_all_options(void){
case ARG_END: case ARG_END:
case ARG_FAIL: case ARG_FAIL:
trace(" FAIL/END on [%s]\n",ps_argv[thisarg]); trace(" FAIL/END on [%s]\n",ps_argv[thisarg]);
return _("Garbage option."); return _("garbage option");
break; break;
default: default:
printf(" ? %s\n",ps_argv[thisarg]); printf(" ? %s\n",ps_argv[thisarg]);
return _("Something broke."); return _("something broke");
} /* switch */ } /* switch */
if(err) return err; if(err) return err;
} /* while */ } /* while */
@ -1135,16 +1135,16 @@ static const char *thread_option_check(void){
} }
if(forest_type){ if(forest_type){
return _("Thread display conflicts with forest display."); return _("thread display conflicts with forest display");
} }
//thread_flags |= TF_no_forest; //thread_flags |= TF_no_forest;
if((thread_flags&TF_B_H) && (thread_flags&(TF_B_m|TF_U_m))) if((thread_flags&TF_B_H) && (thread_flags&(TF_B_m|TF_U_m)))
return _("Thread flags conflict; can't use H with m or -m."); return _("thread flags conflict; can't use H with m or -m");
if((thread_flags&TF_B_m) && (thread_flags&TF_U_m)) if((thread_flags&TF_B_m) && (thread_flags&TF_U_m))
return _("Thread flags conflict; can't use both m and -m."); return _("thread flags conflict; can't use both m and -m");
if((thread_flags&TF_U_L) && (thread_flags&TF_U_T)) if((thread_flags&TF_U_L) && (thread_flags&TF_U_T))
return _("Thread flags conflict; can't use both -L and -T."); return _("thread flags conflict; can't use both -L and -T");
if(thread_flags&TF_B_H) thread_flags |= (TF_show_proc|TF_loose_tasks); if(thread_flags&TF_B_H) thread_flags |= (TF_show_proc|TF_loose_tasks);
if(thread_flags&(TF_B_m|TF_U_m)) thread_flags |= (TF_show_proc|TF_show_task|TF_show_both); if(thread_flags&(TF_B_m|TF_U_m)) thread_flags |= (TF_show_proc|TF_show_task|TF_show_both);
@ -1234,7 +1234,8 @@ try_bsd:
// changing the actual behavior of ps in any way. I know of no // changing the actual behavior of ps in any way. I know of no
// other 'ps' that produces this message. // other 'ps' that produces this message.
if(!(personality & PER_FORCE_BSD)) if(!(personality & PER_FORCE_BSD))
fprintf(stderr, _("Warning: bad ps syntax, perhaps a bogus '-'? See http://gitorious.org/procps/procps/blobs/master/FAQ\n")); fprintf(stderr, _("warning: bad ps syntax, perhaps a bogus '-'?\n"
"See http://gitorious.org/procps/procps/blobs/master/Documentation/FAQ\n"));
#endif #endif
// Remember: contact procps@freelists.org // Remember: contact procps@freelists.org
// if you should feel tempted. Be damn sure you understand all // if you should feel tempted. Be damn sure you understand all
@ -1246,7 +1247,7 @@ try_bsd:
total_failure: total_failure:
reset_parser(); reset_parser();
if(personality & PER_FORCE_BSD) fprintf(stderr, _("ERROR: %s\n"), err2); if(personality & PER_FORCE_BSD) fprintf(stderr, _("error: %s\n"), err2);
else fprintf(stderr, _("ERROR: %s\n"), err); else fprintf(stderr, _("error: %s\n"), err);
do_help(NULL, EXIT_FAILURE); do_help(NULL, EXIT_FAILURE);
} }

View File

@ -60,7 +60,7 @@ const char *select_bits_setup(void){
simple_select = 0; simple_select = 0;
break; break;
default: default:
return _("Process selection options conflict."); return _("process selection options conflict");
break; break;
} }
return NULL; return NULL;

View File

@ -96,12 +96,12 @@ static void O_wrap(sf_node *sfn, int otype){
trailer = (otype=='b') ? "END_BSD" : "END_SYS5" ; trailer = (otype=='b') ? "END_BSD" : "END_SYS5" ;
fnode = do_one_spec("pid",NULL); fnode = do_one_spec("pid",NULL);
if(!fnode)catastrophic_failure(__FILE__, __LINE__, _("Seriously crashing. Goodbye cruel world.")); if(!fnode)catastrophic_failure(__FILE__, __LINE__, _("seriously crashing: goodbye cruel world"));
endp = sfn->f_cooked; while(endp->next) endp = endp->next; /* find end */ endp = sfn->f_cooked; while(endp->next) endp = endp->next; /* find end */
endp->next = fnode; endp->next = fnode;
fnode = do_one_spec(trailer,NULL); fnode = do_one_spec(trailer,NULL);
if(!fnode)catastrophic_failure(__FILE__, __LINE__, _("Seriously crashing. Goodbye cruel world.")); if(!fnode)catastrophic_failure(__FILE__, __LINE__, _("seriously crashing: goodbye cruel world"));
endp = fnode; while(endp->next) endp = endp->next; /* find end */ endp = fnode; while(endp->next) endp = endp->next; /* find end */
endp->next = sfn->f_cooked; endp->next = sfn->f_cooked;
sfn->f_cooked = fnode; sfn->f_cooked = fnode;
@ -136,7 +136,7 @@ static const char *aix_format_parse(sf_node *sfn){
items++; items++;
c = *walk++; c = *walk++;
if(c) goto initial; if(c) goto initial;
return _("Improper AIX field descriptor."); return _("improper AIX field descriptor");
looks_ok: looks_ok:
; ;
} }
@ -157,12 +157,12 @@ static const char *aix_format_parse(sf_node *sfn){
walk++; walk++;
if(!aix){ if(!aix){
free(buf); free(buf);
return _("Unknown AIX field descriptor."); return _("unknown AIX field descriptor");
} }
fnode = do_one_spec(aix->spec, aix->head); fnode = do_one_spec(aix->spec, aix->head);
if(!fnode){ if(!fnode){
free(buf); free(buf);
return _("AIX field descriptor processing bug."); return _("AIX field descriptor processing bug");
} }
} else { } else {
int len; int len;
@ -279,7 +279,7 @@ out:
snprintf( snprintf(
errbuf, errbuf,
sizeof(errbuf), sizeof(errbuf),
_("Unknown user-defined format specifier \"%s\"."), _("unknown user-defined format specifier \"%s\""),
walk walk
); );
} }
@ -305,10 +305,10 @@ out:
/* errors may cause a retry looking for AIX format codes */ /* errors may cause a retry looking for AIX format codes */
if(0) unknown: err=errbuf; if(0) unknown: err=errbuf;
if(0) empty: err=_("Empty format list."); if(0) empty: err=_("empty format list");
if(0) improper: err=_("Improper format list."); if(0) improper: err=_("improper format list");
if(0) badwidth: err=_("Column widths must be unsigned decimal numbers."); if(0) badwidth: err=_("column widths must be unsigned decimal numbers");
if(0) notmacro: err=_("Can't set width for a macro (multi-column) format specifier."); if(0) notmacro: err=_("can not set width for a macro (multi-column) format specifier");
if(strchr(sfn->sf,'%')) err = aix_format_parse(sfn); if(strchr(sfn->sf,'%')) err = aix_format_parse(sfn);
return err; return err;
} }
@ -361,7 +361,7 @@ static const char *long_sort_parse(sf_node *sfn){
case ' ': case ',': case '\t': case '\n': case '\0': case ' ': case ',': case '\t': case '\n': case '\0':
if(need_item){ if(need_item){
free(buf); free(buf);
return _("Improper sort list"); return _("improper sort list");
} }
need_item=1; need_item=1;
break; break;
@ -372,12 +372,12 @@ static const char *long_sort_parse(sf_node *sfn){
} while (*++walk); } while (*++walk);
if(!items){ if(!items){
free(buf); free(buf);
return _("Empty sort list."); return _("empty sort list");
} }
#ifdef STRICT_LIST #ifdef STRICT_LIST
if(need_item){ /* can't have trailing deliminator */ if(need_item){ /* can't have trailing deliminator */
free(buf); free(buf);
return _("Improper sort list."); return _("improper sort list");
} }
#else #else
if(need_item){ /* allow 1 trailing deliminator */ if(need_item){ /* allow 1 trailing deliminator */
@ -393,7 +393,7 @@ static const char *long_sort_parse(sf_node *sfn){
snode = do_one_sort_spec(walk); snode = do_one_sort_spec(walk);
if(!snode){ if(!snode){
free(buf); free(buf);
return _("Unknown sort specifier."); return _("unknown sort specifier");
} }
endp = snode; while(endp->next) endp = endp->next; /* find end */ endp = snode; while(endp->next) endp = endp->next; /* find end */
endp->next = sfn->s_cooked; endp->next = sfn->s_cooked;
@ -420,7 +420,7 @@ static const char *verify_short_sort(const char *arg){
int i; int i;
const char *walk; const char *walk;
int tmp; int tmp;
if(strspn(arg,all) != strlen(arg)) return _("Bad sorting code."); if(strspn(arg,all) != strlen(arg)) return _("bad sorting code");
for(i=256; i--;) checkoff[i] = 0; for(i=256; i--;) checkoff[i] = 0;
walk = arg; walk = arg;
for(;;){ for(;;){
@ -431,13 +431,13 @@ static const char *verify_short_sort(const char *arg){
case '+': case '+':
case '-': case '-':
tmp = *(walk+1); tmp = *(walk+1);
if(!tmp || tmp=='+' || tmp=='-') return _("Bad sorting code."); if(!tmp || tmp=='+' || tmp=='-') return _("bad sorting code");
break; break;
case 'P': case 'P':
if(forest_type) return _("PPID sort and forest output conflict."); if(forest_type) return _("PPID sort and forest output conflict");
/* fall through */ /* fall through */
default: default:
if(checkoff[tmp]) return _("Bad sorting code."); /* repeated */ if(checkoff[tmp]) return _("bad sorting code"); /* repeated */
/* ought to check against already accepted sort options */ /* ought to check against already accepted sort options */
checkoff[tmp] = 1; checkoff[tmp] = 1;
break; break;
@ -471,9 +471,9 @@ static const char *short_sort_parse(sf_node *sfn){
break; break;
default: default:
ss = search_shortsort_array(tmp); ss = search_shortsort_array(tmp);
if(!ss) return _("Unknown sort specifier."); if(!ss) return _("unknown sort specifier");
snode = do_one_sort_spec(ss->spec); snode = do_one_sort_spec(ss->spec);
if(!snode) return _("Unknown sort specifier."); if(!snode) return _("unknown sort specifier");
snode->reverse = direction; snode->reverse = direction;
endp = snode; while(endp->next) endp = endp->next; /* find end */ endp = snode; while(endp->next) endp = endp->next; /* find end */
endp->next = sfn->s_cooked; endp->next = sfn->s_cooked;
@ -509,14 +509,14 @@ static const char *parse_O_option(sf_node *sfn){
break; break;
case SF_U_O: /*** format ***/ case SF_U_O: /*** format ***/
/* Can have -l -f f u... set already_parsed_format like DEC does */ /* Can have -l -f f u... set already_parsed_format like DEC does */
if(already_parsed_format) return _("option -O can not follow other format options."); if(already_parsed_format) return _("option -O can not follow other format options");
err = format_parse(sfn); err = format_parse(sfn);
if(err) return err; if(err) return err;
already_parsed_format = 1; already_parsed_format = 1;
O_wrap(sfn,'u'); /* must wrap user format in default */ O_wrap(sfn,'u'); /* must wrap user format in default */
break; break;
case SF_B_O: /*** both ***/ case SF_B_O: /*** both ***/
if(have_gnu_sort || already_parsed_sort) err = _("Multiple sort options."); if(have_gnu_sort || already_parsed_sort) err = _("multiple sort options");
else err = verify_short_sort(sfn->sf); else err = verify_short_sort(sfn->sf);
if(!err){ /* success as sorting code */ if(!err){ /* success as sorting code */
short_sort_parse(sfn); short_sort_parse(sfn);
@ -524,7 +524,7 @@ static const char *parse_O_option(sf_node *sfn){
return NULL; return NULL;
} }
if(already_parsed_format){ if(already_parsed_format){
err = _("option O is neither first format nor sort order."); err = _("option O is neither first format nor sort order");
break; break;
} }
if(!format_parse(sfn)){ /* if success as format code */ if(!format_parse(sfn)){ /* if success as format code */
@ -534,7 +534,7 @@ static const char *parse_O_option(sf_node *sfn){
} }
break; break;
case SF_G_sort: case SF_B_m: /*** sort ***/ case SF_G_sort: case SF_B_m: /*** sort ***/
if(already_parsed_sort) err = _("Multiple sort options."); if(already_parsed_sort) err = _("multiple sort options");
else err = long_sort_parse(sfn); else err = long_sort_parse(sfn);
already_parsed_sort = 1; already_parsed_sort = 1;
break; break;
@ -651,7 +651,7 @@ static int fmt_delete(const char *findme){
static const char *generate_sysv_list(void){ static const char *generate_sysv_list(void){
format_node *fn; format_node *fn;
if((format_modifiers & FM_y) && !(format_flags & FF_Ul)) if((format_modifiers & FM_y) && !(format_flags & FF_Ul))
return _("Modifier -y without format -l makes no sense."); return _("modifier -y without format -l makes no sense");
if(prefer_bsd_defaults){ if(prefer_bsd_defaults){
if(format_flags) PUSH("cmd"); if(format_flags) PUSH("cmd");
else PUSH("args"); else PUSH("args");
@ -754,7 +754,7 @@ const char *process_sf_options(int localbroken){
if(err) return err; if(err) return err;
} }
if(format_list) catastrophic_failure(__FILE__, __LINE__, _("Bug: must reset the list first!")); if(format_list) catastrophic_failure(__FILE__, __LINE__, _("bug: must reset the list first"));
/* merge formatting info of sf_list into format_list here */ /* merge formatting info of sf_list into format_list here */
sf_walk = sf_list; sf_walk = sf_list;
@ -792,7 +792,7 @@ const char *process_sf_options(int localbroken){
// with sorting. Do the threads remain grouped, with sorting // with sorting. Do the threads remain grouped, with sorting
// by process, or do the threads get sorted by themselves? // by process, or do the threads get sorted by themselves?
if(sort_list && (thread_flags&TF_no_sort)){ if(sort_list && (thread_flags&TF_no_sort)){
return _("Tell <procps@freelists.org> what you expected."); return _("tell <procps@freelists.org> what you expected");
} }
// If nothing else, try to use $PS_FORMAT before the default. // If nothing else, try to use $PS_FORMAT before the default.
@ -802,7 +802,7 @@ const char *process_sf_options(int localbroken){
if(tmp && *tmp){ if(tmp && *tmp){
const char *err; const char *err;
sf_node sfn; sf_node sfn;
if(thread_flags&TF_must_use) return _("Tell <procps@freelists.org> what you want. (-L/-T, -m/m/H, and $PS_FORMAT)"); if(thread_flags&TF_must_use) return _("tell <procps@freelists.org> what you want (-L/-T, -m/m/H, and $PS_FORMAT)");
sfn.sf = tmp; sfn.sf = tmp;
sfn.f_cooked = NULL; sfn.f_cooked = NULL;
err = format_parse(&sfn); err = format_parse(&sfn);
@ -819,13 +819,13 @@ const char *process_sf_options(int localbroken){
return NULL; return NULL;
} }
// FIXME: prove that this won't be hit on valid bogus-BSD options // FIXME: prove that this won't be hit on valid bogus-BSD options
fprintf(stderr, _("Warning: $PS_FORMAT ignored. (%s)\n"), err); fprintf(stderr, _("warning: $PS_FORMAT ignored. (%s)\n"), err);
} }
} }
if(format_list){ if(format_list){
if(format_flags) return _("Conflicting format options."); if(format_flags) return _("conflicting format options");
if(format_modifiers) return _("Can't use output modifiers with user-defined output"); if(format_modifiers) return _("can not use output modifiers with user-defined output");
if(thread_flags&TF_must_use) return _("-L/-T with H/m/-m and -o/-O/o/O is nonsense"); if(thread_flags&TF_must_use) return _("-L/-T with H/m/-m and -o/-O/o/O is nonsense");
return NULL; return NULL;
} }
@ -834,7 +834,7 @@ const char *process_sf_options(int localbroken){
const char *spec; const char *spec;
switch(format_flags){ switch(format_flags){
default: return _("Conflicting format options."); default: return _("conflicting format options");
/* These can be NULL, which enables SysV list generation code. */ /* These can be NULL, which enables SysV list generation code. */
case 0: spec=NULL; break; case 0: spec=NULL; break;
@ -884,9 +884,9 @@ const char *process_sf_options(int localbroken){
if(format_modifiers & FM_j){ if(format_modifiers & FM_j){
fn = do_one_spec("pgid", NULL); fn = do_one_spec("pgid", NULL);
if(!fmt_add_after("PPID", fn)) if(!fmt_add_after("PID", fn)) if(!fmt_add_after("PPID", fn)) if(!fmt_add_after("PID", fn))
catastrophic_failure(__FILE__, __LINE__, _("Internal error, no PID or PPID for -j option.")); catastrophic_failure(__FILE__, __LINE__, _("internal error: no PID or PPID for -j option"));
fn = do_one_spec("sid", NULL); fn = do_one_spec("sid", NULL);
if(!fmt_add_after("PGID", fn)) return _("Lost my PGID!"); if(!fmt_add_after("PGID", fn)) return _("lost my PGID");
} }
if(format_modifiers & FM_y){ if(format_modifiers & FM_y){
/* TODO: check for failure to do something, and complain if so */ /* TODO: check for failure to do something, and complain if so */
@ -899,10 +899,10 @@ const char *process_sf_options(int localbroken){
fmt_delete("NI"); fmt_delete("NI");
fn = do_one_spec("class", NULL); fn = do_one_spec("class", NULL);
if(!fmt_add_after("PRI", fn)) if(!fmt_add_after("PRI", fn))
catastrophic_failure(__FILE__, __LINE__, _("Internal error, no PRI for -c option.")); catastrophic_failure(__FILE__, __LINE__, _("internal error: no PRI for -c option"));
fmt_delete("PRI"); /* we want a different one */ fmt_delete("PRI"); /* we want a different one */
fn = do_one_spec("pri", NULL); fn = do_one_spec("pri", NULL);
if(!fmt_add_after("CLS", fn)) return _("Lost my CLS!"); if(!fmt_add_after("CLS", fn)) return _("lost my CLS");
} }
if(thread_flags & TF_U_T){ if(thread_flags & TF_U_T){
fn = do_one_spec("spid", NULL); fn = do_one_spec("spid", NULL);

View File

@ -20,7 +20,7 @@
#define INTERACTIVE 0 #define INTERACTIVE 0
#define STACK_TRACE 1 #define STACK_TRACE 1
char *stored_prog_name = "You forgot to set \"program\""; char *stored_prog_name = "you forgot to set \"program\"";
static int stack_trace_done; static int stack_trace_done;
/***********/ /***********/

View File

@ -426,7 +426,7 @@ static void __attribute__ ((__noreturn__))
#if 0 #if 0
static void _skillsnice_usage(int line) static void _skillsnice_usage(int line)
{ {
fprintf(stderr, _("Something at line %d.\n"), line); fprintf(stderr, _("something at line %d\n"), line);
skillsnice_usage(stderr); skillsnice_usage(stderr);
} }

View File

@ -340,7 +340,7 @@ static int WriteSetting(const char *setting) {
value = equals + 1; /* point to the value in name=value */ value = equals + 1; /* point to the value in name=value */
if (!*name || !*value || name == equals) { if (!*name || !*value || name == equals) {
xwarnx(_("Malformed setting \"%s\""), setting); xwarnx(_("malformed setting \"%s\""), setting);
return -2; return -2;
} }

View File

@ -361,7 +361,7 @@ static int diskpartition_format(const char *partition_name)
fDiskstat = fopen("/proc/diskstats", "rb"); fDiskstat = fopen("/proc/diskstats", "rb");
if (!fDiskstat) if (!fDiskstat)
xerrx(EXIT_FAILURE, xerrx(EXIT_FAILURE,
_("Your kernel doesn't support diskstat. (2.5.70 or above required)")); _("your kernel does not support diskstat. (2.5.70 or above required)"));
fclose(fDiskstat); fclose(fDiskstat);
ndisks = getdiskstat(&disks, &partitions); ndisks = getdiskstat(&disks, &partitions);
@ -502,7 +502,7 @@ static void diskformat(void)
} }
} else } else
xerrx(EXIT_FAILURE, xerrx(EXIT_FAILURE,
_("Your kernel doesn't support diskstat (2.5.70 or above required)")); _("your kernel does not support diskstat (2.5.70 or above required)"));
} }
static void slabheader(void) static void slabheader(void)
@ -532,7 +532,7 @@ static void slabformat(void)
fSlab = fopen("/proc/slabinfo", "rb"); fSlab = fopen("/proc/slabinfo", "rb");
if (!fSlab) { if (!fSlab) {
xwarnx(_("Your kernel doesn't support slabinfo or your permissions are insufficient.")); xwarnx(_("your kernel does not support slabinfo or your permissions are insufficient"));
return; return;
} }
@ -813,7 +813,7 @@ int main(int argc, char *argv[])
break; break;
case (PARTITIONSTAT): case (PARTITIONSTAT):
if (diskpartition_format(partition) == -1) if (diskpartition_format(partition) == -1)
printf(_("Partition was not found\n")); printf(_("partition was not found\n"));
break; break;
case (SLABSTAT): case (SLABSTAT):
slabformat(); slabformat();

4
w.c
View File

@ -392,7 +392,7 @@ int main(int argc, char **argv)
userlen = atoi(env_var); userlen = atoi(env_var);
if (userlen < 8 || userlen > USERSZ) { if (userlen < 8 || userlen > USERSZ) {
xwarnx xwarnx
(_("User length environment PROCPS_USERLEN must be between 8 and %d, ignoring.\n"), (_("user length environment PROCPS_USERLEN must be between 8 and %d, ignoring\n"),
USERSZ); USERSZ);
userlen = 8; userlen = 8;
} }
@ -402,7 +402,7 @@ int main(int argc, char **argv)
fromlen = atoi(env_var); fromlen = atoi(env_var);
if (fromlen < 8 || fromlen > HOSTSZ) { if (fromlen < 8 || fromlen > HOSTSZ) {
xwarnx xwarnx
(_("From length environment PROCPS_FROMLEN must be between 8 and %d, ignoring.\n"), (_("from length environment PROCPS_FROMLEN must be between 8 and %d, ignoring\n"),
HOSTSZ); HOSTSZ);
fromlen = 16; fromlen = 16;
} }

12
watch.c
View File

@ -384,13 +384,13 @@ int main(int argc, char *argv[])
/*mbstowcs(NULL, NULL, 0); */ /*mbstowcs(NULL, NULL, 0); */
wcommand_characters = mbstowcs(NULL, command, 0); wcommand_characters = mbstowcs(NULL, command, 0);
if (wcommand_characters < 0) { if (wcommand_characters < 0) {
fprintf(stderr, _("Unicode Handling Error\n")); fprintf(stderr, _("unicode handling error\n"));
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
wcommand = wcommand =
(wchar_t *) malloc((wcommand_characters + 1) * sizeof(wcommand)); (wchar_t *) malloc((wcommand_characters + 1) * sizeof(wcommand));
if (wcommand == NULL) { if (wcommand == NULL) {
fprintf(stderr, _("Unicode Handling Error (malloc)\n")); fprintf(stderr, _("unicode handling error (malloc)\n"));
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
mbstowcs(wcommand, command, wcommand_characters + 1); mbstowcs(wcommand, command, wcommand_characters + 1);
@ -518,7 +518,7 @@ int main(int argc, char *argv[])
/* allocate pipes */ /* allocate pipes */
if (pipe(pipefd) < 0) if (pipe(pipefd) < 0)
xerr(7, _("Unable to create IPC pipes")); xerr(7, _("unable to create IPC pipes"));
/* flush stdout and stderr, since we're about to do fd stuff */ /* flush stdout and stderr, since we're about to do fd stuff */
fflush(stdout); fflush(stdout);
@ -528,7 +528,7 @@ int main(int argc, char *argv[])
child = fork(); child = fork();
if (child < 0) { /* fork error */ if (child < 0) { /* fork error */
xerr(2, _("Unable to fork process")); xerr(2, _("unable to fork process"));
} else if (child == 0) { /* in child */ } else if (child == 0) { /* in child */
close(pipefd[0]); /* child doesn't need read side of pipe */ close(pipefd[0]); /* child doesn't need read side of pipe */
close(1); /* prepare to replace stdout with pipe */ close(1); /* prepare to replace stdout with pipe */
@ -539,7 +539,7 @@ int main(int argc, char *argv[])
if (option_exec) { /* pass command to exec instead of system */ if (option_exec) { /* pass command to exec instead of system */
if (execvp(command_argv[0], command_argv) == -1) { if (execvp(command_argv[0], command_argv) == -1) {
xerr(4, _("Unable to execute '%s'"), command_argv[0]); xerr(4, _("unable to execute '%s'"), command_argv[0]);
} }
} else { } else {
status = system(command); /* watch manpage promises sh quoting */ status = system(command); /* watch manpage promises sh quoting */
@ -688,7 +688,7 @@ int main(int argc, char *argv[])
beep(); beep();
if (option_errexit) { if (option_errexit) {
mvaddstr(height - 1, 0, mvaddstr(height - 1, 0,
_("Command exit with a non-zero status. Press a key to exit.")); _("command exit with a non-zero status, press a key to exit"));
refresh(); refresh();
fgetc(stdin); fgetc(stdin);
endwin(); endwin();