Commit Graph

788 Commits

Author SHA1 Message Date
Jim Warner
32a9adbc13 top: provide extensive, generalized nls support
Reviewed-by: Sami Kerola <kerolasa@iki.fi>
Signed-off-by: Jim Warner <james.warner@comcast.net>
2011-12-22 23:48:04 +11:00
Sami Kerola
35cf8a4adc top: add gettext support
Signed-off-by: Jim Warner <james.warner@comcast.net>
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2011-12-22 23:48:03 +11:00
Jim Warner
05f5deb97c top: with lib xalloc changes, restored prior memory logic
With the privatization of the library xalloc functions,
this patch restores top's previous internal memory logic.

This puts us back on a 3.3.1 (and earlier) footing wherein
memory allocation errors carry these implications:
  . if top detected, the terminal will be restored
    prior to an abnormal exit and message
  . if library detected, the terminal will become
    corrupted following the message

To my knowledge, neither type of memory error has ever occurred
during the nine years since top was rewritten.  So the issue of
restoring the termios structure is probably moot.
2011-12-22 23:48:03 +11:00
Sami Kerola
a10282422b sysctl: enable pattern matching with path
Pattern matching support in `sysctl: implement --pattern option'
commit did not work when variable path was defined, for example

$ sysctl net.ipv4 -r arp.ignore

gave no output. Reason being was tht the pattern was matched agains
the specified argument and not the output variable list.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2011-12-20 17:30:55 +01:00
Sami Kerola
5862f47b96 watch: use strtod_or_err() to validate user input
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2011-12-20 17:30:55 +01:00
Sami Kerola
208a043256 tload: validate scale argument
Earlier version crashed when negative value was provided.

$ tload -s -1
Segmentation fault

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2011-12-20 17:30:54 +01:00
Sami Kerola
c0e7e96c1a lib: add strtod_or_err()
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2011-12-20 17:30:54 +01:00
Sami Kerola
2c8b3a7857 pwdx: write errors to stderr
Includes also magic number removal (return value 1 to EXIT_FAILURE),
and proper null assignment to end of string.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2011-12-20 17:30:54 +01:00
Sami Kerola
741de935ef slabtop: use strutils.c to validate user input
This commit fixes also peculiar behavior of

$ slabtop -d 0

which did not make sense. The fix is to disallow anything else but
positive integers, which includes zero as is is not positive (or
negative) number.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2011-12-20 17:30:54 +01:00
Sami Kerola
032f2ed674 vmstat: validate numeric user input and allow infinte updates
The vmstat used ULONG_MAX as definition of infinite updates.  On a
computer with mighty uptime one will find that after 136 years
(assuming 1 second update interval) the vmstat exits, which is in
conflict with a promise of infinite.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2011-12-20 17:30:54 +01:00
Sami Kerola
9047933b2d tload: validate numeric user input
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2011-12-20 17:30:54 +01:00
Sami Kerola
7f99096ded sysctl: exit with error message instead of usage()
Printing usage() output at error is too noisy.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2011-12-20 17:30:54 +01:00
Sami Kerola
127c82763a docs: add exit values to pmap manual page
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2011-12-20 17:30:54 +01:00
Sami Kerola
46d5d44734 pgrep: exit with error message instead of usage()
Printing usage() output at error is too noisy.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2011-12-20 17:30:54 +01:00
Sami Kerola
003d388922 docs: clean up ps.1 manual page
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2011-12-20 17:30:54 +01:00
Sami Kerola
0022b6ec5d nls: improve translations and provide translator help comments
Reference: http://www.freelists.org/post/procps/backporting,1
Reported-by: Jim Warner <james.warner@comcast.net>
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2011-12-20 17:30:54 +01:00
Sami Kerola
7b6084451d other: tell what was taken from util-linux package
Reference: http://www.freelists.org/post/procps/backporting,1
Reported-by: Jim Warner <james.warner@comcast.net>
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2011-12-20 17:30:53 +01:00
Sami Kerola
c862a4caa5 nls: add functions which take translations to be used
Add the following three functions to most of the commands.

setlocale (LC_ALL, "");
bindtextdomain(PACKAGE, LOCALEDIR);
textdomain(PACKAGE);

Reference: http://www.freelists.org/post/procps/backporting,1
Reported-by: Jim Warner <james.warner@comcast.net>
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2011-12-20 17:30:53 +01:00
Sami Kerola
b40353c91e skill: use rpmatch() to yes/no question
The patch also removes fixed size of input, which can be problematic.
I do not know how long the string `yes' might be in all of the worlds
languages.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2011-12-20 17:30:53 +01:00
Sami Kerola
72e37c7d11 vmstats: fix coding style
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2011-12-20 17:30:53 +01:00
Sami Kerola
7af3d4efce dosc: add long options to skill.1
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2011-12-20 17:30:53 +01:00
Sami Kerola
526bae02bb docs: add long options to kill.1
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2011-12-20 17:30:53 +01:00
Sami Kerola
1ac2921f6f skill: fix compiler warnings
Pretty much all of the warnings where caused by some of the previous
patches, and they became visible with gcc when compiling with;

