diff --git a/src/nano.c b/src/nano.c index 0acd847..4c0e04d 100644 --- a/src/nano.c +++ b/src/nano.c @@ -584,6 +584,9 @@ void die(const char *msg, ...) endwin(); + if (ISSET(NO_SAVEFILE)) + return; + /* Restore the old terminal settings. */ tcsetattr(0, TCSANOW, &oldterm); @@ -1921,6 +1924,7 @@ int main(int argc, char **argv) #ifndef DISABLE_COLOR {"syntax", 1, NULL, 'Y'}, #endif + {"nosavefile", 0, NULL, 'Z'}, {"constantshow", 0, NULL, 'c'}, {"rebinddelete", 0, NULL, 'd'}, #ifdef ENABLE_BROWSER @@ -2012,9 +2016,11 @@ int main(int argc, char **argv) if (*(tail(argv[0])) == 'r') SET(RESTRICTED); +UNSET(NO_SAVEFILE); + while ((optchr = getopt_long(argc, argv, - "ABC:DEFGHIKLNOPQ:RST:UVWX:Y:abcdefghijklmno:pqr:s:tuvwxz$", + "ABC:DEFGHIKLNOPQ:RST:UVWX:Y:Zabcdefghijklmno:pqr:s:tuvwxz$", long_options, NULL)) != -1) { switch (optchr) { case 'a': @@ -2121,6 +2127,9 @@ int main(int argc, char **argv) syntaxstr = mallocstrcpy(syntaxstr, optarg); break; #endif + case 'Z': + SET(NO_SAVEFILE); + break; case 'c': SET(CONSTANT_SHOW); break; diff --git a/src/nano.h b/src/nano.h index 1a030b6..bf33755 100644 --- a/src/nano.h +++ b/src/nano.h @@ -519,7 +519,8 @@ enum JUSTIFY_TRIM, SHOW_CURSOR, LINE_NUMBERS, - NO_PAUSES + NO_PAUSES, + NO_SAVEFILE }; /* Flags for the menus in which a given function should be present. */