Mercurial > hg > octave-lojdl
changeset 2435:3be97fe02051
[project @ 1996-10-27 21:31:29 by jwe]
author | jwe |
---|---|
date | Sun, 27 Oct 1996 21:31:30 +0000 |
parents | ced642d8ba6a |
children | a628e881be66 |
files | src/ChangeLog src/oct-hist.cc src/oct-stream.cc src/oct-stream.h src/strftime.c |
diffstat | 5 files changed, 45 insertions(+), 27 deletions(-) [+] |
line wrap: on
line diff
--- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,14 @@ +Sun Oct 27 14:06:44 1996 John W. Eaton <jwe@bevo.che.wisc.edu> + + * oct-hist.cc (do_history): Rewite option parsing to avoid + (probably bogus) errors from g++ on cygwin32 system. + + * strftime.c: Use autoconf macros TIME_WITH_SYS_TIME and + HAVE_SYS_TIME_H to decide which time.h files to include. + + * oct-stream.h, oct-stream.cc (octave_stream::error, + octave_base_stream::error): Rename errno => err_num. + Sat Oct 26 10:40:05 1996 John W. Eaton <jwe@bevo.che.wisc.edu> * oct-hist.cc (do_history): Move declaration of file inside
--- a/src/oct-hist.cc +++ b/src/oct-hist.cc @@ -131,9 +131,10 @@ int i; for (i = 1; i < argc; i++) { - if (argv[i][0] == '-' && argv[i].length () == 2 - && (argv[i][1] == 'r' || argv[i][1] == 'w' - || argv[i][1] == 'a' || argv[i][1] == 'n')) + string option = argv[i]; + + if (option == "-r" || option == "-w" || option == "-a" + || option == "-n") { if (i < argc - 1) { @@ -141,24 +142,25 @@ octave_command_history.set_file (file); } - switch (argv[i][1]) - { - case 'a': // Append `new' lines to file. - octave_command_history.append (); - break; + if (option == "-a") + // Append `new' lines to file. + octave_command_history.append (); + + else if (option == "-w") + // Write entire history. + octave_command_history.write (); - case 'w': // Write entire history. - octave_command_history.write (); - break; + else if (option == "-r") + // Read entire file. + octave_command_history.read (); - case 'r': // Read entire file. - octave_command_history.read (); - break; + else if (option == "-n") + // Read `new' history from file. + octave_command_history.read_range (); - case 'n': // Read `new' history from file. - octave_command_history.read_range (); - break; - } + else + panic_impossible (); + return; } else if (argv[i] == "-q")
--- a/src/oct-stream.cc +++ b/src/oct-stream.cc @@ -1904,9 +1904,9 @@ // Return current error message for this stream. string -octave_base_stream::error (bool clear_err, int& errno) +octave_base_stream::error (bool clear_err, int& err_num) { - errno = fail ? -1 : 0; + err_num = fail ? -1 : 0; string tmp = errmsg; @@ -2190,12 +2190,12 @@ } string -octave_stream::error (bool clear, int& errno) +octave_stream::error (bool clear, int& err_num) { string retval; if (stream_ok ("ferror", false)) - retval = rep->error (clear, errno); + retval = rep->error (clear, err_num); return retval; }
--- a/src/oct-stream.h +++ b/src/oct-stream.h @@ -258,7 +258,7 @@ // Return current error message for this stream. - string error (bool clear, int& errno); + string error (bool clear, int& err_num); protected: @@ -399,12 +399,12 @@ bool eof (void) const; - string error (bool clear, int& errno); + string error (bool clear, int& err_num); string error (bool clear = false) { - int errno; - return error (clear, errno); + int err_num; + return error (clear, err_num); } bool ok (void) const { return rep && rep->ok (); }
--- a/src/strftime.c +++ b/src/strftime.c @@ -80,7 +80,12 @@ #include <stdio.h> #include <sys/types.h> -#if defined(TM_IN_SYS_TIME) || (!defined(HAVE_TM_ZONE) && !defined(HAVE_TZNAME)) + +#if defined(TIME_WITH_SYS_TIME) +#include <sys/time.h> +#include <time.h> +#else +#if defined(HAVE_SYS_TIME_H) #include <sys/time.h> #else #include <time.h>