"Fossies" - the Fresh Open Source Software Archive 
Member "libisoburn-1.5.6/xorriso/opts_d_h.c" (8 Feb 2023, 107743 Bytes) of package /linux/misc/libisoburn-1.5.6.tar.gz:
As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style:
standard) with prefixed line numbers and
code folding option.
Alternatively you can here
view or
download the uninterpreted source code file.
For more information about "opts_d_h.c" see the
Fossies "Dox" file reference documentation and the latest
Fossies "Diffs" side-by-side code changes report:
1.5.4_vs_1.5.6.
1
2 /* xorriso - creates, loads, manipulates and burns ISO 9660 filesystem images.
3
4 Copyright 2007-2023 Thomas Schmitt, <scdbackup@gmx.net>
5
6 Provided under GPL version 2 or later.
7
8 This file contains the implementation of commands 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 #ifdef Xorriso_with_readlinE
33 #define Xorriso_with_line_editoR
34 #endif
35 #ifdef Xorriso_with_editlinE
36 #define Xorriso_with_line_editoR
37 #endif
38
39 /* Command -data_cache_size */
40 int Xorriso_option_data_cache_size(struct XorrisO *xorriso, char *num_tiles,
41 char *tile_blocks, int flag)
42 {
43 int ret, blocks= -1, tiles= -1, to_default= 0;
44
45 sscanf(num_tiles, "%d", &tiles);
46 sscanf(tile_blocks, "%d", &blocks);
47 if(strcmp(num_tiles, "default") == 0 || num_tiles[0] == 0)
48 to_default|= 1;
49 if(strcmp(tile_blocks, "default") == 0 || tile_blocks[0] == 0)
50 to_default|= 2;
51 ret= Xorriso_set_data_cache(xorriso, NULL, tiles, blocks, to_default);
52 if(ret > 0) {
53 xorriso->cache_num_tiles= tiles;
54 xorriso->cache_tile_blocks= blocks;
55 xorriso->cache_default= to_default;
56 }
57 return(ret);
58 }
59
60
61 /* Options -dev , -indev, -outdev */
62 /** @param flag bit0= use as indev
63 bit1= use as outdev
64 bit2= do not -reassure
65 bit3= regard overwritable media as blank
66 bit4= if the drive is a regular disk file: truncate it to
67 the write start address
68 bit5= do not print toc of acquired drive
69 bit6= do not calm down drive after acquiring it
70 @return <=0 error , 1 success, 2 revoked by -reassure
71 */
72 int Xorriso_option_dev(struct XorrisO *xorriso, char *in_adr, int flag)
73 {
74 int ret;
75 char *adr;
76
77 adr= in_adr;
78 if(strcmp(in_adr, "-")==0)
79 adr= "stdio:/dev/fd/1";
80 if(strncmp(adr, "stdio:", 6)==0) {
81 if(strlen(adr)==6 || strcmp(adr, "stdio:/")==0 ||
82 strcmp(adr, "stdio:.")==0 || strcmp(adr, "stdio:..")==0 ||
83 strcmp(adr, "stdio:-")==0) {
84 sprintf(xorriso->info_text,
85 "No suitable path given by device address '%s'", adr);
86 Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);
87 return(0);
88 }
89 }
90
91 if(Xorriso_change_is_pending(xorriso, 0) && (flag&1)) {
92 sprintf(xorriso->info_text,
93 "%s: Image changes pending. -commit or -rollback first",
94 (flag&2) ? "-dev" : "-indev");
95 Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);
96 return(0);
97 }
98 if((flag&1) && (xorriso->in_drive_handle != NULL || adr[0]) && !(flag&4)) {
99 ret= Xorriso_reassure(xorriso, (flag&2) ? "-dev" : "-indev",
100 "eventually discard the current image", 0);
101 if(ret<=0)
102 return(2);
103 }
104
105 if(adr[0]==0) {
106 if((flag&1) && xorriso->in_drive_handle != NULL) {
107 if(xorriso->in_drive_handle == xorriso->out_drive_handle)
108 sprintf(xorriso->info_text,"Giving up -dev ");
109 else
110 sprintf(xorriso->info_text,"Giving up -indev ");
111 Text_shellsafe(xorriso->indev, xorriso->info_text, 1);
112 Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "NOTE", 0);
113 }
114 if((flag&2) && xorriso->out_drive_handle != NULL &&
115 xorriso->in_drive_handle != xorriso->out_drive_handle) {
116 sprintf(xorriso->info_text,"Giving up -outdev ");
117 Text_shellsafe(xorriso->outdev, xorriso->info_text, 1);
118 Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "NOTE", 0);
119 }
120 ret= Xorriso_give_up_drive(xorriso, (flag&3)|((flag&32)>>2));
121 } else
122 ret= Xorriso_aquire_drive(xorriso, adr, NULL,
123 (flag & (3 | 32 | 64)) | (((flag & (8 | 16)) >> 1)));
124 if(ret<=0)
125 return(ret);
126 if(xorriso->in_drive_handle == NULL)
127 xorriso->image_start_mode= 0; /* session setting is invalid by now */
128 return(1);
129 }
130
131
132 /* Option -devices , -device_links */
133 /* @param flag bit0= perform -device_links rather than -devices
134 @return <=0 error , 1 success, 2 revoked by -reassure
135 */
136 int Xorriso_option_devices(struct XorrisO *xorriso, int flag)
137 {
138 int ret;
139
140 if(Xorriso_change_is_pending(xorriso, 0)) {
141 sprintf(xorriso->info_text,
142 "-devices: Image changes pending. -commit or -rollback first");
143 Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);
144 return(0);
145 }
146 ret= Xorriso_reassure(xorriso, "-devices",
147 "eventually discard the current image", 0);
148 if(ret<=0)
149 return(2);
150 xorriso->info_text[0]= 0;
151 if(xorriso->in_drive_handle!=NULL || xorriso->out_drive_handle!=NULL) {
152 if(xorriso->in_drive_handle == xorriso->out_drive_handle) {
153 sprintf(xorriso->info_text, "Gave up -dev ");
154 Text_shellsafe(xorriso->indev, xorriso->info_text, 1);
155 Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "NOTE", 0);
156 }else {
157 if(xorriso->in_drive_handle!=NULL) {
158 sprintf(xorriso->info_text, "Gave up -indev ");
159 Text_shellsafe(xorriso->indev, xorriso->info_text, 1);
160 Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "NOTE", 0);
161 }
162 if(xorriso->out_drive_handle!=NULL) {
163 sprintf(xorriso->info_text, "Gave up -outdev ");
164 Text_shellsafe(xorriso->outdev, xorriso->info_text, 1);
165 Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "NOTE", 0);
166 }
167 }
168 Xorriso_give_up_drive(xorriso, 3);
169 }
170 ret= Xorriso_show_devices(xorriso, flag & 1);
171 return(ret);
172 }
173
174
175 /* Option -dialog "on"|"single_line"|"off" */
176 int Xorriso_option_dialog(struct XorrisO *xorriso, char *mode, int flag)
177 {
178 if(strcmp(mode, "on") == 0 || strcmp(mode, "multi_line") == 0)
179 xorriso->dialog= 2;
180 else if(strcmp(mode, "single_line") == 0)
181 xorriso->dialog= 1;
182 else if(strcmp(mode, "off") == 0)
183 xorriso->dialog= 0;
184 else {
185 sprintf(xorriso->info_text, "-dialog: unknown mode '%s'", mode);
186 Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "SORRY", 0);
187 return(0);
188 }
189 return(1);
190 }
191
192
193 /* Option -disk_dev_ino "on"|"ino_only"|"off" */
194 int Xorriso_option_disk_dev_ino(struct XorrisO *xorriso, char *mode, int flag)
195 {
196 if(strcmp(mode, "on") == 0)
197 xorriso->do_aaip= (xorriso->do_aaip & ~128) | 16 | 32 | 64;
198 else if(strcmp(mode, "ino_only") == 0)
199 xorriso->do_aaip|= 16 | 32 | 64 | 128;
200 else if(strcmp(mode, "off") == 0)
201 xorriso->do_aaip &= ~(16 | 32 | 64 | 128);
202 else {
203 sprintf(xorriso->info_text, "-disk_dev_ino: unknown mode '%s'", mode);
204 Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "SORRY", 0);
205 return(0);
206 }
207 return(1);
208 }
209
210
211 /* Option -disk_pattern "on"|"ls"|"off" */
212 int Xorriso_option_disk_pattern(struct XorrisO *xorriso, char *mode, int flag)
213 {
214 if(strcmp(mode, "off")==0)
215 xorriso->do_disk_pattern= 0;
216 else if(strcmp(mode, "on")==0)
217 xorriso->do_disk_pattern= 1;
218 else if(strcmp(mode, "ls")==0)
219 xorriso->do_disk_pattern= 2;
220 else {
221 sprintf(xorriso->info_text, "-disk_pattern: unknown mode '%s'", mode);
222 Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);
223 return(0);
224 }
225 return(1);
226 }
227
228
229 /* Option -displacement [-]offset */
230 int Xorriso_option_displacement(struct XorrisO *xorriso, char *value, int flag)
231 {
232 double num;
233 int displacement_sign= 1, l;
234 char *cpt;
235
236 cpt= value;
237 if(value[0] == '-') {
238 displacement_sign= -1;
239 cpt++;
240 } else if(value[0] == '+')
241 cpt++;
242 num= Scanf_io_size(cpt, 0);
243 l= strlen(cpt);
244 if(cpt[l - 1] < '0' || cpt[l - 1] > '9')
245 num/= 2048.0;
246 if(num < 0.0 || num > 4294967295.0) {
247 sprintf(xorriso->info_text,
248 "-displacement: too large or too small: '%s'", value);
249 Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);
250 return(0);
251 }
252 if(num == 0)
253 displacement_sign= 0;
254 xorriso->displacement= num;
255 xorriso->displacement_sign= displacement_sign;
256 return(1);
257 }
258
259
260 /* Command -drive_access "exclusive"|"shared":"readonly"|"unrestricted" */
261 int Xorriso_option_drive_access(struct XorrisO *xorriso, char *mode, int flag)
262 {
263 int l;
264 char *npt, *cpt;
265
266 npt= cpt= mode;
267 for(cpt= mode; npt != NULL; cpt= npt+1) {
268 npt= strchr(cpt, ':');
269 if(npt==NULL)
270 l= strlen(cpt);
271 else
272 l= npt - cpt;
273 if(l == 0 && mode[0] != 0)
274 goto unknown_mode;
275 if(strncmp(cpt, "shared", l) == 0 && l == 6) {
276 xorriso->drives_exclusive= 0;
277 } else if(strncmp(cpt, "exclusive", l) == 0 && l == 9) {
278 xorriso->drives_exclusive= 1;
279 } else if(strncmp(cpt, "readonly", l) == 0 && l == 8) {
280 xorriso->drives_access= 0;
281 } else if(strncmp(cpt, "unrestricted", l) == 0 && l == 12) {
282 xorriso->drives_access= 1;
283 } else {
284 unknown_mode:;
285 sprintf(xorriso->info_text, "-drive_access: unknown mode '");
286 if(l > 0 && l < SfileadrL)
287 strncat(xorriso->info_text, cpt, l);
288 strcat(xorriso->info_text, "'");
289 Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);
290 return(0);
291 }
292 }
293 return(1);
294 }
295
296
297 /* Option -drive_class */
298 int Xorriso_option_drive_class(struct XorrisO *xorriso,
299 char *d_class, char *pattern, int flag)
300 {
301 int ret= 1;
302
303 if(strcmp(d_class, "banned") == 0) {
304 ret= Xorriso_lst_new(&(xorriso->drive_blacklist), pattern,
305 xorriso->drive_blacklist, 1);
306 } else if(strcmp(d_class, "caution") == 0) {
307 ret= Xorriso_lst_new(&(xorriso->drive_greylist), pattern,
308 xorriso->drive_greylist, 1);
309 } else if (strcmp(d_class, "harmless") == 0) {
310 ret= Xorriso_lst_new(&(xorriso->drive_whitelist), pattern,
311 xorriso->drive_whitelist, 1);
312 } else if (strcmp(d_class, "clear_list") == 0) {
313 if(strcmp(pattern, "banned") == 0)
314 Xorriso_lst_destroy_all(&(xorriso->drive_blacklist), 0);
315 else if(strcmp(pattern, "caution") == 0)
316 Xorriso_lst_destroy_all(&(xorriso->drive_greylist), 0);
317 else if(strcmp(pattern, "harmless") == 0)
318 Xorriso_lst_destroy_all(&(xorriso->drive_whitelist), 0);
319 else if(strcmp(pattern, "all") == 0) {
320 Xorriso_lst_destroy_all(&(xorriso->drive_blacklist), 0);
321 Xorriso_lst_destroy_all(&(xorriso->drive_greylist), 0);
322 Xorriso_lst_destroy_all(&(xorriso->drive_whitelist), 0);
323 } else {
324 sprintf(xorriso->info_text, "-drive_class clear : unknown class '%s'",
325 pattern);
326 Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);
327 return(0);
328 }
329 ret= 1;
330 } else {
331 sprintf(xorriso->info_text, "-drive_class: unknown class '%s'", d_class);
332 Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);
333 return(0);
334 }
335 return(ret);
336 }
337
338
339 /* Option -dummy "on"|"off" */
340 int Xorriso_option_dummy(struct XorrisO *xorriso, char *mode, int flag)
341 {
342 xorriso->do_dummy= !!strcmp(mode, "off");
343 return(1);
344 }
345
346
347 /* Option -dvd_obs "default"|"32k"|"64k" */
348 int Xorriso_option_dvd_obs(struct XorrisO *xorriso, char *obs, int flag)
349 {
350 double num;
351
352 if(strcmp(obs, "obs_pad") == 0) {
353 xorriso->do_obs_pad= 1;
354 return(1);
355 } else if(strcmp(obs, "no_obs_pad") == 0) {
356 xorriso->do_obs_pad= 0;
357 return(1);
358 } else if(strcmp(obs, "bdr_obs_exempt")== 0) {
359 xorriso->bdr_obs_exempt= 1;
360 return(1);
361 } else if(strcmp(obs, "no_bdr_obs_exempt")== 0) {
362 xorriso->bdr_obs_exempt= 0;
363 return(1);
364 } else if(strcmp(obs, "default") == 0) {
365 num= 0;
366 } else if(obs[0] >= '0' && obs[0] <= '9') {
367 num = Scanf_io_size(obs,0);
368 } else {
369 sprintf(xorriso->info_text, "-dvd_obs : Unrecognized parameter.");
370 Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "SORRY", 0);
371 return(0);
372 }
373 if(num != 0 && num != 32768 && num != 65536) {
374 sprintf(xorriso->info_text,
375 "-dvd_obs : Bad size. Acceptable are 0, 32k, 64k");
376 Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "SORRY", 0);
377 return(0);
378 } else
379 xorriso->dvd_obs= num;
380 return(1);
381 }
382
383
384 /* Option -early_stdio_test */
385 int Xorriso_option_early_stdio_test(struct XorrisO *xorriso, char *mode,
386 int flag)
387 {
388 if(strcmp(mode, "on") == 0)
389 xorriso->early_stdio_test= 2 | 4;
390 else if(strcmp(mode, "off") == 0)
391 xorriso->early_stdio_test= 0;
392 else if(strcmp(mode, "appendable_wo") == 0)
393 xorriso->early_stdio_test= 2 | 4 | 8;
394 else {
395 sprintf(xorriso->info_text, "-early_stdio_test: unknown mode '%s'", mode);
396 Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "SORRY", 0);
397 return(0);
398 }
399 return(1);
400 }
401
402
403 /* Command -ecma119_map */
404 int Xorriso_option_ecma119_map(struct XorrisO *xorriso, char *mode, int flag)
405 {
406 if(strcmp(mode, "unmapped") == 0)
407 xorriso->ecma119_map= 0;
408 else if(strcmp(mode, "stripped") == 0)
409 xorriso->ecma119_map= 1;
410 else if(strcmp(mode, "uppercase") == 0)
411 xorriso->ecma119_map= 2;
412 else if(strcmp(mode, "lowercase") == 0)
413 xorriso->ecma119_map= 3;
414 else {
415 sprintf(xorriso->info_text, "-ecma119_map: unknown mode '%s'", mode);
416 Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "SORRY", 0);
417 return(0);
418 }
419 return(1);
420 }
421
422
423 /* Option -eject */
424 /* @param flag bit0=do not report toc of eventually remaining drives
425 */
426 int Xorriso_option_eject(struct XorrisO *xorriso, char *which, int flag)
427 {
428 int gu_flag= 4, ret;
429
430 if(strncmp(which,"in",2)==0)
431 gu_flag|= 1;
432 else if(strncmp(which,"out",3)==0)
433 gu_flag|= 2;
434 else
435 gu_flag|= 3;
436 if((gu_flag&1) && Xorriso_change_is_pending(xorriso, 0)) {
437 sprintf(xorriso->info_text,
438 "-eject: Image changes pending. -commit or -rollback first");
439 Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);
440 return(0);
441 }
442 if(flag&1)
443 gu_flag|= 8;
444 ret= Xorriso_give_up_drive(xorriso, gu_flag);
445 return(ret);
446 }
447
448
449 /* Options -end , and -rollback_end */
450 /* @param flag bit0= discard pending changes
451 bit1= do not -reassure
452 @return <=0 error , 1 success, 2 revoked by -reassure
453 */
454 int Xorriso_option_end(struct XorrisO *xorriso, int flag)
455 {
456 int ret;
457 char *cmd, *which_will;
458
459 if(flag&1)
460 cmd= "-rollback_end";
461 else
462 cmd= "-end";
463 if(Xorriso_change_is_pending(xorriso, 0)) {
464 if((flag & 1) || !Xorriso_change_is_pending(xorriso, 1))
465 which_will= "end the program discarding image changes";
466 else
467 which_will= "commit image changes and then end the program";
468 } else {
469 which_will= "end the program";
470 }
471 if(!(flag&2)) {
472 ret= Xorriso_reassure(xorriso, cmd, which_will, 0);
473 if(ret<=0)
474 return(2);
475 }
476
477 if(Xorriso_change_is_pending(xorriso, 0)) {
478 if((flag & 1) || !Xorriso_change_is_pending(xorriso, 1)) {
479 xorriso->volset_change_pending= 0;
480 } else {
481 ret= Xorriso_option_commit(xorriso, 1);
482 xorriso->volset_change_pending= 0; /* no further tries to commit */
483 if(ret<=0)
484 return(ret);
485 }
486 }
487 ret= Xorriso_give_up_drive(xorriso, 3);
488 if(ret<=0)
489 return(ret);
490 return(1);
491 }
492
493
494 /* Option -errfile_log marked|plain path|-|"" */
495 int Xorriso_option_errfile_log(struct XorrisO *xorriso,
496 char *mode, char *path, int flag)
497 {
498 int ret, mode_word;
499 FILE *fp= NULL;
500
501 if(path[0]==0 || path[0]=='-') {
502 /* ok */;
503 } else {
504 fp= fopen(path, "a");
505 if(fp==0) {
506 sprintf(xorriso->info_text, "-errfile_log: Cannot open file ");
507 Text_shellsafe(path, xorriso->info_text, 1);
508 Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);
509 return(0);
510 }
511 }
512 mode_word= xorriso->errfile_mode;
513 if(strcmp(mode, "marked")==0)
514 mode_word|= 1;
515 else if(strcmp(mode, "plain")==0)
516 mode_word&= ~1;
517 else {
518 sprintf(xorriso->info_text, "-errfile_log: Unknown mode ");
519 Text_shellsafe(mode, xorriso->info_text, 1);
520 Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);
521 if(fp != NULL)
522 fclose(fp);
523 return(0);
524 }
525
526 Xorriso_process_errfile(xorriso, 0, "log end", 0, 1);
527 if(xorriso->errfile_fp!=NULL)
528 fclose(xorriso->errfile_fp);
529 xorriso->errfile_fp= fp;
530 xorriso->errfile_mode= mode_word;
531 ret= Sfile_str(xorriso->errfile_log, path, 0);
532 if(ret>0)
533 ret= Xorriso_process_errfile(xorriso, 0, "log start", 0, 1);
534 if(ret<=0)
535 return(ret);
536 return(1);
537 }
538
539
540 /* Option -error_behavior */
541 int Xorriso_option_error_behavior(struct XorrisO *xorriso,
542 char *occasion, char *behavior, int flag)
543 {
544 if(strcmp(occasion, "image_loading")==0) {
545 if(strcmp(behavior, "best_effort")==0)
546 xorriso->img_read_error_mode= 0;
547 else if(strcmp(behavior, "failure")==0 || strcmp(behavior, "FAILURE")==0)
548 xorriso->img_read_error_mode= 1;
549 else if(strcmp(behavior, "fatal")==0 || strcmp(behavior, "FATAL")==0)
550 xorriso->img_read_error_mode= 2;
551 else {
552 unknown_behavior:;
553 sprintf(xorriso->info_text,
554 "-error_behavior: with '%s': unknown behavior '%s'",
555 occasion, behavior);
556 Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);
557 return(0);
558 }
559 } else if(strcmp(occasion, "file_extraction")==0) {
560 if(strcmp(behavior, "best_effort")==0)
561 xorriso->extract_error_mode= 0;
562 else if(strcmp(behavior, "keep")==0)
563 xorriso->extract_error_mode= 1;
564 else if(strcmp(behavior, "delete")==0)
565 xorriso->extract_error_mode= 2;
566 else
567 goto unknown_behavior;
568 } else {
569 sprintf(xorriso->info_text, "-error_behavior: unknown occasion '%s'",
570 occasion);
571 Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);
572 return(0);
573 }
574 return(1);
575 }
576
577
578 /* Option -external_filter */
579 int Xorriso_option_external_filter(struct XorrisO *xorriso,
580 int argc, char **argv, int *idx, int flag)
581 {
582 int ret, start_idx, end_idx;
583
584 start_idx= *idx;
585 end_idx= Xorriso_end_idx(xorriso, argc, argv, start_idx, 1);
586 (*idx)= end_idx;
587 if(end_idx - start_idx < 3) {
588 sprintf(xorriso->info_text,
589 "-external_filter : Not enough parameters given. Needed: name options path %s",
590 xorriso->list_delimiter);
591 Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);
592 return(0);
593 }
594 ret= Xorriso_external_filter(xorriso, argv[start_idx],
595 argv[start_idx + 1], argv[start_idx + 2],
596 end_idx - start_idx - 3, argv + start_idx + 3, 0);
597 return(ret);
598 }
599
600
601 /* Options -extract , -extract_single */
602 /* @param flag bit0=do not report the restored item
603 bit1=do not reset pacifier, no final pacifier message
604 bit2= do not make lba-sorted node array for hardlink detection
605 bit5= -extract_single: eventually do not insert directory tree
606 */
607 int Xorriso_option_extract(struct XorrisO *xorriso, char *iso_path,
608 char *disk_path, int flag)
609 {
610 int ret, problem_count;
611 char *eff_origin= NULL, *eff_dest= NULL, *ipth, *eopt[1], *edpt[1];
612
613 Xorriso_alloc_meM(eff_origin, char, SfileadrL);
614 Xorriso_alloc_meM(eff_dest, char, SfileadrL);
615
616 if(xorriso->allow_restore <= 0) {
617 sprintf(xorriso->info_text,
618 "-extract: image-to-disk copies are not enabled by option -osirrox");
619 Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);
620 ret= 0; goto ex;
621 }
622 if(!(flag&2))
623 Xorriso_pacifier_reset(xorriso, 0);
624
625 ipth= iso_path;
626 if(ipth[0]==0)
627 ipth= disk_path;
628 if(disk_path[0]==0) {
629 sprintf(xorriso->info_text, "-extract: Empty disk_path given");
630 Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "SORRY", 1);
631 ret= 0; goto ex;
632 }
633 ret= Xorriso_normalize_img_path(xorriso, xorriso->wdx, disk_path, eff_dest,
634 2|4);
635 if(ret<=0)
636 goto ex;
637 ret= Xorriso_normalize_img_path(xorriso, xorriso->wdi, ipth, eff_origin, 2|8);
638 if(ret<=0)
639 goto ex;
640
641 eopt[0]= eff_origin;
642 edpt[0]= eff_dest;
643 ret= Xorriso_restore_sorted(xorriso, 1, eopt, edpt, &problem_count,
644 (flag & 32 ? 33 : 0));
645
646 if(!(flag&2))
647 Xorriso_pacifier_callback(xorriso, "files restored",xorriso->pacifier_count,
648 xorriso->pacifier_total, "", 1 | 4 | 8 | 32);
649 if(ret <= 0 || problem_count > 0)
650 goto ex;
651
652 if(!(flag&1)) {
653 sprintf(xorriso->info_text, "Extracted from ISO image: %s '%s'='%s'\n",
654 (ret>1 ? "directory" : "file"), eff_origin, eff_dest);
655 Xorriso_info(xorriso,0);
656 }
657 ret= 1;
658 ex:;
659 if(!(flag & (4 | 32)))
660 Xorriso_destroy_node_array(xorriso, 0);
661 Xorriso_free_meM(eff_origin);
662 Xorriso_free_meM(eff_dest);
663 return(ret);
664 }
665
666
667 /* Command -extract_boot_images */
668 int Xorriso_option_extract_boot_images(struct XorrisO *xorriso,
669 char *disk_dir_path, int flag)
670 {
671 int ret;
672
673 if(xorriso->allow_restore <= 0) {
674 sprintf(xorriso->info_text,
675 "-extract_boot_images: image-to-disk copies are not enabled by option -osirrox"
676 );
677 Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);
678 return(0);
679 }
680 ret= Xorriso_extract_boot_images(xorriso, disk_dir_path, 0);
681 return(ret);
682 }
683
684
685 /* Option -extract_cut */
686 int Xorriso_option_extract_cut(struct XorrisO *xorriso, char *iso_rr_path,
687 char *start, char *count, char *disk_path, int flag)
688 {
689 int ret;
690 double num;
691 off_t startbyte, bytecount;
692
693 num= Scanf_io_size(start, 0);
694 if(num<0 || num > 1.0e18) { /* 10^18 = 10^3 ^ 6 < 2^10 ^ 6 = 2^60 */
695 sprintf(xorriso->info_text,
696 "-extract_cut: startbyte address negative or much too large (%s)",
697 start);
698 Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);
699 return(0);
700 }
701 startbyte= num;
702 num= Scanf_io_size(count, 0);
703 if(num<=0 || num > 1.0e18) {
704 sprintf(xorriso->info_text,
705 "-extract_cut: bytecount zero, negative or much too large (%s)",
706 count);
707 Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);
708 return(0);
709 }
710 bytecount= num;
711 sprintf(xorriso->info_text,
712 "-extract_cut from %s , byte %.f to %.f, and store as %s",
713 iso_rr_path, (double) startbyte, (double) (startbyte+bytecount),
714 disk_path);
715 Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "DEBUG", 0);
716
717 ret= Xorriso_extract_cut(xorriso, iso_rr_path, disk_path,
718 startbyte, bytecount, 0);
719 return(ret);
720 }
721
722
723 /* Command -file_name_limit */
724 int Xorriso_option_file_name_limit(struct XorrisO *xorriso, char *value,
725 int flag)
726 {
727 int ret, sub_flag= 0;
728 double num;
729
730 if(value[0] == '+')
731 sub_flag|= 1;
732 num= Scanf_io_size(value + (sub_flag & 1), 0);
733 if(num < 64 || num > 255) {
734 sprintf(xorriso->info_text,
735 "-file_name_limit: Value '%s' out of range [64..255]", value);
736 Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "SORRY", 0);
737 return(0);
738 }
739 if(num == xorriso->file_name_limit)
740 return(1);
741 ret= Xorriso_set_file_name_limit(xorriso, (int) num, sub_flag);
742 return(ret > 0);
743 }
744
745
746 /* Option -file_size_limit */
747 int Xorriso_option_file_size_limit(struct XorrisO *xorriso,
748 int argc, char **argv, int *idx, int flag)
749 {
750 int ret, i, end_idx;
751 off_t new_limit= 0;
752
753 end_idx= Xorriso_end_idx(xorriso, argc, argv, *idx, 1);
754 if(*idx >= end_idx)
755 {ret= 2; goto ex;}
756 if(*idx + 1 == end_idx && strcmp(argv[*idx], "off") == 0) {
757 xorriso->file_size_limit= 0;
758 ret= 1; goto ex;
759 }
760 for(i= *idx; i < end_idx; i++)
761 new_limit+= Scanf_io_size(argv[i], 0);
762 if(new_limit <= 0) {
763 sprintf(xorriso->info_text, "-file_size_limit: values sum up to %.f",
764 (double) new_limit);
765 Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);
766 ret= 0; goto ex;
767 }
768 xorriso->file_size_limit= new_limit;
769 ret= 1;
770 ex:;
771 if((xorriso->file_size_limit >= ((off_t) 4) * (off_t) (1024 * 1024 * 1024) ||
772 xorriso->file_size_limit == 0) && xorriso->iso_level < 3 && ret > 0) {
773 xorriso->iso_level= 3;
774 xorriso->iso_level_is_default= 0;
775 Xorriso_msgs_submit(xorriso, 0,
776 "-file_size_limit of at least 4 GiB causes ISO level 3",
777 0, "NOTE", 0);
778 }
779 (*idx)= end_idx;
780 if(ret > 0) {
781 if(xorriso->file_size_limit > 0)
782 sprintf(xorriso->info_text, "-file_size_limit now at %.f\n",
783 (double) xorriso->file_size_limit);
784 else
785 sprintf(xorriso->info_text, "-file_size_limit now off\n");
786 Xorriso_info(xorriso,0);
787 }
788 return(ret);
789 }
790
791
792 static int Xorriso_determine_name_space(struct XorrisO *xorriso,
793 char *space_name, int flag)
794 {
795 if(strcmp(space_name, "rockridge") == 0)
796 return(1);
797 else if(strcmp(space_name, "joliet") == 0)
798 return(2);
799 else if(strcmp(space_name, "ecma119") == 0 ||
800 strcmp(space_name, "iso9660") == 0)
801 return(3);
802 else if(strcmp(space_name, "hfsplus") == 0)
803 return(4);
804 sprintf(xorriso->info_text, "-find: Unknown output namespace identifier");
805 return(0);
806 }
807
808 static int Xorriso_truncate_const_find_name(struct XorrisO *xorriso,
809 char *expr, char *buffer,
810 char **namept, int flag)
811 {
812 int ret;
813
814 *namept= expr;
815 ret= Xorriso_truncate_path_comps(xorriso, expr, buffer, namept, 1);
816 if(ret < 0) {
817 sprintf(xorriso->info_text,
818 "-find[ix]: cannot truncate constant -name to -file_name_limit: ");
819 Text_shellsafe(expr, xorriso->info_text, 1);
820 Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);
821 return(0);
822 }
823 return(1);
824 }
825
826 /* Option -find alias -findi, and -findx */
827 /* @param flag bit0= -findx rather than -findi
828 bit1= do not reset pacifier, no final pacifier message
829 do not reset find_compare_result
830 bit2= do not count deleted files with rm and rm_r
831 bit3= use Xorriso_findi_sorted() rather than Xorriso_findi()
832 (this can also be ordered by test -sort_lba)
833 bit4= return number of matches plus 1
834 */
835 int Xorriso_option_find(struct XorrisO *xorriso, int argc, char **argv,
836 int *idx, int flag)
837 {
838 int ret, i, end_idx, type= 0, action, deleter= 0, start_lba, count;
839 int list_extattr_head= 0, bsl_mem, disk_path, name_space, prefix_code;
840 struct FindjoB *job, *first_job= NULL, *new_job;
841 char *start_path, *path= NULL, *cpt, *other_path_start= NULL, *cd_pt;
842 char *access_acl_text= NULL, *default_acl_text= NULL, *list_extattr_mode;
843 char *arg1_pt, *namept, *suffix_pt, *value_pt, size_text[40];
844 off_t size_value, suffix_factor= 1;
845
846 struct stat dir_stbuf;
847 uid_t user= 0;
848 gid_t group= 0;
849 time_t date= 0;
850 mode_t mode_or= 0, mode_and= ~1;
851 double mem_lut= 0.0;
852
853 end_idx= Xorriso_end_idx(xorriso, argc, argv, *idx, 1);
854 Xorriso_alloc_meM(path, char, SfileadrL);
855 Xorriso_alloc_meM(other_path_start, char, SfileadrL);
856
857 start_path= ".";
858 list_extattr_mode= "e";
859 if(end_idx > *idx && start_path[0]!=0)
860 start_path= argv[*idx];
861 ret= Findjob_new(&first_job, start_path, 0);
862 if(ret<=0) {
863 Xorriso_no_findjob(xorriso, "-find[ix]", 0);
864 {ret= -1; goto ex;}
865 }
866 job= first_job;
867 if(!(flag&2))
868 xorriso->find_compare_result= 1;
869 for(i= *idx+1; i<end_idx; i++) {
870 ret= 1;
871 if(strcmp(argv[i], "-name")==0) {
872 if(i+1>=end_idx) {
873 not_enough_arguments:;
874 sprintf(xorriso->info_text,
875 "-find[ix]: not enough parameters with test ");
876 Text_shellsafe(argv[i], xorriso->info_text, 1);
877 goto sorry_ex;
878 }
879 i++;
880 ret= Xorriso_truncate_const_find_name(xorriso, argv[i], path, &namept, 0);
881 if(ret <= 0)
882 goto ex;
883 ret= Findjob_set_name_expr(job, namept, 0);
884 if(ret<=0) {
885 sprintf(xorriso->info_text, "-find[ix]: cannot set -name expression ");
886 Text_shellsafe(argv[i], xorriso->info_text, 1);
887 goto sorry_ex;
888 }
889 } else if(strcmp(argv[i], "-wholename")==0) {
890 if(i+1>=end_idx)
891 goto not_enough_arguments;
892 i++;
893 ret= Xorriso_truncate_const_find_name(xorriso, argv[i], path, &namept, 0);
894 if(ret <= 0)
895 goto ex;
896 ret= Findjob_set_name_expr(job, namept, 1);
897 if(ret<=0) {
898 sprintf(xorriso->info_text,
899 "-find[ix]: cannot set -wholename expression ");
900 Text_shellsafe(argv[i], xorriso->info_text, 1);
901 goto sorry_ex;
902 }
903 } else if(strcmp(argv[i], "-type")==0) {
904 if(i+1>=end_idx)
905 goto not_enough_arguments;
906 i++;
907 ret= Findjob_set_file_type(job, argv[i][0], 0);
908 if(ret<=0) {
909 sprintf(xorriso->info_text, "-find[ix]: unknown -type '%c'",argv[i][0]);
910 goto sorry_ex;
911 }
912 } else if(strcmp(argv[i], "-damaged")==0) {
913 Findjob_set_damage_filter(job, 1, 0);
914 } else if(strcmp(argv[i], "-undamaged")==0) {
915 Findjob_set_damage_filter(job, -1, 0);
916 } else if(strcmp(argv[i], "-lba_range")==0) {
917 if(i+2>=end_idx)
918 goto not_enough_arguments;
919 i+= 2;
920
921 /* >>> if letter suffix: use Scanf_io_size */
922 sscanf(argv[i-1], "%d", &start_lba);
923 sscanf(argv[i], "%d", &count);
924 Findjob_set_lba_range(job, start_lba, count, 0);
925 } else if(strcmp(argv[i], "-pending_data")==0) {
926 Findjob_set_commit_filter_2(job, 0);
927 } else if(strcmp(argv[i], "-has_acl")==0) {
928 Findjob_set_acl_filter(job, 1, 0);
929 } else if(strcmp(argv[i], "-has_no_acl")==0) {
930 Findjob_set_acl_filter(job, -1, 0);
931 } else if(strcmp(argv[i], "-has_xattr")==0) {
932 Findjob_set_xattr_filter(job, 1, 0);
933 } else if(strcmp(argv[i], "-has_any_xattr")==0) {
934 Findjob_set_xattr_filter(job, 1, 1);
935 } else if(strcmp(argv[i], "-has_no_xattr")==0) {
936 Findjob_set_xattr_filter(job, -1, 0);
937 } else if(strcmp(argv[i], "-has_aaip")==0) {
938 Findjob_set_aaip_filter(job, 1, 0);
939 } else if(strcmp(argv[i], "-has_no_aaip")==0) {
940 Findjob_set_aaip_filter(job, -1, 0);
941 } else if(strcmp(argv[i], "-has_filter")==0) {
942 Findjob_set_filter_filter(job, 1, 0);
943 } else if(strcmp(argv[i], "-has_no_filter")==0) {
944 Findjob_set_filter_filter(job, -1, 0);
945 } else if(strcmp(argv[i], "-has_md5")==0) {
946 Findjob_set_prop_filter(job, 15, 1, 0);
947 } else if(strcmp(argv[i], "-disk_name")==0 ||
948 strcmp(argv[i], "-disk_path")==0) {
949 disk_path= (strcmp(argv[i], "-disk_path") == 0);
950 if(i+1>=end_idx)
951 goto not_enough_arguments;
952 i++;
953 arg1_pt= argv[i];
954 if(disk_path) {
955 ret= Xorriso_make_abs_adr(xorriso, xorriso->wdx, argv[i], path,
956 1 | 2 | 4 | 8);
957 if(ret<=0)
958 goto ex;
959 arg1_pt= path;
960 }
961 ret= Findjob_set_name_expr(job, arg1_pt, 2 + disk_path);
962 if(ret<=0) {
963 sprintf(xorriso->info_text,
964 "-find[ix]: cannot set %s ",
965 disk_path ? "-disk_path address" : "-disk_name expression");
966 Text_shellsafe(argv[i], xorriso->info_text, 1);
967 goto sorry_ex;
968 }
969 } else if(strcmp(argv[i], "-hidden")==0) {
970 if(i + 1 >= end_idx)
971 goto not_enough_arguments;
972 i+= 1;
973 type= Xorriso__hide_mode(argv[i], 0);
974 if(type < 0) {
975 sprintf(xorriso->info_text, "-findi: -hidden : unknown hide state ");
976 Text_shellsafe(argv[i], xorriso->info_text, 1);
977 goto sorry_ex;
978 } else {
979 ret= Findjob_set_test_hidden(job, type, 0);
980 if(ret <= 0) {
981 sprintf(xorriso->info_text, "-findi: cannot setup -hidden test");
982 goto sorry_ex;
983 }
984 }
985 } else if(strcmp(argv[i], "-has_hfs_crtp")==0) {
986 if(i + 2 >= end_idx)
987 goto not_enough_arguments;
988 i+= 2;
989 ret= Xorriso_hfsplus_file_creator_type(xorriso, "", NULL,
990 argv[i - 1], argv[i], 3);
991 if(ret <= 0)
992 {ret= 0; goto ex;}
993 ret= Findjob_set_crtp_filter(job, argv[i - 1], argv[i], 0);
994 if(ret <= 0) {
995 sprintf(xorriso->info_text, "-findi: cannot setup -has_hfs_crtp test");
996 goto sorry_ex;
997 }
998 } else if(strcmp(argv[i], "-has_hfs_bless")==0) {
999 if(i + 1 >= end_idx)
1000 goto not_enough_arguments;
1001 i+= 1;
1002 ret= Findjob_set_bless_filter(xorriso, job, argv[i], 0);
1003 if(ret <= 0) {
1004 sprintf(xorriso->info_text, "-findi: cannot setup -has_hfs_bless test");
1005 goto sorry_ex;
1006 }
1007 } else if(strcmp(argv[i], "-bad_outname")==0) {
1008 if(i + 1 >= end_idx)
1009 goto not_enough_arguments;
1010 i+= 1;
1011 name_space= Xorriso_determine_name_space(xorriso, argv[i], 0);
1012 if(name_space < 0) {
1013 ret= 0; goto sorry_ex;
1014 }
1015 ret= Findjob_set_num_filter(job, 21, name_space, 0, 0);
1016 if(ret <= 0) {
1017 sprintf(xorriso->info_text, "-findi: cannot setup -bad_outname test");
1018 goto sorry_ex;
1019 }
1020 } else if(strcmp(argv[i], "-true") == 0) {
1021 ret= Findjob_set_false(job, -1, 0);
1022 if(ret <= 0)
1023 goto ex;
1024 } else if(strcmp(argv[i], "-false") == 0) {
1025 ret= Findjob_set_false(job, 1, 0);
1026 if(ret <= 0)
1027 goto ex;
1028 } else if(strcmp(argv[i], "-decision") == 0) {
1029 if(i+1>=end_idx)
1030 goto not_enough_arguments;
1031 i++;
1032 ret= Findjob_set_arg1(job, 11, argv[i], 0);
1033 if(ret <= 0)
1034 goto ex;
1035 } else if(strcmp(argv[i], "-prune") == 0) {
1036 ret= Findjob_set_prune(job, 0);
1037 if(ret <= 0)
1038 goto ex;
1039 } else if(strcmp(argv[i], "-sub") == 0 || strcmp(argv[i], "(") == 0) {
1040 ret= Findjob_open_bracket(job, 0);
1041 if(ret <= 0)
1042 goto ex;
1043 } else if(strcmp(argv[i], "-subend") == 0 || strcmp(argv[i], ")") == 0) {
1044 ret= Findjob_close_bracket(job, 0);
1045 if(ret <= 0)
1046 goto ex;
1047 } else if(strcmp(argv[i], "-not") == 0 || strcmp(argv[i], "!") == 0) {
1048 ret= Findjob_not(job, 0);
1049 if(ret <= 0)
1050 goto ex;
1051 } else if(strcmp(argv[i], "-and") == 0 || strcmp(argv[i], "-a") == 0) {
1052 ret= Findjob_and(job, 0);
1053 if(ret <= 0)
1054 goto ex;
1055 } else if(strcmp(argv[i], "-or") == 0 || strcmp(argv[i], "-o") == 0) {
1056 ret= Findjob_or(job, 0);
1057 if(ret <= 0)
1058 goto ex;
1059 } else if(strcmp(argv[i], "-if") == 0) {
1060 ret= Findjob_if(job, 0);
1061 if(ret <= 0)
1062 goto ex;
1063 } else if(strcmp(argv[i], "-then") == 0) {
1064 ret= Findjob_then(job, 0);
1065 if(ret <= 0)
1066 goto ex;
1067 } else if(strcmp(argv[i], "-else") == 0) {
1068 ret= Findjob_else(job, 0);
1069 if(ret <= 0)
1070 goto ex;
1071 } else if(strcmp(argv[i], "-elseif") == 0) {
1072 ret= Findjob_elseif(job, 0);
1073 if(ret <= 0)
1074 goto ex;
1075 } else if(strcmp(argv[i], "-endif") == 0) {
1076 ret= Findjob_endif(job, 0);
1077 if(ret <= 0)
1078 goto ex;
1079 } else if(strcmp(argv[i], "-sort_lba") == 0) {
1080 flag|= 8;
1081 /* If an operator is open: insert a -true test, else do nothing */
1082 ret= Findjob_set_false(job, -1, 1);
1083 if(ret == 2)
1084 ret= 1;
1085 } else if(strcmp(argv[i], "-use_pattern") == 0 ||
1086 strcmp(argv[i], "-or_use_pattern") == 0) {
1087 if(i + 1 >= end_idx)
1088 goto not_enough_arguments;
1089 i++;
1090 ret= Findjob_set_arg1(job,
1091 22 + (strcmp(argv[i - 1], "-or_use_pattern") == 0),
1092 argv[i], 0);
1093 if(ret <= 0)
1094 goto ex;
1095 } else if(strcmp(argv[i], "-name_limit_blocker") == 0) {
1096 if(i + 1 >= end_idx)
1097 goto not_enough_arguments;
1098 i++;
1099 sscanf(argv[i], "%d", &count);
1100 if(count < 64 || count > 255) {
1101 sprintf(xorriso->info_text,
1102 "-findi: wrong length with -name_limit_blocker [64...255]");
1103 goto sorry_ex;
1104 }
1105 ret= Findjob_set_num_filter(job, 24, count, 0, 0);
1106 if(ret <= 0)
1107 goto ex;
1108 } else if(strcmp(argv[i], "-maxdepth") == 0 ||
1109 strcmp(argv[i], "-mindepth") == 0) {
1110 if(i + 1 >= end_idx)
1111 goto not_enough_arguments;
1112 i++;
1113 count= -1;
1114 sscanf(argv[i], "%d", &count);
1115 if(count < 0) {
1116 sprintf(xorriso->info_text,
1117 "-findi: wrong length with %s [>= 0]", argv[i - 1]);
1118 goto sorry_ex;
1119 }
1120 ret= Findjob_set_num_filter(job,
1121 25 + (strcmp(argv[i - 1], "-mindepth") == 0),
1122 count, 0, 0);
1123 if(ret <= 0)
1124 goto ex;
1125 } else if(strcmp(argv[i], "-size") == 0) {
1126 if(i + 1 >= end_idx)
1127 goto not_enough_arguments;
1128 i++;
1129 if(strlen(argv[i]) >= sizeof(size_text) - 1) {
1130 sprintf(xorriso->info_text,
1131 "-findi: Number text after -size is much too long");
1132 goto sorry_ex;
1133 }
1134 strcpy(size_text, argv[i]);
1135 value_pt= size_text;
1136 prefix_code= 0;
1137 if(*value_pt == 0)
1138 goto size_value_bad;
1139 if(*value_pt == '-') {
1140 prefix_code= -1;
1141 value_pt++;
1142 } else if(*value_pt == '+') {
1143 prefix_code= 1;
1144 value_pt++;
1145 }
1146 if(*value_pt == 0)
1147 goto size_value_bad;
1148 if(*value_pt == '=') {
1149 prefix_code*= 2;
1150 value_pt++;
1151 }
1152 if(*value_pt == 0) {
1153 size_value_bad:;
1154 sprintf(xorriso->info_text,
1155 "-findi: Number text after -size is not suitable");
1156 }
1157 /* Convert "find -size" suffix to Scanf_io_size suffix */
1158 suffix_pt= value_pt + strlen(value_pt) - 1;
1159 if(*suffix_pt == 'b' || *suffix_pt == 'B') {
1160 *suffix_pt= 'd'; /* 512 bytes */
1161 } else if(*suffix_pt == 'c' || *suffix_pt == 'C') {
1162 *suffix_pt= 0; /* 1 byte */
1163 } else if(*suffix_pt == 'w'|| *suffix_pt == 'W') {
1164 *suffix_pt= 0; /* 2 byte */
1165 suffix_factor= 2;
1166 } else if(*suffix_pt >= '0' && *suffix_pt <= '9') {
1167 suffix_pt++;
1168 *suffix_pt= 'd'; /* 512 bytes */
1169 *(suffix_pt + 1)= 0;
1170 }
1171 size_value= (off_t) Scanf_io_size(value_pt, 1) * (off_t) suffix_factor;
1172 if(size_value < 0)
1173 goto size_value_bad;
1174 ret= Findjob_set_size_filter(job, 27, size_value, prefix_code, 0);
1175 if(ret <= 0)
1176 goto ex;
1177
1178 } else if(strcmp(argv[i], "-exec")==0) {
1179 if(i+1>=end_idx) {
1180 not_enough_exec_arguments:;
1181 sprintf(xorriso->info_text,
1182 "-find[ix]: not enough parameters with -exec ");
1183 Text_shellsafe(argv[i], xorriso->info_text, 1);
1184 goto sorry_ex;
1185 }
1186 i++;
1187 cpt= argv[i];
1188 if(*cpt=='-')
1189 cpt++;
1190 if(strcmp(cpt, "echo")==0) {
1191 Findjob_set_action_target(job, 0, NULL, 0);
1192 } else if(strcmp(cpt, "rm")==0) {
1193 Findjob_set_action_target(job, 1, NULL, 0);
1194 deleter= 1;
1195 } else if(strcmp(cpt, "rm_r")==0) {
1196 Findjob_set_action_target(job, 2, NULL, 0);
1197 deleter= 1;
1198
1199 #ifdef NIX
1200 /* >>> not implemented yet */;
1201 } else if(strcmp(cpt, "mv")==0) {
1202 if(i+1>=end_idx)
1203 goto not_enough_exec_arguments;
1204 i++;
1205 Findjob_set_action_target(job, 3, argv[i], 0);
1206 #endif
1207
1208 } else if(strcmp(cpt, "chown")==0 || strcmp(cpt, "chown_r")==0) {
1209 if(i+1>=end_idx)
1210 goto not_enough_exec_arguments;
1211 i++;
1212 ret= Xorriso_convert_uidstring(xorriso, argv[i], &user, 0);
1213 if(ret<=0)
1214 goto ex;
1215 ret= Findjob_set_action_chown(job, user, strlen(cpt)>5);
1216 if(ret<=0) {
1217 Xorriso_no_findjob(xorriso, "-find -exec chown_r", 0);
1218 goto ex;
1219 }
1220 } else if(strcmp(cpt, "chgrp")==0 || strcmp(cpt, "chgrp_r")==0) {
1221 if(i+1>=end_idx)
1222 goto not_enough_exec_arguments;
1223 i++;
1224 ret= Xorriso_convert_gidstring(xorriso, argv[i], &group, 0);
1225 if(ret<=0)
1226 goto ex;
1227 ret= Findjob_set_action_chgrp(job, group, strlen(cpt)>5);
1228 if(ret<=0) {
1229 Xorriso_no_findjob(xorriso, "-find -exec chgrp_r", 0);
1230 goto ex;
1231 }
1232 } else if(strcmp(cpt, "chmod")==0 || strcmp(cpt, "chmod_r")==0) {
1233 if(i+1>=end_idx)
1234 goto not_enough_exec_arguments;
1235 i++;
1236 ret= Xorriso_convert_modstring(xorriso, "-find -exec chmod",
1237 argv[i], &mode_and, &mode_or, 0);
1238 if(ret<=0)
1239 goto ex;
1240 ret= Findjob_set_action_chmod(job, mode_and, mode_or, strlen(cpt)>5);
1241 if(ret<=0) {
1242 Xorriso_no_findjob(xorriso, "-find -exec chmod_r", 0);
1243 goto ex;
1244 }
1245 } else if(strcmp(cpt, "alter_date")==0 || strcmp(cpt, "alter_date_r")==0){
1246 if(i+2>=end_idx)
1247 goto not_enough_exec_arguments;
1248 i+= 2;
1249 ret= Xorriso_convert_datestring(xorriso, "-find -exec alter_date",
1250 argv[i-1], argv[i], &type, &date, 0);
1251 if(ret<=0)
1252 goto ex;
1253 ret= Findjob_set_action_ad(job, type, date, strlen(cpt)>10);
1254 if(ret<=0) {
1255 Xorriso_no_findjob(xorriso, "-find -exec alter_date_r", 0);
1256 goto ex;
1257 }
1258
1259 } else if(strcmp(cpt, "set_to_mtime") == 0) {
1260 Findjob_set_action_target(job, 59, NULL, 0);
1261
1262 } else if(strcmp(cpt, "lsdl")==0) {
1263 Findjob_set_action_target(job, 8, NULL, 0);
1264
1265 } else if(strcmp(cpt, "find")==0) {
1266 ret= Findjob_new(&new_job, "", 0);
1267 if(ret<=0) {
1268 Xorriso_no_findjob(xorriso, "-find[ix]", 0);
1269 {ret= -1; goto ex;}
1270 }
1271 Findjob_set_action_subjob(job, 13, new_job, 0);
1272 job= new_job;
1273
1274 } else if(strcmp(cpt, "compare")==0 || strcmp(cpt, "update")==0 ||
1275 strcmp(cpt, "widen_hardlinks")==0 ||
1276 strcmp(cpt, "update_merge")==0) {
1277 if(i+1>=end_idx)
1278 goto not_enough_exec_arguments;
1279 i++;
1280 action= 14;
1281 if(strcmp(cpt, "update")==0)
1282 action= 17;
1283 else if(strcmp(cpt, "widen_hardlinks")==0)
1284 action= 32;
1285 else if(strcmp(cpt, "update_merge") == 0) {
1286 action= 41;
1287 /* Enter update_merge mode for node adding */
1288 xorriso->update_flags|= 1;
1289 }
1290
1291 ret= Xorriso_make_abs_adr(xorriso, xorriso->wdx, argv[i],
1292 other_path_start, 1|2|4|8);
1293 if(ret<=0)
1294 goto ex;
1295 Findjob_set_action_target(job, action, other_path_start, 0);
1296 ret= Xorriso_make_abs_adr(xorriso, xorriso->wdi, start_path,
1297 path, 1|2|4);
1298 if(ret<=0)
1299 goto ex;
1300 Findjob_set_start_path(job, path, 0);
1301 if(!(flag&2)) {
1302 Xorriso_pacifier_reset(xorriso, 0);
1303 mem_lut= xorriso->last_update_time;
1304 }
1305 } else if(strcmp(cpt, "in_iso")==0 ||
1306 strcmp(cpt, "not_in_iso")==0 ||
1307 strcmp(cpt, "add_missing")==0 ||
1308 strcmp(cpt, "empty_iso_dir")==0 ||
1309 strcmp(cpt, "is_full_in_iso")==0) {
1310 if(i+1>=end_idx)
1311 goto not_enough_exec_arguments;
1312 i++;
1313 ret= Xorriso_make_abs_adr(xorriso, xorriso->wdi, argv[i],
1314 other_path_start, 1|2|4);
1315 if(ret<=0)
1316 goto ex;
1317 if(strcmp(cpt, "in_iso")==0)
1318 action= 15;
1319 else if(strcmp(cpt, "add_missing")==0)
1320 action= 18;
1321 else if(strcmp(cpt, "empty_iso_dir")==0)
1322 action= 19;
1323 else if(strcmp(cpt, "is_full_in_iso")==0)
1324 action= 20;
1325 else
1326 action= 16;
1327 Findjob_set_action_target(job, action, other_path_start, 0);
1328 ret= Xorriso_make_abs_adr(xorriso, xorriso->wdx, start_path, path,
1329 1|2|4|8);
1330 if(ret<=0)
1331 goto ex;
1332 Findjob_set_start_path(job, path, 0);
1333
1334 } else if(strcmp(cpt, "report_damage")==0) {
1335 Findjob_set_action_target(job, 21, NULL, 0);
1336 } else if(strcmp(cpt, "report_lba")==0) {
1337 Findjob_set_action_target(job, 22, NULL, 0);
1338 } else if(strcmp(cpt, "getfacl")==0) {
1339 Findjob_set_action_target(job, 24, NULL, 0);
1340 } else if(strcmp(cpt, "setfacl")==0) {
1341 if(i+1>=end_idx)
1342 goto not_enough_exec_arguments;
1343 i++;
1344 ret= Xorriso_normalize_acl_text(xorriso, argv[i],
1345 &access_acl_text, &default_acl_text, 0);
1346 if(ret <= 0)
1347 goto ex;
1348 Findjob_set_action_text_2(job, 25, access_acl_text, default_acl_text,
1349 0);
1350 } else if(strcmp(cpt, "getfattr")==0) {
1351 Findjob_set_action_target(job, 26, NULL, 0);
1352 } else if(strcmp(cpt, "setfattr")==0) {
1353 if(i + 2 >= end_idx)
1354 goto not_enough_exec_arguments;
1355 i+= 2;
1356 /* check input */
1357 ret= Xorriso_path_setfattr(xorriso, NULL, "", argv[i - 1],
1358 strlen(argv[i]), argv[i], 1);
1359 if(ret <= 0)
1360 goto ex;
1361 Findjob_set_action_text_2(job, 27, argv[i - 1], argv[i], 0);
1362 } else if(strcmp(cpt, "set_filter")==0) {
1363 if(i + 1 >= end_idx)
1364 goto not_enough_exec_arguments;
1365 i+= 1;
1366 Findjob_set_action_target(job, 28, argv[i], 0);
1367 if(!(flag&2)) {
1368 Xorriso_pacifier_reset(xorriso, 0);
1369 mem_lut= xorriso->last_update_time;
1370 }
1371 } else if(strcmp(cpt, "show_stream")==0) {
1372 Findjob_set_action_target(job, 29, NULL, 0);
1373 } else if(strcmp(cpt, "get_any_xattr")==0) {
1374 Findjob_set_action_target(job, 33, NULL, 0);
1375 } else if(strcmp(cpt, "get_md5")==0) {
1376 Findjob_set_action_target(job, 34, NULL, 0);
1377 } else if(strcmp(cpt, "check_md5")==0) {
1378 if(i + 1 >= end_idx)
1379 goto not_enough_exec_arguments;
1380 i+= 1;
1381 Findjob_set_action_target(job, 35, argv[i], 0);
1382 flag|= 8;
1383 if(!(flag&2)) {
1384 Xorriso_pacifier_reset(xorriso, 0);
1385 mem_lut= xorriso->last_update_time;
1386 }
1387 if(!(flag & 1))
1388 xorriso->find_check_md5_result= 0;
1389 } else if(strcmp(cpt, "make_md5")==0) {
1390 Findjob_set_action_target(job, 36, NULL, 0);
1391 flag|= 8;
1392 if(!(flag&2)) {
1393 Xorriso_pacifier_reset(xorriso, 0);
1394 mem_lut= xorriso->last_update_time;
1395 }
1396 } else if(strcmp(cpt, "mkisofs_r")==0) {
1397 Findjob_set_action_target(job, 37, NULL, 0);
1398 } else if(strcmp(cpt, "sort_weight")==0) {
1399 if(i + 1 >= end_idx)
1400 goto not_enough_exec_arguments;
1401 i+= 1;
1402 sscanf(argv[i], "%d", &type);
1403 Findjob_set_action_type(job, 38, type, 0);
1404 } else if(strcmp(cpt, "hide")==0) {
1405 if(i+1>=end_idx)
1406 goto not_enough_exec_arguments;
1407 i++;
1408 type= Xorriso__hide_mode(argv[i], 0);
1409 if(type < 0) {
1410 sprintf(xorriso->info_text, "-find -exec hide: unknown hide state ");
1411 Text_shellsafe(argv[i], xorriso->info_text, 1);
1412 goto sorry_ex;
1413 }
1414 Findjob_set_action_type(job, 39, type, 0);
1415 } else if(strcmp(cpt, "estimate_size")==0) {
1416 Findjob_set_action_target(job, 40, NULL, 0);
1417 } else if(strcmp(cpt, "rm_merge")==0) {
1418 Findjob_set_action_target(job, 42, NULL, 0);
1419 xorriso->update_flags&= ~1; /* End update_merge mode for node adding */
1420 } else if(strcmp(cpt, "clear_merge")==0) {
1421 Findjob_set_action_target(job, 43, NULL, 0);
1422 xorriso->update_flags&= ~1; /* End update_merge mode for node adding */
1423 } else if(strcmp(cpt, "list_extattr")==0) {
1424 if(i+1>=end_idx)
1425 goto not_enough_exec_arguments;
1426 i++;
1427 Findjob_set_action_target(job, 44, argv[i], 0);
1428 list_extattr_head= 1;
1429 list_extattr_mode= argv[i];
1430 } else if(strcmp(cpt, "set_hfs_crtp")==0) {
1431 if(i + 2 >= end_idx)
1432 goto not_enough_exec_arguments;
1433 i+= 2;
1434 /* Check creator and type for compliance */
1435 ret= Xorriso_hfsplus_file_creator_type(xorriso, "", NULL,
1436 argv[i - 1], argv[i], 1);
1437 if(ret <= 0)
1438 goto ex;
1439 Findjob_set_action_text_2(job, 45, argv[i - 1], argv[i], 0);
1440 } else if(strcmp(cpt, "get_hfs_crtp")==0) {
1441 Findjob_set_action_target(job, 46, NULL, 0);
1442 } else if(strcmp(cpt, "set_hfs_bless")==0) {
1443 if(i+1>=end_idx)
1444 goto not_enough_exec_arguments;
1445 i++;
1446 /* Check type of blessing for compliance */
1447 ret= Xorriso_hfsplus_bless(xorriso, "", NULL, argv[i], 4);
1448 if(ret <= 0)
1449 goto ex;
1450 Findjob_set_action_target(job, 47, argv[i], 0);
1451 } else if(strcmp(cpt, "get_hfs_bless")==0) {
1452 Findjob_set_action_target(job, 48, NULL, 0);
1453 } else if(strcmp(cpt, "print_outname")==0) {
1454 if(i+1>=end_idx)
1455 goto not_enough_exec_arguments;
1456 i++;
1457 name_space= Xorriso_determine_name_space(xorriso, argv[i], 0);
1458 if(name_space < 0) {
1459 ret= 0; goto sorry_ex;
1460 }
1461 Findjob_set_action_type(job, 50, name_space, 0);
1462 } else if(strcmp(cpt, "report_sections")==0) {
1463 Findjob_set_action_target(job, 51, NULL, 0);
1464 } else if(strcmp(cpt, "show_stream_id") == 0) {
1465 Findjob_set_action_target(job, 52, NULL, 0);
1466 } else {
1467 sprintf(xorriso->info_text, "-find -exec: unknown action ");
1468 Text_shellsafe(argv[i], xorriso->info_text, 1);
1469 goto sorry_ex;
1470 }
1471 } else {
1472 sprintf(xorriso->info_text, "-find[ix]: unknown option ");
1473 Text_shellsafe(argv[i], xorriso->info_text, 1);
1474 sorry_ex:;
1475 Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);
1476 {ret= 0; goto ex;}
1477 }
1478 }
1479 if(list_extattr_head) {
1480 sprintf(xorriso->result_line,
1481 "# Output of xorriso %s action list_extattr\n",
1482 (flag & 1) ? "-findx" : "-find");
1483 Xorriso_result(xorriso, 0);
1484 strcpy(xorriso->result_line, "cd ");
1485 if(start_path[0] == '/')
1486 strcat(xorriso->result_line, "/");
1487 else {
1488 cd_pt= (flag & 1) ? xorriso->wdx : xorriso->wdi;
1489 if(cd_pt[0] == 0)
1490 cd_pt= "/";
1491 ret= Xorriso_append_extattr_comp(xorriso, cd_pt, strlen(cd_pt),
1492 list_extattr_mode, 0);
1493 if(ret <= 0)
1494 goto ex;
1495 }
1496 strcat(xorriso->result_line, "\n");
1497 /* temporarily disable -backslash_codes with result output */
1498 bsl_mem= xorriso->bsl_interpretation;
1499 xorriso->bsl_interpretation= 0;
1500 Xorriso_result(xorriso, 0);
1501 xorriso->bsl_interpretation= bsl_mem;
1502
1503 sprintf(xorriso->result_line, "c=\"setextattr\"\n\n");
1504 Xorriso_result(xorriso, 0);
1505 }
1506 if(flag&1)
1507 ret= Xorriso_findx(xorriso, first_job, "", start_path, &dir_stbuf, 0, NULL,
1508 0);
1509 else if(flag & 8) {
1510 cpt= start_path;
1511 ret= Xorriso_findi_sorted(xorriso, first_job, (off_t) 0, 1, &cpt, 0);
1512 } else
1513 ret= Xorriso_findi(xorriso, first_job, NULL, (off_t) 0, NULL,
1514 start_path, &dir_stbuf, 0, (flag&4)>>1);
1515 ex:;
1516 if(deleter && !(flag&2))
1517 Xorriso_pacifier_callback(xorriso, "iso_rr_paths deleted",
1518 xorriso->pacifier_count, 0, "", 1|2);
1519 else if(first_job != NULL && first_job->action == 28 && !(flag&2))
1520 Xorriso_pacifier_callback(xorriso, "file filters processed",
1521 xorriso->pacifier_count, 0, "", 1 | 2);
1522 else if(mem_lut!=xorriso->last_update_time && mem_lut!=0.0 && !(flag&2))
1523 Xorriso_pacifier_callback(xorriso, "content bytes read",
1524 xorriso->pacifier_count, 0, "", 1 | 8 | 32);
1525 if(first_job != NULL && first_job->action == 35 && !(flag & 1))
1526 Xorriso_report_md5_outcome(xorriso, first_job->target, 0);
1527 if(first_job != NULL && first_job->action == 40) {
1528 sprintf(xorriso->result_line,"Size lower : %lus\n",
1529 (unsigned long) (first_job->estim_lower_size / (off_t) 2048));
1530 Xorriso_result(xorriso,0);
1531 sprintf(xorriso->result_line,"Size upper : %lus\n",
1532 (unsigned long) ((first_job->estim_upper_size / (off_t) 2048) +
1533 !!(first_job->estim_upper_size % 2048)));
1534 Xorriso_result(xorriso,0);
1535 }
1536 if(access_acl_text != NULL)
1537 free(access_acl_text);
1538 if(default_acl_text != NULL)
1539 free(default_acl_text);
1540 if(ret > 0 && (flag & 16) && first_job != NULL)
1541 ret= first_job->match_count + 1;
1542 Findjob_destroy(&first_job, 0);
1543 Xorriso_free_meM(path);
1544 Xorriso_free_meM(other_path_start);
1545 (*idx)= end_idx;
1546 return(ret);
1547 }
1548
1549
1550 /* Option -follow */
1551 int Xorriso_option_follow(struct XorrisO *xorriso, char *mode, int flag)
1552 {
1553 int was_fl, was_fm, was_fpr, was_fpt, was_fc, l;
1554 double num;
1555 char *cpt, *npt;
1556
1557 was_fpt= xorriso->do_follow_pattern;
1558 was_fpr= xorriso->do_follow_param;
1559 was_fl= xorriso->do_follow_links;
1560 was_fc= xorriso->do_follow_concat;
1561 was_fm= xorriso->do_follow_mount;
1562 xorriso->do_follow_pattern= 0;
1563 xorriso->do_follow_param= 0;
1564 xorriso->do_follow_links= 0;
1565 xorriso->do_follow_concat= 0;
1566 xorriso->do_follow_mount= 0;
1567 npt= cpt= mode;
1568 for(cpt= mode; npt!=NULL; cpt= npt+1) {
1569 npt= strchr(cpt,':');
1570 if(npt==NULL)
1571 l= strlen(cpt);
1572 else
1573 l= npt-cpt;
1574 if(l==0)
1575 goto unknown_mode;
1576 if(strncmp(cpt, "off", l)==0) {
1577 xorriso->do_follow_pattern= 0;
1578 xorriso->do_follow_param= 0;
1579 xorriso->do_follow_links= 0;
1580 xorriso->do_follow_concat= 0;
1581 xorriso->do_follow_mount= 0;
1582 } else if(strncmp(cpt, "on", l)==0) {
1583 xorriso->do_follow_pattern= 1;
1584 xorriso->do_follow_param= 1;
1585 xorriso->do_follow_links= 1;
1586 xorriso->do_follow_concat= 1;
1587 xorriso->do_follow_mount= 1;
1588 } else if(strncmp(cpt, "default", l)==0) {
1589 xorriso->do_follow_pattern= 1;
1590 xorriso->do_follow_param= 0;
1591 xorriso->do_follow_links= 0;
1592 xorriso->do_follow_concat= 0;
1593 xorriso->do_follow_mount= 1;
1594 xorriso->follow_link_limit= 100;
1595 } else if(strncmp(cpt, "link", l)==0 || strncmp(cpt,"links", l)==0) {
1596 xorriso->do_follow_links= 1;
1597 } else if(strncmp(cpt, "mount", l)==0) {
1598 xorriso->do_follow_mount= 1;
1599 } else if(strncmp(cpt,"param", l)==0) {
1600 xorriso->do_follow_param= 1;
1601 } else if(strncmp(cpt, "pattern", l)==0) {
1602 xorriso->do_follow_pattern= 1;
1603 } else if(strncmp(cpt, "concat", l)==0) {
1604 xorriso->do_follow_concat= 1;
1605 } else if(strncmp(cpt, "limit=", 6)==0) {
1606 sscanf(cpt+6, "%lf", &num);
1607 if(num<=0 || num>1.0e6) {
1608 sprintf(xorriso->info_text, "-follow: Value too %s with '%s'",
1609 num<=0 ? "small" : "large", cpt+6);
1610 goto sorry_ex;
1611 }
1612 xorriso->follow_link_limit= num;
1613 } else {
1614 unknown_mode:;
1615 if(l<SfileadrL)
1616 sprintf(xorriso->info_text, "-follow: unknown mode '%s'", cpt);
1617 else
1618 sprintf(xorriso->info_text, "-follow: oversized mode parameter (%d)",l);
1619 sorry_ex:
1620 Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);
1621 xorriso->do_follow_pattern= was_fpt;
1622 xorriso->do_follow_param= was_fpr;
1623 xorriso->do_follow_links= was_fl;
1624 xorriso->do_follow_concat= was_fc;
1625 xorriso->do_follow_mount= was_fm;
1626 return(0);
1627 }
1628 }
1629 return(1);
1630 }
1631
1632
1633 /* Option -fs */
1634 int Xorriso_option_fs(struct XorrisO *xorriso, char *size, int flag)
1635 {
1636 double num;
1637
1638 num= Scanf_io_size(size, 0);
1639 if(num < 64*1024 || num > 1024.0 * 1024.0 * 1024.0) {
1640 sprintf(xorriso->info_text, "-fs: wrong size %.f (allowed: %.f - %.f)",
1641 num, 64.0 * 1024.0, 1024.0 * 1024.0 * 1024.0);
1642 Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "SORRY", 0);
1643 return(0);
1644 }
1645 xorriso->fs= num / 2048.0;
1646 if(xorriso->fs * 2048 < num)
1647 xorriso->fs++;
1648 return(1);
1649 }
1650
1651
1652 /* Commands -getfacl alias -getfacli, -getfacl_r alias -getfacl_ri
1653 -getfattr alias getfattri
1654 */
1655 /* @param flag bit0= recursive -getfacl_r
1656 bit1= getfattr rather than getfacl
1657 bit3= with bit1: do not ignore eventual non-user attributes
1658 */
1659 int Xorriso_option_getfacli(struct XorrisO *xorriso,
1660 int argc, char **argv, int *idx, int flag)
1661 {
1662 int i, ret, was_failure= 0, end_idx, fret;
1663 int optc= 0;
1664 char **optv= NULL;
1665 struct FindjoB *job= NULL;
1666 struct stat dir_stbuf;
1667
1668 ret= Xorriso_opt_args(xorriso, "-getfacl", argc, argv, *idx, &end_idx, &optc,
1669 &optv, 0);
1670 if(ret<=0)
1671 goto ex;
1672 for(i= 0; i<optc; i++) {
1673 if(flag&1) {
1674 ret= Findjob_new(&job, optv[i], 0);
1675 if(ret<=0) {
1676 Xorriso_no_findjob(xorriso, "-getfacl_r", 0);
1677 {ret= -1; goto ex;}
1678 }
1679 if(flag & 2) {
1680 Findjob_set_action_target(job, 26, NULL, 0);
1681 } else
1682 Findjob_set_action_target(job, 24, NULL, 0);
1683 ret= Xorriso_findi(xorriso, job, NULL, (off_t) 0,
1684 NULL, optv[i], &dir_stbuf, 0, 0);
1685 Findjob_destroy(&job, 0);
1686 } else {
1687 if(flag & 2)
1688 ret= Xorriso_getfattr(xorriso, NULL, optv[i], NULL, flag & 8);
1689 else
1690 ret= Xorriso_getfacl(xorriso, NULL, optv[i], NULL, 0);
1691 }
1692 if(ret>0 && !xorriso->request_to_abort)
1693 continue; /* regular bottom of loop */
1694 was_failure= 1;
1695 fret= Xorriso_eval_problem_status(xorriso, ret, 1|2);
1696 if(fret>=0)
1697 continue;
1698 ret= 0; goto ex;
1699 }
1700 ret= 1;
1701 ex:;
1702 (*idx)= end_idx;
1703 Xorriso_opt_args(xorriso, "-getfacl", argc, argv, *idx, &end_idx,
1704 &optc, &optv, 256);
1705 Findjob_destroy(&job, 0);
1706 if(ret<=0)
1707 return(ret);
1708 return(!was_failure);
1709 }
1710
1711
1712 /* Option -gid */
1713 int Xorriso_option_gid(struct XorrisO *xorriso, char *gid, int flag)
1714 {
1715 int ret;
1716
1717 xorriso->do_global_gid= 0;
1718 if(gid[0]==0 || strcmp(gid,"-")==0)
1719 return(1);
1720 ret= Xorriso_convert_gidstring(xorriso, gid, &(xorriso->global_gid), 0);
1721 if(ret>0)
1722 xorriso->do_global_gid= 1;
1723 return(ret);
1724 }
1725
1726
1727 /* Option -grow_blindly */
1728 int Xorriso_option_grow_blindly(struct XorrisO *xorriso, char *msc2, int flag)
1729 {
1730 double num;
1731 int l;
1732
1733 if(msc2[0]==0 || msc2[0]=='-' || strcmp(msc2, "off")==0) {
1734 xorriso->grow_blindly_msc2= -1;
1735 return(1);
1736 }
1737 num= Scanf_io_size(msc2, 0);
1738 l= strlen(msc2);
1739 if(msc2[l-1]<'0' || msc2[l-1]>'9')
1740 num/= 2048.0;
1741 xorriso->grow_blindly_msc2= num;
1742 return(1);
1743 }
1744
1745
1746 /* Option -hardlinks "on"|"off" */
1747 int Xorriso_option_hardlinks(struct XorrisO *xorriso, char *mode, int flag)
1748 {
1749 int ret;
1750 char *what_data= NULL, *what, *what_next;
1751
1752 Xorriso_alloc_meM(what_data, char, SfileadrL);
1753 if(Sfile_str(what_data, mode, 0)<=0) {
1754 sprintf(xorriso->info_text,
1755 "-hardlinks: mode string is much too long (%d)",
1756 (int) strlen(mode));
1757 Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);
1758 {ret= 0; goto ex;}
1759 }
1760 for(what= what_data; what != NULL; what= what_next) {
1761 what_next= strchr(what, ':');
1762 if(what_next != NULL) {
1763 *what_next= 0;
1764 what_next++;
1765 }
1766 if(strcmp(what, "off") == 0) {
1767 Xorriso_finish_hl_update(xorriso, 0);
1768 xorriso->ino_behavior|= 1 | 2 | 4;
1769 xorriso->ino_behavior&= ~8;
1770 } else if(strcmp(what, "on") == 0) {
1771 xorriso->ino_behavior&= ~(1 | 2 | 4 | 8);
1772 } else if(strcmp(what, "without_update") == 0) {
1773 Xorriso_finish_hl_update(xorriso, 0);
1774 xorriso->ino_behavior&= ~(1 | 2 | 4);
1775 xorriso->ino_behavior|= 8;
1776 } else if(strcmp(what, "start_update") == 0) {
1777 xorriso->ino_behavior&= ~(1 | 2 | 4 | 8);
1778 ret= Xorriso_make_di_array(xorriso, 1);
1779 if(ret <= 0)
1780 goto ex;
1781 } else if(strcmp(what, "end_update") == 0) {
1782 Xorriso_finish_hl_update(xorriso, 0);
1783 } else if(strcmp(what, "perform_update") == 0) {
1784 Xorriso_finish_hl_update(xorriso, 0);
1785 } else if(strcmp(what, "start_extract") == 0) {
1786 xorriso->ino_behavior&= ~(1 | 2 | 4);
1787 ret= Xorriso_make_hln_array(xorriso, 1);
1788 if(ret <= 0)
1789 goto ex;
1790 } else if(strcmp(what, "end_extract") == 0) {
1791 Xorriso_destroy_hln_array(xorriso, 0);
1792 } else if(strcmp(what, "discard_extract") == 0) {
1793 Xorriso_destroy_hln_array(xorriso, 0);
1794 } else if(strcmp(what, "normal_extract") == 0) {
1795 xorriso->ino_behavior&= ~16;
1796 } else if(strcmp(what, "cheap_sorted_extract") == 0) {
1797 xorriso->ino_behavior|= 16;
1798 } else if(strcmp(what, "lsl_count") == 0) {
1799 xorriso->ino_behavior&= ~32;
1800 } else if(strcmp(what, "no_lsl_count") == 0) {
1801 xorriso->ino_behavior|= 32;
1802 } else {
1803 sprintf(xorriso->info_text, "-hardlinks: unknown mode '%s' in '%s'",
1804 what, mode);
1805 Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);
1806 {ret= 0; goto ex;}
1807 }
1808 }
1809
1810 /* <<< ts B00613 : This is wrong: it enables new_rr if -hardlinks is off.
1811 Documented is that new_rr gets enabled if hardlinks are on.
1812 But it never worked that way.
1813 A compromise seems to be to disable this totally and
1814 to change man xorriso.
1815 new_rr still is not recognized by mount on Solaris.
1816
1817 if(xorriso->ino_behavior & 2)
1818 Xorriso_option_compliance(xorriso, "new_rr", 0);
1819 */
1820
1821 ret= 1;
1822 ex:;
1823 Xorriso_free_meM(what_data);
1824 return(ret);
1825 }
1826
1827
1828 /* Option -help and part of -prog_help */
1829 int Xorriso_option_help(struct XorrisO *xorriso, int flag)
1830 {
1831 static char text[][80]={
1832
1833 #ifdef Xorriso_no_helP
1834
1835 "This binary program does not contain a help text.",
1836 "If available, read: man 1 xorriso",
1837
1838 #else
1839
1840 "This program creates, loads, manipulates and writes ISO 9660 filesystem",
1841 "images with Rock Ridge extensions. Write targets can be drives with optical",
1842 "media or local filesystem objects.",
1843 "The program operations are controlled by a sequence of commands, of which",
1844 "the initial ones are given as program arguments or as lines in startup",
1845 "files. Further commands may get read from files in batch mode or from",
1846 "standard input in dialog mode.",
1847 "",
1848 " -x Only in effect if given as program argument:",
1849 " Execute commands given as program arguments in a sequence",
1850 " that most likely makes some sense. Default is to execute",
1851 " program arguments exactly in the sequence as given.",
1852 "",
1853 "Preparation commands:",
1854 "Drive addresses are either /dev/... as listed with command -devices or",
1855 "disk files, eventually with prefix \"stdio:\" if non-CD-drive in /dev tree.",
1856 "E.g. /dev/sr0 , /tmp/pseudo_drive , stdio:/dev/sdc",
1857 " -dev address Set input and output drive and load eventual ISO image.",
1858 " Set the image expansion method to growing.",
1859 " -indev address Set input drive and load eventual ISO image. Use expansion",
1860 " methods modifying or blind growing.",
1861 " -outdev address",
1862 " Set output drive and use modifying or blind growing.",
1863 " -drive_class \"harmless\"|\"banned\"|\"risky\"|\"clear_list\" disk_pattern",
1864 " Add a drive path pattern to one of the safety lists or make",
1865 " those lists empty. Defaulty entry in \"risky\" is \"/dev\".",
1866 " -drive_access \"exclusive\"|\"shared\":\"unrestricted\"|\"readonly\"",
1867 " Enable or disable device file locking mechanisms.",
1868 " Enable or disable status and content changes of drive.",
1869 " -scsi_dev_family \"default\"|\"sr\"|\"scd\"|\"sg\"",
1870 " Linux specific: Choose device file type.",
1871 " -read_speed number[\"k/s\"|\"[x]CD\"|\"[x]DVD\"|\"[x]BD\"]|keyword",
1872 " Set the read speed. Default is \"none\" = do not set speed",
1873 " before reading. Prefix \"soft_force:\" enables slowdown by",
1874 " software.",
1875 " -grow_blindly \"off\"|predicted_nwa",
1876 " Switch between modifying and blind growing.",
1877 " -load \"session\"|\"track\"|\"lba\"|\"sbsector\"|\"volid\"|\"auto\" id",
1878 " Load a particular (outdated) ISO session from a -dev or",
1879 " -indev which hosts more than one session.",
1880 " -displacement [-]block_address",
1881 " When loading ISO tree or reading data files compensate a",
1882 " displacement versus the start address for which the image",
1883 " was prepared.",
1884 " -read_fs \"any\"|\"norock\"|\"nojoliet\"|\"ecma119\"",
1885 " Specify which kind of filesystem tree to load if present.",
1886 " -rom_toc_scan \"on\"|\"force\"|\"off\"[:\"emul_on\"|\"emul_off\"]",
1887 " [:\"emul_wide\"|\"emul_narrow\"]",
1888 " Enable scanning for ISO sessions on read-only drives/media",
1889 " and on overwritable media with emulated TOC.",
1890 " -calm_drive \"in\"|\"out\"|\"all\"|\"on\"|\"off\"",
1891 " Reduce drive noise until it gets actually used again.",
1892 " -assert_volid pattern severity",
1893 " Accept input image only if its volume id matches pattern.",
1894 " -charset name Set the character set name to be used for file name",
1895 " conversion from and to media.",
1896 " -in_charset name",
1897 " Like -charset but only for conversion from media.",
1898 " -auto_charset \"on\"|\"off\"",
1899 " Enable writing and reading of character set name in image.",
1900 " -out_charset name",
1901 " Like -charset but only for conversion to media.",
1902 " -local_charset name",
1903 " Override system assumption of the local character set name.",
1904 " -hardlinks mode[:mode ...]",
1905 " Enable or disable recording and restoring of hard links.",
1906 " Modes are \"on\", \"off\", \"perform_update\",",
1907 " \"without_update\", \"discard_extract\",",
1908 " \"cheap_sorted_extract\", \"normal_extract\"",
1909 " -acl \"on\"|\"off\"",
1910 " Enable or disable reading and writing of ACLs.",
1911 " -xattr \"on\"|\"user\"|\"any\"|\"off\"",
1912 " Enable or disable reading and writing of xattr.",
1913 " -md5 \"on\"|\"all\"|\"off\"",
1914 " Enable or disable processing of MD5 checksums.",
1915 " -for_backup",
1916 " Shortcut for: -hardlinks on -acl on -xattr any -md5 on",
1917 " -ecma119_map \"unmapped\"|\"stripped\"|\"uppercase\"|\"lowercase\"",
1918 " Choose conversion of file names if neither Rock Ridge",
1919 " nor Joliet is present in the loaded ISO session.",
1920 " -joliet_map \"unmapped\"|\"stripped\"",
1921 " Choose conversion of file names if the Joliet tree is read",
1922 " when loading the ISO session.",
1923 " -iso_nowtime \"dynamic\"|timestring",
1924 " Choose use of current time or a fixed point in time for",
1925 " timestamps where libisofs would normally use the current",
1926 " (i.e. dynamic) time.",
1927 " -disk_dev_ino \"on\"|\"ino_only\"|\"off\"",
1928 " Enable or disable recording of disk file dev_t and ino_t",
1929 " and their use in file comparison.",
1930 " -scdbackup_tag list_path record_name",
1931 " Enable production of scdbackup tag with -md5 on",
1932 " -ban_stdio_write",
1933 " Allow for writing only the usage of optical drives.",
1934 " -early_stdio_test \"on\"|\"appendable_wo\"|\"off\"",
1935 " Classify stdio drives by effective access permissions.",
1936 " -data_cache_size number_of_tiles blocks_per_tile",
1937 " Adjust size and granularity of the data read cache.",
1938 " -blank [\"force:\"]\"fast\"|\"all\"|\"deformat\"|\"deformat_quickest\"",
1939 " Blank medium or invalidate ISO image on medium.",
1940 " Prefix \"force:\" overrides medium evaluation.",
1941 " -truncate_overwritable entity id adjust",
1942 " Activate an older session on overwritable medium. Adjust",
1943 " its size to some value not smaller than original old size.",
1944 " -close_damaged \"as_needed\"|\"force\"",
1945 " Close track and session of damaged medium.",
1946 " -format \"as_needed\"|\"full\"|\"fast\"|\"by_index_#\"|\"by_size_#\"",
1947 " Format BD-RE, BD-R, DVD-RAM, DVD-RW, DVD+RW.",
1948 " -volid volume_id",
1949 " Specifies the volume ID text. (32 chars out of [A-Z0-9_])",
1950 " -volset_id name",
1951 " Specifies the volume set id. (128 chars)",
1952 " -publisher name",
1953 " Specifies the publisher name. (128 chars)",
1954 " -application_id name",
1955 " Specifies the application id. (128 chars)",
1956 " -system_id name",
1957 " Specifies the system id for the System Area. (32 chars)",
1958 " -volume_date type timestring",
1959 " Specifies volume timestamps. [\"c\",\"m\",\"x\",\"f\",\"uuid\"]",
1960 " -copyright_file name",
1961 " Specifies the name of the Copyright File. (37 chars)",
1962 " -biblio_file name",
1963 " Specifies the name of the Bibliographic File. (37 chars)",
1964 " -abstract_file name",
1965 " Specifies the name of the Abstract File. (37 chars)",
1966 " -application_use character|0xXY|disk_path",
1967 " Specifies the content of Application Use field. (512 bytes)",
1968 " A single character or a hex code gets repeated 512 times.",
1969 " Other text gets opened as data file and 512 bytes are read.",
1970 " -joliet \"on\"|\"off\"",
1971 " Generate Joliet info additional to Rock Ridge info.",
1972 " -hfsplus \"on\"|\"off\"",
1973 " Generate a HFS+ partition and filesystem within ISO image.",
1974 " -rockridge \"on\"|\"off\"",
1975 " Opportunity to omit Rock Ridge info. (Do not do it !)",
1976 " -jigdo \"clear\"|\"template_path\"|\"jigdo_path\"|\"md5_path\"",
1977 " |\"min_size\"|\"checksum_iso\"|\"checksum_template\"",
1978 " |\"checksum_path\"|\"demand_checksum\"|\"checksum_algorithm\"",
1979 " |\"compression\"|\"exclude\"|\"demand_md5\"|\"mapping\"",
1980 " |\"checksum_iso\"|\"checksum_template\"",
1981 " value",
1982 " Clear Jigdo Template Extraction parameter list or add a",
1983 " parameter with its value to that list.",
1984 " -compliance rule[:rule...]",
1985 " Allow more or less harmless deviations from strict standards",
1986 " compliance.",
1987 " -rr_reloc_dir name",
1988 " Specifies name of relocation directory in root directory,",
1989 " to which deep subtrees will get relocated if -compliance",
1990 " is set to \"deep_paths_off\".",
1991 " -boot_image \"any\"|\"isolinux\"|\"grub\"",
1992 " |\"discard\"|\"keep\"|\"patch\"|\"replay\"",
1993 " |\"dir=\"|\"bin_path=\"",
1994 " |\"cat_path=\"|\"cat_hidden=on|iso_rr|joliet|off\"",
1995 " |\"load_size=\"|\"boot_info_table=\"",
1996 " |\"grub2_boot_info=\"|\"grub2_mbr=\"|\"partition_offset=\"",
1997 " |\"partition_hd_cyl=\"|\"partition_sec_hd=\"",
1998 " |\"partition_cyl_align=\"|\"mbr_force_bootable=\"",
1999 " |\"system_area=\"|\"partition_table=on|off\"",
2000 " |\"partition_entry=\"|\"appended_part_as=\"",
2001 " |\"part_like_isohybrid=\"|\"iso_mbr_part_type=\"",
2002 " |\"gpt_disk_guid=\"|\"gpt_iso_bootable\"|\"gpt_iso_not_ro=\"",
2003 " |\"chrp_boot_part=on|off=\"|\"prep_boot_part=\"",
2004 " |\"efi_boot_part=\"|\"efi_boot_part=--efi-boot-image\"",
2005 " |\"mips_path=\"|\"mipsel_path=\"|\"mips_discard\"",
2006 " |\"sparc_label=\"|\"grub2_sparc_core=\"|\"sparc_discard\"",
2007 " |\"hppa_cmdline=\"|\"hppa_bootloader=\"|\"hppa_kernel_32=\"",
2008 " |\"hppa_kernel_64=\"|\"hppa_ramdisk=\"|\"hppa_hdrversion=\"",
2009 " |\"hppa_discard\"|\"alpha_boot=\"|\"alpha_discard\"",
2010 " |\"hfsplus_serial=\"|\"hfsplus_block_size=\"",
2011 " |\"apm_block_size=\"|\"show_status\"",
2012 " Whether to discard or keep an exiting El Torito boot image,",
2013 " or to freshly set up boot equipment. \"replay\" performs",
2014 " the commands proposed by -report_system_area \"cmd\".",
2015 " ISOLINUX can be made bootable by dir=/ or dir=/isolinux",
2016 " or dir=/boot/isolinux. Others, like GRUB, by bin_path=...",
2017 " and cat_path=...",
2018 " The boot image and its helper files need to be added to the",
2019 " ISO image by the usual commands like -map or -add.",
2020 " system_area= and partition_table= are for MBR based booting",
2021 " from USB stick. The system_area= file needs not to be added.",
2022 " chrp_boot_part= and prep_boot_part= are for PowerPC.",
2023 " efi_boot_part= is for booting EFI systems from USB stick.",
2024 " mips_path= adds Big Endian MIPS boot files. mipsel_path=",
2025 " sets one Little Endian MIPS boot file. sparc_label=",
2026 " activates SUN Disk Label. hppa_* is for HP PA-RISC via PALO.",
2027 " alpha_boot= is for DEC Alpha SRM. MIPS, SUN, HP, and Alpha",
2028 " are mutually exclusive and exclusive to production",
2029 " of MBR and to booting via EFI from USB stick.",
2030 " -append_partition partition_number type_code disk_path",
2031 " Append a prepared filesystem image after the end of the",
2032 " ISO image. Caution: Will be overwritten by multi-session.",
2033 "",
2034 " -uid uid User id to be used for the whole multi-session ISO image.",
2035 " -gid gid Group id for the same purpose.",
2036 "",
2037 " -devices Show list of available optical drives and their addresses.",
2038 " -device_links Like devices, but showing link paths which are hopefully",
2039 " persistent over reboot on modern Linux systems.",
2040 "",
2041 " -toc Show media specific tables of content (sessions).",
2042 " -toc_of \"in\"|\"out\"|\"all\"[\":short\"]",
2043 " Show -toc of either input drive or output drive or both.",
2044 "",
2045 " -assess_indev_features \"plain\"|\"cmd\"|\"as_mkisofs\"|\"replay\"",
2046 " Inspect the filesystem on -indev for features like ISO level,",
2047 " Rock Ridge, or file name relaxations.",
2048 "",
2049 " -mount_cmd drive entity id path",
2050 " Print to result channel a command suitable to mount the",
2051 " depicted entity (see -load) at the given directory path.",
2052 " -mount_opts \"exclusive\"|\"shared\"",
2053 " Set options for -mount and -mount_cmd.",
2054 " -session_string drive entity id \"linux:\"path|\"freebsd:\"path|form",
2055 " Print foreign OS command or custom line.",
2056 "",
2057 " -list_formats Show media specific list of format descriptors.",
2058 "",
2059 " -list_speeds Show media specific list of write speed descriptors.",
2060 "",
2061 " -list_profiles \"in\"|\"out\"|\"all\"",
2062 " Show list of media types supported by indev and/or outdev.",
2063 " -print_size Print the foreseeable consumption by next -commit.",
2064 "",
2065 " -tell_media_space",
2066 " Print foreseeable available space on output medium",
2067 " -pvd_info Print various id strings of the loaded ISO image.",
2068 "",
2069 " -report_el_torito \"plain\"|\"help\"|\"cmd\"|\"as_mkisofs\"",
2070 " \"plain\" prints information about the El Torito boot catalog",
2071 " and boot images of the loaded ISO image.",
2072 " \"help\" prints an explanation of the output format.",
2073 " \"cmd\" and \"as_mkisofs\" propose commands to reproduce",
2074 " the boot equipment reported by -report_el_torito \"plain\"",
2075 " and -report_system_area \"plain\"",
2076 " -report_system_area \"plain\"|\"help\"|\"gpt_crc_of:\"disk_path",
2077 " |\"cmd\"|\"as_mkisofs\"",
2078 " \"plain\" prints information about recognized data",
2079 " \"help\" prints an explanation of the output format.",
2080 " in the System Area of the loaded ISO image: MBR, GPT, ...",
2081 " \"gpt_crc_of:\" prints GPT CRC of file disk_path.",
2082 " For \"cmd\" and \"as_mkisofs\" see -report_el_torito.",
2083 "",
2084 "Commands with variable length path list [...] need the list delimiter text",
2085 "as end mark if they are followed by another command. By default this",
2086 "delimiter is \"--\". In dialog and with commands read from files, the line",
2087 "end serves as such a mark. With program arguments this mark can be omitted",
2088 "only with the last command in the list of program arguments.",
2089 "For brevity the list delimiter is referred as \"--\" throughout this text.",
2090 "",
2091 " -list_delimiter text Set the list delimiter to be used instead of \"--\"",
2092 " It has to be a single word, must not be empty, not longer",
2093 " than 80 characters, may not contain quotation marks.",
2094 "",
2095 "Manipulation commands:",
2096 "disk_path is a path to an object in the local filesystem tree.",
2097 "iso_rr_path is the Rock Ridge name of a file object in the ISO image.",
2098 "pathspec is either a disk_path or (if allowed) a pair: iso_rr_path=disk_path",
2099 "Commands marked by [***] have variable length parameter lists and perform",
2100 "pattern expansion if enabled by -iso_rr_pattern or -disk_pattern.",
2101 "",
2102 " -pathspecs \"on\"|\"off\"|\"as_mkisofs\"",
2103 " Allow or disallow pathspecs of form iso_rr_path=disk_path",
2104 " Only \"off\" allows -disk_pattern expansion.",
2105 " -file_name_limit number",
2106 " Set truncation size for file names [64 ... 255].",
2107 " -file_size_limit value [...]",
2108 " Set limit for file content size. One or more numbers to add.",
2109 " -add pathspec [...] | disk_path [***]",
2110 " Insert the given files or directory trees from",
2111 " filesystem into the ISO image. Much like mkisofs.",
2112 " -add_plainly \"none\"|\"unknown\"|\"dashed\"|\"any\"",
2113 " Whether to add lonely arguments as pathspec or disk_path.",
2114 " -path_list disk_path",
2115 " Like -add but read the pathspecs from file disk_path.",
2116 " -quoted_path_list disk_path",
2117 " Like -path_list but with line rules as -dialog \"on\".",
2118 "",
2119 " -map disk_path iso_rr_path",
2120 " Insert disk file object at the given iso_rr_path.",
2121 " -map_single disk_path iso_rr_path",
2122 " Like -map but with directory do not insert its sub tree.",
2123 " -map_l disk_prefix iso_rr_prefix disk_path [***]",
2124 " Performs -map with each disk_path.",
2125 " -update disk_path iso_rr_path",
2126 " Compare both file objects and do what is necessary to make",
2127 " iso_rr_path a matching copy of disk_path.",
2128 " -update_r disk_path iso_rr_path",
2129 " Like -update but affecting all files below directories.",
2130 " -update_l disk_prefix iso_rr_prefix disk_path [***]",
2131 " Performs -update_r with each disk_path.",
2132 " -update_li iso_rr_prefix disk_prefix iso_rr_path [***]",
2133 " Performs -update_r with each iso_rr_path.",
2134 " -update_lxi disk_prefix iso_rr_prefix disk_or_iso_rr_path [***]",
2135 " Performs -update_r with each disk_path or corresponding",
2136 " iso_rr_path after exchange of disk_prefix by iso_rr_prefix.",
2137 " -cut_out disk_path byte_offset byte_count iso_rr_path",
2138 " Map a byte interval of a regular disk file into a regular",
2139 " file in the ISO image.",
2140 "",
2141 " -cpr disk_path [***] iso_rr_path",
2142 " Insert the given files or directory trees from filesystem",
2143 " into the ISO image, according to the rules of cp -r.",
2144 "",
2145 " -rm iso_rr_path [***]",
2146 " Delete the given files from the ISO image.",
2147 " -rm_r iso_rr_path [***]",
2148 " Delete the given directory trees from ISO image.",
2149 " -move iso_rr_path iso_rr_path",
2150 " Rename the single file given by the first iso_rr_path to",
2151 " the second iso_rr_path.",
2152 " -mv iso_rr_path [***] iso_rr_path",
2153 " Like shell command mv rename the given file objects in the",
2154 " ISO tree to the last of the iso_rr_path parameters.",
2155 " -chown uid iso_rr_path [***]",
2156 " Equivalent to chown in the ISO image.",
2157 " -chown_r uid iso_rr_path [***]",
2158 " Like -chown but affecting all files below directories.",
2159 " -chgrp gid iso_rr_path [***]",
2160 " Equivalent to chgrp in the ISO image.",
2161 " -chgrp_r gid iso_rr_path [***]",
2162 " Like -chgrp but affecting all files below directories.",
2163 " -chmod mode iso_rr_path [***]",
2164 " Equivalent to chmod in the ISO image.",
2165 " -chmod_r mode iso_rr_path [***]",
2166 " Like -chmod but affecting all files below directories.",
2167 " -setfacl acl_text iso_rr_path [***]",
2168 " Replace the permissions and eventual ACL of the given files",
2169 " in the ISO image by the ACL which is defined by acl_text.",
2170 " -setfacl_r acl_text iso_rr_path [***]",
2171 " Like -setfacl but affecting all files below directories.",
2172 " -setfacl_list disk_path",
2173 " Read output of getfacl from file disk_path. Set owner,",
2174 " group and ACL of the iso_rr_path given by line \"# file:\".",
2175 " -setfattr [-]name value iso_rr_path [***]",
2176 " Set xattr pair with the given name to the given value, or",
2177 " delete pair if name is prefixed with \"-\" and value is",
2178 " an empty text.",
2179 " -setfattr_r [-]name value iso_rr_path [***]",
2180 " Like -setfattr but affecting all files below directories.",
2181 " -setfattr_list disk_path",
2182 " Read output of getfattr from file disk_path. Replace the",
2183 " xattr of the iso_rr_path given by line \"# file:\".",
2184 " -alter_date type timestring iso_rr_path [***]",
2185 " Alter the date entries of a file in the ISO image. type is",
2186 " one of \"a\", \"m\", \"b\" for:",
2187 " access time, modification time, both times.",
2188 " -alter_date_r type timestring iso_rr_path [***]",
2189 " Like -alter_date but affecting all files below directories.",
2190 " -hide on|iso_rr:joliet:hfsplus|off iso_rr_path [***]",
2191 " Keep names of files out of directory trees, but store their",
2192 " data content in the image.",
2193 " -find iso_rr_path [test [op] [test ...]] [-exec action [params]]",
2194 " performs an action on files below the given directory in",
2195 " the ISO image. Tests:",
2196 " -name pattern, -wholename pattern, -disk_name pattern,",
2197 " -type b|c|d|p|f|l|s|e, -pending_data, -hidden,",
2198 " -lba_range start count, -damaged, -has_acl, -has_xattr,",
2199 " -has_aaip, -has_filter, -has_md5, -has_any_xattr,",
2200 " -has_hfs_crtp, -has_hfs_bless, -bad_outname,",
2201 " -name_limit_blocker, -maxdepth, -mindepth, -size,",
2202 " -prune, -decision yes|no, -true, -false",
2203 " Operators: -not, -or, -and, -sub, (, -subend, ),",
2204 " -if, -then, -elseif, -else, -endif",
2205 " Action may be one of: echo, chown, chown_r, chgrp, chgrp_r,",
2206 " chmod, chmod_r, alter_date, alter_date_r, set_to_mtime,",
2207 " lsdl, compare, rm, rm_r, compare, update, report_damage,",
2208 " report_lba, report_sections,",
2209 " getfacl, setfacl, getfattr, setfattr, get_any_xattr,",
2210 " list_extattr, get_md5, check_md5, make_md5,",
2211 " set_hfs_crtp, get_hfs_crtp, set_hfs_bless, get_hfs_bless,",
2212 " set_filter, show_stream, show_stream_id, mkisofs_r,",
2213 " hide, print_outname, estimate_size, find",
2214 " params are their parameters except iso_rr_path.",
2215 " -mkdir iso_rr_path [...]",
2216 " Create empty directories if they do not exist yet.",
2217 " -lns target_text iso_rr_path",
2218 " Create a symbolic link pointing to target_text",
2219 " -rmdir iso_rr_path [***]",
2220 " Delete empty directories.",
2221 " -clone iso_rr_path_original iso_rr_path_copy",
2222 " Create an ISO copy of an ISO file or ISO directory tree.",
2223 " -cp_clone iso_rr_path_original [***] iso_rr_path_dest",
2224 " Create ISO to ISO copies according to the rules of cp -r.",
2225 "",
2226 " -- Default list delimiter marking the end of command parameter",
2227 " lists. It may be changed by command -list_delimiter.",
2228 "",
2229 " -not_paths disk_path [***]",
2230 " Add the given paths to the list of excluded absolute paths.",
2231 " -not_leaf pattern",
2232 " Add the given pattern to the list of leafname exclusions.",
2233 " -not_list disk_path",
2234 " Read lines from disk_path and use as -not_paths (with \"/\")",
2235 " or as -not_leaf (without \"/\").",
2236 " -quoted_not_list disk_path",
2237 " Like -not_list but with line rules as -dialog \"on\".",
2238 " -not_mgt \"reset\"|\"on\"|\"off\"|\"param_on\"|\"subtree_on\"|\"ignore_on\"",
2239 " Control effect of exclusion lists.",
2240 " -follow \"on\"|\"pattern:param:link:concat:mount:limit=#\"|\"default\"|\"off\"",
2241 " Follow symbolic links and mount points within disk_path.",
2242 " -overwrite \"on\"|\"nondir\"|\"off\"",
2243 " Allow or disallow to overwrite existing files in ISO image.",
2244 " -split_size number[\"k\"|\"m\"]",
2245 " Set the threshold for automatic splitting of regular files.",
2246 " -reassure \"on\"|\"tree\"|\"off\"",
2247 " If \"on\" then ask the user for \"y\" or \"n\" with any",
2248 " file before deleting or overwriting it in the ISO image.",
2249 "",
2250 "Filter commands:",
2251 "External filter processes may produce synthetic file content by reading the",
2252 "original content from stdin and writing to stdout whatever they want.",
2253
2254 #ifdef Xorriso_allow_external_filterS
2255
2256 " -external_filter name option[:option] program_path [arguments] --",
2257 " Define an external filter. Options are: suffix=...: ",
2258 " remove_suffix:if_nonempty:if_reduction:if_block_reduction.",
2259 " -unregister_filter name",
2260 " Undefine an external filter.",
2261 " -close_filter_list",
2262 " Irrevocably ban -external_filter and -unregister_filter.",
2263
2264 #else
2265
2266 "Sorry: The use of external filters was not enabled at compile time.",
2267 " E.g. by ./configure option --enable-external-filters",
2268
2269 #endif /* ! Xorriso_allow_external_filterS */
2270
2271 " -set_filter name iso_rr_path [***]",
2272 " Apply a defined filter to the given data files.",
2273 " Special name \"--remove-all-filters\" revokes filtering.",
2274 " Builtin filters are --gzip , --gunzip, --zisofs .",
2275 " -set_filter_r name iso_rr_path [***]",
2276 " Like -set_filter but affecting all files below directories.",
2277 "",
2278 "zisofs is a compression format which is recognized by some Linux kernels.",
2279 "xorriso supports it by builtin filter \"--zisofs\" which is to be applied by",
2280 "the user, and by \"--zisofs-decode\" which is applied automatically when",
2281 "compressed content is detected with a file in the ISO image.",
2282 " -zisofs option[:options]",
2283 " Set global zisofs parameters:",
2284 " level=0|...|9 , block_size=32k|64k|128k , by_magic=on|off",
2285 " version_2=off|as_needed|on , block_size_v2=32k|...|1024k",
2286 " max_bpt=1k...128g , max_bpt_f=1k...128g , bpt_target=num",
2287 " bpt_free_ratio=-1|[0.0...1.0] , susp_z2=off|on"
2288 "",
2289 "Write-to-media commands:",
2290 " -rollback Discard the manipulated ISO image and reload it.",
2291 "",
2292 " -changes_pending \"no\"|\"yes\"|\"mkisofs_printed\"|\"show_status\"",
2293 " Override the automatically determined change status of the",
2294 " loaded image, or show the current status.",
2295 " -commit Perform the write operation if changes are pending.",
2296 " Then perform -dev outdrive.",
2297 " Hint: To perform a final write operation with no new -dev",
2298 " and no new loading of image, execute command -end.",
2299 " -commit_eject \"in\"|\"out\"|\"all\"|\"none\"",
2300 " Like -commit but rather eject than load image from outdrive.",
2301 " Give up any unejected drive afterwards.",
2302 " -write_type \"auto\"|\"tao\"|\"sao/dao\"",
2303 " Set write type for CD-R[W], DVD-R[W], DVD+R, BD-R.",
2304 " -close \"on\"|\"off\"|\"as_needed\"",
2305 " If \"on\" then mark the written medium as not appendable.",
2306 " -padding number[\"k\"|\"m\"]|\"included\"|\"appended\"",
2307 " Append extra bytes to image stream. (Default is 300k)",
2308 " -dummy \"on\"|\"off\"",
2309 " If \"on\" simulate burning. Refuse if medium cannot simulate.",
2310 " -speed number[\"k/s\"|\"m/s\"|\"[x]CD\"|\"[x]DVD\"|\"[x]BD\"]",
2311 " Set the burn speed. Default is \"max\" = maximum speed.",
2312 " -stream_recording \"on\"|\"off\"",
2313 " Try to circumvent slow checkread on DVD-RAM, BD-RE, BD-R.",
2314 " -modesty_on_drive [\"on\"|\"off\"|min_percent_number]",
2315 " [:\"min_percent=\"number][:\"max_percent=\"number]",
2316 " [:\"min_usec=\"number][:\"max_usec\"=number]",
2317 " [:\"timeout_sec=\"number]",
2318 " Keep drive buffer hungry to ease concurrent burn run.",
2319 " -dvd_obs \"default\"|\"32k\"|\"64k\"|\"obs_pad\"|\"bdr_obs_exempt\"",
2320 " Set number of bytes per DVD/BD write operation or control",
2321 " end alignment padding with DAO DVD-R[W] or BD-R.",
2322 " -use_immed_bit \"on\"|\"off\"|\"default\"",
2323 " Control whether long running SCSI commands shall run",
2324 " asynchronously with progress messages.",
2325 " -stdio_sync \"on\"|\"off\"|\"end\"|number",
2326 " Set number of bytes after which to force output to stdio",
2327 " pseudo drives. \"on\" is the same as 16m.",
2328 " -fs number[\"k\"|\"m\"]",
2329 " Set the size of the fifo buffer. (Default is 4m)",
2330 " -eject \"in\"|\"out\"|\"all\"",
2331 " Immediately eject the medium in -indev, -outdev, or both.",
2332 "",
2333 "Navigation commands:",
2334 "",
2335 " -cd iso_rr_path Change working directory in the ISO image. iso_rr_paths",
2336 " which do not begin with '/' will be inserted beginning at",
2337 " the path given with -cd. -ls patterns will eventually",
2338 " looked up at this path.",
2339 " -cdi disk_path Same as -cd disk_path",
2340 " -cdx disk_path Change the current working directory in the local",
2341 " filesystem. disk_paths which do not begin with '/'",
2342 " will be looked up beginning at the path given with -cdx.",
2343 " -lsx patterns will eventually be looked up at this path.",
2344 " -pwd tells the current working directory in the ISO image.",
2345 " -pwdi same as -pwd.",
2346 " -pwdx tells the current working directory in the local filesystem.",
2347 "",
2348 " -iso_rr_pattern \"on\"|\"ls\"|\"off\"",
2349 " Enable or disable pattern expansions for ISO image commands",
2350 " marked by [***]. \"ls\" restricts it to -ls and -du.",
2351 " -disk_pattern \"on\"|\"ls\"|\"off\"",
2352 " Enable or disable pattern expansions for local filesystem",
2353 " commands marked by [***]. \"ls\" restricts to -ls*x and -du*x.",
2354 "",
2355 " -ls pattern [***] lists files of the ISO image which match one of the",
2356 " given shell parser patterns. (I.e. wildcards '*' '?').",
2357 " Directories are listed by their content.",
2358 " -lsd pattern [***] like -ls but listing directories as single items.",
2359 " -lsl pattern [***] like -ls but also telling some file attributes.",
2360 " -lsdl pattern [***] like -lsd but also telling some file attributes.",
2361 "",
2362 " -lsx pattern [***] lists files of the local filesystem which match one",
2363 " of the patterns. Directories are listed by their content.",
2364 " -lsdx pattern [***] like -lsx but listing directories as single items.",
2365 " -lslx pattern [***] like -lsx but also telling some file attributes.",
2366 " -lsdlx pattern [***] like -lsdx but also telling some file attributes.",
2367 " -getfacl pattern [***] list eventual ACLs of the given files.",
2368 " -getfacl_r pattern [***] like -getfacl but listing whole file trees.",
2369 " -getfattr pattern [***] list eventual xattr of the given files.",
2370 " -getfxattr_r pattern [***] like -getfxattr but listing whole file trees.",
2371 "",
2372 " -du pattern [***] recursively lists sizes of files or directories in the",
2373 " ISO image which match one of the shell parser patterns.",
2374 " -dux pattern [***] recursively lists sizes of files or directories in the",
2375 " local filesystem which match one of the shell parser",
2376 " patterns.",
2377 " -dus pattern [***] like -du but summing up subdirectories without",
2378 " listing them explicitly.",
2379 " -dusx pattern [***] like -dux but summing up subdirectories without",
2380 " listing them explicitly.",
2381 "",
2382 " -findx disk_path [-name pattern] [-type t] [-exec action [params]]",
2383 " Like -find but operating on local filesystem. Most -exec",
2384 " actions are defaulted to action echo. Supported actions are:",
2385 " in_iso, not_in_iso, is_full_in_iso, add_missing,",
2386 " empty_iso_dir",
2387 "",
2388 " -compare disk_path iso_rr_path",
2389 " compare attributes and in case of regular data files the",
2390 " content of filesystem object and ISO object.",
2391 " -compare_r disk_path iso_rr_path",
2392 " Like -compare but affecting all files below directories.",
2393 " -compare_l disk_prefix iso_rr_prefix disk_path [***]",
2394 " Performs -compare_r with each disk_path.",
2395 "",
2396 " -show_stream iso_rr_path [***]",
2397 " Show content stream chain of data files in the ISO image.",
2398 " -show_stream_r iso_rr_path [***]",
2399 " Like -show_stream but affecting all files below directories.",
2400 "",
2401 "Restore commands which copy file objects from ISO image to disk filesystem:",
2402 " -osirrox \"on\"|\"device_files\"|\"off\"|\"blocked\"|\"unblock\"|\"banned\"",
2403 " [:\"concat_split_on\"|\"concat_split_off\"]",
2404 " [:\"auto_chmod_on\"|\"auto_chmod_off\"]",
2405 " [:\"sort_lba_on\"|\"sort_lba_off\"]",
2406 " [:\"strict_acl_on\"|\"strict_acl_off\"]",
2407 " [:\"check_md5_on\"|\"check_md5_off\"|\"check_md5_force\"]",
2408 " [:\"sparse=off\"|\"sparse=\"number]",
2409 " By default \"off\" the inverse operation of xorriso from ISO",
2410 " image to disk filesystem is disabled. \"on\" allows xorriso",
2411 " to create, overwrite, delete files in the disk filesystem.",
2412 " \"banned\" is irrevocably \"off\". \"blocked\" can only be",
2413 " revoked by \"unblock\". (\"device_files\" is dangerous.)",
2414 " -extract iso_rr_path disk_path",
2415 " Copy tree under iso_rr_path onto disk address disk_path.",
2416 " This avoids the pitfalls of cp -r addressing rules.",
2417 " -extract_l iso_rr_prefix disk_prefix iso_rr_path [***]",
2418 " Perform -extract with each iso_rr_path.",
2419 " -extract_single iso_rr_path disk_path",
2420 " Like -extract but with directory do not restore sub tree.",
2421 " -extract_cut iso_rr_path byte_offset byte_count disk_path",
2422 " Copy a byte interval from iso_rr_path to disk_path.",
2423 " This is governed in part by -check_media_defaults.",
2424 " -extract_boot_images disk_path",
2425 " Copy boot images into files in directory disk_path with",
2426 " names which tell the role inside the ISO.",
2427 " -cpx iso_rr_path [***] disk_path",
2428 " Copy leaf file objects from ISO image to disk filesystem.",
2429 " -cpax iso_rr_path [***] disk_path",
2430 " Like -cpx but trying to restore timestamps and ownership.",
2431 " -cp_rx iso_rr_path [***] disk_path",
2432 " Copy directory trees from ISO image to disk filesystem.",
2433 " -cp_rax iso_rr_path [***] disk_path",
2434 " Like -cp_rx but trying to restore timestamps and ownership.",
2435 " -paste_in iso_rr_path disk_path byte_offset byte_count",
2436 " Copy ISO file content into a byte interval of a disk file.",
2437 " -concat \"append\"|\"overwrite\" target iso_rr_path [***]",
2438 " Write content of iso_rr_paths into disk file target. Target",
2439 " may be a disk_path or \"-\" for writing to standard output.",
2440 " -concat \"pipe\" lim prog [args [...]] lim iso_rr_path [***]",
2441 " Start prog with given args and write content of iso_rr_paths",
2442 " into its standard input. prog must at least contain one '/'.",
2443 " lim may be any word that is not among prog and args.",
2444 " -mount drive entity id path",
2445 " Like -mount_cmd but actually performing that command if",
2446 " not setuid or setgid is active.",
2447 "",
2448 "Evaluation of readability:",
2449 " -check_media [options] --",
2450 " Try to read data blocks from the medium and report about the",
2451 " outcome. Several options modify the behavior:",
2452 " use=indev|outdev , what=track|session ,",
2453 " min_lba=blockadr , max_lba=blockadr ,",
2454 " abort_file=path , time_limit=seconds , item_limit=number ,",
2455 " retry=on|off|default , data_to=filepath ,",
2456 " sector_map=filepath , map_with_volid=on|off ,",
2457 " patch_lba0=on|off|force|blockadr[:force] ,",
2458 " report=blocks|files|blocks_files event=severity ,",
2459 " bad_limit=quality , slow_limit=seconds , chunk_size=bytes",
2460 " -check_media_defaults [options] --",
2461 " Preset options for runs of -check_media and -extract_cut.",
2462 "",
2463 "Compatibility emulation (option list may be ended by list delimiter --):",
2464 " -as mkisofs [-help|-version|-o|-R|-r|-J|-V|-P|-f|-m|-exclude-list|",
2465 " -no-pad|-M|-C|-graft-points|-path-list|pathspecs|-z|",
2466 " -no-emul-boot|-b|-c|-boot-info-table|-boot-load-size|-G|...]",
2467 " Perform some mkisofs gestures, understand pathspecs as mkisofs",
2468 " does. Commit happens outside emulation at usual occasions.",
2469 " For a list of options see -as mkisofs -help.",
2470 " -read_mkisofsrc",
2471 " Read and interpret the .mkisofsrc configuration file.",
2472 " -as cdrecord [-help|-v|dev=|speed=|blank=|fs=|-eject|-atip|padsize=|-multi]",
2473 " path|-",
2474 " Perform some cdrecord gestures, eventually write at most one",
2475 " data track to blank, appendable or overwritable media.",
2476 " -pacifier \"xorriso\"|\"cdrecord\"|\"mkisofs\"",
2477 " Choose format of UPDATE pacifier during write operations.",
2478 "",
2479 "General commands:",
2480 " -help Print this text",
2481 " -abort_on severity Set the threshold for events to abort the program.",
2482 " Useful severities: NEVER, ABORT, FATAL, FAILURE, SORRY, WARNING",
2483 " -return_with severity exit_value Set the threshold for events to return",
2484 " at program end the given exit_value even if not aborted.",
2485 " exit_value may be 0 or 32 to 63.",
2486 " -report_about severity Set the threshold for events to be reported.",
2487 " Use -abort_on severities or: HINT, NOTE, UPDATE, DEBUG, ALL",
2488 " -signal_handling \"on\"|\"off\"|\"sig_dfl\"|\"sig_ign\"",
2489 " Handling of signals. Default \"on\" uses libburn handler.",
2490 " -error_behavior \"image_loading\"|\"file_extraction\" behavior",
2491 " Behavior \"best_effort\" is most endurant but may produce",
2492 " results which are correct only on the first glimpse.",
2493 " -dialog \"on\"|\"off\"|\"single_line\"",
2494 " After all program arguments are processed, enter dialog mode.",
2495 " \"single_line\" does not support newline characters within",
2496 " open quotation marks and no line continuation by trailing \\.",
2497 " -page len width Prompt user after len output lines (0=no prompt).",
2498 " width (default 80) can adjust line number computation",
2499 " to the output terminal's line width.",
2500 #ifdef Xorriso_with_line_editoR
2501 " -use_readline \"on\"|\"off\"",
2502 " Whether to use libreadline for dialog if available.",
2503 " -history text Copy text into libreadline history. This command",
2504 " itself is not copied to the history list.",
2505 #endif /* Xorriso_with_line_editoR */
2506 " -sh_style_result \"on\"|\"off\"",
2507 " If \"on\" do not wrap file addresses in quotation marks with",
2508 " -pwd -pwdx -ls -lsd -lsl -lsdl -lsx -lsdx -lslx -lsdlx",
2509 " -du -dus -dux -dusx -findx -find",
2510 " -backslash_codes \"on\"|\"off\"|",
2511 " \"in_double_quotes\"|\"in_quotes\"|\"with_quoted_input\"",
2512 " [:\"with_program_arguments\"][:\"encode_output\"]",
2513 " Disable or enable interpretation of \\a \\b \\e \\f \\n \\r \\t \\v",
2514 " \\\\ \\NNN \\xNN \\cC in input or program arguments.",
2515 " -pkt_output \"on\"|\"off\" Direct output to stdout and prefix each line",
2516 " by a short header which tells channel id and a mode number.",
2517 " Each such output packet is finalized by a newline.",
2518 " Channel ids are 'R:' for result lines, 'I:' for notes",
2519 " and error messages, 'M:' for -mark texts. Bit 0 of the",
2520 " mode number tells whether the newline is also part of the",
2521 " packet payload. Example of a info message with newline:",
2522 " I:1: enter option text :",
2523 " -pkt_output:on is intended for use by frontend programs.",
2524 " -msg_op \"start_sieve\"|\"read_sieve\"|\"clear_sieve\"|\"end_sieve\"|",
2525 " \"parse\"|\"parse_silently\"|\"parse_bulk\"|\"parse_bulk_silently\"|",
2526 " \"compare_sev\"|\"list_sev\" param_text",
2527 " Enable, use, or disable message sieve. Or parse lines into",
2528 " words. Or compare or list severity names.",
2529 " -named_pipes_loop mode[:mode]",
2530 " disk_path_stdin disk_path_stdout disk_path_stderr",
2531 " Enter an EOF resistant dialog loop at a named pipe as input",
2532 " and zero, one or two named pipes as output. \"-\" = no pipe.",
2533 " Mode \"cleanup\" removes pipes at loop end. \"keep\" does not.",
2534 " Mode \"buffered\" reads all lines from input pipe before it",
2535 " opens the output pipes. \"direct\" opens after first input.",
2536 " -launch_frontend program [args ...] --",
2537 " Start a program, connect its stdin to xorriso stdout and",
2538 " stderr, connect its stdout to xorriso stdin.",
2539 " Use any given parameters as arguments for the started program.",
2540 " -logfile channel fileaddress Copy output of a channel to the given file.",
2541 " channel may be 'R','I','M' as with -pkt_output or '.'",
2542 " for the consolidated -pkt_output stream.",
2543 " -mark text If text is not empty it will get put out each time a command",
2544 " is completed.",
2545 " -temp_mem_limit number[\"k\"|\"m\"]",
2546 " Set the maximum size for pattern expansion. (Default is 16m)",
2547 " -prog text Use text as this program's name in subsequent messages",
2548 " -prog_help text Use text as this program's name and perform -help",
2549 " -status mode|filter Report the current settings of persistent commands.",
2550 " Modes:",
2551 " short... print only important or altered settings",
2552 " long ... print settings even if they have default values",
2553 " long_history like long plus -history: lines",
2554 " Filters begin with '-' and are compared literally against the",
2555 " output lines of -status long_history. A line is put out only",
2556 " if its start matches the filter.",
2557 " -status_history_max number Maximum number of history lines to be reported",
2558 " with -status:long_history",
2559 " -options_from_file fileaddress",
2560 " Reads lines from the given file and executes them as commands.",
2561 " -no_rc Only if used as first program argument, this command",
2562 " prevents reading and interpretation of these startup files:",
2563 " /etc/default/xorriso , /etc/opt/xorriso/rc",
2564 " /etc/xorriso/xorriso.conf , $HOME/.xorrisorc",
2565 " -print text",
2566 " Print a text to result channel.",
2567 " -print_info text",
2568 " Print a text to info channel.",
2569 " -print_mark text",
2570 " Print a text to mark channel.",
2571 " -prompt text",
2572 " Wait for Enter key or for a line of input at stdin.",
2573 " -sleep number",
2574 " Do nothing during the given number of seconds.",
2575 " -errfile_log mode path|channel",
2576 " Log disk paths of files involved in problem events.",
2577 " -session_log path",
2578 " Set path of a file where a log record gets appended after",
2579 " each session. Form: timestamp start_lba size volume-id",
2580 " -scsi_log \"on\"|\"off\"",
2581 " Enable or disable logging of SCSI commands to stderr.",
2582 " # any text Is ignored. In dialog mode the input line will be stored in",
2583 " the eventual readline history, nevertheless.",
2584 " -list_extras code",
2585 " Tell whether certain extra features were enabled at compile",
2586 " time. Code \"all\" lists all features and a headline. Other",
2587 " codes pick a single feature. \"codes\" lists the known codes.",
2588 " -list_arg_sorting",
2589 " Print the sorting order of xorriso commands with option -x.",
2590 " -version Tell program and version number",
2591 " -end End program. Commit eventual pending changes.",
2592 " -rollback_end",
2593 " End program. Discard pending changes.",
2594 "",
2595 "",
2596 "Command -page causes a user prompt after the given number of result lines.",
2597 "Empty input resumes output until the next prompt. Other input may be:",
2598 " @ suppresses paging until the current action is done",
2599 " @@ suppresses further result output but continues the action",
2600 " @@@ aborts the current action",
2601 " other aborts the current action and executes input as new command",
2602 "",
2603 #ifdef Xorriso_GNU_xorrisO
2604 "Report bugs to: bug-xorriso@gnu.org , or in private to: scdbackup@gmx.net .",
2605 "xorriso home page: <https://www.gnu.org/software/xorriso/>",
2606 "General help using GNU software: <https://www.gnu.org/gethelp/>",
2607 #else
2608 "Report any bugs to bug-xorriso@gnu.org or in private to scdbackup@gmx.net .",
2609 #endif
2610 "",
2611
2612 #endif /* ! Xorriso_no_helP */
2613
2614 "@ENDE_OF_HELPTEXT_(HOPEFULLY_UNIQUELY_SILLY_TEXT)@"
2615 };
2616
2617 char *tpt= NULL;
2618 int i;
2619
2620 Xorriso_restxt(xorriso,"\n");
2621 sprintf(xorriso->result_line,"usage: %s [settings|actions]\n",
2622 xorriso->progname);
2623 Xorriso_result(xorriso,0);
2624 Xorriso_restxt(xorriso,"\n");
2625 for(i=0;1;i++) {
2626 tpt= text[i];
2627
2628 if(strcmp(tpt,"@ENDE_OF_HELPTEXT_(HOPEFULLY_UNIQUELY_SILLY_TEXT)@")==0)
2629 break;
2630 sprintf(xorriso->result_line,"%s\n",tpt);
2631 Xorriso_result(xorriso,0);
2632 if(xorriso->request_to_abort)
2633 return(1);
2634 }
2635 Xorriso_restxt(xorriso,"\n");
2636 return(1);
2637 }
2638
2639
2640 /* Option -hfsplus "on"|"off" */
2641 int Xorriso_option_hfsplus(struct XorrisO *xorriso, char *mode, int flag)
2642 {
2643 if(strcmp(mode, "off")==0)
2644 xorriso->do_hfsplus= 0;
2645 else if(strcmp(mode, "on")==0)
2646 xorriso->do_hfsplus= 1;
2647 else {
2648 sprintf(xorriso->info_text, "-hfsplus: unknown mode '%s'", mode);
2649 Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);
2650 return(0);
2651 }
2652 return(1);
2653 }
2654
2655
2656 /* Option -hide */
2657 int Xorriso_option_hide(struct XorrisO *xorriso, char *hide_state,
2658 int argc, char **argv, int *idx, int flag)
2659 {
2660 int i, ret, end_idx, optc= 0, was_failure= 0, fret, hide_mode;
2661 char **optv= NULL;
2662
2663 ret= Xorriso_opt_args(xorriso, "-hide", argc, argv, *idx, &end_idx, &optc,
2664 &optv, 0);
2665 if(ret<=0)
2666 goto ex;
2667 hide_mode= Xorriso__hide_mode(hide_state, 0);
2668 if(hide_mode < 0) {
2669 sprintf(xorriso->info_text, "-hide : unknown hide state ");
2670 Text_shellsafe(hide_state, xorriso->info_text, 1);
2671 Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);
2672 goto ex;
2673 }
2674 for(i= 0; i<optc; i++) {
2675 ret= Xorriso_set_hidden(xorriso, NULL, optv[i], hide_mode, 0);
2676 if(ret>0 && !xorriso->request_to_abort)
2677 continue; /* regular bottom of loop */
2678
2679 was_failure= 1;
2680 fret= Xorriso_eval_problem_status(xorriso, ret, 1|2);
2681 if(fret>=0)
2682 continue;
2683 ret= 0; goto ex;
2684 }
2685 ret= 1;
2686 ex:;
2687 (*idx)= end_idx;
2688 Xorriso_opt_args(xorriso, "-hide", argc, argv, *idx, &end_idx, &optc, &optv,
2689 256);
2690 if(ret<=0)
2691 return(ret);
2692 return(!was_failure);
2693 }
2694
2695
2696 /* Option -history */
2697 int Xorriso_option_history(struct XorrisO *xorriso, char *line, int flag)
2698 {
2699 Xorriso_dialog_input(xorriso, line, strlen(line) + 1, 2 | 32);
2700 return(1);
2701 }
2702