Commit Graph

663 Commits

Author SHA1 Message Date
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
Sami Kerola 8fb810ff26 script: include-what-you-use header check
The tool proposed;

script.c should add these lines:

script.c should remove these lines:
- #include <sys/file.h>  // lines 53-53
- #include <sys/types.h>  // lines 48-48
- #include "c.h"  // lines 61-61

and the change nearly did what the tool told. We should keep on
using c.h, not err.h. The config.h is not needed, it's added
automaticly.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2011-06-29 11:24:30 +02:00
Sami Kerola 0f81d3289f script: remove unnecessary void casting
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2011-06-29 11:23:58 +02:00
Sami Kerola fd4c1f632f script: option --force added
The --force will allow default output destination, e.g.
typescript file, to be hard or symbolic link.

[kzak@redhat.com: - remove "error:" prefix from errx()]

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-06-29 11:22:14 +02:00
Sami Kerola 5f51b8b25d write: maintenance fixes
Use libc error printing facilities, remove void casting, clean up
unused headers and alignt coding style with README.devel.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2011-06-25 14:25:40 +02:00
Sami Kerola aa44b95f12 write: long options & new usage
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2011-06-25 14:24:16 +02:00
Sami Kerola 4aa9d65bfa build-sys: move write to term-utils directory
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2011-06-25 13:54:31 +02:00
Samuel Thibault 4585ec0b29 misc: hurd build fixes
* Make blkdev_is_misaligned return 0 when BLKALIGNOFF is not available.
* Make procutils.c include c.h to get a PATH_MAX replacement.
* Provide agetty.c USE_SYSLOG, DEFAULT_VCTERM and DEFAULT_STERM
  defaults for Hurd.
* Make agetty.c only deal with OFDEL, XCASE and VSWTCH if they are
  available.

Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-06-20 12:48:35 +02:00
Karel Zak 4a9b7543ae agetty: try next speed after CBREAK
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-05-18 14:19:39 +02:00
Karel Zak ca8e91a4bf agetty: don't use xalloc.h stuff
agetty logs errors and warnings to syslog, we shouldn't use err.h
stuff here.

Signed-off-by: Karel Zak <kzak@redhat.com>
2011-05-17 14:02:57 +02:00
Karel Zak 3fc62fd3a5 agetty: remove unnecessary options synonyms
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-05-17 13:21:45 +02:00
Karel Zak a694957a9a agetty: use a generic function for strings concatenation
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-05-17 13:03:52 +02:00
Karel Zak 763d7a8705 agetty: remove unnecessary space and "(void)" junk
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-05-17 11:36:02 +02:00
Dr. Werner Fink e85281a8ac aggety: further mingetty features
Allow the system adminstrator to provide options to the login
program.   Some changes for several layouts of the agetty
prompt like short host name or full qualified host name.
Four options enables the user to delay agetty after start,
to change the working directory, to change the root directory,
and to modified scheduling priority.

Signed-off-by: Werner Fink <werner@suse.de>
2011-05-17 11:13:19 +02:00
Werner Fink eb8e1f9f0c agetty: add an autologin feature
Add an autologin feature to agetty, that is that a user can be
automatically logged in.  For this the options of for the
login program has to used.  Make it possible to pass-through
options to the login program which requires a security check.

Signed-off-by: Werner Fink <werner@suse.de>
2011-05-17 11:13:06 +02:00
Dr. Werner Fink 1683f6bf20 agetty: better support of virtual console
Better support of virtual console due support of UTF-8 login names
provided by e.g. LDAP.  Set default size 24/80 on serial modem lines
if not found by the kernel.

Signed-off-by: Werner Fink <werner@suse.de>
2011-05-17 11:11:30 +02:00
Werner Fink 0da025da8e agetty: check virtual console for UTF-8 support
Check out a virtual console line for UTF-8 support, also skip
modem specific setups on a virtual console line.

Signed-off-by: Werner Fink <werner@suse.de>
2011-05-17 11:10:36 +02:00
Werner Fink 3aa6b68f7e agetty: proper session on the terminal line
Ensure a proper session on the terminal line, that is do a
vhangup() and become the controlling terminal.  After this
determine if the terminal line a virtual console by using
the ioctl TIOCMGET to get the status modem bits of a serial
line which is a invalid argument on a virtual console.

Signed-off-by: Werner Fink <werner@suse.de>
2011-05-17 11:10:21 +02:00
Werner Fink 729def03e1 agetty: cleanup argv parsing, utmp update, use writeall(), etc.
Next cleanup, that is split off special character parsing in do_prompt()
and parse_args(), handle name of line of virtual console and use it in
utmp update as well as the session id.  Also move the initial TERM
variable to open_tty() as we use this later in open_tty().  Use writeall()
but avoid repeat to often for EAGAIN (compare with info page of the
(g)libc, description of the macro EAGAIN).

