~ubuntu-branches/ubuntu/precise/libisoburn/precise

« back to all changes in this revision

Viewing changes to xorriso/opts_d_h.c

  • Committer: Bazaar Package Importer
  • Author(s): George Danchev
  • Date: 2011-05-26 16:21:32 UTC
  • mfrom: (9.1.12 sid)
  • Revision ID: james.westby@ubuntu.com-20110526162132-9lzoagfaggnera53
Tags: 1.0.8.pl00-4
* [MA] Improve package descriptions and README.Debian.
* [MA] Migrate to format "3.0 (quilt)" and compatibility 8.
  + debian/control: Drop build-dep on 'cdbs'. Require debhelper (>= 8).
  + debian/rules: Reformulate using 'dh'.
  + debian/libisoburn{1,-dev,-doc}.docs: New files.
  + debian/xorriso.docs: Addition of upstream documents.
* [GD] Make sure doxygen documentaton (doc package) is not built
       when dpkg-buildpackage -B is called (i.e. autobuilders).
* [GD] Move doxygen, graphviz to Build-Depends-Indep.
* [GD] Add missing copyrights for debian packaging.
* [GD] Standards-Version: 3.9.2 (no changes needed).
* [GD] More package description and README.Debian improvements;
       thanks to Tony Mancill <tmancill@debian.org>.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
 
 
2
/* xorriso - creates, loads, manipulates and burns ISO 9660 filesystem images.
 
3
 
 
4
   Copyright 2007-2011 Thomas Schmitt, <scdbackup@gmx.net>
 
5
 
 
6
   Provided under GPL version 2 or later.
 
7
 
 
8
   This file contains the implementation of options as mentioned in man page
 
9
   or info file derived from xorriso.texi.
 
10
*/
 
11
 
 
12
#ifdef HAVE_CONFIG_H
 
13
#include "../config.h"
 
14
#endif
 
15
 
 
16
#include <ctype.h>
 
17
#include <sys/types.h>
 
18
#include <unistd.h>
 
19
#include <stdlib.h>
 
20
#include <stdio.h>
 
21
#include <string.h>
 
22
#include <sys/stat.h>
 
23
#include <sys/time.h>
 
24
#include <time.h>
 
25
#include <errno.h>
 
26
 
 
27
 
 
28
#include "xorriso.h"
 
29
#include "xorriso_private.h"
 
30
#include "xorrisoburn.h"
 
31
 
 
32
 
 
33
/* Options -dev , -indev, -outdev */
 
34
/** @param flag bit0= use as indev
 
35
                bit1= use as outdev
 
36
                bit2= do not -reassure
 
37
                bit3= regard overwriteable media as blank
 
38
                bit4= if the drive is a regular disk file: truncate it to
 
39
                      the write start address
 
40
                bit5= do not print toc of aquired drive
 
41
                bit6= do not calm down drive after aquiring it
 
42
    @return <=0 error , 1 success, 2 revoked by -reassure
 
43
*/
 
44
int Xorriso_option_dev(struct XorrisO *xorriso, char *in_adr, int flag)
 
45
{
 
46
 int ret;
 
47
 char sfe[5*SfileadrL], *adr;
 
48
 
 
49
 adr= in_adr;
 
50
 if(strcmp(in_adr, "-")==0)
 
51
   adr= "stdio:/dev/fd/1";
 
52
 if(strncmp(adr, "stdio:", 6)==0) {
 
53
   if(strlen(adr)==6 || strcmp(adr, "stdio:/")==0 ||
 
54
      strcmp(adr, "stdio:.")==0 || strcmp(adr, "stdio:..")==0 ||
 
55
      strcmp(adr, "stdio:-")==0) {
 
56
     sprintf(xorriso->info_text,
 
57
             "No suitable path given by device address '%s'", adr);
 
58
     Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);
 
59
     return(0);
 
60
   }
 
61
 }
 
62
 
 
63
 if(xorriso->volset_change_pending && (flag&1)) {
 
64
   sprintf(xorriso->info_text,
 
65
           "%s: Image changes pending. -commit or -rollback first",
 
66
           (flag&2) ? "-dev" : "-indev");
 
67
   Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);
 
68
   return(0);
 
69
 }
 
70
 if((flag&1) && (xorriso->in_drive_handle != NULL || adr[0]) && !(flag&4)) {
 
71
   ret= Xorriso_reassure(xorriso, (flag&2) ? "-dev" : "-indev",
 
72
                         "eventually discard the current image", 0);
 
73
   if(ret<=0)
 
74
     return(2);
 
75
 }
 
76
 
 
77
 if(adr[0]==0) {
 
78
   if((flag&1) && xorriso->in_drive_handle != NULL) {
 
79
     if(xorriso->in_drive_handle == xorriso->out_drive_handle)
 
80
       sprintf(xorriso->info_text,"Giving up -dev %s", 
 
81
               Text_shellsafe(xorriso->indev, sfe, 0));
 
82
     else
 
83
       sprintf(xorriso->info_text,"Giving up -indev %s",
 
84
               Text_shellsafe(xorriso->indev, sfe, 0));
 
85
     Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "NOTE", 0);
 
86
   }
 
87
   if((flag&2) && xorriso->out_drive_handle != NULL &&
 
88
      xorriso->in_drive_handle != xorriso->out_drive_handle) {
 
89
     sprintf(xorriso->info_text,"Giving up -outdev %s",
 
90
             Text_shellsafe(xorriso->outdev, sfe, 0));
 
91
     Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "NOTE", 0);
 
92
   }
 
93
   ret= Xorriso_give_up_drive(xorriso, (flag&3)|((flag&32)>>2));
 
94
 } else
 
95
   ret= Xorriso_aquire_drive(xorriso, adr,
 
96
                          (flag & (3 | 32 | 64)) | (((flag & (8 | 16)) >> 1))); 
 
97
 if(ret<=0)
 
98
   return(ret);
 
99
 if(xorriso->in_drive_handle == NULL)
 
100
   xorriso->image_start_mode= 0; /* session setting is invalid by now */
 
101
 return(1);
 
102
}
 
103
 
 
104
 
 
105
/* Option -devices */
 
106
/* @return <=0 error , 1 success, 2 revoked by -reassure
 
107
*/
 
108
int Xorriso_option_devices(struct XorrisO *xorriso, int flag)
 
109
{
 
110
 int ret;
 
111
 char sfe[5*SfileadrL];
 
112
 
 
113
 if(xorriso->volset_change_pending) {
 
114
   sprintf(xorriso->info_text,
 
115
           "-devices: Image changes pending. -commit or -rollback first");
 
116
   Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);
 
117
   return(0);
 
118
 }
 
119
 ret= Xorriso_reassure(xorriso, "-devices",
 
120
                       "eventually discard the current image", 0);
 
121
 if(ret<=0)
 
122
   return(2);
 
123
 xorriso->info_text[0]= 0;
 
124
 if(xorriso->in_drive_handle!=NULL || xorriso->out_drive_handle!=NULL) {
 
125
   if(xorriso->in_drive_handle == xorriso->out_drive_handle) {
 
126
     sprintf(xorriso->info_text, "Gave up -dev %s", 
 
127
             Text_shellsafe(xorriso->indev, sfe, 0));
 
128
     Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "NOTE", 0);
 
129
   }else {
 
130
     if(xorriso->in_drive_handle!=NULL) {
 
131
       sprintf(xorriso->info_text, "Gave up -indev %s", 
 
132
               Text_shellsafe(xorriso->indev, sfe, 0));
 
133
       Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "NOTE", 0);
 
134
     }
 
135
     if(xorriso->out_drive_handle!=NULL) {
 
136
       sprintf(xorriso->info_text, "Gave up -outdev %s", 
 
137
               Text_shellsafe(xorriso->outdev, sfe, 0));
 
138
       Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "NOTE", 0);
 
139
     }
 
140
   }
 
141
   Xorriso_give_up_drive(xorriso, 3);
 
142
 }
 
143
 ret= Xorriso_show_devices(xorriso, 0);
 
144
 return(ret);
 
145
}
 
146
 
 
147
 
 
148
/* Option -dialog "on"|"single_line"|"off" */
 
149
int Xorriso_option_dialog(struct XorrisO *xorriso, char *mode, int flag)
 
150
{
 
151
 if(strcmp(mode, "on") == 0 || strcmp(mode, "multi_line") == 0)
 
152
   xorriso->dialog= 2;
 
153
 else if(strcmp(mode, "single_line") == 0)
 
154
   xorriso->dialog= 2;
 
155
 else if(strcmp(mode, "off") == 0)
 
156
   xorriso->dialog= 0;
 
157
 else {
 
158
   sprintf(xorriso->info_text, "-dialog: unknown mode '%s'", mode);
 
159
   Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "SORRY", 0);
 
160
   return(0);
 
161
 }
 
162
 return(1);
 
163
}
 
164
 
 
165
 
 
166
/* Option -disk_dev_ino "on"|"ino_only"|"off" */
 
167
int Xorriso_option_disk_dev_ino(struct XorrisO *xorriso, char *mode, int flag)
 
168
{
 
169
 if(strcmp(mode, "on") == 0)
 
170
   xorriso->do_aaip= (xorriso->do_aaip & ~128) | 16 | 32 | 64;
 
171
 else if(strcmp(mode, "ino_only") == 0)
 
172
   xorriso->do_aaip|= 16 | 32 | 64 | 128;
 
173
 else if(strcmp(mode, "off") == 0)
 
174
   xorriso->do_aaip &= ~(16 | 32 | 64 | 128);
 
175
 else {
 
176
   sprintf(xorriso->info_text, "-disk_dev_ino: unknown mode '%s'", mode);
 
177
   Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "SORRY", 0);
 
178
   return(0);
 
179
 }
 
180
 return(1);
 
181
}
 
182
 
 
183
 
 
184
/* Option -disk_pattern "on"|"ls"|"off" */
 
185
int Xorriso_option_disk_pattern(struct XorrisO *xorriso, char *mode, int flag)
 
186
{
 
187
 if(strcmp(mode, "off")==0)
 
188
   xorriso->do_disk_pattern= 0;
 
189
 else if(strcmp(mode, "on")==0)
 
190
   xorriso->do_disk_pattern= 1;
 
191
 else if(strcmp(mode, "ls")==0)
 
192
   xorriso->do_disk_pattern= 2;
 
193
 else {
 
194
   sprintf(xorriso->info_text, "-disk_pattern: unknown mode '%s'", mode);
 
195
   Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);
 
196
   return(0);
 
197
 }
 
198
 return(1);
 
199
}
 
200
 
 
201
 
 
202
/* Option -displacement [-]offset */
 
203
int Xorriso_option_displacement(struct XorrisO *xorriso, char *value, int flag)
 
204
{
 
205
 double num;
 
206
 int displacement_sign= 1, l;
 
207
 char *cpt;
 
208
 
 
209
 cpt= value;
 
210
 if(value[0] == '-') {
 
211
   displacement_sign= -1;
 
212
   cpt++;
 
213
 } else if(value[0] == '+')
 
214
   cpt++;
 
215
 num= Scanf_io_size(cpt, 0);
 
216
 l= strlen(cpt);
 
217
 if(cpt[l - 1] < '0' || cpt[l - 1] > '9')
 
218
   num/= 2048.0;
 
219
 if(num < 0.0 || num > 4294967295.0) {
 
220
   sprintf(xorriso->info_text,
 
221
           "-displacement: too large or too small: '%s'", value);
 
222
   Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);
 
223
   return(0);
 
224
 }
 
225
 if(num == 0)
 
226
   displacement_sign= 0;
 
227
 xorriso->displacement= num;
 
228
 xorriso->displacement_sign= displacement_sign;
 
229
 return(1);
 
230
}
 
231
 
 
232
 
 
233
/* Option -drive_class */
 
234
int Xorriso_option_drive_class(struct XorrisO *xorriso,
 
235
                               char *d_class, char *pattern, int flag)
 
236
{
 
237
 int ret= 1;
 
238
 
 
239
 if(strcmp(d_class, "banned") == 0) {
 
240
   ret= Xorriso_lst_new(&(xorriso->drive_blacklist), pattern,
 
241
                          xorriso->drive_blacklist, 1);
 
242
 } else if(strcmp(d_class, "caution") == 0) {
 
243
   ret= Xorriso_lst_new(&(xorriso->drive_greylist), pattern,
 
244
                          xorriso->drive_greylist, 1);
 
245
 } else if (strcmp(d_class, "harmless") == 0) {
 
246
   ret= Xorriso_lst_new(&(xorriso->drive_whitelist), pattern,
 
247
                        xorriso->drive_whitelist, 1);
 
248
 } else if (strcmp(d_class, "clear_list") == 0) {
 
249
   if(strcmp(pattern, "banned") == 0)
 
250
     Xorriso_lst_destroy_all(&(xorriso->drive_blacklist), 0);
 
251
   else if(strcmp(pattern, "caution") == 0)
 
252
     Xorriso_lst_destroy_all(&(xorriso->drive_greylist), 0);
 
253
   else if(strcmp(pattern, "harmless") == 0)
 
254
     Xorriso_lst_destroy_all(&(xorriso->drive_whitelist), 0);
 
255
   else if(strcmp(pattern, "all") == 0) {
 
256
     Xorriso_lst_destroy_all(&(xorriso->drive_blacklist), 0);
 
257
     Xorriso_lst_destroy_all(&(xorriso->drive_greylist), 0);
 
258
     Xorriso_lst_destroy_all(&(xorriso->drive_whitelist), 0);
 
259
   } else {
 
260
     sprintf(xorriso->info_text, "-drive_class clear : unknown class '%s'",
 
261
             pattern);
 
262
     Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);
 
263
     return(0);
 
264
   }
 
265
   ret= 1;
 
266
 } else {
 
267
   sprintf(xorriso->info_text, "-drive_class: unknown class '%s'", d_class);
 
268
   Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);
 
269
   return(0);
 
