More ISO 9660 date cleanup. Hopefully cleaner structure definitions

and more function documentation.
This commit is contained in:
rocky
2003-09-21 01:14:30 +00:00
parent 5ec59c8a98
commit 0a8505d91a
8 changed files with 171 additions and 98 deletions

View File

@@ -1,5 +1,5 @@
/*
$Id: iso9660.h,v 1.23 2003/09/20 12:33:14 rocky Exp $
$Id: iso9660.h,v 1.24 2003/09/21 01:14:30 rocky Exp $
Copyright (C) 2000 Herbert Valerio Riedel <hvr@gnu.org>
Copyright (C) 2003 Rocky Bernstein <rocky@panix.com>
@@ -178,18 +178,22 @@ typedef struct iso9660_stat iso9660_stat_t;
/* Format of an ISO-9660 directory record */
struct iso9660_dir {
uint8_t length; /* 711 */
uint8_t ext_attr_length; /* 711 */
uint8_t xa_length; /* 711 */
uint64_t extent; /* 733 */
uint64_t size; /* 733 */
iso9660_dtime_t date; /* 7 by 711 */
uint8_t flags;
iso9660_dtime_t recording_time; /* 7 by 711 */
uint8_t file_flags;
uint8_t file_unit_size; /* 711 */
uint8_t interleave; /* 711 */
uint8_t interleave_gap; /* 711 */
uint32_t volume_sequence_number; /* 723 */
uint8_t name_len; /* 711 */
char name[EMPTY_ARRAY_SIZE];
uint8_t filename_len; /* 711 */
char filename[EMPTY_ARRAY_SIZE];
} GNUC_PACKED;
/* The following structure is not part of ISO 9660. We just use it
for our own purposes for communicating info back that's pulled out.
*/
struct iso9660_stat { /* big endian!! */
enum { _STAT_FILE = 1, _STAT_DIR = 2 } type;
lsn_t lsn; /* start logical sector number */
@@ -260,8 +264,11 @@ char *iso9660_strncpy_pad(char dst[], const char src[], size_t len,
Get time structure from structure in an ISO 9660 directory index
record. Even though tm_wday and tm_yday fields are not explicitly in
idr_date, the are calculated from the other fields.
If tm is to reflect the localtime set use_localtime true, otherwise
tm will reported in GMT.
*/
void iso9660_get_time (const iso9660_dtime_t *idr_date,
void iso9660_get_dtime (const iso9660_dtime_t *idr_date, bool use_localtime,
/*out*/ struct tm *tm);
@@ -319,8 +326,9 @@ iso9660_dir_init_new_su (void *dir, uint32_t self, uint32_t ssize,
const time_t *dir_time);
void
iso9660_dir_add_entry_su (void *dir, const char name[], uint32_t extent,
uint32_t size, uint8_t flags, const void *su_data,
iso9660_dir_add_entry_su (void *dir, const char filename[], uint32_t extent,
uint32_t size, uint8_t file_flags,
const void *su_data,
unsigned int su_size, const time_t *entry_time);
unsigned int
@@ -368,19 +376,22 @@ iso9660_get_pvd_space_size(const iso9660_pvd_t *pvd);
int
iso9660_get_pvd_block_size(const iso9660_pvd_t *pvd) ;
int
iso9660_get_pvd_version(const iso9660_pvd_t *pvd) ;
/*! Return the primary volume id version number (of pvd).
If there is an error 0 is returned.
*/
int iso9660_get_pvd_version(const iso9660_pvd_t *pvd) ;
lsn_t
iso9660_get_root_lsn(const iso9660_pvd_t *pvd);
/*! Return the LSN of the root directory for pvd.
If there is an error CDIO_INVALID_LSN is returned.
*/
lsn_t iso9660_get_root_lsn(const iso9660_pvd_t *pvd);
/* pathtable */
void
iso9660_pathtable_init (void *pt);
/*! Zero's out pathable. Do this first. */
void iso9660_pathtable_init (void *pt);
unsigned int
iso9660_pathtable_get_size (const void *pt);
unsigned int iso9660_pathtable_get_size (const void *pt);
uint16_t
iso9660_pathtable_l_add_entry (void *pt, const char name[], uint32_t extent,

View File

@@ -1,10 +1,11 @@
/*
$Id: xa.h,v 1.4 2003/09/01 02:08:59 rocky Exp $
$Id: xa.h,v 1.5 2003/09/21 01:14:30 rocky Exp $
Copyright (C) 2000 Herbert Valerio Riedel <hvr@gnu.org>
Copyright (C) 2003 Rocky Bernstein <rocky@panix.com>
See also iso9660.h by Eric Youngdale (1993).
See also iso9660.h by Eric Youngdale (1993) and in cdrtools. These
are
Copyright 1993 Yggdrasil Computing, Incorporated
Copyright (c) 1999,2000 J. Schilling
@@ -33,17 +34,17 @@
#define ISO_XA_MARKER_OFFSET 1024
/* XA attribute definitions */
#define XA_ATTR_G_READ 0x0001 /* System Group Read */
#define XA_ATTR_G_EXEC 0x0004 /* System Group Execute */
#define XA_PERM_RSYS 0x0001 /* System Group Read */
#define XA_PERM_XSYS 0x0004 /* System Group Execute */
#define XA_ATTR_U_READ 0x0010 /* Owner Read */
#define XA_ATTR_U_EXEC 0x0040 /* Owner Execute */
#define XA_PERM_RUSR 0x0010 /* User (owner) Read */
#define XA_PERM_XUSR 0x0040 /* User (owner) Execute */
#define XA_ATTR_O_READ 0x0100 /* Group Read */
#define XA_ATTR_O_EXEC 0x0400 /* Group Execute */
#define XA_PERM_RGRP 0x0100 /* Group Read */
#define XA_PERM_XGRP 0x0400 /* Group Execute */
#define XA_ATTR_W_READ 0x1000 /* World (other) Read */
#define XA_ATTR_W_EXEC 0x4000 /* World (other) Execute */
#define XA_PERM_ROTH 0x1000 /* Other (world) Read */
#define XA_PERM_XOTH 0x4000 /* Other (world) Execute */
#define XA_ATTR_MODE2FORM1 (1 << 11)
#define XA_ATTR_MODE2FORM2 (1 << 12)
@@ -52,8 +53,8 @@
#define XA_ATTR_DIRECTORY (1 << 15)
/* some aggregations */
#define XA_PERM_ALL_READ (XA_ATTR_U_READ | XA_ATTR_G_READ | XA_ATTR_O_READ)
#define XA_PERM_ALL_EXEC (XA_ATTR_U_EXEC | XA_ATTR_G_EXEC | XA_ATTR_O_EXEC)
#define XA_PERM_ALL_READ (XA_PERM_RUSR | XA_PERM_RSYS | XA_PERM_RGRP)
#define XA_PERM_ALL_EXEC (XA_PERM_XUSR | XA_PERM_XSYS | XA_PERM_XGRP)
#define XA_PERM_ALL_ALL (XA_PERM_ALL_READ | XA_PERM_ALL_EXEC)
#define XA_FORM1_DIR (XA_ATTR_DIRECTORY | XA_ATTR_MODE2FORM1 | XA_PERM_ALL_ALL)
@@ -92,9 +93,9 @@ typedef struct iso9660_xa /* big endian!! */
Note that an entry will either be in mode2 form1 or mode form2. That
is you will either see "2-" or "-1" in the 4th & 5th positions.
The 6th and 7th characters refer to permissions for everyone while the
The 6th and 7th characters refer to permissions for a user while the
the 8th and 9th characters refer to permissions for a group while, and
the 10th and 11th characters refer to permissions for a user.
the 10th and 11th characters refer to permissions for everyone.
In each of these pairs the first character (6, 8, 10) is "x" if the
entry is executable. For a directory this means the directory is

View File

@@ -1,5 +1,5 @@
/*
$Id: iso9660.c,v 1.13 2003/09/20 17:47:29 rocky Exp $
$Id: iso9660.c,v 1.14 2003/09/21 01:14:30 rocky Exp $
Copyright (C) 2000 Herbert Valerio Riedel <hvr@gnu.org>
Copyright (C) 2003 Rocky Bernstein <rocky@panix.com>
@@ -37,7 +37,7 @@
#include <stdio.h>
#endif
static const char _rcsid[] = "$Id: iso9660.c,v 1.13 2003/09/20 17:47:29 rocky Exp $";
static const char _rcsid[] = "$Id: iso9660.c,v 1.14 2003/09/21 01:14:30 rocky Exp $";
/* some parameters... */
#define SYSTEM_ID "CD-RTOS CD-BRIDGE"
@@ -51,10 +51,17 @@ pathtable_get_size_and_entries(const void *pt, unsigned int *size,
Get time structure from structure in an ISO 9660 directory index
record. Even though tm_wday and tm_yday fields are not explicitly in
idr_date, the are calculated from the other fields.
If tm is to reflect the localtime set use_localtime true, otherwise
tm will reported in GMT.
*/
void
iso9660_get_time (const iso9660_dtime_t *idr_date, /*out*/ struct tm *tm)
iso9660_get_dtime (const iso9660_dtime_t *idr_date, bool use_localtime,
/*out*/ struct tm *tm)
{
time_t t;
struct tm *temp_tm;
if (!idr_date) return;
tm->tm_year = idr_date->dt_year;
@@ -63,10 +70,16 @@ iso9660_get_time (const iso9660_dtime_t *idr_date, /*out*/ struct tm *tm)
tm->tm_hour = idr_date->dt_hour;
tm->tm_min = idr_date->dt_minute;
tm->tm_sec = idr_date->dt_second;
tm->tm_gmtoff = 0;
/* Recompute tm_wday and tm_yday */
mktime(tm);
/* Recompute tm_wday and tm_yday via mktime. */
t = mktime(tm);
if (use_localtime)
temp_tm = localtime(&t);
else
temp_tm = gmtime(&t);
memcpy(tm, temp_tm, sizeof(struct tm));
}
/*!
@@ -85,7 +98,23 @@ iso9660_set_dtime (const struct tm *tm, /*out*/ iso9660_dtime_t *idr_date)
idr_date->dt_hour = tm->tm_hour;
idr_date->dt_minute = tm->tm_min;
idr_date->dt_second = tm->tm_sec;
idr_date->dt_gmtoff = 0x00; /* tz, GMT -48 +52 in 15min intervals */
/* The ISO 9660 timezone is in the range -48..+52 and each unit
represents a 15-minute interval. */
idr_date->dt_gmtoff = tm->tm_gmtoff / (15 * 60);
if (tm->tm_isdst) idr_date->dt_gmtoff -= 4;
if (idr_date->dt_gmtoff < -48 ) {
cdio_warn ("Converted ISO 9660 timezone %d is less than -48. Adjusted",
idr_date->dt_gmtoff);
idr_date->dt_gmtoff = -48;
} else if (idr_date->dt_gmtoff > 52) {
cdio_warn ("Converted ISO 9660 timezone %d is over 52. Adjusted",
idr_date->dt_gmtoff);
idr_date->dt_gmtoff = 52;
}
}
/*!
@@ -364,10 +393,10 @@ iso9660_dir_calc_record_size(unsigned int namelen, unsigned int su_len)
void
iso9660_dir_add_entry_su(void *dir,
const char name[],
const char filename[],
uint32_t extent,
uint32_t size,
uint8_t flags,
uint8_t file_flags,
const void *su_data,
unsigned int su_size,
const time_t *entry_time)
@@ -385,11 +414,11 @@ iso9660_dir_add_entry_su(void *dir,
cdio_assert (dsize > 0 && !(dsize % ISO_BLOCKSIZE));
cdio_assert (dir != NULL);
cdio_assert (extent > 17);
cdio_assert (name != NULL);
cdio_assert (strlen(name) <= MAX_ISOPATHNAME);
cdio_assert (filename != NULL);
cdio_assert (strlen(filename) <= MAX_ISOPATHNAME);
length = sizeof(iso9660_dir_t);
length += strlen(name);
length += strlen(filename);
length = _cdio_ceil2block (length, 2); /* pad to word boundary */
su_offset = length;
length += su_size;
@@ -433,15 +462,16 @@ iso9660_dir_add_entry_su(void *dir,
idr->extent = to_733(extent);
idr->size = to_733(size);
iso9660_set_dtime (gmtime(entry_time), &(idr->date));
iso9660_set_dtime (gmtime(entry_time), &(idr->recording_time));
idr->flags = to_711(flags);
idr->file_flags = to_711(file_flags);
idr->volume_sequence_number = to_723(1);
idr->name_len = to_711(strlen(name) ? strlen(name) : 1); /* working hack! */
idr->filename_len = to_711(strlen(filename)
? strlen(filename) : 1); /* working hack! */
memcpy(idr->name, name, from_711(idr->name_len));
memcpy(idr->filename, filename, from_711(idr->filename_len));
memcpy(&dir8[offset] + su_offset, su_data, su_size);
}
@@ -483,6 +513,7 @@ iso9660_dir_init_new_su (void *dir,
psu_size, dir_time);
}
/* Zero's out pathable. Do this first. */
void
iso9660_pathtable_init (void *pt)
{
@@ -815,6 +846,9 @@ iso9660_get_pvd_block_size(const iso9660_pvd_t *pvd)
return from_723(pvd->logical_block_size);
}
/*! Return the primary volume id version number (of pvd).
If there is an error 0 is returned.
*/
int
iso9660_get_pvd_version(const iso9660_pvd_t *pvd)
{
@@ -822,6 +856,9 @@ iso9660_get_pvd_version(const iso9660_pvd_t *pvd)
return pvd->version;
}
/*! Return the LSN of the root directory for pvd.
If there is an error CDIO_INVALID_LSN is returned.
*/
lsn_t
iso9660_get_root_lsn(const iso9660_pvd_t *pvd)
{

View File

@@ -1,5 +1,5 @@
/*
$Id: iso9660_fs.c,v 1.10 2003/09/20 11:53:09 rocky Exp $
$Id: iso9660_fs.c,v 1.11 2003/09/21 01:14:30 rocky Exp $
Copyright (C) 2001 Herbert Valerio Riedel <hvr@gnu.org>
Copyright (C) 2003 Rocky Bernstein <rocky@panix.com>
@@ -38,7 +38,7 @@
#include <stdio.h>
static const char _rcsid[] = "$Id: iso9660_fs.c,v 1.10 2003/09/20 11:53:09 rocky Exp $";
static const char _rcsid[] = "$Id: iso9660_fs.c,v 1.11 2003/09/21 01:14:30 rocky Exp $";
static void
_idr2statbuf (const iso9660_dir_t *idr, iso9660_stat_t *stat, bool is_mode2)
@@ -50,18 +50,18 @@ _idr2statbuf (const iso9660_dir_t *idr, iso9660_stat_t *stat, bool is_mode2)
if (!dir_len) return;
stat->type = (idr->flags & ISO_DIRECTORY) ? _STAT_DIR : _STAT_FILE;
stat->type = (idr->file_flags & ISO_DIRECTORY) ? _STAT_DIR : _STAT_FILE;
stat->lsn = from_733 (idr->extent);
stat->size = from_733 (idr->size);
stat->secsize = _cdio_len2blocks (stat->size, ISO_BLOCKSIZE);
iso9660_get_time(&(idr->date), &(stat->tm));
iso9660_get_dtime(&(idr->recording_time), true, &(stat->tm));
cdio_assert (dir_len >= sizeof (iso9660_dir_t));
if (is_mode2) {
int su_length = iso9660_get_dir_len(idr) - sizeof (iso9660_dir_t);
su_length -= idr->name_len;
su_length -= idr->filename_len;
if (su_length % 2)
su_length--;
@@ -77,7 +77,7 @@ _idr2statbuf (const iso9660_dir_t *idr, iso9660_stat_t *stat, bool is_mode2)
cdio_warn ("XA signature not found in ISO9660's system use area;"
" ignoring XA attributes for this file entry.");
cdio_debug ("%d %d %d, '%c%c' (%d, %d)", iso9660_get_dir_len(idr),
idr->name_len,
idr->filename_len,
su_length,
xa_data->signature[0], xa_data->signature[1],
xa_data->signature[0], xa_data->signature[1]);
@@ -98,14 +98,14 @@ _idr2name (const iso9660_dir_t *idr)
cdio_assert (len >= sizeof (iso9660_dir_t));
/* (idr->flags & ISO_DIRECTORY) */
/* (idr->file_flags & ISO_DIRECTORY) */
if (idr->name[0] == '\0')
if (idr->filename[0] == '\0')
strcpy (namebuf, ".");
else if (idr->name[0] == '\1')
else if (idr->filename[0] == '\1')
strcpy (namebuf, "..");
else
strncpy (namebuf, idr->name, idr->name_len);
strncpy (namebuf, idr->filename, idr->filename_len);
return strdup (namebuf);
}

View File

@@ -1,5 +1,5 @@
/*
$Id: xa.c,v 1.3 2003/08/31 09:11:25 rocky Exp $
$Id: xa.c,v 1.4 2003/09/21 01:14:30 rocky Exp $
Copyright (C) 2000 Herbert Valerio Riedel <hvr@gnu.org>
Copyright (C) 2003 Rocky Bernstein <rocky@panix.com>
@@ -72,9 +72,9 @@ _getbuf (void)
Note that an entry will either be in mode2 form1 or mode form2. That
is you will either see "2-" or "-1" in the 4th & 5th positions.
The 6th and 7th characters refer to permissions for everyone while the
The 6th and 7th characters refer to permissions for a user while the
the 8th and 9th characters refer to permissions for a group while, and
the 10th and 11th characters refer to permissions for a user.
the 10th and 11th characters refer to permissions for a others.
In each of these pairs the first character (6, 8, 10) is "x" if the
entry is executable. For a directory this means the directory is
@@ -96,14 +96,15 @@ iso9660_get_xa_attr_str (uint16_t xa_attr)
result[ 3] = (xa_attr & XA_ATTR_MODE2FORM2) ? '2' : '-';
result[ 4] = (xa_attr & XA_ATTR_MODE2FORM1) ? '1' : '-';
result[5] = (xa_attr & XA_ATTR_O_EXEC) ? 'x' : '-';
result[6] = (xa_attr & XA_ATTR_O_READ) ? 'r' : '-';
result[ 5] = (xa_attr & XA_PERM_XUSR) ? 'x' : '-';
result[ 6] = (xa_attr & XA_PERM_RUSR) ? 'r' : '-';
result[7] = (xa_attr & XA_ATTR_G_EXEC) ? 'x' : '-';
result[8] = (xa_attr & XA_ATTR_G_READ) ? 'r' : '-';
result[ 7] = (xa_attr & XA_PERM_XGRP) ? 'x' : '-';
result[ 8] = (xa_attr & XA_PERM_RGRP) ? 'r' : '-';
result[9] = (xa_attr & XA_ATTR_U_EXEC) ? 'x' : '-';
result[10] = (xa_attr & XA_ATTR_U_READ) ? 'r' : '-';
/* Hack alert: wonder if this should be ROTH and XOTH? */
result[ 9] = (xa_attr & XA_PERM_XSYS) ? 'x' : '-';
result[10] = (xa_attr & XA_PERM_RSYS) ? 'r' : '-';
result[11] = '\0';

View File

@@ -15,8 +15,8 @@ ISO9660 filesystem
root dir in PVD set to lsn 18
/:
d d---1xrxrxr 0 0 [fn 00] [LSN 18] 2048 Saturday 0 1900 00:00 .
d d---1xrxrxr 0 0 [fn 00] [LSN 18] 2048 Saturday 0 1900 00:00 ..
d d---1xrxrxr 0 0 [fn 00] [LSN 18] 2048 Dec 31 1969 23:59 .
d d---1xrxrxr 0 0 [fn 00] [LSN 18] 2048 Dec 31 1969 23:59 ..
d d---1xrxrxr 0 0 [fn 00] [LSN 19] 2048 Feb 19 2001 16:37 cdi
d d---1xrxrxr 0 0 [fn 00] [LSN 20] 2048 Feb 19 2001 16:37 ext
d d---1xrxrxr 0 0 [fn 00] [LSN 21] 2048 Feb 19 2001 16:37 mpegav
@@ -24,32 +24,32 @@ ISO9660 filesystem
d d---1xrxrxr 0 0 [fn 00] [LSN 23] 2048 Feb 19 2001 16:37 vcd
/CDI/:
d d---1xrxrxr 0 0 [fn 00] [LSN 19] 2048 Saturday 0 1900 00:00 .
d d---1xrxrxr 0 0 [fn 00] [LSN 18] 2048 Saturday 0 1900 00:00 ..
d d---1xrxrxr 0 0 [fn 00] [LSN 19] 2048 Dec 31 1969 23:59 .
d d---1xrxrxr 0 0 [fn 00] [LSN 18] 2048 Dec 31 1969 23:59 ..
- ---2-xrxrxr 0 0 [fn 01] [LSN 211] 1494332 ( 1315168) Feb 19 2001 16:37 cdi_imag.rtf
- ----1xrxrxr 0 0 [fn 01] [LSN 854] 13616 Feb 19 2001 16:37 cdi_text.fnt
- ----1xrxrxr 0 0 [fn 01] [LSN 861] 102400 Feb 19 2001 16:37 cdi_vcd.app
- ----1xrxrxr 0 0 [fn 01] [LSN 911] 279 Feb 19 2001 16:37 cdi_vcd.cfg
/EXT/:
d d---1xrxrxr 0 0 [fn 00] [LSN 20] 2048 Saturday 0 1900 00:00 .
d d---1xrxrxr 0 0 [fn 00] [LSN 18] 2048 Saturday 0 1900 00:00 ..
d d---1xrxrxr 0 0 [fn 00] [LSN 20] 2048 Dec 31 1969 23:59 .
d d---1xrxrxr 0 0 [fn 00] [LSN 18] 2048 Dec 31 1969 23:59 ..
- ----1xrxrxr 0 0 [fn 01] [LSN 912] 65536 Feb 19 2001 16:37 lot_x.vcd
- ----1xrxrxr 0 0 [fn 01] [LSN 944] 24 Feb 19 2001 16:37 psd_x.vcd
- ----1xrxrxr 0 0 [fn 01] [LSN 945] 114 Feb 19 2001 16:37 scandata.dat
/MPEGAV/:
d d---1xrxrxr 0 0 [fn 00] [LSN 21] 2048 Saturday 0 1900 00:00 .
d d---1xrxrxr 0 0 [fn 00] [LSN 18] 2048 Saturday 0 1900 00:00 ..
d d---1xrxrxr 0 0 [fn 00] [LSN 21] 2048 Dec 31 1969 23:59 .
d d---1xrxrxr 0 0 [fn 00] [LSN 18] 2048 Dec 31 1969 23:59 ..
- ---2-xrxrxr 0 0 [fn 01] [LSN 1251] 3655652 ( 3221504) Feb 19 2001 16:37 avseq01.dat
/SEGMENT/:
d d---1xrxrxr 0 0 [fn 00] [LSN 22] 2048 Saturday 0 1900 00:00 .
d d---1xrxrxr 0 0 [fn 00] [LSN 18] 2048 Saturday 0 1900 00:00 ..
d d---1xrxrxr 0 0 [fn 00] [LSN 22] 2048 Dec 31 1969 23:59 .
d d---1xrxrxr 0 0 [fn 00] [LSN 18] 2048 Dec 31 1969 23:59 ..
/VCD/:
d d---1xrxrxr 0 0 [fn 00] [LSN 23] 2048 Saturday 0 1900 00:00 .
d d---1xrxrxr 0 0 [fn 00] [LSN 18] 2048 Saturday 0 1900 00:00 ..
d d---1xrxrxr 0 0 [fn 00] [LSN 23] 2048 Dec 31 1969 23:59 .
d d---1xrxrxr 0 0 [fn 00] [LSN 18] 2048 Dec 31 1969 23:59 ..
- ----1xrxrxr 0 0 [fn 00] [LSN 151] 2048 Feb 19 2001 16:37 entries.vcd
- ----1xrxrxr 0 0 [fn 00] [LSN 150] 2048 Feb 19 2001 16:37 info.vcd
- ----1xrxrxr 0 0 [fn 00] [LSN 152] 65536 Feb 19 2001 16:37 lot.vcd

View File

@@ -54,13 +54,13 @@ ISO9660 filesystem
/SVCD/:
d d---1xrxrxr 0 0 [fn 00] [LSN 26] 2048 Jan 6 2001 21:29 .
d d---1xrxrxr 0 0 [fn 00] [LSN 20] 2048 Jan 6 2001 21:29 ..
- ----1-rxrxr 0 0 [fn 00] [LSN 151] 2048 Jan 6 2001 21:29 entries.svd
- ----1-rxrxr 0 0 [fn 00] [LSN 150] 2048 Jan 6 2001 21:29 info.svd
- ----1-rxrxr 0 0 [fn 00] [LSN 152] 65536 Jan 6 2001 21:29 lot.svd
- ----1-rxrxr 0 0 [fn 00] [LSN 184] 16 Jan 6 2001 21:29 psd.svd
- ----1-rxrxr 0 0 [fn 00] [LSN 188] 427 Jan 6 2001 21:29 search.dat
- ----1-rxrxr 0 0 [fn 00] [LSN 186] 4096 Jan 6 2001 21:29 spicontx.svd
- ----1-rxrxr 0 0 [fn 00] [LSN 185] 2048 Jan 6 2001 21:29 tracks.svd
- ----1xr-rxr 0 0 [fn 00] [LSN 151] 2048 Jan 6 2001 21:29 entries.svd
- ----1xr-rxr 0 0 [fn 00] [LSN 150] 2048 Jan 6 2001 21:29 info.svd
- ----1xr-rxr 0 0 [fn 00] [LSN 152] 65536 Jan 6 2001 21:29 lot.svd
- ----1xr-rxr 0 0 [fn 00] [LSN 184] 16 Jan 6 2001 21:29 psd.svd
- ----1xr-rxr 0 0 [fn 00] [LSN 188] 427 Jan 6 2001 21:29 search.dat
- ----1xr-rxr 0 0 [fn 00] [LSN 186] 4096 Jan 6 2001 21:29 spicontx.svd
- ----1xr-rxr 0 0 [fn 00] [LSN 185] 2048 Jan 6 2001 21:29 tracks.svd
/VMP/:
d d---1xrxrxr 0 0 [fn 00] [LSN 27] 2048 Jan 6 2001 21:29 .

View File

@@ -1,5 +1,5 @@
/*
$Id: testiso9660.c,v 1.1 2003/09/01 15:08:15 rocky Exp $
$Id: testiso9660.c,v 1.2 2003/09/21 01:14:30 rocky Exp $
Copyright (C) 2003 Rocky Bernstein <rocky@panix.com>
@@ -41,8 +41,6 @@ main (int argc, const char *argv[])
char *dst_p;
int achars[] = {'!', '"', '%', '&', '(', ')', '*', '+', ',', '-', '.',
'/', '?', '<', '=', '>'};
for (c='A'; c<='Z'; c++ ) {
if (!iso9660_isdchar(c)) {
printf("Failed iso9660_isdchar test on %d\n", c);
@@ -126,5 +124,30 @@ main (int argc, const char *argv[])
return 10;
}
/* Test get/set date */
{
struct tm *p_tm, tm;
iso9660_dtime_t dtime;
time_t now = time(NULL);
memset(&dtime, 0, sizeof(dtime));
p_tm = localtime(&now);
iso9660_set_dtime(p_tm, &dtime);
iso9660_get_dtime(&dtime, true, &tm);
if ( memcmp(p_tm, &tm, sizeof(tm)) != 0 ) {
printf("Time retrieved with iso0660_get_dtime not same as that set with "
"iso9660_set_dtime.\n");
return 11;
}
p_tm = gmtime(&now);
iso9660_set_dtime(p_tm, &dtime);
iso9660_get_dtime(&dtime, false, &tm);
if ( memcmp(p_tm, &tm, sizeof(tm)) != 0 ) {
printf("Time retrieved with iso0660_get_dtime not same as that set with "
"iso9660_set_dtime.\n");
return 12;
}
}
return 0;
}