diff options
author | delphij <delphij@FreeBSD.org> | 2007-06-04 01:43:11 +0000 |
---|---|---|
committer | delphij <delphij@FreeBSD.org> | 2007-06-04 01:43:11 +0000 |
commit | 2908bdb1f10f819d2713971e094aa9719b317184 (patch) | |
tree | 81e259b4b8551856ddf7763cc779172378fe60dc /contrib/less/main.c | |
parent | 9b5d103b5b51a6fea5caf2c8b1fc678d65a357c9 (diff) | |
download | FreeBSD-src-2908bdb1f10f819d2713971e094aa9719b317184.zip FreeBSD-src-2908bdb1f10f819d2713971e094aa9719b317184.tar.gz |
Resolve conflicts.
Diffstat (limited to 'contrib/less/main.c')
-rw-r--r-- | contrib/less/main.c | 39 |
1 files changed, 23 insertions, 16 deletions
diff --git a/contrib/less/main.c b/contrib/less/main.c index c7dbdb8..33e8600 100644 --- a/contrib/less/main.c +++ b/contrib/less/main.c @@ -1,6 +1,6 @@ /* $FreeBSD$ */ /* - * Copyright (C) 1984-2004 Mark Nudelman + * Copyright (C) 1984-2007 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. @@ -33,7 +33,7 @@ public char * progname; public int quitting; public int secure; public int dohelp; -public int more_mode = 0; +public int less_is_more; #if LOGFILE public int logfile = -1; @@ -58,6 +58,8 @@ static char consoleTitle[256]; extern int missing_cap; extern int know_dumb; +extern int quit_if_one_screen; +extern int pr_type; /* @@ -111,27 +113,29 @@ main(argc, argv) * Process command line arguments and LESS environment arguments. * Command line arguments override environment arguments. */ - if (strcmp(__progname, "more") == 0) - more_mode = 1; - is_tty = isatty(1); get_term(); init_cmds(); - init_prompt(); init_charset(); init_line(); init_cmdhist(); init_option(); - - if (more_mode) { - scan_option("-E"); - scan_option("-m"); - scan_option("-G"); - scan_option("-f"); - s = lgetenv("MORE"); - } else { - s = lgetenv("LESS"); + + /* + * If the name of the executable program is "more", + * act like LESS_IS_MORE is set. + */ + for (s = progname + strlen(progname); s > progname; s--) + { + if (s[-1] == PATHNAME_SEP[0]) + break; } + if (strcmp(s, "more") == 0) + less_is_more = 1; + + init_prompt(); + + s = lgetenv(less_is_more ? "MORE" : "LESS"); if (s != NULL) scan_option(save(s)); @@ -156,6 +160,9 @@ main(argc, argv) quit(QUIT_OK); } + if (less_is_more && get_quit_at_eof()) + quit_if_one_screen = TRUE; + #if EDITOR editor = lgetenv("VISUAL"); if (editor == NULL || *editor == '\0') @@ -230,7 +237,7 @@ main(argc, argv) quit(QUIT_OK); } - if (missing_cap && !know_dumb && !more_mode) + if (missing_cap && !know_dumb) error("WARNING: terminal is not fully functional", NULL_PARG); init_mark(); open_getchr(); |