New command -concat
This commit is contained in:
@ -1,7 +1,7 @@
|
||||
|
||||
/* xorriso - creates, loads, manipulates and burns ISO 9660 filesystem images.
|
||||
|
||||
Copyright 2007-2012 Thomas Schmitt, <scdbackup@gmx.net>
|
||||
Copyright 2007-2014 Thomas Schmitt, <scdbackup@gmx.net>
|
||||
|
||||
Provided under GPL version 2 or later.
|
||||
|
||||
@ -227,12 +227,30 @@ int Sfile_being_group_member(struct stat *stbuf, int flag)
|
||||
}
|
||||
|
||||
|
||||
int Sfile_get_dev_fd_no(char *filename, int flag)
|
||||
{
|
||||
int i, fd= -1;
|
||||
|
||||
if(strncmp(filename, "/dev/fd/", 8) != 0)
|
||||
return(-1);
|
||||
for(i = 8; filename[i]; i++)
|
||||
if(filename[i] < '0' || filename[i] > '9')
|
||||
break;
|
||||
if(i > 8 && filename[i] == 0)
|
||||
sscanf(filename + 8, "%d", &fd);
|
||||
if(fd < 0)
|
||||
fd = -1;
|
||||
return(fd);
|
||||
}
|
||||
|
||||
|
||||
int Sfile_type(char *filename, int flag)
|
||||
/*
|
||||
bit0= return -1 if file is missing
|
||||
bit1= return a hardlink with siblings as type 5
|
||||
bit2= evaluate eventual link target rather than the link object itself
|
||||
bit3= return a socket or a char device as types 7 or 8 rather than 0
|
||||
bit4= interpret /dev/fd/#fd# as open file descriptor fd
|
||||
*/
|
||||
/*
|
||||
return:
|
||||
@ -245,10 +263,20 @@ int Sfile_type(char *filename, int flag)
|
||||
6=block device
|
||||
7=socket (with bit3)
|
||||
8=character device (with bit3)
|
||||
| 1024 if interpreted as /dev/fd/#fd#
|
||||
| 2048 if interpreted as /dev/fd/#fd# and not fstatable
|
||||
*/
|
||||
{
|
||||
struct stat stbuf;
|
||||
if(flag&4) {
|
||||
int fd= -1, was_dev_fd= 0, ret;
|
||||
|
||||
if(flag & 16)
|
||||
fd= Sfile_get_dev_fd_no(filename, 0);
|
||||
if(fd != -1) {
|
||||
was_dev_fd= 1;
|
||||
if(fstat(fd, &stbuf) == -1)
|
||||
return(1024 | 2048);
|
||||
} else if(flag&4) {
|
||||
if(stat(filename,&stbuf)==-1) {
|
||||
if(flag&1) return(-1);
|
||||
else return(0);
|
||||
@ -262,24 +290,26 @@ int Sfile_type(char *filename, int flag)
|
||||
if(S_ISREG(stbuf.st_mode)) {
|
||||
if(flag&2)
|
||||
if(stbuf.st_nlink>1)
|
||||
return(5);
|
||||
return(1);
|
||||
{ret= 5; goto ex;}
|
||||
{ret= 1; goto ex;}
|
||||
}
|
||||
if(S_ISDIR(stbuf.st_mode))
|
||||
return(2);
|
||||
{ret= 2; goto ex;}
|
||||
if((stbuf.st_mode&S_IFMT)==S_IFLNK)
|
||||
return(3);
|
||||
{ret= 3; goto ex;}
|
||||
if(S_ISFIFO(stbuf.st_mode))
|
||||
return(4);
|
||||
{ret= 4; goto ex;}
|
||||
if(S_ISBLK(stbuf.st_mode))
|
||||
return(6);
|
||||
{ret= 6; goto ex;}
|
||||
if(flag&8)
|
||||
if((stbuf.st_mode&S_IFMT)==S_IFSOCK)
|
||||
return(7);
|
||||
{ret= 7; goto ex;}
|
||||
if(flag&8)
|
||||
if(S_ISCHR(stbuf.st_mode))
|
||||
return(8);
|
||||
return(0);
|
||||
{ret= 8; goto ex;}
|
||||
ret = 0;
|
||||
ex:;
|
||||
return(ret | (was_dev_fd << 10));
|
||||
}
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user