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