56 len = lenp + lenn + 2;
57 if ((lenp > 0) && (path[lenp-1] ==
'/')) {
68 memcpy(str+lenp, name, lenn+1);
82 if (s[len - 1] !=
'\0')
90 if (*s !=
'\0' || (s + 1 - ss) < len)
102 static char get_oct_char(
const char *
s,
int *
i)
111 val = strtol(x, &endx, 8);
125 static char get_hex_char(
const char *
s,
int *
i)
134 val = strtol(x, &endx, 16);
136 die(
"\\x used with no following hex digits\n");
181 val = get_oct_char(s, &j);
184 val = get_hex_char(s, &j);
202 if (
strcmp(filename,
"-") != 0) {
214 buf = realloc(buf, bufsize);
221 ret =
read(fd, &buf[
offset], bufsize - offset);
244 fprintf(stderr,
"Couldn't open blob from '%s': %s\n", filename,
260 if (
strcmp(filename,
"-") != 0) {
269 while (offset < totalsize) {
270 ret =
write(fd, ptr + offset, totalsize - offset);
280 return ret < 0 ? -ret : 0;
289 fprintf(stderr,
"Couldn't write blob to '%s': %s\n", filename,
304 if (
strchr(
"hlLb", *fmt)) {
306 if (qualifier == *fmt) {
317 if ((*fmt ==
'\0') || !
strchr(
"iuxs", *fmt))
322 *size = qualifier ==
'b' ? 1 :
323 qualifier ==
'h' ? 2 :
324 qualifier ==
'l' ? 4 : -1;