On Thu, Sep 25, 2008 at 01:11:33PM +0100, Steve McIntyre wrote:
> >Sounds fine. I'll send a patch for that, then. Does
> >"--creation-date=YYYY-MM-DD-HH-mm-ss-hh" syntax sound fine to you?
>
> If you can make it generic to allow separate specification of each of
> the 4 timestamps, that would be cool. :-)
Done. Please see attached patch.
While testing it, I found a few minor issues in the code. Since I figured
that janitor work would be welcome, I'm attaching these in a separate patch.
--
Robert Millan
The DRM opt-in fallacy: "Your data belongs to us. We will decide when (and
how) you may access your data; but nobody's threatening your freedom: we
still allow you to remove your data and not access it at all."
diff -ur cdrkit-1.1.8.old/genisoimage/genisoimage.c cdrkit-1.1.8/genisoimage/genisoimage.c
--- cdrkit-1.1.8.old/genisoimage/genisoimage.c 2008-05-26 00:12:37.000000000 +0200
+++ cdrkit-1.1.8/genisoimage/genisoimage.c 2008-09-28 15:19:30.000000000 +0200
@@ -435,6 +435,11 @@
#define OPTION_DVD 1501
#endif
+#define OPTION_CREAT_DATE 1502
+#define OPTION_MODIF_DATE 1503
+#define OPTION_EXPIR_DATE 1504
+#define OPTION_EFFEC_DATE 1505
+
#ifdef APPLE_HYB
#define OPTION_CAP 2000
#define OPTION_NETA 2001
@@ -771,6 +776,14 @@
'\0', NULL, "Generate rationalized XA directory attruibutes", ONE_DASH},
{{"transparent-compression", no_argument, NULL, 'z'},
'z', NULL, "Enable transparent compression of files", ONE_DASH},
+ {{"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},
#ifdef APPLE_HYB
{{"hfs-type", required_argument, NULL, OPTION_HFS_TYPE},
@@ -2212,6 +2227,26 @@
get_boot_entry();
current_boot_entry->boot_info_table = 1;
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;
#ifdef APPLE_HYB
case OPTION_HFS_TYPE:
deftype = optarg;
diff -ur cdrkit-1.1.8.old/genisoimage/genisoimage.h cdrkit-1.1.8/genisoimage/genisoimage.h
--- cdrkit-1.1.8.old/genisoimage/genisoimage.h 2008-05-25 23:00:55.000000000 +0200
+++ cdrkit-1.1.8/genisoimage/genisoimage.h 2008-09-28 15:13:07.000000000 +0200
@@ -800,3 +800,12 @@
* EB: various shared stuff
*/
extern char *merge_warn_msg;
+
+/*
+ * 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;
diff -ur cdrkit-1.1.8.old/genisoimage/write.c cdrkit-1.1.8/genisoimage/write.c
--- cdrkit-1.1.8.old/genisoimage/write.c 2008-02-27 09:54:08.000000000 +0100
+++ cdrkit-1.1.8/genisoimage/write.c 2008-09-28 14:59:22.000000000 +0200
@@ -1875,6 +1875,11 @@
}/* 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.
*/
@@ -1983,10 +1988,10 @@
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 (use_XA) {
char *xap = &((char *)&vol_desc)[1024];
diff -ur cdrkit-1.1.8.old/genisoimage/genisoimage.c cdrkit-1.1.8/genisoimage/genisoimage.c
--- cdrkit-1.1.8.old/genisoimage/genisoimage.c 2008-05-26 00:12:37.000000000 +0200
+++ cdrkit-1.1.8/genisoimage/genisoimage.c 2008-09-28 15:19:30.000000000 +0200
@@ -1285,6 +1298,8 @@
if (argc < 2) {
#ifdef USE_LIBSCHILY
errmsgno(EX_BAD, "Missing pathspec.\n");
+#else
+ fprintf(stderr, "Missing pathspec.\n");
#endif
susage(1);
}
@@ -2420,7 +2455,7 @@
#endif /* APPLE_HYB */
case OPTION_ALLOW_LIMITED_SIZE:
allow_limited_size++;
- use_udf++;
+ use_udf++;
break;
default:
susage(1);
@@ -2853,6 +2888,8 @@
if (check_session == 0 && !stream_media_size) {
#ifdef USE_LIBSCHILY
errmsgno(EX_BAD, "Missing pathspec.\n");
+#else
+ fprintf(stderr, "Missing pathspec.\n");
#endif
susage(1);
}
@@ -3311,6 +3348,8 @@
if (no_path_names && !check_session && !stream_media_size) {
#ifdef USE_LIBSCHILY
errmsgno(EX_BAD, "No pathnames found.\n");
+#else
+ fprintf(stderr, "No pathnames found.\n");
#endif
susage(1);
}