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