more int -> bool conversions
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2074 35c25a1d-7b9e-4130-9fde-d3aeb78583b8master
parent
bde3e0e294
commit
8c16bacbbf
15
src/files.c
15
src/files.c
|
@ -1404,7 +1404,8 @@ int copy_file(FILE *inn, FILE *out)
|
||||||
* if tmp is FALSE or if we're appending/prepending.
|
* if tmp is FALSE or if we're appending/prepending.
|
||||||
*
|
*
|
||||||
* Return -1 on error, 1 on success. */
|
* Return -1 on error, 1 on success. */
|
||||||
int write_file(const char *name, int tmp, int append, int nonamechange)
|
int write_file(const char *name, bool tmp, int append, bool
|
||||||
|
nonamechange)
|
||||||
{
|
{
|
||||||
int retval = -1;
|
int retval = -1;
|
||||||
/* Instead of returning in this function, you should always
|
/* Instead of returning in this function, you should always
|
||||||
|
@ -1415,13 +1416,13 @@ int write_file(const char *name, int tmp, int append, int nonamechange)
|
||||||
/* The file descriptor we use. */
|
/* The file descriptor we use. */
|
||||||
mode_t original_umask = 0;
|
mode_t original_umask = 0;
|
||||||
/* Our umask, from when nano started. */
|
/* Our umask, from when nano started. */
|
||||||
int realexists;
|
bool realexists;
|
||||||
/* The result of stat(). TRUE if the file exists, FALSE
|
/* The result of stat(). TRUE if the file exists, FALSE
|
||||||
* otherwise. If name is a link that points nowhere, realexists
|
* otherwise. If name is a link that points nowhere, realexists
|
||||||
* is FALSE. */
|
* is FALSE. */
|
||||||
struct stat st;
|
struct stat st;
|
||||||
/* The status fields filled in by stat(). */
|
/* The status fields filled in by stat(). */
|
||||||
int anyexists;
|
bool anyexists;
|
||||||
/* The result of lstat(). Same as realexists unless name is a
|
/* The result of lstat(). Same as realexists unless name is a
|
||||||
* link. */
|
* link. */
|
||||||
struct stat lst;
|
struct stat lst;
|
||||||
|
@ -1450,7 +1451,7 @@ int write_file(const char *name, int tmp, int append, int nonamechange)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
anyexists = lstat(realname, &lst) != -1;
|
anyexists = (lstat(realname, &lst) != -1);
|
||||||
/* New case: if the file exists, just give up. */
|
/* New case: if the file exists, just give up. */
|
||||||
if (tmp && anyexists)
|
if (tmp && anyexists)
|
||||||
goto cleanup_and_exit;
|
goto cleanup_and_exit;
|
||||||
|
@ -1464,7 +1465,7 @@ int write_file(const char *name, int tmp, int append, int nonamechange)
|
||||||
|
|
||||||
/* Save the state of file at the end of the symlink (if there is
|
/* Save the state of file at the end of the symlink (if there is
|
||||||
* one). */
|
* one). */
|
||||||
realexists = stat(realname, &st) != -1;
|
realexists = (stat(realname, &st) != -1);
|
||||||
|
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_SMALL
|
||||||
/* We backup only if the backup toggle is set, the file isn't
|
/* We backup only if the backup toggle is set, the file isn't
|
||||||
|
@ -1472,7 +1473,7 @@ int write_file(const char *name, int tmp, int append, int nonamechange)
|
||||||
* aren't appending, prepending, or writing a selection, we backup
|
* aren't appending, prepending, or writing a selection, we backup
|
||||||
* only if the file has not been modified by someone else since nano
|
* only if the file has not been modified by someone else since nano
|
||||||
* opened it. */
|
* opened it. */
|
||||||
if (ISSET(BACKUP_FILE) && !tmp && realexists != 0 &&
|
if (ISSET(BACKUP_FILE) && !tmp && realexists &&
|
||||||
(append != 0 || ISSET(MARK_ISSET) ||
|
(append != 0 || ISSET(MARK_ISSET) ||
|
||||||
originalfilestat.st_mtime == st.st_mtime)) {
|
originalfilestat.st_mtime == st.st_mtime)) {
|
||||||
|
|
||||||
|
@ -1747,7 +1748,7 @@ int write_file(const char *name, int tmp, int append, int nonamechange)
|
||||||
* nonamechange set to TRUE so that we don't change the current
|
* nonamechange set to TRUE so that we don't change the current
|
||||||
* filename. Finally, set fileage and filebot back to their old values
|
* filename. Finally, set fileage and filebot back to their old values
|
||||||
* and return. */
|
* and return. */
|
||||||
int write_marked(const char *name, int tmp, int append)
|
int write_marked(const char *name, bool tmp, int append)
|
||||||
{
|
{
|
||||||
int retval = -1;
|
int retval = -1;
|
||||||
bool old_modified = ISSET(MODIFIED);
|
bool old_modified = ISSET(MODIFIED);
|
||||||
|
|
|
@ -214,9 +214,10 @@ int check_operating_dir(const char *currpath, int allow_tabcomp);
|
||||||
void init_backup_dir(void);
|
void init_backup_dir(void);
|
||||||
#endif
|
#endif
|
||||||
int copy_file(FILE *inn, FILE *out);
|
int copy_file(FILE *inn, FILE *out);
|
||||||
int write_file(const char *name, int tmp, int append, int nonamechange);
|
int write_file(const char *name, bool tmp, int append, bool
|
||||||
|
nonamechange);
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_SMALL
|
||||||
int write_marked(const char *name, int tmp, int append);
|
int write_marked(const char *name, bool tmp, int append);
|
||||||
#endif
|
#endif
|
||||||
int do_writeout(bool exiting);
|
int do_writeout(bool exiting);
|
||||||
void do_writeout_void(void);
|
void do_writeout_void(void);
|
||||||
|
|
Loading…
Reference in New Issue