From acac8cefe55238edc3e0f22d8fd0fafcacf14278 Mon Sep 17 00:00:00 2001 From: rlar Date: Fri, 1 Jul 2011 19:19:59 +0000 Subject: [PATCH] winmain.c, remove redundant global variable `oflag' --- ChangeLog | 6 ++++++ src/main.c | 4 ---- src/nghelp.c | 1 - src/winmain.c | 37 ++++++++++++++++++------------------- 4 files changed, 24 insertions(+), 24 deletions(-) diff --git a/ChangeLog b/ChangeLog index b9dc3a1e1..380cc2b52 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2011-07-01 Robert Larice + * src/main.c , + * src/nghelp.c , + * src/winmain.c : + winmain.c, remove redundant global variable `oflag' + 2011-07-01 Robert Larice * src/xspice/cmpp/mod_lex.l : minor bug fix, use EOF diff --git a/src/main.c b/src/main.c index 048a03b3e..c4062ae5d 100644 --- a/src/main.c +++ b/src/main.c @@ -101,7 +101,6 @@ char *ft_rawfile = "rawspice.raw"; #ifdef HAS_WINDOWS extern void winmessage(char* new_msg); /* display a message box (defined in winmain.c)*/ extern void SetSource( char * Name); /* display the source file name in the source window */ -bool oflag = FALSE; /* Output over redefined I/O functions */ FILE *flogp = NULL; /* log file ('-o logfile' command line option) */ int xmain(int argc, char **argv); /* main function prototype */ #endif /* HAS_WINDOWS */ @@ -984,9 +983,6 @@ main(int argc, char **argv) perror (buf); sp_shutdown (EXIT_BAD); } -#ifdef HAS_WINDOWS - oflag = TRUE; /* All further output to -o log file */ -#endif } /* orflag */ #ifdef SIMULATOR if_getparam = spif_getparam_special; diff --git a/src/nghelp.c b/src/nghelp.c index 6e66c3ab0..1ccd76311 100644 --- a/src/nghelp.c +++ b/src/nghelp.c @@ -30,7 +30,6 @@ char *hlp_filelist[] = { "ngspice", 0 }; extern void ivars(); #ifdef HAS_WINDOWS -bool oflag = FALSE; /* Output over redefined I/O functions */ FILE *flogp; /* hvogt 15.12.2001 */ #endif /* HAS_WINDOWS */ diff --git a/src/winmain.c b/src/winmain.c index 6772c43b5..b27c8ea02 100644 --- a/src/winmain.c +++ b/src/winmain.c @@ -89,10 +89,9 @@ static SBufLine HistBuffer[HistSize]; /* History buffer for string window */ static int HistIndex = 0; /* History management */ static int HistPtr = 0; /* History management */ -extern bool oflag; /* if TRUE, Output to stdout redirected into file */ extern bool ft_ngdebug; /* some additional debug info printed */ extern bool ft_batchmode; -extern FILE *flogp; /* definition see xmain.c */ +extern FILE *flogp; /* definition see xmain.c, stdout redirected to file */ #include "winmain.h" /* Forward definition of main() */ @@ -963,7 +962,7 @@ THE_END: int f_f_l_u_s_h( FILE * __stream) { - if (((__stream == stdout) && (oflag == FALSE)) || (__stream == stderr)) + if (((__stream == stdout) && !flogp) || (__stream == stderr)) return 0; else return fflush(__stream); @@ -984,7 +983,7 @@ int fg_e_t_c( FILE * __stream) int f_g_e_t_p_o_s( FILE * __stream, fpos_t * __pos) { int result; - if ((__stream == stdin) || ((__stream == stdout) && (oflag == FALSE)) || (__stream == stderr)) { + if ((__stream == stdin) || ((__stream == stdout) && !flogp) || (__stream == stderr)) { assert(FALSE); return 0; } else @@ -1014,12 +1013,12 @@ char * fg_e_t_s(char * __s, int __n, FILE * __stream) int fp_u_t_c(int __c, FILE * __stream) { - if ((oflag == FALSE) && ((__stream == stdout) || (__stream == stderr))) { + if (!flogp && ((__stream == stdout) || (__stream == stderr))) { if ( __c == LF) w_putch( CR); return w_putch(__c); // Ausgabe in Datei *.log 14.6.2000 - } else if ((oflag == TRUE) && ((__stream == stdout) || __stream == stderr)) { + } else if (flogp && ((__stream == stdout) || __stream == stderr)) { return fputc( __c, flogp); } else return fputc( __c, __stream); @@ -1027,7 +1026,7 @@ int fp_u_t_c(int __c, FILE * __stream) int fp_u_t_s(const char * __s, FILE * __stream) { -// if (((__stream == stdout) && (oflag == FALSE)) || (__stream == stderr)) { hvogt 14.6.2000 +// if (((__stream == stdout) && !flogp) || (__stream == stderr)) { hvogt 14.6.2000 if ((__stream == stdout) || (__stream == stderr)) { int c = SE; @@ -1050,7 +1049,7 @@ int fp_r_i_n_t_f(FILE * __stream, const char * __format, ...) va_list args; va_start(args, __format); -// if (((__stream == stdout) && (oflag == FALSE)) || (__stream == stderr)) { +// if (((__stream == stdout) && !flogp) || (__stream == stderr)) { if ((__stream == stdout) || (__stream == stderr)) { s[0] = SE; @@ -1065,7 +1064,7 @@ int fp_r_i_n_t_f(FILE * __stream, const char * __format, ...) int f_c_l_o_s_e( FILE * __stream) { - if ((__stream == stdin) || ((__stream == stdout) && (oflag == FALSE)) || (__stream == stderr)) { + if ((__stream == stdin) || ((__stream == stdout) && !flogp) || (__stream == stderr)) { assert(FALSE); return 0; } @@ -1074,8 +1073,8 @@ int f_c_l_o_s_e( FILE * __stream) size_t f_r_e_a_d(void * __ptr, size_t __size, size_t __n, FILE * __stream) { -// if ((__stream == stdin) || ((__stream == stdout) && (oflag == FALSE)) || (__stream == stderr)) { - if (((__stream == stdout) && (oflag == FALSE)) || (__stream == stderr)) { +// if ((__stream == stdin) || ((__stream == stdout) && !flogp) || (__stream == stderr)) { + if (((__stream == stdout) && !flogp) || (__stream == stderr)) { assert(FALSE); return 0; } @@ -1102,7 +1101,7 @@ size_t f_r_e_a_d(void * __ptr, size_t __size, size_t __n, FILE * __stream) FILE * f_r_e_o_p_e_n(const char * __path, const char * __mode, FILE * __stream) { - if ((__stream == stdin)/* || ((__stream == stdout) && (oflag == FALSE)) || (__stream == stderr)*/) { + if ((__stream == stdin)/* || ((__stream == stdout) && !flogp) || (__stream == stderr)*/) { assert(FALSE); return 0; } @@ -1114,7 +1113,7 @@ int fs_c_a_n_f(FILE * __stream, const char * __format, ...) int result; va_list args; va_start(args, __format); - if ((__stream == stdin) || ((__stream == stdout) && (oflag == FALSE)) || (__stream == stderr)) { + if ((__stream == stdin) || ((__stream == stdout) && !flogp) || (__stream == stderr)) { assert(FALSE); return 0; } @@ -1125,7 +1124,7 @@ int fs_c_a_n_f(FILE * __stream, const char * __format, ...) int f_s_e_e_k(FILE * __stream, long __offset, int __whence) { - if ((__stream == stdin) || ((__stream == stdout) && (oflag == FALSE)) || (__stream == stderr)) { + if ((__stream == stdin) || ((__stream == stdout) && !flogp) || (__stream == stderr)) { assert(FALSE); return 0; } @@ -1134,7 +1133,7 @@ int f_s_e_e_k(FILE * __stream, long __offset, int __whence) int f_s_e_t_p_o_s(FILE * __stream, const fpos_t *__pos) { - if ((__stream == stdin) || ((__stream == stdout) && (oflag == FALSE)) || (__stream == stderr)) { + if ((__stream == stdin) || ((__stream == stdout) && !flogp) || (__stream == stderr)) { assert(FALSE); return 0; } @@ -1143,7 +1142,7 @@ int f_s_e_t_p_o_s(FILE * __stream, const fpos_t *__pos) long f_t_e_l_l(FILE * __stream) { - if ((__stream == stdin) || ((__stream == stdout) && (oflag == FALSE)) || (__stream == stderr)) { + if ((__stream == stdin) || ((__stream == stdout) && !flogp) || (__stream == stderr)) { assert(FALSE); return 0; } @@ -1195,7 +1194,7 @@ void p_e_r_r_o_r(const char * __s) fp_r_i_n_t_f(stderr, "%s: %s\n", __s, cp); /* output to message box sprintf(s, "%s: %s\n", __s, cp); - if (!oflag) winmessage(s);*/ + if (!flogp) winmessage(s);*/ } int p_r_i_n_t_f(const char * __format, ...) @@ -1238,7 +1237,7 @@ int vfp_r_i_n_t_f(FILE * __stream, const char * __format, void * __arglist) char s [IOBufSize]; s[0] = SE; -// if (((__stream == stdout) && (oflag == FALSE)) || (__stream == stderr)) { +// if (((__stream == stdout) && !flogp) || (__stream == stderr)) { if ((__stream == stdout) || (__stream == stderr)) { result = vsprintf( s, __format, __arglist); @@ -1432,7 +1431,7 @@ int system( const char * command) void winmessage(char* new_msg) { /* open a message box only if message is not written into -o xxx.log */ - if (oflag == FALSE) + if (!flogp) MessageBox(NULL, new_msg, "Ngspice Info", MB_OK|MB_ICONERROR); }