summaryrefslogtreecommitdiff
path: root/usr.bin/mg/fileio.c
AgeCommit message (Collapse)Author
2013-05-18and and -> andlum
2012-11-27- move prototype of expandtilder() to def.h; needed by an upcoming diff.Jasper Lievisse Adriaanse
2012-07-10Fix an outstanding debian bug: #658539lum
"looks good" kjell
2012-06-18- add a pathnames.hJasper Lievisse Adriaanse
- some whitespace cleanup ok lum@
2012-06-15Fixes a problem where if you try to open a file that doesn't exist and haslum
a name longer than LOGIN_NAME_MAX and also has a tilde at the front e.g: $ mg ~01234567890123456789012345678901 mg will give a "Login name too long" instead of opening a new buffer named ~01234567890123456789012345678901
2012-06-14Allow mg to save backup files to a users home directory.lum
Suggestions from eric@ and Sunil Nimmagadda. Remarks deraadt@.
2012-06-11Change error message to reflect the correct filename: nname is 'Newlum
name' as opposed to tname 'Temp name'
2012-05-25Remove static FILE pointer used for handling files in fileio.c. Passlum
by reference instead. This allows the mg startup file to open other files without unexpected things happening. Discussed with Sunil Nimmagadda.
2012-05-23Change how mg handles files beginning with a '~'.lum
Bring behaviour more into line with emacs.
2012-04-12Remove the conditional directives NO_MACRO and NO_STARTUP.lum
They have not compiled for numerous years. ok kjell@ millert@
2012-03-28Close an opendir(). From Igor Zinovik.lum
2011-08-31On a file write fail:lum
1. return an error value 2. show an error message From Loganaden Velvindron with suggestion from millert@
2011-01-21It volates style(9), but in mg, #include"def.h" goes first. 'twas the way it ↵Kjell Wooding
was built. no binary change here. confirmed by lum@, tested by Henri Kemppainen
2011-01-21Change len+memcmp check to a strncmp for prefix testing onKjell Wooding
filename completion. Avoids a recurring portability headache. ok lum@ "concerns assuaged to the soothing sounds of Martin Denny blambert@" (I worry about that guy...)
2008-09-15Enable dirty buffer detection in mg.Kjell Wooding
Emulate the emacs behavior: after suspend/resume, buffer switch, or at save time, warn (prompt) the user if the file has been modified on disk in the interim. This has already saved my butt numerous times. ok phessler
2007-11-27typos; ok jmc@Martynas Venckus
sys/dev/pci/pciide.c from naddy@
2006-12-24Fix a bug where inserting a file resulted in an incorrectKjell Wooding
line-number count for a buffer (M-X insert-file, M-> to reproduce). While here, fix a number of bugs with incorrect line numbers after swap point-and-mark Originally reported via debian's bug tracking system. Fix tested by Han Boetes and Deanna Phillips.
2006-11-19spacingTheo de Raadt
2006-09-19Use S_IS* macros insted of masking with S_IF* flags. The latter mayOtto Moerbeek
have multiple bits set, which lead to surprising results. Spotted by Paul Stoeber, more to come. ok millert@ pedro@ jaredy@ djm@
2006-07-25Rename the header line of a buffer to b_headp, from the remarkablyKjell Wooding
unintuitive b_linep. No binary change.
2006-06-29- use <dirent.h> not <sys/dir.h> (this appeases FreeBSD's annoying #warning)Jason Wright
- grab <sys/time.h> before <sys/resource.h> like getrusage(2) says ok kjell
2006-06-01fix styleKjell Wooding
2006-06-01make // /~ path rewriting optional in adjustname() and use it everywhereJason Wright
except for the command line specified files. ok kjell,cloder
2006-05-03correct one more commentKjell Wooding
2006-05-03Do some KNF, clean up some unused junk that has lying around for 40-oddKjell Wooding
cvs revisions, and fix a few comments to match reality
2006-05-03len = strlen(foo); if foo[len - 1]... will do bad things if len == 0.Kjell Wooding
Avoid, and rearrange a test so it can't (hypothetically) overflow.
2006-04-03lint love; ok kjellTheo de Raadt
2006-04-02test char against '\0', not 0Kjell Wooding
2005-12-20Clean up the ugly casted frees. In one case, this meant eliminating a nastyKjell Wooding
struct/union/casting nightmare when building the list of names for filename completion. In particular, be consistent about strduping and freeing the list data.
2005-12-20Do some delinting of strl-type functions. Also, remove a superfluousKjell Wooding
word in the undo-list.
2005-12-13do some silly de-lintingKjell Wooding
2005-11-20#ifdef NO_DIR can go too. From Han Boetes.Kjell Wooding
2005-11-20Kill the NO_BACKUP #ifdefKjell Wooding
2005-11-20toast NO_DIRED #ifdef; ok kjellTheo de Raadt
2005-11-18greedy use of typedef struct was making code harder to read; ok kjell cloderTheo de Raadt
2005-11-13Better error checking of snprintfs. From Han Boetes.Kjell Wooding
2005-11-11Now that we have an editable minibuffer, revert parsing ofKjell Wooding
"//" and "/~" as '/' and '~' respectively. I know emacs does it, but it is weird, and breaks things that foolishly use filenames like "/tmp//crontab.xxxx". Proddings from matthieu and deraadt. Error report from Bernd Ahlers.
2005-11-11spacingTheo de Raadt
2005-10-18When attempting to open a filename, walk backwards through minibuffer:Kjell Wooding
a> if you run into the beginning of the string, use the whole thing b> if you run into a // combo, use everything starting from the second / c> if you run into a /~ combo, use everything starting from the ~ i.e. do like emacs. From (and for) Jason Wright
2005-10-17Fix string handling. LOGIN_NAME_MAX includes the NUL, so don't reserve extraKjell Wooding
space. Fix usage of strlcpy. Correct test for terminating slash. "looks good" deraadt@
2005-10-14more headers to please lintTheo de Raadt
2005-10-14move the dired routines into dired.c where they belong.Kjell Wooding
ok cloder@
2005-10-13Make dired buffer read-only by default.Kjell Wooding
Noticed by Han Boetes
2005-10-13Use dired mode automatically if file specified for loading isKjell Wooding
a directory. Modified version of patch from Han Boetes. ok cloder@
2005-10-13check if current line is null. fixes a core in dired.Kjell Wooding
2005-10-13Fix dired mode. Make deletions work, and keystrokes match emacs.Kjell Wooding
* dired-other-window should default to current buffer's path. * Remove redundant code (from Han Boetes) * Move initialization (and since we're here, fix mail-mode initialization too) * Remove redundant keymap in dired.c, and replace it with the better one that was being ignored in keymap.c.
2005-06-14Add explicit public domain notices to all public domain files.Kjell Wooding
ok millert@, deraadt@
2005-04-03This is a no binary change which does:David Berghoff
- spelling, punctuation fixes - variable declaration lineup - use parentheses for return and sizeof - K&R function declarations -> ANSI - other minor code beautification ok henning@
2005-03-10spacingTheo de Raadt
2005-03-10the realpath() was needed to do do relative to absolute pathHenning Brauer
conversion. revert my diff that takes it out, and instead, on realpath() failure (like when you have no perms on pwd) just return the unexpanded path. everything still fine with that, just tab completeion and the like does not work (obviously). this was mainly for "sudo mg /etc/something" from ~ where ~ is nfs-mounted with root mapped to -2 and now, that case works as well as tab completion on insert-file etc.