From: Robert Millan Date: Sun, 8 Nov 2009 22:53:15 +0000 (+0000) Subject: Implement support for date stamp overrides: X-Git-Tag: 1.98~443^2~6 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=fa8b1c51a38b5509b58bdfeb570de26c1654d142;p=thirdparty%2Fgrub.git Implement support for date stamp overrides: --creation-date --modification-date --expiration-date --effective-date --- diff --git a/util/mkisofs/mkisofs.c b/util/mkisofs/mkisofs.c index 11959c0ca..b052d10ef 100644 --- a/util/mkisofs/mkisofs.c +++ b/util/mkisofs/mkisofs.c @@ -6,9 +6,11 @@ Copyright 1993 Yggdrasil Computing, Incorporated + Copyright (C) 2009 Free Software Foundation, Inc. + This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2, or (at your option) + the Free Software Foundation; either version 3, or (at your option) any later version. This program is distributed in the hope that it will be useful, @@ -17,7 +19,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software + along with this program; if not, see . Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ static char rcsid[] ="$Id: mkisofs.c,v 1.32 1999/03/07 21:48:49 eric Exp $"; @@ -182,6 +184,11 @@ struct ld_option #define OPTION_J_HIDE 164 #define OPTION_LOG_FILE 165 +#define OPTION_CREAT_DATE 166 +#define OPTION_MODIF_DATE 167 +#define OPTION_EXPIR_DATE 168 +#define OPTION_EFFEC_DATE 169 + static const struct ld_option ld_options[] = { { {"all-files", no_argument, NULL, 'a'}, @@ -263,11 +270,19 @@ static const struct ld_option ld_options[] = { {"volset-seqno", required_argument, NULL, OPTION_VOLSET_SEQ_NUM}, '\0', "#", "Set Volume set sequence number" , ONE_DASH }, { {"old-exclude", required_argument, NULL, 'x'}, - 'x', "FILE", "Exclude file name(depreciated)" , ONE_DASH } + 'x', "FILE", "Exclude file name(depreciated)" , ONE_DASH }, #ifdef ERIC_neverdef { {"transparent-compression", no_argument, NULL, 'z'}, 'z', NULL, "Enable transparent compression of files", ONE_DASH }, #endif + { {"creation-date", required_argument, NULL, OPTION_CREAT_DATE }, + '\0', NULL, "Override creation date", TWO_DASHES }, + { {"modification-date", required_argument, NULL, OPTION_MODIF_DATE }, + '\0', NULL, "Override modification date", TWO_DASHES }, + { {"expiration-date", required_argument, NULL, OPTION_EXPIR_DATE }, + '\0', NULL, "Override expiration date", TWO_DASHES }, + { {"effective-date", required_argument, NULL, OPTION_EFFEC_DATE }, + '\0', NULL, "Override effective date", TWO_DASHES }, }; #define OPTION_COUNT (sizeof ld_options / sizeof ld_options[0]) @@ -855,6 +870,26 @@ int FDECL2(main, int, argc, char **, argv){ case OPTION_NOSPLIT_SL_FIELD: split_SL_field = 0; break; + case OPTION_CREAT_DATE: + if (creation_date) + free(creation_date); + creation_date = strdup(optarg); + break; + case OPTION_MODIF_DATE: + if (modification_date) + free(modification_date); + modification_date = strdup(optarg); + break; + case OPTION_EXPIR_DATE: + if (expiration_date) + free(expiration_date); + expiration_date = strdup(optarg); + break; + case OPTION_EFFEC_DATE: + if (effective_date) + free(effective_date); + effective_date = strdup(optarg); + break; default: usage(); exit(1); diff --git a/util/mkisofs/mkisofs.h b/util/mkisofs/mkisofs.h index b6cd1a047..db297eec6 100644 --- a/util/mkisofs/mkisofs.h +++ b/util/mkisofs/mkisofs.h @@ -5,9 +5,11 @@ Copyright 1993 Yggdrasil Computing, Incorporated + Copyright (C) 2009 Free Software Foundation, Inc. + This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2, or (at your option) + the Free Software Foundation; either version 3, or (at your option) any later version. This program is distributed in the hope that it will be useful, @@ -16,7 +18,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software + along with this program; if not, see . Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* @@ -323,6 +325,15 @@ extern void DECL(set_732, (char * pnt, unsigned int i)); extern void DECL(set_722, (char * pnt, unsigned int i)); extern void DECL(outputlist_insert, (struct output_fragment * frag)); +/* + * Set by user command-line to override default date values + */ + +extern char *creation_date; +extern char *modification_date; +extern char *expiration_date; +extern char *effective_date; + /* multi.c */ extern FILE * in_image; diff --git a/util/mkisofs/write.c b/util/mkisofs/write.c index 842015b6c..bb70cc752 100644 --- a/util/mkisofs/write.c +++ b/util/mkisofs/write.c @@ -5,9 +5,11 @@ Copyright 1993 Yggdrasil Computing, Incorporated + Copyright (C) 2009 Free Software Foundation, Inc. + This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2, or (at your option) + the Free Software Foundation; either version 3, or (at your option) any later version. This program is distributed in the hope that it will be useful, @@ -16,7 +18,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software + along with this program; if not, see . Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ static char rcsid[] ="$Id: write.c,v 1.21 1999/03/07 17:41:19 eric Exp $"; @@ -1181,6 +1183,11 @@ static int FDECL1(file_write, FILE *, outfile) } /* iso_write(... */ +char *creation_date = NULL; +char *modification_date = NULL; +char *expiration_date = NULL; +char *effective_date = NULL; + /* * Function to write the PVD for the disc. */ @@ -1282,10 +1289,10 @@ static int FDECL1(pvd_write, FILE *, outfile) vol_desc.file_structure_version[0] = 1; FILL_SPACE(application_data); - memcpy(vol_desc.creation_date, iso_time, 17); - memcpy(vol_desc.modification_date, iso_time, 17); - memcpy(vol_desc.expiration_date, "0000000000000000", 17); - memcpy(vol_desc.effective_date, iso_time, 17); + memcpy(vol_desc.creation_date, creation_date ? creation_date : iso_time, 17); + memcpy(vol_desc.modification_date, modification_date ? modification_date : iso_time, 17); + memcpy(vol_desc.expiration_date, expiration_date ? expiration_date : "0000000000000000", 17); + memcpy(vol_desc.effective_date, effective_date ? effective_date : iso_time, 17); /* * if not a bootable cd do it the old way