From fd6377e1da04ee0bc7fa0c86475d297ab61cda5b Mon Sep 17 00:00:00 2001 From: Thomas Schmitt Date: Sat, 13 Oct 2007 15:19:10 +0000 Subject: [PATCH] Implemented xorriso setter level of -fs, -gid, -uid --- test/xorriso.c | 72 ++++++++++++++++++++++++++++++++++++++-- test/xorriso.txt | 10 ++++-- test/xorriso_timestamp.h | 2 +- 3 files changed, 77 insertions(+), 7 deletions(-) diff --git a/test/xorriso.c b/test/xorriso.c index 00dc0db9..1f44d4e6 100644 --- a/test/xorriso.c +++ b/test/xorriso.c @@ -58,6 +58,8 @@ or #include #include #include +#include +#include #ifdef Xorriso_with_regeX #include @@ -1712,6 +1714,7 @@ struct XorrisO { /* the global context of askme */ int do_dummy; int do_close; int speed; /* in libburn units : 1000 bytes/second , 0 = Max, -1 = Min */ + int fs; /* fifo size in 2048 byte chunks : at most 1 GB */ /* XORRISO options */ int allow_graft_points; @@ -1823,6 +1826,7 @@ int Xorriso_new(struct XorrisO ** xorriso,char *progname, int flag) m->do_dummy= 0; m->do_close= 0; m->speed= 0; + m->fs= 4*512; /* 4 MiB */ m->allow_graft_points= 0; m->dialog= 0; m->search_mode= 0; @@ -2885,6 +2889,14 @@ int Xorriso_status(struct XorrisO *xorriso, char *filter, FILE *fp, int flag) if(!(is_default && no_defaults)) Xorriso_status_result(xorriso,filter,fp,flag&2); + is_default= (xorriso->fs==4*512); + if((xorriso->fs/512)*512==xorriso->fs) + sprintf(line,"-fs %dm\n", xorriso->fs/512); + else + sprintf(line,"-fs %dk\n", xorriso->fs*2); + if(!(is_default && no_defaults)) + Xorriso_status_result(xorriso,filter,fp,flag&2); + /* >>> BAUSTELLE */ if(xorriso->status_history_max!=Xorriso_status_history_maX || !no_defaults) { @@ -3370,7 +3382,16 @@ int Xorriso_option_findx(struct XorrisO *xorriso, char *pattern, int flag) /* Option -fs */ int Xorriso_option_fs(struct XorrisO *xorriso, char *size, int flag) { - fprintf(stderr, ">>> LIBISOBURN: -fs %s\n", size); + double num; + + num= Scanf_io_size(size, 0); + if(num < 4096 || num > 1024.0 * 1024.0 * 1024.0) { + + /* >>> wrong size */; + + return(0); + } + xorriso->fs= num / 2048.0; return(1); } @@ -3378,7 +3399,29 @@ int Xorriso_option_fs(struct XorrisO *xorriso, char *size, int flag) /* Option -gid */ int Xorriso_option_gid(struct XorrisO *xorriso, char *gid, int flag) { - fprintf(stderr, ">>> LIBISOFS : -gid %s\n", gid); + double num; + char text[80]; + struct group *grp; + + if(gid[0]==0 || strcmp(gid,"-")==0) + xorriso->do_global_gid= 0; + + sscanf(gid, "%lf", &num); + sprintf(text,"%.f",num); + if(strcmp(text,gid)==0) { + xorriso->global_gid= num; + xorriso->do_global_gid= 1; + return(1); + } + grp= getgrnam(gid); + if(grp==NULL) { + + /* >>> unknown group */; + + return(0); + } + xorriso->global_gid= grp->gr_gid; + xorriso->do_global_gid= 1; return(1); } @@ -4132,7 +4175,30 @@ int Xorriso_option_toc(struct XorrisO *xorriso, int flag) /* Option -uid */ int Xorriso_option_uid(struct XorrisO *xorriso, char *uid, int flag) { - fprintf(stderr, ">>> LIBISOFS : -uid %s\n", uid); + double num; + char text[80]; + struct passwd *pwd; + + if(uid[0]==0 || strcmp(uid,"-")==0) + xorriso->do_global_uid= 0; + + sscanf(uid, "%lf", &num); + sprintf(text,"%.f",num); + if(strcmp(text,uid)==0) { + xorriso->global_uid= num; + xorriso->do_global_uid= 1; + return(1); + } + + pwd= getpwnam(uid); + if(pwd==NULL) { + + /* >>> unknown user */; + + return(0); + } + xorriso->global_uid= pwd->pw_uid; + xorriso->do_global_uid= 1; return(1); } diff --git a/test/xorriso.txt b/test/xorriso.txt index ede90732..900186fc 100644 --- a/test/xorriso.txt +++ b/test/xorriso.txt @@ -355,10 +355,14 @@ Settings for result writing: -V volid Specifies the volume ID. (I assume libisofs can do that) --speed number[k|m] Set the burn speed. Default is maximum speed. +-speed number[k|m|c|d] Set the burn speed. Default is 0 = maximum speed. Speed can be given in media dependent numbers or as a - desired throughput per second in kiB (= 1024) or MiB - (= 1024 kiB). + desired throughput per second in MMC compliant kB (= 1000) + or MB (= 1000 kB). Media x-speed factor can be set explicity + by "c" for CD and "d" for "DVD". Example speeds: + 706k = 706kB/s = 4c = 4xCD , 5540k = 5540kB/s = 4d = 4xDVD + If there is no hint about the speed unit attached, then the + media in the outdrive will decide. Default unit is CD = 176.4k. -dummy "on"|"off" If "on" simulate burning or refuse with SORRY event if no simulation is possible. diff --git a/test/xorriso_timestamp.h b/test/xorriso_timestamp.h index 4d2bf686..82d80f12 100644 --- a/test/xorriso_timestamp.h +++ b/test/xorriso_timestamp.h @@ -1 +1 @@ -#define Xorriso_timestamP "2007.10.13.141503" +#define Xorriso_timestamP "2007.10.13.152252"