270
 }
 
271
 return(ret);
 
272
}
 
273
 
 
274
 
 
275
/* Option -dummy "on"|"off" */
 
276
int Xorriso_option_dummy(struct XorrisO *xorriso, char *mode, int flag)
 
277
{
 
278
 xorriso->do_dummy= !!strcmp(mode, "off");
 
279
 return(1);
 
280
}
 
281
 
 
282
 
 
283
/* Option -dvd_obs "default"|"32k"|"64k" */
 
284
int Xorriso_option_dvd_obs(struct XorrisO *xorriso, char *obs, int flag)
 
285
{
 
286
 double num;
 
287
 
 
288
 if(strcmp(obs, "default") == 0)
 
289
   num= 0;
 
290
 else
 
291
   num = Scanf_io_size(obs,0);
 
292
 if(num != 0 && num != 32768 && num != 65536) {
 
293
   sprintf(xorriso->info_text,
 
294
           "-dvd_obs : Bad size. Acceptable are 0, 32k, 64k");
 
295
   Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "SORRY", 0);
 
296
   return(0);
 
297
 } else
 
298
   xorriso->dvd_obs= num;
 
299
 return(1);
 
300
}
 
301
 
 
302
 
 
303
/* Option -early_stdio_test */
 
304
int Xorriso_option_early_stdio_test(struct XorrisO *xorriso, char *mode,
 
305
                                    int flag)
 
306
{
 
307
 if(strcmp(mode, "on") == 0)
 
308
   xorriso->early_stdio_test= 2 | 4;
 
309
 else if(strcmp(mode, "off") == 0)
 
310
   xorriso->early_stdio_test= 0;
 
311
 else if(strcmp(mode, "appendable_wo") == 0)
 
312
   xorriso->early_stdio_test= 2 | 4 | 8;
 
313
 else {
 
314
   sprintf(xorriso->info_text, "-early_stdio_test: unknown mode '%s'", mode);
 
315
   Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "SORRY", 0);
 
316
   return(0);
 
317
 }
 
318
 return(1);
 
319
}
 
320
 
 
321
 
 
322
/* Option -eject */
 
323
/* @param flag bit0=do not report toc of eventually remaining drives
 
324
*/
 
325
int Xorriso_option_eject(struct XorrisO *xorriso, char *which, int flag)
 
326
{
 
327
 int gu_flag= 4, ret;
 
328
 
 
329
 if(strncmp(which,"in",2)==0)
 
330
   gu_flag|= 1;
 
331
 else if(strncmp(which,"out",3)==0)
 
332
   gu_flag|= 2;
 
333
 else
 
334
   gu_flag|= 3;
 
335
 if((gu_flag&1) && xorriso->volset_change_pending) {
 
336
   sprintf(xorriso->info_text,
 
337
           "-eject: Image changes pending. -commit or -rollback first");
 
338
   Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);
 
339
   return(0);
 
340
 }
 
341
 if(flag&1)
 
342
   gu_flag|= 8;
 
343
 ret= Xorriso_give_up_drive(xorriso, gu_flag);
 
344
 return(ret);
 
345
}
 
346
 
 
347
 
 
348
/* Options -end , and -rollback_end */
 
349
/* @param flag bit0= discard pending changes
 
350
               bit1= do not -reassure
 
351
   @return <=0 error , 1 success, 2 revoked by -reassure
 
352
*/
 
353
int Xorriso_option_end(struct XorrisO *xorriso, int flag)
 
354
{
 
355
 int ret;
 
356
 char *cmd, *which_will;
 
357
 
 
358
 if(flag&1)
 
359
   cmd= "-rollback_end";
 
360
 else
 
361
   cmd= "-end";
 
362
 if(xorriso->volset_change_pending) {
 
363
   if((flag & 1) || xorriso->volset_change_pending != 1)
 
364
     which_will= "end the program discarding image changes";
 
365
   else
 
366
     which_will= "commit image changes and then end the program";
 
367
 } else {
 
368
   which_will= "end the program";
 
369
 }
 
370
 if(!(flag&2)) {
 
371
   ret= Xorriso_reassure(xorriso, cmd, which_will, 0);
 
372
   if(ret<=0)
 
373
     return(2);
 
374
 }
 
375
 
 
376
 if(xorriso->volset_change_pending) {
 
377
   if((flag & 1) || xorriso->volset_change_pending != 1) {
 
378
     xorriso->volset_change_pending= 0;
 
379
   } else {
 
380
     ret= Xorriso_option_commit(xorriso, 1);
 
381
     xorriso->volset_change_pending= 0; /* no further tries to commit */
 
382
     if(ret<=0)
 
383
       return(ret);
 
384
   }
 
385
 }
 
386
 ret= Xorriso_give_up_drive(xorriso, 3);
 
387
 if(ret<=0)
 
388
   return(ret);
 
389
 return(1);
 
390
}
 
391
 
 
392
 
 
393
/* Option -errfile_log marked|plain  path|-|"" */
 
394
int Xorriso_option_errfile_log(struct XorrisO *xorriso,
 
395
                               char *mode, char *path, int flag)
 
396
{
 
397
 int ret, mode_word;
 
398
 FILE *fp= NULL;
 
399
 char sfe[5*SfileadrL];
 
400
 
 
401
 if(path[0]==0 || path[0]=='-') {
 
402
   /* ok */;
 
403
 } else {
 
404
   fp= fopen(path, "a");
 
405
   if(fp==0) {
 
406
     sprintf(xorriso->info_text, "-errfile_log: Cannot open file %s",
 
407
             Text_shellsafe(path, sfe, 0));
 
408
     Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);
 
409
     return(0);
 
410
   }
 
411
 }
 
412
 mode_word= xorriso->errfile_mode;
 
413
 if(strcmp(mode, "marked")==0)
 
414
   mode_word|= 1;
 
415
 else if(strcmp(mode, "plain")==0)
 
416
   mode_word&= ~1;
 
417
 else {
 
418
   sprintf(xorriso->info_text, "-errfile_log: Unknown mode %s",
 
419
           Text_shellsafe(mode, sfe, 0));
 
420
   Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);
 
421
   if(fp != NULL)
 
422
     fclose(fp);
 
423
   return(0);
 
424
 }
 
425
 
 
426
 Xorriso_process_errfile(xorriso, 0, "log end", 0, 1);
 
427
 if(xorriso->errfile_fp!=NULL)
 
428
   fclose(xorriso->errfile_fp);
 
429
 xorriso->errfile_fp= fp;
 
430
 xorriso->errfile_mode= mode_word;
 
431
 ret= Sfile_str(xorriso->errfile_log, path, 0);
 
432
 if(ret>0)
 
433
   ret= Xorriso_process_errfile(xorriso, 0, "log start", 0, 1);
 
434
 if(ret<=0)
 
435
   return(ret);
 
436
 return(1);
 
437
}
 
438
 
 
439
 
 
440
/* Option -error_behavior */
 
441
int Xorriso_option_error_behavior(struct XorrisO *xorriso,
 
442
                                  char *occasion, char *behavior, int flag)
 
443
{
 
444
 if(strcmp(occasion, "image_loading")==0) {
 
445
   if(strcmp(behavior, "best_effort")==0)
 
446
     xorriso->img_read_error_mode= 0;
 
447
   else if(strcmp(behavior, "failure")==0 || strcmp(behavior, "FAILURE")==0)
 
448
     xorriso->img_read_error_mode= 1;
 
449
   else if(strcmp(behavior, "fatal")==0 || strcmp(behavior, "FATAL")==0)
 
450
     xorriso->img_read_error_mode= 2;
 
451
   else {
 
452
unknown_behavior:;
 
453
     sprintf(xorriso->info_text,
 
454
             "-error_behavior: with '%s': unknown behavior '%s'",
 
455
             occasion, behavior);
 
456
     Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);
 
457
     return(0);
 
458
   }
 
459
 } else if(strcmp(occasion, "file_extraction")==0) {
 
460
   if(strcmp(behavior, "best_effort")==0)
 
461
     xorriso->extract_error_mode= 0;
 
462
   else if(strcmp(behavior, "keep")==0)
 
463
     xorriso->extract_error_mode= 1;
 
464
   else if(strcmp(behavior, "delete")==0)
 
465
     xorriso->extract_error_mode= 2;
 
466
   else
 
467
     goto unknown_behavior;
 
468
 } else {
 
469
   sprintf(xorriso->info_text, "-error_behavior: unknown occasion '%s'",
 
470
           occasion);
 
471
   Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);
 
472
   return(0);
 
473
 }
 
474
 return(1);
 
475
}
 
476
 
 
477
 
 
478
/* Option -external_filter */
 
479
int Xorriso_option_external_filter(struct XorrisO *xorriso,
 
480
                                   int argc, char **argv, int *idx, int flag)
 
481
{
 
482
 int ret, start_idx, end_idx;
 
483
 
 
484
 start_idx= *idx;
 
485
 end_idx= Xorriso_end_idx(xorriso, argc, argv, start_idx, 1);
 
486
 (*idx)= end_idx;
 
487
 if(end_idx - start_idx < 3) {
 
488
   sprintf(xorriso->info_text,
 
489
 "-external_filter : Not enough arguments given. Needed: name options path %s",
 
490
           xorriso->list_delimiter);
 
491
   Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);
 
492
   return(0);
 
493
 }
 
494
 ret= Xorriso_external_filter(xorriso, argv[start_idx],
 
495
                             argv[start_idx + 1], argv[start_idx + 2],
 
496
                             end_idx - start_idx - 3, argv + start_idx + 3, 0);
 
497
 return(ret);
 
498
}
 
499
 
 
500
 
 
501
/* Options -extract , -extract_single */
 
502
/* @param flag bit0=do not report the restored item
 
503
               bit1=do not reset pacifier, no final pacifier message
 
504
               bit2= do not make lba-sorted node array for hardlink detection
 
505
               bit5= -extract_single: eventually do not insert directory tree
 
506
*/
 
507
int Xorriso_option_extract(struct XorrisO *xorriso, char *iso_path,
 
508
                           char *disk_path, int flag)
 
509
{
 
510
 int ret, problem_count;
 
511
 char eff_origin[SfileadrL], eff_dest[SfileadrL], *ipth, *eopt[1], *edpt[1];
 
512
 
 
513
 if(xorriso->allow_restore <= 0) {
 
514
   sprintf(xorriso->info_text,
 
515
          "-extract: image-to-disk copies are not enabled by option -osirrox");
 
516
   Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);
 
517
   ret= 0; goto ex;
 
518
 }
 
519
 if(!(flag&2))
 
520
   Xorriso_pacifier_reset(xorriso, 0);
 
521
 
 
522
 ipth= iso_path;
 
523
 if(ipth[0]==0)
 
524
   ipth= disk_path;
 
525
 if(disk_path[0]==0) {
 
526
   sprintf(xorriso->info_text, "-extract: Empty disk_path given");
 
527
   Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "SORRY", 1);
 
528
   ret= 0; goto ex;
 
529
 }
 
530
 ret= Xorriso_normalize_img_path(xorriso, xorriso->wdx, disk_path, eff_dest,
 
531
                                 2|4);
 
532
 if(ret<=0)
 
533
   goto ex;
 
534
 ret= Xorriso_normalize_img_path(xorriso, xorriso->wdi, ipth, eff_origin, 2|8);
 
535
 if(ret<=0)
 
536
   goto ex;
 
537
 
 
538
 eopt[0]= eff_origin;
 
539
 edpt[0]= eff_dest;
 
540
 ret= Xorriso_restore_sorted(xorriso, 1, eopt, edpt, &problem_count,
 
541
                             (flag & 32 ? 33 : 0));
 
542
 
 
543
 if(!(flag&2))
 
544
   Xorriso_pacifier_callback(xorriso, "files restored",xorriso->pacifier_count,
 
545
                             xorriso->pacifier_total, "", 1|4);
 
546
 if(ret <= 0 || problem_count > 0)
 
547
   goto ex;
 
548
 
 
549
 if(!(flag&1)) {
 
550
   sprintf(xorriso->info_text, "Extracted from ISO image: %s '%s'='%s'\n",
 
551
           (ret>1 ? "directory" : "file"), eff_origin, eff_dest);
 
552
   Xorriso_info(xorriso,0);
 
553
 }
 
554
 ret= 1;
 
555
ex:;
 
556
 if(!(flag & (4 | 32)))
 
557
   Xorriso_destroy_node_array(xorriso, 0);
 
558
 return(ret);
 
559
}
 
560
 
 
561
 
 
562
/* Option -extract_cut */
 
563
int Xorriso_option_extract_cut(struct XorrisO *xorriso, char *iso_rr_path,
 
564
                           char *start, char *count, char *disk_path, int flag)
 
565
{
 
566
 int ret;
 
567
 double num;
 
568
 off_t startbyte, bytecount;
 
569
 
 
570
 num= Scanf_io_size(start, 0);
 
571
 if(num<0 || num > 1.0e18) { /* 10^18 = 10^3 ^ 6 < 2^10 ^ 6 = 2^60 */
 
572
   sprintf(xorriso->info_text,
 
573
           "-extract_cut: startbyte address negative or much too large (%s)",
 
574
           start);
 
575
   Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);
 
576
   return(0);
 
577
 }
 
578
 startbyte= num;
 
579
 num= Scanf_io_size(count, 0);
 
580
 if(num<=0 || num > 1.0e18) {
 
581
   sprintf(xorriso->info_text,
 
582
           "-extract_cut: bytecount zero, negative or much too large (%s)",
 
583
           count);
 
584
   Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);
 
585
   return(0);
 
586
 }
 
587
 bytecount= num;
 
588
 sprintf(xorriso->info_text, 
 
589
         "-extract_cut from %s , byte %.f to %.f, and store as %s",
 
590
         iso_rr_path, (double) startbyte, (double) (startbyte+bytecount),
 
591
         disk_path);
 
592
 Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "DEBUG", 0);
 
