* 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
+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.
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)
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);