Mercurial > octave-nkf
comparison src/pager.cc @ 2209:859030f15706
[project @ 1996-05-15 11:46:43 by jwe]
author | jwe |
---|---|
date | Wed, 15 May 1996 11:46:48 +0000 |
parents | 9be05ffc288a |
children | a3e39f8efed2 |
comparison
equal
deleted
inserted
replaced
2208:4be9ccca137b | 2209:859030f15706 |
---|---|
43 #include "pager.h" | 43 #include "pager.h" |
44 #include "sighandlers.h" | 44 #include "sighandlers.h" |
45 #include "unwind-prot.h" | 45 #include "unwind-prot.h" |
46 #include "utils.h" | 46 #include "utils.h" |
47 | 47 |
48 pid_t octave_pager_pid = -1; | 48 static pid_t octave_pager_pid = -1; |
49 | 49 |
50 // Our actual connection to the external pager. | 50 // Our actual connection to the external pager. |
51 static oprocstream *external_pager = 0; | 51 static oprocstream *external_pager = 0; |
52 | 52 |
53 // Nonzero means we write to the diary file. | 53 // Nonzero means we write to the diary file. |
87 | 87 |
88 if (saved_sigint_handler) | 88 if (saved_sigint_handler) |
89 { | 89 { |
90 octave_set_signal_handler (SIGINT, saved_sigint_handler); | 90 octave_set_signal_handler (SIGINT, saved_sigint_handler); |
91 saved_sigint_handler = 0; | 91 saved_sigint_handler = 0; |
92 } | |
93 } | |
94 | |
95 static void | |
96 pager_death_handler (pid_t pid, int status) | |
97 { | |
98 if (pid > 0) | |
99 { | |
100 if (WIFEXITED (status) || WIFSIGNALLED (status)) | |
101 { | |
102 octave_pager_pid = -1; | |
103 | |
104 // Don't call error() here because we don't want to set | |
105 // the error state. | |
106 | |
107 warning ("connection to external pager lost --"); | |
108 warning ("pending computations and output have been discarded"); | |
109 } | |
92 } | 110 } |
93 } | 111 } |
94 | 112 |
95 static void | 113 static void |
96 do_sync (const char *msg, bool bypass_pager) | 114 do_sync (const char *msg, bool bypass_pager) |
111 = octave_set_signal_handler (SIGINT, SIG_IGN); | 129 = octave_set_signal_handler (SIGINT, SIG_IGN); |
112 | 130 |
113 external_pager = new oprocstream (pgr.c_str ()); | 131 external_pager = new oprocstream (pgr.c_str ()); |
114 | 132 |
115 if (external_pager) | 133 if (external_pager) |
116 octave_pager_pid = external_pager->pid (); | 134 { |
135 octave_pager_pid = external_pager->pid (); | |
136 | |
137 octave_child_list::insert (octave_pager_pid, | |
138 pager_death_handler); | |
139 } | |
117 } | 140 } |
118 } | 141 } |
119 | 142 |
120 if (external_pager) | 143 if (external_pager) |
121 { | 144 { |