Changes in src/libcfa/fstream.c [53a6c2a:9ebd778]
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/libcfa/fstream.c
r53a6c2a r9ebd778 10 10 // Created On : Wed May 27 17:56:53 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Thu Jul 6 18:38:25201713 // Update Count : 2 5112 // Last Modified On : Mon May 15 18:11:11 2017 13 // Update Count : 234 14 14 // 15 15 … … 39 39 40 40 // private 41 _Bool sepPrt( ofstream * os ) { setNL( os, false );return os->sepOnOff; }41 _Bool sepPrt( ofstream * os ) { return os->sepOnOff; } 42 42 void sepReset( ofstream * os ) { os->sepOnOff = os->sepDefault; } 43 43 void sepReset( ofstream * os, _Bool reset ) { os->sepDefault = reset; os->sepOnOff = os->sepDefault; } 44 44 const char * sepGetCur( ofstream * os ) { return os->sepCur; } 45 45 void sepSetCur( ofstream * os, const char * sepCur ) { os->sepCur = sepCur; } 46 _Bool getNL( ofstream * os ) { return os->sawNL; }47 void setNL( ofstream * os, _Bool state ) { os->sawNL = state; }48 46 49 47 // public 50 void sepOn( ofstream * os ) { os->sepOnOff = ! getNL( os ); }51 void sepOff( ofstream * os ) { os->sepOnOff = false; }48 void sepOn( ofstream * os ) { os->sepOnOff = 1; } 49 void sepOff( ofstream * os ) { os->sepOnOff = 0; } 52 50 53 51 _Bool sepDisable( ofstream *os ) { … … 68 66 void sepSet( ofstream * os, const char * s ) { 69 67 assert( s ); 70 strncpy( os->separator, s, sep Size - 1 );71 os->separator[sep Size - 1] = '\0';68 strncpy( os->separator, s, separateSize - 1 ); 69 os->separator[separateSize - 1] = '\0'; 72 70 } // sepSet 73 71 … … 75 73 void sepSetTuple( ofstream * os, const char * s ) { 76 74 assert( s ); 77 strncpy( os->tupleSeparator, s, sep Size - 1 );78 os->tupleSeparator[sep Size - 1] = '\0';75 strncpy( os->tupleSeparator, s, separateSize - 1 ); 76 os->tupleSeparator[separateSize - 1] = '\0'; 79 77 } // sepSet 80 78 … … 94 92 exit( EXIT_FAILURE ); 95 93 } // if 96 ?{}( os, file, true, false, " ", ", " );94 ?{}( os, file, 1, 0, " ", ", " ); 97 95 } // open 98 96 … … 134 132 } // fmt 135 133 136 static ofstream soutFile = { (FILE *)(&_IO_2_1_stdout_), true, false, " ", ", " };134 static ofstream soutFile = { (FILE *)(&_IO_2_1_stdout_), 1, 0, " ", ", " }; 137 135 ofstream *sout = &soutFile; 138 static ofstream serrFile = { (FILE *)(&_IO_2_1_stderr_), true, false, " ", ", " };136 static ofstream serrFile = { (FILE *)(&_IO_2_1_stderr_), 1, 0, " ", ", " }; 139 137 ofstream *serr = &serrFile; 140 138 … … 152 150 153 151 void open( ifstream * is, const char * name, const char * mode ) { 154 FILE * file= fopen( name, mode );155 if ( file == 0 ) {// do not change unless successful152 FILE *t = fopen( name, mode ); 153 if ( t == 0 ) { // do not change unless successful 156 154 fprintf( stderr, IO_MSG "open input file \"%s\", ", name ); 157 155 perror( 0 ); 158 156 exit( EXIT_FAILURE ); 159 157 } // if 160 is->file = file;158 is->file = t; 161 159 } // open 162 160
Note:
See TracChangeset
for help on using the changeset viewer.