From c07ebfa1e02d208ab12430e6791ea147bcfaf9c0 Mon Sep 17 00:00:00 2001 From: Karel Zak Date: Thu, 7 Dec 2006 00:25:46 +0100 Subject: Imported from util-linux-2.11b tarball. --- text-utils/Makefile | 27 ++++++++++++++++----------- text-utils/README.clear | 7 +++++++ text-utils/README.reset | 20 ++++++++++++++++++++ text-utils/clear | 2 ++ text-utils/clear.1 | 31 +++++++++++++++++++++++++++++++ text-utils/col.c | 2 +- text-utils/colcrt.c | 2 +- text-utils/colrm.c | 2 +- text-utils/column.c | 2 +- text-utils/hexdump.c | 2 +- text-utils/hexsyntax.c | 2 +- text-utils/more.1 | 3 ++- text-utils/more.c | 11 +++++------ text-utils/odsyntax.c | 2 +- text-utils/parse.c | 2 +- text-utils/reset | 11 +++++++++++ text-utils/rev.c | 2 +- text-utils/ul.c | 2 +- 18 files changed, 104 insertions(+), 28 deletions(-) create mode 100644 text-utils/README.clear create mode 100644 text-utils/README.reset create mode 100755 text-utils/clear create mode 100644 text-utils/clear.1 create mode 100755 text-utils/reset (limited to 'text-utils') diff --git a/text-utils/Makefile b/text-utils/Makefile index 2cead324d..5018f6a6c 100644 --- a/text-utils/Makefile +++ b/text-utils/Makefile @@ -6,22 +6,23 @@ include ../make_include include ../MCONFIG -# Where to put man pages? - -MAN1= col.1 colcrt.1 colrm.1 column.1 hexdump.1 more.1 rev.1 - -# Where to put binaries? -# See the "install" rule for the links. . . - -BIN= more +MAN1= col.1 colcrt.1 colrm.1 column.1 hexdump.1 rev.1 USRBIN= col colcrt colrm column hexdump rev -MAYBE= ul +BIN= + +MAYBE= more ul ifeq "$(HAVE_NCURSES)" "yes" +BIN:=$(BIN) more USRBIN:=$(USRBIN) ul -MAN1:=$(MAN1) ul.1 +MAN1:=$(MAN1) ul.1 more.1 +else +ifeq "$(HAVE_TERMCAP)" "yes" +BIN:=$(BIN) more +MAN1:=$(MAN1) more.1 +endif endif # Where to put datebase files? @@ -38,7 +39,7 @@ ifeq "$(HAVE_NCURSES)" "yes" # Have ncurses - make more and ul more ul: $(CC) $(CFLAGS) $(LDFLAGS) $^ -o $@ $(LIBCURSES) -more: more.o +more: more.o $(LIB)/xstrncpy.o ul: ul.o else # Do not have ncurses - give up on ul @@ -71,9 +72,13 @@ column: column.o $(ERR_O) more.o: more.c $(LIB)/pathnames.h rev: rev.o +colcrt.o colrm.o column.o rev.o ul.o: $(LIB)/widechar.h + install install.shadow install.text-utils: all $(INSTALLDIR) $(BINDIR) $(USRBINDIR) $(MOREHELPDIR) $(MAN1DIR) +ifneq "$(BIN)" "" $(INSTALLBIN) $(BIN) $(BINDIR) +endif $(INSTALLBIN) $(USRBIN) $(USRBINDIR) $(INSTALLDAT) $(MOREHELP) $(MOREHELPDIR) $(INSTALLMAN) $(MAN1) $(MAN1DIR) diff --git a/text-utils/README.clear b/text-utils/README.clear new file mode 100644 index 000000000..7684132de --- /dev/null +++ b/text-utils/README.clear @@ -0,0 +1,7 @@ +RedHat and SuSE take the program clear from ncurses. + A 20KB program equivalent to "tput clear". + +Slackware uses the script. + +So, both versions will behave identically, and +Slackware saves 20 KB. diff --git a/text-utils/README.reset b/text-utils/README.reset new file mode 100644 index 000000000..8060d265d --- /dev/null +++ b/text-utils/README.reset @@ -0,0 +1,20 @@ +RedHat and SuSE take the program reset from ncurses, + where reset is a name for the program tset. + It is approximately equivalent to + stty sane; tputs rs1; tputs rs2; tputs rf + with `tputs rf' replaced by `tputs if' when there is an + init_file but no reset_file. In the comments it wonders + whether also sending rs3, rmacs, rmul, rmm might be a good idea. + +Slackware uses the small script given here. + The part `echo -e \\033c' is the canonical reset of the kernel + console status, and is equivalent to `tputs rs1' for a linux + terminal. + +So, both versions are approximately the same. + + +[A disadvantage of `echo -e \\033c' might be that it is potentially +wrong on a non-vt100, non-xterm, non-linux terminal. +An advantage is that there are terminfo entries for xterm around +that only use rs1=^O as reset, and then \Ec is much better.] diff --git a/text-utils/clear b/text-utils/clear new file mode 100755 index 000000000..73d1ebe1c --- /dev/null +++ b/text-utils/clear @@ -0,0 +1,2 @@ +#! /bin/sh +tput clear diff --git a/text-utils/clear.1 b/text-utils/clear.1 new file mode 100644 index 000000000..9d2082304 --- /dev/null +++ b/text-utils/clear.1 @@ -0,0 +1,31 @@ +.\" Copyright 1992 Rickard E. Faith (faith@cs.unc.edu) +.\" May be distributed under the GNU General Public License +.TH CLEAR 1 "10 October 1993" "Linux 0.99" "Linux Programmer's Manual" +.SH NAME +clear \- clear terminal screen +.SH SYNOPSIS +.BR clear +.SH DESCRIPTION +.B clear +calls +.BR tput (1) +with the +.I clear +argument. This causes +.B tput +to attempt to clear the screen checking the data in +.I /etc/termcap +(for the GNU or BSD +.BR tput ) +or in the terminfo database +(for the +.B ncurses +.BR tput ) +and sending the appropriate sequence to the terminal. This command can be +redirected to clear the screen of some other terminal. +.SH "SEE ALSO" +.BR reset (1), +.BR stty (1), +.BR tput (1) +.SH AUTHOR +Rik Faith (faith@cs.unc.edu) diff --git a/text-utils/col.c b/text-utils/col.c index 2e1552a7a..0a875af3d 100644 --- a/text-utils/col.c +++ b/text-utils/col.c @@ -37,7 +37,7 @@ * patches from Andries.Brouwer@cwi.nl * Wed Sep 14 22:31:17 1994: patches from Carl Christofferson * (cchris@connected.com) - * 1999-02-22 Arkadiusz Mi¶kiewicz + * 1999-02-22 Arkadiusz Mi¶kiewicz * added Native Language Support * 1999-09-19 Bruno Haible * modified to work correctly in multi-byte locales diff --git a/text-utils/colcrt.c b/text-utils/colcrt.c index efb176f31..891fd86db 100644 --- a/text-utils/colcrt.c +++ b/text-utils/colcrt.c @@ -32,7 +32,7 @@ */ /* - * 1999-02-22 Arkadiusz Mi¶kiewicz + * 1999-02-22 Arkadiusz Mi¶kiewicz * added Native Language Support * 1999-09-19 Bruno Haible * modified to work correctly in multi-byte locales diff --git a/text-utils/colrm.c b/text-utils/colrm.c index 1b90fe4ab..9ef8af679 100644 --- a/text-utils/colrm.c +++ b/text-utils/colrm.c @@ -32,7 +32,7 @@ */ /* - * 1999-02-22 Arkadiusz Mi¶kiewicz + * 1999-02-22 Arkadiusz Mi¶kiewicz * added Native Language Support * 1999-09-19 Bruno Haible * modified to work correctly in multi-byte locales diff --git a/text-utils/column.c b/text-utils/column.c index 79ebb115b..3a54fe054 100644 --- a/text-utils/column.c +++ b/text-utils/column.c @@ -32,7 +32,7 @@ */ /* - * 1999-02-22 Arkadiusz Mi¶kiewicz + * 1999-02-22 Arkadiusz Mi¶kiewicz * added Native Language Support * 1999-09-19 Bruno Haible * modified to work correctly in multi-byte locales diff --git a/text-utils/hexdump.c b/text-utils/hexdump.c index c18c61505..82eb4d512 100644 --- a/text-utils/hexdump.c +++ b/text-utils/hexdump.c @@ -31,7 +31,7 @@ * SUCH DAMAGE. */ - /* 1999-02-22 Arkadiusz Mi¶kiewicz + /* 1999-02-22 Arkadiusz Mi¶kiewicz * - added Native Language Support */ diff --git a/text-utils/hexsyntax.c b/text-utils/hexsyntax.c index e376b0664..154289da5 100644 --- a/text-utils/hexsyntax.c +++ b/text-utils/hexsyntax.c @@ -31,7 +31,7 @@ * SUCH DAMAGE. */ - /* 1999-02-22 Arkadiusz Mi¶kiewicz + /* 1999-02-22 Arkadiusz Mi¶kiewicz * - added Native Language Support */ diff --git a/text-utils/more.1 b/text-utils/more.1 index 0853dcd90..0a5fa47aa 100644 --- a/text-utils/more.1 +++ b/text-utils/more.1 @@ -36,7 +36,8 @@ .\" 25Dec92: Extensive changes made by Rik Faith (faith@cs.unc.edu) to .\" conform with the more 5.19 currently in use by the Linux community. .\" -.Dd July 29, 1991 (Modified December 25, 1992) +.\" .Dd July 29, 1991 (Modified December 25, 1992) +.Dd December 25, 1992 .Dt MORE 1 .Os "Linux 0.98" .Sh NAME diff --git a/text-utils/more.c b/text-utils/more.c index 79dc626dd..ac62d070c 100644 --- a/text-utils/more.c +++ b/text-utils/more.c @@ -26,7 +26,7 @@ ** on linux/axp. ** modified by Kars de Jong to use terminfo instead ** of termcap. - 1999-02-22 Arkadiusz Mi¶kiewicz + 1999-02-22 Arkadiusz Mi¶kiewicz - added Native Language Support 1999-03-19 Arnaldo Carvalho de Melo - more nls translatable strings @@ -55,6 +55,7 @@ #include #include #include +#include "xstrncpy.h" #include "nls.h" #define _REGEX_RE_COMP @@ -1786,14 +1787,12 @@ retry: if ((padstr = my_tgetstr("pc","pad")) != NULL) PC = *padstr; Home = my_tgetstr("ho","home"); - if (Home == 0 || *Home == '\0') - { + if (Home == 0 || *Home == '\0') { if ((cursorm = my_tgetstr("cm","cup")) != NULL) { const char *t = (const char *)my_tgoto(cursorm, 0, 0); - strncpy(cursorhome, t, sizeof(cursorhome)); - cursorhome[sizeof(cursorhome)-1] = 0; + xstrncpy(cursorhome, t, sizeof(cursorhome)); Home = cursorhome; - } + } } EodClr = my_tgetstr("cd","ed"); if ((chBS = my_tgetstr("le","cub1")) == NULL) diff --git a/text-utils/odsyntax.c b/text-utils/odsyntax.c index 74d724e19..13f7dfa7e 100644 --- a/text-utils/odsyntax.c +++ b/text-utils/odsyntax.c @@ -31,7 +31,7 @@ * SUCH DAMAGE. */ - /* 1999-02-22 Arkadiusz Mi¶kiewicz + /* 1999-02-22 Arkadiusz Mi¶kiewicz * - added Native Language Support */ diff --git a/text-utils/parse.c b/text-utils/parse.c index f96a68e81..ce57c071c 100644 --- a/text-utils/parse.c +++ b/text-utils/parse.c @@ -31,7 +31,7 @@ * SUCH DAMAGE. */ - /* 1999-02-22 Arkadiusz Mi¶kiewicz + /* 1999-02-22 Arkadiusz Mi¶kiewicz * - added Native Language Support */ diff --git a/text-utils/reset b/text-utils/reset new file mode 100755 index 000000000..fb9834db2 --- /dev/null +++ b/text-utils/reset @@ -0,0 +1,11 @@ +#!/bin/sh +stty sane +tput clear +tput rmacs +tput rmm +tput rmso +tput rmul +tput rs1 +tput rs2 +tput rs3 +echo -e \\033c diff --git a/text-utils/rev.c b/text-utils/rev.c index a5697b462..29b8ee528 100644 --- a/text-utils/rev.c +++ b/text-utils/rev.c @@ -37,7 +37,7 @@ * last line that has no newline correctly. * 3-Jun-1998: Patched by Nicolai Langfeldt to work better on Linux: * Handle any-length-lines. Code copied from util-linux' setpwnam.c - * 1999-02-22 Arkadiusz Mi¶kiewicz + * 1999-02-22 Arkadiusz Mi¶kiewicz * added Native Language Support * 1999-09-19 Bruno Haible * modified to work correctly in multi-byte locales diff --git a/text-utils/ul.c b/text-utils/ul.c index 570c4f47d..fb0a697d1 100644 --- a/text-utils/ul.c +++ b/text-utils/ul.c @@ -34,7 +34,7 @@ /* * modified by Kars de Jong * to use terminfo instead of termcap. - * 1999-02-22 Arkadiusz Mi¶kiewicz + * 1999-02-22 Arkadiusz Mi¶kiewicz * added Native Language Support * 1999-09-19 Bruno Haible * modified to work correctly in multi-byte locales -- cgit v1.2.3-55-g7522