summaryrefslogtreecommitdiffstats
path: root/term-utils
Commit message (Collapse)AuthorAgeFilesLines
* agetty: use the "best" interface for \4 and \6Karel Zak2014-05-132-42/+67
| | | | | | | | | | | | 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>
* agetty: fix odd check for chardev/ttyKarel Zak2014-05-131-2/+2
| | | | | References: https://bugzilla.redhat.com/show_bug.cgi?id=1069902 Signed-off-by: Karel Zak <kzak@redhat.com>
* agetty: beside virtual consoles support xvc and hvc device lines as wellWerner Fink2014-05-131-12/+11Star
| | | | | | | | 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>
* agetty: better support of the special system consoles on S390Werner Fink2014-05-131-5/+10
| | | | | | | | | | | | | | | | | 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>
* agetty: avoid that agetty nor sulogin are fooled by a running plymouthWerner Fink2014-05-131-7/+68
| | | | | | | | 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>
* setterm: convert remaining magic values to symbolic referencesSami Kerola2014-05-121-20/+47
| | | | | Signed-off-by: Sami Kerola <kerolasa@iki.fi> Signed-off-by: Karel Zak <kzak@redhat.com>
* setterm: convert various constant number definitions to enumsSami Kerola2014-05-121-20/+26
| | | | | | The enum strings are visible when using debugger. Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* setterm: cleanup printf() usageKarel Zak2014-05-121-58/+24Star
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* setterm: remove unused codeSami Kerola2014-05-121-68/+3Star
| | | | Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* wall: replace magic number by named valueSami Kerola2014-05-121-7/+8
| | | | | Signed-off-by: Sami Kerola <kerolasa@iki.fi> Signed-off-by: Karel Zak <kzak@redhat.com>
* term-utils: avoid error message string length couting errorsSami Kerola2014-05-121-34/+32Star
| | | | | | | | | | | | 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>
* build-sys: remove unnecessary void castsSami Kerola2014-05-121-13/+13
| | | | Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* include/carefulputc: cleanup and add fputs_{quoted,nonblank}()Karel Zak2014-04-032-2/+2
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* scriptreplay: no need to skip first time value or last bytes fixes #58Wolfgang Richter2014-03-201-4/+1Star
|
* script: time from end of read() call partially fixes #58Wolfgang Richter2014-03-201-2/+3
|
* script: clean up files usageKarel Zak2014-02-211-28/+40
| | | | | | | | | | | | | | | * 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>
* script: Also flush writes to timing file.Jesper Dahl Nyerup2014-02-211-1/+4
| | | | | | | | | 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>
* scriptreplay: Add --maxdelay option.Jesper Dahl Nyerup2014-02-102-4/+20
| | | | | | | | 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>
* include/c.h: prefer nanosleep() over usleep()Karel Zak2014-01-241-1/+1
| | | | | | | | | | | | | | 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>
* script: use all-io.h to make the code more robustKarel Zak2014-01-161-9/+5Star
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* script: fix inconsistent -q, use poll() rather then O_NONBLOCKKarel Zak2014-01-161-25/+17Star
| | | | | | | | | - 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>
* script: don't wait for empty descriptors if child is deadKarel Zak2014-01-161-4/+8
| | | | | | | | 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>
* script: script input redirection / eof handlingKarel Zak2013-12-031-19/+79
| | | | | | | | | | | | | | | | | | | | | | | 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>
* script: check that stdin is a terminalKarel Zak2013-12-021-0/+4
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* setterm: fix -dump man page infoKarel Zak2013-12-021-1/+1
| | | | | | | | | 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>
* agetty: support the special terminal on first serial line on a S/390Werner Fink2013-12-021-0/+18
| | | | | | | | 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>
* losetup, agetty: remove unnecessary if's before free()Sami Kerola2013-12-021-4/+2Star
| | | | | Reference: http://git.savannah.gnu.org/cgit/gnulib.git/tree/build-aux/useless-if-before-free Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* script: restore errno in signal handlerKarel Zak2013-11-141-0/+3
| | | | | References: https://plus.google.com/+LennartPoetteringTheOneAndOnly/posts/gHSscCJkakd Signed-off-by: Karel Zak <kzak@redhat.com>
* script: don't call TIOCGWINSZ in signal handlerKarel Zak2013-11-141-3/+5
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* docs: standardize the phrases for --help and --version in all man pagesBenno Schulenberg2013-10-154-7/+7
| | | | Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
* docs: format, grammarize, and standardize the wall man pageBenno Schulenberg2013-10-151-19/+21
| | | | Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
* various: fix mixing declarations and code compiler warnings [smatch]Sami Kerola2013-10-081-5/+5
| | | | Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* textual: make two messages somewhat easier to understandBenno Schulenberg2013-10-081-2/+2
| | | | Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
* build-sys: use tinfo *or* ncurses for more(1), ul(1) and setterm(1)Karel Zak2013-10-041-2/+9
| | | | | | | | | | | | * 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>
* docs: tweak the grammar of an agetty man-page fragmentBenno Schulenberg2013-10-041-4/+4
| | | | Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
* agetty: use standard angular brackets in usage messageBenno Schulenberg2013-10-041-2/+2
| | | | Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
* build-sys: Fix check for __GNU_LIBRARY__Michael Forney2013-10-041-1/+1
| | | | | | | 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>
* include: Add missing includesMichael Forney2013-10-041-0/+1
| | | | | | | | 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>
* Merge branch 'master' of https://github.com/yurchor/util-linuxKarel Zak2013-09-301-1/+1
|\
| * Fix various typosYuri Chornoivan2013-09-281-2/+2
| |
* | textual: fix misspelled words in -rc1Karel Zak2013-09-301-1/+1
| | | | | | | | | | Reported-by: Rafael Ferreira <rafael.f.f1@gmail.com> Signed-off-by: Karel Zak <kzak@redhat.com>
* | clean up term lib handlingMike Frysinger2013-09-301-5/+2Star
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* | setterm: fix term.h/ncurses.h include orderingMike Frysinger2013-09-301-2/+3
|/ | | | | | | | | | | | | | | | | | | 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>
* agetty: add \S to output /etc/os-release dataKarel Zak2013-09-122-2/+111
| | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* agetty: add baud rates available from glibc that are not already supportedJames Buren2013-09-121-0/+36
| | | | | This adds userspace support for baud rates reater than 230400, provided the tty also supports it.
* agetty: only use EXTA/EXTB macros if B19200/B38400 macros are not presentJames Buren2013-09-121-7/+5Star
|
* agetty: cleanup debug ifdefsKarel Zak2013-09-091-5/+5
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* last, utmpdump, agetty, wall, write: avoid compatibility hacksSami Kerola2013-08-293-3/+7
| | | | | | | | 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>
* write: change determination can user write to a terminalSami Kerola2013-08-291-4/+5
| | | | | | | | | | | | | 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>
* docs: add note to wall(1) about sessions which will not get messageSami Kerola2013-08-291-0/+6
| | | | | | | | | | | | 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>