593
 
 
594
 ret= Xorriso_extract_cut(xorriso, iso_rr_path, disk_path,
 
595
                          startbyte, bytecount, 0); 
 
596
 return(ret);
 
597
}
 
598
 
 
599
 
 
600
/* Option -file_size_limit */
 
601
int Xorriso_option_file_size_limit(struct XorrisO *xorriso,
 
602
                                   int argc, char **argv, int *idx, int flag)
 
603
{
 
604
 int ret, i, end_idx;
 
605
 off_t new_limit= 0;
 
606
 
 
607
 end_idx= Xorriso_end_idx(xorriso, argc, argv, *idx, 1);
 
608
 if(*idx >= end_idx)
 
609
   {ret= 2; goto ex;}
 
610
 if(*idx + 1 == end_idx && strcmp(argv[*idx], "off") == 0) {
 
611
   xorriso->file_size_limit= 0;
 
612
   ret= 1; goto ex;
 
613
 }
 
614
 for(i= *idx; i < end_idx; i++)
 
615
   new_limit+= Scanf_io_size(argv[i], 0);
 
616
 if(new_limit <= 0) {
 
617
   sprintf(xorriso->info_text, "-file_size_limit: values sum up to %.f",
 
618
           (double) new_limit);
 
619
   Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 1);
 
620
   ret= 0; goto ex;
 
621
 }
 
622
 xorriso->file_size_limit= new_limit;
 
623
 ret= 1;
 
624
ex:;
 
625
 (*idx)= end_idx;
 
626
 if(ret > 0) {
 
627
   if(xorriso->file_size_limit > 0)
 
628
     sprintf(xorriso->info_text, "-file_size_limit now at %.f\n",
 
629
             (double) xorriso->file_size_limit);
 
630
   else
 
631
     sprintf(xorriso->info_text, "-file_size_limit now off\n");
 
632
   Xorriso_info(xorriso,0);
 
633
 }
 
634
 return(ret);
 
635
}
 
636
 
 
637
 
 
638
/* Option -find alias -findi, and -findx */
 
639
/* @param flag bit0= -findx rather than -findi
 
640
               bit1= do not reset pacifier, no final pacifier message
 
641
                     do not reset find_compare_result
 
642
               bit2= do not count deleted files with rm and rm_r
 
643
               bit3= use Xorriso_findi_sorted() rather than Xorriso_findi()
 
644
                     (this can also be ordered by test -sort_lba)
 
645
*/
 
646
int Xorriso_option_find(struct XorrisO *xorriso, int argc, char **argv,
 
647
                       int *idx, int flag)
 
