summaryrefslogtreecommitdiffstats
path: root/text-utils
Commit message (Collapse)AuthorAgeFilesLines
* 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>
* tailf: inotify based reimplementationKarel Zak2007-12-172-84/+160
| | | | | | | | | This patch: - clean up tailf(1) code - remove stupid "for() { malloc() }" array allocation in the tailf() function - add inotify(7) support Signed-off-by: Karel Zak <kzak@redhat.com>
* more: non-linux supportSamuel Thibault2007-11-081-4/+0Star
| | | | Signed-Off-By: Samuel Thibault <samuel.thibault@ens-lyon.org>
* more: cleanup gcc warningsRandy Dunlap2007-11-051-8/+8
| | | | | | | | | | | | | | | Fix strict gcc warnings that come from using: ("-Wall -Wp,-D_FORTIFY_SOURCE=2") more.c:185: warning: passing argument 1 of 'setupterm' discards qualifiers from pointer target type more.c:205: warning: passing argument 1 of 'tparm' discards qualifiers from pointer target type more.c:812: warning: pointer targets in passing argument 2 of 'mbrtowc' differ in signedness more.c:931: warning: pointer targets in passing argument 2 of 'mbrtowc' differ in signedness more.c:1285: warning: pointer targets in passing argument 1 of 'ttyin' differ in signedness more.c:1486: warning: pointer targets in passing argument 1 of 'ttyin' differ in signedness more.c:1879: warning: pointer targets in passing argument 2 of 'mbrtowc' differ in signedness Signed-off-by: Randy Dunlap <randy.dunlap@oracle.com>
* tailf: opened file leaving unclosedlizf2007-10-261-0/+2
| | | | Signed-off-by: Li Zefan <lizf@cn.fujitsu.com>
* rev: use warn() in errs.hLi Zefan2007-10-251-21/+8Star
| | | | | | | | The function warn() in rev.c is actually duplicate code, so here we remove it. Signed-off-by: Li Zefan <lizf@cn.fujitsu.com> Signed-off-by: Karel Zak <kzak@redhat.com>
* tailf: replace errs.h with libc err.hKarel Zak2007-10-181-21/+13Star
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* column: replace errs.h with libc err.hKarel Zak2007-10-161-4/+4
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* tailf: add option -n to specifying output linesLi Zefan2007-10-112-10/+36
| | | | | | | | | | | | | | It will be useful if we can print out the last n lines instead of the last 10, just like tail. There are examples: tailf -n 5 file1 tailf --lines 10 file2 tailf -20 file3 Signed-off-by: Li Zefan <lizf@cn.fujitsu.com> Signed-off-by: Karel Zak <kzak@redhat.com>
* tailf: clean up gcc warnings & fix use of errnoKarel Zak2007-10-111-7/+13
| | | | | | | | | | | | | | | | | Fix strict gcc warnings in tailf that come from using: ("-Wall -Wp,-D_FORTIFY_SOURCE=2") tailf.c:111: warning: ignoring return value of 'fwrite', declared with attribute warn_unused_result Also, tailf uses perror() for error reporting, but it inserts an fprintf call first, so perror() is actually reporting the result of the fprintf() call, not the failing call; change the code to print the message by using strerror() instead. Builds cleanly on x86_32 and x86_64. Signed-off-by: Randy Dunlap <randy.dunlap@oracle.com> Signed-off-by: Karel Zak <kzak@redhat.com>
* pg: fix segfault on searchRajeev V. Pillai2007-10-031-1/+1
| | | | | | | | | Run pg(1) and type '/<CR>' which is supposed to forward search for the previously remembered search string. pg(1) will segfault after printing "No remembered search string:". Signed-off-by: Rajeev V. Pillai <rajeevvp@gmail.com> Signed-off-by: Karel Zak <kzak@redhat.com>
* build-sys: nls/locale handling in util-linux-ng generalMike Frysinger2007-09-193-4/+1Star
| | | | | | | | | | | | | | | On Monday 03 September 2007, Karel Zak wrote: > http://thread.gmane.org/gmane.linux.utilities.util-linux-ng/590/focus=592 > > I agree that we need a better support for compilation without > locales, but from my point of view NLS != all locales stuff. The NLS > support is subset only. thinking about the input from everyone, i'd propose the attached ... Only pull in locale.h as needed and move it to the common nls.h. Signed-off-by: Mike Frysinger <vapier@gentoo.org>
* more: fix underlining for multibyte charsKarel Zak2007-08-141-0/+16
| | | | | | | | | | Try: $ printf "aaa _\bŽ_\bŽ_\bŽ bbb\n" | more aaa ŽŽŽ bbb (ŽŽŽ has to be three underlined chars on terminal). Signed-off-by: Karel Zak <kzak@redhat.com>
* manpage typosLaMont Jones2007-07-241-2/+2
| | | | Signed-off-by: LaMont Jones <lamont@mmjgroup.com>
* man pages: add "AVAILABILITY" sectionKarel Zak2007-07-0312-1/+37
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* build-sys: fix linking when ncurses is built with --with-termlib=tinfoArkadiusz Miskiewicz2007-07-021-0/+6
| | | | | | | | | | When system ncurses is built with --with-termlib=tinfo option then there are two libraries - libtinfo (which contains terminal related functions) and libncurses (rest). Correctly link against libtinfo in such case. Signed-off-by: Arkadiusz Miskiewicz <arekm@maven.pl>
* text-utils: fix the more command compilation against termcapKarel Zak2007-06-051-3/+44
| | | | | | | The build-sys (text-utils/Makefile.am) allows to compile against ncurses and termcap. The termcap version is broken in more.c. Signed-off-by: Karel Zak <kzak@redhat.com>
* build-sys: do not use wildcards in EXTRA_DISTStepan Kasal2007-05-161-1/+3
| | | | | | | Wildcards in EXTRA_DIST break "make dist" for vpath build. But plain directory names are ok. Signed-off-by: Stepan Kasal <skasal@redhat.com>
* build-sys: fix README filenames and add missing files to EXTRA_DISTsKarel Zak2007-02-083-32/+1Star
| | | | | | Also, the patch makes "make mrproper" more robust. Signed-off-by: Karel Zak <kzak@redhat.com>
* col: getwchar() errors shouldn't be hiddenKarel Zak2007-01-301-3/+12
| | | | | | | | The col truncates output when multibyte errors is detected, but the problem is not reported to stderr and return code is still same like for successful exit. This stupid behaviour is fixed by this patch. Signed-off-by: Karel Zak <kzak@redhat.com>
* build-sys: fix ifdef ENABLE_WIDECHAR usageKarel Zak2007-01-304-15/+15
| | | | | | | | There has been unexpected mix of HAVE_WIDECHAR and ENABLE_WIDECHAR macros. The ENABLE_WIDECHAR is old version and has to be replaced everywhere otherwise we will see bugs with multibyte stuff. Signed-off-by: Karel Zak <kzak@redhat.com>
* hexdump: don't use memset with zero lenghtKarel Zak2007-01-171-1/+2
| | | | | | gcc 4.1.0: "warning: memset used with constant zero length parameter...." Signed-off-by: Karel Zak <kzak@redhat.com>
* more: fix file descriptor leakKarel Zak2007-01-041-0/+2
| | | | | | | | | | | When you view a file with the more command and run a shell, the file descriptor for reading the file is leaked to that process. To test, more any file. Then do !/bin/sh. At the prompt do "ls -l /proc/$$/fd" and you'll see the leaked fd. From: Steve Grubb <sgrubb@redhat.com> Signed-off-by: Karel Zak <kzak@redhat.com>
* build-sys: add missing filesKarel Zak2007-01-041-1/+4
| | | | | | | This patch add all missing headers, man pages and README files to automake stuff and "make dist-gzip" produces useful tarball now. Signed-off-by: Karel Zak <kzak@redhat.com>