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