2009-01-29 Chris Allegretta <chrisa@asty.org>
* nano.c (main): Add support for nano acting like a pager when invoked with - as first file argument. Not yet perfect (garbles screen state on exit) but it's something. git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4356 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
Этот коммит содержится в:
родитель
2d90cf324e
Коммит
25d459aa64
@ -1,3 +1,7 @@
|
||||
2009-01-29 Chris Allegretta <chrisa@asty.org>
|
||||
* nano.c (main): Add support for nano acting like a pager when invoked with - as first
|
||||
file argument. Not yet perfect (garbles screen state on exit) but it's something.
|
||||
|
||||
2009-01-28 Davide Pesavento <davidepesa@gmail.com>
|
||||
* doc/syntax/gentoo.nanorc: Updates from David and Mike Frysinger.
|
||||
|
||||
|
@ -260,6 +260,9 @@ void reset_multis(filestruct *fileptr)
|
||||
int i;
|
||||
filestruct *oof;
|
||||
|
||||
if (!openfile->syntax)
|
||||
return;
|
||||
|
||||
for (i = 0; i < openfile->syntax->nmultis; i++) {
|
||||
for (oof = fileptr->next; oof != NULL; oof = oof->next) {
|
||||
if (oof->multiswatching == NULL)
|
||||
|
24
src/nano.c
24
src/nano.c
@ -2239,6 +2239,30 @@ int main(int argc, char **argv)
|
||||
optind++;
|
||||
}
|
||||
|
||||
if (optind < argc && !strcmp(argv[optind], "-")) {
|
||||
FILE *f;
|
||||
int ttystdin;
|
||||
struct termios term;
|
||||
|
||||
enable_signals();
|
||||
open_buffer("", FALSE);
|
||||
endwin();
|
||||
|
||||
f = fopen("/dev/stdin", "rb");
|
||||
if (f == NULL)
|
||||
nperror("fopen");
|
||||
|
||||
read_file(f, "stdin", TRUE);
|
||||
ttystdin = open("/dev/tty", O_RDONLY);
|
||||
if (!ttystdin)
|
||||
die(_("Couldn't reopen stdin from keyboard, sorry\n"));
|
||||
|
||||
dup2(ttystdin,0);
|
||||
close(ttystdin);
|
||||
set_modified();
|
||||
optind++;
|
||||
}
|
||||
|
||||
#ifdef ENABLE_MULTIBUFFER
|
||||
old_multibuffer = ISSET(MULTIBUFFER);
|
||||
SET(MULTIBUFFER);
|
||||
|
Загрузка…
Ссылка в новой задаче
Block a user