Commit Graph

519 Commits

Author SHA1 Message Date
Karel Zak 3d0b57d62c Merge branch 'opts' of https://github.com/jwpi/util-linux 2015-01-26 11:31:05 +01:00
Benno Schulenberg 54fefa078e textual: fix spellos and inconsistencies in several program messages
Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
2015-01-26 11:17:55 +01:00
J William Piggott b06c1ca6f8 docs: restore minus symbols in long opts
Signed-off-by: J William Piggott <elseifthen@gmx.com>
2015-01-20 18:15:30 -05:00
Benno Schulenberg 3a60b1c26b docs: remove obsolete and unneeded comments from man-page files
Transform some of them into copyright lines.
Also fix three header lines and snip some trailing whitespace.

Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
2015-01-12 11:03:26 +01:00
Sami Kerola 4ebac79f01 build-sys: fix make checkincludes warnings
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2015-01-07 21:57:53 +00:00
Benno Schulenberg 451dbcfae1 textual: add a docstring to most of the utilities
This adds a concise description of a tool to its usage text.

A first form of this patch was proposed by Steven Honeyman
(see http://www.spinics.net/lists/util-linux-ng/msg09994.html).

Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
2015-01-06 11:27:38 +01:00
Benno Schulenberg f49ccec212 docs: don't use bold or italics for "[option]" in synopsis of man pages
As per the convention shown in Documentation/howto-man-page.txt.
Also make a few other tiny adjustments along the way.

Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
2014-12-19 09:57:23 +01:00
Karel Zak 90d5285d8c agetty: use futimens, check for all in configure.ac
It seems better to warn about --reload in ./configure if futimens or
inotify_init1 are missing.

The patch also replaces futimes() with futimens() to make the code
compatible with Uclibc.

Addresses: https://github.com/karelzak/util-linux/issues/133
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-11-21 11:38:11 +01:00
Karel Zak 3c5ee57cd3 agetty: fix typo
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-11-21 09:42:23 +01:00
Karel Zak 914047b498 agetty: keep the current baud before try 9600 on serial lines
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-11-21 09:03:00 +01:00
Karel Zak 14da9b1f3d agetty: don't ignore TERM
Fix command line parsing to not ignore term setting if no baud
specified, for example:

  /sbin/agetty ttyS0 vt100

Signed-off-by: Karel Zak <kzak@redhat.com>
2014-11-21 08:43:14 +01:00
Karel Zak 8410cdd38a aggety: always set default serial line speed
* makes speeds table usage more robust
* don't call next_speed() for empty speeds table to avoid division by zero
* default to 9600 when port baud unspecified

Addresses: https://github.com/karelzak/util-linux/pull/131
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-11-20 10:56:03 +01:00
Sami Kerola d8c1fc7ac4 setterm: fix dubious one-bit signed bitfield [smatch scan]
term-utils/setterm.c:165:24: error: dubious one-bit signed bitfield

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2014-10-20 14:07:19 +02:00
Andreas Henriksson 032228c9af script: may be hangs
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-10-14 12:07:21 +02:00
Sami Kerola db433bf737 textual: use usage() text element macros
Translating these text elements should happen only once, which is
more likely when the text macros are used properly.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2014-10-01 12:33:26 +02:00
Sami Kerola a587cc5520 textual: use manual tail usage() macro
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2014-10-01 12:33:24 +02:00
Sami Kerola f627750083 textual: use version printing macro everywhere
Only mount, umount, and blkid remains not using the macro because they
are print also library references.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2014-10-01 12:33:23 +02:00
Karel Zak 8026fa9bc7 build-sys: use -lutil for BSD only
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-09-17 10:56:46 +02:00
Christoph Egger c32270d41f agetty: fixing FTBFS on !linux (Debian util-linux 2.20.1-1.2)
Handle vc flags missing on FreeBSD
Fix tty creation on kFreeBSD taking patch from 2.19

Addresses-Debian-Bug: #650185
2014-09-17 10:14:50 +02:00
Benno Schulenberg 1d23119072 textual: remove some inconsistent periods from error messages
While doing so, also improve translatability and some wordings.

Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
2014-08-11 14:51:54 +02:00
Karel Zak b928bb109a Revert "wall: wrap message header when it exceeds 79 characters"
This reverts commit 93d7baf250.

Ooops... it wasn't my plan to merge this patch. Sorry.
2014-07-29 11:57:01 +02:00
Sami Kerola 93d7baf250 wall: wrap message header when it exceeds 79 characters
Header truncation started to happen more often after commit
d81c30553f that made the header to be
longer.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2014-07-28 21:15:18 +01:00
Stef Walter 6443dd43da agetty: Reprompt and reprint /etc/issue when asked
Add an 'agetty --reload' command which asks all running agetty
commands to display their prompts again.

Several of the /etc/issue escape codes such as \4 and \S depend on
variable data which can change after the agetty prompt is displayed.
This can cause stale data to be displayed when a user looks at a VT,
especially in cases of DHCP racing with system start up.

We never want this to occur once the user has started typing a
user name. So we detect when the user starts typing, after which
no further reprompting occurs after that point.

[kzak@redhat.com: - add #ifdefs to make it usable on non-inotify systems,
                  - use futimens() with NULL timespec
                  - add --reaload to usage()]

Signed-off-by: Stef Walter <stefw-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-07-28 16:33:33 +02:00
Karel Zak 479912e7b3 wall: add fallback for failed sysconf()
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-07-17 15:19:34 +02:00
Benno Schulenberg 6e72fa5965 docs: bring a few more man pages closer to standard formatting
Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
2014-07-16 12:03:25 +02:00
Sami Kerola 4636f0613d setterm: remove unnecessary variable
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2014-07-13 17:27:10 +01:00
Benno Schulenberg d276d99572 setterm: improve formatting and wording of usage text
Mainly: showing that the word color is a placeholder by writing
<color>, showing some numbers as optional, and message levels
and colors as not optional.

Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
2014-06-30 10:21:11 +02:00
Benno Schulenberg e73a07208e setterm: improve wording and formatting of the man page
The main changes are: showing the arguments of boolean options
as optional, improving the alphabetization, and restoring the
--half-bright option that went missing in 2011.

Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
2014-06-30 10:20:09 +02:00
Karel Zak cabce4ea71 script: clean up code to genenrate Star/Done messages
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-06-23 11:41:31 +02:00
Andreas Henriksson dc47cfee48 script: silence the done message on --quiet as well
Apparently James Hunts patch (which he provided a long time
ago) is no longer covering it all.

This followup patch also silences the "Script done ..." message
when --quiet is used.

Signed-off-by: Andreas Henriksson <andreas@fatal.se>
2014-06-23 11:31:08 +02:00
James Hunt 1474c09ea8 script: --quiet option is not quiet.
Specifying 'script --quiet ...' still produces the 'Script started'
message in the typescript file. The --quiet option implies that the
script program should not log any of its output to the typescript file.

Originally reported at:
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=693966

Signed-off-by: Andreas Henriksson <andreas@fatal.se>
2014-06-23 11:31:07 +02:00
Samuel Thibault 88e0f3df66 build-sys: fixes for non-Linux systems
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-06-19 10:35:23 +02:00
Karel Zak ee312c654b docs: fix "behaviour" vs. "behavior"
Sometimes we use "behaviour" and "behavior" in the same text, let's
use "behavior" only everywhere.

Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=1011068
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-06-06 09:49:35 +02:00
Csaba Kos 578a1691f6 script: fix spurious exit from input read loop on EINTR. 2014-06-02 10:14:30 +02:00
Csaba Kos 26ed9fb872 script: fix a rare deadlock after child termination 2014-06-02 10:14:07 +02:00
Sami Kerola 8e3bdb3468 docs: setterm.1 clean up manual page groff style
Underline option arguments, and use bold for options.  Avoid use of \f
font style change in paragraphs, but use them when describing options.

Reviewed-by: Benno Schulenberg <bensberg@justemail.net>
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2014-05-26 16:35:59 +01:00
Sami Kerola f0dcd918eb docs: setterm.1 add options compatibility note
Both --option and -option formats are accepted.

Reviewed-by: Benno Schulenberg <bensberg@justemail.net>
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2014-05-26 16:35:59 +01:00
Sami Kerola b5700fe506 docs: setterm.1 add missing options to manual page and remove duplicate
Reviewed-by: Benno Schulenberg <bensberg@justemail.net>
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2014-05-26 16:35:59 +01:00
Sami Kerola 5edc8dbc33 setterm: add usage() descriptions
Reviewed-by: Benno Schulenberg <bensberg@justemail.net>
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2014-05-26 16:35:59 +01:00
Karel Zak 3f91b9902b build-sys: add BUILD_{SCRIPT,SCRIPTREPLAY}
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-05-21 13:58:03 +02:00
Karel Zak 2832032772 setterm: fix 'bright' in usage, remove unnecessary error message
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-05-20 11:56:43 +02:00
Sami Kerola fbb08864cb setterm: remove ulcolor and hbcolor duplicates
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2014-05-19 22:58:14 +01:00
Sami Kerola 7a20c8a188 setterm: add set_blanking() action
This make over long perform_sequence() function a little bit shorter.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2014-05-19 22:54:24 +01:00
Sami Kerola 11f69359fa setterm: mark some options to be exclusive with each other
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2014-05-19 22:54:24 +01:00
Sami Kerola 78dd23cbf5 setterm: various visual terminal effects are not console specific
Setting colors, making line not to wrap, and so on can be attempted in
other than consoles.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2014-05-19 22:54:23 +01:00
Sami Kerola cda2b5b951 setterm: improve error messages
Reuse messages to make translation work easier.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2014-05-19 22:54:23 +01:00
Sami Kerola da27df2553 setterm: tell user when options does not effect
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2014-05-19 22:54:23 +01:00
Sami Kerola 16279cc2b4 setterm: improve perform_sequence() coding style
Delete pointless braces, new lines, and add spacing between operators.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2014-05-19 22:54:23 +01:00
Sami Kerola 253e5e7161 setterm: correct usage() bright color argument
This has been wrong since commit 2dc8716.  The bright is a prefix
attribute to other colors.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2014-05-19 22:54:17 +01:00
Sami Kerola 917465831f setterm: make -msglevel 0 to work as is did earlier
Commit 3393c136 caused regression.  The klogctl() logging range is 1-8,
but the value 0 is special according to setterm.1 manual page.  It turns
on loging, same way as '-msg on' option.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2014-05-19 22:45:39 +01:00
Sami Kerola 609d48534a setterm: remove devfs and /dev/vcsa0 support
The devfs files /dev/vcc/a* does not need to be supported, and vcsa0 has
not existed in years if ever.

Reference: http://lwn.net/Articles/65197/
Reference: http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/Documentation/devices.txt?id=14186fea0cb06bc43181ce239efe0df6f1af260a#n260
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2014-05-19 22:45:38 +01:00
Sami Kerola 341566ff45 setterm: clean up screendump()
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2014-05-19 22:45:38 +01:00
Sami Kerola dcc2fe2903 setterm: add init_terminal() to make main() shorter
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2014-05-19 22:45:38 +01:00
Sami Kerola d87d20b0fa setterm: add option control structure
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2014-05-19 22:45:38 +01:00
Sami Kerola 43f68f8fea setterm: remove usage comment segment
It is enough trouble to keep usage output aligned with getopt() parsing,
manual page, and bash-completion, so get rid of the unnecessary effort
duplication.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2014-05-19 22:45:38 +01:00
Sami Kerola c591be873b setterm: move show_tabs() and screendump() functions
Earlier the function was in the middle of option parsing code segment,
and screendump() required function prototype.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2014-05-19 22:45:37 +01:00
Sami Kerola 35b578a02a setterm: use string utils to numeric parsing
Check the input numbers are numbers, which makes also the code shorter,
and user experience better as half invalid imputs will error.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2014-05-19 22:45:36 +01:00
Sami Kerola fb27f91cac setterm: recommend long options with double hyphen
While the -version style options will work for next unknown number of
years start moving towards user interface that has way of invoking long
options as most of the other commands.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2014-05-19 22:21:14 +01:00
Sami Kerola 45c90b77e6 setterm: use getopt_long_only() for option parsing
The getopt_long_only() has advantage of allowing one and two hyphen
versions of options, for example -help and --help.  Secondly the getopt
function family from libc can ensure some options requiring arguments,
while other are optional, and some should not accept argument at all.
That makes option parsing more robust.

Unfortunately retiring the old option parsing makes this change greater
than preferred.  Assuming not mistakes happen the new code works
functionally exactly as the old did.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2014-05-19 21:58:01 +01:00
Sami Kerola 104ecc7e70 setterm: clean up includes
Use klogctl(2) from sys/klog.h just like dmesg(1).  The rest is just
reordering, and indenting.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2014-05-19 21:56:24 +01:00
Karel Zak 0a8dacfe86 agetty: update man page
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-05-19 10:59:54 +02:00
Benjamin Robin 584c07449c agetty: Update help usage function
Signed-off-by: Benjamin Robin <dev@benjarobin.fr>
2014-05-18 02:48:14 +02:00
Benjamin Robin 6c77c7fac2 agetty: Fix implementation of option --nonewline. The flag F_NONL was never set.
Signed-off-by: Benjamin Robin <dev@benjarobin.fr>
2014-05-18 02:47:42 +02:00
Karel Zak 0f283438bf agetty: use the "best" interface for \4 and \6
The issue file escape sequences \4 and \6 prints the host IP when no
interface is specified. That's useless on some virtual machines where
gethostname()+getaddrinfo() returns 127.0.0.1.

The seems better to print IP of the "best" interface (UP, RUNNING, non-LOOPBACK)
and use gethostname() as painful fallback only.

Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=1090935
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-05-13 15:23:42 +02:00
Karel Zak c6b3513942 agetty: fix odd check for chardev/tty
References: https://bugzilla.redhat.com/show_bug.cgi?id=1069902
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-05-13 12:28:48 +02:00
Werner Fink b9c7390948 agetty: beside virtual consoles support xvc and hvc device lines as well
For this approach do not use the ioctl TIOCMGET anymore as this
is for real serial lines only. But switch over to use the ioctl
KDGKBMODE as this is unique to the virtual console lines only.

Signed-off-by: Werner Fink <werner@suse.de>
2014-05-13 10:40:11 +02:00
Werner Fink f2bcda5183 agetty: better support of the special system consoles on S390
That is that there are several consoles, the /dev/ttyS0 which
is type of ibm3215 and a dumb terminal, then there is the device
/dev/3270/tty1 which can handle ANSI color escape sequences and is
a ibm327x terminal, and the /dev/ttyS1 which is a vt220 terminal.

The macro is_speed() in agetty.c allows to distinguish between the
terminal line (/dev)3270/tty1 and the speed options on the command
line used in

/run/systemd/generator/getty.target.wants/serial-getty@3270-tty1.service

which is a symbolic link to /usr/lib/systemd/system/serial-getty@.service

Signed-off-by: Werner Fink <werner@suse.de>
2014-05-13 10:39:40 +02:00
Werner Fink bb280f79f1 agetty: avoid that agetty nor sulogin are fooled by a running plymouth
The nowadays used plymouth locks the devices used for the system
console which causes that agetty as well as sulogin can not modify
the termios settings of e.g. the serial devices of the systenm console.

Signed-off-by: Werner Fink <werner@suse.de>
2014-05-13 10:36:49 +02:00
Sami Kerola 3393c136a2 setterm: convert remaining magic values to symbolic references
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-05-12 13:59:59 +02:00
Sami Kerola 010f219d5f setterm: convert various constant number definitions to enums
The enum strings are visible when using debugger.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2014-05-12 13:54:38 +02:00
Karel Zak 6ed37604fe setterm: cleanup printf() usage
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-05-12 13:53:10 +02:00
Sami Kerola 45656c9fe1 setterm: remove unused code
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2014-05-12 13:38:53 +02:00
Sami Kerola 42e296b59d wall: replace magic number by named value
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-05-12 13:38:25 +02:00
Sami Kerola afbdd44fe3 term-utils: avoid error message string length couting errors
Remove various magic numbers with either a string lenght count, or a
symbolic variable that is recognized by gdb.

[kzak@redhat.com: - use snprintf() everywhere,
                  - check snprintf() return code rather than mess up
                    the code with strlens]

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-05-12 13:37:35 +02:00
Sami Kerola 89dda67868 build-sys: remove unnecessary void casts
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2014-05-12 13:07:12 +02:00
Karel Zak 78a3b0af30 include/carefulputc: cleanup and add fputs_{quoted,nonblank}()
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-04-03 12:29:16 +02:00
Wolfgang Richter a21f7ec91d scriptreplay: no need to skip first time value or last bytes fixes #58 2014-03-19 22:47:11 -04:00
Wolfgang Richter b0d6b85720 script: time from end of read() call partially fixes #58 2014-03-19 22:45:48 -04:00
Karel Zak 4368e3e687 script: clean up files usage
* don't initialize timingfd (to stderr) when -t not specified

 * care about timingfd dooutput() rather in main()

 * make timingdf gloval like fscript FILE

 * close all in done()

 * close irrelevant things in subshell and input processes

Reported-by: Sami Kerola <kerolasa@iki.fi>
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-02-21 13:39:14 +01:00
Jesper Dahl Nyerup 5d0ce5e84f script: Also flush writes to timing file.
If both -f and -t are given, flush the timing fd on each write, similar
to the behavior on the script fd. This allows playback of still-running
sessions, and reduces the risk of ending up with empty timing files when
script(1) exits abnormally.

Signed-off-by: Jesper Dahl Nyerup <nyerup@one.com>
2014-02-21 13:16:20 +01:00
Jesper Dahl Nyerup 7f1d483638 scriptreplay: Add --maxdelay option.
This option caps the delay between updates, to avoid long pauses in
transcript playback.

Signed-off-by: Jesper Dahl Nyerup <nyerup@one.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-02-10 19:24:28 +01:00
Karel Zak a5bd793996 include/c.h: prefer nanosleep() over usleep()
Let's use nanosleep() although if usleep() exists. The nanosleep
function does no interact with signals and other timers.

The patch introduces xusleep() as replacement to libc (or our fallback)
usleep(). Yes, we don't want to use struct timespec + nanosleep()
everywhere in code as nano-time resolution is useless for us.

The patch also enlarges delays in some busy wait loops. It seems
enough to try read/write 4x per second.

Signed-off-by: Karel Zak <kzak@redhat.com>
2014-01-24 13:04:14 +01:00
Karel Zak c6fca22e3a script: use all-io.h to make the code more robust
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-01-16 14:44:37 +01:00
Karel Zak 968e632cdb script: fix inconsistent -q, use poll() rather then O_NONBLOCK
- don't suppress "Script done" message in typescript file by -q
   (note that -q has no effect to "Script started" message)

 - simplify the code by poll()

Signed-off-by: Karel Zak <kzak@redhat.com>
2014-01-16 13:18:24 +01:00
Karel Zak 38374be4c8 script: don't wait for empty descriptors if child is dead
The current code waits for empty file master and slave descriptors,
but it makes sense only if there is child process that cares (read)
about data in the descriptors.

Signed-off-by: Karel Zak <kzak@redhat.com>
2014-01-16 12:22:13 +01:00
Karel Zak 3822032da3 script: script input redirection / eof handling
echo "ps uf" | script

does not work because script assume that stdin is terminal and
it does not forward EOF to the pty.

This patch:

  * make non-tty use-case more robust (don't call tty ioclts to
    non-tty file descriptors.

  * send EOF (CTL('D') control char) to the master channel when
    detected eof by read() on stdin

  * wait for empty master and slave file descriptors to be sure that
    we don't miss date for typescript. This is also necessary to be
    sure that slave channel (shell) is completely initialized otherwise
    EOF is ignored.

Reported-by: Phillip Susi <psusi@ubuntu.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
2013-12-03 13:32:55 +01:00
Karel Zak f50473e7ca script: check that stdin is a terminal
Signed-off-by: Karel Zak <kzak@redhat.com>
2013-12-02 13:42:01 +01:00
Karel Zak 43298be931 setterm: fix -dump man page info
It seems that setterm -dump does not dump terminal attributes, but
the man page says -dump includes the attributes. Let's fix the man
page.

Reported-by: Phillip Susi <psusi@ubuntu.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
2013-12-02 12:21:47 +01:00
Werner Fink fba8a53542 agetty: support the special terminal on first serial line on a S/390
which is due legacy reasons a block terminal of type 3270 or higher.
Whereas the second serial line on a S/390(x) is a real character
terminal which is compatible with VT220.

Signed-off-by: Werner Fink <werner@suse.de>
2013-12-02 11:07:32 +01:00
Sami Kerola f614b73c0e losetup, agetty: remove unnecessary if's before free()
Reference: http://git.savannah.gnu.org/cgit/gnulib.git/tree/build-aux/useless-if-before-free
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2013-12-02 10:59:20 +01:00
Karel Zak 185b1bc7f4 script: restore errno in signal handler
References: https://plus.google.com/+LennartPoetteringTheOneAndOnly/posts/gHSscCJkakd
Signed-off-by: Karel Zak <kzak@redhat.com>
2013-11-14 14:42:23 +01:00
Karel Zak f630400c4e script: don't call TIOCGWINSZ in signal handler
Signed-off-by: Karel Zak <kzak@redhat.com>
2013-11-14 14:34:15 +01:00
Benno Schulenberg b4362b6f84 docs: standardize the phrases for --help and --version in all man pages
Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
2013-10-15 10:28:30 +02:00
Benno Schulenberg 4e36bc592d docs: format, grammarize, and standardize the wall man page
Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
2013-10-15 10:28:30 +02:00
Sami Kerola 5d324c6b94 various: fix mixing declarations and code compiler warnings [smatch]
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2013-10-08 15:47:59 +02:00
Benno Schulenberg 38ae77d743 textual: make two messages somewhat easier to understand
Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
2013-10-08 15:38:39 +02:00
Karel Zak ccf92e6db7 build-sys: use tinfo *or* ncurses for more(1), ul(1) and setterm(1)
* it seems that we don't have to link the utils with ncurses, tinfo is enough.
   This change saves one unnecessary dependence.

 * libtinfo is also distributed with pkg-config files, so we can use
   PKG_CHECK_MODULES() as a primary source for LIBS and CFLAGS.

 * add TINFO_CFLAGS (although it's probably always empty)

Signed-off-by: Karel Zak <kzak@redhat.com>
2013-10-04 13:28:37 +02:00
Benno Schulenberg 4b53739cf0 docs: tweak the grammar of an agetty man-page fragment
Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
2013-10-04 11:56:59 +02:00
Benno Schulenberg 3755d48b17 agetty: use standard angular brackets in usage message
Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
2013-10-04 11:54:49 +02:00
Michael Forney 23e0d15ba4 build-sys: Fix check for __GNU_LIBRARY__
If we are not on glibc, __GNU_LIBRARY__ will not exist causing the check
to always fail and try to use syscalls directly.

Signed-off-by: Karel Zak <kzak@redhat.com>
2013-10-04 11:51:45 +02:00
Michael Forney 00c505d9cf include: Add missing includes
sys/types.h: For u_char typedef
sys/params.h: For MAXNAMLEN
sys/ttydefaults.h: For various tty definitions (also add configure check)

Signed-off-by: Karel Zak <kzak@redhat.com>
2013-10-04 11:51:21 +02:00
Karel Zak c1d26ddbe7 Merge branch 'master' of https://github.com/yurchor/util-linux 2013-09-30 15:56:31 +02:00
Karel Zak a1e276ae15 textual: fix misspelled words in -rc1
Reported-by: Rafael Ferreira <rafael.f.f1@gmail.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
2013-09-30 13:58:53 +02:00
Mike Frysinger 2b8f22bd90 clean up term lib handling
The ncurses package has been providing pkg-config files for a while now.
So let's start using them to get the proper linker & compiler flags.  It
can make a difference when ncurses is configured in a way that requires
extra link time flags but util-linux doesn't provide them, or when the
headers live in a weird place and util-linux can't find them.

Since the NCURSES_LIBS is always defined for the Makefile, there's no need
to gate on the HAVE_NCURSES conditional.  When it's disabled, the var will
simply be empty.

With a minor tweak to how tinfo is handled, we can do the same thing -- we
just always use TINFO_LIBS in the Makefile's.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2013-09-30 13:41:07 +02:00
Mike Frysinger bfc4331b14 setterm: fix term.h/ncurses.h include ordering
The ncurses term.h header has logic in it to detect if nucrses.h has
already been included and void defining things when it has.  But since
setterm includes term.h and the ncurses.h, it doesn't work and we can
get fun build-time warnings like:

  CC       term-utils/setterm-setterm.o
In file included from term-utils/setterm.c:109:0:
/usr/include/ncursesw/ncurses.h:827:12: warning: redundant redeclaration of 'tigetflag' [-Wredundant-decls]
 extern NCURSES_EXPORT(int) tigetflag (NCURSES_CONST char *);  /* implemented */
            ^
In file included from term-utils/setterm.c:106:0:
/usr/include/ncursesw/term.h:775:12: note: previous declaration of 'tigetflag' was here
 extern NCURSES_EXPORT(int) tigetflag (NCURSES_CONST char *);
            ^

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2013-09-30 13:41:03 +02:00
Yuri Chornoivan 0d0d12adf8 Fix various typos 2013-09-28 13:33:59 +03:00
Karel Zak b34f097e75 agetty: add \S to output /etc/os-release data
This patch allows to use a new \S or \S{VARNAME} sequence in the
/etc/issue file. The sequence prints data from /etc/os-release.  The
reason is to keep /etc/issue file distribution and release
independent.

The \S{ANSI_COLOR} is converted to the real terminal escape seq.

For example:

   \S
   Kernel \r on an \m (\l)

or more complex example:

   Welcome to \S{ANSI_COLOR}\S{NAME}0m \S{VERSION}
   Report bugs at \S{BUG_REPORT_URL}.

See http://www.freedesktop.org/software/systemd/man/os-release.html
fr more details about /etc/issue.

Based on patch from Bill Nottingham <notting@redhat.com>.

Signed-off-by: Karel Zak <kzak@redhat.com>
2013-09-12 12:44:09 +02:00
James Buren f28dde8ecf agetty: add baud rates available from glibc that are not already supported
This adds userspace support for baud rates reater than 230400, provided the tty
also supports it.
2013-09-12 11:03:59 +02:00
James Buren 09625c2ec7 agetty: only use EXTA/EXTB macros if B19200/B38400 macros are not present 2013-09-12 11:02:48 +02:00
Karel Zak 46568b002d agetty: cleanup debug ifdefs
Signed-off-by: Karel Zak <kzak@redhat.com>
2013-09-09 09:15:40 +02:00
Sami Kerola cfa7fe890b last, utmpdump, agetty, wall, write: avoid compatibility hacks
In include/bits/utmp.h the ut_user and ut_time macros are marked with
comment they are backwards compatibility hacks.  It is probably best to
avoid use of these macros where ever possible.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2013-08-29 18:14:10 +01:00
Sami Kerola 0233a8ea18 write: change determination can user write to a terminal
Earlier test failed when user had write permission, but was not in
special group that owns terminal devices, usually tty.

This made write(1) to fail for root, if the root did not happen to be in
tty group.  In this commit root is granted ot write to anyone, even if
they have mesg(1) turned off.  For an user who is trying to write to own
other session the group write bit is significant only for whether mesg(1)
are enabled.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2013-08-29 18:14:07 +01:00
Sami Kerola f7afb6b6b8 docs: add note to wall(1) about sessions which will not get message
Sessions that has in utmp data ut_line begining with ':' are skipped.
This is done to avoid write errors to devices such as '/dev/:0'.  For
example wdm is reported to to generate such utmp line.

Perhaps in future this code should be revalidated.  If an utmp data
contains broken device lines it might be best inform user with a error
message, rather than skipping silently suspicious device entries.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2013-08-29 18:14:07 +01:00
Sami Kerola 5721ea5753 wall: line wrap at column 79 also when line has tab chars
Earlier tabs caused random ragged right indentation, because the tab
length was assumed to be 1 char which is not the case most of the time.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2013-08-29 18:14:07 +01:00
Sami Kerola 1e6f6cdb84 mesg: sync usage() with howto-usage-function.txt
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2013-08-29 18:14:07 +01:00
Sami Kerola bbeae1cef1 wall: sync usage() with howto-usage-function.txt
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2013-08-29 18:14:07 +01:00
Sami Kerola cff0667f42 wall: send message also to sessions opened by user 'sleeper'
Ignoring an user by name, and not telling about it in manual page, is
unexpected.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2013-08-29 18:14:06 +01:00
Sami Kerola ada6c48f06 include: carefulput: print determined char when unprintable char is found
This is done to allow reuse of the functin in last(1).

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2013-08-23 10:58:48 +02:00
Karel Zak d81c30553f wall: make banner sysvinit compatible
Signed-off-by: Karel Zak <kzak@redhat.com>
2013-08-13 12:23:21 +02:00
Karel Zak cdd3cc7fa4 wall: allow to specify <message> on command line
wall(1) from sysvinit supports

   # wall I love this company!

semantic, This patch add this functionally to the util-linux wall.

Signed-off-by: Karel Zak <kzak@redhat.com>
2013-08-13 11:45:54 +02:00
Karel Zak 6f96420666 agetty: -L accepts optional argument
Signed-off-by: Karel Zak <kzak@redhat.com>
2013-08-06 15:39:11 +02:00
Sami Kerola 3797cf255b agetty: fix memory leak [clang-analyzer]
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2013-07-09 14:25:15 +02:00
kernc a056cfe290 Fixes "getty: unrecognized option '--loginpause'"
Usage incorrectly stated --loginpause is a valid option, where instead --login-pause is.

Also --no-hostname --> --nohostname.
2013-07-04 17:02:57 +02:00
Benno Schulenberg f61a7d1fa6 agetty: improve wording, grammar and some formatting in man page
Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
2013-06-18 10:52:07 +02:00
Benno Schulenberg 6afe9db471 agetty: fix a kill/erase error in man page and improve clarity
Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
2013-06-18 10:51:53 +02:00
Karel Zak 3210631789 Merge branch 'master' of https://github.com/eric-s-raymond/util-linux
* 'master' of https://github.com/eric-s-raymond/util-linux:
  Fix broken list syntax.
  Restore use of correct alternation syntax using { | }.
  Re-layout a FILES section in the traditional style.
  Remove another .ti for .RS/.RE, and remove a .TP that broke list parsing.
  Replace .IP o with .IP \(bu, using the [nt]roff bullet character.
  Replace .ti operations with equivalent .RS/.RE pairs.
2013-06-13 13:32:02 +02:00
Karel Zak 714cff30fd agetty: use O_NONBLOCK only for serial lines with CLOCAL
* regression introduced by ef264c830e

 * also increase sleep when O_NONBLOCK used (grr.. this is so stupid
   thing, do we really need O_NONBLOCK for the stupid serial lines?)

References: https://bugzilla.redhat.com/show_bug.cgi?id=972457
Signed-off-by: Karel Zak <kzak@redhat.com>
2013-06-13 11:30:02 +02:00
Eric S. Raymond 48cb48dcf2 Re-layout a FILES section in the traditional style. 2013-06-10 15:58:25 -04:00
Eric S. Raymond e438668bd9 Remove another .ti for .RS/.RE, and remove a .TP that broke list parsing. 2013-06-10 15:55:45 -04:00
Eric S. Raymond 12e45a0512 Replace .IP o with .IP \(bu, using the [nt]roff bullet character.
This will improve the quality of generated HTML. There is a cost,
which is that most terminal emulators will just display the bullet
as a (less visible) dot.  An alternative to this change would be
to use a * character for the bullet.
2013-06-10 15:48:41 -04:00
Eric S. Raymond f9da2801b6 Replace .ti operations with equivalent .RS/.RE pairs.
This change makes automatic lifting to XML-DocBook possible, and
should enable generation of better-quality HTML from these pages.
2013-06-10 15:42:06 -04:00
Benno Schulenberg bb3e58088a textual: standardize the spelling of "superuser"
Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
2013-06-07 11:31:37 +02:00
Karel Zak 4cfda3dce0 agetty: update man page and usage()
- baud_rate is optional
 - agetty has been rewritten 2 years ago, so don't blame original
   authors in the man page

Signed-off-by: Karel Zak <kzak@redhat.com>
2013-06-03 10:04:43 +02:00
Karel Zak ef264c830e agetty: allow full control on CLOCAL flag
Now the -L option allows to explicitly enable CLOCAL flag.

Unfortunately sometimes it's necessary to clear the flag. This patch
add optional argument =<mode> to specify 'auto', 'always' and 'never'
to control CLOCAL flag.

Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=816342
Signed-off-by: Karel Zak <kzak@redhat.com>
2013-05-23 09:47:58 +02:00
Karel Zak d78d040933 build-sys: add --disable-setterm
Signed-off-by: Karel Zak <kzak@redhat.com>
2013-04-26 13:47:54 +02:00
Sami Kerola 7f587afc67 wall: check writing to a file descriptor was successful
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2013-04-26 13:26:07 +02:00
Sami Kerola 1aba8336c0 agetty: check writing to a file was successful
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2013-04-26 13:26:06 +02:00
Sami Kerola 3acc206d39 various: fix variable and function declarations [smatch scan]
disk-utils/fsck.minix.c:511:9: warning: mixing declarations and code
fdisks/sfdisk.c:982:5: warning: mixing declarations and code
fdisks/sfdisk.c:1254:5: warning: mixing declarations and code
fdisks/sfdisk.c:1564:5: warning: mixing declarations and code
lib/mbsalign.c:279:7: warning: mixing declarations and code
libblkid/src/devname.c:378:17: warning: mixing declarations and code
libfdisk/src/alignment.c:219:9: warning: mixing declarations and code
term-utils/wall.c:111:9: warning: mixing declarations and code
text-utils/col.c:418:19: warning: non-ANSI function declaration of function 'flush_blanks'
text-utils/col.c:553:12: warning: non-ANSI function declaration of function 'alloc_line'
text-utils/rev.c:105:9: warning: mixing declarations and code
text-utils/tailf.c:245:9: warning: mixing declarations and code

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2013-04-09 12:17:20 +02:00
Sami Kerola 2dc87166a7 setterm: fix various color option argument lists
The lists did not have correct colors in usage().  Because the usage()
had to be fixed, it is best to make the output easy for translators to
work with.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2013-04-05 13:56:12 +02:00
Sami Kerola 86ad1432e8 agetty: the command does not have -h and -V options
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2013-04-05 13:55:54 +02:00
Karel Zak 8d8ea18ea7 docs: remove repeated words
Signed-off-by: Karel Zak <kzak@redhat.com>
2013-04-05 13:35:30 +02:00
Karel Zak 4b856ee4b9 agetty: add --chroot to usage() and man page
Signed-off-by: Karel Zak <kzak@redhat.com>
2013-04-05 12:55:20 +02:00
Karel Zak 1505a0b266 agetty: add -E, --remote to usage()
Signed-off-by: Karel Zak <kzak@redhat.com>
2013-04-05 12:47:42 +02:00
Karel Zak a77e7ac77c setterm: fix memory leak [coverity scan]
Signed-off-by: Karel Zak <kzak@redhat.com>
2013-03-27 16:22:56 +01:00
Karel Zak 8362545b4a lib/xalloc: fix mamory leak in xgethostname() [coverity scan]
Signed-off-by: Karel Zak <kzak@redhat.com>
2013-03-27 16:08:47 +01:00
Karel Zak 915c1d99f6 agetty: make \{4,6} issue file code more robust [coverity scan]
... and more readable for static analyzers

Signed-off-by: Karel Zak <kzak@redhat.com>
2013-03-27 14:33:17 +01:00
Karel Zak 3d13d5823f script: use __noreturn__ for really last function [clang -Winvalid-noreturn]
Use 'noreturn' for done() only.

Signed-off-by: Karel Zak <kzak@redhat.com>
2013-03-20 15:20:18 +01:00
Karel Zak 5ad0923904 remove duplicate includes
Signed-off-by: Karel Zak <kzak@redhat.com>
2013-03-20 14:40:19 +01:00
Benno Schulenberg 9c91fc03ae docs: make the section AVAILABILITY always come last in man pages
Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
2013-03-20 14:09:24 +01:00
Sami Kerola 2281e1eda3 wall: use xgethostname()
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2013-03-04 12:28:32 +01:00
William Pitcock 51924a4ef0 add missing rpmatch.h everywhere it needs to be
Signed-off-by: William Pitcock <nenolod@dereferenced.org>
Signed-off-by: Karel Zak <kzak@redhat.com>
2013-02-20 13:04:02 +01:00
Sami Kerola f8bd089b1d a pointer should not be compared to zero [coccinelle]
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2013-02-06 11:51:15 +01:00
Benno Schulenberg b50945d4ac textual: spell and encode the name of Arkadiusz Miśkiewicz correctly
Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
2013-02-06 11:15:02 +01:00
Benno Schulenberg 9e53140075 agetty: properly pluralize the reporting of the number of users
Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
2013-01-30 15:23:42 +01:00
Sami Kerola 7d36855604 agetty: make usage() translator friendly
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2013-01-25 16:40:05 +01:00
Benno Schulenberg 8c219bf463 textual: gettextize several overlooked messages
Also improve the clarity of some of them.

Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
2013-01-25 11:47:29 +01:00
Benno Schulenberg c602fe5a8e textual: tag two bug messages as "internal error"
Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
2013-01-25 11:47:28 +01:00
Sami Kerola b4ff2f54d7 script: search shell from path, when necessary
Addresses: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=518532
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2013-01-09 13:37:01 +01:00
Werner Fink f5664477cb include/ttyutils: add default chardata
this one moves the init_chardata to include/ttyutils.h as well as to
lib/include/ttyutils.c.  Also the macros CTL/CTRL are fixed in
agetty.c and sulogin.c to use the XOR variant CTL.

[kzak@redhat.com: use macro rather than global variable for default
                  chardata]

Signed-off-by: Werner Fink <werner@suse.de>
Signed-off-by: Karel Zak <kzak@redhat.com>
2013-01-08 15:42:12 +01:00
Karel Zak 91984e938e agetty: replace perms 660 to 620
... the default is root:tty 620

Signed-off-by: Karel Zak <kzak@redhat.com>
2013-01-02 08:27:32 +01:00
Karel Zak a73f59fa03 sulogin: remove consoles.c from libcommon
- move struct chardata to include/ttyutils.h
- move console.{h,c} to login-utils/sulogin-* (it's sulogin specific)
- fix sulogin and agetty includes

Signed-off-by: Karel Zak <kzak@redhat.com>
2012-12-23 22:14:21 +01:00
Karel Zak 747c1d9d57 setterm: fix compiler warning
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-12-20 19:55:20 +01:00
Karel Zak 5676f36563 agetty: remove @ and # as default kill and erase chars
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-11-22 11:23:53 +01:00
Karel Zak cb872ac99d agetty: add --{erase,kill}-chars options
We need way to disable the default kill and erase agetty chars to make
the getty usable for Active Directory users with '@' in username.

It seems that the most extendible solution is to add options that
allow to complete control additional erase/kill chars. If you specify
empty strings then the chars are disabled at all.

Note that this patch is backwardly compatible.

Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=870854
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-11-22 11:17:51 +01:00
Karel Zak 933956cb49 agetty: make --autologin useful with --skip-login (prompt)
The --autologin prints

	hostname login: username (automatic login)

message. This commit allows to suppress the message at all if
--skip-login (aka skip prompt) is specified.

It means that

	agetty --skip-login --noissue --autologin foouser

does completely silent autologin.

Addresses: https://github.com/karelzak/util-linux/issues/21
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-11-19 10:54:58 +01:00
Sami Kerola 958e39d238 script: do not try to close stderr twice
The commit cdd2a8c360 broke script(1)
return value.

$ script -e -c "echo"; echo $?
1

The reason, as Daniel it reported, was that the script will close stderr
twice, once as timing file and atexit() in function close_stdout().  This
commit fixes the problem.

Reported-by: Daniel Narvaez <dwnarvaez@gmail.com>
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2012-11-08 14:51:20 +01:00
Michal Schmidt c13d60b291 agetty: fix autodetection for TERM
open_tty() autodetects whether to set TERM to "linux" or "vt102", but it
can apply the result only if op->term is still NULL.
2012-11-02 12:38:25 +01:00
Sami Kerola 74b3df85f7 agetty: replace gethostbyname() with getaddrinfo()
The gethostbyname() is legacy function which may be withdrawn in a
future.

Reference: http://pubs.opengroup.org/onlinepubs/009695399/functions/gethostbyname.html
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2012-10-22 10:14:36 +02:00
Karel Zak a0fc344b78 write: stop using MAXHOSTNAMELEN
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-10-19 16:27:58 +02:00
Karel Zak 2448f33637 agetty: stop using MAXHOSTNAMELEN
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-10-19 16:27:46 +02:00
Petr Uzel 2754ffc5f5 setterm: make error message more informative
If `setterm -dump` fails because of lack of permission to read
/dev/vcsa, it should not report that it couldn't read /dev/vcsa0.
This could be misleading if there is only /dev/vcsa, but not /dev/vcsa0.

Before:
$ ./setterm -dump
setterm: Couldn't read /dev/vcsa0

After:
$ ./setterm -dump
setterm: Couldn't read neither /dev/vcsa0 nor /dev/vcsa

(Note: /dev/vcsa0 does not exist and the user does not have read
permission on /dev/vcsa in this case).

Addresses: https://bugzilla.novell.com/show_bug.cgi?id=780615
Reported-by: Christopher Yeleighton <giecrilj@stegny.2a.pl>
Signed-off-by: Petr Uzel <petr.uzel@suse.cz>
2012-09-21 12:14:14 +02:00
Karel Zak 2b945eda3d agetty: add \4 and \6 issue file sequences to print IP addresses
Based on Andrea Bonomi <a.bonomi@endian.com> ideas.

Signed-off-by: Karel Zak <kzak@redhat.com>
2012-09-13 12:59:46 +02:00
Sami Kerola 5da054e070 script: add noreturn function attributes
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2012-07-26 13:51:33 +02:00
Sami Kerola 4d9e37bfed setterm: fix shadow declaration
term-utils/setterm.c:221:55: warning: declaration of 'opt_term' shadows a global declaration [-Wshadow]
term-utils/setterm.c:181:5: warning: shadowed declaration is here [-Wshadow]

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-07-26 13:44:58 +02:00
Mantas Mikulėnas 9002d6504a agetty: remove unnecessary sleep(10)
I'm quite sure this is not supposed to be here (apparently added as part
of commit 783b08fc1c).

Signed-off-by: Mantas Mikulėnas <grawity@gmail.com>
2012-07-25 16:13:11 +02:00
Karel Zak 5769a938b4 scriptreplay: fix compiler warning [-Wmissing-prototypes]
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-07-16 18:48:27 +02:00
Sami Kerola 289dcc9023 translation: unify file open error messages
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2012-07-16 18:18:22 +02:00
Sami Kerola add1b8afd0 translation: unify stat error messages
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2012-07-16 18:18:22 +02:00
Karel Zak 783b08fc1c agetty: close tty before vhangup()
Let's close all tty file descriptors if called with --hangup option.

References: https://lkml.org/lkml/2012/6/5/145
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-07-12 16:34:56 +02:00
Karel Zak 4459448fbd agetty: make tcsetpgrp() optional
The session setup TIOCSCTTY is optional, so tcsetpgrp() that depends
on controlling terminal should be optional too.

Reported-by: Hilko Bengen <bengen@debian.org>
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-07-11 18:15:21 +02:00
Sami Kerola 01c5b78794 agetty: use configured run state directory
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2012-07-10 13:00:20 +02:00
Karel Zak dcdb349be7 build-sys: always use default $(LDADD)
The global variable $(LDADD) is always used if program_LDADD is
not specified. Let's use $LDADD everywhere to avoid exceptions for
people who need to specify global $LDADD.

Signed-off-by: Karel Zak <kzak@redhat.com>
2012-07-09 16:23:51 +02:00
Karel Zak f38e5ff355 build-sys: cleanup .gitignore files
- move all binaries to top-level .gitignore
 - remove unnecessary */.gitignore files

Signed-off-by: Karel Zak <kzak@redhat.com>
2012-06-26 20:50:54 +02:00
Karel Zak d77ab74af7 build-sys: convert lib/ to libcommon.la
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-06-26 20:50:53 +02:00
Karel Zak 22d2322eb1 build-sys: convert term-utils/ to module
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-06-26 17:53:09 +02:00
Karel Zak 46e28f0431 script: remove unused code
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-06-21 12:14:34 +02:00
Karel Zak efcf26f44f agetty: more robust debug() macro, check ioctl result [coverity scan]
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-06-21 12:13:08 +02:00
Sami Kerola 66fc066537 scriptreplay: fix compiler format warning
scriptreplay.c:210:3: warning: format '%zd' expects argument of type 'signed size_t *', but argument 4 has type 'size_t *' [-Wformat]

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2012-06-17 18:00:00 +02:00
Sami Kerola 0e9b73d3fb build: fix redundant redeclaration warnings
env.c:24:15: warning: redundant redeclaration of 'environ' [-Wredundant-decls]
su.c:81:15: warning: redundant redeclaration of 'environ' [-Wredundant-decls]

fstab.c:581:14: warning: redundant redeclaration of 'strsignal' [-Wredundant-decls]

kill.h:1:13: note: previous declaration of 'get_pids' was here
kill.c:152:13: warning: redundant redeclaration of 'get_pids' [-Wredundant-decls]

kill.c:142:5: warning: redundant redeclaration of 'main' [-Wredundant-decls]
getopt.c:89:5: warning: redundant redeclaration of 'main' [-Wredundant-decls]

agetty.c:536:15: warning: redundant redeclaration of 'optarg' [-Wredundant-decls]
agetty.c:537:13: warning: redundant redeclaration of 'optind' [-Wredundant-decls]
script.c:161:13: warning: redundant redeclaration of 'optind' [-Wredundant-decls]
wall.c:96:13: warning: redundant redeclaration of 'optind' [-Wredundant-decls]

libmount.h:362:26: note: previous declaration of 'mnt_update_get_fs' was here
libmount.h:454:26: note: previous declaration of 'mnt_context_get_fs' was here
mountP.h:383:26: warning: redundant redeclaration of 'mnt_context_get_fs' [-Wredundant-decls]
mountP.h:398:26: warning: redundant redeclaration of 'mnt_update_get_fs' [-Wredundant-decls]

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2012-06-11 19:51:35 +02:00
Karel Zak abb53be5cb Merge branch '2012wk22' of git://github.com/kerolasa/lelux-utiliteetit
* '2012wk22' of git://github.com/kerolasa/lelux-utiliteetit:
  docs: clean up getopt.1 manual
  docs: clean up dmesg.1 manual
  docs: clean up chcpu.8 manual
  fileutils: xmkstemp() interface change
  docs: fix all man page groff warnings
  tools: add checkmans.sh
  docs: clean up wdctl.8 manual
  docs: clean up login.1 manual
  login: allow TTYGROUP name begin by number
  build-sys: add su executable to .gitignore
  logindefs: change getlogindefs_num() to return unsigned long

Conflicts:
	login-utils/su.c
	sys-utils/dmesg.1
2012-06-05 16:57:01 +02:00
Bernhard Voelker 871ffd0960 Fix typos in comments and wall's man page
Culprits identified again by (newer) misspellings:

  $ git ls-files | misspellings -f - | grep -v '^po/'

* wall: Fix typo in man page.
* Fix typos in source code comments.

Signed-off-by: Bernhard Voelker <mail@bernhard-voelker.de>
2012-06-05 14:37:26 +02:00
Dave Reisner 3c4fed097d fileutils: xmkstemp() interface change
We can not let the user control where TMPDIR is for this tempfile.
This will be where we write the updated passwd file, and must be
capable of being moved atomically with rename(2).  Therefore, it
cannot be on a different device, or setpwnam() and vipw/vigr programs
will invariably fail with EXDEV.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2012-06-02 20:29:12 +02:00
Sami Kerola 79f8481889 docs: fix all man page groff warnings
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2012-06-02 20:29:12 +02:00
Thomas Schwinge 4658cfd492 write: Don't explicitly include <asm/param.h>.
It doesn't exist on some systems, but will come in via <sys/param.h> on the
others.

Signed-off-by: Thomas Schwinge <thomas@codesourcery.com>
2012-05-29 10:11:41 +02:00
Thomas Schwinge e78a7ecd4f write: Use PATH_MAX instead of MAXPATHLEN, as elsewhere.
Signed-off-by: Thomas Schwinge <thomas@codesourcery.com>
2012-05-29 10:11:37 +02:00
Karel Zak 3a9c3f3fb7 include/c: move fallback for MAXHOSTNAMELEN to c.h
Reported-by: Thomas Schwinge <thomas@codesourcery.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-05-29 10:08:25 +02:00
Karel Zak b43d3a3a2c term-utils: cleanup strtoxx_or_err()
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-05-15 17:46:05 +02:00
Petr Uzel e12c9866b5 include: rename writeall.h to all-io.h
Signed-off-by: Petr Uzel <petr.uzel@suse.cz>
2012-05-15 11:32:27 +02:00
Sami Kerola cdd2a8c360 term-utils: verify writing to streams was successful
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2012-04-04 19:46:25 +02:00
Sami Kerola d2ec3e33f1 script: error in usage() output
Error originates to commit 3ff526391f
which is bit more than year, and part or releases v2.20 & v2.21.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2012-04-02 13:14:20 +02:00
Sami Kerola b0660441de reset: make scripts bourne sh compliant [checkbashisms]
In addition strict compliance the commit will take variable name
quoting, and $(command) substitution in use.

$ checkbashisms reset reset.033c
possible bashism in reset line 11 ('$[' should be '$(('):
bot=$[ ${LINES:-`tput lines`} - 1 ]
possible bashism in reset.033c line 11 (echo -e):
echo -e \\033c

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2012-03-30 16:48:12 +02:00
Sami Kerola 6a801e1a38 setterm: correct manual page reference
An error from commit faa0548de4

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2012-03-30 16:48:12 +02:00
Sami Kerola 7961acce46 fileutils: differentiate xmkstemp and xfmkstemp
Let developer to choose, case by case, what sort of return value is
best in her code.  The xmkstemp() is for users who want file
descriptor as return value of the function, xfmkstemp() will return
FILE pointer.

Proposed-By: Karel Zak <kzak@redhat.com>
CC: Davidlohr Bueso <dave@gnu.org>
Reference: http://marc.info/?l=util-linux-ng&m=133129570124003&w=2
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2012-03-18 14:29:38 +01:00
Sami Kerola a000bbb613 wall: use xmkstemp for temporary file
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2012-03-18 14:28:04 +01:00
Sami Kerola 041b8ab252 mesg: use rpmatch to yes/no question
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2012-03-18 14:28:04 +01:00
Karel Zak 879a7ab470 agetty: move vc initialization to ttyutils.h
... to make the code usable for sulogin.

Signed-off-by: Karel Zak <kzak@redhat.com>
2012-03-12 14:39:32 +01:00
Karel Zak a17f32645d script: play well with csh when invoked from within /etc/csh.login
Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=797888
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-03-08 16:02:28 +01:00
Karel Zak d9201203cf agetty: check localtime() result
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-02-06 16:02:28 +01:00
Francesco Cosoleto 1a204cd216 agetty: add static and const qualifiers
Remove also a static qualifier in main() function.

Signed-off-by: Francesco Cosoleto <cosoleto@gmail.com>
2011-12-16 12:49:13 +01:00
Jari Aalto 115bfafafe setterm: order man page items alphabetically
Signed-off-by: Jari Aalto <jari.aalto@cante.net>
2011-12-16 11:25:10 +01:00
Karel Zak 1593b134eb agetty: don't use log_err() for non-fatal errors
The TIOCSCTTY ioctl requires that caller is session leader -- so it
depends on initd (or we have to add setsid() to aggety). It seems that the
traditional way is to setup tty in agetty and session in login(1).

It means that all session related things (TIOCSCTTY, vhangup, ...) in the
command agetty should be optional. (Note that vhangup() is called when
--hangup is explicitly specified on command line, so log_err() makes
sense there.)

Reported-by: Andrew Walrond <andrew@walrond.org>
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-12-08 12:54:49 +01:00
Sami Kerola e11a5e6375 build-sys: check HAVE_ definitions with #ifdef [smatch scan]
Fix to `warning: undefined preprocessor identifier' messages.

[kzak@redhat.com: replace "#ifdef XXX #ifdef YYY" with
                  "#if defined(XXX) && defined(YYY)"]

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-12-02 18:27:12 +01:00
Sami Kerola fbc333fec0 build-sys: check HAVE_ definitions with #ifdef [smatch scan]
Fix to `warning: undefined preprocessor identifier' messages.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2011-12-02 18:21:46 +01:00
Dennis Jensen 9c62a2326e agetty: map NL to CR-NL on output in initial termiossettings
From: Jacoby Hickerson <hickersonjl@gmail.com>
Signed-off-by: Dennis Jensen <dennis.h.jensen@siemens.com>
2011-11-28 10:34:39 +01:00
Karel Zak 01095ae33c agetty: pass hostname to login(1)
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-10-26 23:17:15 +02:00
Sami Kerola 7dab96af41 docs: align wall.1 with howto-man-page.txt
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2011-10-03 20:51:39 +02:00
Sami Kerola 1aa1fbaee1 docs: align scriptreplay.1 with howto-man-page.txt
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2011-10-03 20:49:04 +02:00
Sami Kerola c5e7b9fa70 docs: align script.1 with howto-man-page.txt
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2011-10-03 20:32:45 +02:00
Petr Uzel 960cf5737e misc: use %m in format string instead of %s and strerror(errno)
Signed-off-by: Petr Uzel <petr.uzel@suse.cz>
2011-09-27 15:46:07 +02:00
Karel Zak b926112726 agetty: test ECHO on c_lflag
Reported-by: xinglp <xinglp@gmail.com>
Addresses: http://bugzilla.redhat.com/show_bug.cgi?id=739522
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-09-26 12:34:10 +02:00
Karel Zak d36ee054ca script: non-ANSI definition [smatch scan]
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-09-12 16:18:16 +02:00
Karel Zak 36601b2343 agetty: add --nohints
Reported-by: "Gabor Z. Papp" <gzp@papp.hu>
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-09-12 14:24:27 +02:00
Karel Zak 4d84fcb4c7 script: libintl.h included in nls.h
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-09-07 16:29:56 +02:00
Karel Zak 89aed1c950 agetty: double equals sign typo in opentty()
Reported-by: Francesco Cosoleto <cosoleto@gmail.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-09-07 07:37:03 +02:00
Natanael Copa 3c911718df script: fix building with --disable-nls
We should only include the libintl.h when NLS is requested.

This fixes issue when building util-linux with uClibc.

Signed-off-by: Natanael Copa <ncopa@alpinelinux.org>
2011-09-07 07:30:35 +02:00
Karel Zak b89fdd9c05 write: fix path for freopen()
Reported-by: xinglp <xinglp@gmail.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-09-06 03:18:46 +02:00
Karel Zak fa25f2289c Merge branch 'docs-dir' of https://github.com/kerolasa/lelux-utiliteetit
* 'docs-dir' of https://github.com/kerolasa/lelux-utiliteetit:
  docs: remove duplicated text
  docs: require kernel support before accepting use of it
  docs: note about independent super block structs
  docs: add libmount & libblkid debug instructions
  Documentation: add debugging doc
  arch: start using arch as a usage() example
  docs: new file Documentation/release-schedule.txt
  docs: move setuid information from reame to hwclock.8
  docs: clean up old readme files
  docs: copy contributors from legacy files to AUTHORS
  docs: new file Documentation/howto-man-page.txt
  docs: new file Documentation/source-code-management.txt
  docs: new file Documentation/howto-contribute.txt
  docs: new file Documentation/howto-compilation.txt
  docs: tell what the Documentation/ is about
  docs: add usage() howto for contributors
  docs: Documentation directory added
  docs: remove README.clear
2011-08-31 11:04:15 +02:00
Benno Schulenberg 62246430f3 docs: also uniformize headers and footers of troff-formatted man pages
Add two spaces as the required third argument of the date line to make
the specified date get used instead of today's date.  Incorporate the
section number into the page title, then use an empty section number,
so that specifying an explicit section/volume name will work.

Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
2011-08-29 11:24:39 +02:00
Benno Schulenberg 557db9cd05 scriptreplay: improve synopsis and formatting and wording in man page
Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
2011-08-22 10:39:28 +02:00
Benno Schulenberg 232dc924c4 docs: uniformize the header and footer lines in man pages
Use dates without the day, use the full month name, put "util-linux" in
the lower left corner, and "User Commands" or "System Administration"
at the top center.

Also improve here and there the one-line program description.

Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
2011-08-22 10:39:21 +02:00
Karel Zak 4c27cd9089 write: cleanup usage()
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-08-16 13:56:17 +02:00
Karel Zak a290362bb8 wall: cleanup usage()
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-08-16 13:53:36 +02:00
Karel Zak a1e04e8fe3 setterm: cleanup usage()
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-08-16 13:50:29 +02:00
Karel Zak 14cc9ddafe scriptreplay: cleanup usage()
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-08-16 13:43:34 +02:00
Karel Zak 87d6050bb0 script: cleanup usage()
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-08-16 13:41:06 +02:00
Karel Zak 2960a4a343 mesg: cleanup usage()
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-08-16 13:39:03 +02:00
Karel Zak c0d38ecdce agetty: clean up usage
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-08-16 11:58:50 +02:00
Benno Schulenberg 73bc3206bc script: normalize formatting of the man page
Also improve the description of the --timing option,
and discard a then superfluous paragraph.

Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
2011-08-15 15:49:50 +02:00
Benno Schulenberg 51b65a5bf7 script: indicate that the file argument to --timing is optional
Also improve some other descriptions in the usage message.

Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
2011-08-15 15:49:48 +02:00
Benno Schulenberg 1bf3e8a8eb write: remove inconsistent periods from two error messages
Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
2011-08-15 15:49:47 +02:00
Sami Kerola f98d4f766e docs: Documentation directory added
Move readme, licence, change log, relese notes and other
supplementary files to a Documentation directory. This commit
does not change contents of any other but few Makefile.am files.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2011-08-12 20:19:52 +02:00
Karel Zak 9aeb66dc6b agetty: improve login(1) argv[]
* fix regression: missing username should not be reported (EPERM) if
  -n/--skip-login is given and username is NULL.

* don't compose login options *string* if we can use argv *array* (the
  string is necessary only for --login-options).

* don't overwrite --login-options by --autologin

  The old code silently ignores login-options and "login -f <username>"
  is always used.

  The new code uses:
    a)	"login -f <username>"    by default
    b)	"login <login-options>"  for --login-options + --autologin

  where for b) the username from "--autologin <username>" is used to
  replace \u magic string in <login-options>.

* the \u could be used more than once in one login argv string, for
  example: agetty --login-options "-o user=\\u,name=\\u --foo"

* the space in --login-options is correctly ignored, for example
  agetty --login-options " hello world ".

Reviewed-by: Voelker, Bernhard <bernhard.voelker@siemens-enterprise.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-08-08 12:07:07 +02:00
Samuel Thibault b0198a1163 agetty: C.UTF-8 locale instead of en_US.UTF-8
Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
2011-08-08 11:50:21 +02:00
Samuel Thibault 7478fce029 agetty: only enable F_UTF8 if kernel has already set IUTF8.
Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
2011-08-08 11:49:58 +02:00
Petr Uzel e3c5ef39e3 wall: build with SUID_{C,LD}FLAGS
Signed-off-by: Petr Uzel <petr.uzel@suse.cz>
2011-08-08 11:49:43 +02:00
Werner Fink 8408647d89 agetty: Fix IUTF8 flag
Preserve IUTF8 as set up by the kernel, which knows which consoles are
in utf8 mode.

Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
Signed-off-by: Werner Fink <werner@suse.de>
2011-08-02 14:20:31 +02:00
Sami Kerola 739de07650 scriptreplay: fix buffer overflow
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-07-26 11:58:38 +02:00
Marc-Antoine Perennou bfa8d39b58 build-sys: fix spaces versus tabs conflict
For some reason, tabs were replaced by spaces in commit
73ae0d5be6

Signed-off-by: Marc-Antoine Perennou <Marc-Antoine@Perennou.com>
2011-07-11 15:12:06 +02:00
Marc-Antoine Perennou 73ae0d5be6 build-sys: don't try to chgrp write or wall if they are not built
Fix regression from commit 4aa9d65bfa

Signed-off-by: Marc-Antoine Perennou <Marc-Antoine@Perennou.com>
2011-07-11 11:53:44 +02:00
Sami Kerola 05644dabb4 script: remove magic constants and a type mismatch fix
The type mismatch; doinput: int -> ssize_t

[kzak@redhat.com: - int -> pid_t,
                  - remove "register" keyword]

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-06-29 11:31:58 +02:00