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
56ce5f2b
Commit
56ce5f2b
authored
7 years ago
by
Benno Schulenberg
Browse files
Options
Download
Email Patches
Plain Diff
tweaks: rename a function and a variable, to better match what they do
Also improve some comments.
parent
5ebdd3fe
master
feature/match-parens
refactor/readbility
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/nano.c
+11
-8
src/nano.c
with
11 additions
and
8 deletions
+11
-8
src/nano.c
View file @
56ce5f2b
...
...
@@ -59,6 +59,9 @@ static struct termios oldterm;
static
struct
sigaction
act
;
/* Used to set up all our fun signal handlers. */
static
bool
input_was_aborted
=
FALSE
;
/* Whether reading from standard input was aborted via ^C. */
/* Create a new linestruct node. Note that we do not set prevnode->next
* to the new line. */
filestruct
*
make_new_node
(
filestruct
*
prevnode
)
...
...
@@ -1100,13 +1103,10 @@ void do_cancel(void)
;
}
static
bool
pager_input_aborted
=
FALSE
;
/* Did someone invoke the pager and abort it via ^C? */
/* Cancel reading from stdin like a pager. */
RETSIGTYPE
cancel_stdin_pager
(
int
signal
)
/* Make a note that reading from stdin was concluded with ^C. */
RETSIGTYPE
make_a_note
(
int
signal
)
{
pager_
input_aborted
=
TRUE
;
input_
was_
aborted
=
TRUE
;
}
/* Read whatever comes from standard input into a new buffer. */
...
...
@@ -1136,7 +1136,7 @@ bool scoop_stdin(void)
setup_failed
=
TRUE
;
nperror
(
"sigaction"
);
}
else
{
newaction
.
sa_handler
=
cancel_stdin_pager
;
newaction
.
sa_handler
=
make_a_note
;
if
(
sigaction
(
SIGINT
,
&
newaction
,
&
oldaction
)
==
-
1
)
{
setup_failed
=
TRUE
;
nperror
(
"sigaction"
);
...
...
@@ -1166,8 +1166,11 @@ bool scoop_stdin(void)
dup2
(
thetty
,
0
);
close
(
thetty
);
if
(
!
pager_input_aborted
)
/* If things went well, store the current state of the terminal. */
if
(
!
input_was_aborted
)
tcgetattr
(
0
,
&
oldterm
);
/* If it was changed, restore the handler for SIGINT. */
if
(
!
setup_failed
&&
sigaction
(
SIGINT
,
&
oldaction
,
NULL
)
==
-
1
)
nperror
(
"sigaction"
);
...
...
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