mirror of
https://github.com/opnsense/src.git
synced 2026-05-28 04:12:45 -04:00
Merge version 1.04 into HEAD.
This commit is contained in:
parent
d6df5fd25f
commit
215568d2a2
11 changed files with 411 additions and 74 deletions
|
|
@ -43,7 +43,9 @@ mkisofs.o: mkisofs.c iso9660.h mkisofs.h exclude.h
|
|||
|
||||
clean:
|
||||
/bin/rm -f *.o core mkisofs *~ #*#
|
||||
(cd diag/; make clean)
|
||||
(cd cdwrite/; make clean)
|
||||
|
||||
dist:
|
||||
tar -cvf - README Configure Makefile.in make.com TODO COPYING ChangeLog *.8 *.c *.h diag | gzip > mkisofs-1.02.tar.gz
|
||||
tar -cvf - README Configure Makefile.in make.com TODO COPYING ChangeLog *.8 *.c *.h diag cdwrite.old cdwrite-1.5 | gzip > mkisofs-1.04.tar.gz
|
||||
|
||||
|
|
|
|||
|
|
@ -11,12 +11,24 @@
|
|||
#define ABSTRACT_DEFAULT NULL
|
||||
#define VOLSET_ID_DEFAULT NULL
|
||||
#define VOLUME_ID_DEFAULT "CDROM"
|
||||
|
||||
#ifdef __FreeBSD__
|
||||
#define SYSTEM_ID_DEFAULT "FreeBSD"
|
||||
#else
|
||||
#endif
|
||||
|
||||
#ifdef __QNX__
|
||||
#define SYSTEM_ID_DEFAULT "QNX"
|
||||
#else
|
||||
#endif
|
||||
|
||||
#ifdef __linux__
|
||||
#define SYSTEM_ID_DEFAULT "LINUX"
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef __osf__
|
||||
#define SYSTEM_ID_DEFAULT "OSF"
|
||||
#endif
|
||||
|
||||
#ifndef SYSTEM_ID_DEFAULT
|
||||
#define SYSTEM_ID_DEFAULT "UNKNOWNSYS"
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -1,10 +1,16 @@
|
|||
all: dump isodump isovfy
|
||||
#CC = gcc
|
||||
CC = cc -traditional
|
||||
|
||||
all: dump isodump isovfy
|
||||
|
||||
isoinfo:isoinfo.c
|
||||
${CC} -g -o isoinfo isoinfo.c
|
||||
dump:dump.c
|
||||
gcc -o dump dump.c
|
||||
${CC} -o dump dump.c
|
||||
isodump:isodump.c
|
||||
gcc -o isodump isodump.c
|
||||
${CC} -o isodump isodump.c
|
||||
isovfy:isovfy.c
|
||||
gcc -o isovfy isovfy.c
|
||||
${CC} -o isovfy isovfy.c
|
||||
|
||||
clean:
|
||||
rm dump isodump isovfy
|
||||
rm -f dump isodump isovfy isoinfo
|
||||
|
|
|
|||
|
|
@ -52,7 +52,7 @@ isonum_731 (char * p)
|
|||
|
||||
|
||||
int
|
||||
isonum_733 (char * p)
|
||||
isonum_733 (unsigned char * p)
|
||||
{
|
||||
return (isonum_731 (p));
|
||||
}
|
||||
|
|
@ -104,7 +104,7 @@ struct iso_directory_record {
|
|||
unsigned char interleave [ISODCL (28, 28)]; /* 711 */
|
||||
unsigned char volume_sequence_number [ISODCL (29, 32)]; /* 723 */
|
||||
unsigned char name_len [ISODCL (33, 33)]; /* 711 */
|
||||
unsigned char name [0];
|
||||
unsigned char name [1];
|
||||
};
|
||||
|
||||
#ifdef USE_TERMIOS
|
||||
|
|
@ -285,13 +285,15 @@ int
|
|||
dump_rr(struct iso_directory_record * idr)
|
||||
{
|
||||
int len;
|
||||
char * pnt;
|
||||
unsigned char * pnt;
|
||||
|
||||
len = idr->length[0] & 0xff;
|
||||
len -= sizeof(struct iso_directory_record);
|
||||
len += sizeof(idr->name);
|
||||
len -= idr->name_len[0];
|
||||
pnt = (char *) idr;
|
||||
pnt = (unsigned char *) idr;
|
||||
pnt += sizeof(struct iso_directory_record);
|
||||
pnt -= sizeof(idr->name);
|
||||
pnt += idr->name_len[0];
|
||||
if((idr->name_len[0] & 1) == 0){
|
||||
pnt++;
|
||||
|
|
@ -318,9 +320,9 @@ showblock(int flag){
|
|||
if(idr->length[0] == 0) break;
|
||||
printf("%3d ", idr->length[0]);
|
||||
printf("[%2d] ", idr->volume_sequence_number[0]);
|
||||
printf("%5x ", *((unsigned int *) idr->extent));
|
||||
printf("%8d ", *((unsigned int *) idr->size));
|
||||
printf ((idr->flags[0] & 2) ? "*" : " ");
|
||||
printf("%5x ", isonum_733(idr->extent));
|
||||
printf("%8d ", isonum_733(idr->size));
|
||||
printf ((idr->flags[0] & 2) ? "*" : " ");
|
||||
if(idr->name_len[0] == 1 && idr->name[0] == 0)
|
||||
printf(". ");
|
||||
else if(idr->name_len[0] == 1 && idr->name[0] == 1)
|
||||
|
|
|
|||
|
|
@ -112,7 +112,7 @@ isonum_732 (char * p)
|
|||
}
|
||||
|
||||
int
|
||||
isonum_733 (char * p)
|
||||
isonum_733 (unsigned char * p)
|
||||
{
|
||||
return (isonum_731 (p));
|
||||
}
|
||||
|
|
@ -312,14 +312,14 @@ check_tree(int file_addr, int file_size, int parent_addr){
|
|||
else if(idr->name_len[0] == 1 && idr->name[0] == 0) {
|
||||
iline += sprintf(&lbuffer[iline],". ");
|
||||
rflag = 0;
|
||||
if(orig_file_addr !=*((unsigned int *) idr->extent))
|
||||
if(orig_file_addr !=isonum_733(idr->extent))
|
||||
iline += sprintf(&lbuffer[iline],"***** Directory has null extent.", goof++);
|
||||
if(i1)
|
||||
iline += sprintf(&lbuffer[iline],"***** . not first entry.", rr_goof++);
|
||||
} else if(idr->name_len[0] == 1 && idr->name[0] == 1) {
|
||||
iline += sprintf(&lbuffer[iline],".. ");
|
||||
rflag = 0;
|
||||
if(parent_file_addr !=*((unsigned int *) idr->extent))
|
||||
if(parent_file_addr !=isonum_733(idr->extent))
|
||||
iline += sprintf(&lbuffer[iline],"***** Directory has null extent.", goof++);
|
||||
if(i1 != 1)
|
||||
iline += sprintf(&lbuffer[iline],"***** .. not second entry.", rr_goof++);
|
||||
|
|
@ -332,7 +332,10 @@ check_tree(int file_addr, int file_size, int parent_addr){
|
|||
};
|
||||
|
||||
if(size && extent == 0) iline += sprintf(&lbuffer[iline],"****Extent==0, size != 0", goof++);
|
||||
#if 0
|
||||
/* This is apparently legal. */
|
||||
if(size == 0 && extent) iline += sprintf(&lbuffer[iline],"****Extent!=0, size == 0", goof++);
|
||||
#endif
|
||||
|
||||
if(idr->flags[0] & 0xfd)
|
||||
iline += sprintf(&lbuffer[iline],"Flags=(%x) ", idr->flags[0], goof++);
|
||||
|
|
@ -361,8 +364,8 @@ check_tree(int file_addr, int file_size, int parent_addr){
|
|||
|
||||
|
||||
|
||||
if(rflag && (idr->flags[0] & 2)) check_tree((*((unsigned int *) idr->extent)) << 11,
|
||||
*((unsigned int *) idr->size),
|
||||
if(rflag && (idr->flags[0] & 2)) check_tree((isonum_733(idr->extent)) << 11,
|
||||
isonum_733(idr->size),
|
||||
orig_file_addr << 11);
|
||||
i += buffer[i];
|
||||
i1++;
|
||||
|
|
|
|||
|
|
@ -29,8 +29,7 @@ char * fn;
|
|||
return;
|
||||
}
|
||||
|
||||
|
||||
excl[i] = malloc(strlen(fn)+1);
|
||||
excl[i] = (char *) malloc(strlen(fn)+1);
|
||||
if (! excl[i]) {
|
||||
fprintf(stderr,"Can't allocate memory for excluded filename\n");
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -20,6 +20,8 @@
|
|||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||
|
||||
/* ADD_FILES changes made by Ross Biro biro@yggdrasil.com 2/23/95 */
|
||||
|
||||
#include "mkisofs.h"
|
||||
|
||||
#include <assert.h>
|
||||
|
|
@ -54,7 +56,7 @@
|
|||
|
||||
struct directory * root = NULL;
|
||||
|
||||
static char version_string[] = "mkisofs v1.03";
|
||||
static char version_string[] = "mkisofs v1.04";
|
||||
|
||||
FILE * discimage;
|
||||
unsigned int next_extent = 0;
|
||||
|
|
@ -90,6 +92,7 @@ int omit_version_number = 0; /* May violate iso9660, but noone uses vers*/
|
|||
int RR_relocation_depth = 6; /* Violates iso9660, but most systems work */
|
||||
int full_iso9660_filenames = 0; /* Used with Amiga. Disc will not work with
|
||||
DOS */
|
||||
int allow_leading_dots = 0; /* DOS cannot read names with leading dots */
|
||||
|
||||
struct rcopts{
|
||||
char * tag;
|
||||
|
|
@ -185,7 +188,7 @@ void usage(){
|
|||
fprintf(stderr,"Usage:\n");
|
||||
fprintf(stderr,
|
||||
"mkisofs [-o outfile] [-R] [-V volid] [-v] [-a] \
|
||||
[-T]\n [-l] [-d] [-V] [-D] [-p preparer] \
|
||||
[-T]\n [-l] [-d] [-V] [-D] [-L] [-p preparer] \
|
||||
[-P publisher] [ -A app_id ] [-z] \
|
||||
[-x path -x path ...] path\n");
|
||||
exit(1);
|
||||
|
|
@ -280,9 +283,15 @@ int FDECL3(iso9660_file_length,const char*, name, struct directory_entry *, sres
|
|||
if(current_length < 30) *result++ = (islower(*pnt) ? toupper(*pnt) : *pnt);
|
||||
} else { /* Dos style filenames */
|
||||
if(*pnt == '.') {
|
||||
if (seen_dot) {ignore++; continue;}
|
||||
if(result) *result++ = '.';
|
||||
seen_dot++;
|
||||
if (!chars_before_dot && !allow_leading_dots) {
|
||||
/* DOS can't read files with dot first */
|
||||
chars_before_dot++;
|
||||
if (result) *result++ = '_'; /* Substitute underscore */
|
||||
} else {
|
||||
if (seen_dot) {ignore++; continue;}
|
||||
if(result) *result++ = '.';
|
||||
seen_dot++;
|
||||
}
|
||||
} else if (seen_dot) {
|
||||
if(chars_after_dot < 3) {
|
||||
chars_after_dot++;
|
||||
|
|
@ -367,6 +376,154 @@ int FDECL3(iso9660_file_length,const char*, name, struct directory_entry *, sres
|
|||
return chars_before_dot + chars_after_dot + seen_dot + extra;
|
||||
}
|
||||
|
||||
#ifdef ADD_FILES
|
||||
|
||||
struct file_adds *root_file_adds = NULL;
|
||||
|
||||
void
|
||||
FDECL2(add_one_file, char *, addpath, char *, path )
|
||||
{
|
||||
char *cp;
|
||||
char *name;
|
||||
struct file_adds *f;
|
||||
struct file_adds *tmp;
|
||||
|
||||
f = root_file_adds;
|
||||
tmp = NULL;
|
||||
|
||||
name = rindex (addpath, PATH_SEPARATOR);
|
||||
if (name == NULL) {
|
||||
name = addpath;
|
||||
} else {
|
||||
name++;
|
||||
}
|
||||
|
||||
cp = strtok (addpath, SPATH_SEPARATOR);
|
||||
|
||||
while (cp != NULL && strcmp (name, cp)) {
|
||||
if (f == NULL) {
|
||||
root_file_adds = e_malloc (sizeof *root_file_adds);
|
||||
f=root_file_adds;
|
||||
f->name = NULL;
|
||||
f->child = NULL;
|
||||
f->next = NULL;
|
||||
f->add_count = 0;
|
||||
f->adds = NULL;
|
||||
f->used = 0;
|
||||
}
|
||||
if (f->child) {
|
||||
for (tmp = f->child; tmp->next != NULL; tmp =tmp->next) {
|
||||
if (strcmp (tmp->name, cp) == 0) {
|
||||
f = tmp;
|
||||
goto next;
|
||||
}
|
||||
}
|
||||
if (strcmp (tmp->name, cp) == 0) {
|
||||
f=tmp;
|
||||
goto next;
|
||||
}
|
||||
/* add a new node. */
|
||||
tmp->next = e_malloc (sizeof (*tmp->next));
|
||||
f=tmp->next;
|
||||
f->name = strdup (cp);
|
||||
f->child = NULL;
|
||||
f->next = NULL;
|
||||
f->add_count = 0;
|
||||
f->adds = NULL;
|
||||
f->used = 0;
|
||||
} else {
|
||||
/* no children. */
|
||||
f->child = e_malloc (sizeof (*f->child));
|
||||
f = f->child;
|
||||
f->name = strdup (cp);
|
||||
f->child = NULL;
|
||||
f->next = NULL;
|
||||
f->add_count = 0;
|
||||
f->adds = NULL;
|
||||
f->used = 0;
|
||||
|
||||
}
|
||||
next:
|
||||
cp = strtok (NULL, SPATH_SEPARATOR);
|
||||
}
|
||||
/* Now f if non-null points to where we should add things */
|
||||
if (f == NULL) {
|
||||
root_file_adds = e_malloc (sizeof *root_file_adds);
|
||||
f=root_file_adds;
|
||||
f->name = NULL;
|
||||
f->child = NULL;
|
||||
f->next = NULL;
|
||||
f->add_count = 0;
|
||||
f->adds = NULL;
|
||||
}
|
||||
|
||||
/* Now f really points to where we should add this name. */
|
||||
f->add_count++;
|
||||
f->adds = realloc (f->adds, sizeof (*f->adds)*f->add_count);
|
||||
f->adds[f->add_count-1].path = strdup (path);
|
||||
f->adds[f->add_count-1].name = strdup (name);
|
||||
}
|
||||
|
||||
void
|
||||
FDECL3(add_file_list, int, argc, char **,argv, int, ind)
|
||||
{
|
||||
char *ptr;
|
||||
char *dup_arg;
|
||||
|
||||
while (ind < argc) {
|
||||
dup_arg = strdup (argv[ind]);
|
||||
ptr = index (dup_arg,'=');
|
||||
if (ptr == NULL) {
|
||||
free (dup_arg);
|
||||
return;
|
||||
}
|
||||
*ptr = 0;
|
||||
ptr++;
|
||||
add_one_file (dup_arg, ptr);
|
||||
free (dup_arg);
|
||||
ind++;
|
||||
}
|
||||
}
|
||||
void
|
||||
FDECL1(add_file, char *, filename)
|
||||
{
|
||||
char buff[1024];
|
||||
FILE *f;
|
||||
char *ptr;
|
||||
char *p2;
|
||||
int count=0;
|
||||
|
||||
if (strcmp (filename, "-") == 0) {
|
||||
f = stdin;
|
||||
} else {
|
||||
f = fopen (filename, "r");
|
||||
if (f == NULL) {
|
||||
perror ("fopen");
|
||||
exit (1);
|
||||
}
|
||||
}
|
||||
while (fgets (buff, 1024, f)) {
|
||||
count++;
|
||||
ptr = buff;
|
||||
while (isspace (*ptr)) ptr++;
|
||||
if (*ptr==0) continue;
|
||||
if (*ptr=='#') continue;
|
||||
|
||||
if (ptr[strlen(ptr)-1]== '\n') ptr[strlen(ptr)-1]=0;
|
||||
p2 = index (ptr, '=');
|
||||
if (p2 == NULL) {
|
||||
fprintf (stderr, "Error in line %d: %s\n", count, buff);
|
||||
exit (1);
|
||||
}
|
||||
*p2 = 0;
|
||||
p2++;
|
||||
add_one_file (ptr, p2);
|
||||
}
|
||||
if (f != stdin) fclose (f);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
int FDECL2(main, int, argc, char **, argv){
|
||||
char * outfile;
|
||||
struct directory_entry de;
|
||||
|
|
@ -374,6 +531,9 @@ int FDECL2(main, int, argc, char **, argv){
|
|||
struct stat statbuf;
|
||||
char * scan_tree;
|
||||
int c;
|
||||
#ifdef ADD_FILES
|
||||
char *add_file_file = NULL;
|
||||
#endif
|
||||
|
||||
if (argc < 2)
|
||||
usage();
|
||||
|
|
@ -382,7 +542,7 @@ int FDECL2(main, int, argc, char **, argv){
|
|||
read_rcfile(argv[0]);
|
||||
|
||||
outfile = NULL;
|
||||
while ((c = getopt(argc, argv, "o:V:RfvaTp:P:x:dDlNzA:")) != EOF)
|
||||
while ((c = getopt(argc, argv, "i:o:V:RfvaTp:P:x:dDlLNzA:")) != EOF)
|
||||
switch (c)
|
||||
{
|
||||
case 'p':
|
||||
|
|
@ -415,6 +575,9 @@ int FDECL2(main, int, argc, char **, argv){
|
|||
case 'l':
|
||||
full_iso9660_filenames++;
|
||||
break;
|
||||
case 'L':
|
||||
allow_leading_dots++;
|
||||
break;
|
||||
case 'N':
|
||||
omit_version_number++;
|
||||
break;
|
||||
|
|
@ -450,6 +613,11 @@ int FDECL2(main, int, argc, char **, argv){
|
|||
case 'x':
|
||||
exclude(optarg);
|
||||
break;
|
||||
case 'i':
|
||||
#ifdef ADD_FILES
|
||||
add_file_file = optarg;
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
usage();
|
||||
exit(1);
|
||||
|
|
@ -478,6 +646,13 @@ int FDECL2(main, int, argc, char **, argv){
|
|||
|
||||
scan_tree = argv[optind];
|
||||
|
||||
#ifdef ADD_FILES
|
||||
if (add_file_file) {
|
||||
add_file(add_file_file);
|
||||
}
|
||||
add_file_list (argc, argv, optind+1);
|
||||
#endif
|
||||
|
||||
if(!scan_tree){
|
||||
usage();
|
||||
exit(1);
|
||||
|
|
@ -499,7 +674,7 @@ int FDECL2(main, int, argc, char **, argv){
|
|||
#else
|
||||
extension_record = generate_rr_extension_record("IEEE_P1282",
|
||||
"THE IEEE P1282 PROTOCOL PROVIDES SUPPORT FOR POSIX FILE SYSTEM SEMANTICS",
|
||||
"PLEASE CONTACT THE IEEE STANDARDS DEPARTMENT,PISCATAWAY, NJ, USA FOR THE P1282 SPECIFICATION.", &extension_record_size);
|
||||
"PLEASE CONTACT THE IEEE STANDARDS DEPARTMENT, PISCATAWAY, NJ, USA FOR THE P1282 SPECIFICATION.", &extension_record_size);
|
||||
#endif
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -19,6 +19,8 @@
|
|||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||
|
||||
/* ADD_FILES changes made by Ross Biro biro@yggdrasil.com 2/23/95 */
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
/* This symbol is used to indicate that we do not have things like
|
||||
|
|
@ -100,6 +102,7 @@ struct directory_entry{
|
|||
unsigned int priority;
|
||||
char * name;
|
||||
char * table;
|
||||
char * whole_name;
|
||||
struct directory * filedir;
|
||||
struct directory_entry * parent_rec;
|
||||
unsigned int flags;
|
||||
|
|
@ -141,6 +144,23 @@ struct deferred{
|
|||
unsigned int flags;
|
||||
};
|
||||
|
||||
#ifdef ADD_FILES
|
||||
struct file_adds {
|
||||
char *name;
|
||||
struct file_adds *child;
|
||||
struct file_adds *next;
|
||||
int add_count;
|
||||
int used;
|
||||
struct dirent de;
|
||||
struct {
|
||||
char *path;
|
||||
char *name;
|
||||
} *adds;
|
||||
};
|
||||
extern struct file_adds *root_file_adds;
|
||||
|
||||
#endif
|
||||
|
||||
extern void DECL(sort_n_finish,(struct directory *));
|
||||
extern int goof;
|
||||
extern struct directory * root;
|
||||
|
|
|
|||
|
|
@ -279,7 +279,7 @@ int deep_opt;
|
|||
nchar -= 1;
|
||||
} else if(cpnt[0] == 0){
|
||||
if(MAYBE_ADD_CE_ENTRY(2)) add_CE_entry();
|
||||
Rock[ipnt++] = SL_ROOT;
|
||||
Rock[ipnt++] = (cpnt == &symlink_buff[0] ? SL_ROOT : 0);
|
||||
Rock[ipnt++] = 0; /* length is zero */
|
||||
lenval += 2;
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -20,16 +20,22 @@
|
|||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||
|
||||
/* ADD_FILES changes made by Ross Biro biro@yggdrasil.com 2/23/95 */
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <time.h>
|
||||
#include <errno.h>
|
||||
|
||||
#ifndef VMS
|
||||
#include <unistd.h>
|
||||
#ifdef HASSYSMACROS
|
||||
#if defined(HASSYSMACROS) && !defined(HASMKDEV)
|
||||
#include <sys/sysmacros.h>
|
||||
#endif
|
||||
#include <unistd.h>
|
||||
#ifdef HASMKDEV
|
||||
#include <sys/types.h>
|
||||
#include <sys/mkdev.h>
|
||||
#endif
|
||||
#else
|
||||
#include <sys/file.h>
|
||||
#include <vms/fabdef.h>
|
||||
|
|
@ -475,6 +481,89 @@ void finish_cl_pl_entries(){
|
|||
d_entry = d_entry->next;
|
||||
};
|
||||
}
|
||||
|
||||
#ifdef ADD_FILES
|
||||
/* This function looks up additions. */
|
||||
char *
|
||||
FDECL3(look_up_addition,char **, newpath, char *,path, struct dirent **,de) {
|
||||
char *dup_path;
|
||||
char *cp;
|
||||
struct file_adds *f;
|
||||
struct file_adds *tmp;
|
||||
|
||||
f=root_file_adds;
|
||||
if (!f) return NULL;
|
||||
|
||||
/* I don't trust strtok */
|
||||
dup_path = strdup (path);
|
||||
|
||||
cp = strtok (dup_path, SPATH_SEPARATOR);
|
||||
while (cp != NULL) {
|
||||
for (tmp = f->child; tmp != NULL; tmp=tmp->next) {
|
||||
if (strcmp (tmp->name, cp) == 0) break;
|
||||
}
|
||||
if (tmp == NULL) {
|
||||
/* no match */
|
||||
free (dup_path);
|
||||
return (NULL);
|
||||
}
|
||||
f = tmp;
|
||||
cp = strtok(NULL, SPATH_SEPARATOR);
|
||||
}
|
||||
free (dup_path);
|
||||
|
||||
/* looks like we found something. */
|
||||
if (tmp->used >= tmp->add_count) return (NULL);
|
||||
|
||||
*newpath = tmp->adds[tmp->used].path;
|
||||
tmp->used++;
|
||||
*de = &(tmp->de);
|
||||
return (tmp->adds[tmp->used-1].name);
|
||||
|
||||
}
|
||||
|
||||
/* This function lets us add files from outside the standard file tree.
|
||||
It is useful if we want to duplicate a cd, but add/replace things.
|
||||
We should note that the real path will be used for exclusions. */
|
||||
|
||||
struct dirent *
|
||||
FDECL3(readdir_add_files, char **, pathp, char *,path, DIR *, dir){
|
||||
struct dirent *de;
|
||||
|
||||
char *addpath;
|
||||
char *name;
|
||||
|
||||
de = readdir (dir);
|
||||
if (de) {
|
||||
return (de);
|
||||
}
|
||||
|
||||
name=look_up_addition (&addpath, path, &de);
|
||||
|
||||
if (!name) {
|
||||
return;
|
||||
}
|
||||
|
||||
*pathp=addpath;
|
||||
|
||||
/* Now we must create the directory entry. */
|
||||
/* fortuneately only the name seems to matter. */
|
||||
/*
|
||||
de->d_ino = -1;
|
||||
de->d_off = 0;
|
||||
de->d_reclen = strlen (name);
|
||||
*/
|
||||
strncpy (de->d_name, name, NAME_MAX);
|
||||
de->d_name[NAME_MAX]=0;
|
||||
return (de);
|
||||
|
||||
}
|
||||
#else
|
||||
struct dirent *
|
||||
FDECL3(readdir_add_files, char **, pathp, char *,path, DIR *, dir){
|
||||
return (readdir (dir));
|
||||
}
|
||||
#endif
|
||||
/*
|
||||
* This function scans the directory tree, looking for files, and it makes
|
||||
* note of everything that is found. We also begin to construct the ISO9660
|
||||
|
|
@ -493,6 +582,7 @@ FDECL2(scan_directory_tree,char *, path, struct directory_entry *, de){
|
|||
char * cpnt;
|
||||
int new_reclen;
|
||||
int deep_flag;
|
||||
char *old_path;
|
||||
|
||||
current_dir = opendir(path);
|
||||
d_entry = NULL;
|
||||
|
|
@ -500,7 +590,9 @@ FDECL2(scan_directory_tree,char *, path, struct directory_entry *, de){
|
|||
/* Apparently NFS sometimes allows you to open the directory, but
|
||||
then refuses to allow you to read the contents. Allow for this */
|
||||
|
||||
if(current_dir) d_entry = readdir(current_dir);
|
||||
old_path = path;
|
||||
|
||||
if(current_dir) d_entry = readdir_add_files(&path, old_path, current_dir);
|
||||
|
||||
if(!current_dir || !d_entry) {
|
||||
fprintf(stderr,"Unable to open directory %s\n", path);
|
||||
|
|
@ -578,7 +670,7 @@ FDECL2(scan_directory_tree,char *, path, struct directory_entry *, de){
|
|||
|
||||
/* The first time through, skip this, since we already asked for
|
||||
the first entry when we opened the directory. */
|
||||
if(dflag) d_entry = readdir(current_dir);
|
||||
if(dflag) d_entry = readdir_add_files(&path, old_path, current_dir);
|
||||
dflag++;
|
||||
|
||||
if(!d_entry) break;
|
||||
|
|
@ -629,10 +721,11 @@ FDECL2(scan_directory_tree,char *, path, struct directory_entry *, de){
|
|||
|
||||
if(S_ISLNK(lstatbuf.st_mode)){
|
||||
|
||||
/* Here we decide how to handle the symbolic links. Here we
|
||||
handle the general case - if we are not following links or there is an
|
||||
error, then we must change something. If RR is in use, it is easy, we
|
||||
let RR describe the file. If not, then we punt the file. */
|
||||
/* Here we decide how to handle the symbolic links. Here
|
||||
we handle the general case - if we are not following
|
||||
links or there is an error, then we must change
|
||||
something. If RR is in use, it is easy, we let RR
|
||||
describe the file. If not, then we punt the file. */
|
||||
|
||||
if((status || !follow_links)){
|
||||
if(use_RockRidge){
|
||||
|
|
@ -652,35 +745,50 @@ FDECL2(scan_directory_tree,char *, path, struct directory_entry *, de){
|
|||
};
|
||||
}
|
||||
|
||||
/* Here we handle a different kind of case. Here we have a symlink,
|
||||
but we want to follow symlinks. If we run across a directory loop,
|
||||
then we need to pretend that we are not following symlinks for this file.
|
||||
If this is the first time we have seen this, then make this seem
|
||||
as if there was no symlink there in the first place */
|
||||
|
||||
else if(strcmp(d_entry->d_name, ".") &&
|
||||
strcmp(d_entry->d_name, "..")) {
|
||||
if(find_directory_hash(statbuf.st_dev, STAT_INODE(statbuf))){
|
||||
fprintf(stderr, "Infinite loop detected (%s)\n", whole_path);
|
||||
if(!use_RockRidge) continue;
|
||||
statbuf.st_size = 0;
|
||||
STAT_INODE(statbuf) = UNCACHED_INODE;
|
||||
statbuf.st_dev = (dev_t) UNCACHED_DEVICE;
|
||||
statbuf.st_mode = (statbuf.st_mode & ~S_IFMT) | S_IFREG;
|
||||
if( follow_links
|
||||
&& S_ISDIR(statbuf.st_mode) )
|
||||
{
|
||||
if( strcmp(d_entry->d_name, ".")
|
||||
&& strcmp(d_entry->d_name, "..") )
|
||||
{
|
||||
if(find_directory_hash(statbuf.st_dev, STAT_INODE(statbuf)))
|
||||
{
|
||||
if(!use_RockRidge)
|
||||
{
|
||||
fprintf(stderr, "Already cached directory seen (%s)\n",
|
||||
whole_path);
|
||||
continue;
|
||||
}
|
||||
statbuf.st_size = 0;
|
||||
STAT_INODE(statbuf) = UNCACHED_INODE;
|
||||
statbuf.st_dev = (dev_t) UNCACHED_DEVICE;
|
||||
statbuf.st_mode = (statbuf.st_mode & ~S_IFMT) | S_IFREG;
|
||||
} else {
|
||||
lstatbuf = statbuf;
|
||||
add_directory_hash(statbuf.st_dev, STAT_INODE(statbuf));
|
||||
};
|
||||
};
|
||||
};
|
||||
lstatbuf = statbuf;
|
||||
add_directory_hash(statbuf.st_dev, STAT_INODE(statbuf));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Add directories to the cache so that we don't waste space even
|
||||
* if we are supposed to be following symlinks.
|
||||
*/
|
||||
if( follow_links
|
||||
&& strcmp(d_entry->d_name, ".")
|
||||
&& strcmp(d_entry->d_name, "..")
|
||||
&& S_ISDIR(statbuf.st_mode) )
|
||||
{
|
||||
add_directory_hash(statbuf.st_dev, STAT_INODE(statbuf));
|
||||
}
|
||||
#ifdef VMS
|
||||
if(!S_ISDIR(lstatbuf.st_mode) && (statbuf.st_fab_rfm != FAB$C_FIX &&
|
||||
statbuf.st_fab_rfm != FAB$C_STMLF)) {
|
||||
fprintf(stderr,"Warning - file %s has an unsupported VMS record"
|
||||
" format (%d)\n",
|
||||
whole_path, statbuf.st_fab_rfm);
|
||||
};
|
||||
}
|
||||
#endif
|
||||
|
||||
if(S_ISREG(lstatbuf.st_mode) && (status = access(whole_path, R_OK))){
|
||||
|
|
@ -691,11 +799,15 @@ FDECL2(scan_directory_tree,char *, path, struct directory_entry *, de){
|
|||
|
||||
/* Add this so that we can detect directory loops with hard links.
|
||||
If we are set up to follow symlinks, then we skip this checking. */
|
||||
if(!follow_links && S_ISDIR(lstatbuf.st_mode) && strcmp(d_entry->d_name, ".") &&
|
||||
strcmp(d_entry->d_name, "..")) {
|
||||
if( !follow_links
|
||||
&& S_ISDIR(lstatbuf.st_mode)
|
||||
&& strcmp(d_entry->d_name, ".")
|
||||
&& strcmp(d_entry->d_name, "..") )
|
||||
{
|
||||
if(find_directory_hash(statbuf.st_dev, STAT_INODE(statbuf))) {
|
||||
fprintf(stderr,"Directory loop - fatal goof (%s %x %d).\n",
|
||||
whole_path, statbuf.st_dev, STAT_INODE(statbuf));
|
||||
fprintf(stderr,"Directory loop - fatal goof (%s %lx %lu).\n",
|
||||
whole_path, (unsigned long) statbuf.st_dev,
|
||||
(unsigned long) STAT_INODE(statbuf));
|
||||
exit(1);
|
||||
};
|
||||
add_directory_hash(statbuf.st_dev, STAT_INODE(statbuf));
|
||||
|
|
@ -727,6 +839,7 @@ FDECL2(scan_directory_tree,char *, path, struct directory_entry *, de){
|
|||
s_entry->table = NULL;
|
||||
|
||||
s_entry->name = strdup(d_entry->d_name);
|
||||
s_entry->whole_name = strdup (whole_path);
|
||||
|
||||
s_entry->filedir = this_dir;
|
||||
s_entry->isorec.flags[0] = 0;
|
||||
|
|
@ -810,18 +923,20 @@ FDECL2(scan_directory_tree,char *, path, struct directory_entry *, de){
|
|||
break;
|
||||
#ifndef NON_UNIXFS
|
||||
case S_IFBLK:
|
||||
sprintf(buffer,"B\t%s\t%d %d\n",
|
||||
sprintf(buffer,"B\t%s\t%lu %lu\n",
|
||||
s_entry->name,
|
||||
major(statbuf.st_rdev), minor(statbuf.st_rdev));
|
||||
(unsigned long) major(statbuf.st_rdev),
|
||||
(unsigned long) minor(statbuf.st_rdev));
|
||||
break;
|
||||
case S_IFIFO:
|
||||
sprintf(buffer,"P\t%s\n",
|
||||
s_entry->name);
|
||||
break;
|
||||
case S_IFCHR:
|
||||
sprintf(buffer,"C\t%s\t%d %d\n",
|
||||
sprintf(buffer,"C\t%s\t%lu %lu\n",
|
||||
s_entry->name,
|
||||
major(statbuf.st_rdev), minor(statbuf.st_rdev));
|
||||
(unsigned long) major(statbuf.st_rdev),
|
||||
(unsigned long) minor(statbuf.st_rdev));
|
||||
break;
|
||||
case S_IFLNK:
|
||||
readlink(whole_path, symlink_buff, sizeof(symlink_buff));
|
||||
|
|
|
|||
|
|
@ -376,11 +376,7 @@ static void FDECL1(assign_file_addresses, struct directory *, dpnt){
|
|||
dwpnt->name = NULL;
|
||||
} else {
|
||||
dwpnt->table = NULL;
|
||||
strcpy(whole_path, s_entry->filedir->whole_name);
|
||||
#ifndef VMS
|
||||
if(strlen(whole_path)) strcat(whole_path, "/");
|
||||
#endif
|
||||
strcat(whole_path, s_entry->name);
|
||||
strcpy(whole_path, s_entry->whole_name);
|
||||
dwpnt->name = strdup(whole_path);
|
||||
};
|
||||
dwpnt->next = NULL;
|
||||
|
|
@ -407,8 +403,15 @@ static void FDECL1(assign_file_addresses, struct directory *, dpnt){
|
|||
fprintf(stderr,"Reported file size is %d extents\n", s_entry->size);
|
||||
exit(1);
|
||||
};
|
||||
} else
|
||||
set_733(s_entry->isorec.extent, 0);
|
||||
} else {
|
||||
/*
|
||||
* This is for zero-length files. If we leave the extent 0,
|
||||
* then we get screwed, because many readers simply drop files
|
||||
* that have an extent of zero. Thus we leave the size 0,
|
||||
* and just assign the extent number.
|
||||
*/
|
||||
set_733(s_entry->isorec.extent, last_extent);
|
||||
}
|
||||
};
|
||||
};
|
||||
};
|
||||
|
|
|
|||
Loading…
Reference in a new issue