tweaks: reduce the scope of two variables, and rename them too
This reduction is possible since the routine no longer loops when it encounters a +NUMBER argument.master
parent
bee670424e
commit
40d34862fd
13
src/nano.c
13
src/nano.c
|
@ -2534,13 +2534,13 @@ int main(int argc, char **argv)
|
||||||
|
|
||||||
/* Read the named files on the command line into new buffers. */
|
/* Read the named files on the command line into new buffers. */
|
||||||
{
|
{
|
||||||
ssize_t iline = 0, icol = 0;
|
|
||||||
|
|
||||||
while (optind < argc && (!openfile || ISSET(MULTIBUFFER))) {
|
while (optind < argc && (!openfile || ISSET(MULTIBUFFER))) {
|
||||||
|
ssize_t givenline = 0, givencol = 0;
|
||||||
|
|
||||||
/* If there's a +LINE or +LINE,COLUMN flag here, it is followed
|
/* If there's a +LINE or +LINE,COLUMN flag here, it is followed
|
||||||
* by at least one other argument: the filename it applies to. */
|
* by at least one other argument: the filename it applies to. */
|
||||||
if (optind < argc - 1 && argv[optind][0] == '+') {
|
if (optind < argc - 1 && argv[optind][0] == '+') {
|
||||||
if (!parse_line_column(&argv[optind++][1], &iline, &icol))
|
if (!parse_line_column(&argv[optind++][1], &givenline, &givencol))
|
||||||
statusline(ALERT, _("Invalid line or column number"));
|
statusline(ALERT, _("Invalid line or column number"));
|
||||||
}
|
}
|
||||||
/* If opening fails, don't try to position the cursor. */
|
/* If opening fails, don't try to position the cursor. */
|
||||||
|
@ -2548,11 +2548,8 @@ int main(int argc, char **argv)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
/* If a position was given on the command line, go there. */
|
/* If a position was given on the command line, go there. */
|
||||||
if (iline > 0 || icol > 0) {
|
if (givenline > 0 || givencol > 0)
|
||||||
do_gotolinecolumn(iline, icol, FALSE, FALSE);
|
do_gotolinecolumn(givenline, givencol, FALSE, FALSE);
|
||||||
iline = 0;
|
|
||||||
icol = 0;
|
|
||||||
}
|
|
||||||
#ifndef DISABLE_HISTORIES
|
#ifndef DISABLE_HISTORIES
|
||||||
else if (ISSET(POS_HISTORY)) {
|
else if (ISSET(POS_HISTORY)) {
|
||||||
ssize_t savedposline, savedposcol;
|
ssize_t savedposline, savedposcol;
|
||||||
|
|
Loading…
Reference in New Issue