Deleted Added
sdiff udiff text old ( 204431 ) new ( 204433 )
full compact
1/*
2 * (C) Copyright David Gibson <dwg@au1.ibm.com>, IBM Corporation. 2005.
3 *
4 *
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License as
7 * published by the Free Software Foundation; either version 2 of the
8 * License, or (at your option) any later version.

--- 38 unchanged lines hidden (view full) ---

47static void write_prefix(FILE *f, int level)
48{
49 int i;
50
51 for (i = 0; i < level; i++)
52 fputc('\t', f);
53}
54
55static int isstring(char c)
56{
57 return (isprint(c)
58 || (c == '\0')
59 || strchr("\a\b\t\n\v\f\r", c));
60}
61
62static void write_propval_string(FILE *f, struct data val)
63{
64 const char *str = val.val;
65 int i;
66 struct marker *m = val.markers;
67
68 assert(str[val.len-1] == '\0');
69
70 while (m && (m->offset == 0)) {
71 if (m->type == LABEL)
72 fprintf(f, "%s: ", m->ref);
73 m = m->next;
74 }
75 fprintf(f, "\"");
76
77 for (i = 0; i < (val.len-1); i++) {
78 char c = str[i];
79
80 switch (c) {
81 case '\a':
82 fprintf(f, "\\a");
83 break;
84 case '\b':
85 fprintf(f, "\\b");
86 break;
87 case '\t':

--- 14 unchanged lines hidden (view full) ---

102 case '\\':
103 fprintf(f, "\\\\");
104 break;
105 case '\"':
106 fprintf(f, "\\\"");
107 break;
108 case '\0':
109 fprintf(f, "\", ");
110 while (m && (m->offset < i)) {
111 if (m->type == LABEL) {
112 assert(m->offset == (i+1));
113 fprintf(f, "%s: ", m->ref);
114 }
115 m = m->next;
116 }
117 fprintf(f, "\"");
118 break;
119 default:
120 if (isprint(c))
121 fprintf(f, "%c", c);
122 else
123 fprintf(f, "\\x%02hhx", c);
124 }
125 }

--- 154 unchanged lines hidden ---