📄 mkisofs.c
字号:
for (i = 0; i < (int)OPTION_COUNT; i++) { if (ld_options[i].doc != NULL) { int comma; int len; int j; fprintf(stderr, " "); comma = FALSE; len = 2; j = i; do { if (ld_options[j].shortopt != '\0' && ld_options[j].control != NO_HELP) { fprintf(stderr, "%s-%c", comma ? ", " : "", ld_options[j].shortopt); len += (comma ? 2 : 0) + 2; if (ld_options[j].arg != NULL) { if (ld_options[j].opt.has_arg != optional_argument) { fprintf(stderr, " "); ++len; } fprintf(stderr, "%s", ld_options[j].arg); len += strlen(ld_options[j].arg); } comma = TRUE; } ++j; } while (j < (int)OPTION_COUNT && ld_options[j].doc == NULL); j = i; do { if (ld_options[j].opt.name != NULL && ld_options[j].control != NO_HELP) { fprintf(stderr, "%s-%s%s", comma ? ", " : "", ld_options[j].control == TWO_DASHES ? "-" : "", ld_options[j].opt.name); len += ((comma ? 2 : 0) + 1 + (ld_options[j].control == TWO_DASHES ? 1 : 0) + strlen(ld_options[j].opt.name)); if (ld_options[j].arg != NULL) { fprintf(stderr, " %s", ld_options[j].arg); len += 1 + strlen(ld_options[j].arg); } comma = TRUE; } ++j; } while (j < (int)OPTION_COUNT && ld_options[j].doc == NULL); if (len >= 30) { fprintf(stderr, "\n"); len = 0; } for (; len < 30; len++) fputc(' ', stderr); fprintf(stderr, "%s\n", ld_options[i].doc); } } exit(excode);}/* * Fill in date in the iso9660 format * * The standards state that the timezone offset is in multiples of 15 * minutes, and is what you add to GMT to get the localtime. The U.S. * is always at a negative offset, from -5h to -8h (can vary a little * with DST, I guess). The Linux iso9660 filesystem has had the sign * of this wrong for ages (mkisofs had it wrong too for the longest time). */EXPORT intiso9660_date(result, crtime) char *result; time_t crtime;{ struct tm *local; local = localtime(&crtime); result[0] = local->tm_year; result[1] = local->tm_mon + 1; result[2] = local->tm_mday; result[3] = local->tm_hour; result[4] = local->tm_min; result[5] = local->tm_sec; /* * Must recalculate proper timezone offset each time, as some files use * daylight savings time and some don't... */ result[6] = local->tm_yday; /* save yday 'cause gmtime zaps it */ local = gmtime(&crtime); local->tm_year -= result[0]; local->tm_yday -= result[6]; local->tm_hour -= result[3]; local->tm_min -= result[4]; if (local->tm_year < 0) { local->tm_yday = -1; } else { if (local->tm_year > 0) local->tm_yday = 1; } result[6] = -(local->tm_min + 60 * (local->tm_hour + 24 * local->tm_yday)) / 15; return 0;}/* hide "./rr_moved" if all its contents are hidden */LOCAL voidhide_reloc_dir(){ struct directory_entry *s_entry; for (s_entry = reloc_dir->contents; s_entry; s_entry = s_entry->next) { if (strcmp(s_entry->name, ".") == 0 || strcmp(s_entry->name, "..") == 0) continue; if ((s_entry->de_flags & INHIBIT_ISO9660_ENTRY) == 0) return; } /* all entries are hidden, so hide this directory */ reloc_dir->dir_flags |= INHIBIT_ISO9660_ENTRY; reloc_dir->self->de_flags |= INHIBIT_ISO9660_ENTRY;}/* * get pathnames from the command line, and then from given file */LOCAL char *get_pnames(argc, argv, opt, pname, pnsize, fp) int argc; char **argv; int opt; char *pname; int pnsize; FILE *fp;{ int len; /* we may of already read the first line from the pathnames file */ if (save_pname) { save_pname = 0; return (pname); } if (opt < argc) return (argv[opt]); if (fp == NULL) return ((char *) 0); if (fgets(pname, pnsize, fp)) { /* Discard newline */ len = strlen(pname); if (pname[len - 1] == '\n') { pname[len - 1] = '\0'; } return (pname); } return ((char *) 0);}extern char *cdrecord_data;EXPORT intmain(argc, argv) int argc; char **argv;{ struct directory_entry de;#ifdef HAVE_SBRK unsigned long mem_start;#endif struct stat statbuf; char *merge_image = NULL; struct iso_directory_record *mrootp = NULL; struct output_fragment *opnt; int longind; char shortopts[OPTION_COUNT * 3 + 2]; struct option longopts[OPTION_COUNT + 1]; int c; int n; char *log_file = 0; char *node = NULL; char *pathnames = 0; FILE *pfp = NULL; char pname[PATH_MAX], *arg; char nodename[PATH_MAX]; int no_path_names = 1; int warn_violate = 0; int have_cmd_line_pathspec = 0; int rationalize_all = 0;#ifdef APPLE_HYB char *afpfile = ""; /* mapping file for TYPE/CREATOR */ int hfs_ct = 0; char *root_info = 0;#endif /* APPLE_HYB */#ifdef __EMX__ /* This gives wildcard expansion with Non-Posix shells with EMX */ _wildcard(&argc, &argv);#endif save_args(argc, argv); if (argc < 2) {#ifdef USE_LIBSCHILY errmsgno(EX_BAD, "Missing pathspec.\n");#endif susage(1); } /* Get the defaults from the .mkisofsrc file */ read_rcfile(argv[0]); outfile = NULL; /* * Copy long option initialization from GNU-ld. */ /* * Starting the short option string with '-' is for programs that * expect options and other ARGV-elements in any order and that care * about the ordering of the two. We describe each non-option * ARGV-element as if it were the argument of an option with * character code 1. */ { int i, is, il; shortopts[0] = '-'; is = 1; il = 0; for (i = 0; i < (int)OPTION_COUNT; i++) { if (ld_options[i].shortopt != '\0') { shortopts[is] = ld_options[i].shortopt; ++is; if (ld_options[i].opt.has_arg == required_argument || ld_options[i].opt.has_arg == optional_argument) { shortopts[is] = ':'; ++is; if (ld_options[i].opt.has_arg == optional_argument) { shortopts[is] = ':'; ++is; } } } if (ld_options[i].opt.name != NULL) { longopts[il] = ld_options[i].opt; ++il; } } shortopts[is] = '\0'; longopts[il].name = NULL; } while ((c = getopt_long_only(argc, argv, shortopts, longopts, &longind)) != EOF) switch (c) { case 1: /* A filename that we take as input. */ optind--; have_cmd_line_pathspec = 1; goto parse_input_files; case OPTION_USE_GRAFT: use_graft_ptrs = 1; break; case 'C': /* * This is a temporary hack until cdrecord gets the * proper hooks in it. */ cdrecord_data = optarg; break; case OPTION_GUI: gui++; break; case 'i':#ifdef USE_LIBSCHILY comerrno(EX_BAD, "-i option no longer supported.\n");#else fprintf(stderr, "-i option no longer supported.\n"); exit(1);#endif break; case OPTION_ISO_LEVEL: iso9660_level = atoi(optarg); switch (iso9660_level) { case 1: /* * Only on file section * 8.3 d or d1 characters for files * 8 d or d1 characters for directories */ break; case 2: /* * Only on file section */ break; case 3: /* * No restrictions */ break; default: comerrno(EX_BAD, "Illegal iso9660 Level %d, use 1..3.\n", ucs_level); } break; case 'J': use_Joliet++; break; case OPTION_JLONG: use_Joliet++; jlen = JLONGMAX; break; case OPTION_JCHARSET: use_Joliet++; /* FALLTHROUGH */ case OPTION_INPUT_CHARSET: icharset = optarg; break; case OPTION_OUTPUT_CHARSET: ocharset = optarg; break; case OPTION_NOBAK: all_files = 0; break; case 'b': use_eltorito++; boot_image = optarg; /* pathname of the boot image on disk */ if (boot_image == NULL) {#ifdef USE_LIBSCHILY comerrno(EX_BAD, "Required Eltorito boot image pathname missing\n");#else fprintf(stderr, "Required Eltorito boot image pathname missing\n"); exit(1);#endif } get_boot_entry(); current_boot_entry->boot_image = boot_image; break; case OPTION_ALT_BOOT: /* * Start new boot entry parameter list. */ new_boot_entry(); break; case 'B': use_sparcboot++; /* list of pathnames of boot images */ scan_sparc_boot(optarg); break; case 'G': use_genboot++; /* pathname of the boot image on disk */ genboot_image = optarg; if (genboot_image == NULL) {#ifdef USE_LIBSCHILY comerrno(EX_BAD, "Required generic boot image pathname missing\n");#else fprintf(stderr, "Required generic boot image pathname missing\n"); exit(1);#endif } break; case OPTION_SPARCLABEL: /* Sun disk label string */ sparc_boot_label(optarg); break; case 'c': use_eltorito++; /* pathname of the boot image on cd */ boot_catalog = optarg; if (boot_catalog == NULL) {#ifdef USE_LIBSCHILY comerrno(EX_BAD, "Required boot catalog pathname missing\n");#else fprintf(stderr, "Required boot catalog pathname missing\n"); exit(1);#endif } break; case OPTION_ABSTRACT: abstract = optarg; if (strlen(abstract) > 37) {#ifdef USE_LIBSCHILY comerrno(EX_BAD, "Abstract filename string too long\n");#else fprintf(stderr, "Abstract filename string too long\n"); exit(1);#endif }; break; case 'A': appid = optarg; if (strlen(appid) > 128) {#ifdef USE_LIBSCHILY comerrno(EX_BAD, "Application-id string too long\n");#else fprintf(stderr, "Application-id string too long\n"); exit(1);#endif }; break; case OPTION_BIBLIO: biblio = optarg; if (strlen(biblio) > 37) {#ifdef USE_LIBSCHILY comerrno(EX_BAD, "Bibliographic filename string too long\n");#else fprintf(stderr, "Bibliographic filename string too long\n"); exit(1);#endif }; break; case OPTION_CACHE_INODES: cache_inodes = 1; break; case OPTION_NOCACHE_INODES: cache_inodes = 0; break; case OPTION_CHECK_OLDNAMES: check_oldnames++; break; case OPTION_CHECK_SESSION: check_session++; check_oldnames++; merge_image = optarg; outfile = "/dev/null"; /* * cdrecord_data is handled specially in multi.c
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -