summaryrefslogtreecommitdiffstats
path: root/text-utils/more.c
Commit message (Collapse)AuthorAgeFilesLines
* misc: add static keyword to where needed [smatch scan]Sami Kerola2017-02-201-53/+53
| | | | | | | text-utils/rev.c:68:9: warning: symbol 'buf' was not declared. Should it be static? Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* misc: do not use plain 0 as NULL [smatch scan]Sami Kerola2017-02-201-2/+2
| | | | | | | | | | 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>
* more: avoid double free() on exitKarel Zak2016-12-151-0/+8
| | | | | | | | | | | | | On 'q' command more(1) calls end_it() function with _exit(). The _exit() may suspend program execution due to pending I/O on very loaded server. In this time SIGINT may be delivered due to impatient user who will press ^C. And then end_it() cleanup function may be executed by signal handler too. The result is double free()... Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=1403971 Signed-off-by: Karel Zak <kzak@redhat.com>
* more: don't include ncurses.h, fix for non-widecharKarel Zak2016-06-031-5/+2Star
| | | | | | | | It seems our crazy widechar.h is in conflict with ncurses, but it seems that nothing in more.c requires anything from ncurses. All we need is probably <term.h>. Signed-off-by: Karel Zak <kzak@redhat.com>
* more: remove unnecessary compatibility layerKarel Zak2016-01-261-66/+41Star
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* build-sys: remove libtermcap supportSami Kerola2016-01-261-87/+23Star
| | | | | | | | | | It is unlikely anyone is going to build this project on system where libtermcap is available. Fedora project obsoleted libtermcap 2007-12-12 in favour of ncurses. Debian made same move 2005. Reference: https://fedoraproject.org/wiki/Deprecated_packages Reference: https://www.debian.org/doc/manuals/debian-faq/ch-compat.en.html#s-termcap Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* more: improve ugly macroKarel Zak2015-08-051-10/+17
| | | | | | no comment, just F*CK YOU to the original author of this crap... Signed-off-by: Karel Zak <kzak@redhat.com>
* textual: grammarize and harmonize the stat error messageBenno Schulenberg2015-02-021-1/+1
| | | | | | | | | The message "stat failed %s" seems to say that stat() failed to do something, or failed to pass a test, but of course it means that the statting of something failed. So say so. Also make two very similar messages equal to this one. Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
* more: fix repeat search crashSami Kerola2015-01-281-0/+3
| | | | | | | | | Repeating a search for a pattern that did not found made more(1) to crash. To reproduce 'more /etc/services' and search for 'doom'; you will find a service in port 666 - pressing '.' after that result used to cause core dump. Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* 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>
* more: fix compiler warningsKarel Zak2014-12-191-2/+2
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* more: blacklist unsigned integer overflow [AddressSanitizer]Sami Kerola2014-12-191-4/+11
| | | | | | The mbrtowc() return values are overflowing by design. Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* textual: improve error messagesSami Kerola2014-12-091-6/+4Star
| | | | | | | Use error printing facilities that add command name in front of the error message, and add explanation that is part of existing translations. Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* more: replace ad-hoc support for plurals with gettext plurals.Lauri Nurmi2014-07-281-8/+6Star
|
* more: fix double free crashSami Kerola2014-02-211-1/+0Star
| | | | | | | | Commit b9579f1f44b46c9f12f1e01b01c02d82ae1cf728 moved fclose() to checkf(), but missed removing file closure in magic(). Ironically the cause of regression is in previous commit message. Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* more: improve formatting and wording of man page and help textBenno Schulenberg2014-02-211-16/+15Star
| | | | | | | Also, slice up the usage text for ease of translation. Reported-by: Phillip Susi <psusi@ubuntu.com> Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
* more: fix mem leak [coverity scan]Karel Zak2014-01-141-1/+3
| | | | | | ... the code is so soo ugly. Signed-off-by: Karel Zak <kzak@redhat.com>
* more: fix warning when compiled --without-ncursesKarel Zak2013-10-151-1/+1
| | | | | Reported-by: Benno Schulenberg <bensberg@justemail.net> Signed-off-by: Karel Zak <kzak@redhat.com>
* more: make output redirection more efficientSami Kerola2013-08-051-3/+4
| | | | | | | | | | | | | Especially with large inputs the change improves performance considerably. old> time more /boot/vmlinuz >/dev/null real 0m0.224s new> more /boot/vmlinuz >/dev/null real 0m0.009s Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* more: guarantee space for multibyteKarel Zak2013-08-011-0/+6
| | | | | | .. to make the code more robust. Signed-off-by: Karel Zak <kzak@redhat.com>
* more: check for buffer size when write multibyte charKarel Zak2013-08-011-1/+2
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* more: fix buffer overflowKarel Zak2013-08-011-1/+2
| | | | | | | | | The bug has been probably introduced by commit 1ac300932deab8dea2c43050921bbbdb36d62ff1. Reported-by: "Dr. David Alan Gilbert" <dave@treblig.org> References: https://bugzilla.novell.com/show_bug.cgi?id=829720 Signed-off-by: Karel Zak <kzak@redhat.com>
* more: use variable lenght printf field width to print blanksSami Kerola2013-07-091-2/+1Star
| | | | | | This makes program to run a little faster. Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* more: assigned value is never read [clang-analyzer]Sami Kerola2013-07-091-1/+1
| | | | Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* Fix various typosYuri Chornoivan2013-04-261-1/+1
|
* a pointer should not be compared to zero [coccinelle]Sami Kerola2013-02-061-2/+2
| | | | 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>
* textual: standardize the reporting of program name plus package versionBenno Schulenberg2013-01-301-2/+1Star
| | | | Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
* textual: standardize reporting of program name plus package versionBenno Schulenberg2013-01-251-1/+2
| | | | Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
* textual: fix a few typos in some of the usage help textsBenno Schulenberg2013-01-251-2/+2
| | | | | | Also improve clarity of some other lines of those texts. Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
* more: allow to compile as non-interactive test_more programKarel Zak2013-01-241-0/+7
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* more: remove unnecessary variableSami Kerola2012-12-191-2/+2
| | | | Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* more: remove few memory leaksSami Kerola2012-10-151-1/+7
| | | | | | | The remaining memory leaks are related to ncurses internals, or the one open file descriptor when user users 'q' to exit. Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* more: align void in functions with prototypes, and remove void castsSami Kerola2012-10-151-14/+14
| | | | | | | | If there is void in argument list at function prototype it is reasonable to expect to see it also where the function is wrote. This change also removes unnecessary return value void casting. Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* more: fix coding styleSami Kerola2012-10-151-1714/+1694Star
| | | | Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* more: add noreturn function attributeSami Kerola2012-07-261-1/+2
| | | | Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* more: fix shadow declarationSami Kerola2012-07-261-3/+3
| | | | | | | text-utils/more.c:1123:13: warning: declaration of 'state' shadows a previous local [-Wshadow] text-utils/more.c:1095:18: warning: shadowed declaration is here [-Wshadow] Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* more: fix pointer wrap around compiler warningsSami Kerola2012-06-171-5/+3Star
| | | | | | | more.c:318:5: warning: assuming pointer wraparound does not occur when comparing P +- C1 with P +- C2 [-Wstrict-overflow] more.c:362:3: warning: assuming pointer wraparound does not occur when comparing P +- C1 with P +- C2 [-Wstrict-overflow] Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* more: fix search repetition regressionSami Kerola2012-06-171-1/+13
| | | | | | | Commit 596007ef6a37b708f44286932eed667b316e5f70 introduced a bug crashing more always when a text search was repeated with 'n' command. Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* Fix typos in comments and wall's man pageBernhard Voelker2012-06-051-1/+1
| | | | | | | | | | | 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>
* more: fix regex error messages printingKarel Zak2012-06-051-2/+3
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* more: remove a meaningless testJeremy Huntwork2012-06-051-2/+1Star
| | | | | | | regexec only returns 0 or REG_NOMATCH so remove a meaningless test Signed-off-by: Jeremy Huntwork <jhuntwork@lightcubesolutions.com> Signed-off-by: Karel Zak <kzak@redhat.com>
* Use POSIX regcomp and regexec over obsolete BSD re_comp and re_execJeremy Huntwork2012-05-131-6/+7
|
* Fix typos found by misspellingsBernhard Voelker2012-04-231-2/+2
| | | | | | | | | | | | | | | The tool misspellings (https://github.com/lyda/misspell-check) detected several typos. Command used: $ git ls-files | grep -v ^po/ | misspellings -f - * isosize: Fix typo in usage string. * configure.ac: Fix typo in help string of --enable-most-builds option. * fdisk: Fix typo in man page. * libblkid, blkid, mount: Likewise. * Fix various typos in docs and in source code comments. Signed-off-by: Bernhard Voelker <mail@bernhard-voelker.de>
* text-utils: verify writing to streams was successfulSami Kerola2012-04-041-8/+10
| | | | Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* more: fix typosDavidlohr Bueso2012-02-241-1/+1
| | | | Signed-off-by: Davidlohr Bueso <dave@gnu.org>
* more: add commentKarel Zak2012-01-311-0/+1
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* more: new usage output, and some trivial fixesSami Kerola2011-02-151-188/+208
| | | | | | | | | | | | | | | | | | | | | Usage output screen got to be completely rewrote. Aim is to assist user to determe which switches to use without reading manual page. The change also introduced new option to see command version. Determination if the executable name is `page' is now easy to see in source, and effect of using the name is mentioned in manual page. Rest of the change is trivial; exit values to compiler warning removals, magic constants to preprocessor definitions, symbolic exit values, comment pretty printing and #endif markups. [kzak@redhat.com: - coding style - add __unused__ attribute to signal handlers] Signed-off-by: Sami Kerola <kerolasa@iki.fi> Signed-off-by: Karel Zak <kzak@redhat.com>
* rename util-linux-ng back to util-linuxKarel Zak2010-11-301-1/+1
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* lib: [strutils] general purpose string handling functionsDavidlohr Bueso2010-11-231-1/+1
| | | | | | | | | | | | | This patch replaces a few functions used throughout the source: * Renames getnum (from schedutils) to strtol_or_err * Moves strtosize (from lib/strtosize.c) * Moves xstrncpy (from include/xstrncpy.h) * Adds strnlen, strnchr and strndup if not available (remove it from libmount utils) A few Makefile.am files were modified to compile accordingly along with trivial renaming in schedutils source code. Signed-off-by: Davidlohr Bueso <dave@gnu.org>