Signed-off-by: Werner Fink <werner@suse.de>
2011-05-17 11:10:03 +02:00
Werner Fink bde20e1b2b agetty: more code cleanup
More code cleanup, that is use bit mask for eight bit option, use
modern speed_t type, split local error() into local log_err(), log_warn(),
and dolog() for fine graduated logging with syslogger.

Signed-off-by: Werner Fink <werner@suse.de>
2011-05-17 11:08:49 +02:00
Sami Kerola d54749cf33 docs: agetty manual update
Tell users how to see what issue escape will print by using other
commands, such as uname.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2011-04-27 23:21:21 +02:00
Sami Kerola 96cc7b0b3e agetty.c: move issue path to pathnames.h
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2011-04-27 23:21:19 +02:00
Sami Kerola 53d5504235 agetty.c: further scrubbing
In reply to two requests.

http://permalink.gmane.org/gmane.linux.utilities.util-linux-ng/3990
http://permalink.gmane.org/gmane.linux.utilities.util-linux-ng/3999

The scubbing consists;

o Old school introduction back to the top of the source file.
o Indentation changes.
o Removal of void casting.
o Removal of braces from single statements.
o Unified format for comments.
o Comparison with W. Venema's code from 1993 to clean few comment
  mysteries.
o Web referrals added to further explanation to near the code or
  comments which some could find difficult to understand why.
o Clean up of comments.
o FIXME items added where attention is needed.
o Make functions static.
o Functions with same argument types use same argument order.
o Get rid of classic K&R style function declarations.

Please notice that this patch _should not_ affect how program
works e.g. this has no actual code changes.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2011-04-27 23:21:17 +02:00
Karel Zak a7a4aa9857 mesg: add \n to usage() output
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-04-14 17:16:30 +02:00
Karel Zak e1167ce2ec mesg: man page clean wqup
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-04-14 17:11:23 +02:00
Sami Kerola 849c6ea3f7 mesg: new --verbose option
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2011-04-14 17:08:00 +02:00
Sami Kerola ea87bbf679 mesg: add long options to the man page
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2011-04-14 17:07:55 +02:00
Sami Kerola fe16e12513 mesg: use long options, also --help and --version added
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2011-04-14 17:07:26 +02:00
Karel Zak 70bedfa1db agetty: coding style - fix identation
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-04-14 13:43:11 +02:00
Karel Zak b75c8134aa agetty: coding style - fix comments, remove tailing whitespace
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-04-14 13:25:57 +02:00
Sami Kerola 72f286b5f6 agetty: getopt case segment reordering
The case clause after getopts is in alphabetical order, just like
option string definition and manual page. The patch also convers
spaces to tabs in this code block.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2011-04-14 13:20:26 +02:00
Sami Kerola e9980cf8f1 docs: agetty long options
Long options to manual page with the new --version and --help.
The manual page option order is also set to be the same as it is
in code. For the persons who don't see the order it is short
option case in sensitive alphabetical order.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2011-04-14 13:20:25 +02:00
Sami Kerola 214af4fd0f agetty: symbolic standard file descriptors
I find it easier to read code in which standard file descriptors
are symbolic strings rather than numbers.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2011-04-14 13:20:25 +02:00
Sami Kerola af19306b8d agetty: #endif comments
The longer #ifdef ... #endif markups have now at the end section
comment where they begun, which should improve preprosessor
directive readability.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2011-04-14 13:20:25 +02:00
Sami Kerola 7c45597f91 agetty: error message about required arguments
This patch also fixes only remaining magical number to EXIT_*
markup.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2011-04-14 13:20:25 +02:00
Sami Kerola 3b4113f2a6 agetty: use long options
This patch will introducing --help and --version options, which
does not have short version. Reason to this is a that the -h was
already assigned.

