Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
cs24-19fa
git_rec_nano
Commits
276ab2c8
Commit
276ab2c8
authored
7 years ago
by
Benno Schulenberg
Browse files
Options
Download
Email Patches
Plain Diff
tweaks: reshuffle code and frob comments, to reduce the number of lines
parent
80686bb5
master
feature/match-parens
refactor/readbility
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/files.c
+5
-12
src/files.c
src/nano.c
+6
-7
src/nano.c
with
11 additions
and
19 deletions
+11
-19
src/files.c
View file @
276ab2c8
...
...
@@ -1411,12 +1411,9 @@ char *safe_tempfile(FILE **f)
}
#ifndef DISABLE_OPERATINGDIR
/*
Initialize full_
operating
_
dir
based on operating_dir
. */
/*
Change to the specified
operating
dir
ectory, when it's valid
. */
void
init_operating_dir
(
void
)
{
if
(
operating_dir
==
NULL
)
return
;
full_operating_dir
=
get_full_path
(
operating_dir
);
/* If the operating directory is inaccessible, fail. */
...
...
@@ -1493,17 +1490,13 @@ int prompt_failed_backupwrite(const char *filename)
return
response
;
}
/* Transform the specified backup directory to an absolute path. */
void
init_backup_dir
(
void
)
{
char
*
full_backup_dir
;
if
(
backup_dir
==
NULL
)
return
;
full_backup_dir
=
get_full_path
(
backup_dir
);
char
*
full_backup_dir
=
get_full_path
(
backup_dir
);
/*
If get_full_path() failed or the backup
directory
is
*
inaccessible, unset
backup
_dir
. */
/*
When we can't get an absolute path, or it's not a
directory
,
*
cancel the making of
backup
s
. */
if
(
full_backup_dir
==
NULL
||
full_backup_dir
[
strlen
(
full_backup_dir
)
-
1
]
!=
'/'
)
{
free
(
full_backup_dir
);
...
...
This diff is collapsed.
Click to expand it.
src/nano.c
View file @
276ab2c8
...
...
@@ -2374,19 +2374,18 @@ int main(int argc, char **argv)
#endif
/* !DISABLE_HISTORIES */
#ifndef NANO_TINY
/* Set up the backup directory (unless we're using restricted mode,
* in which case backups are disabled, since they would allow
* reading from or writing to files not specified on the command
* line). This entails making sure it exists and is a directory, so
* that backup files will be saved there. */
if
(
!
ISSET
(
RESTRICTED
))
/* If a backup directory was specified and we're not in restricted mode,
* make sure the path exists and is a directory, so that backup files can
* be saved there. */
if
(
backup_dir
!=
NULL
&&
!
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. */
init_operating_dir
();
if
(
operating_dir
!=
NULL
)
init_operating_dir
();
#endif
#ifndef DISABLE_JUSTIFY
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment
Menu
Projects
Groups
Snippets
Help