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
e8c7cf20
Commit
e8c7cf20
authored
8 years ago
by
Benno Schulenberg
Browse files
Options
Download
Email Patches
Plain Diff
startup: report an error when the given line or column number is invalid
This fixes
https://savannah.gnu.org/bugs/?50028
.
parent
605f0318
master
feature/match-parens
refactor/readbility
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/nano.c
+6
-4
src/nano.c
src/search.c
+1
-1
src/search.c
src/utils.c
+1
-1
src/utils.c
with
8 additions
and
6 deletions
+8
-6
src/nano.c
View file @
e8c7cf20
...
...
@@ -2557,7 +2557,8 @@ int main(int argc, char **argv)
* non-option argument, and it is followed by at least one other
* argument, the filename it applies to. */
if
(
0
<
optind
&&
optind
<
argc
-
1
&&
argv
[
optind
][
0
]
==
'+'
)
{
parse_line_column
(
&
argv
[
optind
][
1
],
&
startline
,
&
startcol
);
if
(
!
parse_line_column
(
&
argv
[
optind
][
1
],
&
startline
,
&
startcol
))
statusline
(
ALERT
,
_
(
"Invalid line or column number"
));
optind
++
;
}
...
...
@@ -2581,9 +2582,10 @@ int main(int argc, char **argv)
for
(;
i
<
argc
;
i
++
)
{
/* If there's a +LINE or +LINE,COLUMN flag here, it is followed
* by at least one other argument: the filename it applies to. */
if
(
i
<
argc
-
1
&&
argv
[
i
][
0
]
==
'+'
)
parse_line_column
(
&
argv
[
i
][
1
],
&
iline
,
&
icol
);
else
{
if
(
i
<
argc
-
1
&&
argv
[
i
][
0
]
==
'+'
)
{
if
(
!
parse_line_column
(
&
argv
[
i
][
1
],
&
iline
,
&
icol
))
statusline
(
ALERT
,
_
(
"Invalid line or column number"
));
}
else
{
/* If opening fails, don't try to position the cursor. */
if
(
!
open_buffer
(
argv
[
i
],
FALSE
))
continue
;
...
...
This diff is collapsed.
Click to expand it.
src/search.c
View file @
e8c7cf20
...
...
@@ -894,7 +894,7 @@ void do_gotolinecolumn(ssize_t line, ssize_t column, bool use_answer,
/* Try to extract one or two numbers from the user's response. */
if
(
!
parse_line_column
(
answer
,
&
line
,
&
column
))
{
status
bar
(
_
(
"Invalid line or column number"
));
status
line
(
ALERT
,
_
(
"Invalid line or column number"
));
return
;
}
}
else
{
...
...
This diff is collapsed.
Click to expand it.
src/utils.c
View file @
e8c7cf20
...
...
@@ -129,7 +129,7 @@ bool parse_line_column(const char *str, ssize_t *line, ssize_t *column)
firstpart
=
mallocstrcpy
(
NULL
,
str
);
firstpart
[
comma
-
str
]
=
'\0'
;
retval
=
parse_num
(
firstpart
,
line
);
retval
=
parse_num
(
firstpart
,
line
)
&&
retval
;
free
(
firstpart
);
...
...
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