648
{
 
649
 int ret, i, end_idx, type= 0, action, deleter= 0, start_lba, count;
 
650
 struct FindjoB *job, *first_job= NULL, *new_job;
 
651
 char *start_path, sfe[5*SfileadrL], *cpt, other_path_start[SfileadrL];
 
652
 char *access_acl_text= NULL, *default_acl_text= NULL;
 
653
 
 
654
 struct stat dir_stbuf;
 
655
 uid_t user= 0;
 
656
 gid_t group= 0;
 
657
 time_t date= 0;
 
658
 mode_t mode_or= 0, mode_and= ~1;
 
659
 double mem_lut= 0.0;
 
660
 
 
661
 end_idx= Xorriso_end_idx(xorriso, argc, argv, *idx, 1);
 
662
 start_path= ".";
 
663
 if(end_idx > *idx && start_path[0]!=0)
 
664
   start_path= argv[*idx];
 
665
 ret= Findjob_new(&first_job, start_path, 0);
 
666
 if(ret<=0) {
 
667
   Xorriso_no_findjob(xorriso, "-find[ix]", 0);
 
668
   {ret= -1; goto ex;}
 
669
 }
 
670
 job= first_job;
 
671
 if(!(flag&2))
 
672
   xorriso->find_compare_result= 1;
 
673
 for(i= *idx+1; i<end_idx; i++) {
 
674
   if(strcmp(argv[i], "-name")==0) {
 
675
     if(i+1>=end_idx) {
 
676
not_enough_arguments:;
 
677
       sprintf(xorriso->info_text,
 
678
               "-find[ix]: not enough arguments with test %s",
 
679
               Text_shellsafe(argv[i], sfe, 0));
 
680
       goto sorry_ex;
 
681
     }
 
682
     i++;
 
683
     ret= Findjob_set_name_expr(job, argv[i], 0);
 
684
     if(ret<=0) {
 
685
       sprintf(xorriso->info_text, "-find[ix]: cannot set -name expression %s",
 
686
               Text_shellsafe(argv[i], sfe, 0));
 
687
       goto sorry_ex;
 
688
     }
 
689
   } else if(strcmp(argv[i], "-wholename")==0) {
 
690
     if(i+1>=end_idx)
 
691
       goto not_enough_arguments;
 
692
     i++;
 
693
     ret= Findjob_set_name_expr(job, argv[i], 1);
 
694
     if(ret<=0) {
 
695
       sprintf(xorriso->info_text,
 
696
               "-find[ix]: cannot set -wholename expression %s",
 
697
               Text_shellsafe(argv[i], sfe, 0));
 
698
       goto sorry_ex;
 
699
     }
 
700
   } else if(strcmp(argv[i], "-type")==0) {
 
701
     if(i+1>=end_idx)
 
702
       goto not_enough_arguments;
 
703
     i++;
 
704
     ret= Findjob_set_file_type(job, argv[i][0], 0);
 
705
     if(ret<=0) {
 
706
       sprintf(xorriso->info_text, "-find[ix]: unknown -type '%c'",argv[i][0]);
 
707
       goto sorry_ex;
 
708
     }
 
709
   } else if(strcmp(argv[i], "-damaged")==0) {
 
710
     Findjob_set_damage_filter(job, 1, 0);
 
711
   } else if(strcmp(argv[i], "-undamaged")==0) {
 
712
     Findjob_set_damage_filter(job, -1, 0);
 
713
   } else if(strcmp(argv[i], "-lba_range")==0) {
 
714
     if(i+2>=end_idx)
 
715
       goto not_enough_arguments;
 
716
     i+= 2;
 
717
     sscanf(argv[i-1], "%d", &start_lba);
 
718
     sscanf(argv[i], "%d", &count);
 
719
     Findjob_set_lba_range(job, start_lba, count, 0);
 
720
   } else if(strcmp(argv[i], "-pending_data")==0) {
 
721
     Findjob_set_commit_filter_2(job, 0);
 
722
   } else if(strcmp(argv[i], "-has_acl")==0) {
 
723
     Findjob_set_acl_filter(job, 1, 0);
 
724
   } else if(strcmp(argv[i], "-has_no_acl")==0) {
 
725
     Findjob_set_acl_filter(job, -1, 0);
 
726
   } else if(strcmp(argv[i], "-has_xattr")==0) {
 
727
     Findjob_set_xattr_filter(job, 1, 0);
 
728
   } else if(strcmp(argv[i], "-has_any_xattr")==0) {
 
729
     Findjob_set_xattr_filter(job, 1, 1);
 
730
   } else if(strcmp(argv[i], "-has_no_xattr")==0) {
 
731
     Findjob_set_xattr_filter(job, -1, 0);
 
732
   } else if(strcmp(argv[i], "-has_aaip")==0) {
 
733
     Findjob_set_aaip_filter(job, 1, 0);
 
734
   } else if(strcmp(argv[i], "-has_no_aaip")==0) {
 
735
     Findjob_set_aaip_filter(job, -1, 0);
 
736
   } else if(strcmp(argv[i], "-has_filter")==0) {
 
737
     Findjob_set_filter_filter(job, 1, 0);
 
738
   } else if(strcmp(argv[i], "-has_no_filter")==0) {
 
739
     Findjob_set_filter_filter(job, -1, 0);
 
740
   } else if(strcmp(argv[i], "-has_md5")==0) {
 
741
     Findjob_set_prop_filter(job, 15, 1, 0);
 
742
   } else if(strcmp(argv[i], "-disk_name")==0) {
 
743
     if(i+1>=end_idx)
 
744
       goto not_enough_arguments;
 
745
     i++;
 
746
     ret= Findjob_set_name_expr(job, argv[i], 2);
 
747
     if(ret<=0) {
 
748
       sprintf(xorriso->info_text,
 
749
               "-find[ix]: cannot set -disk_name expression %s",
 
750
               Text_shellsafe(argv[i], sfe, 0));
 
751
       goto sorry_ex;
 
752
     }
 
753
   } else if(strcmp(argv[i], "-hidden")==0) {
 
754
     if(i + 1 >= end_idx)
 
755
       goto not_enough_arguments;
 
756
     i+= 1;
 
757
     type= Xorriso__hide_mode(argv[i], 0);
 
758
     if(type < 0) {
 
759
       sprintf(xorriso->info_text, "-findi: -hidden : unknown hide state %s",
 
760
               Text_shellsafe(argv[i], sfe, 0));
 
761
       goto sorry_ex;
 
762
     } else {
 
763
       ret= Findjob_set_test_hidden(job, type, 0);
 
764
       if(ret <= 0) {
 
765
         sprintf(xorriso->info_text, "-findi: cannot setup -hidden test");
 
766
         goto sorry_ex;
 
767
       }
 
768
     }
 
769
   } else if(strcmp(argv[i], "-true") == 0) {
 
770
     ret= Findjob_set_false(job, -1, 0);
 
771
   } else if(strcmp(argv[i], "-false") == 0) {
 
772
     ret= Findjob_set_false(job, 1, 0);
 
773
   } else if(strcmp(argv[i], "-decision") == 0) {
 
774
     if(i+1>=end_idx)
 
775
       goto not_enough_arguments;
 
776
     i++;
 
777
     ret= Findjob_set_decision(job, argv[i], 0);
 
778
   } else if(strcmp(argv[i], "-prune") == 0) {
 
779
     ret= Findjob_set_prune(job, 0);
 
780
   } else if(strcmp(argv[i], "-sub") == 0 || strcmp(argv[i], "(") == 0) {
 
781
     ret= Findjob_open_bracket(job, 0);
 
782
   } else if(strcmp(argv[i], "-subend") == 0 || strcmp(argv[i], ")") == 0) {
 
783
     ret= Findjob_close_bracket(job, 0);
 
784
   } else if(strcmp(argv[i], "-not") == 0 || strcmp(argv[i], "!") == 0) {
 
785
     ret= Findjob_not(job, 0);
 
786
   } else if(strcmp(argv[i], "-and") == 0 || strcmp(argv[i], "-a") == 0) {
 
787
     ret= Findjob_and(job, 0);
 
788
   } else if(strcmp(argv[i], "-or") == 0 || strcmp(argv[i], "-o") == 0) {
 
789
     ret= Findjob_or(job, 0);
 
790
   } else if(strcmp(argv[i], "-if") == 0) {
 
791
     ret= Findjob_if(job, 0);
 
792
   } else if(strcmp(argv[i], "-then") == 0) {
 
793
     ret= Findjob_then(job, 0);
 
794
   } else if(strcmp(argv[i], "-else") == 0) {
 
795
     ret= Findjob_else(job, 0);
 
796
   } else if(strcmp(argv[i], "-elseif") == 0) {
 
797
     ret= Findjob_elseif(job, 0);
 
798
   } else if(strcmp(argv[i], "-endif") == 0) {
 
799
     ret= Findjob_endif(job, 0);
 
800
   } else if(strcmp(argv[i], "-sort_lba") == 0) {
 
801
     flag|= 8;
 
802
     /* If an operator is open: insert a -true test, else do nothing */
 
803
     ret= Findjob_set_false(job, -1, 1);
 
804
     if(ret == 2)
 
805
       ret= 1;
 
806
   } else if(strcmp(argv[i], "-exec")==0) {
 
807
     if(i+1>=end_idx) {
 
808
not_enough_exec_arguments:;
 
809
       sprintf(xorriso->info_text,
 
810
               "-find[ix]: not enough arguments with -exec %s",
 
811
               Text_shellsafe(argv[i], sfe, 0));
 
812
       goto sorry_ex;
 
813
     }
 
814
     i++;
 
815
     cpt= argv[i];
 
816
     if(*cpt=='-')
 
817
       cpt++;
 
818
     if(strcmp(cpt, "echo")==0) {
 
819
       Findjob_set_action_target(job, 0, NULL, 0);
 
820
     } else if(strcmp(cpt, "rm")==0) {
 
821
       Findjob_set_action_target(job, 1, NULL, 0);
 
822
       deleter= 1;
 
823
     } else if(strcmp(cpt, "rm_r")==0) {
 
824
       Findjob_set_action_target(job, 2, NULL, 0);
 
825
       deleter= 1;
 
826
 
 
827
#ifdef NIX
 
828
/* >>> not implemented yet */;
 
829
     } else if(strcmp(cpt, "mv")==0) {
 
830
       if(i+1>=end_idx)
 
831
         goto not_enough_exec_arguments;
 
832
       i++;
 
833
       Findjob_set_action_target(job, 3, argv[i], 0);
 
834
#endif
 
835
 
 
836
     } else if(strcmp(cpt, "chown")==0 || strcmp(cpt, "chown_r")==0) {
 
837
       if(i+1>=end_idx)
 
838
         goto not_enough_exec_arguments;
 
839
       i++;
 
840
       ret= Xorriso_convert_uidstring(xorriso, argv[i], &user, 0);
 
841
       if(ret<=0)
 
842
         goto ex;
 
843
       ret= Findjob_set_action_chown(job, user, strlen(cpt)>5);
 
844
       if(ret<=0) {
 
845
         Xorriso_no_findjob(xorriso, "-find -exec chown_r", 0);
 
846
         goto ex;
 
847
       }
 
848
     } else if(strcmp(cpt, "chgrp")==0 || strcmp(cpt, "chgrp_r")==0) {
 
849
       if(i+1>=end_idx)
 
850
         goto not_enough_exec_arguments;
 
851
       i++;
 
852
       ret= Xorriso_convert_gidstring(xorriso, argv[i], &group, 0);
 
853
       if(ret<=0)
 
854
         goto ex;
 
855
       ret= Findjob_set_action_chgrp(job, group, strlen(cpt)>5);
 
856
       if(ret<=0) {
 
857
         Xorriso_no_findjob(xorriso, "-find -exec chgrp_r", 0);
 
858
         goto ex;
 
859
       }
 
860
     } else if(strcmp(cpt, "chmod")==0 || strcmp(cpt, "chmod_r")==0) {
 
861
       if(i+1>=end_idx)
 
862
         goto not_enough_exec_arguments;
 
863
       i++;
 
864
       ret= Xorriso_convert_modstring(xorriso, "-find -exec chmod",
 
865
                                      argv[i], &mode_and, &mode_or, 0);
 
866
       if(ret<=0)
 
867
         goto ex;
 
868
       ret= Findjob_set_action_chmod(job, mode_and, mode_or, strlen(cpt)>5);
 
869
       if(ret<=0) {
 
870
         Xorriso_no_findjob(xorriso, "-find -exec chmod_r", 0);
 
871
         goto ex;
 
872
       }
 
873
     } else if(strcmp(cpt, "alter_date")==0 || strcmp(cpt, "alter_date_r")==0){
 
874
       if(i+2>=end_idx)
 
875
         goto not_enough_exec_arguments;
 
876
       i+= 2;
 
877
       ret= Xorriso_convert_datestring(xorriso, "-find -exec alter_date",
 
878
                                       argv[i-1], argv[i], &type, &date, 0);
 
879
       if(ret<=0)
 
880
         goto ex;
 
881
       ret= Findjob_set_action_ad(job, type, date, strlen(cpt)>10);
 
882
       if(ret<=0) {
 
883
         Xorriso_no_findjob(xorriso, "-find -exec alter_date_r", 0);
 
884
         goto ex;
 
885
       }
 
886
     } else if(strcmp(cpt, "lsdl")==0) {
 
887
       Findjob_set_action_target(job, 8, NULL, 0);
 
888
 
 
889
     } else if(strcmp(cpt, "find")==0) {
 
890
       ret= Findjob_new(&new_job, "", 0);
 
891
       if(ret<=0) {
 
892
         Xorriso_no_findjob(xorriso, "-find[ix]", 0);
 
893
         {ret= -1; goto ex;}
 
894
       }
 
895
       Findjob_set_action_subjob(job, 13, new_job, 0);
 
896
       job= new_job;
 
897
 
 
898
     } else if(strcmp(cpt, "compare")==0 || strcmp(cpt, "update")==0 ||
 
899
               strcmp(cpt, "widen_hardlinks")==0 ||
 
900
               strcmp(cpt, "update_merge")==0) {
 
901
       if(i+1>=end_idx)
 
902
         goto not_enough_exec_arguments;
 
903
       i++;
 
904
       action= 14;
 
905
       if(strcmp(cpt, "update")==0)
 
906
         action= 17;
 
907
       else if(strcmp(cpt, "widen_hardlinks")==0)
 
908
         action= 32;
 
909
       else if(strcmp(cpt, "update_merge") == 0) {
 
910
         action= 41;
 
911
         /* Enter update_merge mode for node adding */
 
912
         xorriso->update_flags|= 1;
 
913
       }
 
914
 
 
915
       ret= Xorriso_make_abs_adr(xorriso, xorriso->wdx, argv[i],
 
916
                                 other_path_start, 1|2|4|8);
 
917
       if(ret<=0)
 
918
         goto ex;
 
919
       Findjob_set_action_target(job, action, other_path_start, 0);
 
920
       ret= Xorriso_make_abs_adr(xorriso, xorriso->wdi, start_path,sfe, 1|2|4);
 
921
       if(ret<=0)
 
922
         goto ex;
 
923
       Findjob_set_start_path(job, sfe, 0);
 
924
       if(!(flag&2)) {
 
925
         Xorriso_pacifier_reset(xorriso, 0);
 
926
         mem_lut= xorriso->last_update_time;
 
927
       }
 
928
     } else if(strcmp(cpt, "in_iso")==0 ||
 
929
               strcmp(cpt, "not_in_iso")==0 ||
 
930
               strcmp(cpt, "add_missing")==0 ||
 
931
               strcmp(cpt, "empty_iso_dir")==0 ||
 
932
               strcmp(cpt, "is_full_in_iso")==0) {
 
933
       if(i+1>=end_idx)
 
934
         goto not_enough_exec_arguments;
 
935
       i++;
 
936
       ret= Xorriso_make_abs_adr(xorriso, xorriso->wdi, argv[i],
 
937
                                 other_path_start, 1|2|4);
 
938
       if(ret<=0)
 
939
         goto ex;
 
940
       if(strcmp(cpt, "in_iso")==0)
 
941
         action= 15;
 
942
       else if(strcmp(cpt, "add_missing")==0)
 
943
         action= 18;
 
944
       else if(strcmp(cpt, "empty_iso_dir")==0)
 
945
         action= 19;
 
946
       else if(strcmp(cpt, "is_full_in_iso")==0)
 
947
         action= 20;
 
948
       else
 
949
         action= 16;
 
950
       Findjob_set_action_target(job, action, other_path_start, 0);
 
951
       ret= Xorriso_make_abs_adr(xorriso, xorriso->wdx, start_path, sfe,
 
952
                                 1|2|4|8);
 
953
       if(ret<=0)
 
954
         goto ex;
 
955
       Findjob_set_start_path(job, sfe, 0);
 
956
 
 
957
     } else if(strcmp(cpt, "report_damage")==0) {
 
958
       Findjob_set_action_target(job, 21, NULL, 0);
 
959
     } else if(strcmp(cpt, "report_lba")==0) {
 
960
       Findjob_set_action_target(job, 22, NULL, 0);
 
961
     } else if(strcmp(cpt, "getfacl")==0) {
 
962
       Findjob_set_action_target(job, 24, NULL, 0);
 
963
     } else if(strcmp(cpt, "setfacl")==0) {
 
964
       if(i+1>=end_idx)
 
965
         goto not_enough_exec_arguments;
 
966
       i++;
 
967
       ret= Xorriso_normalize_acl_text(xorriso, argv[i],
 
968
                                       &access_acl_text, &default_acl_text, 0);
 
969
       if(ret <= 0)
 
970
         goto ex;
 
971
       Findjob_set_action_text_2(job, 25, access_acl_text, default_acl_text,
 
972
                                 0);
 
973
     } else if(strcmp(cpt, "getfattr")==0) {
 
974
       Findjob_set_action_target(job, 26, NULL, 0);
 
975
     } else if(strcmp(cpt, "setfattr")==0) {
 
976
       if(i + 2 >= end_idx)
 
977
         goto not_enough_exec_arguments;
 
978
       i+= 2;
 
979
       /* check input */
 
980
       ret= Xorriso_path_setfattr(xorriso, NULL, "", argv[i - 1],
 
981
                                  strlen(argv[i]), argv[i], 1);
 
982
       if(ret <= 0)
 
983
         goto ex;
 
984
       Findjob_set_action_text_2(job, 27, argv[i - 1], argv[i], 0);
 
985
     } else if(strcmp(cpt, "set_filter")==0) {
 
986
       if(i + 1 >= end_idx)
 
987
         goto not_enough_exec_arguments;
 
988
       i+= 1;
 
989
       Findjob_set_action_target(job, 28, argv[i], 0);
 
990
       if(!(flag&2)) {
 
991
         Xorriso_pacifier_reset(xorriso, 0);
 
992
         mem_lut= xorriso->last_update_time;
 
993
       }
 
994
     } else if(strcmp(cpt, "show_stream")==0) {
 
995
       Findjob_set_action_target(job, 29, NULL, 0);
 
996
     } else if(strcmp(cpt, "get_any_xattr")==0) {
 
997
       Findjob_set_action_target(job, 33, NULL, 0);
 
998
     } else if(strcmp(cpt, "get_md5")==0) {
 
999
       Findjob_set_action_target(job, 34, NULL, 0);
 
1000
     } else if(strcmp(cpt, "check_md5")==0) {
 
1001
       if(i + 1 >= end_idx)
 
1002
         goto not_enough_exec_arguments;
 
1003
       i+= 1;
 
1004
       Findjob_set_action_target(job, 35, argv[i], 0);
 
1005
       flag|= 8;
 
1006
       if(!(flag&2)) {
 
1007
         Xorriso_pacifier_reset(xorriso, 0);
 
1008
         mem_lut= xorriso->last_update_time;
 
1009
       }
 
1010
       if(!(flag & 1))
 
1011
         xorriso->find_check_md5_result= 0;
 
1012
     } else if(strcmp(cpt, "make_md5")==0) {
 
1013
       Findjob_set_action_target(job, 36, NULL, 0);
 
1014
       flag|= 8;
 
1015
       if(!(flag&2)) {
 
1016
         Xorriso_pacifier_reset(xorriso, 0);
 
1017
         mem_lut= xorriso->last_update_time;
 
1018
       }
 
1019
     } else if(strcmp(cpt, "mkisofs_r")==0) {
 
1020
       Findjob_set_action_target(job, 37, NULL, 0);
 
1021
     } else if(strcmp(cpt, "sort_weight")==0) {
 
1022
       if(i + 1 >= end_idx)
 
1023
         goto not_enough_exec_arguments;
 
1024
       i+= 1;
 
1025
       sscanf(argv[i], "%d", &type);
 
1026
       Findjob_set_action_type(job, 38, type, 0);
 
1027
     } else if(strcmp(cpt, "hide")==0) {
 
1028
       if(i+1>=end_idx)
 
1029
         goto not_enough_exec_arguments;
 
1030
       i++;
 
1031
       type= Xorriso__hide_mode(argv[i], 0);
 
1032
       if(type < 0) {
 
1033
         sprintf(xorriso->info_text, "-find -exec hide: unknown hide state %s",
 
1034
                 Text_shellsafe(argv[i], sfe, 0));
 
1035
         goto sorry_ex;
 
1036
       }
 
1037
       Findjob_set_action_type(job, 39, type, 0);
 
1038
     } else if(strcmp(cpt, "estimate_size")==0) {
 
1039
       Findjob_set_action_target(job, 40, NULL, 0);
 
1040
     } else if(strcmp(cpt, "rm_merge")==0) {
 
1041
       Findjob_set_action_target(job, 42, NULL, 0);
 
1042
       xorriso->update_flags&= ~1; /* End update_merge mode for node adding */
 
1043
     } else if(strcmp(cpt, "clear_merge")==0) {
 
1044
       Findjob_set_action_target(job, 43, NULL, 0);
 
1045
       xorriso->update_flags&= ~1; /* End update_merge mode for node adding */
 
1046
     } else {
 
1047
       sprintf(xorriso->info_text, "-find -exec: unknown action %s",
 
1048
               Text_shellsafe(argv[i], sfe, 0));
 
1049
       goto sorry_ex;
 
1050
     }
 
1051
   } else {
 
1052
     sprintf(xorriso->info_text, "-find[ix]: unknown option %s",
 
1053
             Text_shellsafe(argv[i], sfe, 0));
 
1054
sorry_ex:;
 
1055
     Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);
 
1056
     {ret= 0; goto ex;}
 
1057
   }
 
1058
 }
 
1059
 if(flag&1)
 
1060
   ret= Xorriso_findx(xorriso, first_job, "", start_path, &dir_stbuf, 0, NULL,
 
1061
                      0);
 
1062
 else if(flag & 8) {
 
1063
   cpt= start_path;
 
1064
   ret= Xorriso_findi_sorted(xorriso, first_job, (off_t) 0, 1, &cpt, 0);
 
1065
 } else
 
1066
   ret= Xorriso_findi(xorriso, first_job, NULL, (off_t) 0, NULL,
 
1067
                      start_path, &dir_stbuf, 0, (flag&4)>>1);
 
1068
ex:;
 
1069
 if(deleter && !(flag&2))
 
1070
   Xorriso_pacifier_callback(xorriso, "iso_rr_paths deleted",
 
1071
                             xorriso->pacifier_count, 0, "", 1|2);
 
1072
 else if(first_job->action == 28  && !(flag&2))
 
1073
   Xorriso_pacifier_callback(xorriso, "file filters processed",
 
1074
                             xorriso->pacifier_count, 0, "", 1 | 2);
 
1075
 else if(mem_lut!=xorriso->last_update_time && mem_lut!=0.0 && !(flag&2))
 
1076
   Xorriso_pacifier_callback(xorriso, "content bytes read",
 
1077
                             xorriso->pacifier_count, 0, "", 1);
 
1078
 if(first_job->action == 35 && !(flag & 1))
 
1079
   Xorriso_report_md5_outcome(xorriso, first_job->target, 0);
 
1080
 if(first_job->action == 40) {
 
1081
   sprintf(xorriso->result_line,"Size lower   : %lus\n",
 
1082
          (unsigned long) (first_job->estim_lower_size / (off_t) 2048));
 
1083
   Xorriso_result(xorriso,0);
 
1084
   sprintf(xorriso->result_line,"Size upper   : %lus\n",
 
1085
          (unsigned long) ((first_job->estim_upper_size / (off_t) 2048) +
 
1086
                           !!(first_job->estim_upper_size % 2048)));
 
1087
   Xorriso_result(xorriso,0);
 
1088
 }
 
1089
 if(access_acl_text != NULL)
 
1090
   free(access_acl_text);
 
1091
 if(default_acl_text != NULL)
 
1092
   free(default_acl_text);
 
1093
 Findjob_destroy(&first_job, 0);
 
1094
 (*idx)= end_idx;
 
1095
 return(ret);
 
1096
}
 
1097
 
 
1098
 
 
1099
/* Option -follow */
 
