From 7dcc8f1d7ac7f344dd04d67345114e738b1b380a Mon Sep 17 00:00:00 2001 From: Benno Schulenberg Date: Tue, 14 Jan 2020 14:18:07 +0100 Subject: [PATCH] tweaks: adjust the indentation after the previous change Also reshuffle some lines, and adjust the comments. --- src/nano.c | 6 ++---- src/rcfile.c | 27 +++++++++++++-------------- 2 files changed, 15 insertions(+), 18 deletions(-) diff --git a/src/nano.c b/src/nano.c index d3fb06bb..201dc8e0 100644 --- a/src/nano.c +++ b/src/nano.c @@ -1894,10 +1894,8 @@ int main(int argc, char **argv) if (*(tail(argv[0])) == 'r') SET(RESTRICTED); - while ((optchr = - getopt_long(argc, argv, - "ABC:DEFGHIJ:KLMNOPQ:RST:UVWX:Y:Zabcdef:ghijklmno:pr:s:tuvwxyz$", - long_options, NULL)) != -1) { + while ((optchr = getopt_long(argc, argv, "ABC:DEFGHIJ:KLMNOPQ:RST:UVWX:Y:Z" + "abcdef:ghijklmno:pr:s:tuvwxyz$", long_options, NULL)) != -1) { switch (optchr) { #ifndef NANO_TINY case 'A': diff --git a/src/rcfile.c b/src/rcfile.c index 1353119d..7285027c 100644 --- a/src/rcfile.c +++ b/src/rcfile.c @@ -1642,11 +1642,10 @@ bool have_nanorc(const char *path, const char *name) return is_good_file(nanorc); } -/* First read the system-wide rcfile, then the user's rcfile. */ +/* Process the nanorc file that was specified on the command line (if any), + * and otherwise the system-wide rcfile followed by the user's rcfile. */ void do_rcfiles(void) { - const char *xdgconfdir; - if (custom_nanorc) { nanorc = get_full_path(custom_nanorc); if (access(nanorc, F_OK) != 0) @@ -1654,22 +1653,22 @@ void do_rcfiles(void) } else nanorc = mallocstrcpy(nanorc, SYSCONFDIR "/nanorc"); - /* First process the system-wide nanorc, if it exists and is suitable. */ if (is_good_file(nanorc)) parse_one_nanorc(); if (custom_nanorc == NULL) { - get_homedir(); - xdgconfdir = getenv("XDG_CONFIG_HOME"); + const char *xdgconfdir = getenv("XDG_CONFIG_HOME"); - /* Now try the to find a nanorc file in the user's home directory or in - * the XDG configuration directories, and process the first one found. */ - if (have_nanorc(homedir, "/" HOME_RC_NAME) || - have_nanorc(xdgconfdir, "/nano/" RCFILE_NAME) || - have_nanorc(homedir, "/.config/nano/" RCFILE_NAME)) - parse_one_nanorc(); - else if (homedir == NULL && xdgconfdir == NULL) - jot_error(N_("I can't find my home directory! Wah!")); + get_homedir(); + + /* Now try to find a nanorc file in the user's home directory or in the + * XDG configuration directories, and process the first one found. */ + if (have_nanorc(homedir, "/" HOME_RC_NAME) || + have_nanorc(xdgconfdir, "/nano/" RCFILE_NAME) || + have_nanorc(homedir, "/.config/nano/" RCFILE_NAME)) + parse_one_nanorc(); + else if (homedir == NULL && xdgconfdir == NULL) + jot_error(N_("I can't find my home directory! Wah!")); } check_vitals_mapped();