comparison src/file-io.cc @ 1750:fd0d12493223

[project @ 1996-01-13 09:31:07 by jwe]
author jwe
date Sat, 13 Jan 1996 09:31:07 +0000
parents a02f140ed897
children 3a9462b655f1
comparison
equal deleted inserted replaced
1749:c7f5599eb177 1750:fd0d12493223
62 #include "help.h" 62 #include "help.h"
63 #include "input.h" 63 #include "input.h"
64 #include "mappers.h" 64 #include "mappers.h"
65 #include "oct-map.h" 65 #include "oct-map.h"
66 #include "oct-hist.h" 66 #include "oct-hist.h"
67 #include "oct-obj.h"
67 #include "pager.h" 68 #include "pager.h"
68 #include "statdefs.h" 69 #include "statdefs.h"
69 #include "sysdep.h" 70 #include "sysdep.h"
70 #include "syswait.h" 71 #include "syswait.h"
71 #include "pt-const.h"
72 #include "oct-obj.h"
73 #include "utils.h" 72 #include "utils.h"
74 #include "variables.h" 73 #include "variables.h"
75 74
76 extern "C" void mode_string (); 75 extern "C" void mode_string ();
77 76
2484 { 2483 {
2485 Octave_object retval; 2484 Octave_object retval;
2486 2485
2487 if (args.length () == 1) 2486 if (args.length () == 1)
2488 { 2487 {
2489 string tstr = args(0).string_value (); 2488 string fname = oct_tilde_expand (args(0).string_value ());
2490 const char *name = tstr.c_str ();
2491
2492 static char *fname = 0;
2493
2494 if (fname)
2495 free (fname);
2496
2497 fname = tilde_expand (name);
2498 2489
2499 if (! error_state) 2490 if (! error_state)
2500 { 2491 {
2501 struct stat buf; 2492 struct stat buf;
2502 2493
2503 if (stat (fname, &buf) < 0) 2494 if (stat (fname.c_str (), &buf) < 0)
2504 retval = -1.0; 2495 retval = -1.0;
2505 else 2496 else
2506 retval = tree_constant (mk_stat_map (buf)); 2497 retval = tree_constant (mk_stat_map (buf));
2507 } 2498 }
2508 } 2499 }
2520 { 2511 {
2521 Octave_object retval; 2512 Octave_object retval;
2522 2513
2523 if (args.length () == 1) 2514 if (args.length () == 1)
2524 { 2515 {
2525 string tstr = args(0).string_value (); 2516 string fname = oct_tilde_expand (args(0).string_value ());
2526 const char *name = tstr.c_str ();
2527
2528 static char *fname = 0;
2529
2530 if (fname)
2531 free (fname);
2532
2533 fname = tilde_expand (name);
2534 2517
2535 if (! error_state) 2518 if (! error_state)
2536 { 2519 {
2537 struct stat buf; 2520 struct stat buf;
2538 2521
2539 if (lstat (fname, &buf) < 0) 2522 if (lstat (fname.c_str (), &buf) < 0)
2540 retval = -1.0; 2523 retval = -1.0;
2541 else 2524 else
2542 retval = tree_constant (mk_stat_map (buf)); 2525 retval = tree_constant (mk_stat_map (buf));
2543 } 2526 }
2544 } 2527 }