Commit graph

20 commits

Author SHA1 Message Date
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
b87cbe8486 text-utils: verify writing to streams was successful
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2012-04-04 19:45:41 +02:00
Sami Kerola
397f499613 pg: align with howto-usage-function.txt
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2012-03-30 16:48:12 +02:00
Sami Kerola
b6415f1243 pg: correct version printing in help screen
Commit also adds -V option.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2012-03-30 16:48:12 +02:00
Karel Zak
f144a2f543 pg: fix write_all() usage
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-08-17 00:30:13 +02:00
Karel Zak
ba14e04d72 pg: fix compiler warnings [-Wunused-result]
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-08-02 13:55:30 +02:00
Sami Kerola
a699625d79 pg: return value warning fix
void function 'makeprint' should not return void expression

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2011-06-01 09:07:54 +02:00
Sami Kerola
f13616a064 pg: use size_t for wcstombs() return code
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2011-06-01 09:07:47 +02:00
Davidlohr Bueso
f3a342a429 pg: use xalloc for memory allocation
Signed-off-by: Davidlohr Bueso <dave@gnu.org>
2010-11-01 14:03:08 +01:00
Mike Frysinger
45b1087e74 pg: command enters infinite loop
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>
2010-01-04 09:49:23 +01:00
Peter Breitenlohner
d5004be1f5 pg: compiler warning with NLS disabled
Signed-off-by: Peter Breitenlohner <peb@mppmu.mpg.de>
2009-07-20 15:23:40 +02:00
Karel Zak
126836e852 pg: add gettext call for the help string
Signed-off-by: Karel Zak <kzak@redhat.com>
2008-12-12 15:13:44 +01:00
Pedro Ribeiro
7c7f4ff8e0 pg: several strings without gettext calls
Signed-off-by: Pedro Ribeiro <p.m42.ribeiro@gmail.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
2008-10-03 09:31:44 +02:00
Rajeev V. Pillai
2b00dd6d54 pg: fix segfault on search
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>
2007-10-03 22:39:27 +02:00
Mike Frysinger
8b7f16fc37 build-sys: nls/locale handling in util-linux-ng general
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>
2007-09-19 23:15:21 +02:00
Karel Zak
06b04b23cd build-sys: fix ifdef ENABLE_WIDECHAR usage
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>
2007-01-30 13:49:50 +01:00
Karel Zak
48d7b13a1e Imported from util-linux-2.13-pre1 tarball. 2006-12-07 00:26:54 +01:00
Karel Zak
a5a16c6853 Imported from util-linux-2.11y tarball. 2006-12-07 00:26:08 +01:00
Karel Zak
0e6f4a203d Imported from util-linux-2.11v tarball. 2006-12-07 00:26:02 +01:00
Karel Zak
63cccae468 Imported from util-linux-2.11t tarball. 2006-12-07 00:25:58 +01:00