# HG changeset patch # User jwe # Date 747290366 0 # Node ID 3abd838cc4b3c0b20cbe78473842680cc09d0055 # Parent ab04b34037f0c177361909845a3c60074baec451 [project @ 1993-09-06 04:39:26 by jwe] (execute_startup_files): Try harder to avoid executing $HOME/.octaverc twice. diff -r ab04b34037f0 -r 3abd838cc4b3 src/octave.cc --- a/src/octave.cc Mon Sep 06 04:14:39 1993 +0000 +++ b/src/octave.cc Mon Sep 06 04:39:26 1993 +0000 @@ -28,6 +28,7 @@ #endif #include +#include #include #include #include @@ -230,16 +231,23 @@ // Try to execute commands from $HOME/.octaverc and ./.octaverc. + char *home_rc = (char *) NULL; if (home_directory != NULL) { - char *rc = strconcat (home_directory, "/.octaverc"); - - parse_and_execute (rc, 0); - - delete [] rc; + home_rc = strconcat (home_directory, "/.octaverc"); + parse_and_execute (home_rc, 0); } - if (strcmp (the_current_working_directory, home_directory) != 0) +// Names alone are not enough. + + struct stat home_rc_statbuf; + stat (home_rc, &home_rc_statbuf); + delete [] home_rc; + + struct stat dot_rc_statbuf; + stat ("./.octaverc", &dot_rc_statbuf); + + if (home_rc_statbuf.st_ino != dot_rc_statbuf.st_ino) parse_and_execute ("./.octaverc", 0); }