1100
int Xorriso_option_follow(struct XorrisO *xorriso, char *mode, int flag)
 
1101
{
 
1102
 int was_fl, was_fm, was_fpr, was_fpt, l;
 
1103
 double num;
 
1104
 char *cpt, *npt;
 
1105
 
 
1106
 was_fpt= xorriso->do_follow_pattern;
 
1107
 was_fpr= xorriso->do_follow_param;
 
1108
 was_fl= xorriso->do_follow_links;
 
1109
 was_fm= xorriso->do_follow_mount;
 
1110
 xorriso->do_follow_pattern= 0;
 
1111
 xorriso->do_follow_param= 0;
 
1112
 xorriso->do_follow_links= 0;
 
1113
 xorriso->do_follow_mount= 0;
 
1114
 npt= cpt= mode;
 
1115
 for(cpt= mode; npt!=NULL; cpt= npt+1) {
 
1116
   npt= strchr(cpt,':');
 
1117
   if(npt==NULL)
 
1118
     l= strlen(cpt);
 
1119
   else
 
1120
     l= npt-cpt;
 
1121
   if(l==0)
 
1122
     goto unknown_mode;
 
1123
   if(strncmp(cpt, "off", l)==0) {
 
1124
     xorriso->do_follow_pattern= 0;
 
1125
     xorriso->do_follow_param= 0;
 
1126
     xorriso->do_follow_links= 0;
 
1127
     xorriso->do_follow_mount= 0;
 
1128
   } else if(strncmp(cpt, "on", l)==0) {
 
1129
     xorriso->do_follow_pattern= 1;
 
1130
     xorriso->do_follow_param= 1;
 
1131
     xorriso->do_follow_links= 1;
 
1132
     xorriso->do_follow_mount= 1;
 
1133
   } else if(strncmp(cpt, "default", l)==0) {
 
1134
     xorriso->do_follow_pattern= 1;
 
1135
     xorriso->do_follow_param= 0;
 
1136
     xorriso->do_follow_links= 0;
 
1137
     xorriso->do_follow_mount= 1;
 
1138
     xorriso->follow_link_limit= 100;
 
1139
   } else if(strncmp(cpt, "link", l)==0 || strncmp(cpt,"links", l)==0) {
 
1140
     xorriso->do_follow_links= 1;
 
1141
   } else if(strncmp(cpt, "mount", l)==0) {
 
1142
     xorriso->do_follow_mount= 1;
 
1143
   } else if(strncmp(cpt,"param", l)==0) {
 
1144
     xorriso->do_follow_param= 1;
 
1145
   } else if(strncmp(cpt, "pattern", l)==0) {
 
1146
     xorriso->do_follow_pattern= 1;
 
1147
   } else if(strncmp(cpt, "limit=", 6)==0) {
 
1148
     sscanf(cpt+6, "%lf", &num);
 
1149
     if(num<=0 || num>1.0e6) {
 
1150
       sprintf(xorriso->info_text, "-follow: Value too %s with '%s'",
 
1151
               num<=0 ? "small" : "large", cpt+6);
 
1152
       goto sorry_ex;
 
1153
     }
 
1154
     xorriso->follow_link_limit= num;
 
1155
   } else {
 
1156
unknown_mode:;
 
1157
     if(l<SfileadrL)
 
1158
       sprintf(xorriso->info_text, "-follow: unknown mode '%s'", cpt);
 
1159
     else
 
1160
       sprintf(xorriso->info_text, "-follow: oversized mode parameter (%d)",l);
 
1161
sorry_ex:
 
1162
     Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);
 
1163
     xorriso->do_follow_pattern= was_fpt;
 
1164
     xorriso->do_follow_param= was_fpr;
 
1165
     xorriso->do_follow_links= was_fl;
 
1166
     xorriso->do_follow_mount= was_fm;
 
1167
     return(0);
 
1168
   }
 
1169
 }
 
1170
 return(1);
 
1171
}
 
1172
 
 
1173
 
 
1174
/* Option -fs */
 
1175
int Xorriso_option_fs(struct XorrisO *xorriso, char *size, int flag)
 
1176
{
 
1177
 double num;
 
1178
 
 
1179
 num= Scanf_io_size(size, 0);
 
1180
 if(num < 64*1024 || num > 1024.0 * 1024.0 * 1024.0) {
 
1181
   sprintf(xorriso->info_text, "-fs: wrong size %.f (allowed: %.f - %.f)",
 
1182
           num, 64.0 * 1024.0, 1024.0 * 1024.0 * 1024.0);
 
1183
   Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "SORRY", 0);
 
1184
   return(0);
 
1185
 }
 
1186
 xorriso->fs= num / 2048.0;
 
1187
 if(xorriso->fs * 2048 < num)
 
1188
   xorriso->fs++;
 
1189
 return(1);
 
1190
}
 
1191
 
 
1192
 
 
1193
/* Optionis -getfacl alias -getfacli, -getfacl_r alias -getfacl_ri
 
1194
            -getfattr alias getfattri
 
1195
*/
 
1196
/* @param flag bit0= recursive -getfacl_r
 
1197
               bit1= getfattr rather than getfacl
 
1198
               bit3= with bit1: do not ignore eventual non-user attributes
 
1199
*/
 
1200
int Xorriso_option_getfacli(struct XorrisO *xorriso,
 
1201
                            int argc, char **argv, int *idx, int flag)
 
1202
{
 
1203
 int i, ret, was_failure= 0, end_idx, fret;
 
1204
 int optc= 0;
 
1205
 char **optv= NULL;
 
1206
 struct FindjoB *job= NULL;
 
1207
 struct stat dir_stbuf;
 
1208
 
 
1209
 ret= Xorriso_opt_args(xorriso, "-getfacl", argc, argv, *idx, &end_idx, &optc,
 
1210
                       &optv, 0);
 
1211
 if(ret<=0)
 
1212
   goto ex;
 
1213
 for(i= 0; i<optc; i++) {
 
1214
   if(flag&1) {
 
1215
     ret= Findjob_new(&job, optv[i], 0);
 
1216
     if(ret<=0) {
 
1217
       Xorriso_no_findjob(xorriso, "-getfacl_r", 0);
 
1218
       {ret= -1; goto ex;}
 
1219
     }
 
1220
     if(flag & 2) {
 
1221
       Findjob_set_action_target(job, 26, NULL, 0);
 
1222
     } else
 
1223
       Findjob_set_action_target(job, 24, NULL, 0);
 
1224
     ret= Xorriso_findi(xorriso, job, NULL, (off_t) 0,
 
1225
                        NULL, optv[i], &dir_stbuf, 0, 0);
 
1226
     Findjob_destroy(&job, 0);
 
1227
   } else {
 
1228
     if(flag & 2)
 
1229
       ret= Xorriso_getfattr(xorriso, NULL, optv[i], NULL, flag & 8);
 
1230
     else
 
1231
       ret= Xorriso_getfacl(xorriso, NULL, optv[i], NULL, 0);
 
1232
   }
 
1233
   if(ret>0 && !xorriso->request_to_abort)
 
1234
 continue; /* regular bottom of loop */
 
1235
   was_failure= 1;
 
1236
   fret= Xorriso_eval_problem_status(xorriso, ret, 1|2);
 
1237
   if(fret>=0)
 
1238
 continue;
 
1239
   ret= 0; goto ex;
 
1240
 }
 
1241
 ret= 1;
 
1242
ex:;
 
1243
 (*idx)= end_idx;
 
1244
 Xorriso_opt_args(xorriso, "-getfacl", argc, argv, *idx, &end_idx,
 
1245
                  &optc, &optv, 256);
 
1246
 Findjob_destroy(&job, 0);
 
1247
 if(ret<=0)
 
1248
   return(ret);
 
1249
 return(!was_failure);
 
1250
}
 
1251
 
 
1252
 
 
1253
/* Option -gid */
 
1254
int Xorriso_option_gid(struct XorrisO *xorriso, char *gid, int flag)
 
1255
{
 
1256
 int ret;
 
1257
 
 
1258
 xorriso->do_global_gid= 0;
 
1259
 if(gid[0]==0 || strcmp(gid,"-")==0)
 
1260
   return(1);
 
1261
 ret= Xorriso_convert_gidstring(xorriso, gid, &(xorriso->global_gid), 0);   
 
1262
 if(ret>0)
 
1263
   xorriso->do_global_gid= 1;
 
1264
 return(ret);
 
1265
}
 
1266
 
 
1267
 
 
1268
/* Option -grow_blindly */
 
1269
int Xorriso_option_grow_blindly(struct XorrisO *xorriso, char *msc2, int flag)
 
1270
{
 
1271
 double num;
 
1272
 int l;
 
1273
 
 
1274
 if(msc2[0]==0 || msc2[0]=='-' || strcmp(msc2, "off")==0) {
 
1275
   xorriso->grow_blindly_msc2= -1;
 
1276
   return(1);
 
1277
 }
 
1278
 num= Scanf_io_size(msc2, 0);
 
1279
 l= strlen(msc2);
 
1280
 if(msc2[l-1]<'0' || msc2[l-1]>'9')
 
1281
   num/= 2048.0;
 
1282
 xorriso->grow_blindly_msc2= num;
 
1283
 return(1);
 
1284
}
 
1285
 
 
1286
 
 
1287
/* Option -hardlinks "on"|"off" */
 
1288
int Xorriso_option_hardlinks(struct XorrisO *xorriso, char *mode, int flag)
 
1289
{
 
1290
 int ret;
 
1291
 char what_data[SfileadrL], *what, *what_next;
 
1292
 
 
1293
 if(Sfile_str(what_data, mode, 0)<=0) {
 
1294
   sprintf(xorriso->info_text,
 
1295
           "-hardlinks: mode string is much too long (%d)",
 
1296
           (int) strlen(mode));
 
1297
   Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);
 
1298
   return(0);
 
1299
 } 
 
1300
 for(what= what_data; what != NULL; what= what_next) {
 
1301
   what_next= strchr(what, ':');
 
1302
   if(what_next != NULL) {
 
1303
     *what_next= 0;
 
1304
     what_next++;
 
1305
   }
 
1306
   if(strcmp(what, "off") == 0) {
 
1307
     Xorriso_finish_hl_update(xorriso, 0);
 
1308
     xorriso->ino_behavior|= 1 | 2 | 4;
 
1309
     xorriso->ino_behavior&= ~8;
 
1310
   } else if(strcmp(what, "on") == 0) {
 
1311
     xorriso->ino_behavior&= ~(1 | 2 | 4 | 8);
 
1312
   } else if(strcmp(what, "without_update") == 0) {
 
1313
     Xorriso_finish_hl_update(xorriso, 0);
 
1314
     xorriso->ino_behavior&= ~(1 | 2 | 4);
 
1315
     xorriso->ino_behavior|= 8;
 
1316
   } else if(strcmp(what, "start_update") == 0) {
 
1317
     xorriso->ino_behavior&= ~(1 | 2 | 4 | 8);
 
1318
     ret= Xorriso_make_di_array(xorriso, 1);
 
1319
     if(ret <= 0)
 
1320
       return(ret);
 
1321
   } else if(strcmp(what, "end_update") == 0) {
 
1322
     Xorriso_finish_hl_update(xorriso, 0);
 
1323
   } else if(strcmp(what, "perform_update") == 0) {
 
1324
     Xorriso_finish_hl_update(xorriso, 0);
 
1325
   } else if(strcmp(what, "start_extract") == 0) {
 
1326
     xorriso->ino_behavior&= ~(1 | 2 | 4);
 
1327
     ret= Xorriso_make_hln_array(xorriso, 1);
 
1328
     if(ret <= 0)
 
1329
       return(ret);
 
1330
   } else if(strcmp(what, "end_extract") == 0) {
 
1331
     Xorriso_destroy_hln_array(xorriso, 0);
 
1332
   } else if(strcmp(what, "discard_extract") == 0) {
 
1333
     Xorriso_destroy_hln_array(xorriso, 0);
 
1334
   } else if(strcmp(what, "normal_extract") == 0) {
 
1335
     xorriso->ino_behavior&= ~16;
 
1336
   } else if(strcmp(what, "cheap_sorted_extract") == 0) {
 
1337
     xorriso->ino_behavior|= 16;
 
1338
   } else {
 
1339
     sprintf(xorriso->info_text, "-hardlinks: unknown mode '%s' in '%s'",
 
1340
             what, mode);
 
1341
     Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);
 
1342
     return(0);
 
1343
   }
 
1344
 }
 
1345
 
 
1346
 /* <<< ts B00613 : This is wrong: it enables new_rr if -hardlinks is off.
 
1347
                    Documented is that new_rr gets enabled if hardlinks are on.
 
1348
                    But it never worked that way.
 
1349
                    A compromise seems to be to disable this totally and
 
1350
                    to change man xorriso.
 
1351
                    new_rr still is not recognized by mount on Solaris.
 
1352
 
 
1353
 if(xorriso->ino_behavior & 2)
 
1354
   Xorriso_option_compliance(xorriso, "new_rr", 0);
 
1355
 */
 
1356
 
 
1357
 return(1);
 
1358
}
 
1359
 
 
1360
 
 
1361
/* Option -help and part of -prog_help */
 
1362
int Xorriso_option_help(struct XorrisO *xorriso, int flag)
 
