summaryrefslogtreecommitdiffstats
path: root/contrib/less/main.c
diff options
context:
space:
mode:
authortjr <tjr@FreeBSD.org>2004-04-17 07:16:34 +0000
committertjr <tjr@FreeBSD.org>2004-04-17 07:16:34 +0000
commit44c4d557e2436dfbb703a9fc3e78fac79c574d4b (patch)
treef46d7e51d83360c5b6bdacf5b08e16a415ed61b5 /contrib/less/main.c
parentc0c85bc41cb6c023adae56cf0a7e3495bd528cb2 (diff)
downloadFreeBSD-src-44c4d557e2436dfbb703a9fc3e78fac79c574d4b.zip
FreeBSD-src-44c4d557e2436dfbb703a9fc3e78fac79c574d4b.tar.gz
Import less v381.
Diffstat (limited to 'contrib/less/main.c')
-rw-r--r--contrib/less/main.c21
1 files changed, 15 insertions, 6 deletions
diff --git a/contrib/less/main.c b/contrib/less/main.c
index 861996b..1fb91a3 100644
--- a/contrib/less/main.c
+++ b/contrib/less/main.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 1984-2000 Mark Nudelman
+ * Copyright (C) 1984-2002 Mark Nudelman
*
* You may distribute under the terms of either the GNU General Public
* License or the Less License, as specified in the README file.
@@ -162,6 +162,7 @@ main(argc, argv)
ifile = get_ifile(FAKE_HELPFILE, ifile);
while (argc-- > 0)
{
+ char *filename;
#if (MSDOS_COMPILER && MSDOS_COMPILER != DJGPPC)
/*
* Because the "shell" doesn't expand filename patterns,
@@ -171,16 +172,23 @@ main(argc, argv)
*/
struct textlist tlist;
char *gfilename;
- char *filename;
gfilename = lglob(*argv++);
init_textlist(&tlist, gfilename);
filename = NULL;
while ((filename = forw_textlist(&tlist, filename)) != NULL)
- ifile = get_ifile(filename, ifile);
+ {
+ (void) get_ifile(filename, ifile);
+ ifile = prev_ifile(NULL_IFILE);
+ }
free(gfilename);
#else
- ifile = get_ifile(*argv++, ifile);
+ filename = shell_quote(*argv);
+ if (filename == NULL)
+ filename = *argv;
+ argv++;
+ (void) get_ifile(filename, ifile);
+ ifile = prev_ifile(NULL_IFILE);
#endif
}
/*
@@ -209,11 +217,10 @@ main(argc, argv)
if (missing_cap && !know_dumb)
error("WARNING: terminal is not fully functional", NULL_PARG);
init_mark();
- raw_mode(1);
open_getchr();
+ raw_mode(1);
init_signals(1);
-
/*
* Select the first file to examine.
*/
@@ -258,6 +265,7 @@ main(argc, argv)
commands();
quit(QUIT_OK);
/*NOTREACHED*/
+ return (0);
}
/*
@@ -292,6 +300,7 @@ ecalloc(count, size)
error("Cannot allocate memory", NULL_PARG);
quit(QUIT_ERROR);
/*NOTREACHED*/
+ return (NULL);
}
/*
OpenPOWER on IntegriCloud