40
40
06 Jul 2016 : Work begins.
41
41
21 Oct 2016 : Refactorized CF function names.
42
42
24 Oct 2016 : Added reading and writing of empty lines and comments.
43
+ 03 May 2018 : Write final result.
43
44
*/
44
45
45
46
/* Defines for MESCC libraries
54
55
//#define CC_FCX // Support for user number in filenames.
55
56
//#define CC_FCX_DIR // Support for named user numbers - needs CC_FCX and DirToDrvUsr().
56
57
57
- //#define CC_FILEIO_SMALL // Exclude fread(), fwrite() and fgets().
58
-
59
58
//#define CC_NO_MUL // Exclude support for MULTIPLICATION.
60
59
//#define CC_NO_DIV // Exclude support for DIVISION and MODULUS.
61
60
//#define CC_NO_SWITCH // Exclude support for SWITCH.
62
61
63
62
#define CC_NO_ARGS // Exclude support for ARGC and ARGV.
64
63
64
+ #define CC_FGETS // fgets()
65
+ #define CC_FPUTS // fputs()
66
+
65
67
/* Standard MESCC library
66
68
----------------------
67
69
You must include this library;
73
75
------------------------
74
76
Leave only what you need.
75
77
*/
76
- // #include <alloc.h>
78
+ #include <alloc.h>
77
79
//#include <atexit.h>
78
80
//#include <bsearch.h>
79
81
//#include <clock.h>
80
- // #include <conio.h>
82
+ #include <conio.h>
81
83
//#include <cpm.h>
82
- // #include <ctype.h>
83
- // #include <fileio.h>
84
+ #include <ctype.h>
85
+ #include <fileio.h>
84
86
//#include <fprintf.h>
85
87
//#include <mem.h>
86
88
#include <printf.h>
89
91
//#include <redir.h>
90
92
//#include <setjmp.h>
91
93
//#include <sprintf.h>
92
- // #include <string.h>
94
+ #include <string.h>
93
95
//#include <xprintf.h>
94
96
//#include <z80.h>
95
97
@@ -191,6 +193,9 @@ main()
191
193
192
194
printf ("\n" );
193
195
196
+ if (CfWrite (cf , "test.cf" ))
197
+ error ("Can't write test.cf" );
198
+
194
199
printf ("Destroying CF\n\n" );
195
200
196
201
CfDestroy (cf );
@@ -207,7 +212,7 @@ char *key, *value;
207
212
208
213
result = CfSetKey (cf , key , value );
209
214
210
- printf ("Set %s = %s %s\n" , key , value , result ? " --> ERROR" : "" );
215
+ printf ("Set '%s' = '%s' %s\n" , key , value , result ? " --> ERROR" : "" );
211
216
}
212
217
213
218
set_bool (key , value )
@@ -217,7 +222,7 @@ char *key; int value;
217
222
218
223
result = CfSetBool (cf , key , value );
219
224
220
- printf ("Set %s = %s %s\n" , key , value ? "true" : "false" , result ? " --> ERROR" : "" );
225
+ printf ("Set '%s' = '%s' %s\n" , key , value ? "true" : "false" , result ? " --> ERROR" : "" );
221
226
}
222
227
223
228
set_str (key , value )
@@ -227,7 +232,7 @@ char *key, *value;
227
232
228
233
result = CfSetStr (cf , key , value );
229
234
230
- printf ("Set %s = \"%s\" %s\n" , key , value , result ? " --> ERROR" : "" );
235
+ printf ("Set '%s' = '%s' %s\n" , key , value , result ? " --> ERROR" : "" );
231
236
}
232
237
233
238
pr_keys (cf )
0 commit comments