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
71 static void push_hdr(const char *s) in push_hdr() argument
73 fputs(s, stdout); in push_hdr()
79 char s[256]; in cpio_trailer() local
82 sprintf(s, "%s%08X%08X%08lX%08lX%08X%08lX" in cpio_trailer()
86 0, /* mode */ in cpio_trailer()
98 push_hdr(s); in cpio_trailer()
108 unsigned int mode, uid_t uid, gid_t gid) in cpio_mkslink() argument
110 char s[256]; in cpio_mkslink() local
114 sprintf(s,"%s%08X%08X%08lX%08lX%08X%08lX" in cpio_mkslink()
118 S_IFLNK | mode, /* mode */ in cpio_mkslink()
130 push_hdr(s); in cpio_mkslink()
142 unsigned int mode; in cpio_mkslink_line() local
145 int rc = -1; in cpio_mkslink_line()
147 …if (5 != sscanf(line, "%" str(PATH_MAX) "s %" str(PATH_MAX) "s %o %d %d", name, target, &mode, &ui… in cpio_mkslink_line()
148 fprintf(stderr, "Unrecognized dir format '%s'", line); in cpio_mkslink_line()
151 rc = cpio_mkslink(name, target, mode, uid, gid); in cpio_mkslink_line()
156 static int cpio_mkgeneric(const char *name, unsigned int mode, in cpio_mkgeneric() argument
159 char s[256]; in cpio_mkgeneric() local
163 sprintf(s,"%s%08X%08X%08lX%08lX%08X%08lX" in cpio_mkgeneric()
167 mode, /* mode */ in cpio_mkgeneric()
179 push_hdr(s); in cpio_mkgeneric()
192 mode_t mode; member
198 .mode = S_IFDIR
202 .mode = S_IFIFO
206 .mode = S_IFSOCK
213 unsigned int mode; in cpio_mkgeneric_line() local
216 int rc = -1; in cpio_mkgeneric_line()
218 if (4 != sscanf(line, "%" str(PATH_MAX) "s %o %d %d", name, &mode, &uid, &gid)) { in cpio_mkgeneric_line()
219 fprintf(stderr, "Unrecognized %s format '%s'", in cpio_mkgeneric_line()
223 mode |= generic_type_table[gt].mode; in cpio_mkgeneric_line()
224 rc = cpio_mkgeneric(name, mode, uid, gid); in cpio_mkgeneric_line()
244 static int cpio_mknod(const char *name, unsigned int mode, in cpio_mknod() argument
248 char s[256]; in cpio_mknod() local
251 mode |= S_IFBLK; in cpio_mknod()
253 mode |= S_IFCHR; in cpio_mknod()
257 sprintf(s,"%s%08X%08X%08lX%08lX%08X%08lX" in cpio_mknod()
261 mode, /* mode */ in cpio_mknod()
273 push_hdr(s); in cpio_mknod()
281 unsigned int mode; in cpio_mknod_line() local
287 int rc = -1; in cpio_mknod_line()
289 if (7 != sscanf(line, "%" str(PATH_MAX) "s %o %d %d %c %u %u", in cpio_mknod_line()
290 name, &mode, &uid, &gid, &dev_type, &maj, &min)) { in cpio_mknod_line()
291 fprintf(stderr, "Unrecognized nod format '%s'", line); in cpio_mknod_line()
294 rc = cpio_mknod(name, mode, uid, gid, dev_type, maj, min); in cpio_mknod_line()
308 return -1; in cpio_mkfile_csum()
313 size -= this_read; in cpio_mkfile_csum()
317 return -1; in cpio_mkfile_csum()
323 unsigned int mode, uid_t uid, gid_t gid, in cpio_mkfile() argument
326 char s[256]; in cpio_mkfile() local
331 int rc = -1; in cpio_mkfile()
336 mode |= S_IFREG; in cpio_mkfile()
340 fprintf (stderr, "File %s could not be opened for reading\n", location); in cpio_mkfile()
346 fprintf(stderr, "File %s could not be stat()'ed\n", location); in cpio_mkfile()
351 fprintf(stderr, "%s: Timestamp exceeds maximum cpio timestamp, clipping.\n", in cpio_mkfile()
357 fprintf(stderr, "%s: Size exceeds maximum cpio file size\n", in cpio_mkfile()
363 fprintf(stderr, "Failed to checksum file %s\n", location); in cpio_mkfile()
376 sprintf(s,"%s%08X%08X%08lX%08lX%08X%08lX" in cpio_mkfile()
380 mode, /* mode */ in cpio_mkfile()
392 push_hdr(s); in cpio_mkfile()
403 fprintf(stderr, "Can not read %s file\n", location); in cpio_mkfile()
412 size -= this_read; in cpio_mkfile()
436 snprintf(expanded, sizeof expanded, "%s%s%s", in cpio_replace_env()
449 unsigned int mode; in cpio_mkfile_line() local
454 int rc = -1; in cpio_mkfile_line()
456 if (5 > sscanf(line, "%" str(PATH_MAX) "s %" str(PATH_MAX) in cpio_mkfile_line()
457 "s %o %d %d %n", in cpio_mkfile_line()
458 name, location, &mode, &uid, &gid, &end)) { in cpio_mkfile_line()
459 fprintf(stderr, "Unrecognized file format '%s'", line); in cpio_mkfile_line()
477 if (sscanf(line + end, "%" str(PATH_MAX) "s %n", in cpio_mkfile_line()
490 mode, uid, gid, nlinks); in cpio_mkfile_line()
499 "\t%s [-t <timestamp>] [-c] <cpio_list>\n" in usage()
505 "file <name> <location> <mode> <uid> <gid> [<hard links>]\n" in usage()
506 "dir <name> <mode> <uid> <gid>\n" in usage()
507 "nod <name> <mode> <uid> <gid> <dev_type> <maj> <min>\n" in usage()
508 "slink <name> <target> <mode> <uid> <gid>\n" in usage()
509 "pipe <name> <mode> <uid> <gid>\n" in usage()
510 "sock <name> <mode> <uid> <gid>\n" in usage()
516 "<mode> mode/permissions of the file\n" in usage()
535 "-c: calculate and store 32-bit checksums for file data.\n", in usage()
580 if (opt == -1) in main()
586 fprintf(stderr, "Invalid timestamp: %s\n", in main()
603 * Timestamps after 2106-02-07 06:28:15 UTC have an ascii hex time_t in main()
612 if (argc - optind != 1) { in main()
617 if (!strcmp(filename, "-")) in main()
620 fprintf(stderr, "ERROR: unable to open '%s': %s\n\n", in main()
633 /* comment - skip to next line */ in main()
639 "ERROR: incorrect format, could not locate file type line %d: '%s'\n", in main()
641 ec = -1; in main()
657 "ERROR: incorrect format, newline required line %d: '%s'\n", in main()
659 ec = -1; in main()
674 fprintf(stderr, "unknown file type line %d: '%s'\n", in main()