version 1.1.1.2, 2003/04/13 18:21:21 |
version 1.1.1.3, 2011/09/16 17:47:06 |
|
|
/* |
/* |
* Copyright (C) 1984-2002 Mark Nudelman |
* Copyright (C) 1984-2011 Mark Nudelman |
* |
* |
* You may distribute under the terms of either the GNU General Public |
* You may distribute under the terms of either the GNU General Public |
* License or the Less License, as specified in the README file. |
* License or the Less License, as specified in the README file. |
|
|
static char consoleTitle[256]; |
static char consoleTitle[256]; |
#endif |
#endif |
|
|
|
extern int less_is_more; |
extern int missing_cap; |
extern int missing_cap; |
extern int know_dumb; |
extern int know_dumb; |
|
extern int quit_if_one_screen; |
|
extern int pr_type; |
|
|
|
|
/* |
/* |
|
|
is_tty = isatty(1); |
is_tty = isatty(1); |
get_term(); |
get_term(); |
init_cmds(); |
init_cmds(); |
init_prompt(); |
|
init_charset(); |
init_charset(); |
init_line(); |
init_line(); |
|
init_cmdhist(); |
init_option(); |
init_option(); |
s = lgetenv("LESS"); |
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) |
if (s != NULL) |
scan_option(save(s)); |
scan_option(save(s)); |
|
|
|
|
quit(QUIT_OK); |
quit(QUIT_OK); |
} |
} |
|
|
|
if (less_is_more && get_quit_at_eof()) |
|
quit_if_one_screen = TRUE; |
|
|
#if EDITOR |
#if EDITOR |
editor = lgetenv("VISUAL"); |
editor = lgetenv("VISUAL"); |
if (editor == NULL || *editor == '\0') |
if (editor == NULL || *editor == '\0') |
|
|
c = *ps; |
c = *ps; |
if (uppercase) |
if (uppercase) |
{ |
{ |
if (len == 0 && SIMPLE_IS_LOWER(c)) |
if (len == 0 && ASCII_IS_LOWER(c)) |
return (-1); |
return (-1); |
if (SIMPLE_IS_UPPER(c)) |
if (ASCII_IS_UPPER(c)) |
c = SIMPLE_TO_LOWER(c); |
c = ASCII_TO_LOWER(c); |
} |
} |
sc = *s; |
sc = *s; |
if (len > 0 && SIMPLE_IS_UPPER(sc)) |
if (len > 0 && ASCII_IS_UPPER(sc)) |
sc = SIMPLE_TO_LOWER(sc); |
sc = ASCII_TO_LOWER(sc); |
if (c != sc) |
if (c != sc) |
break; |
break; |
len++; |
len++; |
|
|
save_status = status; |
save_status = status; |
quitting = 1; |
quitting = 1; |
edit((char*)NULL); |
edit((char*)NULL); |
|
save_cmdhist(); |
if (any_display && is_tty) |
if (any_display && is_tty) |
clear_bot(); |
clear_bot(); |
deinit(); |
deinit(); |
|
|
*/ |
*/ |
close(2); |
close(2); |
#endif |
#endif |
#if WIN32 |
#ifdef WIN32 |
SetConsoleTitle(consoleTitle); |
SetConsoleTitle(consoleTitle); |
#endif |
#endif |
close_getchr(); |
close_getchr(); |