udf1.c: Do better about dealing with recursive directories.
iso-info.c: small variable name change
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
$Id: udf1.c,v 1.11 2005/10/30 07:35:36 rocky Exp $
|
||||
$Id: udf1.c,v 1.12 2005/10/30 15:58:37 rocky Exp $
|
||||
|
||||
Copyright (C) 2005 Rocky Bernstein <rocky@panix.com>
|
||||
|
||||
@@ -51,44 +51,48 @@
|
||||
#define udf_PATH_DELIMITERS "/\\"
|
||||
|
||||
static void
|
||||
print_file_info(const udf_file_t *p_udf_file)
|
||||
print_file_info(const udf_file_t *p_udf_file, const char* psz_dirname)
|
||||
{
|
||||
time_t mod_time = udf_get_modification_time(p_udf_file);
|
||||
char psz_mode[11]="invalid";
|
||||
const char *psz_fname= psz_dirname
|
||||
? psz_dirname : udf_get_filename(p_udf_file);
|
||||
|
||||
if ('\0' == *psz_fname) psz_fname = strdup(".");
|
||||
|
||||
/* Print directory attributes*/
|
||||
printf("%s ", udf_mode_string(udf_get_posix_filemode(p_udf_file),
|
||||
psz_mode));
|
||||
printf("%4d ", udf_get_link_count(p_udf_file));
|
||||
printf("%s %s", udf_get_filename(p_udf_file), ctime(&mod_time));
|
||||
printf("%s %s", psz_fname, ctime(&mod_time));
|
||||
}
|
||||
|
||||
static udf_file_t *
|
||||
list_files(const udf_t *p_udf, udf_file_t *p_udf_file, char *psz_token)
|
||||
list_files(const udf_t *p_udf, udf_file_t *p_udf_file, const char *psz_path)
|
||||
{
|
||||
if (!p_udf_file) return NULL;
|
||||
if (psz_token) {
|
||||
print_file_info(p_udf_file);
|
||||
}
|
||||
|
||||
print_file_info(p_udf_file, psz_path);
|
||||
|
||||
while (udf_get_next(p_udf, p_udf_file)) {
|
||||
char *next_tok = strtok(psz_token, udf_PATH_DELIMITERS);
|
||||
|
||||
if (udf_is_dir(p_udf_file)) {
|
||||
udf_file_t * p_udf_file2 = udf_get_sub(p_udf, p_udf_file);
|
||||
|
||||
udf_file_t *p_udf_file2 = udf_get_sub(p_udf, p_udf_file);
|
||||
if (p_udf_file2) {
|
||||
udf_file_t *p_udf_file3 =
|
||||
list_files(p_udf, p_udf_file2, next_tok);
|
||||
const char *psz_dirname = udf_get_filename(p_udf_file);
|
||||
const unsigned int i_newlen=2 + strlen(psz_path) + strlen(psz_dirname);
|
||||
char *psz_newpath = calloc(1, sizeof(char)*i_newlen);
|
||||
|
||||
if (!p_udf_file3) udf_file_free(p_udf_file2);
|
||||
udf_file_free(p_udf_file3);
|
||||
snprintf(psz_newpath, i_newlen, "%s%s/", psz_path, psz_dirname);
|
||||
list_files(p_udf, p_udf_file2, psz_newpath);
|
||||
free(psz_newpath);
|
||||
udf_file_free(p_udf_file2);
|
||||
}
|
||||
} else {
|
||||
print_file_info(p_udf_file);
|
||||
print_file_info(p_udf_file, NULL);
|
||||
}
|
||||
}
|
||||
free(psz_token);
|
||||
return p_udf_file;
|
||||
}
|
||||
|
||||
@@ -134,7 +138,7 @@ main(int argc, const char *argv[])
|
||||
|
||||
}
|
||||
|
||||
list_files(p_udf, p_udf_file, strdup(udf_get_filename(p_udf_file)));
|
||||
list_files(p_udf, p_udf_file, "");
|
||||
udf_file_free(p_udf_file);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
$Id: iso-info.c,v 1.32 2005/10/06 09:37:11 rocky Exp $
|
||||
$Id: iso-info.c,v 1.33 2005/10/30 15:58:37 rocky Exp $
|
||||
|
||||
Copyright (C) 2004, 2005 Rocky Bernstein <rocky@panix.com>
|
||||
|
||||
@@ -198,17 +198,17 @@ _log_handler (cdio_log_level_t level, const char message[])
|
||||
}
|
||||
|
||||
static void
|
||||
print_iso9660_recurse (iso9660_t *p_iso, const char pathname[])
|
||||
print_iso9660_recurse (iso9660_t *p_iso, const char psz_path[])
|
||||
{
|
||||
CdioList_t *entlist;
|
||||
CdioList_t *dirlist = _cdio_list_new ();
|
||||
CdioListNode_t *entnode;
|
||||
uint8_t i_joliet_level = iso9660_ifs_get_joliet_level(p_iso);
|
||||
|
||||
entlist = iso9660_ifs_readdir (p_iso, pathname);
|
||||
entlist = iso9660_ifs_readdir (p_iso, psz_path);
|
||||
|
||||
if (opts.print_iso9660) {
|
||||
printf ("%s:\n", pathname);
|
||||
printf ("%s:\n", psz_path);
|
||||
}
|
||||
|
||||
if (NULL == entlist) {
|
||||
@@ -228,10 +228,10 @@ print_iso9660_recurse (iso9660_t *p_iso, const char pathname[])
|
||||
if (yep != p_statbuf->rr.b3_rock || 1 == opts.no_rock_ridge) {
|
||||
iso9660_name_translate_ext(psz_iso_name, translated_name,
|
||||
i_joliet_level);
|
||||
snprintf (_fullname, sizeof (_fullname), "%s%s", pathname,
|
||||
snprintf (_fullname, sizeof (_fullname), "%s%s", psz_path,
|
||||
translated_name);
|
||||
} else {
|
||||
snprintf (_fullname, sizeof (_fullname), "%s%s", pathname,
|
||||
snprintf (_fullname, sizeof (_fullname), "%s%s", psz_path,
|
||||
psz_iso_name);
|
||||
}
|
||||
|
||||
@@ -249,7 +249,7 @@ print_iso9660_recurse (iso9660_t *p_iso, const char pathname[])
|
||||
psz_iso_name, translated_name);
|
||||
} else
|
||||
if ( strcmp (psz_iso_name, ".") && strcmp (psz_iso_name, ".."))
|
||||
printf("%9u %s%s\n", (unsigned int) p_statbuf->size, pathname,
|
||||
printf("%9u %s%s\n", (unsigned int) p_statbuf->size, psz_path,
|
||||
yep == p_statbuf->rr.b3_rock
|
||||
? psz_iso_name : translated_name);
|
||||
if (p_statbuf->rr.i_symlink) {
|
||||
|
||||
Reference in New Issue
Block a user