📄 mkisofs.c
字号:
/* const char **targets, **pp;*/ fprintf (stderr, "Usage: %s [options] file...\n", program_name); fprintf (stderr, "Options:\n"); for (i = 0; i < 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 < 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 < 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(1);}/* * 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). */int FDECL2(iso9660_date,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 */static 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;}extern char * cdwrite_data;int FDECL2(main, int, argc, char **, argv){ struct directory_entry de;#ifdef HAVE_SBRK unsigned long mem_start;#endif struct stat statbuf; char * scan_tree; 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; char *log_file = 0; if (argc < 2) usage(); /* 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 < 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--; goto parse_input_files; case 'C': /* * This is a temporary hack until cdwrite gets the proper hooks in * it. */ cdwrite_data = optarg; break; case 'i': fprintf(stderr, "-i option no longer supported.\n"); exit(1); break; case 'J': use_Joliet++; break; case 'O': do_fileopt++; break; case 'a': all_files++; break; case 'b': use_eltorito++; boot_image = optarg; /* pathname of the boot image on cd */ if (boot_image == NULL) { fprintf(stderr,"Required boot image pathname missing\n"); exit(1); } break; case 'c': use_eltorito++; boot_catalog = optarg; /* pathname of the boot image on cd */ if (boot_catalog == NULL) { fprintf(stderr,"Required boot catalog pathname missing\n"); exit(1); } break; case OPTION_ABSTRACT: abstract = optarg; if(strlen(abstract) > 37) { fprintf(stderr,"Abstract filename string too long\n"); exit(1); }; break; case 'A': appid = optarg; if(strlen(appid) > 128) { fprintf(stderr,"Application-id string too long\n"); exit(1); }; break; case OPTION_BIBLIO: biblio = optarg; if(strlen(biblio) > 37) { fprintf(stderr,"Bibliographic filename string too long\n"); exit(1); }; break; case OPTION_COPYRIGHT: copyright = optarg; if(strlen(copyright) > 37) { fprintf(stderr,"Copyright filename string too long\n"); exit(1); }; break; case 'd': omit_period++; break; case 'D': RR_relocation_depth = 32767; break; case 'f': follow_links++; break; case 'l': full_iso9660_filenames++; break; case 'L': allow_leading_dots++; break; case OPTION_LOG_FILE: log_file = optarg; break; case 'M': merge_image = optarg; break; case 'N': omit_version_number++; break; case 'o': outfile = optarg; break; case 'p': preparer = optarg; if(strlen(preparer) > 128) { fprintf(stderr,"Preparer string too long\n"); exit(1); }; break; case OPTION_PRINT_SIZE: print_size++; break; case 'P': publisher = optarg; if(strlen(publisher) > 128) { fprintf(stderr,"Publisher string too long\n"); exit(1); }; break; case OPTION_QUIET: verbose = 0; break; case 'R': use_RockRidge++; break; case 'r': rationalize++; use_RockRidge++; break; case OPTION_SPLIT_OUTPUT: split_output++; break; case OPTION_SYSID: system_id = optarg; if(strlen(system_id) > 32) { fprintf(stderr,"System ID string too long\n"); exit(1); }; break; case 'T': generate_tables++; break; case 'V': volume_id = optarg; if(strlen(volume_id) > 32) { fprintf(stderr,"Volume ID string too long\n"); exit(1); }; break; case OPTION_VOLSET: volset_id = optarg; if(strlen(volset_id) > 128) { fprintf(stderr,"Volume set ID string too long\n"); exit(1); }; break; case OPTION_VOLSET_SIZE: volume_set_size = atoi(optarg); break; case OPTION_VOLSET_SEQ_NUM: volume_sequence_number = atoi(optarg); if (volume_sequence_number > volume_set_size) { fprintf(stderr,"Volume set sequence number too big\n"); exit(1); } break; case 'v': verbose++; break; case 'z':#ifdef VMS fprintf(stderr,"Transparent compression not supported with VMS\n"); exit(1);#else transparent_compression++;#endif break; case 'x': case 'm': /* * Somehow two options to do basically the same thing got added somewhere along * the way. The 'match' code supports limited globbing, so this is the one * that got selected. Unfortunately the 'x' switch is probably more intuitive. */ add_match(optarg); break; case OPTION_I_HIDE: i_add_match(optarg); break; case OPTION_J_HIDE: j_add_match(optarg); break; case OPTION_HELP: usage (); exit (0); break; case OPTION_NOSPLIT_SL_COMPONENT: split_SL_component = 0; break; case OPTION_NOSPLIT_SL_FIELD: split_SL_field = 0; break; default: usage(); exit(1); }parse_input_files:#ifdef __NetBSD__ { int resource; struct rlimit rlp; if (getrlimit(RLIMIT_DATA,&rlp) == -1) perror("Warning: getrlimit"); else { rlp.rlim_cur=33554432; if (setrlimit(RLIMIT_DATA,&rlp) == -1) perror("Warning: setrlimit"); } }#endif#ifdef HAVE_SBRK mem_start = (unsigned long) sbrk(0);#endif /* if the -hide-joliet option has been given, set the Joliet option */ if (!use_Joliet && j_ishidden()) use_Joliet++; if(verbose > 1) fprintf(stderr,"%s\n", version_string); if(cdwrite_data == NULL && merge_image != NULL) { fprintf(stderr,"Multisession usage bug: Must specify -C if -M is used.\n"); exit(0); } if(cdwrite_data != NULL && merge_image == NULL) { fprintf(stderr,"Warning: -C specified without -M: old session data will not be merged.\n"); } /* The first step is to scan the directory tree, and take some notes */ scan_tree = argv[optind];
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -