summaryrefslogtreecommitdiffstats
path: root/term-utils/wall.c
Commit message (Collapse)AuthorAgeFilesLines
* Remove isascii usageRosen Penev2019-08-081-1/+2
| | | | | | | There is a c_isascii function that can be used. isascii is deprecated and not available with some libcs like uClibc-ng where it can be compile time disabled.
* wall: make sure ut_line is not emptyKarel Zak2019-06-061-4/+6
| | | | | Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=1711574 Signed-off-by: Karel Zak <kzak@redhat.com>
* misc: consolidate version printing and close_stdout()Karel Zak2019-04-161-3/+3
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* hardlink, wall: fix variable shadowingSami Kerola2019-02-181-6/+6
| | | | | | | | | | | | | misc-utils/hardlink.c:91:65: warning: declaration shadows a variable in the global scope [-Wshadow] misc-utils/hardlink.c:73:5: note: previous declaration is here int content_only = 0; term-utils/wall.c:114:40: warning: declaration shadows a variable in the global scope [-Wshadow] term-utils/wall.c:129:65: warning: declaration shadows a variable in the global scope [-Wshadow] /usr/include/bits/getopt_core.h:36:14: note: previous declaration is here extern char *optarg; Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* wall: remove unnecessary warningKarel Zak2019-02-141-1/+0Star
| | | | | | | | | wall(1) may be used in scripts or in pipe. In this case report failed ttyname() does not make sense, especially if the code does not depend on on this function. Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=1608176 Signed-off-by: Karel Zak <kzak@redhat.com>
* wall: make sure line is zero terminatedKarel Zak2018-10-031-1/+1
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* misc: consolidate macro style USAGE_HELP_OPTIONSRuediger Meier2017-06-291-2/+2
| | | | | | | | | changed in include/c.h and applied via sed: sed -i 's/fprintf.*\(USAGE_MAN_TAIL.*\)/printf(\1/' $(git ls-files -- "*.c") sed -i 's/print_usage_help_options\(.*\);/printf(USAGE_HELP_OPTIONS\1);/' $(git ls-files -- "*.c") Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
* misc: introduce print_usage_help_options()Ruediger Meier2017-06-271-2/+1Star
| | | | | | | | | | | | Consolidate --help and --version descriptions. We are now able to align them to the other options. We changed include/c.h. The rest of this patch was generated by sed, plus manually setting the right alignment numbers. We do not change anything but white spaces in the --help output. Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
* misc: cosmetics, remove argument from usage(FILE*)Ruediger Meier2017-06-261-3/+4
| | | | | | | | | | | | | | This patch is trivial and changes nothing, because we were always using usage(stdout) Now all our usage() functions look very similar. If wanted we could auto-generate another big cosmetical patch to remove all the useless "FILE *out" constants and use printf and puts rather than their f* friends. Such patch could be automatically synchronized with the translation project (newlines!) to not make the translators sick. Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
* wall: don't use gid_t when allocate grounps arrayKarel Zak2017-06-141-1/+1
| | | | | Reported-by: Ruediger Meier <ruediger.meier@ga-group.nl> Signed-off-by: Karel Zak <kzak@redhat.com>
* misc: remove stray semicolonsSami Kerola2017-06-141-1/+1
| | | | Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* wall: fix OSX getgrouplist, gid_t* vs int*Karel Zak2017-06-141-1/+7
| | | | | | | | | | | | | | | | This was the compiler warning: term-utils/wall.c:156:39: warning: passing 'gid_t *const' (aka 'unsigned int *const') to parameter of type 'int *' converts between pointers to integer types with different sign [-Wpointer-sign] rc = getgrouplist(login, pw->pw_gid, buf->groups, &ngroups); ^~~~~~~~~~~ /usr/include/unistd.h:653:43: note: passing argument to parameter here int getgrouplist(const char *, int, int *, int *); ^ Reported-by: Ruediger Meier <ruediger.meier@ga-group.nl> Signed-off-by: Karel Zak <kzak@redhat.com>
* wall: make sure with not referencing a null pointerKarel Zak2017-05-291-0/+3
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* misc: do not use plain 0 as NULL [smatch scan]Sami Kerola2017-02-201-6/+6
| | | | | | | | | | text-utils/tailf.c:69:21: warning: Using plain integer as NULL pointer Since many 'struct option' has used zero as NULL make them more readable in same go by reindenting, and using named argument requirements. Reference: https://lwn.net/Articles/93577/ Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* Use --help suggestion on invalid optionKarel Zak2016-12-191-1/+1
| | | | | | | | The current default is to print all usage() output. This is overkill in many case. Addresses: https://github.com/karelzak/util-linux/issues/338 Signed-off-by: Karel Zak <kzak@redhat.com>
* wall: remove unnecessary includeKarel Zak2016-12-081-1/+0Star
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* login-utils: switch to utmpx.hRuediger Meier2016-12-071-4/+4
| | | | | | | | Now the build will fail on many non-Linux systems because utmpx.h is available everywhere but we still use non-POSIX features. We'll fix this next commit. Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
* wall: check -g GIDKarel Zak2016-12-021-1/+7
| | | | | | Based on comments from Sami Kerola. Signed-off-by: Karel Zak <kzak@redhat.com>
* wall: add --group optionJim Patterson2016-12-021-1/+75
| | | | | | | | | | | | | | | | The wall command on AIX supports a "-g" option to limit the message to a group of users by gid. Add compatibility to the Linux version. Thanks to Sami Kerola <kerolasa@iki.fi> for an initial skeleton implementation. [kzak@redhat.com: - rename max to ngroups - add free_group_workspace() - some cosmetic changes] Reference: http://www.ibm.com/support/knowledgecenter/ssw_aix_61/com.ibm.aix.cmds6/wall.htm Signed-off-by: Jim Patterson <jimp@wegrok.net> Signed-off-by: Karel Zak <kzak@redhat.com>
* misc: Fix various typosSebastian Rasmussen2016-05-311-1/+1
| | | | | | | Fix various typos in error messages, warnings, debug strings, comments and names of static functions. Signed-off-by: Sebastian Rasmussen <sebras@gmail.com>
* misc: safer (and uniform) handling of return valueYuriy M. Kaminskiy2016-03-071-2/+2
| | | | | | When `rc` is `INT_MAX`, `rc + 1` result in signed integer overflow. Signed-off-by: Karel Zak <kzak@redhat.com>
* wall: do not use a temporary file.Karel Zak2015-04-031-36/+80
| | | | | | | | | | | | | | | The issue with using a temporary file in wall is that wall runs as setgid. This means that an unprivileged user who runs wall can modify wall's temporary files, even if those are mode 0600, so the unprivileged user can edit and effectively suppress the banner. The fix is to simply not use temporary files. [kzak@redhat.com: - rewrite growing string functions - use struct buffer - add buf_print() function] Signed-off-by: Karel Zak <kzak@redhat.com> Co-Author: Jann Horn <jann@thejh.net>
* textual: add a docstring to most of the utilitiesBenno Schulenberg2015-01-061-0/+4
| | | | | | | | | 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>
* Revert "wall: wrap message header when it exceeds 79 characters"Karel Zak2014-07-291-6/+1Star
| | | | | | This reverts commit 93d7baf250495b2385c369afd48137a7363ae4c2. Ooops... it wasn't my plan to merge this patch. Sorry.
* wall: wrap message header when it exceeds 79 charactersSami Kerola2014-07-281-1/+6
| | | | | | | | Header truncation started to happen more often after commit d81c30553f4fb49173d38f69edff4b0b67a18b65 that made the header to be longer. Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* wall: add fallback for failed sysconf()Karel Zak2014-07-171-0/+3
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* 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>
* include/carefulputc: cleanup and add fputs_{quoted,nonblank}()Karel Zak2014-04-031-1/+1
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* last, utmpdump, agetty, wall, write: avoid compatibility hacksSami Kerola2013-08-291-1/+1
| | | | | | | | 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>
* wall: line wrap at column 79 also when line has tab charsSami Kerola2013-08-291-0/+2
| | | | | | | 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>
* wall: sync usage() with howto-usage-function.txtSami Kerola2013-08-291-11/+10Star
| | | | Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* wall: send message also to sessions opened by user 'sleeper'Sami Kerola2013-08-291-4/+1Star
| | | | | | | Ignoring an user by name, and not telling about it in manual page, is unexpected. Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* include: carefulput: print determined char when unprintable char is foundSami Kerola2013-08-231-1/+1
| | | | | | This is done to allow reuse of the functin in last(1). Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* wall: make banner sysvinit compatibleKarel Zak2013-08-131-16/+18
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* wall: allow to specify <message> on command lineKarel Zak2013-08-131-31/+60
| | | | | | | | | | 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>
* various: fix variable and function declarations [smatch scan]Sami Kerola2013-04-091-5/+5
| | | | | | | | | | | | | | | | | 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>
* wall: use xgethostname()Sami Kerola2013-03-041-4/+3Star
| | | | Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* textual: spell and encode the name of Arkadiusz Miƛkiewicz correctlyBenno Schulenberg2013-02-061-1/+1
| | | | Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
* translation: unify file open error messagesSami Kerola2012-07-161-1/+1
| | | | Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* translation: unify stat error messagesSami Kerola2012-07-161-1/+1
| | | | Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* build: fix redundant redeclaration warningsSami Kerola2012-06-111-1/+0Star
| | | | | | | | | | | | | | | | | | | | | | | | | 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>
* fileutils: xmkstemp() interface changeDave Reisner2012-06-021-1/+1
| | | | | | | | | | | 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>
* include/c: move fallback for MAXHOSTNAMELEN to c.hKarel Zak2012-05-291-8/+0Star
| | | | | Reported-by: Thomas Schwinge <thomas@codesourcery.com> Signed-off-by: Karel Zak <kzak@redhat.com>
* term-utils: cleanup strtoxx_or_err()Karel Zak2012-05-151-2/+2
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* term-utils: verify writing to streams was successfulSami Kerola2012-04-041-1/+4
| | | | Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* fileutils: differentiate xmkstemp and xfmkstempSami Kerola2012-03-181-1/+1
| | | | | | | | | | | | 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>
* wall: use xmkstemp for temporary fileSami Kerola2012-03-181-14/+5Star
| | | | Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* wall: cleanup usage()Karel Zak2011-08-161-7/+8
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* wall: cleanup mbufsize usageKarel Zak2011-04-121-7/+5Star
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* wall: support --timeout switchSami Kerola2011-04-121-2/+11
| | | | | | The switch controls message write time out to terminals. Signed-off-by: Sami Kerola <kerolasa@iki.fi>