Commit Graph

53 Commits

Author SHA1 Message Date
Jaromir Capik
ca03e0280f Applied corrected patch for w -i
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>
2012-05-30 21:37:13 +10:00
Jaromir Capik
2b58862421 Add -i option to w
w can now show IP address for the from field with the -i option
2012-05-29 22:20:36 +10:00
Mike Frysinger
2320dc9cdb w: fix printf compile warning
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>
2012-05-22 20:18:51 +10:00
Craig Small
9af478c13d Remove trailing - from w from column
Jaromir Capik discovered that the from column for w would print
a trailing - for some types of hosts.
2012-04-25 10:21:07 +10: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
031afacb48 w: align header when from lenght is defined
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>
2012-03-04 12:12:42 +01:00
Sami Kerola
c459346303 w: make date string abbreviations nls aware
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2012-03-04 11:56:25 +01:00
Sami Kerola
abd9e0f6e2 w: use utmp headers to determine host size as well
Completes change in commit ddd15211e0

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2012-03-04 11:53:29 +01:00
Sami Kerola
ddd15211e0 w: use utmp definitions to determine array sizes
Signed-off-by: Sami Kerola <kerolasa@iki.fi>

Conflicts:

	w.c
2012-03-04 08:20:39 +11: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
2347521bb5 w: fix compiler warnings
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>
2012-03-03 18:36:29 +11:00
Craig Small
502a79e02f Merge remote-tracking branch 'sami/to-craig' into sami-merge
Conflicts:
	pgrep.c
	w.c
2012-03-03 13:56:32 +11:00
Mike Frysinger
0da6537c5f fix printf format warnings
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>
2012-01-26 21:15:42 +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
Sami Kerola
6241e9d545 w: indicate unknown host when -f is used
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>
2012-01-08 21:31:56 +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
Jim Warner
94468ac0b3 w: fix broken -o (old-style) short form option 2012-01-02 16:27:38 +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
76841eda26 w: add gettext support
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2011-12-20 17:17:04 +01:00
Sami Kerola
7af14af685 w: new usage & fix coding style
Coding style fixed and more readable help output.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2011-12-20 17:17:02 +01:00
Craig Small
99bebff06a w: use environment to set user and from/host column widths
A patch from Debian.

Bug-Debian: http://bugs.debian.org/396423
Bug-Debian: http://bugs.debian.org/341439
Backported-by: Sami Kerola <kerolasa@iki.fi>
2011-12-18 22:57:35 +11:00
Craig Small
88f485e20a w: use COLUMNS environment if TIOCGWINSZ fails
A patch from Debian.

Backported-by: Sami Kerola <kerolasa@iki.fi>
2011-12-18 22:56:59 +11:00
Craig Small
a0a51eb921 w: bassman emulation with -o option
A patch from Debian.

Bug-Debian: http://bugs.debian.org/414906
Backported-by: Sami Kerola <kerolasa@iki.fi>
2011-12-18 22:56:41 +11:00
Craig Small
3f59ff5a16 Revert -n flag for w 2011-07-15 08:52:45 +10:00
Craig Small
a26c3bfa39 top hotplug memory support
Another patch from Jim for top to support hot-pluggable memory. Not
fully tested on real hot-pluggable memory because neither of us have
it
2011-07-14 21:16:02 +10:00
Werner Fink
4736dad559 Do not let sysctl abort due a missed file or directory under /proc.
Include signal.h for compiling w.

Signed-off-by: Werner Fink <werner@suse.de>
2011-01-19 12:26:01 +01:00
Jan Görig
63b6a8fcbf Make w make better guesses for user process
Based on suggestion by Herbert Xu <herbert@gondor.apana.org.au>
Bug-Debian: http://bugs.debian.org/187808
Author: Craig Small <csmall@debian.org>
2010-12-16 10:15:35 +01:00
albert
87eb7ec462 w: stale utmp entries snuck in via uninitialized var -- thanks Robert A Basch 2006-06-17 06:14:33 +00:00
albert
7767733812 dietlibc needs termios.h for struct winsize -- thanks Thomas Ogrisegg 2005-10-30 00:04:21 +00:00
albert
c961f2604a leftovers in the 3.2.4 release 2004-11-04 20:50:59 +00:00
albert
c462dcfad5 ps thread support 2003-09-20 08:29:55 +00:00
albert
f2a0a095ba completed the move, output.* --> escape.* 2002-12-21 13:36:36 +00:00
albert
34dd01fa40 argv[0] should keep people happy! 2002-12-21 12:02:51 +00:00
albert
3e67b58ec2 satisfy GPL section 2a and LGPL section 2b name+date requirement 2002-12-15 00:30:17 +00:00
albert
cf16b01a99 stdout, not stderr -- thanks to Sander van Malssen 2002-12-11 21:25:04 +00:00
albert
5087f3dbf6 big header clean-up 2002-12-09 07:00:07 +00:00
albert
6e83c7ed6e tolerate libproc changes 2002-12-08 21:05:54 +00:00
albert
be982c88fd c99 fixes 2002-11-26 00:11:35 +00:00
albert
c846a886db part 2 2002-11-26 00:04:25 +00:00
albert
c471462b3d w.c is 4-unit indent, mixed spaces and 8-unit hard tabs 2002-11-25 23:34:27 +00:00
albert
1572abd03e part 1 2002-11-25 23:24:40 +00:00
albert
81a4a3d281 gcc 3.0 warnings 2002-10-12 04:25:57 +00:00
albert
64808793eb coding style II 2002-10-09 22:01:55 +00:00
albert
af89241571 coding style 2002-10-09 21:32:33 +00:00
albert
e4d350522e mention -a 2002-10-09 04:28:48 +00:00
albert
f0b745c222 Alexandra N. Kossovsky's KOI8-R locale fix #153043 2002-10-08 18:45:19 +00:00
albert
58d7de98cf 64-bit time for Linux 2.5.xx 2002-05-29 16:40:03 +00:00
albert
bce2da1f9a 64-bit time for Linux 2.5.xx 2002-05-28 04:18:55 +00:00