Lines Matching +full:s +full:- +full:mode
1 // SPDX-License-Identifier: GPL-2.0
23 #define xstr(s) #s argument
24 #define str(s) xstr(s) argument
72 static void push_hdr(const char *s) in push_hdr() argument
74 fputs(s, stdout); in push_hdr()
80 char s[256]; in cpio_trailer() local
83 sprintf(s, "%s%08X%08X%08lX%08lX%08X%08lX" in cpio_trailer()
87 0, /* mode */ in cpio_trailer()
99 push_hdr(s); in cpio_trailer()
109 unsigned int mode, uid_t uid, gid_t gid) in cpio_mkslink() argument
111 char s[256]; in cpio_mkslink() local
115 sprintf(s,"%s%08X%08X%08lX%08lX%08X%08lX" in cpio_mkslink()
119 S_IFLNK | mode, /* mode */ in cpio_mkslink()
131 push_hdr(s); in cpio_mkslink()
143 unsigned int mode; in cpio_mkslink_line() local
146 int rc = -1; in cpio_mkslink_line()
148 …if (5 != sscanf(line, "%" str(PATH_MAX) "s %" str(PATH_MAX) "s %o %d %d", name, target, &mode, &ui… in cpio_mkslink_line()
149 fprintf(stderr, "Unrecognized dir format '%s'", line); in cpio_mkslink_line()
152 rc = cpio_mkslink(name, target, mode, uid, gid); in cpio_mkslink_line()
157 static int cpio_mkgeneric(const char *name, unsigned int mode, in cpio_mkgeneric() argument
160 char s[256]; in cpio_mkgeneric() local
164 sprintf(s,"%s%08X%08X%08lX%08lX%08X%08lX" in cpio_mkgeneric()
168 mode, /* mode */ in cpio_mkgeneric()
180 push_hdr(s); in cpio_mkgeneric()
193 mode_t mode; member
199 .mode = S_IFDIR
203 .mode = S_IFIFO
207 .mode = S_IFSOCK
214 unsigned int mode; in cpio_mkgeneric_line() local
217 int rc = -1; in cpio_mkgeneric_line()
219 if (4 != sscanf(line, "%" str(PATH_MAX) "s %o %d %d", name, &mode, &uid, &gid)) { in cpio_mkgeneric_line()
220 fprintf(stderr, "Unrecognized %s format '%s'", in cpio_mkgeneric_line()
224 mode |= generic_type_table[gt].mode; in cpio_mkgeneric_line()
225 rc = cpio_mkgeneric(name, mode, uid, gid); in cpio_mkgeneric_line()
245 static int cpio_mknod(const char *name, unsigned int mode, in cpio_mknod() argument
249 char s[256]; in cpio_mknod() local
252 mode |= S_IFBLK; in cpio_mknod()
254 mode |= S_IFCHR; in cpio_mknod()
258 sprintf(s,"%s%08X%08X%08lX%08lX%08X%08lX" in cpio_mknod()
262 mode, /* mode */ in cpio_mknod()
274 push_hdr(s); in cpio_mknod()
282 unsigned int mode; in cpio_mknod_line() local
288 int rc = -1; in cpio_mknod_line()
290 if (7 != sscanf(line, "%" str(PATH_MAX) "s %o %d %d %c %u %u", in cpio_mknod_line()
291 name, &mode, &uid, &gid, &dev_type, &maj, &min)) { in cpio_mknod_line()
292 fprintf(stderr, "Unrecognized nod format '%s'", line); in cpio_mknod_line()
295 rc = cpio_mknod(name, mode, uid, gid, dev_type, maj, min); in cpio_mknod_line()
309 return -1; in cpio_mkfile_csum()
314 size -= this_read; in cpio_mkfile_csum()
318 return -1; in cpio_mkfile_csum()
324 unsigned int mode, uid_t uid, gid_t gid, in cpio_mkfile() argument
327 char s[256]; in cpio_mkfile() local
332 int rc = -1; in cpio_mkfile()
338 mode |= S_IFREG; in cpio_mkfile()
342 fprintf (stderr, "File %s could not be opened for reading\n", location); in cpio_mkfile()
348 fprintf(stderr, "File %s could not be stat()'ed\n", location); in cpio_mkfile()
357 fprintf(stderr, "%s: Timestamp exceeds maximum cpio timestamp, clipping.\n", in cpio_mkfile()
363 fprintf(stderr, "%s: Timestamp negative, clipping.\n", in cpio_mkfile()
370 fprintf(stderr, "%s: Size exceeds maximum cpio file size\n", in cpio_mkfile()
376 fprintf(stderr, "Failed to checksum file %s\n", location); in cpio_mkfile()
389 sprintf(s,"%s%08X%08X%08lX%08lX%08X%08lX" in cpio_mkfile()
393 mode, /* mode */ in cpio_mkfile()
405 push_hdr(s); in cpio_mkfile()
416 fprintf(stderr, "Can not read %s file\n", location); in cpio_mkfile()
425 size -= this_read; in cpio_mkfile()
449 snprintf(expanded, sizeof expanded, "%s%s%s", in cpio_replace_env()
462 unsigned int mode; in cpio_mkfile_line() local
467 int rc = -1; in cpio_mkfile_line()
469 if (5 > sscanf(line, "%" str(PATH_MAX) "s %" str(PATH_MAX) in cpio_mkfile_line()
470 "s %o %d %d %n", in cpio_mkfile_line()
471 name, location, &mode, &uid, &gid, &end)) { in cpio_mkfile_line()
472 fprintf(stderr, "Unrecognized file format '%s'", line); in cpio_mkfile_line()
490 if (sscanf(line + end, "%" str(PATH_MAX) "s %n", in cpio_mkfile_line()
503 mode, uid, gid, nlinks); in cpio_mkfile_line()
512 "\t%s [-t <timestamp>] [-c] <cpio_list>\n" in usage()
518 "file <name> <location> <mode> <uid> <gid> [<hard links>]\n" in usage()
519 "dir <name> <mode> <uid> <gid>\n" in usage()
520 "nod <name> <mode> <uid> <gid> <dev_type> <maj> <min>\n" in usage()
521 "slink <name> <target> <mode> <uid> <gid>\n" in usage()
522 "pipe <name> <mode> <uid> <gid>\n" in usage()
523 "sock <name> <mode> <uid> <gid>\n" in usage()
529 "<mode> mode/permissions of the file\n" in usage()
549 "-c: calculate and store 32-bit checksums for file data.\n", in usage()
594 if (opt == -1) in main()
600 fprintf(stderr, "Invalid timestamp: %s\n", in main()
618 * Timestamps after 2106-02-07 06:28:15 UTC have an ascii hex time_t in main()
627 if (argc - optind != 1) { in main()
632 if (!strcmp(filename, "-")) in main()
635 fprintf(stderr, "ERROR: unable to open '%s': %s\n\n", in main()
648 /* comment - skip to next line */ in main()
654 "ERROR: incorrect format, could not locate file type line %d: '%s'\n", in main()
656 ec = -1; in main()
672 "ERROR: incorrect format, newline required line %d: '%s'\n", in main()
674 ec = -1; in main()
689 fprintf(stderr, "unknown file type line %d: '%s'\n", in main()