summaryrefslogtreecommitdiffstats
path: root/usr.bin/pr/pr.c
diff options
context:
space:
mode:
authorache <ache@FreeBSD.org>1999-11-30 09:41:01 +0000
committerache <ache@FreeBSD.org>1999-11-30 09:41:01 +0000
commit5ff251c82de8165191ae852c7e3ca551c345c924 (patch)
tree2526422de48e3bb591b38e2b15757e6b165e4707 /usr.bin/pr/pr.c
parent8b0f80aa0813c735071a34861d22e6892337aa5e (diff)
downloadFreeBSD-src-5ff251c82de8165191ae852c7e3ca551c345c924.zip
FreeBSD-src-5ff251c82de8165191ae852c7e3ca551c345c924.tar.gz
Localize it
Diffstat (limited to 'usr.bin/pr/pr.c')
-rw-r--r--usr.bin/pr/pr.c32
1 files changed, 21 insertions, 11 deletions
diff --git a/usr.bin/pr/pr.c b/usr.bin/pr/pr.c
index c4fac42..aaaf389 100644
--- a/usr.bin/pr/pr.c
+++ b/usr.bin/pr/pr.c
@@ -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);
}
OpenPOWER on IntegriCloud