fork of PCE focusing on macplus, supporting DaynaPort SCSI network emulation
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

char-stdio: Add option 'append'

+11 -1
+4
doc/char-drivers.txt
··· 106 106 stdio: 107 107 Output is written to a file. Input is read from a file. 108 108 109 + append=[0|1] 110 + If true, open the output file for appending instead of 111 + truncating it. 112 + 109 113 file=<filename> 110 114 Set the output file name. 111 115
+6 -1
src/drivers/char/char-stdio.c
··· 129 129 static 130 130 int chr_stdio_init (char_stdio_t *drv, const char *name) 131 131 { 132 + const char *mode; 133 + 132 134 chr_init (&drv->cdrv, drv); 133 135 134 136 drv->cdrv.close = chr_stdio_close; ··· 142 144 143 145 drv->flush = drv_get_option_bool (name, "flush", 1); 144 146 drv->reopen = drv_get_option_bool (name, "reopen", 0); 147 + drv->append = drv_get_option_bool (name, "append", 0); 145 148 146 149 drv->write_name = drv_get_option (name, "write"); 147 150 ··· 155 158 drv->reopen = 0; 156 159 } 157 160 else { 158 - drv->write_fp = fopen (drv->write_name, "wb"); 161 + mode = drv->append ? "ab" : "wb"; 162 + 163 + drv->write_fp = fopen (drv->write_name, mode); 159 164 160 165 if (drv->write_fp == NULL) { 161 166 return (1);
+1
src/drivers/char/char-stdio.h
··· 34 34 35 35 char flush; 36 36 char reopen; 37 + char append; 37 38 38 39 char *read_name; 39 40 FILE *read_fp;