Localize it
This commit is contained in:
parent
8b0f80aa08
commit
5ff251c82d
@ -50,7 +50,7 @@
|
||||
.Bk -words
|
||||
.Op Fl Ar column
|
||||
.Ek
|
||||
.Op Fl adFmrt
|
||||
.Op Fl adFLmrt
|
||||
.Bk -words
|
||||
.Oo
|
||||
.Op Fl e
|
||||
@ -218,6 +218,8 @@ If any nondigit character,
|
||||
is specified, it is used as the output
|
||||
.Em <tab>
|
||||
character.
|
||||
.It Fl L
|
||||
Do not use time locale for header.
|
||||
.It Fl l Ar lines
|
||||
Override the 66 line default and reset the page length to
|
||||
.Ar lines .
|
||||
|
@ -33,6 +33,8 @@
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $FreeBSD$
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
@ -51,6 +53,7 @@ static char sccsid[] = "@(#)pr.c 8.2 (Berkeley) 4/16/94";
|
||||
|
||||
#include <ctype.h>
|
||||
#include <errno.h>
|
||||
#include <locale.h>
|
||||
#include <signal.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
@ -1557,7 +1560,7 @@ void
|
||||
usage()
|
||||
{
|
||||
(void)fputs(
|
||||
"usage: pr [+page] [-col] [-adFmrt] [-e[ch][gap]] [-h header]\n",err);
|
||||
"usage: pr [+page] [-col] [-adFLmrt] [-e[ch][gap]] [-h header]\n",err);
|
||||
(void)fputs(
|
||||
" [-i[ch][gap]] [-l line] [-n[ch][width]] [-o offset]\n",err);
|
||||
(void)fputs(
|
||||
@ -1578,6 +1581,7 @@ setup(argc, argv)
|
||||
int iflag = 0;
|
||||
int wflag = 0;
|
||||
int cflag = 0;
|
||||
int Lflag = 0;
|
||||
|
||||
if (isatty(fileno(stdout))) {
|
||||
/*
|
||||
@ -1589,7 +1593,7 @@ setup(argc, argv)
|
||||
}
|
||||
} else
|
||||
err = stderr;
|
||||
while ((c = egetopt(argc, argv, "#adFmrte?h:i?l:n?o:s?w:")) != -1) {
|
||||
while ((c = egetopt(argc, argv, "#adFmrte?h:i?Ll:n?o:s?w:")) != -1) {
|
||||
switch (c) {
|
||||
case '+':
|
||||
if ((pgnm = atoi(eoptarg)) < 1) {
|
||||
@ -1614,11 +1618,11 @@ setup(argc, argv)
|
||||
break;
|
||||
case 'e':
|
||||
++eflag;
|
||||
if ((eoptarg != NULL) && !isdigit(*eoptarg))
|
||||
if ((eoptarg != NULL) && !isdigit((unsigned char)*eoptarg))
|
||||
inchar = *eoptarg++;
|
||||
else
|
||||
inchar = INCHAR;
|
||||
if ((eoptarg != NULL) && isdigit(*eoptarg)) {
|
||||
if ((eoptarg != NULL) && isdigit((unsigned char)*eoptarg)) {
|
||||
if ((ingap = atoi(eoptarg)) < 0) {
|
||||
(void)fputs(
|
||||
"pr: -e gap must be 0 or more\n", err);
|
||||
@ -1641,11 +1645,11 @@ setup(argc, argv)
|
||||
break;
|
||||
case 'i':
|
||||
++iflag;
|
||||
if ((eoptarg != NULL) && !isdigit(*eoptarg))
|
||||
if ((eoptarg != NULL) && !isdigit((unsigned char)*eoptarg))
|
||||
ochar = *eoptarg++;
|
||||
else
|
||||
ochar = OCHAR;
|
||||
if ((eoptarg != NULL) && isdigit(*eoptarg)) {
|
||||
if ((eoptarg != NULL) && isdigit((unsigned char)*eoptarg)) {
|
||||
if ((ogap = atoi(eoptarg)) < 0) {
|
||||
(void)fputs(
|
||||
"pr: -i gap must be 0 or more\n", err);
|
||||
@ -1660,8 +1664,11 @@ setup(argc, argv)
|
||||
} else
|
||||
ogap = OGAP;
|
||||
break;
|
||||
case 'L':
|
||||
Lflag++;
|
||||
break;
|
||||
case 'l':
|
||||
if (!isdigit(*eoptarg) || ((lines=atoi(eoptarg)) < 1)) {
|
||||
if (!isdigit((unsigned char)*eoptarg) || ((lines=atoi(eoptarg)) < 1)) {
|
||||
(void)fputs(
|
||||
"pr: Number of lines must be 1 or more\n",err);
|
||||
return(1);
|
||||
@ -1671,11 +1678,11 @@ setup(argc, argv)
|
||||
++merge;
|
||||
break;
|
||||
case 'n':
|
||||
if ((eoptarg != NULL) && !isdigit(*eoptarg))
|
||||
if ((eoptarg != NULL) && !isdigit((unsigned char)*eoptarg))
|
||||
nmchar = *eoptarg++;
|
||||
else
|
||||
nmchar = NMCHAR;
|
||||
if ((eoptarg != NULL) && isdigit(*eoptarg)) {
|
||||
if ((eoptarg != NULL) && isdigit((unsigned char)*eoptarg)) {
|
||||
if ((nmwd = atoi(eoptarg)) < 1) {
|
||||
(void)fputs(
|
||||
"pr: -n width must be 1 or more\n",err);
|
||||
@ -1689,7 +1696,7 @@ setup(argc, argv)
|
||||
nmwd = NMWD;
|
||||
break;
|
||||
case 'o':
|
||||
if (!isdigit(*eoptarg) || ((offst = atoi(eoptarg))< 1)){
|
||||
if (!isdigit((unsigned char)*eoptarg) || ((offst = atoi(eoptarg))< 1)){
|
||||
(void)fputs("pr: -o offset must be 1 or more\n",
|
||||
err);
|
||||
return(1);
|
||||
@ -1715,7 +1722,7 @@ setup(argc, argv)
|
||||
break;
|
||||
case 'w':
|
||||
++wflag;
|
||||
if (!isdigit(*eoptarg) || ((pgwd = atoi(eoptarg)) < 1)){
|
||||
if (!isdigit((unsigned char)*eoptarg) || ((pgwd = atoi(eoptarg)) < 1)){
|
||||
(void)fputs(
|
||||
"pr: -w width must be 1 or more \n",err);
|
||||
return(1);
|
||||
@ -1810,5 +1817,8 @@ setup(argc, argv)
|
||||
}
|
||||
|
||||
timefrmt = TIMEFMT;
|
||||
if (!Lflag)
|
||||
(void) setlocale(LC_TIME, "");
|
||||
|
||||
return(0);
|
||||
}
|
||||
|
@ -35,6 +35,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)pr.h 8.1 (Berkeley) 6/6/93
|
||||
* $FreeBSD$
|
||||
*/
|
||||
|
||||
/*
|
||||
@ -58,7 +59,7 @@
|
||||
#define HDFMT "%s %s Page %d\n\n\n"
|
||||
#define HEADLEN 5
|
||||
#define TAILLEN 5
|
||||
#define TIMEFMT "%b %e %H:%M %Y"
|
||||
#define TIMEFMT "%Ex %H:%M %Y"
|
||||
#define FNAME ""
|
||||
#define LBUF 8192
|
||||
#define HDBUF 512
|
||||
|
Loading…
Reference in New Issue
Block a user