Skip to content

Commit 4fbee0a

Browse files
committed
cf: solved bug in quoted strings.
1 parent d37a6cd commit 4fbee0a

File tree

5 files changed

+101
-159
lines changed

5 files changed

+101
-159
lines changed

cf/CF.COM

128 Bytes
Binary file not shown.

cf/TEST.CF

+6-4
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
# Book data:
2-
title = That's cool!
3-
author = Jim Brown
2+
title = "That's cool!"
3+
author = "Jim Brown"
44
year = 1977
55
pages = 150
6-
summary = "This book, blah, blah, blah.."
6+
summary = "This book, blah, blah, blah..."
77

88
# Is it lent?
99
lent = true
10-

10+
lent_to = Peter
11+
lend_expires = "12 Jan 2017"
12+


cf/TEST_2.CF

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
# This is a comment
2-
lent_to = Peter Smith
2+
lent_to = Peter
33
lend_expires = 12 Jan 2017
44


cf/cf.c

+15-10
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
06 Jul 2016 : Work begins.
4141
21 Oct 2016 : Refactorized CF function names.
4242
24 Oct 2016 : Added reading and writing of empty lines and comments.
43+
03 May 2018 : Write final result.
4344
*/
4445

4546
/* Defines for MESCC libraries
@@ -54,14 +55,15 @@
5455
//#define CC_FCX // Support for user number in filenames.
5556
//#define CC_FCX_DIR // Support for named user numbers - needs CC_FCX and DirToDrvUsr().
5657

57-
//#define CC_FILEIO_SMALL // Exclude fread(), fwrite() and fgets().
58-
5958
//#define CC_NO_MUL // Exclude support for MULTIPLICATION.
6059
//#define CC_NO_DIV // Exclude support for DIVISION and MODULUS.
6160
//#define CC_NO_SWITCH // Exclude support for SWITCH.
6261

6362
#define CC_NO_ARGS // Exclude support for ARGC and ARGV.
6463

64+
#define CC_FGETS // fgets()
65+
#define CC_FPUTS // fputs()
66+
6567
/* Standard MESCC library
6668
----------------------
6769
You must include this library;
@@ -73,14 +75,14 @@
7375
------------------------
7476
Leave only what you need.
7577
*/
76-
//#include <alloc.h>
78+
#include <alloc.h>
7779
//#include <atexit.h>
7880
//#include <bsearch.h>
7981
//#include <clock.h>
80-
//#include <conio.h>
82+
#include <conio.h>
8183
//#include <cpm.h>
82-
//#include <ctype.h>
83-
//#include <fileio.h>
84+
#include <ctype.h>
85+
#include <fileio.h>
8486
//#include <fprintf.h>
8587
//#include <mem.h>
8688
#include <printf.h>
@@ -89,7 +91,7 @@
8991
//#include <redir.h>
9092
//#include <setjmp.h>
9193
//#include <sprintf.h>
92-
//#include <string.h>
94+
#include <string.h>
9395
//#include <xprintf.h>
9496
//#include <z80.h>
9597

@@ -191,6 +193,9 @@ main()
191193

192194
printf("\n");
193195

196+
if(CfWrite(cf, "test.cf"))
197+
error("Can't write test.cf");
198+
194199
printf("Destroying CF\n\n");
195200

196201
CfDestroy(cf);
@@ -207,7 +212,7 @@ char *key, *value;
207212

208213
result = CfSetKey(cf, key, value);
209214

210-
printf("Set %s = %s%s\n", key, value, result ? " --> ERROR" : "");
215+
printf("Set '%s' = '%s'%s\n", key, value, result ? " --> ERROR" : "");
211216
}
212217

213218
set_bool(key, value)
@@ -217,7 +222,7 @@ char *key; int value;
217222

218223
result = CfSetBool(cf, key, value);
219224

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" : "");
221226
}
222227

223228
set_str(key, value)
@@ -227,7 +232,7 @@ char *key, *value;
227232

228233
result = CfSetStr(cf, key, value);
229234

230-
printf("Set %s = \"%s\"%s\n", key, value, result ? " --> ERROR" : "");
235+
printf("Set '%s' = '%s'%s\n", key, value, result ? " --> ERROR" : "");
231236
}
232237

233238
pr_keys(cf)

0 commit comments

Comments
 (0)