1363
{
 
1364
 static char text[][80]={
 
1365
 
 
1366
#ifdef Xorriso_no_helP
 
1367
 
 
1368
"This binary program does not contain a help text.",
 
1369
"If available, read: man 1 xorriso",
 
1370
 
 
1371
#else
 
1372
 
 
1373
"This program creates, loads, manipulates and writes ISO 9660 filesystem",
 
1374
"images with Rock Ridge extensions. Write targets can be drives with optical",
 
1375
"media or local filesystem objects.",
 
1376
"",
 
1377
"Preparation options:",
 
1378
"Drive addresses are either /dev/... as listed with option -devices or",
 
1379
"disk files, eventually with prefix \"stdio:\" if non-CD-drive in /dev tree.",
 
1380
"E.g. /dev/sr0 , /tmp/pseudo_drive , stdio:/dev/sdc",
 
1381
"  -dev address   Set input and output drive and load eventual ISO image.",
 
1382
"                 Set the image expansion method to growing.",
 
1383
"  -indev address  Set input drive and load eventual ISO image. Use expansion",
 
1384
"                 methods modifying or blind growing.",
 
1385
"  -outdev address",
 
1386
"                 Set output drive and use modifying or blind growing.",
 
1387
"  -drive_class \"harmless\"|\"banned\"|\"risky\"|\"clear_list\" disk_pattern",
 
1388
"                 Add a drive path pattern to one of the safety lists or make",
 
1389
"                 those lists empty. Defaulty entry in \"risky\" is \"/dev\".",
 
1390
"  -grow_blindly \"off\"|predicted_nwa",
 
1391
"                 Switch between modifying and blind growing.",
 
1392
"  -load \"session\"|\"track\"|\"lba\"|\"sbsector\"|\"volid\"|\"auto\" id",
 
1393
"                 Load a particular (outdated) ISO image from a -dev or",
 
1394
"                 -indev which hosts more than one session.",
 
1395
"  -displacement [-]block_address",
 
1396
"                 When loading ISO tree or reading data files compensate a",
 
1397
"                 displacement versus the start address for which the image",
 
1398
"                 was prepared.",
 
1399
"  -rom_toc_scan \"on\"|\"force\"|\"off\"[:\"emul_on\"|\"emul_off\"]",
 
1400
"                 Enable scanning for ISO sessions on read-only drives/media",
 
1401
"                 resp. on overwriteable media with emulated TOC.",
 
1402
"  -calm_drive \"in\"|\"out\"|\"all\"|\"on\"|\"off\"",
 
1403
"                 Reduce drive noise until it gets actually used again.",
 
1404
"  -assert_volid pattern severity",
 
1405
"                 Accept input image only if its volume id matches pattern.",
 
1406
"  -charset name  Set the character set name to be used for file name",
 
1407
"                 conversion from and to media.",
 
1408
"  -in_charset name",
 
1409
"                 Like -charset but only for conversion from media.",
 
1410
"  -auto_charset \"on\"|\"off\"",
 
1411
"                 Enable writing and reading of character set name in image.",
 
1412
"  -out_charset name",
 
1413
"                 Like -charset but only for conversion to media.",
 
1414
"  -local_charset name",
 
1415
"                 Override system assumption of the local character set name.",
 
1416
"  -hardlinks mode[:mode ...]",
 
1417
"                 Enable resp. disable recording and restoring of hard links.",
 
1418
"                 Modes are \"on\", \"off\", \"perform_update\",",
 
1419
"                 \"without_update\", \"discard_extract\",",
 
1420
"                 \"cheap_sorted_extract\", \"normal_extract\"",
 
1421
"  -acl \"on\"|\"off\"",
 
1422
"                 Enable resp. disable reading and writing of ACLs.",
 
1423
"  -xattr \"on\"|\"off\"",
 
1424
"                 Enable resp. disable reading and writing of xattr.",
 
1425
"  -for_backup",
 
1426
"                 Shortcut for: -hardlinks on -acl on -xattr on -md5 on",
 
1427
"  -disk_dev_ino \"on\"|\"ino_only\"|\"off\"",
 
1428
"                 Enable resp. disable recording of disk file dev_t and ino_t",
 
1429
"                 and their use in file comparison.",
 
1430
"  -md5 \"on\"|\"all\"|\"off\"",
 
1431
"                 Enable resp. disable processing of MD5 checksums.",
 
1432
"  -scdbackup_tag list_path record_name",
 
1433
"                 Enable production of scdbackup tag with -md5 on",
 
1434
"  -ban_stdio_write",
 
1435
"                 Allow for writing only the usage of optical drives.",
 
1436
"  -early_stdio_test \"on\"|\"appendable_wo\"|\"off\"",
 
1437
"                 Classify stdio drives by effective access permissions.",
 
1438
"  -blank \"fast\"|\"all\"|\"deformat\"|\"deformat_quickest\"",
 
1439
"                 Blank media resp. invalidate ISO image on media.",
 
1440
"  -format \"as_needed\"|\"full\"|\"fast\"|\"by_index_#\"|\"by_size_#\"",
 
1441
"                 Format BD-RE, BD-R, DVD-RAM, DVD-RW, DVD+RW.",
 
1442
"  -volid volume_id",
 
1443
"                 Specifies the volume ID text. (32 chars out of [A-Z0-9_])",
 
1444
"  -volset_id name",
 
1445
"                 Specifies the volume set id. (128 chars)",
 
1446
"  -publisher name",
 
1447
"                 Specifies the publisher name. (128 chars)",
 
1448
"  -application_id name",
 
1449
"                 Specifies the application id. (128 chars)",
 
1450
"  -system_id name",
 
1451
"                 Specifies the system id for the System Area. (32 chars)",
 
1452
"  -volume_date type timestring",
 
1453
"                 Specifies volume timestamps. [\"c\",\"m\",\"x\",\"f\",\"uuid\"]", 
 
1454
"  -copyright_file name",
 
1455
"                 Specifies the name of the Copyright File. (37 chars)",
 
1456
"  -biblio_file name",
 
1457
"                 Specifies the name of the Bibliographic File. (37 chars)",
 
1458
"  -abstract_file name",
 
1459
"                 Specifies the name of the Abstract File. (37 chars)",
 
1460
"  -joliet \"on\"|\"off\"",
 
1461
"                 Generate Joliet info additional to Rock Ridge info.",
 
1462
"  -jigdo \"clear\"|\"template_path\"|\"jigdo_path\"|\"md5_path\"",
 
1463
"         |\"min_size\"|\"checksum_iso\"|\"checksum_template\"",
 
1464
"         |\"compression\"|\"exclude\"|\"demand_md5\"|\"mapping\"",
 
1465
"         |\"checksum_iso\"|\"checksum_template\"",
 
1466
"         value",
 
1467
"                 Clear Jigdo Template Extraction parameter list or add a",
 
1468
"                 parameter with its value to that list.",
 
1469
"  -compliance rule[:rule...]",
 
1470
"                 Allow more or less harmless deviations from strict standards",
 
1471
"                 compliance.",
 
1472
"  -boot_image \"any\"|\"isolinux\"|\"grub\"",
 
1473
"              |\"discard\"|\"keep\"|\"patch\"|\"dir=\"|\"bin_path=\"",
 
1474
"              |\"cat_path=\"|\"cat_hidden=on|iso_rr|joliet|off\"",
 
1475
"              |\"load_size=\"|\"system_area=\"|\"partition_table=on|off\"",
 
1476
"              |\"mips_path=\"|\"mipsel_path=\"|\"mips_discard\"",
 
1477
"              |\"sparc_label=\"|\"sparc_discard\"",
 
1478
"              |\"show_status\"",
 
1479
"                 Whether to discard or keep an exiting El Torito boot image.",
 
1480
"                 ISOLINUX can be made bootable by dir=/ or dir=/isolinux",
 
1481
"                 or dir=/boot/isolinux. Others, like GRUB, by bin_path=...",
 
1482
"                 and cat_path=...",
 
1483
"                 The boot image and its helper files need to be added to the",
 
1484
"                 ISO image by the usual commands like -map or -add.",
 
1485
"                 system_area= and partition_table= are for MBR based booting",
 
1486
"                 from USB stick. The system_area= file needs not to be added.",
 
1487
"                 mips_path= adds Big Endian MIPS boot files. mipsel_path=",
 
1488
"                 sets one Little Endian MIPS boot file. sparc_label=",
 
1489
"                 activates SUN Disk Label. All three are mutually exclusive",
 
1490
"                 and exclusive to MBR production.",
 
1491
"  -append_partition partition_number type_code disk_path",
 
1492
"                 Append a prepared filesystem image after the end of the",
 
1493
"                 ISO image. Caution: Will be overwritten by multi-session.",
 
1494
"",
 
1495
"  -uid uid       User id to be used for the whole multi-session ISO image.",
 
1496
"  -gid gid       Group id for the same purpose.",
 
1497
"",
 
1498
"  -devices       Show list of available optical drives and their addresses.",
 
1499
"",
 
1500
"  -toc           Show media specific table of content (sessions).",
 
1501
"",
 
1502
"  -mount_cmd drive entity id path",
 
1503
"                 Print to result channel a command suitable to mount the",
 
1504
"                 depicted entity (see -load) at the given directory path.",
 
1505
"  -mount_opts \"exclusive\"|\"shared\"",
 
1506
"                 Set options for -mount and -mount_cmd.",
 
1507
"  -session_string drive entity id \"linux:\"path|\"freebsd:\"path|form",
 
1508
"                 Print foreign OS command or custom line.",
 
1509
"",
 
1510
"  -list_formats  Show media specific list of format descriptors.",
 
1511
"",
 
1512
"  -list_profiles \"in\"|\"out\"|\"all\"",
 
1513
"                 Show list of media types supported by indev resp. outdev.",
 
1514
"  -print_size    Print the foreseeable consumption by next -commit.",
 
1515
"",
 
1516
"  -tell_media_space",
 
1517
"                 Print foreseeable available space on output media",
 
1518
"  -pvd_info      Print various id strings of the loaded ISO image."
 
1519
"",
 
1520
"Options with variable length path list [...] need the list delimiter text",
 
1521
"as end mark if they are followed by another option. By default this delimiter",
 
1522
"is \"--\". In dialog and with options read from files, the line end serves",
 
1523
"as such a mark. With program arguments this mark can be omitted only with",
 
1524
"the last option in the list of arguments.",
 
1525
"For brevity the list delimiter is referred as \"--\" throughout this text.",
 
1526
"",
 
1527
"  -list_delimiter text   Set the list delimiter to be used instead of \"--\"",
 
1528
"                 It has to be a single word, must not be empty, not longer",
 
1529
"                 than 80 characters, may mot contain quotation marks.",
 
1530
"",
 
1531
"Manipulation options:",
 
1532
"disk_path is a path to an object in the local filesystem tree.",
 
1533
"iso_rr_path is the Rock Ridge name of a file object in the ISO image.",
 
1534
"pathspec is either a disk_path or (if allowed) a pair: iso_rr_path=disk_path",
 
1535
"Options marked by [***] have variable argument length and perform pattern",
 
1536
"expansion if enabled by -iso_rr_pattern resp. -disk_pattern.",
 
1537
"",
 
1538
"  -pathspecs \"on\"|\"off\"  Allow or disallow pathspecs of form ",
 
1539
"                 iso_rr_path=disk_path . Only \"off\" allows eventual",
 
1540
"                 -disk_pattern expansion.",
 
1541
"  -add pathspec [...] | disk_path [***]",
 
1542
"                 Insert the given files or directory trees from",
 
1543
"                 filesystem into the ISO image. Much like mkisofs.",
 
1544
"  -add_plainly \"none\"|\"unknown\"|\"dashed\"|\"any\"",
 
1545
"                 Whether to add lonely arguments as pathspec resp. disk_path.",
 
1546
"  -path_list disk_path",
 
1547
"                 Like -add but read the pathspecs from file disk_path.",
 
1548
"  -quoted_path_list disk_path",
 
1549
"                 Like -path_list but with line rules as -dialog \"on\".",
 
1550
"",
 
1551
"  -map disk_path iso_rr_path",
 
1552
"                 Insert disk file object at the given iso_rr_path.",
 
1553
"  -map_single disk_path iso_rr_path",
 
1554
"                 Like -map but with directory do not insert its sub tree.",
 
1555
"  -map_l disk_prefix iso_rr_prefix disk_path [***]",
 
1556
"                 Performs -map with each disk_path.",
 
1557
"  -update disk_path iso_rr_path",
 
1558
"                 Compare both file objects and do what is necessary to make",
 
1559
"                 iso_rr_path a matching copy of disk_path.", 
 
1560
"  -update_r disk_path iso_rr_path",
 
1561
"                 Like -update but affecting all files below directories.",
 
1562
"  -update_l disk_prefix iso_rr_prefix disk_path [***]",
 
1563
"                 Performs -update_r with each disk_path.",
 
1564
"  -cut_out disk_path byte_offset byte_count iso_rr_path",
 
1565
"                 Map a byte interval of a regular disk file into a regular",
 
1566
"                 file in the ISO image.",
 
1567
"",
 
1568
"  -cpr disk_path [***] iso_rr_path",
 
1569
"                 Insert the given files or directory trees from filesystem",
 
1570
"                 into the ISO image, according to the rules of cp -r.",
 
1571
"",
 
1572
"  -rm iso_rr_path [***]",
 
1573
"                 Delete the given files from the ISO image.",
 
1574
"  -rm_r iso_rr_path [***]",
 
1575
"                 Delete the given directory trees from ISO image.",
 
1576
"  -mv iso_rr_path [***] iso_rr_path",
 
1577
"                 Rename the given file objects in the ISO tree to the last",
 
1578
"                 argument in the list.",
 
1579
"  -chown uid iso_rr_path [***]",
 
1580
"                 Equivalent to chown in the ISO image.",
 
1581
"  -chown_r uid iso_rr_path [***]",
 
1582
"                 Like -chown but affecting all files below directories.",
 
1583
"  -chgrp gid iso_rr_path [***]",
 
1584
"                 Equivalent to chgrp in the ISO image.",
 
1585
"  -chgrp_r gid iso_rr_path [***]",
 
1586
"                 Like -chgrp but affecting all files below directories.",
 
1587
"  -chmod mode iso_rr_path [***]",
 
1588
"                 Equivalent to chmod in the ISO image.",
 
1589
"  -chmod_r mode iso_rr_path [***]",
 
1590
"                 Like -chmod but affecting all files below directories.",
 
1591
"  -setfacl acl_text iso_rr_path [***]",
 
1592
"                 Replace the permissions and eventual ACL of the given files",
 
1593
"                 in the ISO image by the ACL which is defined by acl_text.",
 
1594
"  -setfacl_r acl_text iso_rr_path [***]",
 
1595
"                 Like -setfacl but affecting all files below directories.",
 
1596
"  -setfacl_list disk_path",
 
1597
"                 Read output of getfacl from file disk_path. Set owner,",
 
1598
"                 group and ACL of the iso_rr_path given by line \"# file:\".",
 
1599
"  -setfattr [-]name value iso_rr_path [***]",
 
1600
"                 Set xattr pair with the given name to the given value, or",
 
1601
"                 delete pair if name is prefixed with \"-\" and value is",
 
1602
"                 an empty text.",
 
1603
"  -setfattr_r [-]name value iso_rr_path [***]",
 
1604
"                 Like -setfattr but affecting all files below directories.",
 
1605
"  -setfattr_list disk_path",
 
1606
"                 Read output of getfattr from file disk_path. Replace the",
 
1607
"                 xattr of the iso_rr_path given by line \"# file:\".",
 
1608
"  -alter_date type timestring iso_rr_path [***]",
 
1609
"                 Alter the date entries of a file in the ISO image. type is",
 
1610
"                 one of \"a\", \"m\", \"b\" for:",
 
1611
"                 access time, modification time, both times.",
 
1612
"  -alter_date_r type timestring iso_rr_path [***]",
 
1613
"                 Like -alter_date but affecting all files below directories.",
 
1614
"  -hide on|iso_rr|joliet|off iso_rr_path [***]",
 
1615
"                 Keep names of files out of directory tree, but store their",
 
1616
"                 data content in the image.",
 
1617
"  -find iso_rr_path [test [op] [test ...]] [-exec action [params]]",
 
1618
"                 performs an action on files below the given directory in",
 
1619
"                 the ISO image. Tests:",
 
1620
"                   -name pattern, -wholename pattern, -disk_name pattern,",
 
1621
"                   -type b|c|d|p|f|l|s|e, -pending_data, -hidden,",
 
1622
"                   -lba_range start count, -damaged, -has_acl, -has_xattr,",
 
1623
"                   -has_aaip, -has_filter, -has_md5, -has_any_xattr,",
 
1624
"                   -prune, -decision yes|no, -true, -false",
 
1625
"                 Operators: -not, -or, -and, -sub, (, -subend, ),",
 
1626
"                   -if, -then, -elseif, -else, -endif",
 
1627
"                 Action may be one of: echo, chown, chown_r, chgrp, chgrp_r",
 
1628
"                   chmod, chmod_r, alter_date, alter_date_r, lsdl, compare,",
 
1629
"                   rm, rm_r, compare, update, report_damage, report_lba,",
 
1630
"                   getfacl, setfacl, getfattr, setfattr, get_any_xattr,",
 
1631
"                   get_md5, check_md5, make_md5, set_filter, show_stream,",
 
1632
"                   mkisofs_r, hide, find.",
 
1633
"                 params are their arguments except iso_rr_path.",
 
1634
"  -mkdir iso_rr_path [...]",
 
1635
"                 Create empty directories if they do not exist yet.",
 
1636
"  -rmdir iso_rr_path [***]",
 
1637
"                 Delete empty directories.",
 
1638
"  -clone iso_rr_path_original iso_rr_path_copy",
 
1639
"                 Create an ISO copy of an ISO file or ISO directory tree.",
 
1640
"  -cp_clone iso_rr_path_original [***] iso_rr_path_dest",
 
1641
"                 Create ISO to ISO copies according to the rules of cp -r.",
 
1642
"",
 
1643
"  --             Default list delimiter marking the end of action argument",
 
1644
"                 list. It may be changed by option -list_delimiter.",
 
1645
"",
 
1646
"  -not_paths disk_path [***]",
 
1647
"                 Add the given paths to the list of excluded absolute paths.",
 
1648
"  -not_leaf pattern",
 
1649
"                 Add the given pattern to the list of leafname exclusions.",
 
1650
"  -not_list disk_path",
 
1651
"                 Read lines from disk_path and use as -not_paths (with \"/\")",
 
1652
"                 or as -not_leaf (without \"/\").",
 
1653
"  -quoted_not_list disk_path",
 
1654
"                 Like -not_list but with line rules as -dialog \"on\".",
 
1655
"  -not_mgt \"reset\"|\"on\"|\"off\"|\"param_on\"|\"subtree_on\"|\"ignore_on\"",
 
1656
"                 Control effect of exclusion lists.",
 
1657
"  -follow \"on\"|\"pattern:param:link:mount:limit=#\"|\"default\"|\"off\"",
 
1658
"                 Follow symbolic links and mount points within disk_path.",
 
1659
"  -overwrite \"on\"|\"nondir\"|\"off\"",
 
1660
"                 Allow or disallow to overwrite existing files in ISO image.",
 
1661
"  -split_size number[\"k\"|\"m\"]",
 
1662
"                 Set the threshold for automatic splitting of regular files.",
 
1663
"  -reassure \"on\"|\"tree\"|\"off\"",
 
1664
"                 If \"on\" then ask the user for \"y\" or \"n\" with any",
 
1665
"                 file before deleting or overwriting it in the ISO image.",
 
1666
"",
 
1667
"Filter options:",
 
1668
"External filter processes may produce synthetic file content by reading the",
 
1669
"original content from stdin and writing to stdout whatever they want.",
 
1670
 
 
1671
#ifdef Xorriso_allow_external_filterS
 
1672
 
 
1673
"  -external_filter name option[:option] program_path [arguments] --",
 
1674
"                 Define an external filter. Options are: suffix=...: ",
 
1675
"                 remove_suffix:if_nonempty:if_reduction:if_block_reduction.",
 
1676
"  -unregister_filter name",
 
1677
"                 Undefine an external filter.",
 
1678
"  -close_filter_list",
 
1679
"                 Irrevocably ban -external_filter and -unregister_filter.",
 
1680
 
 
1681
#else
 
1682
 
 
1683
"Sorry: The use of external filters was not enabled at compile time.",
 
1684
"       E.g. by ./configure option --enable-external-filters",
 
1685
 
 
1686
#endif /* ! Xorriso_allow_external_filterS */
 
1687
 
 
1688
"  -set_filter name iso_rr_path [***]",
 
1689
"                 Apply a defined filter to the given data files.",
 
1690
"                 Special name \"--remove-all-filters\" revokes filtering.",
 
1691
"                 Builtin filters are --gzip , --gunzip, --zisofs .",
 
1692
"  -set_filter_r name iso_rr_path [***]",
 
1693
"                 Like -set_filter but affecting all files below directories.",
 
1694
"",
 
1695
"zisofs is a compression format which is recognized by some Linux kernels.",
 
1696
"xorriso supports it by builtin filter \"--zisofs\" which is to be applied by",
 
1697
"the user, and by \"--zisofs-decode\" which is applied automatically when",
 
1698
"compressed content is detected with a file in the ISO image.",
 
1699
"  -zisofs option[:options]",
 
1700
"                 Set global zisofs parameters:",
 
1701
"                   level=0|...|9 , block_size=32k|64k|128k , by_magic=on|off",
 
1702
"",
 
1703
"Write-to-media options:",
 
1704
"  -rollback      Discard the manipulated ISO image and reload it.",
 
1705
"",
 
1706
"  -commit        Perform the write operation and then perform -dev outdrive.",
 
1707
"                 Hint: To perform a final write operation with no new -dev",
 
1708
"                       and no new loading of image, execute option -end.",
 
1709
"  -commit_eject  \"in\"|\"out\"|\"all\"|\"none\"",
 
1710
"                 Like -commit but rather eject than load image from outdrive.",
 
1711
"                 Give up any unejected drive afterwards.",
 
1712
"  -close \"on\"|\"off\"",
 
1713
"                 If \"on\" then mark the written media as not appendable.",
 
1714
"  -padding number[\"k\"|\"m\"]|\"included\"|\"appended\"",
 
1715
"                 Append extra bytes to image stream. (Default is 300k)",
 
1716
"  -dummy \"on\"|\"off\"",
 
1717
"                 If \"on\" simulate burning. Refuse if media cannot simulate.",
 
1718
"  -speed number[\"k/s\"|\"m/s\"|\"[x]CD\"|\"[x]DVD\"|\"[x]BD\"]",
 
1719
"                 Set the burn speed. Default is 0 = maximum speed.",
 
1720
"  -stream_recording \"on\"|\"off\"",
 
1721
"                 Try to circumvent slow checkread on DVD-RAM, BD-RE, BD-R.",
 
1722
"  -dvd_obs \"default\"|\"32k\"|\"64k\"",
 
1723
"                 Set number of bytes per DVD/BD write operation.",
 
1724
"  -stdio_sync \"on\"|\"off\"|number",
 
1725
"                 Set number of bytes after which to force output to stdio",
 
1726
"                 pseudo drives. \"on\" is the same as 16m.",
 
1727
"  -fs number[\"k\"|\"m\"]",
 
1728
"                 Set the size of the fifo buffer. (Default is 4m)",
 
1729
"  -eject \"in\"|\"out\"|\"all\"",
 
1730
"                 Immediately eject the media in -indev, resp. -outdev,",
 
1731
"                 resp. both.",
 
1732
"",
 
1733
"Navigation options:",
 
1734
"",
 
1735
"  -cd iso_rr_path  Change working directory in the ISO image. iso_rr_paths",
 
1736
"                 which do not begin with '/' will be inserted beginning at",
 
1737
"                 the path given with -cd. -ls patterns will eventually",
 
1738
"                 looked up at this path.",
 
1739
"  -cdi disk_path   Same as -cd disk_path",
 
1740
"  -cdx disk_path  Change the current working directory in the local",
 
1741
"                 filesystem. disk_paths which do not begin with '/'",
 
1742
"                 will be looked up beginning at the path given with -cdx.",
 
1743
"                 -lsx patterns will eventually be looked up at this path.",
 
1744
"  -pwd           tells the current working directory in the ISO image.",
 
1745
"  -pwdi          same as -pwd.",
 
1746
"  -pwdx          tells the current working directory in the local filesystem.",
 
1747
"",
 
1748
"  -iso_rr_pattern \"on\"|\"ls\"|\"off\"",
 
1749
"                 Enable or disable pattern expansions for ISO image commands",
 
1750
"                 marked by [***]. \"ls\" restricts it to -ls and -du.",
 
1751
"  -disk_pattern \"on\"|\"ls\"|\"off\"",
 
1752
"                 Enable or disable pattern expansions for local filesystem",
 
1753
"                 commands marked by [***]. \"ls\" restricts to -ls*x and -du*x.",
 
1754
"",
 
1755
"  -ls pattern [***]  lists files of the ISO image which match one of the",
 
1756
"                 given shell parser patterns. (I.e. wildcards '*' '?').",
 
1757
"                 Directories are listed by their content.",
 
1758
"  -lsd pattern [***]   like -ls but listing directories as single items.",
 
1759
"  -lsl pattern [***]   like -ls but also telling some file attributes.",
 
1760
"  -lsdl pattern [***]  like -lsd but also telling some file attributes.",
 
1761
"",
 
1762
"  -lsx pattern [***]   lists files of the local filesystem which match one",
 
1763
"                 of the patterns. Directories are listed by their content.",
 
1764
"  -lsdx pattern [***]  like -lsx but listing directories as single items.",
 
1765
"  -lslx pattern [***]  like -lsx but also telling some file attributes.",
 
1766
"  -lsdlx pattern [***] like -lsdx but also telling some file attributes.",
 
1767
"  -getfacl pattern [***]     list eventual ACLs of the given files.",
 
1768
"  -getfacl_r pattern [***]   like -getfacl but listing whole file trees.",
 
1769
"  -getfattr pattern [***]    list eventual xattr of the given files.",
 
1770
"  -getfxattr_r pattern [***] like -getfxattr but listing whole file trees.",
 
1771
"",
 
1772
"  -du pattern [***]  recursively lists sizes of files or directories in the",
 
1773
"                 ISO image which match one of the shell parser patterns.",
 
1774
"  -dux pattern [***]  recursively lists sizes of files or directories in the",
 
1775
"                 local filesystem which match one of the shell parser",
 
1776
"                 patterns.",
 
1777
"  -dus pattern [***]  like -du but summing up subdirectories without",
 
1778
"                 listing them explicitely.",
 
1779
"  -dusx pattern [***]  like -dux but summing up subdirectories without",
 
1780
"                 listing them explicitely.",
 
1781
"",
 
1782
"  -findx disk_path [-name pattern] [-type t] [-exec action [params]]",
 
1783
"                 Like -find but operating on local filesystem. Most -exec",
 
1784
"                 actions are defaulted to action echo. Supported actions are:",
 
1785
"                  in_iso, not_in_iso, is_full_in_iso, add_missing,",
 
1786
"                  empty_iso_dir",
 
1787
"",
 
1788
"  -compare disk_path iso_rr_path",
 
1789
"                 compare attributes and in case of regular data files the",
 
1790
"                 content of filesystem object and ISO object.",
 
1791
"  -compare_r disk_path iso_rr_path",
 
1792
"                 Like -compare but affecting all files below directories.",
 
1793
"  -compare_l disk_prefix iso_rr_prefix disk_path [***]",
 
1794
"                 Performs -compare_r with each disk_path.",
 
1795
"",
 
1796
"  -show_stream iso_rr_path [***]",
 
1797
"                 Show content stream chain of data files in the ISO image.",
 
1798
"  -show_stream_r iso_rr_path [***]",
 
1799
"                 Like -show_stream but affecting all files below directories.",
 
1800
"",
 
1801
"Restore options which copy file objects from ISO image to disk filesystem:",
 
1802
"  -osirrox \"on\"|\"device_files\"|\"off\"|\"banned\"",
 
1803
"           [:\"concat_split_on\"|\"concat_split_off\"]",
 
1804
"           [:\"auto_chmod_on\"|\"auto_chmod_off\"]",
 
1805
"           [:\"sort_lba_on\"|\"sort_lba_off\"]",
 
1806
"                 By default \"off\" the inverse operation of xorriso from ISO",
 
1807
"                 image to disk filesystem is disabled. \"on\" allows xorriso",
 
1808
"                 to create, overwrite, delete files in the disk filesystem.", 
 
1809
"                 \"banned\" is irrevocably \"off\".",
 
1810
"  -extract iso_rr_path disk_path",
 
1811
"                 Copy tree under iso_rr_path onto disk address disk_path.",
 
1812
"                 This avoids the pitfalls of cp -r addressing rules.",
 
1813
"  -extract_l iso_rr_prefix disk_prefix iso_rr_path [***]",
 
1814
"                 Perform -extract with each iso_rr_path.",
 
1815
"  -extract_single iso_rr_path disk_path",
 
1816
"                 Like -extract but with directory do not restore sub tree.",
 
1817
"  -extract_cut iso_rr_path byte_offset byte_count disk_path",
 
1818
"                 Copy a byte interval from iso_rr_path to disk_path.",
 
1819
"                 This is governed in part by -check_media_defaults.",
 
1820
"  -cpx iso_rr_path [***] disk_path",
 
1821
"                 Copy leaf file objects from ISO image to disk filesystem.",
 
1822
"  -cpax iso_rr_path [***] disk_path",
 
1823
"                 Like -cpx but trying to restore timestamps and ownership.",
 
1824
"  -cp_rx iso_rr_path [***] disk_path",
 
1825
"                 Copy directory trees from ISO image to disk filesystem.",
 
1826
"  -cp_rax iso_rr_path [***] disk_path",
 
1827
"                 Like -cp_rx but trying to restore timestamps and ownership.",
 
1828
"  -paste_in iso_rr_path disk_path byte_offset byte_count",
 
1829
"                 Copy ISO file content into a byte interval of a disk file.",
 
1830
"  -mount drive entity id path",
 
1831
"                 Like -mount_cmd but actually performing that command if",
 
1832
"                 not setuid or setgid is active.",
 
1833
"",
 
1834
"Evaluation of readability:",
 
1835
"  -check_media [options] --",
 
1836
"                 Try to read data blocks from media and report about the",
 
1837
"                 outcome. Several options modify the behavior:",
 
1838
"                  use=indev|outdev , what=track|session ,",
 
1839
"                  min_lba=blockadr , max_lba=blockadr ,",
 
1840
"                  abort_file=path , time_limit=seconds , item_limit=number ,",
 
1841
"                  retry=on|off|default , data_to=filepath ,",
 
1842
"                  sector_map=filepath , map_with_volid=on|off ,",
 
1843
"                  patch_lba0=on|off|force|blockadr[:force] ,",
 
1844
"                  report=blocks|files|blocks_files event=severity ,",
 
1845
"                  bad_limit=quality , slow_limit=seconds , chunk_size=bytes",
 
1846
"  -check_media_defaults [options] --",
 
1847
"                 Preset options for runs of -check_media and -extract_cut.",
 
1848
"",
 
1849
"Compatibility emulation (argument list may be ended by list delimiter --):",
 
1850
"  -as mkisofs  [-help|-version|-o|-R|-r|-J|-V|-P|-f|-m|-exclude-list|",
 
1851
"                -no-pad|-M|-C|-graft-points|-path-list|pathspecs|-z|",
 
1852
"                -no-emul-boot|-b|-c|-boot-info-table|-boot-load-size|-G|...]",
 
1853
"              Perform some mkisofs gestures, understand pathspecs as mkisofs",
 
1854
"              does. Commit happens outside emulation at usual occasions.",
 
1855
"              For a list of options see -as mkisofs -help.",
 
1856
"  -read_mkisofsrc",
 
1857
"              Read and interpret the .mkisofsrc configuration file.",
 
1858
"  -as cdrecord [-help|-v|dev=|speed=|blank=|fs=|-eject|-atip|padsize=|-multi]",
 
1859
"               path|-",
 
1860
"              Perform some cdrecord gestures, eventually write at most one",
 
1861
"              data track to blank, appendable or overwriteable media.",
 
1862
"  -pacifier \"xorriso\"|\"cdrecord\"|\"mkisofs\"",
 
1863
"              Choose format of UPDATE pacifier during write operations.",
 
1864
"",
 
1865
"General options:",
 
1866
"  -help       Print this text",
 
1867
"  -abort_on severity   Set the threshhold for events to abort the program.",
 
1868
"              Useful severities: NEVER, ABORT, FATAL, FAILURE, SORRY, WARNING",
 
1869
"  -return_with severity exit_value   Set the threshhold for events to return",
 
1870
"              at program end the given exit_value even if not aborted.",
 
1871
"              exit_value may be 0 or 32 to 63.",
 
1872
"  -report_about severity   Set the threshhold for events to be reported.",
 
1873
"              Use -abort_on severities or: HINT, NOTE, UPDATE, DEBUG, ALL",
 
1874
"  -error_behavior \"image_loading\"|\"file_extraction\" behavior",
 
1875
"              Behavior \"best_effort\" is most endurant but may produce",
 
1876
"              results which are correct only on the first glimpse.",
 
1877
"  -dialog \"on\"|\"off\"|\"single_line\"",
 
1878
"              After all arguments are processed, enter dialog mode.",
 
1879
"              \"single_line\" does not support newline characters within",
 
1880
"              open quotation marks and no line continuation by trailing \\.",
 
1881
"  -page len width  Prompt user after len output lines (0=no prompt).",
 
1882
"              width (default 80) can adjust line number computation",
 
1883
"              to the output terminal's line width.",
 
1884
#ifdef Xorriso_with_readlinE
 
1885
"  -use_stdin  Use raw standard input even if libreadline is available",
 
1886
"  -use_readline  Use libreadline for dialog if available",
 
1887
"  -history text  Copy text into libreadline history. This command",
 
1888
"              itself is not copied to the history list.",
 
1889
#endif /* Xorriso_with_readlinE */
 
1890
"  -backslash_codes \"on\"|\"off\"|",
 
1891
"                   \"in_double_quotes\"|\"in_quotes\"|\"with_quoted_input\"",
 
1892
"                   [:\"with_program_arguments\"][:\"encode_output\"]",
 
1893
"              Disable or enable interpretation of \\a \\b \\e \\f \\n \\r \\t \\v",
 
1894
"              \\\\ \\NNN \\xNN \\cC in input or program arguments.",
 
1895
"  -pkt_output \"on\"|\"off\"  Direct output to stdout and prefix each line",
 
1896
"              by a short header which tells channel id and a mode number.",
 
1897
"              Each such output packet is finalized by a newline.",
 
1898
"              Channel ids are 'R:' for result lines, 'I:' for notes",
 
1899
"              and error messages, 'M:' for -mark texts. Bit 0 of the",
 
1900
"              mode number tells whether the newline is also part of the",
 
1901
"              packet payload. Example of a info message with newline:",
 
1902
"                I:1: enter option text :",
 
1903
"              -pkt_output:on is intended for use by frontend programs.",
 
1904
"  -logfile channel fileaddress  Copy output of a channel to the given file.",
 
1905
"              channel may be 'R','I','M' as with -pkt_output or '.'",
 
1906
"              for the consolidated -pkt_output stream.",
 
1907
"  -mark text  If text is not empty it will get put out each time an",
 
1908
"              option is completed.",
 
1909
"  -temp_mem_limit number[\"k\"|\"m\"]",
 
1910
"              Set the maximum size for pattern expansion. (Default is 16m)",
 
1911
"  -prog text  Use text as this program's name in subsequent messages",
 
1912
"  -prog_help text  Use text as this program's name and perform -help",
 
1913
"  -status mode|filter  Report the current settings of persistent options.",
 
1914
"              Modes:",
 
1915
"                 short... print only important or altered options",
 
1916
"                 long ... print options even if they have default settings",
 
1917
"                 long_history  like long plus -history: lines",
 
1918
"              Filters begin with '-' and are compared literally against the",
 
1919
"              output lines of -status long_history. A line is put out only",
 
1920
"              if its start matches the filter.",
 
1921
"  -status_history_max number  Maximum number of history lines to be reported",
 
1922
"              with -status:long_history",
 
1923
"  -options_from_file fileaddress",
 
1924
"              Reads lines from the given file and executes them as program",
 
1925
"              options.",
 
1926
"  -no_rc      Only if used as first command line argument this option",
 
1927
"              prevents reading and interpretation of startup files.",
 
1928
"  -print text",
 
1929
"              Print a text to result channel.",
 
1930
"  -print_info text",
 
1931
"              Print a text to info channel.",
 
1932
"  -print_mark text",
 
1933
"              Print a text to mark channel.",
 
1934
"  -prompt text",
 
1935
"              Wait for Enter key resp. for a line of input at stdin.",
 
1936
"  -errfile_log mode path|channel",
 
1937
"              Log disk paths of files involved in problem events.",
 
1938
"  -session_log path",
 
1939
"              Set path of a file where a log record gets appended after",
 
1940
"              each session. Form: timestamp start_lba size volume-id", 
 
1941
"  -scsi_log \"on\"|\"off\"",
 
1942
"              Enable or disable logging of SCSI commands to stderr.",
 
1943
"  # any text  Is ignored. In dialog mode the input line will be stored in",
 
1944
"              the eventual readline history, nevertheless.", 
 
1945
"  -version    Tell program and version number",
 
1946
"  -end        End program. Commit eventual pending changes.",
 
1947
"  -rollback_end",
 
1948
"              End program. Discard pending changes.",
 
1949
"",
 
1950
"",
 
1951
"Option -page causes a user prompt after the given number of result lines.",
 
1952
"Empty input resumes output until the next prompt. Other input may be:",
 
1953
"  @     suppresses paging until the current action is done",
 
1954
"  @@    suppresses further result output but continues the action",
 
1955
"  @@@   aborts the current action",
 
1956
"  other aborts the current action and executes input as new",
 
1957
"        option",
 
1958
"",
 
1959
 
 
1960
#endif /* ! Xorriso_no_helP */
 
1961
 
 
1962
"@ENDE_OF_HELPTEXT_(HOPEFULLY_UNIQUELY_SILLY_TEXT)@"
 
1963
 };
 
1964
 
 
1965
 char *tpt= NULL;
 
1966
 int i,pass;
 
1967
 
 
1968
 Xorriso_restxt(xorriso,"\n"); 
 
1969
 sprintf(xorriso->result_line,"usage: %s [settings|actions]\n",
 
1970
         xorriso->progname); 
 
1971
 Xorriso_result(xorriso,0);
 
1972
 Xorriso_restxt(xorriso,"\n"); 
 
1973
 for(pass=0;pass<1;pass++) {
 
1974
   for(i=0;1;i++) {
 
1975
     if(pass==0)
 
1976
       tpt= text[i];
 
1977
     
 
1978
     if(strcmp(tpt,"@ENDE_OF_HELPTEXT_(HOPEFULLY_UNIQUELY_SILLY_TEXT)@")==0)
 
1979
   break;
 
1980
     sprintf(xorriso->result_line,"%s\n",tpt);
 
1981
     Xorriso_result(xorriso,0);
 
1982
     if(xorriso->request_to_abort)
 
1983
       return(1);
 
1984
   }
 
1985
 }
 
1986
 Xorriso_restxt(xorriso,"\n"); 
 
1987
 return(1);
 
1988
}
 