[kzak@redhat.com: - fix one usage call,
                  - use %1$s in usage printf format
                  - remove "static const" from enum]

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-04-14 13:15:36 +02:00
Sami Kerola 82cd61f251 agetty: use program_invocation_short_name
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2011-04-14 13:09:09 +02:00
Sami Kerola be66a93afc agetty: use xalloc.h
Unifies and fixes malloc and strdup calls.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2011-04-14 13:08:59 +02:00
Sami Kerola 7ca59ef25f script: optional timing output file argument added
And update to manual page accordingly.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2011-04-12 14:21:36 +02:00
Sami Kerola ed66f51588 docs: scriptreplay add note about new options
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2011-04-12 14:21:36 +02:00
Sami Kerola 0da871b50d scriptreplay: allow arguments as command line switches
The command line switches override old style arguments

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-04-12 14:21:36 +02:00
Sami Kerola 178365ef96 docs: scriptreplay mention basic long options
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2011-04-12 14:20:01 +02:00
Sami Kerola 84adb5e65e scriptreplay: support long options
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-04-12 14:19:44 +02:00
Sami Kerola f004a02d80 scriptreplay: end printing with new line
Depending on opinion this is either modest bug fix or tiny
improvement.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2011-04-12 13:35:37 +02:00
Karel Zak 9123987458 script: don't include err.h directly 2011-04-12 12:57:56 +02:00
Karel Zak 35b671371b wall: support --timeout switch (vol 2.)
This is the rest of the commit

	cae7485e59

the original patch was committed without man page and Makefile
changes. Sorry.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-04-12 11:50:00 +02:00
Karel Zak c666d1d170 wall: cleanup mbufsize usage
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-04-12 11:49:28 +02:00
Sami Kerola cae7485e59 wall: support --timeout switch
The switch controls message write time out to terminals.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2011-04-12 11:31:21 +02:00
Sami Kerola e89c3891a5 wall: add long options and 79 char cut info to the man page
Mention that over 79 characters long lines are cut, while long
options is an obvious change.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2011-04-12 11:29:13 +02:00
Sami Kerola 5e6bf8008b ttymsg: fix compiler warnings and use EXIT_
[kzak@redhat.com: - remove 'register' storage class specifier]

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-04-12 11:19:15 +02:00
Sami Kerola 76cc41b7fb wall: use long options
Also --version & --help options added, and rewrote help output.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-04-12 11:12:17 +02:00
Sami Kerola 98e2d4deb3 wall: remove global variables and support TMPDIR
The TMPDIR environment is preferred over _PATH_TMP in which a
file is created that is ultimately sent to terminals. This patch
will also fix compiler warnings and removes magical numbers,
which has not explanation.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-04-12 11:09:42 +02:00
Karel Zak 9497ebb074 setterm: use xmalloc()
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-04-06 11:24:23 +02:00
Sami Kerola 172ba4f2a8 setterm: fix variable types, and unused argument warnings
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2011-04-06 11:21:48 +02:00
Sami Kerola 9350520053 setterm: add note about long dump file paths to man page
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2011-04-06 11:20:48 +02:00
Sami Kerola a973947c88 setterm: function screendump coding style fixed
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2011-04-06 11:19:15 +02:00
Sami Kerola 6e8e22adf6 setterm: mention in man setterm.1 -version and -help switches
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2011-04-06 11:15:15 +02:00
Sami Kerola 261f1423fb setterm: use libc error printing facilities
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-04-06 11:13:40 +02:00
Sami Kerola faa0548de4 setterm: support -help and -version options
[kzak@redhat.com: - merge all options to the one string]

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-04-06 11:10:34 +02:00
Sami Kerola 2971543625 setterm: segfault with long dump file name
The patch will make too long path to be truncated to MAX_PATH
lenght. If user supplies too long file name that is caught at
fopen. Some users might find this unintuitive, so the altered
behavior will be mantioned in manual page.

Bug in earlier version was visible with a command bellow.

setterm -dump -file $(for i in $(seq 254); do printf x ; done)

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2011-04-06 10:59:17 +02:00
Karel Zak c738bc32a4 build-sys: fix distcheck for term-utils
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-04-04 10:53:07 +02:00
Karel Zak 6c7d5ae9a2 move struct option to .rodata
It does not make sense to have writable large arrays of "struct
option" on the stack.

Signed-off-by: Karel Zak <kzak@redhat.com>
2011-03-03 15:00:30 +01:00
Karel Zak 342da61035 build-sys: add term-utils/.gitignore
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-03-02 14:29:34 +01:00
Karel Zak db6772a19c build-sys: move wall to term-utils/
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-03-02 14:20:33 +01:00
Karel Zak c4571e4908 build-sys: move mesg to term-utils/
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-03-02 14:18:31 +01:00
Karel Zak 720d1af42e build-sys: move reset to term-utils/
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-03-02 14:08:30 +01:00
Karel Zak c76d33bacc build-sys: move script and scriptreplay to term-utils/
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-03-02 14:06:23 +01:00
Karel Zak 8c59914ee2 build-sys: move setterm to term-utils/
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-03-02 14:02:01 +01:00
Karel Zak cf56b8b507 build-sys: move agetty to term-utils
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-03-02 13:57:00 +01:00
Karel Zak c0f20acb7a build-sys: add term-utils/
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-03-02 13:54:05 +01:00