CFLAGS="-O -g -ggdb -Wall -Wextra -pedantic -Wstrict-overflow
	-Wformat -Wswitch-default -Wswitch-enum -Wsync-nand
	-Wredundant-decls -Wuninitialized"

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2011-12-20 17:30:53 +01:00
Sami Kerola
d8d94a87ef skill: add long options to usage output
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2011-12-20 17:30:53 +01:00
Sami Kerola
4ea27a7716 skill: support usage output to stdout & stderr
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2011-12-20 17:30:53 +01:00
Sami Kerola
89e1a83c07 skill: use symbolic exit values
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2011-12-20 17:30:53 +01:00
Sami Kerola
8b8149ba60 skill: use strtosig() for -l option argument
Re-enable signal number to name string, and other way around,
conversion after it broke at the time when long options where
introduced.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2011-12-20 17:30:53 +01:00
Sami Kerola
94bbf63140 libproc-ng: add strtosig() function
The function will convert a signal number string to a signal name, or
vice a verse.  Return value is string, which is an function user is
expected to free after use.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2011-12-20 17:30:53 +01:00
Sami Kerola
a45a1c6c88 skill: add long options
This commit broke `-l <sig>' conversion, which needs to be fixed
before kill can be claimed to work similar enough way as it did
earlier.  The fix require libprocps change, because the current
print_given_signals() simply does not work in this case.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2011-12-20 17:30:53 +01:00
Sami Kerola
b4b73df69c skill: warning printout for non-existing processes
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2011-12-20 17:30:52 +01:00
Sami Kerola
991b8a94f0 skill: add long options & new debugging option
Done for skillsnice_parse(), meaning the kill needs functionality
will be done later.

This commit also introduces new debugging option.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2011-12-20 17:30:52 +01:00
Sami Kerola
61094186fe skill: parse kill signals separately
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2011-12-20 17:30:52 +01:00
Sami Kerola
723ce0dc74 skill: use strtol_or_err to nice argument parsing
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2011-12-20 17:30:52 +01:00
Sami Kerola
b260b11a3b lib: add strtol into utility library
The utility library is for functions which are shared in commands,
but that does not belong to libproc-ng.  The first function is a
wrapper for strtol that performs error checking, and exists if such
happen.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2011-12-20 17:30:52 +01:00
Sami Kerola
130895b02e skill: remove run time configuration global variables
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2011-12-20 17:30:52 +01:00
Sami Kerola
9e3203203f skill: move usage functions near each other
Done only for convenience.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2011-12-20 17:30:52 +01:00
Sami Kerola
4c8446dc55 skill: clean up which functionality is being called
The skill.c is three different commands depending on how the
executable is named. This patch makes evaluation of the command name
cleaner.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2011-12-20 17:30:52 +01:00
Sami Kerola
57f290dcb4 skill: reindent the file
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2011-12-20 17:30:52 +01:00
Jim Warner
3e90357803 build-sys: use Makevars --add-comments= to limit .pot comments
By not limiting --add-comments= via an argument, xgettext is far
too aggressive (one might say stupid) when extracting comments.
It doesn't even limit extraction to a single preceeding comment.

Here is an example showing a program source excerpt and the
resulting .pot excerpt:

 --- program source ----------------------------------------
 close (0); dup (in_fd[0]);  /* set the stdin to the in pipe */
 close (1); dup (out_fd[1]); /* set the stdout to the out pipe */
 close (2); dup (out_fd[1]); /* set the stderr to the out pipe */
 execvp (args[0], args);     /* exec gdb */
 perror (_("exec failed"));

 --- resulting .pot ----------------------------------------
 #. set the stdin to the in pipe
 #. set the stdout to the out pipe
 #. set the stderr to the out pipe
 #. exec gdb
 #: ps/stacktrace.c:28 ps/stacktrace.c:63
 msgid "exec failed"
 msgstr ""
2011-12-20 17:30:52 +01:00
Jim Warner
364325362d build-sys: we don't need wide-ncurses, what were we thinking?
. 1 program uses curses (top)
. 2 programs use ncurses (slabtop, watch)
. all 3 include non-wide <curses.h> or <ncurses.h>
. those 3 do not currently need wide support
. but anticipating nls, we link against libncursesw

This patch ensures an environment consistent with current
and future ncurses needs.
2011-12-20 17:30:52 +01:00
Jim Warner
692dcb531c build-sys: added config.h include to nls.h (for PACKAGE str) 2011-12-20 17:30:52 +01:00
Jim Warner
50fca987cc build-sys: added tabs to AC_CONFIG_FILES for consistency 2011-12-20 17:30:51 +01:00
Jim Warner
326c510e70 build-sys: alphabeticized strverscmp in AC_CHECK_FUNCS 2011-12-20 17:30:51 +01:00
Jim Warner
cb10eb8e18 build-sys: added some missing files to AC_CHECK_HEADERS 2011-12-20 17:30:51 +01:00
Jim Warner
0d27054a7b slabtop: added remaining missing nls support 2011-12-20 17:30:51 +01:00
Jim Warner
7b9b0c8d18 free: added remaining missing nls support 2011-12-20 17:30:51 +01:00
Jim Warner
faed131f10 misc: trailing space/tab cleanup following rebase 2011-12-20 17:30:51 +01:00
Jim Warner
0d48df69a4 build-sys: corrected/simplified ncurses support detection 2011-12-20 17:30:51 +01:00
Jim Warner
86e938a333 pmap: correct 'rh analysis #2' patch and contrib document 2011-12-20 17:30:51 +01:00
Sami Kerola
565e4c61a8 build-sys: verify gettext is present in autogen.sh
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2011-12-20 17:30:51 +01:00