nano

nano with my custom patches
git clone git://bsandro.tech/nano
Log | Files | Refs | README | LICENSE

commit dd7cc7230e1dc2201ccfd9249360a18a5c9c21fd
parent 3aedb36e68b88c293b1e763b7e715f18bf11da27
Author: David Lawrence Ramsey <pooka109@gmail.com>
Date:   Fri, 28 May 2004 23:45:25 +0000

don't bother initializing the backup directory or reading $SPELL for the
alternative spell checker if we're in restricted mode, since both
backups and spell checking are disabled then


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@1777 35c25a1d-7b9e-4130-9fde-d3aeb78583b8

Diffstat:
MChangeLog | 6+++++-
Msrc/nano.c | 16++++++++++------
2 files changed, 15 insertions(+), 7 deletions(-)

diff --git a/ChangeLog b/ChangeLog @@ -208,8 +208,12 @@ CVS code - after the terminal is properly set up, so that we can restore it easily after a resize. (DLR) - Add missing cast to char when calling do_char(). (DLR) + - Don't initialize the backup directory if we're in restricted + mode, since backups are disabled then. (DLR) - Check $SPELL for an alternative spell checker if we didn't get - one from the command line and/or rcfile, as Pico does. (DLR) + one from the command line and/or rcfile, as Pico does. Don't + do this if we're in restricted mode, since spell checking is + disabled then. (DLR) - nano.h: - Since REGEXP_COMPILED is only used in search.c, convert it from a flag to a static int there. (DLR) diff --git a/src/nano.c b/src/nano.c @@ -3367,14 +3367,17 @@ int main(int argc, char *argv[]) #endif #ifndef NANO_SMALL - /* Set up the backup directory. This entails making sure it exists - * and is a directory, so that backup files will be saved there. */ - init_backup_dir(); + /* Set up the backup directory (unless we're using restricted mode, + * in which case backups are disabled). This entails making sure it + * exists and is a directory, so that backup files will be saved + * there. */ + if (!ISSET(RESTRICTED)) + init_backup_dir(); #endif #ifndef DISABLE_OPERATINGDIR /* Set up the operating directory. This entails chdir()ing there, - so that file reads and writes will be based there. */ + * so that file reads and writes will be based there. */ init_operating_dir(); #endif @@ -3390,8 +3393,9 @@ int main(int argc, char *argv[]) #ifndef DISABLE_SPELLER /* If we don't have an alternative spell checker after reading the * command line and/or rcfile, check $SPELL for one, as Pico - * does. */ - if (alt_speller == NULL) { + * does (unless we're using restricted mode, in which case spell + * checking is disabled). */ + if (!ISSET(RESTRICTED) && alt_speller == NULL) { char *spellenv = getenv("SPELL"); if (spellenv != NULL) alt_speller = mallocstrcpy(NULL, spellenv);