1
|
1 // user-prefs.cc -*- C++ -*- |
|
2 /* |
|
3 |
1009
|
4 Copyright (C) 1992, 1993, 1994, 1995 John W. Eaton |
1
|
5 |
|
6 This file is part of Octave. |
|
7 |
|
8 Octave is free software; you can redistribute it and/or modify it |
|
9 under the terms of the GNU General Public License as published by the |
|
10 Free Software Foundation; either version 2, or (at your option) any |
|
11 later version. |
|
12 |
|
13 Octave is distributed in the hope that it will be useful, but WITHOUT |
|
14 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
15 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
16 for more details. |
|
17 |
|
18 You should have received a copy of the GNU General Public License |
|
19 along with Octave; see the file COPYING. If not, write to the Free |
|
20 Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. |
|
21 |
|
22 */ |
|
23 |
240
|
24 #ifdef HAVE_CONFIG_H |
1192
|
25 #include <config.h> |
1
|
26 #endif |
|
27 |
|
28 #include <string.h> |
|
29 |
|
30 #include "user-prefs.h" |
1086
|
31 #include "mappers.h" |
1
|
32 #include "error.h" |
|
33 #include "variables.h" |
|
34 #include "utils.h" |
|
35 |
|
36 // The list of user preferences. Values change when global variables |
|
37 // change, so we don\'t have to do a variable look up every time we |
|
38 // need to check a preference. |
|
39 user_preferences user_pref; |
|
40 |
720
|
41 // Initialize global user_pref structure. |
|
42 |
831
|
43 void |
720
|
44 init_user_prefs (void) |
|
45 { |
|
46 user_pref.automatic_replot = 0; |
1093
|
47 user_pref.define_all_return_values = 0; |
720
|
48 user_pref.do_fortran_indexing = 0; |
|
49 user_pref.empty_list_elements_ok = 0; |
|
50 user_pref.ignore_function_time_stamp = 0; |
|
51 user_pref.implicit_str_to_num_ok = 0; |
|
52 user_pref.ok_to_lose_imaginary_part = 0; |
|
53 user_pref.output_max_field_width = 0; |
|
54 user_pref.output_precision = 0; |
|
55 user_pref.page_screen_output = 0; |
|
56 user_pref.prefer_column_vectors = 0; |
|
57 user_pref.prefer_zero_one_indexing = 0; |
|
58 user_pref.print_answer_id_name = 0; |
|
59 user_pref.print_empty_dimensions = 0; |
|
60 user_pref.propagate_empty_matrices = 0; |
1045
|
61 user_pref.read_only_constants = 1; |
720
|
62 user_pref.resize_on_range_error = 0; |
|
63 user_pref.return_last_computed_value = 0; |
|
64 user_pref.save_precision = 0; |
|
65 user_pref.silent_functions = 0; |
|
66 user_pref.split_long_rows = 0; |
1198
|
67 user_pref.struct_levels_to_print = 0; |
1116
|
68 user_pref.suppress_verbose_help_message = 0; |
720
|
69 user_pref.treat_neg_dim_as_zero = 0; |
|
70 user_pref.warn_assign_as_truth_value = 0; |
|
71 user_pref.warn_comma_in_global_decl = 0; |
|
72 user_pref.warn_divide_by_zero = 0; |
1037
|
73 user_pref.warn_function_name_clash = 0; |
1093
|
74 user_pref.whitespace_in_literal_matrix = 0; |
720
|
75 |
|
76 user_pref.default_save_format = 0; |
|
77 user_pref.editor = 0; |
|
78 user_pref.gnuplot_binary = 0; |
|
79 user_pref.imagepath = 0; |
|
80 user_pref.info_file = 0; |
|
81 user_pref.loadpath = 0; |
|
82 user_pref.pager_binary = 0; |
|
83 user_pref.ps1 = 0; |
|
84 user_pref.ps2 = 0; |
1044
|
85 user_pref.ps4 = 0; |
720
|
86 user_pref.pwd = 0; |
|
87 } |
661
|
88 |
|
89 // Check the value of a string variable to see if it it's ok to do |
|
90 // something. |
|
91 // |
673
|
92 // return of 1 => always ok. |
|
93 // return of 0 => never ok. |
661
|
94 // return of -1 => ok, but give me warning (default). |
|
95 |
1
|
96 static int |
|
97 check_str_pref (char *var) |
|
98 { |
195
|
99 char *val = builtin_string_variable (var); |
1
|
100 int pref = -1; |
529
|
101 if (val) |
1
|
102 { |
|
103 if (strncmp (val, "yes", 3) == 0 |
|
104 || strncmp (val, "true", 4) == 0) |
|
105 pref = 1; |
|
106 else if (strncmp (val, "never", 5) == 0 |
|
107 || strncmp (val, "no", 2) == 0 |
|
108 || strncmp (val, "false", 5) == 0) |
|
109 pref = 0; |
|
110 } |
|
111 return pref; |
|
112 } |
|
113 |
1198
|
114 // XXX FIXME XXX -- some of these should do their own checking to be |
|
115 // able to provide more meaningful warning or error messages. |
|
116 |
661
|
117 // Should a replot command be generated automatically each time a plot |
|
118 // changes in some way? |
|
119 |
|
120 int |
|
121 automatic_replot (void) |
|
122 { |
|
123 user_pref.automatic_replot = check_str_pref ("automatic_replot"); |
|
124 |
|
125 return 0; |
|
126 } |
|
127 |
|
128 |
1093
|
129 // Should variables returned from functions have default values if |
|
130 // they are otherwise uninitialized? |
661
|
131 |
430
|
132 int |
1093
|
133 define_all_return_values (void) |
430
|
134 { |
1093
|
135 user_pref.define_all_return_values = |
|
136 check_str_pref ("define_all_return_values"); |
|
137 |
430
|
138 return 0; |
|
139 } |
|
140 |
661
|
141 |
|
142 // Should we allow assignments like: |
|
143 // |
|
144 // octave> A(1) = 3; A(2) = 5 |
|
145 // |
|
146 // for A already defined and a matrix type? |
|
147 |
1
|
148 int |
|
149 do_fortran_indexing (void) |
|
150 { |
|
151 user_pref.do_fortran_indexing = |
|
152 check_str_pref ("do_fortran_indexing"); |
|
153 |
|
154 return 0; |
|
155 } |
|
156 |
661
|
157 |
|
158 // Should ignore empty elements in a matrix list (i.e., is an |
|
159 // expression like `[[], 1]' ok? |
|
160 |
1
|
161 int |
|
162 empty_list_elements_ok (void) |
|
163 { |
|
164 user_pref.empty_list_elements_ok = |
|
165 check_str_pref ("empty_list_elements_ok"); |
|
166 |
|
167 return 0; |
|
168 } |
|
169 |
661
|
170 |
|
171 // Should Octave always check to see if function files have changed |
|
172 // since they were last compiled? |
|
173 |
430
|
174 int |
|
175 ignore_function_time_stamp (void) |
|
176 { |
|
177 int pref = 0; |
|
178 |
|
179 char *val = builtin_string_variable ("ignore_function_time_stamp"); |
|
180 |
529
|
181 if (val) |
430
|
182 { |
|
183 if (strncmp (val, "all", 3) == 0) |
|
184 pref = 2; |
|
185 if (strncmp (val, "system", 6) == 0) |
|
186 pref = 1; |
|
187 } |
|
188 |
|
189 user_pref.ignore_function_time_stamp = pref; |
|
190 |
|
191 return 0; |
|
192 } |
|
193 |
661
|
194 |
|
195 // Should we allow things like: |
|
196 // |
|
197 // octave> 'abc' + 0 |
|
198 // 97 98 99 |
|
199 // |
|
200 // to happen? |
|
201 |
1
|
202 int |
|
203 implicit_str_to_num_ok (void) |
|
204 { |
|
205 user_pref.implicit_str_to_num_ok = |
|
206 check_str_pref ("implicit_str_to_num_ok"); |
|
207 |
|
208 return 0; |
|
209 } |
|
210 |
661
|
211 |
|
212 // Should we allow silent conversion of complex to real when a real |
|
213 // type is what we\'re really looking for? |
|
214 |
1
|
215 int |
|
216 ok_to_lose_imaginary_part (void) |
|
217 { |
|
218 user_pref.ok_to_lose_imaginary_part = |
|
219 check_str_pref ("ok_to_lose_imaginary_part"); |
|
220 |
|
221 return 0; |
|
222 } |
|
223 |
661
|
224 |
|
225 // If possible, send all output intended for the screen through the |
|
226 // pager. |
|
227 |
430
|
228 int |
|
229 page_screen_output (void) |
|
230 { |
|
231 user_pref.page_screen_output = check_str_pref ("page_screen_output"); |
|
232 |
|
233 return 0; |
|
234 } |
|
235 |
661
|
236 |
|
237 // When doing assignments like: |
|
238 // |
|
239 // octave> A(1) = 3; A(2) = 5 |
|
240 // |
|
241 // (for A undefined) should we build column vectors? Returning true |
|
242 // only matters when resize_on_range_error is also true. |
|
243 |
1
|
244 int |
|
245 prefer_column_vectors (void) |
|
246 { |
|
247 user_pref.prefer_column_vectors = |
|
248 check_str_pref ("prefer_column_vectors"); |
|
249 |
|
250 return 0; |
|
251 } |
|
252 |
661
|
253 |
|
254 // For things like |
|
255 // |
|
256 // a = [2,3]; a([1,1]) |
|
257 // |
|
258 // return [2 3] instead of [2 2]. |
|
259 |
1
|
260 int |
|
261 prefer_zero_one_indexing (void) |
|
262 { |
|
263 user_pref.prefer_zero_one_indexing = |
|
264 check_str_pref ("prefer_zero_one_indexing"); |
|
265 |
|
266 return 0; |
|
267 } |
|
268 |
661
|
269 |
|
270 // Should we print things like |
|
271 // |
|
272 // octave> a = [1,2;3,4] |
|
273 // a = |
|
274 // |
|
275 // 1 2 |
|
276 // 3 4 |
|
277 |
1
|
278 int |
|
279 print_answer_id_name (void) |
|
280 { |
|
281 user_pref.print_answer_id_name = |
|
282 check_str_pref ("print_answer_id_name"); |
|
283 |
|
284 return 0; |
|
285 } |
|
286 |
661
|
287 |
|
288 // Should we also print the dimensions of empty matrices? |
|
289 |
430
|
290 int |
|
291 print_empty_dimensions (void) |
|
292 { |
|
293 user_pref.print_empty_dimensions = |
|
294 check_str_pref ("print_empty_dimensions"); |
|
295 |
|
296 return 0; |
|
297 } |
|
298 |
661
|
299 |
|
300 // Should operations on empty matrices return empty matrices or an |
|
301 // error? |
|
302 |
1
|
303 int |
|
304 propagate_empty_matrices (void) |
|
305 { |
|
306 user_pref.propagate_empty_matrices = |
|
307 check_str_pref ("propagate_empty_matrices"); |
|
308 |
|
309 return 0; |
|
310 } |
|
311 |
1045
|
312 // Should built-in constants always be read only? |
|
313 |
|
314 int |
|
315 read_only_constants (void) |
|
316 { |
|
317 user_pref.read_only_constants = check_str_pref ("read_only_constants"); |
|
318 |
|
319 return 0; |
|
320 } |
661
|
321 |
|
322 // When doing assignments, should we resize matrices if the indices |
|
323 // are outside the current bounds? |
|
324 |
1
|
325 int |
|
326 resize_on_range_error (void) |
|
327 { |
|
328 user_pref.resize_on_range_error = |
|
329 check_str_pref ("resize_on_range_error"); |
|
330 |
|
331 return 0; |
|
332 } |
|
333 |
661
|
334 |
|
335 // If a function does not return any values explicitly, return the |
|
336 // last computed value. |
|
337 |
1
|
338 int |
|
339 return_last_computed_value (void) |
|
340 { |
|
341 user_pref.return_last_computed_value = |
|
342 check_str_pref ("return_last_computed_value"); |
|
343 |
|
344 return 0; |
|
345 } |
|
346 |
661
|
347 |
|
348 // Suppress printing results in called functions. |
|
349 |
1
|
350 int |
|
351 silent_functions (void) |
|
352 { |
|
353 user_pref.silent_functions = |
|
354 check_str_pref ("silent_functions"); |
|
355 |
|
356 return 0; |
|
357 } |
|
358 |
661
|
359 |
|
360 // Should should big matrices be split into smaller slices for output? |
|
361 |
1
|
362 int |
|
363 split_long_rows (void) |
|
364 { |
|
365 user_pref.split_long_rows = check_str_pref ("split_long_rows"); |
|
366 |
|
367 return 0; |
|
368 } |
|
369 |
661
|
370 |
1198
|
371 // How many levels of structure elements should we print? |
|
372 |
|
373 int |
|
374 struct_levels_to_print (void) |
|
375 { |
|
376 int status = 0; |
|
377 |
|
378 static int kludge = 0; |
|
379 |
|
380 double val; |
|
381 if (builtin_real_scalar_variable ("struct_levels_to_print", val) == 0 |
|
382 && ! xisnan (val)) |
|
383 { |
|
384 int ival = NINT (val); |
1201
|
385 if (ival >= 0 && (double) ival == val) |
1198
|
386 { |
|
387 user_pref.struct_levels_to_print = ival; |
|
388 return status; |
|
389 } |
|
390 } |
|
391 |
|
392 if (kludge == 0) |
|
393 kludge++; |
|
394 else |
|
395 { |
|
396 warning ("invalid value specified for struct_levels_to_print"); |
|
397 status = -1; |
|
398 } |
|
399 |
|
400 return status; |
|
401 } |
|
402 |
|
403 |
1116
|
404 // Suppress printing of additional help message in help and usage |
|
405 // functions? |
|
406 |
|
407 int |
|
408 suppress_verbose_help_message (void) |
|
409 { |
|
410 user_pref.suppress_verbose_help_message = |
|
411 check_str_pref ("suppress_verbose_help_message"); |
|
412 |
|
413 return 0; |
|
414 } |
|
415 |
|
416 |
661
|
417 // Should things like: |
|
418 // |
|
419 // octave> ones (-1, 5) |
|
420 // |
|
421 // result in an empty matrix or an error? |
|
422 |
1
|
423 int |
|
424 treat_neg_dim_as_zero (void) |
|
425 { |
|
426 user_pref.treat_neg_dim_as_zero = |
|
427 check_str_pref ("treat_neg_dim_as_zero"); |
|
428 |
|
429 return 0; |
|
430 } |
|
431 |
661
|
432 |
|
433 // Generate a warning for the assignment in things like |
|
434 // |
|
435 // octave> if (a = 2 < n) |
|
436 // |
|
437 // but not |
|
438 // |
|
439 // octave> if ((a = 2) < n) |
|
440 |
430
|
441 int |
|
442 warn_assign_as_truth_value (void) |
|
443 { |
|
444 user_pref.warn_assign_as_truth_value = |
|
445 check_str_pref ("warn_assign_as_truth_value"); |
|
446 |
|
447 return 0; |
|
448 } |
|
449 |
661
|
450 |
|
451 // Generate a warning for the comma in things like |
|
452 // |
|
453 // octave> global a, b = 2 |
|
454 |
1
|
455 int |
|
456 warn_comma_in_global_decl (void) |
|
457 { |
|
458 user_pref.warn_comma_in_global_decl = |
|
459 check_str_pref ("warn_comma_in_global_decl"); |
|
460 |
|
461 return 0; |
|
462 } |
|
463 |
661
|
464 |
|
465 // On IEEE machines, allow divide by zero errors to be suppressed. |
|
466 |
1
|
467 int |
|
468 warn_divide_by_zero (void) |
|
469 { |
|
470 user_pref.warn_divide_by_zero = check_str_pref ("warn_divide_by_zero"); |
|
471 |
|
472 return 0; |
|
473 } |
|
474 |
1037
|
475 // Generate warning if declared function name disagrees with the name |
|
476 // of the file in which it is defined. |
|
477 |
|
478 int |
|
479 warn_function_name_clash (void) |
|
480 { |
|
481 user_pref.warn_function_name_clash = |
|
482 check_str_pref ("warn_function_name_clash"); |
|
483 |
|
484 return 0; |
|
485 } |
|
486 |
1093
|
487 |
|
488 // Should whitespace in a literal matrix list be automatically |
|
489 // converted to commas and semicolons? |
|
490 // |
|
491 // user specifies value of pref |
|
492 // -------------- ------------- |
|
493 // "ignore" 2 |
|
494 // "traditional" 1 |
|
495 // anything else 0 |
|
496 // |
|
497 // Octave will never insert a comma in a literal matrix list if the |
|
498 // user specifies "ignore". For example, the statement [1 2] will |
|
499 // result in an error instead of being treated the same as [1, 2], and |
|
500 // the statement |
|
501 // |
|
502 // [ 1, 2, |
|
503 // 3, 4 ] |
|
504 // |
|
505 // will result in the vector [1 2 3 4] instead of a matrix. |
|
506 // |
|
507 // Traditional behavior makes Octave convert spaces to a comma between |
|
508 // identifiers and `('. For example, the statement |
|
509 // |
|
510 // [eye (2)] |
|
511 // |
|
512 // will be parsed as |
|
513 // |
|
514 // [eye, (2)] |
|
515 // |
|
516 // and will result in an error since the `eye' function will be |
|
517 // called with no arguments. To get around this, you would have to |
|
518 // omit the space between `eye' and the `('. |
|
519 // |
|
520 // The default value is 0, which results in behavior that is the same |
|
521 // as traditional, except that Octave does not convert spaces to a |
|
522 // comma between identifiers and `('. For example, the statement |
|
523 // |
|
524 // [eye (2)] |
|
525 // |
|
526 // will result in a call to `eye' with the argument `2'. |
|
527 |
|
528 int |
|
529 whitespace_in_literal_matrix (void) |
|
530 { |
|
531 int pref = 0; |
|
532 char *val = builtin_string_variable ("whitespace_in_literal_matrix"); |
|
533 if (val) |
|
534 { |
|
535 if (strncmp (val, "ignore", 6) == 0) |
|
536 pref = 2; |
|
537 else if (strncmp (val, "traditional", 11) == 0) |
|
538 pref = 1; |
|
539 } |
|
540 user_pref.whitespace_in_literal_matrix = pref; |
|
541 return 0; |
|
542 } |
|
543 |
|
544 |
1
|
545 int |
|
546 set_output_max_field_width (void) |
|
547 { |
|
548 int status = 0; |
|
549 |
|
550 static int kludge = 0; |
|
551 |
|
552 double val; |
1086
|
553 if (builtin_real_scalar_variable ("output_max_field_width", val) == 0 |
|
554 && ! xisnan (val)) |
1
|
555 { |
|
556 int ival = NINT (val); |
|
557 if (ival > 0 && (double) ival == val) |
|
558 { |
1198
|
559 user_pref.output_max_field_width = ival; |
1
|
560 return status; |
|
561 } |
|
562 } |
|
563 |
|
564 if (kludge == 0) |
|
565 kludge++; |
|
566 else |
|
567 { |
|
568 warning ("invalid value specified for output_max_field_width"); |
|
569 status = -1; |
|
570 } |
|
571 |
|
572 return status; |
|
573 } |
|
574 |
|
575 int |
|
576 set_output_precision (void) |
|
577 { |
|
578 int status = 0; |
|
579 |
|
580 static int kludge = 0; |
|
581 |
|
582 double val; |
1086
|
583 if (builtin_real_scalar_variable ("output_precision", val) == 0 |
|
584 && ! xisnan (val)) |
1
|
585 { |
|
586 int ival = NINT (val); |
|
587 if (ival >= 0 && (double) ival == val) |
|
588 { |
|
589 user_pref.output_precision = ival; |
|
590 return status; |
|
591 } |
|
592 } |
|
593 |
|
594 if (kludge == 0) |
|
595 kludge++; |
|
596 else |
|
597 { |
|
598 warning ("invalid value specified for output_precision"); |
|
599 status = -1; |
|
600 } |
|
601 |
|
602 return status; |
|
603 } |
|
604 |
|
605 int |
275
|
606 set_save_precision (void) |
|
607 { |
|
608 int status = 0; |
|
609 |
|
610 static int kludge = 0; |
|
611 |
|
612 double val; |
1086
|
613 if (builtin_real_scalar_variable ("save_precision", val) == 0 |
|
614 && ! xisnan (val)) |
275
|
615 { |
|
616 int ival = NINT (val); |
|
617 if (ival >= 0 && (double) ival == val) |
|
618 { |
|
619 user_pref.save_precision = ival; |
|
620 return status; |
|
621 } |
|
622 } |
|
623 |
|
624 if (kludge == 0) |
|
625 kludge++; |
|
626 else |
|
627 { |
|
628 warning ("invalid value specified for save_precision"); |
|
629 status = -1; |
|
630 } |
|
631 |
|
632 return status; |
|
633 } |
|
634 |
|
635 int |
430
|
636 sv_editor (void) |
1
|
637 { |
|
638 int status = 0; |
|
639 |
430
|
640 char *s = builtin_string_variable ("EDITOR"); |
529
|
641 if (s) |
1
|
642 { |
430
|
643 delete [] user_pref.editor; |
|
644 user_pref.editor = s; |
1
|
645 } |
|
646 else |
|
647 { |
430
|
648 warning ("invalid value specified for EDITOR"); |
|
649 status = -1; |
|
650 } |
|
651 |
|
652 return status; |
|
653 } |
|
654 |
|
655 int |
605
|
656 sv_default_save_format (void) |
|
657 { |
|
658 int status = 0; |
|
659 |
|
660 char *s = builtin_string_variable ("default_save_format"); |
|
661 if (s) |
|
662 { |
|
663 delete [] user_pref.default_save_format; |
|
664 user_pref.default_save_format = s; |
|
665 } |
|
666 else |
|
667 { |
|
668 warning ("invalid value specified for default_save_format"); |
|
669 status = -1; |
|
670 } |
|
671 |
|
672 return status; |
|
673 } |
|
674 |
|
675 int |
430
|
676 sv_gnuplot_binary (void) |
|
677 { |
|
678 int status = 0; |
|
679 |
|
680 char *s = builtin_string_variable ("gnuplot_binary"); |
529
|
681 if (s) |
430
|
682 { |
|
683 delete [] user_pref.gnuplot_binary; |
|
684 user_pref.gnuplot_binary = s; |
|
685 } |
|
686 else |
|
687 { |
|
688 warning ("invalid value specified for gnuplot_binary"); |
1
|
689 status = -1; |
|
690 } |
|
691 |
|
692 return status; |
|
693 } |
|
694 |
|
695 int |
686
|
696 sv_imagepath (void) |
|
697 { |
|
698 int status = 0; |
|
699 |
|
700 char *s = builtin_string_variable ("IMAGEPATH"); |
|
701 if (s) |
|
702 { |
|
703 delete [] user_pref.imagepath; |
|
704 user_pref.imagepath = s; |
|
705 } |
|
706 else |
|
707 { |
|
708 warning ("invalid value specified for IMAGEPATH"); |
|
709 status = -1; |
|
710 } |
|
711 |
|
712 return status; |
|
713 } |
|
714 |
|
715 int |
186
|
716 sv_info_file (void) |
|
717 { |
|
718 int status = 0; |
|
719 |
195
|
720 char *s = builtin_string_variable ("INFO_FILE"); |
529
|
721 if (s) |
186
|
722 { |
|
723 delete [] user_pref.info_file; |
|
724 user_pref.info_file = s; |
|
725 } |
|
726 else |
|
727 { |
|
728 warning ("invalid value specified for INFO_FILE"); |
|
729 status = -1; |
|
730 } |
|
731 |
|
732 return status; |
|
733 } |
|
734 |
|
735 int |
430
|
736 sv_loadpath (void) |
195
|
737 { |
|
738 int status = 0; |
|
739 |
430
|
740 char *s = builtin_string_variable ("LOADPATH"); |
529
|
741 if (s) |
195
|
742 { |
430
|
743 delete [] user_pref.loadpath; |
1121
|
744 user_pref.loadpath = maybe_add_default_load_path (s); |
195
|
745 } |
|
746 else |
|
747 { |
430
|
748 warning ("invalid value specified for LOADPATH"); |
|
749 status = -1; |
|
750 } |
|
751 |
|
752 return status; |
|
753 } |
|
754 |
|
755 int |
|
756 sv_pager_binary (void) |
|
757 { |
|
758 int status = 0; |
|
759 |
|
760 char *s = builtin_string_variable ("PAGER"); |
529
|
761 if (s) |
430
|
762 { |
|
763 delete [] user_pref.pager_binary; |
|
764 user_pref.pager_binary = s; |
|
765 } |
|
766 else |
|
767 { |
|
768 warning ("invalid value specified for PAGER"); |
195
|
769 status = -1; |
|
770 } |
|
771 |
|
772 return status; |
|
773 } |
|
774 |
|
775 int |
1
|
776 sv_ps1 (void) |
|
777 { |
|
778 int status = 0; |
|
779 |
195
|
780 char *s = builtin_string_variable ("PS1"); |
529
|
781 if (s) |
1
|
782 { |
|
783 delete [] user_pref.ps1; |
|
784 user_pref.ps1 = s; |
|
785 } |
|
786 else |
|
787 { |
|
788 warning ("invalid value specified for PS1"); |
|
789 status = -1; |
|
790 } |
|
791 |
|
792 return status; |
|
793 } |
|
794 |
|
795 int |
|
796 sv_ps2 (void) |
|
797 { |
|
798 int status = 0; |
|
799 |
195
|
800 char *s = builtin_string_variable ("PS2"); |
529
|
801 if (s) |
1
|
802 { |
|
803 delete [] user_pref.ps2; |
|
804 user_pref.ps2 = s; |
|
805 } |
|
806 else |
|
807 { |
|
808 warning ("invalid value specified for PS2"); |
|
809 status = -1; |
|
810 } |
|
811 |
|
812 return status; |
|
813 } |
|
814 |
|
815 int |
1044
|
816 sv_ps4 (void) |
|
817 { |
|
818 int status = 0; |
|
819 |
|
820 char *s = builtin_string_variable ("PS4"); |
|
821 if (s) |
|
822 { |
|
823 delete [] user_pref.ps4; |
|
824 user_pref.ps4 = s; |
|
825 } |
|
826 else |
|
827 { |
|
828 warning ("invalid value specified for PS4"); |
|
829 status = -1; |
|
830 } |
|
831 |
|
832 return status; |
|
833 } |
|
834 |
|
835 int |
1
|
836 sv_pwd (void) |
|
837 { |
|
838 int status = 0; |
|
839 |
195
|
840 char *s = builtin_string_variable ("PWD"); |
529
|
841 if (s) |
1
|
842 { |
|
843 delete [] user_pref.pwd; |
|
844 user_pref.pwd = s; |
|
845 } |
|
846 else |
|
847 { |
|
848 warning ("invalid value specified for PWD"); |
|
849 status = -1; |
|
850 } |
|
851 |
|
852 return status; |
|
853 } |
|
854 |
|
855 /* |
|
856 ;;; Local Variables: *** |
|
857 ;;; mode: C++ *** |
|
858 ;;; page-delimiter: "^/\\*" *** |
|
859 ;;; End: *** |
|
860 */ |