MCPcopy Create free account
hub / github.com/ading2210/linuxpdf / parse_fname

Function parse_fname

tinyemu/fs_utils.c:122–188  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

120}
121
122int parse_fname(char *buf, int buf_size, const char **pp)
123{
124 const char *p;
125 char *q;
126 int c, h;
127
128 p = *pp;
129 while (isspace_nolf(*p))
130 p++;
131 if (*p == '\0')
132 return -1;
133 q = buf;
134 if (*p == '"') {
135 p++;
136 for(;;) {
137 c = *p++;
138 if (c == '\0' || c == '\n') {
139 return -1;
140 } else if (c == '\"') {
141 break;
142 } else if (c == '\\') {
143 c = *p++;
144 switch(c) {
145 case '\'':
146 case '\"':
147 case '\\':
148 goto add_char;
149 case 'n':
150 c = '\n';
151 goto add_char;
152 case 'r':
153 c = '\r';
154 goto add_char;
155 case 't':
156 c = '\t';
157 goto add_char;
158 case 'x':
159 h = from_hex(*p++);
160 if (h < 0)
161 return -1;
162 c = h << 4;
163 h = from_hex(*p++);
164 if (h < 0)
165 return -1;
166 c |= h;
167 goto add_char;
168 default:
169 return -1;
170 }
171 } else {
172 add_char:
173 if (q >= buf + buf_size - 1)
174 return -1;
175 *q++ = c;
176 }
177 }
178 } else {
179 while (!isspace_nolf(*p) && *p != '\0' && *p != '\n') {

Callers 11

filelist_load_recFunction · 0.85
preload_parse_str_oldFunction · 0.85
preload_parse_strFunction · 0.85
parse_hex_bufFunction · 0.85
fs_cmd_xhrFunction · 0.85
fs_cmd_set_base_urlFunction · 0.85
fs_cmd_reset_base_urlFunction · 0.85
fs_cmd_set_urlFunction · 0.85
fs_cmd_export_fileFunction · 0.85
fs_cmd_set_import_dirFunction · 0.85
fs_cmd_writeFunction · 0.85

Calls 2

isspace_nolfFunction · 0.85
from_hexFunction · 0.85

Tested by

no test coverage detected