Commit Graph

433 Commits (b00d0b9c8ca4b291f55bc9f2cb1de4d42e0437d6)

Author SHA1 Message Date
Chris Allegretta 637daa85c5 * src/*: Retire iso_me_harder_funcmap based on suggestion by <bernd.spaeth@gmx.net>
This does add 20KB to nano's executable size but it gets rid of a lot of indirection
          that makes people stomach turn.  There are several new stub functions and need of more
          tidying as a result of this.



git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4527 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2011-02-07 14:45:56 +00:00
Chris Allegretta 3d411188f6 2011-02-06 Chris Allegretta <chrisa@asty.org>
* files.c (write_file) - Fix problems with writing the backup file (albeit interactively)
	  with new function prompt_failed_backupwrite(), allows more secure handling of problems
	  with failing to write the backup file compared to 'allow_insecure_backup'.
	* winio.c (edit_redraw): Removed unused variable



git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4526 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2011-02-07 02:06:20 +00:00
Chris Allegretta ab53864de7 2010-11-12 Chris Allegretta <chrisa@asty.org>
* Add check for RESTRICTED mode back to speller, suspend and insert file
          routines, since adding key bindings broke the fact that they should be
          disabled in restricted mode.  Fixes Savannah bug 31625 reported by
          Charlie Somerville.



git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4519 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2010-11-12 06:22:12 +00:00
Chris Allegretta 461519cce7 Add more inseure backup checks to that strange cases like with ACLs will work with allow_insecure_backup.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4509 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2010-06-24 14:47:00 +00:00
Chris Allegretta 0acca27ac7 2010-06-20 Chris Allegretta <chrisa@asty.org>
* New option allow_insecure_backup, allows the previous security
          fixes for backup files to be overridden if you're really positive
          you want to.  Fixes Savannah bug 29732 by Brian Szymanski <skibrianski>.



git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4508 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2010-06-21 03:10:10 +00:00
Chris Allegretta 86be3af75f 2010-05-23 Chris Allegretta <chrisa@asty.org>
* files.c (write_file): Don't even try to chown() the backup
          file unless we're root, since it's probably going to fail if
          we're editing a file we don't own.  Fixes Savannah bug
          29514: [nano 2.2.2] backup should ignore chown errors.



git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4507 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2010-05-23 04:30:23 +00:00
Chris Allegretta db9d983646 2010-04-14 Chris Allegretta <chrisa@asty.org>
* files.c (wirte_file): Don't set current_stat when tmp == TRUE, check
          whether current_stat is set when trying to use it, and don't do the
          modification check if the filename changed, since we have no way
          of knowing about it in that case.  Fixes Savannah bug 29392, reported
          by Mike Frysinger.



git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4500 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2010-04-14 06:03:12 +00:00
Chris Allegretta ad8476eb7d Sigh, left out O_EXCL from Dan's patch
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4497 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2010-04-09 15:31:00 +00:00
Chris Allegretta 7f61a6cb79 2010-04-09 Chris Allegretta <chrisa@asty.org>
* files.c (do_writeout): Better security fixes for backup file writing, 
          mangled from submission by Dan Rosenberg <dan.j.rosenberg at gmail>.



git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4496 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2010-04-09 15:01:51 +00:00
Chris Allegretta dbbf9a052f Okay maybe make it crash EVEN less.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4495 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2010-04-08 04:07:14 +00:00
Chris Allegretta 83a0e9013e 2010-04-02 Chris Allegretta <chrisa@asty.org>
* files.c (do_writeout): Previous fixes should not cause a crash
          when saving a new file.  Discovered by Mike Frysinger <vapier@gentoo.org>.



git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4494 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2010-04-08 02:22:53 +00:00
Chris Allegretta 9e73aeb10f Fix that wording cause it's the file owner we care about
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4492 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2010-04-07 05:53:41 +00:00
Chris Allegretta 0d1381adf9 * files.c (do_writeout): Also abort on writing a backup
file when its owner doesn't match the edited file.



git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4491 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2010-04-07 05:48:24 +00:00
Chris Allegretta cdb5b16198 2010-04-02 Chris Allegretta <chrisa@asty.org>
* files.c (do_writeout): Expand modification check to include both the
          original file's device ID and inode number as reasons to warn the
          user that the file has been modified.  Based on security article on nano
          by Dan Rosenberg.



git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4490 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2010-04-03 02:39:18 +00:00
Chris Allegretta 6cf05d487f 2010-01-14 Chris Allegretta <chrisa@asty.org>
* files.c (do_writeout): Fix for crash / incorrect external modification warning
          due to earlier fix in r4467.



git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4474 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2010-01-14 06:32:37 +00:00
Chris Allegretta 8d41fb8c3e 2009-12-22 Chris Allegretta <chrisa@asty.org>
* files.c (write_file): Fix compatibility with previous stat fix and tiny mode.

2009-12-22 David Lawrence Ramsey <pooka109@gmail.com>
        * global.c: Add new strings for forward/back in the file browser.  New variables
          nano_forwardfile_msg and nano_backfile_msg.



git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4469 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2009-12-23 05:03:09 +00:00
Chris Allegretta 3c7dda6e7e 2009-12-20 Chris Allegretta <chrisa@asty.org>
* files.c (is_file_writable): remove assert check for f, since it's not
          initialized at the time.  Fixes Savannah bug 28309, reported by Zoltan Kovacs.



git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4468 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2009-12-20 05:55:41 +00:00
Chris Allegretta 869aca4392 2009-12-20 Brian Szymanski <skibrianski via Savannah>
* src/files.c (write_file): Check stat struct exists, and if not use just obtained stat data.    
          Fixes Ubuntu bug 471568, "reproducible crash in nano on trying to save to a file 
          different than the one specified on the command line".



git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4467 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2009-12-20 05:46:35 +00:00
Chris Allegretta 2c7b506fbc 2009-12-09 Chris Allegretta <chrisa@asty.org>
* files.c (read_file) - Add parameter for whether we should even try to check
          file writability, as the message is useless when we're inserting into an
          existing buffer.  Fixes Savannah bug 28219.



git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4460 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2009-12-09 16:51:43 +00:00
Chris Allegretta 8a07a96eef 2009-12-01 David Lawrence Ramsey <pooka109@gmail.com>
* Update documentation for 2.2 features including sample nanorc file, texinfo
          file, man pages, UPGRADE file, and update copyright noticed for the current year.



git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4453 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2009-12-02 03:36:22 +00:00
Chris Allegretta a97cb819f2 2009-12-01 Kamil Dudka <kdudka@redhat.com>
* chars.c, file.c - Better handle unused results for things like mbtowc(), new
          macro IGNORE_CALL_RESULT.

2009-12-01 Chris Allegretta <chrisa@asty.org>
        * global.c (shortcut_init) - Remove redundant entries for ^Y/^V reported by
          Christian Weisgerber.
        * doc/man/nanorc.5 - Fix typo in Meta documentation, reported by gibboris@gmail.com.

2009-11-29 David Lawrence Ramsey <pooka109@gmail.com>
        * global.c (shortcut_init) - Add support for ^P and ^N in the help menu.



git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4452 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2009-12-02 03:24:18 +00:00
Chris Allegretta 5a018f0d3a 2009-11-29 Chris Allegretta <chrisa@asty.org>
* prompt.c (get_prompt_string) - Universally handle help key when is disabled.  Fixes Savannah
          bug 28117 by David Lawrence Ramsey <pooka109@gmail.com>.
        * chars.c, files.c: Add junk vars to silence the compiler.  Sigh.

2009-11-29 David Lawrence Ramsey <pooka109@gmail.com>
        * Change several *chars to const char, additional cleanups and casts to make compilers happier.



git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4448 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2009-11-29 06:13:22 +00:00
Chris Allegretta 533b9fa827 * files.c (do_writeout) - Only mention file modification if we're writing the same
file we originally opened.



git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4424 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2009-11-14 20:06:24 +00:00
Chris Allegretta a60910cc54 Better fix, remove unneeded closecode variable and update bug credit.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4419 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2009-11-10 03:44:12 +00:00
Chris Allegretta 7be32046b0 2009-11-09 Chris Allegretta <chrisa@asty.org>
* files.c (read_file): - Remove debugging messages from file load  



git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4418 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2009-11-10 02:46:17 +00:00
Chris Allegretta 1d461475ce 2009-11-03 Chris Allegretta <chrisa@asty.org>
* nano.h - Fix comma at end of enumerator list which angers -pedantic.

2009-11-03 Mike Frysinger <vapier@gentoo.org>
        * files.c - Move up is_file_writable() to stop implicit definition complaints.



git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4415 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2009-11-03 18:47:39 +00:00
Chris Allegretta f8f9027295 2009-09-02 Chris Allegretta <chrisa@asty.org>
* Attempt to check file writability and emit a warning on the status bar
          if nano doesn't think the file can be written to.  Feature originally
          requested by Damien Jolders <madamien@skullsquad.com> et al.



git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4407 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2009-09-03 05:45:13 +00:00
Chris Allegretta 04fbfaae51 2009-02-08 Chris Allegretta <chrisa@asty.org>
* Add more multidata initliazers for new buffers and 'magic lines'.  Fixes segfaults
          with syntax highlighting in new buffers, initially reported by Mike Frysinger.



git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4372 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2009-02-08 17:45:21 +00:00
Chris Allegretta 364763f4d1 2009-02-02 Chris Allegretta <chrisa@asty.org>
* New color precalculation code for mult-line regexes.  New function precalc_multicolorinfo(),
          new structure multidata for keeping track of where regexes start/stop.  More 
          performance improvements forthcoming.



git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4362 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2009-02-03 05:05:58 +00:00
Chris Allegretta 2823c99e72 2009-01-25 Chris Allegretta <chrisa@asty.org>
* files.c (open_file), nanorc.c (parse_include): Don't get_full_path on     
          included rc files, due to it potentially impacting the ability
          to read files in nano's cwd().  Fixes Savnanah bug #25297 reported by Mike 
          Frysinger)



git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4353 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2009-01-26 08:48:22 +00:00
Chris Allegretta d47d8cd450 * First pass at some caching of caching color info. Right now it's only for
multi-line regexes but this may not be enough to increase performance.



git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4351 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2009-01-25 07:25:17 +00:00
Chris Allegretta a117163a4c 2009-01-19 Chris Allegretta <chrisa@asty.org>
* Change funcion definitions to shorts instead of (void *)s.  New mapping function
          iso_me_harder_funcmap().  Fixes compilation complaints with -pedantic, 
          reported by Eitan Adler <eitanadlerlist@gmail.com>.



git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4349 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2009-01-19 19:10:39 +00:00
Chris Allegretta 2d189ae46d Add tiny check around new mtime check code. Fixes certain compile time options.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4345 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2008-10-22 22:11:46 +00:00
Chris Allegretta 95add8dabe 2008-10-20 Chris Allegretta <chrisa@asty.org>
* files.c (do_writeout): Add check for file modification when saving
          the file so the user can at least know they may be blowing away changes.



git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4344 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2008-10-21 10:20:07 +00:00
Chris Allegretta 1d77823f79 * global.c, help.c, browser.c, files.c, proto.h: Fix several compipation and programmatic
issues with --disable-help, especially that do-writeout was treating ^G the same as ^M.



git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4317 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2008-08-30 21:00:00 +00:00
Chris Allegretta 90ad8e20b9 2008-08-08 Magnus Granberg <zorry@ume.nu> / Adam Conrad <?>
* files.c: (write_file): Add needed flags to open() calls when writing out files.  Fixes Savannah bug
          #23827: Compilation fails with -D_FORTIFY_SOURCE=2



git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4306 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2008-08-17 16:25:40 +00:00
Chris Allegretta 2cc58882f6 * files.c (write_file): Check exit code of fclose(), since in certain out of space conditions the OS will
happily report successful fwrite()s until you try and close the file.  Fix for Savannah bug
	  #24000: no free space on partition - nano claims successful write - file empty 



git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4304 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2008-08-16 23:54:15 +00:00
Chris Allegretta b08b38680d Re-add the skip_backup label since we do still need it in one case.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4299 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2008-08-09 09:31:33 +00:00
Chris Allegretta 5c27d723c9 * text.c (do_redo): Fix improperly restoring the text when redoing a line split.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4298 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2008-08-09 09:28:07 +00:00
Chris Allegretta 447f1b4b75 * files.c: Do not go on and attempt to write the main file if writing the backup file failed,
related to Savannah bug 24000.



git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4297 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2008-08-09 03:39:10 +00:00
Chris Allegretta 14c8620e0b - Change add_undo and current_undo to only take action arg, as openfilestruct arg is always openfile
- Add ability to undo a file/cmd insert, needed to add undoable flag to read_file and open_buffer as a result



git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4291 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2008-08-03 04:48:05 +00:00
Chris Allegretta 07fcc4c973 Add beginning undo feature, since I want to start fixing bugs from savannah and don't want to manager another checking, and the code basically works for some operations.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4271 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2008-07-10 20:13:04 +00:00
Chris Allegretta 8b6461fc80 files.c,proto.h,text.c: Fix for conflicts with AIX curses variables, from William Jojo <jojowil@hvcc.edu>
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4260 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2008-05-31 23:09:40 +00:00
Chris Allegretta 2cca48380d Fix for bug #22780: build failure with --enable-multibuffer --enable-tiny
Plus make the actual prompt work with --enable-tiny when inserting files.



git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4248 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2008-03-31 06:25:14 +00:00
Chris Allegretta cfb45f8214 Fix problems with inserting files using --disable-tabcomp and probably
other --disable type options.



git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4231 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2008-03-16 14:24:28 +00:00
Chris Allegretta 10f868d33c - Update man page a little bit more
- Change do_prompt and get_prompt_line to pass meta_key and func_key
  so the calling program can DTRT when it calsl get_shortcut.  In
  particular this allows the "new file buffer" toggle on the insert file
  menu to work, and presumably other rebinding stuff should now work also.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4226 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2008-03-14 04:08:51 +00:00
Chris Allegretta d3a1ff6a33 Fix multibuffer mode not showing "Close" string anymore
on buffer open/closer.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4225 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2008-03-13 17:48:16 +00:00
Chris Allegretta eb64314f8b Convert more code to use new backend. Add some more sentinel strings
for enter and backspace keys in case their control key alternates get
rebound.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4223 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2008-03-12 04:44:14 +00:00
Chris Allegretta 79a33bb38d New keybindings code and backend. New structs subnfunc for menu functions
and toggles and sc for shortcut keys, old 'shortcut' and 'toggles' structs are
gone.  The current implementation has a bunch of broken stuff (some of which is
documented in BUGS).  Updated nanorc.5 with some mostly complete documentation
on configuring.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4215 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2008-03-05 07:34:01 +00:00
David Lawrence Ramsey cfd4b89f4b in read_file(), improve autodetection of DOS and Mac format files to not
trigger on carriage returns in the middle of files, as found by Kjell
Braden


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4179 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2007-11-17 20:34:38 +00:00