]> git.pond.sub.org Git - empserver/commitdiff
Make xundump interpret escapes in identifiers
authorMarkus Armbruster <armbru@pond.sub.org>
Tue, 4 Mar 2008 20:41:26 +0000 (21:41 +0100)
committerMarkus Armbruster <armbru@pond.sub.org>
Fri, 14 Mar 2008 19:25:42 +0000 (20:25 +0100)
We need this because we have symbols with spaces, e.g. missions[].

src/lib/common/xundump.c

index c33df1281b734f7b34b50a649a8df36a36506f73..731cac7db58bacbae38070ec91f252d2f38c51ee 100644 (file)
@@ -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.