1989
 
 
1990
 
 
1991
/* Option -hide */
 
1992
int Xorriso_option_hide(struct XorrisO *xorriso, char *hide_state,
 
1993
                        int argc, char **argv, int *idx, int flag)
 
1994
{
 
1995
 int i, ret, end_idx, optc= 0, was_failure= 0, fret, hide_mode;
 
1996
 char **optv= NULL;
 
1997
 
 
1998
 ret= Xorriso_opt_args(xorriso, "-hide", argc, argv, *idx, &end_idx, &optc,
 
1999
                       &optv, 0);
 
2000
 if(ret<=0)
 
2001
   goto ex;
 
2002
 hide_mode= Xorriso__hide_mode(hide_state, 0);
 
2003
 if(hide_mode < 0) {
 
2004
   sprintf(xorriso->info_text, "-hide : unknown hide state ");
 
2005
   Text_shellsafe(hide_state, xorriso->info_text, 1);
 
2006
   Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);
 
2007
   goto ex;
 
2008
 }
 
2009
 for(i= 0; i<optc; i++) {
 
2010
   ret= Xorriso_set_hidden(xorriso, NULL, optv[i], hide_mode, 0);
 
2011
   if(ret>0 && !xorriso->request_to_abort)
 
2012
 continue; /* regular bottom of loop */
 
2013
 
 
2014
   was_failure= 1;
 
2015
   fret= Xorriso_eval_problem_status(xorriso, ret, 1|2);
 
2016
   if(fret>=0)
 
2017
 continue;
 
2018
   ret= 0; goto ex;
 
2019
 }
 
2020
 ret= 1;
 
2021
ex:;
 
2022
 (*idx)= end_idx;
 
2023
 Xorriso_opt_args(xorriso, "-hide", argc, argv, *idx, &end_idx, &optc, &optv,
 
2024
                  256);
 
2025
 if(ret<=0)
 
2026
   return(ret);
 
2027
 return(!was_failure);
 
2028
}
 
2029
 
 
2030
 
 
2031
/* Option -history */
 
2032
int Xorriso_option_history(struct XorrisO *xorriso, char *line, int flag)
 
2033
{
 
2034
 Xorriso_dialog_input(xorriso,line,strlen(line)+1,2);
 
2035
 return(1);
 
2036
}
 
2037