=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/less/main.c,v retrieving revision 1.1.1.2 retrieving revision 1.1.1.3 diff -c -r1.1.1.2 -r1.1.1.3 *** src/usr.bin/less/main.c 2003/04/13 18:21:21 1.1.1.2 --- src/usr.bin/less/main.c 2011/09/16 17:47:06 1.1.1.3 *************** *** 1,5 **** /* ! * 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. --- 1,5 ---- /* ! * Copyright (C) 1984-2011 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. *************** *** 54,61 **** --- 54,64 ---- static char consoleTitle[256]; #endif + extern int less_is_more; extern int missing_cap; extern int know_dumb; + extern int quit_if_one_screen; + extern int pr_type; /* *************** *** 111,121 **** is_tty = isatty(1); get_term(); init_cmds(); - init_prompt(); init_charset(); init_line(); init_option(); ! s = lgetenv("LESS"); if (s != NULL) scan_option(save(s)); --- 114,140 ---- is_tty = isatty(1); get_term(); init_cmds(); init_charset(); init_line(); + init_cmdhist(); init_option(); ! init_search(); ! ! /* ! * 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)); *************** *** 140,145 **** --- 159,167 ---- 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') *************** *** 335,348 **** c = *ps; if (uppercase) { ! if (len == 0 && SIMPLE_IS_LOWER(c)) return (-1); ! if (SIMPLE_IS_UPPER(c)) ! c = SIMPLE_TO_LOWER(c); } sc = *s; ! if (len > 0 && SIMPLE_IS_UPPER(sc)) ! sc = SIMPLE_TO_LOWER(sc); if (c != sc) break; len++; --- 357,370 ---- c = *ps; if (uppercase) { ! if (len == 0 && ASCII_IS_LOWER(c)) return (-1); ! if (ASCII_IS_UPPER(c)) ! c = ASCII_TO_LOWER(c); } sc = *s; ! if (len > 0 && ASCII_IS_UPPER(sc)) ! sc = ASCII_TO_LOWER(sc); if (c != sc) break; len++; *************** *** 369,374 **** --- 391,397 ---- save_status = status; quitting = 1; edit((char*)NULL); + save_cmdhist(); if (any_display && is_tty) clear_bot(); deinit(); *************** *** 383,389 **** */ close(2); #endif ! #if WIN32 SetConsoleTitle(consoleTitle); #endif close_getchr(); --- 406,412 ---- */ close(2); #endif ! #ifdef WIN32 SetConsoleTitle(consoleTitle); #endif close_getchr();