Mercurial > hg > octave-lyh
annotate liboctave/oct-rl-hist.c @ 14819:67b6b47a22f6
doc: Clarify docstrings for canonicalize_file_name, make_absolute_filename
* syscalls.cc (canonicalize_file_name): Clarify docstring.
* utils.cc (make_absolute_filename): Clarify docstring.
author | Rik <octave@nomad.inbox5.com> |
---|---|
date | Fri, 29 Jun 2012 13:38:28 -0700 |
parents | 72c96de7a403 |
children |
rev | line source |
---|---|
3519 | 1 /* |
2 | |
14138
72c96de7a403
maint: update copyright notices for 2012
John W. Eaton <jwe@octave.org>
parents:
11586
diff
changeset
|
3 Copyright (C) 2000-2012 John W. Eaton |
3519 | 4 |
5 This file is part of Octave. | |
6 | |
7 Octave is free software; you can redistribute it and/or modify it | |
8 under the terms of the GNU General Public License as published by the | |
7016 | 9 Free Software Foundation; either version 3 of the License, or (at your |
10 option) any later version. | |
3519 | 11 |
12 Octave is distributed in the hope that it will be useful, but WITHOUT | |
13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
15 for more details. | |
16 | |
17 You should have received a copy of the GNU General Public License | |
7016 | 18 along with Octave; see the file COPYING. If not, see |
19 <http://www.gnu.org/licenses/>. | |
3519 | 20 |
21 */ | |
22 | |
23 #ifdef HAVE_CONFIG_H | |
24 #include <config.h> | |
25 #endif | |
26 | |
11486
a1deab9a6e71
bash-like history control
Pascal Dupuis <Pascal.Dupuis@worldonline.be> and John W. Eaton <jwe@octave.org>
parents:
10317
diff
changeset
|
27 #include "oct-rl-hist.h" |
a1deab9a6e71
bash-like history control
Pascal Dupuis <Pascal.Dupuis@worldonline.be> and John W. Eaton <jwe@octave.org>
parents:
10317
diff
changeset
|
28 |
3519 | 29 #if defined (USE_READLINE) |
30 | |
31 #include <stdio.h> | |
32 #include <stdlib.h> | |
4587 | 33 #include <string.h> |
3519 | 34 |
35 #include <readline/history.h> | |
36 | |
11486
a1deab9a6e71
bash-like history control
Pascal Dupuis <Pascal.Dupuis@worldonline.be> and John W. Eaton <jwe@octave.org>
parents:
10317
diff
changeset
|
37 /* check_history_control, hc_erasedup, and the core of |
a1deab9a6e71
bash-like history control
Pascal Dupuis <Pascal.Dupuis@worldonline.be> and John W. Eaton <jwe@octave.org>
parents:
10317
diff
changeset
|
38 octave_add_history were borrowed from Bash. */ |
a1deab9a6e71
bash-like history control
Pascal Dupuis <Pascal.Dupuis@worldonline.be> and John W. Eaton <jwe@octave.org>
parents:
10317
diff
changeset
|
39 |
a1deab9a6e71
bash-like history control
Pascal Dupuis <Pascal.Dupuis@worldonline.be> and John W. Eaton <jwe@octave.org>
parents:
10317
diff
changeset
|
40 /* Check LINE against what HISTCONTROL says to do. Returns 1 if the line |
a1deab9a6e71
bash-like history control
Pascal Dupuis <Pascal.Dupuis@worldonline.be> and John W. Eaton <jwe@octave.org>
parents:
10317
diff
changeset
|
41 should be saved; 0 if it should be discarded. */ |
a1deab9a6e71
bash-like history control
Pascal Dupuis <Pascal.Dupuis@worldonline.be> and John W. Eaton <jwe@octave.org>
parents:
10317
diff
changeset
|
42 static int |
a1deab9a6e71
bash-like history control
Pascal Dupuis <Pascal.Dupuis@worldonline.be> and John W. Eaton <jwe@octave.org>
parents:
10317
diff
changeset
|
43 check_history_control (const char *line, int history_control) |
3519 | 44 { |
11486
a1deab9a6e71
bash-like history control
Pascal Dupuis <Pascal.Dupuis@worldonline.be> and John W. Eaton <jwe@octave.org>
parents:
10317
diff
changeset
|
45 HIST_ENTRY *temp; |
a1deab9a6e71
bash-like history control
Pascal Dupuis <Pascal.Dupuis@worldonline.be> and John W. Eaton <jwe@octave.org>
parents:
10317
diff
changeset
|
46 int r; |
a1deab9a6e71
bash-like history control
Pascal Dupuis <Pascal.Dupuis@worldonline.be> and John W. Eaton <jwe@octave.org>
parents:
10317
diff
changeset
|
47 |
a1deab9a6e71
bash-like history control
Pascal Dupuis <Pascal.Dupuis@worldonline.be> and John W. Eaton <jwe@octave.org>
parents:
10317
diff
changeset
|
48 if (history_control == 0) |
a1deab9a6e71
bash-like history control
Pascal Dupuis <Pascal.Dupuis@worldonline.be> and John W. Eaton <jwe@octave.org>
parents:
10317
diff
changeset
|
49 return 1; |
a1deab9a6e71
bash-like history control
Pascal Dupuis <Pascal.Dupuis@worldonline.be> and John W. Eaton <jwe@octave.org>
parents:
10317
diff
changeset
|
50 |
a1deab9a6e71
bash-like history control
Pascal Dupuis <Pascal.Dupuis@worldonline.be> and John W. Eaton <jwe@octave.org>
parents:
10317
diff
changeset
|
51 /* ignorespace or ignoreboth */ |
a1deab9a6e71
bash-like history control
Pascal Dupuis <Pascal.Dupuis@worldonline.be> and John W. Eaton <jwe@octave.org>
parents:
10317
diff
changeset
|
52 if ((history_control & HC_IGNSPACE) && *line == ' ') |
a1deab9a6e71
bash-like history control
Pascal Dupuis <Pascal.Dupuis@worldonline.be> and John W. Eaton <jwe@octave.org>
parents:
10317
diff
changeset
|
53 return 0; |
a1deab9a6e71
bash-like history control
Pascal Dupuis <Pascal.Dupuis@worldonline.be> and John W. Eaton <jwe@octave.org>
parents:
10317
diff
changeset
|
54 |
a1deab9a6e71
bash-like history control
Pascal Dupuis <Pascal.Dupuis@worldonline.be> and John W. Eaton <jwe@octave.org>
parents:
10317
diff
changeset
|
55 /* ignoredups or ignoreboth */ |
a1deab9a6e71
bash-like history control
Pascal Dupuis <Pascal.Dupuis@worldonline.be> and John W. Eaton <jwe@octave.org>
parents:
10317
diff
changeset
|
56 if (history_control & HC_IGNDUPS) |
a1deab9a6e71
bash-like history control
Pascal Dupuis <Pascal.Dupuis@worldonline.be> and John W. Eaton <jwe@octave.org>
parents:
10317
diff
changeset
|
57 { |
a1deab9a6e71
bash-like history control
Pascal Dupuis <Pascal.Dupuis@worldonline.be> and John W. Eaton <jwe@octave.org>
parents:
10317
diff
changeset
|
58 using_history (); |
a1deab9a6e71
bash-like history control
Pascal Dupuis <Pascal.Dupuis@worldonline.be> and John W. Eaton <jwe@octave.org>
parents:
10317
diff
changeset
|
59 temp = previous_history (); |
a1deab9a6e71
bash-like history control
Pascal Dupuis <Pascal.Dupuis@worldonline.be> and John W. Eaton <jwe@octave.org>
parents:
10317
diff
changeset
|
60 |
a1deab9a6e71
bash-like history control
Pascal Dupuis <Pascal.Dupuis@worldonline.be> and John W. Eaton <jwe@octave.org>
parents:
10317
diff
changeset
|
61 r = (temp == 0 || strcmp (temp->line, line)); |
a1deab9a6e71
bash-like history control
Pascal Dupuis <Pascal.Dupuis@worldonline.be> and John W. Eaton <jwe@octave.org>
parents:
10317
diff
changeset
|
62 |
a1deab9a6e71
bash-like history control
Pascal Dupuis <Pascal.Dupuis@worldonline.be> and John W. Eaton <jwe@octave.org>
parents:
10317
diff
changeset
|
63 using_history (); |
a1deab9a6e71
bash-like history control
Pascal Dupuis <Pascal.Dupuis@worldonline.be> and John W. Eaton <jwe@octave.org>
parents:
10317
diff
changeset
|
64 |
a1deab9a6e71
bash-like history control
Pascal Dupuis <Pascal.Dupuis@worldonline.be> and John W. Eaton <jwe@octave.org>
parents:
10317
diff
changeset
|
65 if (r == 0) |
a1deab9a6e71
bash-like history control
Pascal Dupuis <Pascal.Dupuis@worldonline.be> and John W. Eaton <jwe@octave.org>
parents:
10317
diff
changeset
|
66 return r; |
a1deab9a6e71
bash-like history control
Pascal Dupuis <Pascal.Dupuis@worldonline.be> and John W. Eaton <jwe@octave.org>
parents:
10317
diff
changeset
|
67 } |
a1deab9a6e71
bash-like history control
Pascal Dupuis <Pascal.Dupuis@worldonline.be> and John W. Eaton <jwe@octave.org>
parents:
10317
diff
changeset
|
68 |
a1deab9a6e71
bash-like history control
Pascal Dupuis <Pascal.Dupuis@worldonline.be> and John W. Eaton <jwe@octave.org>
parents:
10317
diff
changeset
|
69 return 1; |
a1deab9a6e71
bash-like history control
Pascal Dupuis <Pascal.Dupuis@worldonline.be> and John W. Eaton <jwe@octave.org>
parents:
10317
diff
changeset
|
70 } |
a1deab9a6e71
bash-like history control
Pascal Dupuis <Pascal.Dupuis@worldonline.be> and John W. Eaton <jwe@octave.org>
parents:
10317
diff
changeset
|
71 |
a1deab9a6e71
bash-like history control
Pascal Dupuis <Pascal.Dupuis@worldonline.be> and John W. Eaton <jwe@octave.org>
parents:
10317
diff
changeset
|
72 /* Remove all entries matching LINE from the history list. Triggered when |
a1deab9a6e71
bash-like history control
Pascal Dupuis <Pascal.Dupuis@worldonline.be> and John W. Eaton <jwe@octave.org>
parents:
10317
diff
changeset
|
73 HISTCONTROL includes `erasedups'. */ |
a1deab9a6e71
bash-like history control
Pascal Dupuis <Pascal.Dupuis@worldonline.be> and John W. Eaton <jwe@octave.org>
parents:
10317
diff
changeset
|
74 |
a1deab9a6e71
bash-like history control
Pascal Dupuis <Pascal.Dupuis@worldonline.be> and John W. Eaton <jwe@octave.org>
parents:
10317
diff
changeset
|
75 static void |
a1deab9a6e71
bash-like history control
Pascal Dupuis <Pascal.Dupuis@worldonline.be> and John W. Eaton <jwe@octave.org>
parents:
10317
diff
changeset
|
76 hc_erasedups (const char *line) |
a1deab9a6e71
bash-like history control
Pascal Dupuis <Pascal.Dupuis@worldonline.be> and John W. Eaton <jwe@octave.org>
parents:
10317
diff
changeset
|
77 { |
a1deab9a6e71
bash-like history control
Pascal Dupuis <Pascal.Dupuis@worldonline.be> and John W. Eaton <jwe@octave.org>
parents:
10317
diff
changeset
|
78 HIST_ENTRY *temp; |
a1deab9a6e71
bash-like history control
Pascal Dupuis <Pascal.Dupuis@worldonline.be> and John W. Eaton <jwe@octave.org>
parents:
10317
diff
changeset
|
79 int r; |
a1deab9a6e71
bash-like history control
Pascal Dupuis <Pascal.Dupuis@worldonline.be> and John W. Eaton <jwe@octave.org>
parents:
10317
diff
changeset
|
80 |
a1deab9a6e71
bash-like history control
Pascal Dupuis <Pascal.Dupuis@worldonline.be> and John W. Eaton <jwe@octave.org>
parents:
10317
diff
changeset
|
81 using_history (); |
11490
0a4dfc867e60
avoid GCC warning for oct-rl-hist.c
John W. Eaton <jwe@octave.org>
parents:
11486
diff
changeset
|
82 while ((temp = previous_history ())) |
11486
a1deab9a6e71
bash-like history control
Pascal Dupuis <Pascal.Dupuis@worldonline.be> and John W. Eaton <jwe@octave.org>
parents:
10317
diff
changeset
|
83 { |
a1deab9a6e71
bash-like history control
Pascal Dupuis <Pascal.Dupuis@worldonline.be> and John W. Eaton <jwe@octave.org>
parents:
10317
diff
changeset
|
84 if (! strcmp (temp->line, line)) |
a1deab9a6e71
bash-like history control
Pascal Dupuis <Pascal.Dupuis@worldonline.be> and John W. Eaton <jwe@octave.org>
parents:
10317
diff
changeset
|
85 { |
a1deab9a6e71
bash-like history control
Pascal Dupuis <Pascal.Dupuis@worldonline.be> and John W. Eaton <jwe@octave.org>
parents:
10317
diff
changeset
|
86 r = where_history (); |
a1deab9a6e71
bash-like history control
Pascal Dupuis <Pascal.Dupuis@worldonline.be> and John W. Eaton <jwe@octave.org>
parents:
10317
diff
changeset
|
87 remove_history (r); |
a1deab9a6e71
bash-like history control
Pascal Dupuis <Pascal.Dupuis@worldonline.be> and John W. Eaton <jwe@octave.org>
parents:
10317
diff
changeset
|
88 } |
a1deab9a6e71
bash-like history control
Pascal Dupuis <Pascal.Dupuis@worldonline.be> and John W. Eaton <jwe@octave.org>
parents:
10317
diff
changeset
|
89 } |
a1deab9a6e71
bash-like history control
Pascal Dupuis <Pascal.Dupuis@worldonline.be> and John W. Eaton <jwe@octave.org>
parents:
10317
diff
changeset
|
90 using_history (); |
a1deab9a6e71
bash-like history control
Pascal Dupuis <Pascal.Dupuis@worldonline.be> and John W. Eaton <jwe@octave.org>
parents:
10317
diff
changeset
|
91 } |
a1deab9a6e71
bash-like history control
Pascal Dupuis <Pascal.Dupuis@worldonline.be> and John W. Eaton <jwe@octave.org>
parents:
10317
diff
changeset
|
92 |
a1deab9a6e71
bash-like history control
Pascal Dupuis <Pascal.Dupuis@worldonline.be> and John W. Eaton <jwe@octave.org>
parents:
10317
diff
changeset
|
93 /* Check LINE against HISTCONTROL and add it to the history if it's OK. |
a1deab9a6e71
bash-like history control
Pascal Dupuis <Pascal.Dupuis@worldonline.be> and John W. Eaton <jwe@octave.org>
parents:
10317
diff
changeset
|
94 Returns 1 if the line was saved in the history, 0 otherwise. */ |
a1deab9a6e71
bash-like history control
Pascal Dupuis <Pascal.Dupuis@worldonline.be> and John W. Eaton <jwe@octave.org>
parents:
10317
diff
changeset
|
95 |
a1deab9a6e71
bash-like history control
Pascal Dupuis <Pascal.Dupuis@worldonline.be> and John W. Eaton <jwe@octave.org>
parents:
10317
diff
changeset
|
96 int |
a1deab9a6e71
bash-like history control
Pascal Dupuis <Pascal.Dupuis@worldonline.be> and John W. Eaton <jwe@octave.org>
parents:
10317
diff
changeset
|
97 octave_add_history (const char *line, int history_control) |
a1deab9a6e71
bash-like history control
Pascal Dupuis <Pascal.Dupuis@worldonline.be> and John W. Eaton <jwe@octave.org>
parents:
10317
diff
changeset
|
98 { |
a1deab9a6e71
bash-like history control
Pascal Dupuis <Pascal.Dupuis@worldonline.be> and John W. Eaton <jwe@octave.org>
parents:
10317
diff
changeset
|
99 if (check_history_control (line, history_control)) |
a1deab9a6e71
bash-like history control
Pascal Dupuis <Pascal.Dupuis@worldonline.be> and John W. Eaton <jwe@octave.org>
parents:
10317
diff
changeset
|
100 { |
a1deab9a6e71
bash-like history control
Pascal Dupuis <Pascal.Dupuis@worldonline.be> and John W. Eaton <jwe@octave.org>
parents:
10317
diff
changeset
|
101 /* We're committed to saving the line. If the user has requested it, |
a1deab9a6e71
bash-like history control
Pascal Dupuis <Pascal.Dupuis@worldonline.be> and John W. Eaton <jwe@octave.org>
parents:
10317
diff
changeset
|
102 remove other matching lines from the history. */ |
a1deab9a6e71
bash-like history control
Pascal Dupuis <Pascal.Dupuis@worldonline.be> and John W. Eaton <jwe@octave.org>
parents:
10317
diff
changeset
|
103 |
a1deab9a6e71
bash-like history control
Pascal Dupuis <Pascal.Dupuis@worldonline.be> and John W. Eaton <jwe@octave.org>
parents:
10317
diff
changeset
|
104 if (history_control & HC_ERASEDUPS) |
a1deab9a6e71
bash-like history control
Pascal Dupuis <Pascal.Dupuis@worldonline.be> and John W. Eaton <jwe@octave.org>
parents:
10317
diff
changeset
|
105 hc_erasedups (line); |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
106 |
11486
a1deab9a6e71
bash-like history control
Pascal Dupuis <Pascal.Dupuis@worldonline.be> and John W. Eaton <jwe@octave.org>
parents:
10317
diff
changeset
|
107 add_history (line); |
a1deab9a6e71
bash-like history control
Pascal Dupuis <Pascal.Dupuis@worldonline.be> and John W. Eaton <jwe@octave.org>
parents:
10317
diff
changeset
|
108 |
a1deab9a6e71
bash-like history control
Pascal Dupuis <Pascal.Dupuis@worldonline.be> and John W. Eaton <jwe@octave.org>
parents:
10317
diff
changeset
|
109 return 1; |
a1deab9a6e71
bash-like history control
Pascal Dupuis <Pascal.Dupuis@worldonline.be> and John W. Eaton <jwe@octave.org>
parents:
10317
diff
changeset
|
110 } |
a1deab9a6e71
bash-like history control
Pascal Dupuis <Pascal.Dupuis@worldonline.be> and John W. Eaton <jwe@octave.org>
parents:
10317
diff
changeset
|
111 |
a1deab9a6e71
bash-like history control
Pascal Dupuis <Pascal.Dupuis@worldonline.be> and John W. Eaton <jwe@octave.org>
parents:
10317
diff
changeset
|
112 return 0; |
3519 | 113 } |
114 | |
115 int | |
116 octave_where_history (void) | |
117 { | |
118 return where_history (); | |
119 } | |
120 | |
121 int | |
122 octave_history_length (void) | |
123 { | |
124 return history_length; | |
125 } | |
126 | |
127 int | |
128 octave_max_input_history (void) | |
129 { | |
130 return max_input_history; | |
131 } | |
132 | |
133 int | |
134 octave_history_base (void) | |
135 { | |
136 return history_base; | |
137 } | |
138 | |
139 void | |
140 octave_stifle_history (int n) | |
141 { | |
3520 | 142 stifle_history (n); |
3519 | 143 } |
144 | |
145 int | |
146 octave_unstifle_history (void) | |
147 { | |
148 return unstifle_history (); | |
149 } | |
150 | |
151 int | |
152 octave_history_is_stifled (void) | |
153 { | |
154 return history_is_stifled (); | |
155 } | |
156 | |
157 int | |
158 octave_history_set_pos (int n) | |
159 { | |
160 return history_set_pos (n); | |
161 } | |
162 | |
163 int | |
164 octave_read_history (const char *f) | |
165 { | |
166 return read_history (f); | |
167 } | |
168 | |
169 void | |
170 octave_using_history (void) | |
171 { | |
3520 | 172 using_history (); |
3519 | 173 } |
174 | |
175 int | |
176 octave_read_history_range (const char *f, int b, int e) | |
177 { | |
178 return read_history_range (f, b, e); | |
179 } | |
180 | |
181 int | |
182 octave_write_history (const char *f) | |
183 { | |
184 return write_history (f); | |
185 } | |
186 | |
187 int | |
188 octave_append_history (int n, const char *f) | |
189 { | |
190 return append_history (n, f); | |
191 } | |
192 | |
193 int | |
194 octave_history_truncate_file (const char *f, int n) | |
195 { | |
196 return history_truncate_file (f, n); | |
197 } | |
198 | |
199 void | |
200 octave_remove_history (int n) | |
201 { | |
202 HIST_ENTRY *discard = remove_history (n); | |
203 | |
204 if (discard) | |
205 { | |
206 if (discard->line) | |
10317
42d098307c30
untabify additional source files
John W. Eaton <jwe@octave.org>
parents:
10158
diff
changeset
|
207 free (discard->line); |
3519 | 208 |
209 free (discard); | |
210 } | |
211 } | |
212 | |
213 char * | |
214 octave_history_goto_mark (int n) | |
215 { | |
216 HIST_ENTRY *h; | |
217 | |
218 char *retval = 0; | |
219 | |
220 if (history_set_pos (n)) | |
221 { | |
222 h = current_history (); | |
223 | |
224 if (h) | |
10317
42d098307c30
untabify additional source files
John W. Eaton <jwe@octave.org>
parents:
10158
diff
changeset
|
225 retval = h->line; |
3519 | 226 } |
227 | |
228 return retval; | |
229 } | |
230 | |
231 char * | |
232 octave_history_get (int n) | |
233 { | |
234 char *retval = 0; | |
235 | |
236 HIST_ENTRY *h = history_get (n); | |
237 | |
238 if (h) | |
239 retval = h->line; | |
240 | |
241 return retval; | |
242 } | |
243 | |
244 char ** | |
245 octave_history_list (int limit, int number_lines) | |
246 { | |
247 static char **retval = 0; | |
248 | |
249 HIST_ENTRY **hlist = 0; | |
250 | |
251 if (retval) | |
252 { | |
253 char **p = retval; | |
254 | |
3598 | 255 while (*p) |
10317
42d098307c30
untabify additional source files
John W. Eaton <jwe@octave.org>
parents:
10158
diff
changeset
|
256 free (*p++); |
3519 | 257 |
258 free (retval); | |
259 | |
260 retval = 0; | |
261 } | |
262 | |
263 hlist = history_list (); | |
264 | |
265 if (hlist) | |
266 { | |
267 int i, k; | |
268 | |
269 int beg = 0; | |
270 int end = 0; | |
271 while (hlist[end]) | |
10317
42d098307c30
untabify additional source files
John W. Eaton <jwe@octave.org>
parents:
10158
diff
changeset
|
272 end++; |
3519 | 273 |
274 beg = (limit < 0 || end < limit) ? 0 : (end - limit); | |
275 | |
276 retval = malloc ((end - beg + 1) * sizeof (char **)); | |
277 | |
278 k = 0; | |
279 for (i = beg; i < end; i++) | |
10317
42d098307c30
untabify additional source files
John W. Eaton <jwe@octave.org>
parents:
10158
diff
changeset
|
280 { |
42d098307c30
untabify additional source files
John W. Eaton <jwe@octave.org>
parents:
10158
diff
changeset
|
281 char *line = hlist[i]->line; |
42d098307c30
untabify additional source files
John W. Eaton <jwe@octave.org>
parents:
10158
diff
changeset
|
282 int len = line ? strlen (line) : 0; |
42d098307c30
untabify additional source files
John W. Eaton <jwe@octave.org>
parents:
10158
diff
changeset
|
283 char *tmp = malloc (len + 64); |
3519 | 284 |
10317
42d098307c30
untabify additional source files
John W. Eaton <jwe@octave.org>
parents:
10158
diff
changeset
|
285 if (number_lines) |
42d098307c30
untabify additional source files
John W. Eaton <jwe@octave.org>
parents:
10158
diff
changeset
|
286 sprintf (tmp, "%5d%c%s", i + history_base, |
42d098307c30
untabify additional source files
John W. Eaton <jwe@octave.org>
parents:
10158
diff
changeset
|
287 hlist[i]->data ? '*' : ' ', |
42d098307c30
untabify additional source files
John W. Eaton <jwe@octave.org>
parents:
10158
diff
changeset
|
288 line ? line : ""); |
42d098307c30
untabify additional source files
John W. Eaton <jwe@octave.org>
parents:
10158
diff
changeset
|
289 else |
42d098307c30
untabify additional source files
John W. Eaton <jwe@octave.org>
parents:
10158
diff
changeset
|
290 sprintf (tmp, "%c%s", hlist[i]->data ? '*' : ' ', |
42d098307c30
untabify additional source files
John W. Eaton <jwe@octave.org>
parents:
10158
diff
changeset
|
291 line ? line : ""); |
3519 | 292 |
10317
42d098307c30
untabify additional source files
John W. Eaton <jwe@octave.org>
parents:
10158
diff
changeset
|
293 retval[k++] = tmp; |
42d098307c30
untabify additional source files
John W. Eaton <jwe@octave.org>
parents:
10158
diff
changeset
|
294 } |
3519 | 295 |
296 retval[k] = 0; | |
297 } | |
298 | |
299 return retval; | |
300 } | |
301 | |
302 void | |
303 octave_replace_history_entry (int which, const char *line) | |
304 { | |
305 HIST_ENTRY *discard = replace_history_entry (which, line, 0); | |
306 | |
307 if (discard) | |
308 { | |
309 if (discard->line) | |
10317
42d098307c30
untabify additional source files
John W. Eaton <jwe@octave.org>
parents:
10158
diff
changeset
|
310 free (discard->line); |
3519 | 311 |
312 free (discard); | |
313 } | |
314 } | |
315 | |
316 #endif |