From f9e28d0491f7fbb04855c8202a95a8477cefbc04 Mon Sep 17 00:00:00 2001 From: Markus Armbruster Date: Tue, 4 Mar 2008 21:41:26 +0100 Subject: [PATCH] Make xundump interpret escapes in identifiers We need this because we have symbols with spaces, e.g. missions[]. --- src/lib/common/xundump.c | 31 ++++++++++++++++--------------- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/src/lib/common/xundump.c b/src/lib/common/xundump.c index c33df128..731cac7d 100644 --- a/src/lib/common/xundump.c +++ b/src/lib/common/xundump.c @@ -132,21 +132,6 @@ skipfs(FILE *fp) return ch; } -/* - * Read an identifier from FP into BUF. - * BUF must have space for 1024 characters. - * Return number of characters read on success, -1 on failure. - */ -static int -getid(FILE *fp, char *buf) -{ - int n; - if (fscanf(fp, "%1023[^#()<>=#\" \t\n]%n", buf, &n) != 1 - || !isalpha(buf[0])) - return -1; - return n; -} - /* * Decode escape sequences in BUF. * Return BUF on success, null pointer on failure. @@ -172,6 +157,22 @@ xuesc(char *buf) return buf; } +/* + * Read an identifier from FP into BUF. + * BUF must have space for 1024 characters. + * Return number of characters read on success, -1 on failure. + */ +static int +getid(FILE *fp, char *buf) +{ + int n; + if (fscanf(fp, "%1023[^\"#()<>= \t\n]%n", buf, &n) != 1 + || !isalpha(buf[0])) + return -1; + xuesc(buf); + return n; +} + /* * Try to read a field name from FP. * I is the field number, counting from zero.