Lines Matching +full:s +full:- +full:mode
1 // SPDX-License-Identifier: GPL-2.0
21 #define xstr(s) #s argument
22 #define str(s) xstr(s) argument
67 static void push_hdr(const char *s) in push_hdr() argument
69 fputs(s, stdout); in push_hdr()
75 char s[256]; in cpio_trailer() local
78 sprintf(s, "%s%08X%08X%08lX%08lX%08X%08lX" in cpio_trailer()
82 0, /* mode */ in cpio_trailer()
94 push_hdr(s); in cpio_trailer()
104 unsigned int mode, uid_t uid, gid_t gid) in cpio_mkslink() argument
106 char s[256]; in cpio_mkslink() local
110 sprintf(s,"%s%08X%08X%08lX%08lX%08X%08lX" in cpio_mkslink()
114 S_IFLNK | mode, /* mode */ in cpio_mkslink()
126 push_hdr(s); in cpio_mkslink()
138 unsigned int mode; in cpio_mkslink_line() local
141 int rc = -1; in cpio_mkslink_line()
143 …if (5 != sscanf(line, "%" str(PATH_MAX) "s %" str(PATH_MAX) "s %o %d %d", name, target, &mode, &ui… in cpio_mkslink_line()
144 fprintf(stderr, "Unrecognized dir format '%s'", line); in cpio_mkslink_line()
147 rc = cpio_mkslink(name, target, mode, uid, gid); in cpio_mkslink_line()
152 static int cpio_mkgeneric(const char *name, unsigned int mode, in cpio_mkgeneric() argument
155 char s[256]; in cpio_mkgeneric() local
159 sprintf(s,"%s%08X%08X%08lX%08lX%08X%08lX" in cpio_mkgeneric()
163 mode, /* mode */ in cpio_mkgeneric()
175 push_hdr(s); in cpio_mkgeneric()
188 mode_t mode; member
194 .mode = S_IFDIR
198 .mode = S_IFIFO
202 .mode = S_IFSOCK
209 unsigned int mode; in cpio_mkgeneric_line() local
212 int rc = -1; in cpio_mkgeneric_line()
214 if (4 != sscanf(line, "%" str(PATH_MAX) "s %o %d %d", name, &mode, &uid, &gid)) { in cpio_mkgeneric_line()
215 fprintf(stderr, "Unrecognized %s format '%s'", in cpio_mkgeneric_line()
219 mode |= generic_type_table[gt].mode; in cpio_mkgeneric_line()
220 rc = cpio_mkgeneric(name, mode, uid, gid); in cpio_mkgeneric_line()
240 static int cpio_mknod(const char *name, unsigned int mode, in cpio_mknod() argument
244 char s[256]; in cpio_mknod() local
247 mode |= S_IFBLK; in cpio_mknod()
249 mode |= S_IFCHR; in cpio_mknod()
253 sprintf(s,"%s%08X%08X%08lX%08lX%08X%08lX" in cpio_mknod()
257 mode, /* mode */ in cpio_mknod()
269 push_hdr(s); in cpio_mknod()
277 unsigned int mode; in cpio_mknod_line() local
283 int rc = -1; in cpio_mknod_line()
285 if (7 != sscanf(line, "%" str(PATH_MAX) "s %o %d %d %c %u %u", in cpio_mknod_line()
286 name, &mode, &uid, &gid, &dev_type, &maj, &min)) { in cpio_mknod_line()
287 fprintf(stderr, "Unrecognized nod format '%s'", line); in cpio_mknod_line()
290 rc = cpio_mknod(name, mode, uid, gid, dev_type, maj, min); in cpio_mknod_line()
296 unsigned int mode, uid_t uid, gid_t gid, in cpio_mkfile() argument
299 char s[256]; in cpio_mkfile() local
303 int file = -1; in cpio_mkfile()
305 int rc = -1; in cpio_mkfile()
309 mode |= S_IFREG; in cpio_mkfile()
313 fprintf (stderr, "File %s could not be opened for reading\n", location); in cpio_mkfile()
319 fprintf(stderr, "File %s could not be stat()'ed\n", location); in cpio_mkfile()
331 fprintf (stderr, "Can not read %s file\n", location); in cpio_mkfile()
343 sprintf(s,"%s%08X%08X%08lX%08lX%08X%08lX" in cpio_mkfile()
347 mode, /* mode */ in cpio_mkfile()
359 push_hdr(s); in cpio_mkfile()
392 snprintf(expanded, sizeof expanded, "%s%s%s", in cpio_replace_env()
405 unsigned int mode; in cpio_mkfile_line() local
410 int rc = -1; in cpio_mkfile_line()
412 if (5 > sscanf(line, "%" str(PATH_MAX) "s %" str(PATH_MAX) in cpio_mkfile_line()
413 "s %o %d %d %n", in cpio_mkfile_line()
414 name, location, &mode, &uid, &gid, &end)) { in cpio_mkfile_line()
415 fprintf(stderr, "Unrecognized file format '%s'", line); in cpio_mkfile_line()
433 if (sscanf(line + end, "%" str(PATH_MAX) "s %n", in cpio_mkfile_line()
446 mode, uid, gid, nlinks); in cpio_mkfile_line()
455 "\t%s [-t <timestamp>] <cpio_list>\n" in usage()
461 "file <name> <location> <mode> <uid> <gid> [<hard links>]\n" in usage()
462 "dir <name> <mode> <uid> <gid>\n" in usage()
463 "nod <name> <mode> <uid> <gid> <dev_type> <maj> <min>\n" in usage()
464 "slink <name> <target> <mode> <uid> <gid>\n" in usage()
465 "pipe <name> <mode> <uid> <gid>\n" in usage()
466 "sock <name> <mode> <uid> <gid>\n" in usage()
472 "<mode> mode/permissions of the file\n" in usage()
535 if (opt == -1) in main()
541 fprintf(stderr, "Invalid timestamp: %s\n", in main()
554 if (argc - optind != 1) { in main()
559 if (!strcmp(filename, "-")) in main()
562 fprintf(stderr, "ERROR: unable to open '%s': %s\n\n", in main()
575 /* comment - skip to next line */ in main()
581 "ERROR: incorrect format, could not locate file type line %d: '%s'\n", in main()
583 ec = -1; in main()
599 "ERROR: incorrect format, newline required line %d: '%s'\n", in main()
601 ec = -1; in main()
616 fprintf(stderr, "unknown file type line %d: '%s'\n", in main()