I checked the second patch, saved it, it looked ok.
And then applied the first (wrong) patch. Jaromik gave this correction.
Signed-off-by: Craig Small <csmall@enc.com.au>
Building w on an x86_64 system triggers:
w.c:404:4: warning: format '%zu' expects argument of type 'size_t',
but argument 4 has type 'int' [-Wformat]
Since we're comparing UT_NAMESIZE to an int, cast it to that type
(since it can't exceed it) and update the printf.
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
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>
Before this commit header and output was not in sync if
PROCPS_FROMLEN environment variable where defined. Example of wrong
behavior is below where the last four fields which are skewed.
$ PROCPS_FROMLEN=18 w -f | cat
12:31:34 up 1:25, 1 user, load average: 0.03, 0.06, 0.06
USER TTY FROM LOGIN@ IDLE JCPU PCPU WHAT
sake tty1 - 11:06 1:25m 3.76s 0.00s xinit /ho[...]
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
w.c:409:2: warning: suggest parentheses around assignment used as truth value [-Wparentheses]
w.c:325:42: warning: unused variable 'args' [-Wunused-variable]
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
pgrep.c: In function 'main':
pgrep.c:793:4: warning: format '%d' expects argument of type 'int', but argument 4 has type 'long int' [-Wformat]
vmstat.c: In function 'diskpartition_format':
vmstat.c:382:9: warning: format '%u' expects argument of type 'unsigned int', but argument 5 has type 'long long unsigned int' [-Wformat]
vmstat.c:408:10: warning: format '%u' expects argument of type 'unsigned int', but argument 5 has type 'long long unsigned int' [-Wformat]
w.c: In function 'main':
w.c:394:4: warning: format '%d' expects argument of type 'int', but argument 4 has type 'long unsigned int' [-Wformat]
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
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>
The option -f used too print `-' to FROM column when host was not
known. This commit changes behaviour back to what it was earlier.
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
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.
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>