summaryrefslogtreecommitdiffstats
path: root/text-utils
Commit message (Collapse)AuthorAgeFilesLines
* hexdump: remove od functionality in favor to GNU coreutils odSami Kerola2010-12-306-358/+8Star
| | | | Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* rename util-linux-ng back to util-linuxKarel Zak2010-11-3013-25/+25
| | | | 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>
* column: segfault on empty inputKarel Zak2010-11-041-2/+4
| | | | | Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=579955 Signed-off-by: Karel Zak <kzak@redhat.com>
* rev: use xalloc for memory allocationDavidlohr Bueso2010-11-011-3/+2Star
| | | | Signed-off-by: Davidlohr Bueso <dave@gnu.org>
* ul: use xalloc for memory allocationDavidlohr Bueso2010-11-011-7/+4Star
| | | | Signed-off-by: Davidlohr Bueso <dave@gnu.org>
* col: use err.h and EXIT_* macrosKarel Zak2010-11-011-27/+23Star
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* col: use xalloc for memory allocationDavidlohr Bueso2010-11-011-27/+11Star
| | | | | | Differentiate between malloc and realloc (not done so far) and get rid of local warn() Signed-off-by: Davidlohr Bueso <dave@gnu.org>
* tailf: use xalloc for memory allocationDavidlohr Bueso2010-11-011-2/+3
| | | | Signed-off-by: Davidlohr Bueso <dave@gnu.org>
* more: use xalloc for memory allocationDavidlohr Bueso2010-11-011-10/+6Star
| | | | Signed-off-by: Davidlohr Bueso <dave@gnu.org>
* pg: use xalloc for memory allocationDavidlohr Bueso2010-11-011-17/+3Star
| | | | Signed-off-by: Davidlohr Bueso <dave@gnu.org>
* remove free() from atexit() callbacksKarel Zak2010-10-291-7/+0Star
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* use _exit() instead of exit() in sighandlersMarek Polacek2010-10-292-2/+2
| | | | Signed-off-by: Marek Polacek <mmpolacek@gmail.com>
* column: code readability improvementsSami Kerola2010-10-211-53/+57
| | | | Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* column: error messaging & exit codesSami Kerola2010-10-211-8/+12
| | | | | | | Human understandable error messages along with symbolic exit codes to comply with coding standard. Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* column: EOF handling bugSami Kerola2010-10-211-2/+3
| | | | | | | | | | | | | | | | | | For the last line of the file lenght of line should be determined where the EOF is instead of new line. Old output was $ printf "1 2\n3" | column -t column: line too long 1 2 which this commit will change to $ printf "1 2\n3" | column -t 1 2 3 Signed-off-by: Sami Kerola <kerolasa@iki.fi> Signed-off-by: Karel Zak <kzak@redhat.com>
* column: update manual page to match column switchesSami Kerola2010-10-071-63/+36Star
| | | | | Signed-off-by: Sami Kerola <kerolasa@iki.fi> Signed-off-by: Karel Zak <kzak@redhat.com>
* column: getopt_long and new help outputSami Kerola2010-10-071-14/+36
| | | | | | | [kzak@redhat.com: - remove __progname, cleanup usage()] Signed-off-by: Sami Kerola <kerolasa@iki.fi> Signed-off-by: Karel Zak <kzak@redhat.com>
* ul: use atexit() to deallocate buffer, print errors by err()Karel Zak2010-09-171-35/+25Star
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* ul: fix memory leak.Davidlohr Bueso2010-09-171-1/+22
| | | | | | | | | | The 'obuf' variable is not being freed after usage and this includes when SIGINTs occur, hence add some basic signal handling. [kzak@redhat.com - remove if-before-free ] Signed-off-by: Davidlohr Bueso <dave@gnu.org> Signed-off-by: Karel Zak <kzak@redhat.com>
* tailf: fixed timing issue that could cause duplicate data outputDima Kogan2010-08-201-1/+10
| | | | | | | | | | | | | | The issue is that in roll_file() we fstat() to find the file size, then read() as much data as we can and then use the previously saved file size to mark our position. The bug occurs if we read past the file size reported by fstat() because more data has arrived while we were reading it. The attached patch uses the current file position as the location marker instead, with some extra logic to handle tailing truncated files. [kzak@redhat.com: - fix coding style] Signed-off-by: Dima Kogan <dkogan@cds.caltech.edu> Signed-off-by: Karel Zak <kzak@redhat.com>
* rev: coding style, various fixesDavidlohr Bueso2010-08-201-85/+110
| | | | | | | | | | | | | | * Change indentation to 8 characters and coding style, for better reading the code. * Add some memory allocation error handling. * Fix memory leaks. In cases when Ctrl-C is used to exit the program, 'p' cannot be freed, so made it a global var, to share between main() and sig_handler(). Signal handing is necessary to fix some leaks, so added a very basic, non invasive, mechanism. Signed-off-by: Davidlohr Bueso <dave@gnu.org> Signed-off-by: Karel Zak <kzak@redhat.com>
* portability: use standard constantsFrançois Revol2010-07-261-0/+4
| | | | | Signed-off-by: François Revol <revol@free.fr> Signed-off-by: Karel Zak <kzak@redhat.com>
* pg: command enters infinite loopMike Frysinger2010-01-041-1/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | In a multibyte locale such as en_GB.UTF-8, the pg command cannot handle files containing a form feed character (ASCII 0x0c) at the start of a line. The program enters an infinite loop. I've traced the problem to the function endline_for_mb in file pg.c. The code assumes that the libc function wcwidth will return a nonnegative value, which is not true for a form feed character. wcwidth returns -1 and the unsigned variable "pos" goes into underflow. I'll attach a patch which tests whether the character is printable before calling wcwidth. If not, it uses instead the width of the constant L'?' which is later used to replace nonprintable characters. I trust that we can assume printability of this constant :-) Steps to Reproduce: 1. Select a multibyte locale (tested with en_GB.UTF-8) 2. Create a file with a form feed character (0x0c) at the start of a line. 3. Try to display this file using the pg command. Reported-by: Mark Calderbank <m.calderbank@iname.com> Reported-by: Mike Frysinger <vapier@gentoo.org> Addresses: https://bugs.gentoo.org/297717 Signed-off-by: Karel Zak <kzak@redhat.com>
* po: fix msgid bugsKarel Zak2009-12-101-1/+1
| | | | | Reported-by: Petr Pisar <petr.pisar@atlas.cz> Signed-off-by: Karel Zak <kzak@redhat.com>
* hexdump: bug in hexdump when offset == file lengthAmérico Wang2009-12-011-1/+1
| | | | | | | | | | | | | | | | | | | On Thu, Nov 26, 2009 at 03:42:21AM -0500, Mike Smith wrote: >[mike@laptop ~]$ dd if=/dev/urandom of=testfile bs=1 count=42 >42+0 records in >42+0 records out >42 bytes (42 B) copied, 0.000216179 s, 194 kB/s >[mike@laptop ~]$ hexdump -Cv testfile -s 42 >0000002a bb b0 ba 50 fe 70 f8 d9 f7 96 36 49 e9 74 c7 bd |...P.p....6I.t..| >0000003a 82 cb 19 64 a6 30 53 29 d2 fa 08 e3 f4 26 7f de |...d.0S).....&..| >0000004a bb 2c f2 df 7c a7 8c 6e 66 01 |.,..|..nf.| >00000054 >[mike@laptop ~]$ hexdump -Cv testfile -s 43 >0000002a I think I got where the bug is, it's an off-by-one problem... Signed-off-by: WANG Cong <xiyou.wangcong@gmail.com>
* tailf: fix printf formatMike Frysinger2009-11-231-1/+1
| | | | | | | ssize_t types are shown with %zd, not %ld. Reviewed-by: WANG Cong <xiyou.wangcong@gmail.com> Signed-off-by: Mike Frysinger <vapier@gentoo.org>
* line: remove deprecated #ident directiveKarel Zak2009-11-201-2/+0Star
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* more: limited line buffer length results in corrupted UTF-8 textKarel Zak2009-11-161-7/+43
| | | | | | Addresses-Debian-Bug: #552608 Reported-By: Roger Leigh <rleigh@debian.org> Signed-off-by: Karel Zak <kzak@redhat.com>
* replace usleep() for systems that don't have themDaniel Mierswa2009-08-211-0/+1
| | | | | | | | | This function is marked obsolete in POSIX.1-2001 and removed in POSIX.1-2008. Conditionally replaced with nanosleep(). Signed-off-by: Daniel Mierswa <impulze@impulze.org>
* pg.1: formattingPeter Breitenlohner2009-08-171-15/+11Star
| | | | Signed-off-by: Peter Breitenlohner <peb@mppmu.mpg.de>
* more.1: formattingPeter Breitenlohner2009-08-171-3/+3
| | | | Signed-off-by: Peter Breitenlohner <peb@mppmu.mpg.de>
* ul.1: erroneous .SH instead of .ShPeter Breitenlohner2009-08-171-2/+2
| | | | Signed-off-by: Peter Breitenlohner <peb@mppmu.mpg.de>
* hexdump.1: erroneous .Nm ""Peter Breitenlohner2009-08-171-9/+9
| | | | Signed-off-by: Peter Breitenlohner <peb@mppmu.mpg.de>
* replace bcopy,bzero,index and rindexDaniel Mierswa2009-08-174-8/+8
| | | | | | | | | Those 4 functions are marked as LEGACY in POSIX.1-2001 and removed in POSIX.1-2008. Replaced with memmove,memset,strchr and strrchr. Signed-off-by: Daniel Mierswa <impulze@impulze.org>
* tailf: report inotify_add_watch() problemsKarel Zak2009-08-111-1/+11
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* pg: compiler warning with NLS disabledPeter Breitenlohner2009-07-201-2/+2
| | | | Signed-off-by: Peter Breitenlohner <peb@mppmu.mpg.de>
* build-sys: rename to _execdirKarel Zak2009-07-041-2/+2
| | | | | | | | | | | | The variable name "usrlibexecdir" is very confusing (because we have /usr/libexec). The "exec" prefix is required for user-defined directories, see http://www.gnu.org/software/hello/manual/automake/The-Two-Parts-of-Install.html#The-Two-Parts-of-Install This patch renames all usr*execdir variables to usr*_execdir. Signed-off-by: Karel Zak <kzak@redhat.com>
* pg: add gettext call for the help stringKarel Zak2008-12-121-2/+6
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* tailf: unistd.h is included more than onceKarel Zak2008-11-261-1/+0Star
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* pg: several strings without gettext callsPedro Ribeiro2008-10-031-5/+5
| | | | | Signed-off-by: Pedro Ribeiro <p.m42.ribeiro@gmail.com> Signed-off-by: Karel Zak <kzak@redhat.com>
* remove CVS keywordsmaximilian attems2008-07-281-1/+0Star
| | | | | | | | this patch removes old CVS keywords from comments. mount(8) works for newer Linux then 0.99 ;) Signed-off-by: maximilian attems <max@stro.at>
* more: dont use a.out.hMike Frysinger2008-06-161-4/+3Star
| | | | | | | | The a.out.h header is not friendly to portable systems (iow, those that lack a.out support), and since the defines are only used in a cheesy magic, just use the magic constants. It's not like they're ever going to change. Signed-off-by: Mike Frysinger <vapier@gentoo.org>
* more: minor fixes to magic()James Youngman2008-06-161-5/+5
| | | | | | | | | Read the magic bytes into signed chars instead of vanilla chars in order to ensure consistent results even on systems whose char type has no sign. Eliminate spurious parentheses in return statements. Correct grammatical errors in comments. Signed-off-by: James Youngman <jay@gnu.org>
* more: use HAVE_WIDECHAR instead ENABLE_WIDECHARKarel Zak2008-04-161-2/+2
| | | | | | This problem has been detected by tools/codecheck-config. Signed-off-by: Karel Zak <kzak@redhat.com>
* build-sys: ignore a bunch of generated files, mostly binariesJames Youngman2008-04-141-0/+11
| | | | | Signed-off-by: James Youngman <jay@gnu.org> Signed-off-by: Karel Zak <kzak@redhat.com>
* build-sys: use ncursesw (wide version) when possibeKarel Zak2008-03-201-4/+4
| | | | | | | | | | Detect ncursesw and use it in place of ncurses when possible (default). Allow people to use classic (non-wide) version by --with-ncurses or disable all ncurses/ncursesw support by --without-ncurses. Co-Author: Mike Frysinger <vapier@gentoo.org> Signed-off-by: Karel Zak <kzak@redhat.com>
* more: replace CBAUD with cfgetispeed()Samuel Thibault2008-01-031-1/+1
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* tailf: non-linux supportSamuel Thibault2007-12-181-0/+2
| | | | | | Include <sys/inotify.h> only when inotify_init() was detected Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
* build-sys: use dist_man_MANS instead of man_MANSStepan Kasal2007-12-171-3/+3
| | | | Signed-off-by: Stepan Kasal <skasal@redhat.com>