Commit Graph

55 Commits

Author SHA1 Message Date
Sami Kerola
c8554e6c0f skill: fix compiler warnings
skill.c:340:5: warning: no previous declaration for 'skill_sig_option' [-Wmissing-declarations]
skill.c:460:5: warning: no previous declaration for 'snice_prio_option' [-Wmissing-declarations]

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2012-11-06 22:28:30 +11:00
Craig Small
19b6f48990 kill -PID fixed
Bug-Debian: http://bugs.debian.org/688731

kill would not permit negative PIDs and thought they were options. kill
now explicitly checks for unknown options and if they are numeric
assumes they are negative PIDs.  The first negative PID stops any
further option processing.

Signed-off-by: Craig Small <csmall@enc.com.au>
2012-10-02 21:56:38 +10:00
Mike Frysinger
c6e3ec4602 skill: check return value of getline
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2012-05-22 20:19:03 +10:00
Sami Kerola
34344de979 build-sys: uClibc does not have rpmatch()
Add simple replacement with hardcoded y/n responses to allow
compilation on systems without rpmatch().

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2012-04-18 10:03:55 +02:00
Sami Kerola
52269d22f3 all: check stdout and stderr status at exit
If stream status is not checked at the end of execution below problem
would not report error, or non-zero exit code.  The uptime is just an
example same was true with all commands of the project.

$ uptime >&- ; echo $?
uptime: write error: Bad file descriptor
1
$ uptime >/dev/full ; echo $?
uptime: write error: No space left on device
1

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2012-03-23 15:57:53 +01:00
Sami Kerola
be34477bbd skill: remove dead code
Commit 991b8a94f0 took use
getopt_long(), which means the code that is related to earlier
selfmade argument parsing is unnecessary.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2012-03-16 14:34:21 +01:00
Sami Kerola
ce61089059 docs: clarification to license headers in files
Add license header to all files.  The summary of licensing is below,
taken from Craig Small's email which is referred in commit message
tail.

sysctl and pgrep are GPL 2+
The rest is LGPL 2.1+

Reference: http://www.freelists.org/post/procps/Incorrect-FSF-address-in-the-license-files,8
Bug-Redhat: https://bugzilla.redhat.com/show_bug.cgi?id=797962
CC: Craig Small <csmall@enc.com.au>
CC: Jaromir Capik <jcapik@redhat.com>
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2012-03-03 18:41:11 +11:00
Sami Kerola
ef4a6bef5f skill: fix argument parsing regression
Command skill accepted earlier command name as argument.  This did
not work since commit 991b8a94f0.

Reported-By: "Anne C. Hanna" <orion@ugcs.caltech.edu>
Bug-Debian: http://bugs.debian.org/659038
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2012-02-11 21:42:35 +01:00
Sami Kerola
8cd53e16b5 skill: ensure optarg is not null [smatch scan]
skill.c:549 skillsnice_parse(87) error: we previously assumed 'optarg' could be null (see line 539)

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2012-02-05 20:54:58 +01:00
Craig Small
8955ec26fe Merge remote-tracking branch 'sami/vapier' 2012-01-24 22:36:28 +11:00
Mike Frysinger
afaf698896 use helpers from c.h
A few files still use the C library helpers from err.h, so migrate
them to the local c.h helpers.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2012-01-24 08:55:05 +01:00
Sami Kerola
7fc80ffa42 skill: exclude debugging strings from nls
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2012-01-22 01:23:59 +01:00
Sami Kerola
79ceb30b5c 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>
2012-01-15 20:52:58 +01:00
Craig Small
fb11e1fe0a Changed the err and warns to macros
err and warn are BSD format but they are not recommended by library
developers.  However their consiseness is useful!

The solution is to use some macros that create xerr etc which then
just map to the error() function.  The next problem is error() uses
program_invocation_name so we set this to program_invovation_short_name

This is a global set but seems to be the convention (or at least errors
are on the short name only) used everywhere else.
2012-01-03 18:48:43 +11:00
Sami Kerola
c3405fab1a translations: group usage texts
Reference: http://www.freelists.org/post/procps/backporting,5
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2012-01-02 16:29:03 +11: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
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
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
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
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
Sami Kerola
1ef14f4bf9 includes: add xalloc.h to unify memory allocations
The xalloc.h provides necessary error checking.

Signed-off-by: Jim Warner <james.warner@comcast.net>
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2011-12-20 17:30:50 +01:00
Sami Kerola
84c9e5fbf5 skill: add gettext support
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2011-12-20 17:17:04 +01:00
Sami Kerola
b6578cb372 skill: new usage function
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2011-12-20 17:17:03 +01:00
Justin Pryzby
db4751c216 skill: kill prints perror
A patch from Debian.

Bug-Debian: http://bugs.debian.org/468363
Backported-by: Sami Kerola <kerolasa@iki.fi>
2011-12-18 22:52:03 +11:00
WANG Yunfeng
15b853c02b skill: do not treat skill null parameter as 0
A patch from Debian.

Bug-Debian: http://bugs.debian.org/551173
Backported-by: Sami Kerola <kerolasa@iki.fi>
2011-12-18 22:51:32 +11:00
Craig Small
057f895529 skill: fix too greedy option parser
Patch based on submitted patch by Yoshio Nakamura

A patch from Debian.

Bug-Debian: http://bugs.debian.org/331419
Bug-Debian: http://bugs.debian.org/569030
Backported-by: Sami Kerola <kerolasa@iki.fi>
2011-12-18 22:50:58 +11:00
Craig Small
86fb879a0d skill: add CR to warning line
A patch from Debian.

Bug-Debian: http://bugs.debian.org/331419
Bug-Debian: http://bugs.debian.org/331419
Backported-by: Sami Kerola <kerolasa@iki.fi>
2011-12-18 22:26:24 +11:00
Jim Warner
f9ae59f5df libtool accommodation: kill, skill, snice 2011-10-11 09:57:01 +02:00
albert
fcc376b861 note UNIX standard self-conflict 2008-03-24 05:57:28 +00:00
albert
59fc9dd711 %cpu and other changes 2004-09-12 15:43:48 +00:00
albert
f1db79c042 better handling of long usernames 2004-07-20 23:31:12 +00:00
albert
360e6533c9 misc 2003-08-16 21:15:53 +00:00
albert
3e67b58ec2 satisfy GPL section 2a and LGPL section 2b name+date requirement 2002-12-15 00:30:17 +00:00
albert
b657e7e08a NORETURN 2002-12-09 07:53:09 +00:00
albert
5087f3dbf6 big header clean-up 2002-12-09 07:00:07 +00:00
albert
7ac9a0e1f5 present for Jim 2002-12-03 09:07:59 +00:00
albert
80b73a78e4 c99 warnings again 2002-11-27 08:36:03 +00:00
albert
ade43a692b c99 -- ugh, this is HARD 2002-11-27 08:21:30 +00:00