libisoburn  1.5.4
About: libisoburn is a frontend for the libraries libburn and libisofs which enables creation and expansion of ISO-9660 filesystems on all media and file types supported by libburn. It implements the API and command interpreter of program xorriso, and installs this program as small dynamically linked binary. xorriso is suitable for incremental data backup and for production of bootable ISO 9660 images. A statically linked version is available as GNU xorriso.
  Fossies Dox: libisoburn-1.5.4.tar.gz  ("unofficial" and yet experimental doxygen-generated source code documentation)  

opts_a_c.c
Go to the documentation of this file.
1 
2 /* xorriso - creates, loads, manipulates and burns ISO 9660 filesystem images.
3 
4  Copyright 2007-2019 Thomas Schmitt, <scdbackup@gmx.net>
5 
6  Provided under GPL version 2 or later.
7 
8  This file contains the implementation of commands -a* to -c* as mentioned
9  in man page 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 /* for -charset */
28 #include <iconv.h>
29 #include <langinfo.h>
30 #include <locale.h>
31 
32 
33 #include "xorriso.h"
34 #include "xorriso_private.h"
35 #include "xorrisoburn.h"
36 
37 
38 /* Option -abort_on */
39 int Xorriso_option_abort_on(struct XorrisO *xorriso, char *in_severity,
40  int flag)
41 {
42  int ret, sev;
43  char severity[20], *official;
44 
45  Xorriso__to_upper(in_severity, severity, (int) sizeof(severity), 0);
46  ret= Xorriso__text_to_sev(severity, &sev, 0);
47  if(ret<=0) {
48  sprintf(xorriso->info_text, "-abort_on: Not a known severity name : ");
49  Text_shellsafe(in_severity, xorriso->info_text, 1);
50  Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);
51  return(ret);
52  }
53  ret= Xorriso__sev_to_text(sev, &official, 0);
54  if(ret <= 0)
55  official= severity;
56  if(Sfile_str(xorriso->abort_on_text, official, 0) <= 0)
57  return(-1);
58  xorriso->abort_on_severity= sev;
59  xorriso->abort_on_is_default= 0;
60  Xorriso_set_abort_severity(xorriso, 0);
61  return(1);
62 }
63 
64 
65 /* Option -abstract_file */
66 int Xorriso_option_abstract_file(struct XorrisO *xorriso, char *name, int flag)
67 {
68  if(Xorriso_check_name_len(xorriso, name,
69  (int) sizeof(xorriso->abstract_file),
70  "-abstract_file", 0) <= 0)
71  return(0);
72  strcpy(xorriso->abstract_file, name);
73  Xorriso_set_change_pending(xorriso, 1);
74  return(1);
75 }
76 
77 /* Option -acl "on"|"off" */
78 int Xorriso_option_acl(struct XorrisO *xorriso, char *mode, int flag)
79 {
80  int ret;
81 
82  if(strcmp(mode, "off")==0)
83  xorriso->do_aaip&= ~3;
84  else if(strcmp(mode, "on")==0)
85  xorriso->do_aaip|= (1 | 2);
86  else {
87  sprintf(xorriso->info_text, "-acl: unknown mode '%s'", mode);
88  Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);
89  return(0);
90  }
91  ret= Xorriso_set_ignore_aclea(xorriso, 0);
92  if(ret <= 0)
93  return(ret);
94  return(1);
95 }
96 
97 
98 /* @param flag bit3= unescape \\
99 */
100 static void unescape_pathspec_part(char *rpt, int flag)
101 {
102  char *wpt;
103 
104  wpt= rpt;
105  for(; *rpt != 0; rpt++) {
106  if(*rpt == '\\') {
107  if(*(rpt + 1) == '=')
108  continue;
109  if((flag & 8) && *(rpt + 1) == '\\')
110  rpt++;
111  }
112  *(wpt++)= *rpt;
113  }
114  *wpt= 0;
115 }
116 
117 
118 /* Option -add */
119 /* @param flag bit0=do not report the added item
120  bit1=do not reset pacifier, no final pacifier message
121  bit2= prepend ISO working directory in any case
122 */
123 int Xorriso_option_add(struct XorrisO *xorriso, int argc, char **argv,
124  int *idx, int flag)
125 {
126  int i, end_idx, ret, was_failure= 0, fret, optc= 0, split, as_mkisofs= 0;
127  char *target= NULL, *source= NULL, *ept, *eff_path= NULL;
128  char **optv= NULL;
129 
130  ret= Xorriso_opt_args(xorriso, "-add", argc, argv, *idx, &end_idx,
131  &optc, &optv, ((!!xorriso->allow_graft_points)<<2)|2);
132  if(ret<=0)
133  goto ex;
134 
135  Xorriso_alloc_meM(target, char, SfileadrL);
136  Xorriso_alloc_meM(source, char, SfileadrL);
137  Xorriso_alloc_meM(eff_path, char, SfileadrL);
138 
139  if(xorriso->allow_graft_points & 2)
140  as_mkisofs= 8;
141  if(!(flag&2))
142  Xorriso_pacifier_reset(xorriso, 0);
143  for(i= 0; i<optc; i++) {
144  if(Sfile_str(target,optv[i],0)<=0)
145  {ret= -1; goto ex;}
146  strcpy(source, optv[i]);
147  split= 0;
148  if(xorriso->allow_graft_points) {
149  ret= Fileliste__target_source_limit(target, '=', &ept,
150  !(xorriso->allow_graft_points & 2));
151  if(ret>0) {
152  *ept= 0;
153  strcpy(source, ept+1);
154  split= 1;
155  }
156  /* unescape \= */;
157  if(split) {
158  unescape_pathspec_part(target, as_mkisofs);
159  if(as_mkisofs)
160  unescape_pathspec_part(source, as_mkisofs);
161  } else {
162  unescape_pathspec_part(source, as_mkisofs);
163  }
164  }
165  if(split==0)
166  strcpy(target, source);
167  if(flag & 4) {
168  ret= Sfile_prepend_path(xorriso->wdi, target, 0);
169  if(ret<=0) {
170  sprintf(xorriso->info_text, "Effective path gets much too long (%d)",
171  (int) (strlen(xorriso->wdi)+strlen(target)+1));
172  Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);
173  goto problem_handler;
174  }
175  }
176 
177  ret= Xorriso_normalize_img_path(xorriso, xorriso->wdi, target, eff_path, 2);
178  if(ret<=0)
179  goto problem_handler;
180  strcpy(target, eff_path);
181  ret= Xorriso_normalize_img_path(xorriso, xorriso->wdx, source,eff_path,2|4);
182  if(ret<=0)
183  goto problem_handler;
184  strcpy(source, eff_path);
185 
186  ret= Xorriso_graft_in(xorriso, NULL, source, target, (off_t)0, (off_t)0, 0);
187  if(ret<=0 || xorriso->request_to_abort)
188  goto problem_handler;
189  sprintf(xorriso->info_text, "Added to ISO image: %s '%s'='%s'\n",
190  (ret>1 ? "directory" : "file"), (target[0] ? target : "/"), source);
191  if(!(flag&1))
192  Xorriso_info(xorriso, 0);
193 
194  continue; /* regular bottom of loop */
195 problem_handler:;
196  was_failure= 1;
197  fret= Xorriso_eval_problem_status(xorriso, ret, 1|2);
198  if(fret>=0)
199  continue;
200  goto ex;
201  }
202  if(!(flag&2))
203  Xorriso_pacifier_callback(xorriso, "files added", xorriso->pacifier_count,
204  xorriso->pacifier_total, "", 1);
205  ret= 1;
206 ex:;
207  (*idx)= end_idx;
208  Xorriso_free_meM(target);
209  Xorriso_free_meM(source);
210  Xorriso_free_meM(eff_path);
211  Xorriso_opt_args(xorriso, "-add", argc, argv, *idx, &end_idx, &optc, &optv,
212  256);
213  if(ret<=0)
214  return(ret);
215  return(!was_failure);
216 }
217 
218 
219 /* Option -add_plainly "none"|"unknown" */
220 int Xorriso_option_add_plainly(struct XorrisO *xorriso, char *mode,int flag)
221 {
222  if(strcmp(mode, "none")==0)
223  xorriso->add_plainly= 0;
224  if(strcmp(mode, "unknown")==0)
225  xorriso->add_plainly= 1;
226  else if(strcmp(mode, "dashed")==0)
227  xorriso->add_plainly= 2;
228  else if(strcmp(mode, "any")==0)
229  xorriso->add_plainly= 3;
230  else {
231  sprintf(xorriso->info_text, "-add_plainly: unknown mode '%s'", mode);
232  Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);
233  return(0);
234  }
235  return(1);
236 }
237 
238 
239 /* Option -alter_date , -alter_date_r */
240 /* @param flag bit0=recursive (-alter_date_r)
241 */
242 int Xorriso_option_alter_date(struct XorrisO *xorriso,
243  char *time_type, char *timestring,
244  int argc, char **argv, int *idx, int flag)
245 {
246  int i, ret, was_failure= 0, t_type= 0, end_idx, fret;
247  time_t t;
248  int optc= 0;
249  char **optv= NULL;
250  struct FindjoB *job= NULL;
251  struct stat dir_stbuf;
252 
253  ret= Xorriso_opt_args(xorriso, "-alter_date", argc, argv, *idx, &end_idx,
254  &optc, &optv, 0);
255  if(ret<=0)
256  goto ex;
257  ret= Xorriso_convert_datestring(xorriso, "-alter_date", time_type, timestring,
258  &t_type, &t, 0);
259  if(ret<=0)
260  goto ex;
261  for(i= 0; i<optc; i++) {
262  if(flag&1) {
263  ret= Findjob_new(&job, optv[i], 0);
264  if(ret<=0) {
265  Xorriso_no_findjob(xorriso, "-alter_date", 0);
266  {ret= -1; goto ex;}
267  }
268  Findjob_set_action_ad(job, t_type, t, 0);
269  ret= Xorriso_findi(xorriso, job, NULL, (off_t) 0,
270  NULL, optv[i], &dir_stbuf, 0, 0);
271  Findjob_destroy(&job, 0);
272  } else
273  ret= Xorriso_set_time(xorriso, optv[i], t, t_type);
274  if(ret>0 && !xorriso->request_to_abort)
275  continue; /* regular bottom of loop */
276  was_failure= 1;
277  fret= Xorriso_eval_problem_status(xorriso, ret, 1|2);
278  if(fret>=0)
279  continue;
280  goto ex;
281  }
282  ret= 1;
283 ex:;
284  (*idx)= end_idx;
285  Xorriso_opt_args(xorriso, "-alter_date", argc, argv, *idx, &end_idx, &optc,
286  &optv, 256);
287  Findjob_destroy(&job, 0);
288  if(ret<=0)
289  return(ret);
290  return(!was_failure);
291 }
292 
293 
294 /* Option -append_partition */
295 int Xorriso_option_append_partition(struct XorrisO *xorriso, char *partno_text,
296  char *type_text, char *image_path, int flag)
297 {
298  int partno = 0, type_code= -1, i, guid_valid= 0, ret;
299  unsigned int unum;
300  char *tpt;
301  uint8_t guid[16];
302  static char *part_type_names[] = {"FAT12", "FAT16", "Linux", "", NULL};
303  static int part_type_codes[] = { 0x01, 0x06, 0x83, 0x00};
304 
305  sscanf(partno_text, "%d", &partno);
306  if(partno < 1 || partno > Xorriso_max_appended_partitionS) {
307  sprintf(xorriso->info_text,
308  "-append_partition: Partition number '%s' is out of range (1...%d)",
309  partno_text, Xorriso_max_appended_partitionS);
310  Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);
311  return(0);
312  }
313  for(i= 0; part_type_names[i] != NULL; i++)
314  if(strcmp(part_type_names[i], type_text) == 0)
315  break;
316  if(part_type_names[i] != NULL)
317  type_code= part_type_codes[i];
318  if(type_code < 0) {
319  ret= Xorriso_parse_type_guid(xorriso, type_text, guid, &type_code, 0);
320  if(ret > 0)
321  guid_valid= 1;
322  }
323 
324  if(type_code < 0) {
325  tpt= type_text;
326  if(strncmp(tpt, "0x", 2) == 0)
327  tpt+= 2;
328  else
329  goto bad_type;
330  unum= 0xffffffff;
331  sscanf(tpt, "%X", &unum);
332  if(unum > 0xff) {
333 bad_type:;
334  sprintf(xorriso->info_text,
335 "-append_partition: Partition type '%s' is out of range (0x00...0xff or GUID)",
336  type_text);
337  Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);
338  return(0);
339  }
340  type_code= unum;
341  }
342 
343  if(xorriso->appended_partitions[partno - 1] != NULL)
344  free(xorriso->appended_partitions[partno - 1]);
345  xorriso->appended_partitions[partno - 1]= strdup(image_path);
346  if(xorriso->appended_partitions[partno - 1] == NULL) {
347  Xorriso_no_malloc_memory(xorriso, NULL, 0);
348  return(-1);
349  }
350  xorriso->appended_part_types[partno - 1]= type_code;
351  if(guid_valid) {
352  memcpy(xorriso->appended_part_type_guids[partno - 1], guid, 16);
353  xorriso->appended_part_gpt_flags[partno - 1]|= 1;
354  } else {
355  xorriso->appended_part_gpt_flags[partno - 1]&= ~1;
356  }
357  return(1);
358 }
359 
360 
361 /* Option -application_id */
362 int Xorriso_option_application_id(struct XorrisO *xorriso, char *name,
363  int flag)
364 {
365  if(Xorriso_check_name_len(xorriso, name,
366  (int) sizeof(xorriso->application_id),
367  "-application_id", 0) <= 0)
368  return(0);
369  if(strcmp(name, "@xorriso@") == 0)
370  Xorriso_preparer_string(xorriso, xorriso->application_id, 0);
371  else
372  strcpy(xorriso->application_id,name);
373  Xorriso_set_change_pending(xorriso, 1);
374  return(1);
375 }
376 
377 
378 /* Command -application_use */
379 int Xorriso_option_application_use(struct XorrisO *xorriso, char *path,
380  int flag)
381 {
382  if(Sfile_str(xorriso->application_use, path, 0) <= 0) {
383  sprintf(xorriso->info_text,
384  "-application_use: parameter string is much too long (%d)",
385  (int) strlen(path));
386  Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);
387  return(0);
388  }
389  return(1);
390 }
391 
392 
393 /* Option -as */
394 /* @param flag bit0=do not report the added item
395  bit1=do not reset pacifier, no final pacifier message
396 */
397 int Xorriso_option_as(struct XorrisO *xorriso, int argc, char **argv,
398  int *idx, int flag)
399 {
400  int end_idx, ret, idx_count;
401 
402  end_idx= Xorriso_end_idx(xorriso, argc, argv, *idx, 1);
403  idx_count= end_idx-(*idx);
404  if(end_idx<=0 || (*idx)>=argc) {
405  if(idx_count<1)
406  sprintf(xorriso->info_text,
407  "-as : Not enough arguments given. Needed: whom do_what %s",
408  xorriso->list_delimiter);
409  else
410  sprintf(xorriso->info_text,
411  "-as %s : Not enough arguments given. Needed: do_what %s",
412  argv[*idx], xorriso->list_delimiter);
413  Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);
414  ret= 0; goto ex;
415  }
416  if(strcmp(argv[*idx], "cdrecord")==0 || strcmp(argv[*idx], "wodim")==0 ||
417  strcmp(argv[*idx], "cdrskin")==0 || strcmp(argv[*idx], "xorrecord")==0) {
418  ret= Xorriso_cdrskin(xorriso, argv[*idx], end_idx-(*idx)-1, argv+(*idx)+1,
419  0);
420  if(ret<=0)
421  goto ex;
422  } else if(strcmp(argv[*idx], "mkisofs")==0 ||
423  strcmp(argv[*idx], "genisoimage")==0 ||
424  strcmp(argv[*idx], "genisofs")==0 ||
425  strcmp(argv[*idx], "xorrisofs")==0) {
426  ret= Xorriso_genisofs(xorriso, argv[*idx], end_idx-(*idx)-1, argv+(*idx)+1,
427  0);
428  if(ret<=0)
429  goto ex;
430  } else {
431  sprintf(xorriso->info_text,
432  "-as : Not a known emulation personality: '%s'", argv[*idx]);
433  Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);
434  ret= 0; goto ex;
435  }
436 
437  ret= 1;
438 ex:;
439  (*idx)= end_idx;
440  return(ret);
441 }
442 
443 
444 /* Option -assert_volid */
445 int Xorriso_option_assert_volid(struct XorrisO *xorriso, char *pattern,
446  char *severity, int flag)
447 {
448  int ret, sev;
449  char *sev_text= "", off_severity[20];
450 
451  if(strlen(pattern)>=sizeof(xorriso->assert_volid)) {
452  sprintf(xorriso->info_text,
453  "Name too long with option -application_id (%d > %d)",
454  (int) strlen(pattern), (int) sizeof(xorriso->assert_volid)-1);
455  Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "SORRY", 0);
456  return(0);
457  }
458  if(pattern[0]) {
459  ret= Sregex_match(pattern, "", 1);
460  if(ret <= 0) {
461  sprintf(xorriso->info_text, "-assert_volid: Cannot use given pattern.");
462  Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);
463  return(0);
464  }
465  }
466  if(severity[0] != 0 || pattern[0] != 0) {
467  if(severity[0] == 0)
468  sev_text= xorriso->abort_on_text;
469  else
470  sev_text= severity;
471  if(strcmp(sev_text, "NEVER") == 0)
472  sev_text= "ABORT";
473  Xorriso__to_upper(sev_text, off_severity, (int) sizeof(off_severity), 0);
474  sev_text= off_severity;
475  ret= Xorriso__text_to_sev(sev_text, &sev, 0);
476  if(ret<=0) {
477  sprintf(xorriso->info_text, "-assert_volid: Not a known severity name : ");
478  Text_shellsafe(severity, xorriso->info_text, 1);
479  Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);
480  return(ret);
481  }
482  }
483  if(Sfile_str(xorriso->assert_volid, pattern,0) <= 0)
484  return(-1);
485  strcpy(xorriso->assert_volid_sev, sev_text);
486  return(1);
487 }
488 
489 
490 /* Option -auto_charset "on"|"off" */
491 int Xorriso_option_auto_charset(struct XorrisO *xorriso, char *mode, int flag)
492 {
493  if(strcmp(mode, "off")==0)
494  xorriso->do_aaip&= ~(256 | 512);
495  else if(strcmp(mode, "on")==0)
496  xorriso->do_aaip|= (256 | 512);
497  else {
498  sprintf(xorriso->info_text, "-auto_charset: unknown mode '%s'", mode);
499  Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);
500  return(0);
501  }
502  return(1);
503 }
504 
505 
506 /* Option -backslash_codes */
507 int Xorriso_option_backslash_codes(struct XorrisO *xorriso, char *mode,
508  int flag)
509 {
510  char *npt, *cpt;
511  int l, was;
512 
513  was= xorriso->bsl_interpretation;
514  xorriso->bsl_interpretation= 0;
515  npt= cpt= mode;
516  for(; npt!=NULL; cpt= npt+1) {
517  npt= strchr(cpt,':');
518  if(npt==NULL)
519  l= strlen(cpt);
520  else
521  l= npt-cpt;
522  if(l == 0)
523  continue;
524  if(l == 3 && strncmp(cpt, "off", l)==0) {
525  xorriso->bsl_interpretation= 0;
526  } else if(l == 16 && strncmp(cpt, "in_double_quotes", l)==0) {
527  xorriso->bsl_interpretation= (xorriso->bsl_interpretation & ~3) | 1;
528  } else if(l == 9 && strncmp(cpt, "in_quotes", l)==0) {
529  xorriso->bsl_interpretation= (xorriso->bsl_interpretation & ~3) | 2;
530  } else if(l == 17 && strncmp(cpt, "with_quoted_input", l)==0) {
531  xorriso->bsl_interpretation= (xorriso->bsl_interpretation & ~3) | 3;
532  } else if(l == 22 && strncmp(cpt, "with_program_arguments", l)==0) {
533  xorriso->bsl_interpretation= xorriso->bsl_interpretation | 16;
534  } else if(l == 13 && strncmp(cpt, "encode_output", l)==0) {
535  xorriso->bsl_interpretation= xorriso->bsl_interpretation | 32 | 64;
536  } else if(l == 14 && strncmp(cpt, "encode_results", l)==0) {
537  xorriso->bsl_interpretation= xorriso->bsl_interpretation | 32;
538  } else if(l == 12 && strncmp(cpt, "encode_infos", l)==0) {
539  xorriso->bsl_interpretation= xorriso->bsl_interpretation | 64;
540  } else if(l == 2 && strncmp(cpt, "on", l)==0) {
541  xorriso->bsl_interpretation= 3 | 16 | 32 | 64;
542  } else {
543  if(l<SfileadrL)
544  sprintf(xorriso->info_text, "-backslash_codes: unknown mode '%s'", cpt);
545  else
546  sprintf(xorriso->info_text,
547  "-backslash_codes: oversized mode parameter (%d)", l);
548  Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);
549  xorriso->bsl_interpretation= was;
550  return(0);
551  }
552  }
553  return(1);
554 }
555 
556 
557 /* Option -ban_stdio_write */
558 int Xorriso_option_ban_stdio_write(struct XorrisO *xorriso, int flag)
559 {
560  xorriso->ban_stdio_write= 1;
561  return(1);
562 }
563 
564 
565 /* Option -biblio_file */
566 int Xorriso_option_biblio_file(struct XorrisO *xorriso, char *name, int flag)
567 {
568  if(Xorriso_check_name_len(xorriso, name, (int) sizeof(xorriso->biblio_file),
569  "-biblio_file", 0) <= 0)
570  return(0);
571  strcpy(xorriso->biblio_file, name);
572  Xorriso_set_change_pending(xorriso, 1);
573  return(1);
574 }
575 
576 
577 /* Option -blank and -format */
578 /* @param flag bit0= format rather than blank
579  @return <=0 error , 1 success, 2 revoked by -reassure
580 */
581 int Xorriso_option_blank(struct XorrisO *xorriso, char *in_mode, int flag)
582 {
583  char *cmd= "-blank", *mode;
584  int aq_ret, ret, mode_flag= 0, as_needed= 0, idx, do_force= 0;
585  off_t size= 0;
586 
587  if(flag&1)
588  cmd= "-format";
589  if(xorriso->out_drive_handle == NULL) {
590  sprintf(xorriso->info_text,
591  "%s: No output drive set by -dev -or -outdev", cmd);
592  Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);
593  return(0);
594  }
595  if(xorriso->in_drive_handle == xorriso->out_drive_handle) {
596  if(Xorriso_change_is_pending(xorriso, 0)) {
597  sprintf(xorriso->info_text,
598  "%s: Image changes pending. -commit or -rollback first.", cmd);
599  Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);
600  return(0);
601  }
602  }
603  ret= Xorriso_reassure(xorriso, cmd,
604  "possibly make unreadable data on outdev", 0);
605  if(ret<=0)
606  return(2);
607 
608  if(strncmp(in_mode, "force:", 6) == 0) {
609  do_force= 1;
610  mode= in_mode + 6;
611  } else
612  mode= in_mode;
613  if(strcmp(mode, "as_needed")==0 || mode[0]==0)
614  as_needed= 1;
615  else if(strcmp(mode, "all")==0 || strcmp(mode, "full")==0)
616  mode_flag= 0;
617  else if((strcmp(mode, "deformat")==0 ||
618  strcmp(mode, "deformat_sequential")==0) && !(flag&1))
619  mode_flag= 2;
620  else if((strcmp(mode, "deformat_quickest")==0 ||
621  strcmp(mode, "deformat_sequential_quickest")==0) && !(flag&1))
622  mode_flag= 3;
623  else if(strcmp(mode, "fast")==0)
624  mode_flag= 1;
625  else if(strncmp(mode, "by_index_", 9)==0 && (flag&1)) {
626  mode_flag= 128;
627  idx= -1;
628  if(strlen(mode)>9)
629  sscanf(mode+9, "%d", &idx);
630  if(idx<0 || idx>255) {
631 unusable_index:;
632  sprintf(xorriso->info_text,
633  "-format: mode '%s' provides unusable index number", mode);
634  Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);
635  return(0);
636  }
637  mode_flag|= (idx<<8);
638  } else if(strncmp(mode, "fast_by_index_", 14)==0 && (flag&1)) {
639  mode_flag= 1 | 128;
640  idx= -1;
641  if(strlen(mode)>14)
642  sscanf(mode+14, "%d", &idx);
643  if(idx<0 || idx>255)
644  goto unusable_index;
645  mode_flag|= (idx<<8);
646  } else if(strncmp(mode, "by_size_", 8) == 0 && (flag & 1)) {
647  size= (off_t) Scanf_io_size(mode + 8, 0);
648  if(size <= 0) {
649 unusable_size:;
650  sprintf(xorriso->info_text,
651  "-format: mode '%s' provides unusable size value", mode);
652  Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);
653  return(0);
654  }
655  mode_flag= 2;
656  } else if(strncmp(mode, "fast_by_size_", 13) == 0 && (flag & 1)) {
657  size= (off_t) Scanf_io_size(mode + 13, 0);
658  if(size <= 0)
659  goto unusable_size;
660  mode_flag= 3;
661  } else if(strcmp(mode, "without_spare") == 0 && (flag & 1)) {
662  mode_flag= 32;
663  } else {
664  sprintf(xorriso->info_text,
665  "%s: Unknown %s mode '%s'",
666  cmd, ((flag&1) ? "-format" : "-blank"), mode);
667  Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);
668  return(0);
669  }
670  if(do_force) {
671  ret= Xorriso_pretend_full_disc(xorriso, 0);
672  if(ret <= 0)
673  return(ret);
674  }
675  if(as_needed)
676  ret= Xorriso_blank_as_needed(xorriso, (flag&1)<<2);
677  else if(flag&1)
678  ret= Xorriso_format_media(xorriso, size, mode_flag & 0xffa7);
679  else
680  ret= Xorriso_blank_media(xorriso, mode_flag&3);
681  if(ret==0)
682  return(ret);
683  if(ret <= 0) { /* in case of success, above functions will have re-acquired */
684  aq_ret= Xorriso_reaquire_outdev(xorriso, 0); /* actually give up drive */
685  if(ret<aq_ret)
686  return(ret);
687  if(aq_ret<=0)
688  return(aq_ret);
689  }
690  return(1);
691 }
692 
693 
694 /* Option -boot_image */
695 int Xorriso_option_boot_image(struct XorrisO *xorriso, char *form,
696  char *treatment, int flag)
697 {
698  int was_ok= 1, ret, isolinux_grub= 0, count, bin_count, parm_len;
699  int palohdrversion, type_code;
700  unsigned int u;
701  char *formpt, *treatpt, *eff_path= NULL, *eqpt, parm[20];
702  uint8_t sn[8];
703  double num;
704 
705  Xorriso_alloc_meM(eff_path, char, SfileadrL);
706  formpt= form;
707  if(formpt[0]=='-')
708  formpt++;
709  treatpt= treatment;
710  if(treatpt[0]=='-')
711  treatpt++;
712 
713  if(strcmp(formpt, "isolinux")==0 || strcmp(formpt, "grub") == 0)
714  isolinux_grub= 1;
715  if(strcmp(treatpt, "keep")==0) {
716  if(xorriso->boot_count > 0) {
717 cannot_keep_or_patch:;
718  sprintf(xorriso->info_text,
719  "Loaded boot image has already been replaced. Cannot keep or patch it.");
720  Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);
721  {ret= 0; goto ex;}
722  }
723  if(isolinux_grub)
724  goto treatment_patch;
725  xorriso->keep_boot_image= 1;
726  xorriso->patch_isolinux_image= (xorriso->patch_isolinux_image & ~3) | 0;
727  xorriso->boot_image_bin_path[0]= 0;
728  xorriso->patch_system_area= 0;
729 
730  } else if(strcmp(treatpt, "patch")==0) {
731 treatment_patch:;
732  if(xorriso->boot_count > 0)
733  goto cannot_keep_or_patch;
734  xorriso->keep_boot_image= 0;
735  xorriso->patch_isolinux_image= (xorriso->patch_isolinux_image & ~3) | 1;
736  xorriso->boot_image_bin_path[0]= 0;
737  if(strcmp(formpt, "grub") == 0) {
738  xorriso->patch_isolinux_image|= 2;
739  xorriso->patch_system_area= 1;
740  } else if(strcmp(formpt, "isolinux") == 0)
741  xorriso->patch_system_area= 2;
742  else
743  xorriso->patch_system_area= 0;
744 
745  } else if(strcmp(treatpt, "replay")==0) {
746  ret= Xorriso_report_system_area(xorriso, "cmd", 2);
747  if(ret <= 0)
748  goto ex;
749 
750  } else if(strcmp(treatpt, "discard")==0) {
751  xorriso->keep_boot_image= 0;
752  xorriso->patch_isolinux_image= (xorriso->patch_isolinux_image & ~0x3ff) | 0;
753  xorriso->boot_image_bin_path[0]= 0;
754  xorriso->patch_system_area= 0;
755  if((xorriso->system_area_options & 0xfc ) == 0)
756  xorriso->system_area_options= 0; /* Reset eventual type 0 flags */
757  if(xorriso->boot_count > 0) {
758  ret= Xorriso_attach_boot_image(xorriso, 2); /* dispose boot images */
759  if(ret <= 0)
760  goto ex;
761  }
762 
763  } else if(strcmp(treatpt, "next") == 0) {
764  ret= Xorriso_attach_boot_image(xorriso, 0);
765  if(ret <= 0)
766  goto ex;
767 
768  } else if(strcmp(treatpt, "show_status")==0) {
769  sprintf(xorriso->result_line, "------------------------------------\n");
770  Xorriso_result(xorriso, 0);
771  sprintf(xorriso->result_line, "Status of loaded boot image :\n");
772  Xorriso_result(xorriso, 0);
773  sprintf(xorriso->result_line, "------------------------------------\n");
774  Xorriso_result(xorriso, 0);
775  Xorriso_show_boot_info(xorriso, 0);
776  sprintf(xorriso->result_line, "------------------------------------\n");
777  Xorriso_result(xorriso, 0);
778  sprintf(xorriso->result_line, "Boot image settings for next commit:\n");
779  Xorriso_result(xorriso, 0);
780  sprintf(xorriso->result_line, "------------------------------------\n");
781  Xorriso_result(xorriso, 0);
782  Xorriso_status(xorriso, "-boot_image", NULL, 0);
783  sprintf(xorriso->result_line, "------------------------------------\n");
784  Xorriso_result(xorriso, 0);
785 
786  } else if(strcmp(treatpt, "cat_path=") == 0) {
787  xorriso->boot_image_cat_path[0] = 0;
788  } else if(strncmp(treatpt, "cat_path=", 9) == 0) {
789  ret= Xorriso_normalize_img_path(xorriso, xorriso->wdi, treatpt + 9,
790  xorriso->boot_image_cat_path, 2);
791  if(ret <= 0)
792  goto ex;
793 
794  } else if(strncmp(treatpt, "cat_hidden=", 11) == 0) {
795  ret= Xorriso__hide_mode(treatpt + 11, 0);
796  if(ret >= 0)
797  xorriso->boot_image_cat_hidden= ret;
798  else
799  was_ok= 0;
800 
801  } else if(strncmp(treatpt, "dir=", 4) == 0) {
802  if(strcmp(formpt, "isolinux")==0) {
803  /* ISOLINUX */
804  /* The three locations mentioned in http://syslinux.zytor.com/iso.php */
805  if(strcmp(treatpt + 4, "/") == 0)
806  strcpy(xorriso->boot_image_bin_path, "/");
807  else if(strcmp(treatpt + 4, "isolinux") == 0
808  || strcmp(treatpt + 4, "/isolinux") == 0)
809  strcpy(xorriso->boot_image_bin_path, "/isolinux/");
810  else if(strcmp(treatpt + 4, "boot/isolinux") == 0
811  || strcmp(treatpt + 4, "/boot/isolinux") == 0
812  || strcmp(treatpt + 4, "boot") == 0
813  || strcmp(treatpt + 4, "/boot") == 0)
814  strcpy(xorriso->boot_image_bin_path, "/boot/isolinux/");
815  else {
816  sprintf(xorriso->info_text,
817  "Unrecognized keyword with -boot_image %s %s",
818  form, treatment);
819  Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);
820  sprintf(xorriso->info_text,
821  "Allowed with dir= are / , /isolinux . /boot/isolinux");
822  Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "HINT", 0);
823  {ret= 0; goto ex;}
824  }
825  strcpy(xorriso->boot_image_cat_path, xorriso->boot_image_bin_path);
826  strcat(xorriso->boot_image_bin_path, "isolinux.bin");
827  strcat(xorriso->boot_image_cat_path, "boot.cat");
828  xorriso->boot_image_load_size= 4 * 512;
829  xorriso->boot_img_size_default= 0;
830  xorriso->keep_boot_image= 0;
831  xorriso->patch_isolinux_image= (xorriso->patch_isolinux_image & ~3) | 1;
832  strcpy(xorriso->boot_image_bin_form, formpt);
833  {ret= 1; goto ex;}
834 
835  } else if(strcmp(formpt, "grub") == 0) {
836 
837  /* >>> GRUB */
838  was_ok= 0;
839 
840  strcpy(xorriso->boot_image_bin_form, formpt);
841 
842  } else
843  was_ok= 0;
844 
845  } else if(strcmp(treatpt, "bin_path=") == 0) {
846  xorriso->boot_image_bin_path[0] = 0;
847  xorriso->boot_efi_default= 0;
848  } else if(strncmp(treatpt, "bin_path=", 9) == 0) {
849  if(strncmp(treatpt + 9, "--interval:appended_partition_", 30) == 0) {
850  if(strlen(treatpt + 9) >= sizeof(xorriso->boot_image_bin_path)) {
851 interval_text_long:;
852  sprintf(xorriso->info_text,
853  "-boot_image: --interval text is much too long (%d)",
854  (int) strlen(treatpt + 9));
855  Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);
856  ret= 0; goto ex;
857  }
858  strcpy(xorriso->boot_image_bin_path, treatpt + 9);
859  } else {
860  ret= Xorriso_normalize_img_path(xorriso, xorriso->wdi, treatpt + 9,
861  xorriso->boot_image_bin_path, 2);
862  if(ret <= 0)
863  goto ex;
864  }
865  xorriso->keep_boot_image= 0;
866  if(isolinux_grub) {
867  xorriso->patch_isolinux_image= (xorriso->patch_isolinux_image & ~3) | 1;
868  if(xorriso->boot_image_bin_path[0]) {
869  xorriso->boot_image_load_size= 4 * 512;
870  xorriso->boot_img_size_default= 0;
871  }
872  strcpy(xorriso->boot_image_bin_form, formpt);
873  } else
874  strcpy(xorriso->boot_image_bin_form, "any");
875  xorriso->boot_efi_default= 0;
876 
877  } else if(strcmp(treatpt, "efi_path=") == 0) {
878  xorriso->boot_image_bin_path[0] = 0;
879  xorriso->boot_efi_default= 0;
880  } else if(strncmp(treatpt, "efi_path=", 9) == 0) {
881  if(strncmp(treatpt + 9, "--interval:appended_partition_", 30) == 0) {
882  if(strlen(treatpt + 9) >= sizeof(xorriso->boot_image_bin_path))
883  goto interval_text_long;
884  strcpy(xorriso->boot_image_bin_path, treatpt + 9);
885  } else {
886  ret= Xorriso_normalize_img_path(xorriso, xorriso->wdi, treatpt + 9,
887  xorriso->boot_image_bin_path, 2);
888  if(ret <= 0)
889  goto ex;
890  }
891  xorriso->keep_boot_image= 0;
892  xorriso->boot_efi_default= 1;
893 
894  } else if(strncmp(treatpt, "mips_path=", 10) == 0) {
895  sprintf(eff_path, "-boot_image %s mips_path=", formpt);
896  ret= Xorriso_coordinate_system_area(xorriso, 1, 0, eff_path, 0);
897  if(ret <= 0)
898  goto ex;
899  ret= Xorriso_normalize_img_path(xorriso, xorriso->wdi, treatpt + 10,
900  eff_path, 2);
901  if(ret <= 0)
902  goto ex;
903  ret= Xorriso_add_mips_boot_file(xorriso, eff_path, 0);
904  if(ret <= 0)
905  goto ex;
906 
907  } else if(strncmp(treatpt, "mipsel_path=", 12) == 0) {
908  sprintf(eff_path, "-boot_image %s mipsel_path=", formpt);
909  ret= Xorriso_coordinate_system_area(xorriso, 2, 0, eff_path, 0);
910  if(ret <= 0)
911  goto ex;
912  ret= Xorriso_normalize_img_path(xorriso, xorriso->wdi, treatpt + 12,
913  eff_path, 2);
914  if(ret <= 0)
915  goto ex;
916  ret= Xorriso_add_mips_boot_file(xorriso, eff_path, 2);
917  if(ret <= 0)
918  goto ex;
919 
920  } else if(strcmp(treatpt, "mips_discard") == 0 ||
921  strcmp(treatpt, "mipsel_discard") == 0 ||
922  strcmp(treatpt, "sparc_discard") == 0 ||
923  strcmp(treatpt, "hppa_discard") == 0 ||
924  strcmp(treatpt, "alpha_discard") == 0) {
925  xorriso->system_area_options&= ~0xfc; /* system area type 0 */
926  Xorriso_add_mips_boot_file(xorriso, "", 1); /* give up MIPS boot files */
927  Xorriso_set_hppa_boot_parm(xorriso, "", "", 1); /* give up HP-PA files */
928  Xorriso_set_alpha_boot(xorriso, "", 1); /* give up DEC Alpha loader */
929 
930  } else if(strncmp(treatpt, "sparc_label=", 12) == 0) {
931  sprintf(eff_path, "-boot_image %s sparc_label=", formpt);
932  ret= Xorriso_coordinate_system_area(xorriso, 3, 0, eff_path, 0);
933  if(ret <= 0)
934  goto ex;
935  strncpy(xorriso->ascii_disc_label, treatpt + 12,
937  xorriso->ascii_disc_label[Xorriso_disc_label_sizE - 1] = 0;
938 
939  } else if(strncmp(treatpt, "grub2_sparc_core=", 17) == 0) {
940  ret= Xorriso_normalize_img_path(xorriso, xorriso->wdi, treatpt + 17,
941  xorriso->grub2_sparc_core, 2);
942  if(ret <= 0)
943  goto ex;
944 
945  } else if(strncmp(treatpt, "hppa_", 5) == 0) {
946  sprintf(eff_path, "-boot_image %s %s", formpt, treatpt);
947  palohdrversion= (xorriso->system_area_options >> 2) & 0x3f;
948  if(palohdrversion != 4)
949  palohdrversion= 5;
950  ret= Xorriso_coordinate_system_area(xorriso, palohdrversion, 0, eff_path,
951  0);
952  if(ret <= 0)
953  goto ex;
954  eqpt= strchr(treatpt, '=');
955  if(eqpt == NULL) {
956  sprintf(xorriso->info_text,
957  "No equal sign found in -boot_image %s %s", form, treatment);
958  Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);
959  ret= 0; goto ex;
960  }
961  parm_len= (eqpt - treatpt) - 5;
962  if(parm_len > (int) sizeof(parm) - 1)
963  parm_len= sizeof(parm) - 1;
964  strncpy(parm, treatpt + 5, parm_len);
965  parm[parm_len]= 0;
966  ret= Xorriso_set_hppa_boot_parm(xorriso, eqpt + 1, parm, 0);
967  if(ret <= 0)
968  goto ex;
969 
970  } else if(strncmp(treatpt, "alpha_boot=", 11) == 0) {
971  sprintf(eff_path, "-boot_image %s %s", formpt, treatpt);
972  ret= Xorriso_coordinate_system_area(xorriso, 6, 0, eff_path, 0);
973  if(ret <= 0)
974  goto ex;
975  ret = Xorriso_set_alpha_boot(xorriso, treatpt + 11, 0);
976  if(ret <= 0)
977  goto ex;
978 
979  } else if(strncmp(treatpt, "boot_info_table=", 16)==0) {
980  if(strcmp(treatpt + 16, "off") == 0)
981  xorriso->patch_isolinux_image= (xorriso->patch_isolinux_image & ~3) | 0;
982  else if(strcmp(treatpt + 16, "on") == 0)
983  xorriso->patch_isolinux_image= (xorriso->patch_isolinux_image & ~3) |
984  1 | (2 * (strcmp(treatpt, "grub") == 0));
985  else
986  was_ok= 0;
987 
988  } else if(strncmp(treatpt, "grub2_boot_info=", 16)==0) {
989  if(strcmp(treatpt + 16, "off") == 0)
990  xorriso->patch_isolinux_image= xorriso->patch_isolinux_image & ~512;
991  else if(strcmp(treatpt + 16, "on") == 0)
992  xorriso->patch_isolinux_image= xorriso->patch_isolinux_image | 512;
993  else
994  was_ok= 0;
995 
996  } else if(strncmp(treatpt, "load_size=", 10) == 0) {
997  if(strcmp(treatpt + 10, "full") == 0) {
998  xorriso->boot_img_full_size= 1;
999  } else {
1000  num= Scanf_io_size(treatpt + 10, 0);
1001  if(num < 512 && isolinux_grub) {
1002  sprintf(xorriso->info_text,
1003  "-boot_image %s : load_size too small (%s < 512)",
1004  formpt, treatpt + 10);
1005  Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);
1006  {ret= 0; goto ex;}
1007  }
1008  xorriso->boot_image_load_size= num;
1009  }
1010  xorriso->boot_img_size_default= 0;
1011 
1012  } else if(strncmp(treatpt, "id_string=", 10) == 0) {
1013  memset(xorriso->boot_id_string, 0, 29);
1014  if(strlen(treatpt + 10) == 56) {
1015  ret= Hex_to_bin(treatpt + 10, 28, &count, xorriso->boot_id_string, 0);
1016  } else
1017  ret= 0;
1018  if(ret <= 0)
1019  strncpy((char *) xorriso->boot_id_string, treatpt + 10, 28);
1020 
1021  } else if(strncmp(treatpt, "sel_crit=", 9) == 0) {
1022  memset(xorriso->boot_selection_crit, 0, 21);
1023  count= 0;
1024  ret= Hex_to_bin(treatpt + 9, 20, &count, xorriso->boot_selection_crit, 0);
1025  if(ret <= 0) {
1026  sprintf(xorriso->info_text,
1027  "-boot_image %s sel_crit= : Wrong form. Need even number of hex digits.",
1028  formpt);
1029  Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);
1030  {ret= 0; goto ex;}
1031  }
1032 
1033  } else if(strncmp(treatpt, "system_area=", 12) == 0) {
1034  if(strcmp(formpt, "isolinux")==0) {
1035  ret= Xorriso_coordinate_system_area(xorriso, 0, 2,
1036  "-boot_image isolinux system_area=", 0);
1037  if(ret <= 0)
1038  goto ex;
1039  }
1040  if(strcmp(treatpt + 12, ".") == 0) {
1041  ret= Xorriso_set_system_area_path(xorriso, "", 0);
1042  } else {
1043  ret= Xorriso_set_system_area_path(xorriso, treatpt + 12, 0);
1044  }
1045  if(ret <= 0)
1046  goto ex;
1047  xorriso->system_area_options&= ~0x4000;
1048  if(strcmp(treatpt + 12, "/dev/zero") == 0)
1049  xorriso->system_area_clear_loaded= 1;
1050 
1051  } else if(strncmp(treatpt, "partition_table=", 16)==0) {
1052  if(strcmp(treatpt + 16, "off") == 0) {
1053  xorriso->system_area_options&= ~3;
1054  } else if(strcmp(treatpt + 16, "on") == 0) {
1055  sprintf(eff_path, "-boot_image %s partition_table=", formpt);
1056  if(strcmp(formpt, "isolinux")==0)
1057  ret= Xorriso_coordinate_system_area(xorriso, 0, 2, eff_path, 0);
1058  else
1059  ret= Xorriso_coordinate_system_area(xorriso, 0, 1, eff_path, 0);
1060  if(ret <= 0)
1061  goto ex;
1062  } else
1063  was_ok= 0;
1064  } else if(strncmp(treatpt, "partition_entry=", 16)==0) {
1065  if(strcmp(formpt, "isolinux") != 0) {
1066  sprintf(xorriso->info_text,
1067  "-boot_image %s partition_entry=%s : Wrong type. Need \"isolinux\".",
1068  formpt, treatpt + 16);
1069  Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);
1070  {ret= 0; goto ex;}
1071  }
1072  if(strcmp(treatpt + 16, "gpt_basdat") == 0) {
1073  xorriso->patch_isolinux_image = (xorriso->patch_isolinux_image & ~0x0fc) |
1074  (1 << 2);
1075  } else if(strcmp(treatpt + 16, "gpt_hfsplus") == 0) {
1076  xorriso->patch_isolinux_image = (xorriso->patch_isolinux_image & ~0x0fc) |
1077  (2 << 2);
1078  } else if(strcmp(treatpt + 16, "apm_hfsplus") == 0) {
1079  xorriso->patch_isolinux_image = xorriso->patch_isolinux_image | (1 << 8);
1080  } else if(strcmp(treatpt + 16, "off") == 0) {
1081  xorriso->patch_isolinux_image = (xorriso->patch_isolinux_image & ~0x1fc);
1082  } else
1083  was_ok= 0;
1084 
1085  } else if(strncmp(treatpt, "partition_offset=", 17)==0) {
1086  u= 0;
1087  sscanf(treatpt + 17, "%u", &u);
1088  if(u > 0 && u < 16) {
1089  sprintf(xorriso->info_text,
1090  "-boot_image %s partition_offset= : Non-zero number too small (<16).",
1091  formpt);
1092  Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);
1093  {ret= 0; goto ex;}
1094  }
1095  xorriso->partition_offset= u;
1096 
1097  } else if(strncmp(treatpt, "appended_part_as=", 17) == 0) {
1098  if(strcmp(treatpt + 17, "gpt") == 0) {
1099  xorriso->appended_as_gpt = 1;
1100  } else if(strcmp(treatpt + 17, "mbr") == 0) {
1101  xorriso->appended_as_gpt = 0;
1102  xorriso->appended_as_apm = 0;
1103  } else if(strcmp(treatpt + 17, "apm") == 0) {
1104  xorriso->appended_as_apm = 1;
1105  } else
1106  was_ok= 0;
1107 
1108  } else if(strncmp(treatpt, "gpt_disk_guid=", 14) == 0) {
1109  ret= Xorriso_parse_gpt_guid(xorriso, treatpt + 14, 0);
1110  if(ret <= 0)
1111  goto ex;
1112 
1113  } else if(strncmp(treatpt, "part_like_isohybrid=", 20) == 0) {
1114  if(strcmp(treatpt + 20, "on") == 0)
1115  xorriso->part_like_isohybrid= 1;
1116  else if(strcmp(treatpt + 20, "off") == 0)
1117  xorriso->part_like_isohybrid= 0;
1118  else
1119  was_ok= 0;
1120 
1121  } else if(strncmp(treatpt, "iso_mbr_part_type=", 18) == 0) {
1122  ret= 256;
1123  xorriso->iso_mbr_part_flag&= ~1;
1124  if(strncmp(treatpt + 18, "default", 2) == 0) {
1125  ret= -1;
1126  } else if(strncmp(treatpt + 18, "0x", 2) == 0) {
1127  u= 256;
1128  sscanf(treatpt + 20, "%x", &u);
1129  ret= u;
1130  } else {
1131  ret= Xorriso_parse_type_guid(xorriso, treatpt + 18,
1132  xorriso->iso_gpt_type_guid, &type_code, 0);
1133  if(ret > 0) {
1134  ret= type_code;
1135  xorriso->iso_mbr_part_flag|= 1;
1136  } else {
1137  sscanf(treatpt + 18, "%d", &ret);
1138  }
1139  }
1140 
1141  if(ret < -1 || ret > 0xff) {
1142  sprintf(xorriso->info_text,
1143  "-boot_image %s : iso_mbr_part_type='%s' wrong (\"default\", 0 ... 255, 0x00 ... 0xff)",
1144  formpt, treatpt + 18);
1145  Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);
1146  {ret= 0; goto ex;}
1147  }
1148  xorriso->iso_mbr_part_type= ret;
1149 
1150  } else if(strncmp(treatpt, "partition_hd_cyl=", 17)==0) {
1151  u= 0;
1152  sscanf(treatpt + 17, "%u", &u);
1153  if(u > 255) {
1154  sprintf(xorriso->info_text,
1155  "-boot_image %s partition_hd_cyl= : Number too large (>255).", formpt);
1156  Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);
1157  {ret= 0; goto ex;}
1158  }
1159  xorriso->partition_heads_per_cyl= u;
1160 
1161  } else if(strncmp(treatpt, "partition_sec_hd=", 17)==0) {
1162  u= 0;
1163  sscanf(treatpt + 17, "%u", &u);
1164  if(u > 63) {
1165  sprintf(xorriso->info_text,
1166  "-boot_image %s partition_sec_hd= : Number too large (>63).", formpt);
1167  Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);
1168  {ret= 0; goto ex;}
1169  }
1170  xorriso->partition_secs_per_head= u;
1171 
1172  } else if(strncmp(treatpt, "partition_cyl_align=", 20)==0) {
1173  if(strcmp(treatpt + 20, "auto") == 0)
1174  xorriso->system_area_options= (xorriso->system_area_options & ~0x300);
1175  else if(strcmp(treatpt + 20, "on") == 0)
1176  xorriso->system_area_options=
1177  (xorriso->system_area_options & ~0x300) | 0x100;
1178  else if(strcmp(treatpt + 20, "off") == 0)
1179  xorriso->system_area_options=
1180  (xorriso->system_area_options & ~0x300) | 0x200;
1181  else if(strcmp(treatpt + 20, "all") == 0)
1182  xorriso->system_area_options=
1183  (xorriso->system_area_options & ~0x300) | 0x300;
1184  else {
1185  sprintf(xorriso->info_text,
1186  "-boot_image %s partition_cyl_align: unknown mode : %s",
1187  formpt, treatpt + 20);
1188  Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "SORRY", 0);
1189  {ret= 0; goto ex;}
1190  }
1191 
1192  } else if(strncmp(treatpt, "platform_id=", 12)==0) {
1193  u= 256; /* intentionally too large */
1194  if(strncmp(treatpt + 12, "0x", 2) == 0)
1195  sscanf(treatpt + 14, "%x", &u);
1196  else
1197  sscanf(treatpt + 12, "%u", &u);
1198  if(u > 0xff) {
1199  sprintf(xorriso->info_text,
1200  "-boot_image %s : platform_id too large (%s > 0xff)",
1201  formpt, treatpt + 12);
1202  Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);
1203  {ret= 0; goto ex;}
1204  }
1205  xorriso->boot_platform_id= u;
1206 
1207  } else if(strncmp(treatpt, "emul_type=", 10)==0) {
1208  if(strcmp(treatpt + 10, "none") == 0 ||
1209  strcmp(treatpt + 10, "no_emulation") == 0) {
1210  xorriso->boot_image_emul= 0;
1211  xorriso->boot_emul_default= 0;
1212  } else if(strcmp(treatpt + 10, "hard_disk") == 0) {
1213  xorriso->boot_image_emul= 1;
1214  xorriso->boot_emul_default= 0;
1215  } else if(strcmp(treatpt + 10, "floppy") == 0 ||
1216  strcmp(treatpt + 10, "diskette") == 0) {
1217  xorriso->boot_image_emul= 2;
1218  xorriso->boot_emul_default= 0;
1219  } else {
1220  sprintf(xorriso->info_text,
1221  "-boot_image %s : Unknown media_type : %s",
1222  formpt, treatpt + 10);
1223  Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);
1224  {ret= 0; goto ex;}
1225  }
1226 
1227  } else if(strncmp(treatpt, "hfsplus_serial=", 15) == 0) {
1228  ret= Hex_to_bin(treatpt + 15, 8, &bin_count, (unsigned char *) sn, 0);
1229  if(ret <= 0 || bin_count != 8) {
1230  sprintf(xorriso->info_text,
1231  "boot_image %s : Malformed hfsplus_serial : %s",
1232  formpt, treatpt + 15);
1233  Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);
1234  Xorriso_msgs_submit(xorriso, 0,
1235  "Expected is a string of 16 hex digits [0-9a-fA-F]",
1236  0, "HINT", 0);
1237  ret= 0; goto ex;
1238  } else {
1239  memcpy(xorriso->hfsp_serial_number, sn, 8);
1240  }
1241 
1242  } else if(strncmp(treatpt, "hfsplus_block_size=", 19) == 0) {
1243  u= 0;
1244  sscanf(treatpt + 19, "%u", &u);
1245  if(u != 0 && u!= 512 && u != 2048) {
1246  sprintf(xorriso->info_text,
1247  "boot_image %s : Malformed hfsplus_block_size : %s",
1248  formpt, treatpt + 19);
1249  Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);
1250  Xorriso_msgs_submit(xorriso, 0, "Expected are 0, 512, or 2048",
1251  0, "HINT", 0);
1252  ret= 0; goto ex;
1253  }
1254  xorriso->hfsp_block_size= u;
1255 
1256  } else if(strncmp(treatpt, "apm_block_size=", 15) == 0) {
1257  u= 0;
1258  sscanf(treatpt + 15, "%u", &u);
1259  if(u != 0 && u!= 512 && u != 2048) {
1260  sprintf(xorriso->info_text,
1261  "boot_image %s : Malformed apm_block_size : %s",
1262  formpt, treatpt + 15);
1263  Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);
1264  Xorriso_msgs_submit(xorriso, 0, "Expected are 0, 512, or 2048",
1265  0, "HINT", 0);
1266  ret= 0; goto ex;
1267  }
1268  xorriso->apm_block_size= u;
1269 
1270  } else if(strncmp(treatpt, "efi_boot_part=", 14) == 0) {
1271  if(Sfile_str(xorriso->efi_boot_partition, treatpt + 14, 0) <= 0)
1272  {ret= -1; goto ex;}
1273 
1274  } else if(strncmp(treatpt, "prep_boot_part=", 15) == 0) {
1275  if(Sfile_str(xorriso->prep_partition, treatpt + 15, 0) <= 0)
1276  {ret= -1; goto ex;}
1277 
1278  } else if(strncmp(treatpt, "chrp_boot_part=", 15) == 0) {
1279  if(strcmp(treatpt + 15, "on") == 0) {
1280  xorriso->system_area_options= (xorriso->system_area_options & ~0x3cfc) |
1281  0x400;
1282  } else if(strcmp(treatpt + 15, "off") == 0) {
1283  xorriso->system_area_options= xorriso->system_area_options & ~0x3c00;
1284  } else {
1285  sprintf(xorriso->info_text,
1286  "-boot_image %s chrp_boot_part: unknown mode : %s",
1287  formpt, treatpt + 15);
1288  Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "SORRY", 0);
1289  {ret= 0; goto ex;}
1290  }
1291 
1292  } else if(strncmp(treatpt, "isohybrid=", 10) == 0 &&
1293  strcmp(formpt, "isolinux")==0) {
1294 
1295 #ifdef Xorriso_with_isohybriD
1296 
1297  if(strcmp(treatpt + 10, "off") == 0)
1298  xorriso->boot_image_isohybrid= 0;
1299  else if(strcmp(treatpt + 10, "auto") == 0)
1300  xorriso->boot_image_isohybrid= 1;
1301  else if(strcmp(treatpt + 10, "on") == 0)
1302  xorriso->boot_image_isohybrid= 2;
1303  else if(strcmp(treatpt + 10, "force") == 0)
1304  xorriso->boot_image_isohybrid= 3;
1305  else {
1306  sprintf(xorriso->info_text,
1307  "Unrecognized keyword with -boot_image %s %s",
1308  form, treatment);
1309  Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);
1310  sprintf(xorriso->info_text,
1311  "Allowed with isohybrid= are: off , auto , on , force");
1312  Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "HINT", 0);
1313  {ret= 0; goto ex;}
1314  }
1315 
1316 #else
1317 
1318  if(strcmp(treatpt + 10, "off") == 0) {
1319  xorriso->boot_image_isohybrid= 0;
1320  } else {
1321  sprintf(xorriso->info_text,
1322  "isohybrid MBR generation has been disabled on request of its inventor H. Peter Anvin on 31 Mar 2010");
1323  Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);
1324  sprintf(xorriso->info_text,
1325  "It has been replaced by -boot_image isolinux system_area=External-File");
1326  Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "HINT", 0);
1327  }
1328 
1329 #endif /* ! Xorriso_with_isohybriD */
1330 
1331  } else if(strncmp(treatpt, "grub2_mbr=", 10) == 0) {
1332  ret= Xorriso_coordinate_system_area(xorriso, 0, (1 << 14), eff_path, 1 | 2);
1333  if(ret <= 0)
1334  goto ex;
1335  if(strcmp(treatpt + 10, ".") == 0) {
1336  ret= Xorriso_set_system_area_path(xorriso, "", 0);
1337  } else {
1338  ret= Xorriso_set_system_area_path(xorriso, treatpt + 10, 0);
1339  }
1340  if(ret <= 0)
1341  goto ex;
1342  if(treatpt [10] == 0)
1343  xorriso->system_area_options&= ~0x4000;
1344  else
1345  xorriso->system_area_options|= 0x4000;
1346 
1347  } else if(strncmp(treatpt, "mbr_force_bootable=", 19) == 0) {
1348  if(strcmp(treatpt + 19, "off") == 0) {
1349  xorriso->system_area_options&= ~(1 << 15);
1350  } else if(strcmp(treatpt + 19, "on") == 0) {
1351  xorriso->system_area_options|= (1 << 15);
1352  } else {
1353  sprintf(xorriso->info_text,
1354  "-boot_image %s mbr_force_bootable=: unknown mode : %s",
1355  formpt, treatpt + 19);
1356  Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "SORRY", 0);
1357  {ret= 0; goto ex;}
1358  }
1359 
1360  } else
1361  was_ok= 0;
1362 
1363  if(!was_ok) {
1364  sprintf(xorriso->info_text, "Unrecognized options with -boot_image: %s %s",
1365  form, treatment);
1366  Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);
1367  {ret= 0; goto ex;}
1368  }
1369  ret= 1;
1370 ex:
1371  Xorriso_free_meM(eff_path);
1372  return(ret);
1373 }
1374 
1375 
1376 /* Option -calm_drive */
1377 int Xorriso_option_calm_drive(struct XorrisO *xorriso, char *which, int flag)
1378 {
1379  int gu_flag= 0, ret;
1380 
1381  if(strcmp(which,"in")==0)
1382  gu_flag= 1;
1383  else if(strcmp(which,"out")==0)
1384  gu_flag= 2;
1385  else if(strcmp(which,"on")==0) {
1386  xorriso->do_calm_drive|= 1;
1387  } else if(strcmp(which,"off")==0) {
1388  xorriso->do_calm_drive&= ~1;
1389  } else if(strcmp(which,"revoke")==0) {
1390  gu_flag= 7;
1391  } else
1392  gu_flag= 3;
1393  ret= Xorriso_drive_snooze(xorriso, gu_flag);
1394  return(ret);
1395 }
1396 
1397 
1398 /* Option -cd alias -cdi */
1399 int Xorriso_option_cdi(struct XorrisO *xorriso, char *iso_rr_path, int flag)
1400 {
1401  char *path= NULL, *eff_path= NULL, *namept;
1402  int ret;
1403 
1404  Xorriso_alloc_meM(path, char, SfileadrL);
1405  Xorriso_alloc_meM(eff_path, char, SfileadrL);
1406 
1407  if (strlen(iso_rr_path)>sizeof(xorriso->wdi)) {
1408  sprintf(xorriso->info_text,"-cdi: iso_rr_path too long (%d > %d)",
1409  (int) strlen(iso_rr_path), (int) sizeof(xorriso->wdi)-1);
1410  Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);
1411  {ret= 0; goto ex;}
1412  }
1413  Xorriso_warn_of_wildcards(xorriso, iso_rr_path, 1);
1414  sprintf(xorriso->info_text,"previous working directory:\n");
1415  Xorriso_info(xorriso,0);
1416  Xorriso_esc_filepath(xorriso, xorriso->wdi, xorriso->result_line, 0);
1417  if(xorriso->sh_style_result == 0 || xorriso->wdi[0] == 0)
1418  strcat(xorriso->result_line, "/");
1419  strcat(xorriso->result_line, "\n");
1420  Xorriso_result(xorriso,0);
1421  if(strcmp(iso_rr_path,"/")==0 || iso_rr_path[0]==0) {
1422  strcpy(xorriso->wdi,"");
1423  Xorriso_option_pwdi(xorriso, 0);
1424  {ret= 1; goto ex;}
1425  } else if(iso_rr_path[0]!='/') {
1426  strcpy(path, xorriso->wdi);
1427  if(Sfile_add_to_path(path,iso_rr_path,0)<=0)
1428  {ret= -1; goto ex;}
1429  } else {
1430  if(Sfile_str(path,iso_rr_path,0)<=0)
1431  {ret= -1; goto ex;}
1432  }
1433 
1434  ret= Xorriso_normalize_img_path(xorriso, xorriso->wdi, path, eff_path, 1);
1435  if(ret<0)
1436  goto ex;
1437  if(ret==0) {
1438  sprintf(xorriso->info_text, "-cdi: not existing yet in ISO image : ");
1439  Text_shellsafe(path, xorriso->info_text, 1);
1440  Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "WARNING", 0);
1441  ret= Xorriso_normalize_img_path(xorriso, xorriso->wdi, path, eff_path, 2);
1442  if(ret<=0)
1443  goto ex;
1444  } else if(ret!=2) {
1445  sprintf(xorriso->info_text, "-cdi: not a directory : ");
1446  Text_shellsafe(eff_path, xorriso->info_text, 1);
1447  Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);
1448  {ret= 0; goto ex;}
1449  }
1450  Xorriso_truncate_path_comps(xorriso, eff_path, path, &namept, 0);
1451  strcpy(xorriso->wdi, namept);
1452 
1453  Xorriso_option_pwdi(xorriso, 0);
1454  ret= 1;
1455 ex:;
1456  Xorriso_free_meM(path);
1457  Xorriso_free_meM(eff_path);
1458  return(ret);
1459 }
1460 
1461 
1462 /* Option -cdx */
1463 int Xorriso_option_cdx(struct XorrisO *xorriso, char *disk_path, int flag)
1464 {
1465  char *path= NULL, *eff_path= NULL;
1466  int ret;
1467 
1468  Xorriso_alloc_meM(path, char, SfileadrL);
1469  Xorriso_alloc_meM(eff_path, char, SfileadrL);
1470 
1471  if (strlen(disk_path)>sizeof(xorriso->wdx)) {
1472  sprintf(xorriso->info_text,"-cdx: disk_path too long (%d > %d)",
1473  (int) strlen(disk_path), (int) sizeof(xorriso->wdx)-1);
1474  Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);
1475  {ret= 0; goto ex;}
1476  }
1477  Xorriso_warn_of_wildcards(xorriso, disk_path, 1|2);
1478  sprintf(xorriso->info_text,"previous working directory on hard disk:\n");
1479  Xorriso_info(xorriso,0);
1480  Xorriso_esc_filepath(xorriso, xorriso->wdx, xorriso->result_line, 0);
1481  if(xorriso->sh_style_result == 0 || xorriso->wdx[0] == 0)
1482  strcat(xorriso->result_line, "/");
1483  strcat(xorriso->result_line, "\n");
1484  Xorriso_result(xorriso,0);
1485  if(strcmp(disk_path,"/")==0) {
1486  strcpy(xorriso->wdx,"");
1487  Xorriso_option_pwdx(xorriso, 0);
1488  {ret= 1; goto ex;}
1489  } else if(disk_path[0]!='/') {
1490  strcpy(path, xorriso->wdx);
1491  if(Sfile_add_to_path(path,disk_path,0)<=0)
1492  {ret= -1; goto ex;}
1493  } else {
1494  if(Sfile_str(path,disk_path,0)<=0)
1495  {ret= -1; goto ex;}
1496  }
1497 
1498  ret= Xorriso_normalize_img_path(xorriso, xorriso->wdx, path, eff_path, 2|4);
1499  if(ret<=0)
1500  goto ex;
1501  if(eff_path[0]) {
1502  ret= Sfile_type(eff_path,1|4|8);
1503  if(ret<0) {
1504  Xorriso_msgs_submit(xorriso, 0, eff_path, 0, "ERRFILE", 0);
1505  sprintf(xorriso->info_text,"-cdx: file not found : ");
1506  Text_shellsafe(eff_path, xorriso->info_text, 1);
1507  Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);
1508  {ret= 0; goto ex;}
1509  }
1510  if(ret!=2) {
1511  Xorriso_msgs_submit(xorriso, 0, eff_path, 0, "ERRFILE", 0);
1512  sprintf(xorriso->info_text, "-cdx: not a directory : ");
1513  Text_shellsafe(eff_path, xorriso->info_text, 1);
1514  Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);
1515  {ret= 0; goto ex;}
1516  }
1517  }
1518  if(Sfile_str(xorriso->wdx,eff_path,0)<=0)
1519  {ret= -1; goto ex;}
1520  Xorriso_option_pwdx(xorriso, 0);
1521  ret= 1;
1522 ex:;
1523  Xorriso_free_meM(path);
1524  Xorriso_free_meM(eff_path);
1525  return(ret);
1526 }
1527 
1528 
1529 /* Option -changes_pending */
1530 int Xorriso_option_changes_pending(struct XorrisO *xorriso, char *state,
1531  int flag)
1532 {
1533  if(strcmp(state, "no") == 0)
1534  xorriso->volset_change_pending= 0;
1535  else if(strcmp(state, "yes") == 0)
1536  xorriso->volset_change_pending= 1;
1537  else if(strcmp(state, "mkisofs_printed") == 0)
1538  xorriso->volset_change_pending= 2;
1539  else if(strcmp(state, "show_status") == 0) {
1540  strcpy(xorriso->result_line, "-changes_pending ");
1541  if(xorriso->volset_change_pending == 0)
1542  strcat(xorriso->result_line, "no");
1543  else if(xorriso->volset_change_pending == 2)
1544  strcat(xorriso->result_line, "mkisofs_printed");
1545  else
1546  strcat(xorriso->result_line, "yes");
1547  strcat(xorriso->result_line, "\n");
1548  Xorriso_result(xorriso,0);
1549  } else {
1550  sprintf(xorriso->info_text, "-changes_pending: unknown state code '%s'",
1551  state);
1552  Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);
1553  return(0);
1554  }
1555  return(1);
1556 }
1557 
1558 
1559 /* Option -charset */
1560 /* @param flag bit0= set in_charset
1561  bit1= set out_charset
1562  bit2= set local_charset
1563 */
1564 int Xorriso_option_charset(struct XorrisO *xorriso, char *name, int flag)
1565 {
1566  int ret;
1567  char *name_pt= NULL, *local_charset;
1568  iconv_t iconv_ret= (iconv_t) -1;
1569 
1570  if(name != NULL)
1571  if(name[0] != 0)
1572  name_pt= name;
1573  if(flag & 4) {
1574  ret= Xorriso_set_local_charset(xorriso, name_pt, 0);
1575  if(ret <= 0)
1576  return(ret);
1577  }
1578  if(flag & 1) {
1579  if(name_pt != NULL) {
1580  Xorriso_get_local_charset(xorriso, &local_charset, 0);
1581  iconv_ret= iconv_open(local_charset, name_pt);
1582  if(iconv_ret == (iconv_t) -1) {
1583  sprintf(xorriso->info_text,
1584  "-%scharset: Cannot convert from character set ",
1585  flag & 2 ? "" : "in_");
1586  Text_shellsafe(name_pt, xorriso->info_text, 1);
1587  Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, errno, "FAILURE",
1588  0);
1589  return(0);
1590  } else
1591  iconv_close(iconv_ret);
1592  }
1593  if(Sregex_string(&(xorriso->in_charset), name_pt, 0) <= 0) {
1594  Xorriso_no_malloc_memory(xorriso, NULL, 0);
1595  return(-1);
1596  }
1597  }
1598  if(flag & 2) {
1599  if(name_pt != NULL) {
1600  Xorriso_get_local_charset(xorriso, &local_charset, 0);
1601  iconv_ret= iconv_open(local_charset, name_pt);
1602  if(iconv_ret == (iconv_t) -1) {
1603  sprintf(xorriso->info_text, "-%scharset: Cannot convert to charset ",
1604  flag & 1 ? "" : "out_");
1605  Text_shellsafe(name_pt, xorriso->info_text, 1);
1606  Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, errno, "FAILURE",
1607  0);
1608  return(0);
1609  } else
1610  iconv_close(iconv_ret);
1611  }
1612  if(Sregex_string(&(xorriso->out_charset), name_pt, 0) <= 0) {
1613  Xorriso_no_malloc_memory(xorriso, NULL, 0);
1614  return(-1);
1615  }
1616  }
1617  if(flag & 3) {
1618  if(name_pt == NULL)
1619  Xorriso_get_local_charset(xorriso, &name_pt, 0);
1620  sprintf(xorriso->info_text, "Character set for %sconversion is now: ",
1621  (flag & 3) == 1 ? "input " : (flag & 3) == 2 ? "output " : "");
1622  Text_shellsafe(name_pt, xorriso->info_text, 1);
1623  Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "NOTE", 0);
1624  }
1625  return(1);
1626 }
1627 
1628 
1629 /* Options -check_md5 and -check_md5_r
1630  @param flag bit0= issue summary message
1631  bit1= do not reset pacifier, no final pacifier message
1632  >>> bit2= do not issue pacifier messages at all
1633  bit3= recursive: -check_md5_r
1634 */
1635 int Xorriso_option_check_md5(struct XorrisO *xorriso,
1636  int argc, char **argv, int *idx, int flag)
1637 {
1638  int ret, i, mem_pci, end_idx, fret, sev, do_report= 0;
1639  int optc= 0;
1640  char **optv= NULL, *cpt, *severity= "ALL", off_severity[20];
1641  struct FindjoB *job= NULL;
1642  double mem_lut= 0.0;
1643 
1644  mem_pci= xorriso->pacifier_interval;
1645 
1646  ret= Xorriso_opt_args(xorriso, "-check_md5", argc, argv, *idx + 1,
1647  &end_idx, &optc, &optv, 128);
1648  if(ret<=0)
1649  goto ex;
1650 
1651  /* Interpret argv[*idx] as severity */
1652  if(argc <= *idx) {
1653  sprintf(xorriso->info_text,
1654  "-check_md5: No event severity given for case of mismatch");
1655  Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);
1656  ret= 0; goto ex;
1657  }
1658  severity= argv[*idx];
1659  Xorriso__to_upper(severity, off_severity, (int) sizeof(off_severity), 0);
1660  severity= off_severity;
1661  ret= Xorriso__text_to_sev(severity, &sev, 0);
1662  if(ret<=0) {
1663  sprintf(xorriso->info_text, "-check_md5: Not a known severity name : ");
1664  Text_shellsafe(severity, xorriso->info_text, 1);
1665  Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);
1666  goto ex;
1667  }
1668 
1669  if(!(flag & (2 | 4))) {
1670  Xorriso_pacifier_reset(xorriso, 0);
1671  mem_lut= xorriso->last_update_time;
1672  }
1673  xorriso->pacifier_interval= 5.0;
1674 
1675  xorriso->find_check_md5_result= 0;
1676 
1677  if(optc == 0) {
1678  ret= Xorriso_check_session_md5(xorriso, severity, 0);
1679  do_report= 1;
1680  goto ex;
1681  }
1682 
1683  for(i= 0; i < optc; i++) {
1684  if(flag & 8) {
1685  ret= Findjob_new(&job, optv[i], 0);
1686  if(ret<=0) {
1687  Xorriso_no_findjob(xorriso, "-check_md5_r", 0);
1688  {ret= -1; goto ex;}
1689  }
1690  Findjob_set_action_target(job, 35, severity, 0);
1691  cpt= optv[i];
1692  ret= Xorriso_findi_sorted(xorriso, job, (off_t) 0, 1, &cpt, 0);
1693  Findjob_destroy(&job, 0);
1694  if(ret > 0)
1695  ret= xorriso->find_compare_result;
1696  else {
1697  ret= -1;
1698  xorriso->find_check_md5_result|= 2;
1699  }
1700  } else {
1701  ret= Xorriso_check_md5(xorriso, NULL, optv[i], 4);
1702  if(ret < 0)
1703  xorriso->find_check_md5_result|= 2;
1704  else if(ret == 0)
1705  xorriso->find_check_md5_result|= 1;
1706  else if(ret == 1)
1707  xorriso->find_check_md5_result|= 8;
1708  else if(ret == 2)
1709  xorriso->find_check_md5_result|= 4;
1710  }
1711  if(ret>0 && !xorriso->request_to_abort)
1712  continue; /* regular bottom of loop */
1713  fret= Xorriso_eval_problem_status(xorriso, ret, 1|2);
1714  if(fret>=0)
1715  continue;
1716  ret= 0; goto report_outcome;
1717  }
1718  ret= 1;
1719 
1720 report_outcome:;
1721  do_report= 1;
1722 
1723 ex:;
1724  if(!(flag & (2 | 4))) {
1725  xorriso->pacifier_interval= mem_pci;
1726  if(mem_lut!=xorriso->last_update_time && !(flag&2))
1727  Xorriso_pacifier_callback(xorriso, "content bytes read",
1728  xorriso->pacifier_count, 0, "", 1 | 8 | 32);
1729  }
1730  if(do_report) {
1731  if(optc == 0) {
1732  if(ret <= 0) {
1733  sprintf(xorriso->result_line,
1734  "MD5 MISMATCH WITH DATA OF LOADED SESSION !\n");
1735  Xorriso_result(xorriso,0);
1736  if(strcmp(severity, "ALL") != 0) {
1737  sprintf(xorriso->info_text,
1738  "Event triggered by MD5 comparison mismatch");
1739  Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, severity, 0);
1740  }
1741  } else {
1742  sprintf(xorriso->result_line, "Ok, session data match recorded md5.\n");
1743  Xorriso_result(xorriso,0);
1744  }
1745  } else {
1746  Xorriso_report_md5_outcome(xorriso, severity, 0);
1747  }
1748  }
1749  (*idx)= end_idx;
1750  Xorriso_opt_args(xorriso, "-getfacl", argc, argv, *idx, &end_idx,
1751  &optc, &optv, 256);
1752  Findjob_destroy(&job, 0);
1753  if(ret <= 0)
1754  return(ret);
1755  return((xorriso->find_check_md5_result & 3) == 0);
1756 }
1757 
1758 
1759 /* Option -check_media */
1761  int argc, char **argv, int *idx, int flag)
1762 {
1763  int ret, i, count, lba, blocks, quality, pass, was_md5= 0, was_event= 0;
1764  int end_idx, old_idx, os_errno, to_info= 0;
1765  char quality_name[80], *head_buffer= NULL;
1766  struct SpotlisT *spotlist= NULL;
1767  struct CheckmediajoB *job= NULL;
1768  struct FindjoB *findjob= NULL;
1769  struct stat dir_stbuf;
1770 
1771  old_idx= *idx;
1772  end_idx= Xorriso_end_idx(xorriso, argc, argv, *idx, 1);
1773  (*idx)= end_idx;
1774 
1775  Xorriso_alloc_meM(head_buffer, char, 64 * 1024);
1776 
1777  ret= Checkmediajob_new(&job, 0);
1778  if(ret <= 0)
1779  goto ex;
1780  ret= Xorriso_check_media_setup_job(xorriso, job, argv, old_idx, end_idx, 0);
1781  if(ret <= 0)
1782  goto ex;
1783 
1784  to_info= (strcmp(job->data_to_path, "-") == 0);
1785  if((job->report_mode == 1 || job->report_mode == 2) && job->use_dev == 1) {
1786  sprintf(xorriso->info_text,
1787  "-check_media: cannot report=*files while use=outdef");
1788  Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);
1789  ret= 0; goto ex;
1790  }
1791  if(job->patch_lba0 && job->data_to_path[0] == 0) {
1792  sprintf(xorriso->info_text,
1793  "-check_media: cannot apply patch_lba0= while data_to= has empty value");
1794  Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);
1795  ret= 0; goto ex;
1796  }
1797  if(job->patch_lba0 && to_info) {
1798  sprintf(xorriso->info_text,
1799  "-check_media: cannot apply patch_lba0= while data_to= is \"-\"");
1800  Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);
1801  ret= 0; goto ex;
1802  }
1803 
1804  if(job->use_dev == 2) {
1805  if(job->sector_map_path[0] == 0) {
1806  sprintf(xorriso->info_text,
1807  "-check_media: option use=sector_map but sector_map=''");
1808  Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);
1809  ret= 0; goto ex;
1810  }
1812  xorriso->info_text, &os_errno, 0);
1813  if(ret <= 0) {
1814  if(xorriso->info_text[0])
1815  Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, os_errno,
1816  "FAILURE", 0);
1817  goto ex;
1818  }
1819  ret= Xorriso_sectormap_to_spotlist(xorriso, job, &spotlist, 0);
1820  if(ret <= 0)
1821  goto ex;
1822  Sectorbitmap_destroy(&(xorriso->in_sector_map), 0);
1823  ret= Sectorbitmap_clone(job->sector_map, &(xorriso->in_sector_map), 0);
1824  if(ret <= 0)
1825  goto ex;
1826  } else {
1827  ret= Xorriso_check_media(xorriso, &spotlist, job, 0);
1828  if(ret <= 0)
1829  goto ex;
1830  }
1831 
1832  if(job->patch_lba0) {
1833  ret= Xorriso_open_job_data_to(xorriso, job, 0);
1834  if(ret <= 0)
1835  goto ex;
1836  if(ret == 1) {
1837  ret= Xorriso_update_iso_lba0(xorriso, job->patch_lba0_msc1, 0,
1838  head_buffer, job,
1839  (8 * (job->patch_lba0 == 1)) |
1840  4 | (job->patch_lba0_msc1 < 0));
1841  if(ret <= 0)
1842  goto ex;
1843  }
1844  }
1845 
1846  if(job->report_mode == 0 || job->report_mode == 2) { /* report blocks */
1847  for(pass= 0; pass < 2; pass++) {
1848  if(pass == 0) {
1849  sprintf(xorriso->result_line,
1850  "Media checks : lba , size , quality\n");
1851  } else {
1852  if(!was_md5)
1853  break;
1854  sprintf(xorriso->result_line,
1855  "MD5 checks : lba , size , result\n");
1856  }
1857  if(to_info) {
1858  strcpy(xorriso->info_text, xorriso->result_line);
1859  Xorriso_info(xorriso, 0);
1860  } else {
1861  Xorriso_result(xorriso, 0);
1862  }
1863  count= Spotlist_count(spotlist, 0);
1864  for(i= 0; i < count; i++) {
1865  ret= Spotlist_get_item(spotlist, i, &lba, &blocks, &quality, 0);
1866  if(ret <= 0)
1867  continue;
1868  if(pass == 0) {
1869  if(quality == Xorriso_read_quality_md5_mismatcH ||
1870  quality == Xorriso_read_quality_unreadablE) {
1871  was_event= 1;
1872  }
1873  if(quality == Xorriso_read_quality_md5_matcH ||
1874  quality == Xorriso_read_quality_md5_mismatcH) {
1875  was_md5= 1;
1876  continue;
1877  }
1878  }
1879  else if(pass == 1 && !(quality == Xorriso_read_quality_md5_matcH ||
1881  continue;
1882  sprintf(xorriso->result_line, "%s: %10d , %10d , %s\n",
1883  pass == 0 ? "Media region " : "MD5 tag range",
1884  lba, blocks, Spotlist__quality_name(quality, quality_name,
1885  xorriso->check_media_bad_limit, 0));
1886  if(to_info) {
1887  strcpy(xorriso->info_text, xorriso->result_line);
1888  Xorriso_info(xorriso, 0);
1889  } else {
1890  Xorriso_result(xorriso, 0);
1891  }
1892  }
1893  }
1894  }
1895  if(job->report_mode == 1 || job->report_mode == 2) { /* report files */
1896  ret= Findjob_new(&findjob, "/", 0);
1897  if(ret<=0) {
1898  Xorriso_no_findjob(xorriso, "-check_media report=files", 0);
1899  {ret= -1; goto ex;}
1900  }
1901  Findjob_set_damage_filter(findjob, 1, 0);
1902  Findjob_set_action_target(findjob, 21, NULL, 0);
1903  ret= Xorriso_findi(xorriso, findjob, NULL, (off_t) 0,
1904  NULL, "/", &dir_stbuf, 0, 0);
1905  Findjob_destroy(&findjob, 0);
1906  if(ret <= 0)
1907  goto ex;
1908  }
1909  ret= 1;
1910 ex:;
1911  if(was_event && strcmp(job->event_severity, "ALL") != 0) {
1912  sprintf(xorriso->info_text,
1913  "Event triggered by media read error or MD5 comparison mismatch");
1914  Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, job->event_severity,
1915  0);
1916  }
1917  Spotlist_destroy(&spotlist, 0);
1918  Checkmediajob_destroy(&job, 0);
1919  Xorriso_free_meM(head_buffer);
1920  return(ret);
1921 }
1922 
1923 
1924 /* Option -check_media_defaults */
1926  int argc, char **argv, int *idx, int flag)
1927 {
1928  int ret, old_idx, end_idx;
1929  struct CheckmediajoB *job= NULL;
1930 
1931  old_idx= *idx;
1932  end_idx= Xorriso_end_idx(xorriso, argc, argv, *idx, 1);
1933  (*idx)= end_idx;
1934 
1935  ret= Checkmediajob_new(&job, 0);
1936  if(ret <= 0)
1937  goto ex;
1938  ret= Xorriso_check_media_setup_job(xorriso, job, argv, old_idx, end_idx, 0);
1939  if(ret <= 0)
1940  goto ex;
1942  xorriso->check_media_default= job;
1943  job= NULL;
1944  ret= 1;
1945 ex:;
1946  Checkmediajob_destroy(&job, 0);
1947  return(ret);
1948 }
1949 
1950 
1951 /* Option -chgrp alias -chgrpi , chgrp_r alias chgrpi */
1952 /* @param flag bit0=recursive (-chgrp_r)
1953 */
1954 int Xorriso_option_chgrpi(struct XorrisO *xorriso, char *gid,
1955  int argc, char **argv, int *idx, int flag)
1956 {
1957  int i, ret, was_failure= 0, end_idx, fret;
1958  gid_t gid_number;
1959  int optc= 0;
1960  char **optv= NULL;
1961  struct FindjoB *job= NULL;
1962  struct stat dir_stbuf;
1963 
1964  ret= Xorriso_opt_args(xorriso, "-chgrpi", argc, argv, *idx, &end_idx, &optc,
1965  &optv, 0);
1966  if(ret<=0)
1967  goto ex;
1968  ret= Xorriso_convert_gidstring(xorriso, gid, &gid_number, 0);
1969  if(ret<=0)
1970  goto ex;
1971  for(i= 0; i<optc; i++) {
1972  if(flag&1) {
1973  ret= Findjob_new(&job, optv[i], 0);
1974  if(ret<=0) {
1975  Xorriso_no_findjob(xorriso, "-chgrp_r", 0);
1976  {ret= -1; goto ex;}
1977  }
1978  Findjob_set_action_chgrp(job, gid_number, 0);
1979  ret= Xorriso_findi(xorriso, job, NULL, (off_t) 0,
1980  NULL, optv[i], &dir_stbuf, 0, 0);
1981  Findjob_destroy(&job, 0);
1982  } else
1983  ret= Xorriso_set_gid(xorriso, optv[i], gid_number, 0);
1984  if(ret>0 && !xorriso->request_to_abort)
1985  continue; /* regular bottom of loop */
1986  was_failure= 1;
1987  fret= Xorriso_eval_problem_status(xorriso, ret, 1|2);
1988  if(fret>=0)
1989  continue;
1990  goto ex;
1991  }
1992  ret= 1;
1993 ex:;
1994  (*idx)= end_idx;
1995  Xorriso_opt_args(xorriso, "-chgrpi", argc, argv, *idx, &end_idx, &optc, &optv,
1996  256); /* clean up */
1997  if(ret<=0)
1998  return(ret);
1999  Findjob_destroy(&job, 0);
2000  return(!was_failure);
2001 }
2002 
2003 
2004 /* Option -chmod alias -chmodi , -chmod_r alias chmod_ri */
2005 /* @param flag bit0=recursive (-chmod_r)
2006 */
2007 int Xorriso_option_chmodi(struct XorrisO *xorriso, char *mode,
2008  int argc, char **argv, int *idx, int flag)
2009 {
2010  int i, ret, was_failure= 0, end_idx, fret;
2011  mode_t mode_and= ~0, mode_or= 0;
2012  int optc= 0;
2013  char **optv= NULL;
2014  struct FindjoB *job= NULL;
2015  struct stat dir_stbuf;
2016 
2017  ret= Xorriso_opt_args(xorriso, "-chmodi", argc, argv, *idx, &end_idx, &optc,
2018  &optv, 0);
2019  if(ret<=0)
2020  goto ex;
2021  ret= Xorriso_convert_modstring(xorriso, "-chmodi",
2022  mode, &mode_and, &mode_or, 0);
2023  if(ret<=0)
2024  goto ex;
2025  for(i= 0; i<optc; i++) {
2026  if(flag&1) {
2027  ret= Findjob_new(&job, optv[i], 0);
2028  if(ret<=0) {
2029  Xorriso_no_findjob(xorriso, "-chmod_r", 0);
2030  {ret= -1; goto ex;}
2031  }
2032  Findjob_set_action_chmod(job, mode_and, mode_or, 0);
2033  ret= Xorriso_findi(xorriso, job, NULL, (off_t) 0,
2034  NULL, optv[i], &dir_stbuf, 0, 0);
2035  Findjob_destroy(&job, 0);
2036  } else {
2037  ret= Xorriso_set_st_mode(xorriso, optv[i], mode_and, mode_or, 0);
2038  }
2039  if(ret>0 && !xorriso->request_to_abort)
2040  continue; /* regular bottom of loop */
2041  was_failure= 1;
2042  fret= Xorriso_eval_problem_status(xorriso, ret, 1|2);
2043  if(fret>=0)
2044  continue;
2045  ret= 0; goto ex;
2046  }
2047  ret= 1;
2048 ex:;
2049  (*idx)= end_idx;
2050  Xorriso_opt_args(xorriso, "-chmodi", argc, argv, *idx, &end_idx, &optc, &optv,
2051  256);
2052  Findjob_destroy(&job, 0);
2053  if(ret<=0)
2054  return(ret);
2055  return(!was_failure);
2056 }
2057 
2058 
2059 /* Option -chown alias -chowni , chown_r alias chown_ri */
2060 /* @param flag bit0=recursive (-chown_r)
2061 */
2062 int Xorriso_option_chowni(struct XorrisO *xorriso, char *uid,
2063  int argc, char **argv, int *idx, int flag)
2064 {
2065  int i, ret, was_failure= 0, end_idx, fret;
2066  uid_t uid_number;
2067  int optc= 0;
2068  char **optv= NULL;
2069  struct FindjoB *job= NULL;
2070  struct stat dir_stbuf;
2071 
2072  ret= Xorriso_opt_args(xorriso, "-chowni", argc, argv, *idx, &end_idx,
2073  &optc, &optv, 0);
2074  if(ret<=0)
2075  goto ex;
2076  ret= Xorriso_convert_uidstring(xorriso, uid, &uid_number, 0);
2077  if(ret<=0)
2078  goto ex;
2079  for(i= 0; i<optc; i++) {
2080  if(flag&1) {
2081  ret= Findjob_new(&job, optv[i], 0);
2082  if(ret<=0) {
2083  Xorriso_no_findjob(xorriso, "-chown_r", 0);
2084  {ret= -1; goto ex;}
2085  }
2086  Findjob_set_action_chown(job, uid_number, 0);
2087  ret= Xorriso_findi(xorriso, job, NULL, (off_t) 0,
2088  NULL, optv[i], &dir_stbuf, 0, 0);
2089  Findjob_destroy(&job, 0);
2090  } else
2091  ret= Xorriso_set_uid(xorriso, optv[i], uid_number, 0);
2092  if(ret>0 && !xorriso->request_to_abort)
2093  continue; /* regular bottom of loop */
2094  was_failure= 1;
2095  fret= Xorriso_eval_problem_status(xorriso, ret, 1|2);
2096  if(fret>=0)
2097  continue;
2098  ret= 0; goto ex;
2099  }
2100  ret= 1;
2101 ex:;
2102  (*idx)= end_idx;
2103  Xorriso_opt_args(xorriso, "-chowni", argc, argv, *idx, &end_idx,
2104  &optc, &optv, 256);
2105  Findjob_destroy(&job, 0);
2106  if(ret<=0)
2107  return(ret);
2108  return(!was_failure);
2109 }
2110 
2111 
2112 /* Option -clone */
2113 int Xorriso_option_clone(struct XorrisO *xorriso, char *origin, char *dest,
2114  int flag)
2115 {
2116  int ret;
2117 
2118  ret= Xorriso_clone_tree(xorriso, NULL, origin, dest, 0);
2119  return(ret);
2120 }
2121 
2122 
2123 /* Option -close "on"|"off"|"as_needed" */
2124 int Xorriso_option_close(struct XorrisO *xorriso, char *mode, int flag)
2125 {
2126  if(strcmp(mode, "off") == 0) {
2127  xorriso->do_close= 0;
2128  xorriso->auto_close= 0;
2129  } else if(strcmp(mode, "as_needed") == 0) {
2130  xorriso->do_close= 0;
2131  xorriso->auto_close= 1;
2132  } else {
2133  xorriso->do_close= 1;
2134  xorriso->auto_close= 0;
2135  }
2136  return(1);
2137 }
2138 
2139 
2140 /* Option -close_damaged */
2141 int Xorriso_option_close_damaged(struct XorrisO *xorriso, char *mode, int flag)
2142 {
2143  int ret, force= 0;
2144 
2145  if(strcmp(mode, "as_needed") == 0 || strcmp(mode, "") == 0)
2146  force= 0;
2147  else if(strcmp(mode, "force") == 0)
2148  force= 1;
2149  else {
2150  sprintf(xorriso->info_text, "-close_damaged: unknown mode ");
2151  Text_shellsafe(mode, xorriso->info_text, 1);
2152  Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);
2153  return(0);
2154  }
2155  ret= Xorriso_reassure(xorriso, "-close_damaged",
2156  "Close damaged track and session", 0);
2157  if(ret <= 0)
2158  {ret= 2; goto ex;}
2159  ret= Xorriso_close_damaged(xorriso, force);
2160  if(ret <= 0)
2161  goto ex;
2162  ret= 1;
2163 ex:;
2164  return(ret);
2165 }
2166 
2167 
2168 /* Option -close_filter_list */
2169 int Xorriso_option_close_filter_list(struct XorrisO *xorriso, int flag)
2170 {
2171  xorriso->filter_list_closed= 1;
2172  return(1);
2173 }
2174 
2175 
2176 /* Option -commit */
2177 /* @param flag bit0= leave indrive and outdrive acquired as they were,
2178  i.e. do not acquire outdrive as new in-out-drive
2179  bit1= do not perform eventual -reassure
2180  @return <=0 error , 1 success, 2 revoked by -reassure , 3 no change pending
2181 */
2182 int Xorriso_option_commit(struct XorrisO *xorriso, int flag)
2183 {
2184  int ret;
2185  char eternal_problem_status_text_mem[80];
2186 
2187  if(!Xorriso_change_is_pending(xorriso, 0)) {
2188  sprintf(xorriso->info_text, "-commit: No image modifications pending");
2189  Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "WARNING", 0);
2190  {ret= 3; goto ex;}
2191  }
2192  if(!(flag&2)) {
2193  ret= Xorriso_reassure(xorriso, "-commit",
2194  "write the pending image changes to the medium", 0);
2195  if(ret<=0)
2196  {ret= 2; goto ex;}
2197  }
2198  Xorriso_process_errfile(xorriso, 0, "burn session start", 0, 1);
2199  Xorriso_get_problem_status(xorriso, eternal_problem_status_text_mem, 1);
2200  ret= Xorriso_write_session(xorriso, 0);
2201  if(ret == 2) {
2202  if(Xorriso__severity_cmp("WARNING", eternal_problem_status_text_mem) > 0)
2203  strcpy(eternal_problem_status_text_mem, "WARNING");
2204  Xorriso_set_problem_status(xorriso, eternal_problem_status_text_mem, 1);
2205  ret= Xorriso_retry_write_session(xorriso, 0);
2206  }
2207  Xorriso_process_errfile(xorriso, 0, "burn session end", 0, 1);
2208  if(ret<=0)
2209  goto ex;
2210  Xorriso_write_session_log(xorriso, 0);
2211  xorriso->volset_change_pending= 0;
2212  xorriso->no_volset_present= 0;
2213  if(flag&1)
2214  {ret= 1; goto ex;}
2215  if(Sregex_string(&(xorriso->in_charset), xorriso->out_charset, 0) <= 0)
2216  {ret= -1; goto ex;}
2217  if(xorriso->grow_blindly_msc2>=0)
2218  ret= Xorriso_option_dev(xorriso, "", 3|4);
2219  else {
2220  xorriso->displacement= 0;
2221  xorriso->displacement_sign= 0;
2222  ret= Xorriso_reaquire_outdev(xorriso, 3);
2223  if(xorriso->in_drive_handle == NULL)
2224  xorriso->image_start_mode= 0; /* session setting is invalid by now */
2225  }
2226 ex:;
2227  return(ret);
2228 }
2229 
2230 
2231 /* Option -commit_eject */
2232 /* @return <=0 error , 1 success, 2 revoked by -reassure
2233 */
2234 int Xorriso_option_commit_eject(struct XorrisO *xorriso, char *which, int flag)
2235 {
2236  int ret, eret;
2237 
2238  ret= Xorriso_option_commit(xorriso, 1);
2239  if(ret<=0 || ret==2 || ret==3)
2240  return(ret);
2241  if(strcmp(which, "none")==0)
2242  eret= 1;
2243  else
2244  eret= Xorriso_option_eject(xorriso, which, 1);
2245  ret= Xorriso_option_dev(xorriso, "", 3|4);
2246  if(eret<ret)
2247  return(eret);
2248  return(ret);
2249 }
2250 
2251 
2252 /* Options -compare and -compare_r
2253  @param flag bit0= issue summary message
2254  bit1= do not reset pacifier, no final pacifier message
2255  bit2= do not issue pacifier messages at all
2256  bit3= recursive: -compare_r
2257 */
2258 int Xorriso_option_compare(struct XorrisO *xorriso, char *disk_path,
2259  char *iso_path, int flag)
2260 {
2261  int ret, mem_pci, zero= 0, result, follow_links;
2262  double mem_lut= 0.0;
2263  char *ipth, *argv[6], *eff_origin= NULL, *eff_dest= NULL;
2264 
2265  Xorriso_alloc_meM(eff_origin, char, SfileadrL);
2266  Xorriso_alloc_meM(eff_dest, char, SfileadrL);
2267 
2268  ipth= iso_path;
2269  if(ipth[0]==0)
2270  ipth= disk_path;
2271  if(disk_path[0]==0) {
2272  sprintf(xorriso->info_text, "-compare: Empty disk_path given");
2273  Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "SORRY", 1);
2274  {ret= 0; goto ex;}
2275  }
2276  ret= Xorriso_normalize_img_path(xorriso, xorriso->wdx, disk_path, eff_origin,
2277  2|4|8);
2278  if(ret<=0)
2279  goto ex;
2280  ret= Xorriso_normalize_img_path(xorriso, xorriso->wdi, ipth, eff_dest, 2|8);
2281  if(ret<=0)
2282  goto ex;
2283 
2284  if(xorriso->disk_excl_mode&8)
2285  ret= Xorriso_path_is_excluded(xorriso, eff_origin, 1);
2286  else
2287  ret= 0;
2288  if(ret!=0)
2289  goto report_outcome;
2290  if(!(flag&2)) {
2291  Xorriso_pacifier_reset(xorriso, 0);
2292  mem_lut= xorriso->last_update_time;
2293  }
2294  mem_pci= xorriso->pacifier_interval;
2295  xorriso->pacifier_interval= 5.0;
2296 
2297  if(flag&8) {
2298  xorriso->find_compare_result= 1;
2299  argv[0]= eff_dest;
2300  argv[1]= "-exec";
2301  argv[2]= "compare";
2302  argv[3]= eff_origin;
2303  zero= 0;
2304  ret= Xorriso_option_find(xorriso, 4, argv, &zero, 2); /* -findi */
2305  if(ret>0) {
2306  argv[0]= eff_origin;
2307  argv[1]= "-exec";
2308  argv[2]= "not_in_iso";
2309  argv[3]= eff_dest;
2310  zero= 0;
2311  ret= Xorriso_option_find(xorriso, 4, argv, &zero, 1|2); /* -findx */
2312  if(ret>0 && !xorriso->do_follow_mount) {
2313  argv[0]= eff_origin;
2314  argv[1]= "-type";
2315  argv[2]= "m";
2316  argv[3]= "-exec";
2317  argv[4]= "is_full_in_iso";
2318  argv[5]= eff_dest;
2319  zero= 0;
2320  ret= Xorriso_option_find(xorriso, 6, argv, &zero, 1|2); /* -findx */
2321  }
2322  if(ret>0)
2323  ret= xorriso->find_compare_result;
2324  else
2325  ret= -1;
2326  } else
2327  ret= -1;
2328  } else {
2329  follow_links= (xorriso->do_follow_links || xorriso->do_follow_param) << 28;
2330  ret= Xorriso_compare_2_files(xorriso, eff_origin, eff_dest, "", &result,
2331  2 | follow_links | ((flag&4)<<27) | (1<<30));
2332  }
2333 
2334  xorriso->pacifier_interval= mem_pci;
2335  if(mem_lut!=xorriso->last_update_time && !(flag&2))
2336  Xorriso_pacifier_callback(xorriso, "content bytes read",
2337  xorriso->pacifier_count, 0, "", 1 | 8 | 32);
2338 report_outcome:;
2339  if(ret>0) {
2340  sprintf(xorriso->result_line,
2341  "Both file objects match as far as expectable.\n");
2342  } else if(ret==0) {
2343  sprintf(xorriso->result_line, "Differences detected.\n");
2344  } else {
2345  sprintf(xorriso->result_line, "Comparison failed due to error.\n");
2346  }
2347  if(flag&1)
2348  Xorriso_result(xorriso,0);
2349  if(ret<0)
2350  goto ex;
2351  ret= 1;
2352 ex:;
2353  Xorriso_free_meM(eff_origin);
2354  Xorriso_free_meM(eff_dest);
2355  return(ret);
2356 }
2357 
2358 
2359 /* Option -compliance */
2360 int Xorriso_option_compliance(struct XorrisO *xorriso, char *mode,
2361  int flag)
2362 {
2363  return(Xorriso_relax_compliance(xorriso, mode, 0));
2364 }
2365 
2366 
2367 /* Command -concat */
2368 int Xorriso_option_concat(struct XorrisO *xorriso,
2369  int argc, char **argv, int *idx, int flag)
2370 {
2371  int ret, end_idx, optc= 0, progc= 0, iso_rr_start, prog_end_idx= -1;
2372  char **optv= NULL, **progv= NULL, *delimiter_mem= NULL;
2373  char *delimiter= NULL;
2374 
2375  /* Must be done before any goto ex; */
2376  end_idx= Xorriso_end_idx(xorriso, argc, argv, *idx, 1);
2377  iso_rr_start= *idx + 2;
2378 
2379  if(xorriso->allow_restore <= 0) {
2380  sprintf(xorriso->info_text,
2381  "-concat: image content copies are not enabled by option -osirrox");
2382  Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);
2383  ret= 0; goto ex;
2384  }
2385  if(end_idx - *idx < 3) {
2386  sprintf(xorriso->info_text,
2387  "-concat: Not enough arguments. Need mode, target, iso_rr_path.");
2388  Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);
2389  ret= 0; goto ex;
2390  }
2391  if(strcmp(argv[*idx], "pipe") == 0) {
2392  if(end_idx - *idx < 5) {
2393  sprintf(xorriso->info_text,
2394  "-concat pipe: Not enough arguments. Need delimiter, program path, delimiter, iso_rr_path.");
2395  Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);
2396  ret= 0; goto ex;
2397  }
2398 
2399  ret= Xorriso_check_thing_len(xorriso, argv[*idx + 1],
2400  sizeof(xorriso->list_delimiter), "-concat",
2401  "Delimiter", 0);
2402  if(ret <= 0)
2403  goto ex;
2404  Xorriso_alloc_meM(delimiter_mem, char, strlen(xorriso->list_delimiter) + 1);
2405  Xorriso_alloc_meM(delimiter, char, strlen(argv[*idx + 1]) + 1);
2406  strcpy(delimiter_mem, xorriso->list_delimiter);
2407  strcpy(delimiter, argv[*idx + 1]);
2408  strcpy(xorriso->list_delimiter, delimiter);
2409  ret= Xorriso_opt_args(xorriso, "-concat pipe", argc , argv, *idx + 2,
2410  &prog_end_idx, &progc, &progv, 4 | 128);
2411  strcpy(xorriso->list_delimiter, delimiter_mem);
2412  if(ret <= 0)
2413  goto ex;
2414  if(progc <= 0) {
2415  sprintf(xorriso->info_text, "-concat pipe: No program path given.");
2416  Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);
2417  ret= 0; goto ex;
2418  }
2419  iso_rr_start= prog_end_idx + 1;
2420  }
2421  ret= Xorriso_opt_args(xorriso, "-concat", argc , argv, iso_rr_start, &end_idx,
2422  &optc, &optv, 128);
2423  if(ret <= 0)
2424  goto ex;
2425  if(optc <= 0) {
2426  sprintf(xorriso->info_text, "-concat: No iso_rr_paths given.");
2427  Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "WARNING", 0);
2428  ret= 0; goto ex;
2429  }
2430  ret= Xorriso_concat(xorriso, argv[*idx], argv[*idx + 1],
2431  progc, progv, optc, optv, 0);
2432 ex:;
2433  if(progv != NULL) {
2434  if(delimiter_mem != NULL && delimiter != NULL)
2435  strcpy(xorriso->list_delimiter, delimiter);
2436  Xorriso_opt_args(xorriso, "-concat", argc, argv, *idx + 2, &prog_end_idx,
2437  &progc, &progv, 256);
2438  if(delimiter_mem != NULL && delimiter != NULL)
2439  strcpy(xorriso->list_delimiter, delimiter_mem);
2440  }
2441  Xorriso_opt_args(xorriso, "-concat", argc, argv, iso_rr_start, &end_idx,
2442  &optc, &optv, 256);
2443  Xorriso_free_meM(delimiter);
2444  Xorriso_free_meM(delimiter_mem);
2445  *idx= end_idx;
2446  return(ret);
2447 }
2448 
2449 
2450 /* Option -copyright_file */
2451 int Xorriso_option_copyright_file(struct XorrisO *xorriso, char *name, int flag)
2452 {
2453  if(Xorriso_check_name_len(xorriso, name,
2454  (int) sizeof(xorriso->copyright_file),
2455  "-copyright_file", 0) <= 0)
2456  return(0);
2457  strcpy(xorriso->copyright_file, name);
2458  Xorriso_set_change_pending(xorriso, 1);
2459  return(1);
2460 }
2461 
2462 
2463 /* Option -cp_clone */
2464 int Xorriso_option_cp_clone(struct XorrisO *xorriso, int argc, char **argv,
2465  int *idx, int flag)
2466 {
2467  int i, end_idx_dummy, ret, is_dir= 0, was_failure= 0, fret, pass;
2468  char *eff_origin= NULL, *eff_dest= NULL, *dest_dir= NULL, *leafname= NULL;
2469  int optc= 0;
2470  char **optv= NULL;
2471  struct stat stbuf;
2472 
2473  Xorriso_alloc_meM(eff_origin, char, SfileadrL);
2474  Xorriso_alloc_meM(eff_dest, char, SfileadrL);
2475  Xorriso_alloc_meM(dest_dir, char, SfileadrL);
2476  Xorriso_alloc_meM(leafname, char, SfileadrL);
2477 
2478  ret= Xorriso_cpmv_args(xorriso, "-cp_clone", argc, argv, idx,
2479  &optc, &optv, eff_dest, 1);
2480  if(ret<=0)
2481  goto ex;
2482  if(ret == 1 && optc > 1) {
2483 nondir_exists:;
2484  sprintf(xorriso->info_text,
2485  "-cp_clone: Copy address already exists and is not a directory: ");
2486  Text_shellsafe(eff_dest, xorriso->info_text, 1);
2487  Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);
2488  {ret= 0; goto ex;}
2489  }
2490  strcpy(dest_dir, eff_dest);
2491  if(optc == 1) {
2492  ret= Xorriso_iso_lstat(xorriso, eff_dest, &stbuf, 0);
2493  if(ret >= 0) {
2494  if(S_ISDIR(stbuf.st_mode))/* target directory exists */
2495  is_dir= 1;
2496  else
2497  goto nondir_exists;
2498  }
2499  } else {
2500  is_dir= 1;
2501  ret= Xorriso_mkdir(xorriso, dest_dir, 1 | 2);
2502  if(ret < 0)
2503  {ret= -(ret != -1); goto ex;}
2504  }
2505 
2506  /* Pass 0 checks whether the way is clear, pass 1 does the cloning */
2507  for(pass= 0; pass < 2; pass++) {
2508  for(i= 0; i<optc; i++) {
2509  ret= Xorriso_normalize_img_path(xorriso, xorriso->wdi,
2510  optv[i], eff_origin, !!pass);
2511  if(ret<=0 || xorriso->request_to_abort)
2512  goto problem_handler;
2513  if(is_dir) {
2514  ret= Sfile_leafname(eff_origin, leafname, 0);
2515  if(ret<=0)
2516  goto problem_handler;
2517  strcpy(eff_dest, dest_dir);
2518  ret= Sfile_add_to_path(eff_dest, leafname, 0);
2519  if(ret<=0) {
2520  sprintf(xorriso->info_text, "Effective path gets much too long (%d)",
2521  (int) (strlen(eff_dest)+strlen(leafname)+1));
2522  Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);
2523  goto problem_handler;
2524  }
2525  }
2526  ret= Xorriso_iso_lstat(xorriso, eff_dest, &stbuf, 0);
2527  if(pass == 0) {
2528  /* It is ok if both are directories */;
2529  if(ret >= 0 && S_ISDIR(stbuf.st_mode)) {
2530  ret= Xorriso_iso_lstat(xorriso, eff_origin, &stbuf, 0);
2531  if (ret >= 0 && S_ISDIR(stbuf.st_mode))
2532  ret= -1;
2533  }
2534  if(ret >= 0) {
2535  sprintf(xorriso->info_text, "Cloning: May not overwrite: ");
2536  Text_shellsafe(eff_dest, xorriso->info_text, 1);
2537  Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);
2538  goto problem_handler;
2539  }
2540  } else {
2541  ret= Xorriso_clone_tree(xorriso, NULL, eff_origin, eff_dest, 1);
2542  if(ret <= 0)
2543  goto problem_handler;
2544  }
2545 
2546  continue; /* regular bottom of loop */
2547 problem_handler:;
2548  was_failure= 1;
2549  fret= Xorriso_eval_problem_status(xorriso, ret, 1|2);
2550  if(fret>=0)
2551  continue;
2552  goto ex;
2553  }
2554  }
2555  ret= !was_failure;
2556 ex:;
2557  Xorriso_opt_args(xorriso, "-cp_clone",
2558  argc, argv, *idx, &end_idx_dummy, &optc, &optv, 256);
2559  Xorriso_free_meM(eff_origin);
2560  Xorriso_free_meM(eff_dest);
2561  Xorriso_free_meM(dest_dir);
2562  Xorriso_free_meM(leafname);
2563  return(ret);
2564 }
2565 
2566 
2567 /* Option -cpr alias -cpri */
2568 int Xorriso_option_cpri(struct XorrisO *xorriso, int argc, char **argv,
2569  int *idx, int flag)
2570 {
2571  int i, ret, is_dir= 0, was_failure= 0, fret, end_idx_dummy;
2572  char *eff_origin= NULL, *eff_dest= NULL, *dest_dir= NULL, *leafname= NULL;
2573  int optc= 0;
2574  char **optv= NULL;
2575 
2576  Xorriso_alloc_meM(eff_origin, char, SfileadrL);
2577  Xorriso_alloc_meM(eff_dest, char, SfileadrL);
2578  Xorriso_alloc_meM(dest_dir, char, SfileadrL);
2579  Xorriso_alloc_meM(leafname, char, SfileadrL);
2580 
2581  ret= Xorriso_cpmv_args(xorriso, "-cpri", argc, argv, idx,
2582  &optc, &optv, eff_dest, 1|2);
2583  if(ret<=0)
2584  goto ex;
2585  if(ret==2) {
2586  is_dir= 1;
2587  strcpy(dest_dir, eff_dest);
2588  }
2589 
2590  /* Perform graft-ins */
2591  Xorriso_pacifier_reset(xorriso, 0);
2592  for(i= 0; i<optc && !xorriso->request_to_abort; i++) {
2593  ret= Xorriso_normalize_img_path(xorriso, xorriso->wdx, optv[i], eff_origin,
2594  2|4);
2595  if(ret<=0 || xorriso->request_to_abort)
2596  goto problem_handler;
2597  if(is_dir) {
2598  ret= Sfile_leafname(eff_origin, leafname, 0);
2599  if(ret<=0)
2600  goto problem_handler;
2601  strcpy(eff_dest, dest_dir);
2602  ret= Sfile_add_to_path(eff_dest, leafname, 0);
2603  if(ret<=0) {
2604  sprintf(xorriso->info_text, "Effective path gets much too long (%d)",
2605  (int) (strlen(eff_dest)+ strlen(leafname)+1));
2606  Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);
2607  goto problem_handler;
2608  }
2609  }
2610  ret= Xorriso_graft_in(xorriso, NULL, eff_origin, eff_dest,
2611  (off_t) 0, (off_t) 0, 0);
2612  if(ret<=0 || xorriso->request_to_abort)
2613  goto problem_handler;
2614  sprintf(xorriso->info_text, "Added to ISO image: %s '%s'='%s'\n",
2615  (ret>1 ? "directory" : "file"), (eff_dest[0] ? eff_dest : "/"),
2616  eff_origin);
2617  if(!(flag&1))
2618  Xorriso_info(xorriso, 0);
2619  continue; /* regular bottom of loop */
2620 problem_handler:;
2621  was_failure= 1;
2622  fret= Xorriso_eval_problem_status(xorriso, ret, 1|2);
2623  if(fret>=0)
2624  continue;
2625  goto ex;
2626  }
2627  Xorriso_pacifier_callback(xorriso, "files added", xorriso->pacifier_count,
2628  xorriso->pacifier_total, "", 1);
2629  ret= !was_failure;
2630 ex:;
2631  Xorriso_opt_args(xorriso, "-cpri",
2632  argc, argv, *idx, &end_idx_dummy, &optc, &optv, 256);
2633  Xorriso_free_meM(eff_origin);
2634  Xorriso_free_meM(eff_dest);
2635  Xorriso_free_meM(dest_dir);
2636  Xorriso_free_meM(leafname);
2637  return(ret);
2638 }
2639 
2640 
2641 /* Options -cpx , -cpax, -cp_rx , -cp_rax */
2642 /* @param flag bit0= recursive (-cp_rx, -cp_rax)
2643  bit1= full property restore (-cpax, -cp_rax)
2644 */
2645 int Xorriso_option_cpx(struct XorrisO *xorriso, int argc, char **argv,
2646  int *idx, int flag)
2647 {
2648  int i, ret, is_dir= 0, was_failure= 0, fret, end_idx_dummy, problem_count;
2649  char *eff_origin= NULL, *eff_dest= NULL, *dest_dir= NULL, *leafname= NULL;
2650  char **eff_src_array= NULL, **eff_tgt_array= NULL;
2651  int optc= 0;
2652  char **optv= NULL;
2653  struct stat stbuf;
2654 
2655  Xorriso_alloc_meM(eff_origin, char, SfileadrL);
2656  Xorriso_alloc_meM(eff_dest, char, SfileadrL);
2657  Xorriso_alloc_meM(dest_dir, char, SfileadrL);
2658  Xorriso_alloc_meM(leafname, char, SfileadrL);
2659 
2660  ret= Xorriso_cpmv_args(xorriso, "-cp*x", argc, argv, idx,
2661  &optc, &optv, eff_dest, 1|4);
2662  if(ret<=0)
2663  goto ex;
2664  if(ret==2) {
2665  is_dir= 1;
2666  strcpy(dest_dir, eff_dest);
2667  }
2668  if(xorriso->allow_restore <= 0) {
2669  sprintf(xorriso->info_text,
2670  "-cpx: image-to-disk copies are not enabled by option -osirrox");
2671  Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);
2672  ret= 0; goto ex;
2673  }
2674 
2675  if(xorriso->do_restore_sort_lba || !(xorriso->ino_behavior & 4)) {
2676  eff_src_array= calloc(optc, sizeof(char *));
2677  eff_tgt_array= calloc(optc, sizeof(char *));
2678  if(eff_src_array == NULL || eff_tgt_array == NULL) {
2679  Xorriso_no_malloc_memory(xorriso, NULL, 0);
2680  ret= -1; goto ex;
2681  }
2682  for(i= 0; i < optc; i++)
2683  eff_src_array[i]= eff_tgt_array[i]= NULL;
2684  }
2685 
2686  /* Perform copying */
2687  Xorriso_pacifier_reset(xorriso, 0);
2688  for(i= 0; i<optc && !xorriso->request_to_abort; i++) {
2689  ret= Xorriso_normalize_img_path(xorriso, xorriso->wdi, optv[i], eff_origin,
2690  2|8);
2691  if(ret<=0 || xorriso->request_to_abort)
2692  goto problem_handler;
2693 
2694  ret= Xorriso_iso_lstat(xorriso, eff_origin, &stbuf, 2|4);
2695  if(ret==-1)
2696  goto problem_handler;
2697  if(S_ISDIR(stbuf.st_mode) && !(flag&1)) {
2698  /* only allow directories if they actually represent split data files */
2699  ret= 0;
2700  if(xorriso->do_concat_split)
2701  ret= Xorriso_is_split(xorriso, eff_origin, NULL, 4);
2702  if(ret<0)
2703  goto problem_handler;
2704  if(ret==0) {
2705  sprintf(xorriso->info_text, "-cpx: May not copy directory ");
2706  Text_shellsafe(eff_origin, xorriso->info_text, 1);
2707  Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);
2708  ret= 0; goto problem_handler;
2709  }
2710  }
2711 
2712  if(is_dir && strcmp(eff_origin, "/")!=0) {
2713  ret= Sfile_leafname(eff_origin, leafname, 0);
2714  if(ret<=0)
2715  goto problem_handler;
2716  strcpy(eff_dest, dest_dir);
2717  ret= Sfile_add_to_path(eff_dest, leafname, 0);
2718  if(ret<=0) {
2719  sprintf(xorriso->info_text, "Effective path gets much too long (%d)",
2720  (int) (strlen(eff_dest)+strlen(leafname)+1));
2721  Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);
2722  goto problem_handler;
2723  }
2724  }
2725  if(eff_src_array != NULL) {
2726  eff_src_array[i]= strdup(eff_origin);
2727  eff_tgt_array[i]= strdup(eff_dest);
2728  if(eff_src_array[i] == NULL || eff_tgt_array[i] == NULL) {
2729  Xorriso_no_malloc_memory(xorriso, &(eff_src_array[i]), 0);
2730  ret= -1; goto ex;
2731  }
2732  } else {
2733  ret= Xorriso_restore(xorriso, eff_origin, eff_dest, (off_t) 0, (off_t) 0,
2734  16 | ((!(flag&2))<<6));
2735  if(ret<=0 || xorriso->request_to_abort)
2736  goto problem_handler;
2737  if(ret==3 || (flag&1))
2738  continue;
2739  sprintf(xorriso->info_text,
2740  "Copied from ISO image to disk: %s '%s' = '%s'\n",
2741  (ret>1 ? "directory" : "file"), eff_origin, eff_dest);
2742  Xorriso_info(xorriso, 0);
2743  }
2744  continue; /* regular bottom of loop */
2745 problem_handler:;
2746  was_failure= 1;
2747  fret= Xorriso_eval_problem_status(xorriso, ret, 1|2);
2748  if(fret>=0)
2749  continue;
2750  goto ex;
2751  }
2752 
2753  if(eff_src_array != NULL) {
2754  ret= Xorriso_restore_sorted(xorriso, optc, eff_src_array, eff_tgt_array,
2755  &problem_count, 0);
2756  if(ret <= 0 || problem_count > 0)
2757  was_failure= 1;
2758  }
2759  if(xorriso->pacifier_count>0)
2760  Xorriso_pacifier_callback(xorriso, "files restored",xorriso->pacifier_count,
2761  xorriso->pacifier_total, "", 1|4);
2762  ret= !was_failure;
2763 ex:;
2764  i= optc;
2765  Sfile_destroy_argv(&i, &eff_src_array, 0);
2766  i= optc;
2767  Sfile_destroy_argv(&i, &eff_tgt_array, 0);
2768  Xorriso_opt_args(xorriso, "-cp*x",
2769  argc, argv, *idx, &end_idx_dummy, &optc, &optv, 256);
2770  Xorriso_free_meM(eff_origin);
2771  Xorriso_free_meM(eff_dest);
2772  Xorriso_free_meM(dest_dir);
2773  Xorriso_free_meM(leafname);
2774  return(ret);
2775 }
2776 
2777 
2778 /* Option -cut_out */
2779 int Xorriso_option_cut_out(struct XorrisO *xorriso, char *disk_path,
2780  char *start, char *count, char *iso_rr_path, int flag)
2781 {
2782  int ret;
2783  double num;
2784  off_t startbyte, bytecount;
2785 
2786  num= Scanf_io_size(start, 0);
2787  if(num<0 || num > 1.0e18) { /* 10^18 = 10^3 ^ 6 < 2^10 ^ 6 = 2^60 */
2788  sprintf(xorriso->info_text,
2789  "-cut_out: startbyte address negative or much too large (%s)", start);
2790  Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);
2791  return(0);
2792  }
2793  startbyte= num;
2794  num= Scanf_io_size(count, 0);
2795  if(num<=0 || num > 1.0e18) {
2796  sprintf(xorriso->info_text,
2797  "-cut_out: bytecount zero, negative or much too large (%s)", count);
2798  Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);
2799  return(0);
2800  }
2801  bytecount= num;
2802  sprintf(xorriso->info_text,
2803  "-cut_out from %s , byte %.f to %.f, and graft as %s",
2804  disk_path, (double) startbyte, (double) (startbyte+bytecount),
2805  iso_rr_path);
2806  Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "DEBUG", 0);
2807 
2808  ret= Xorriso_cut_out(xorriso, disk_path, startbyte, bytecount,
2809  iso_rr_path, 0);
2810  return(ret);
2811 }
2812 
int Spotlist_get_item(struct SpotlisT *o, int idx, int *start_lba, int *blocks, int *quality, int flag)
Definition: check_media.c:182
int Sectorbitmap_from_file(struct SectorbitmaP **o, char *path, char *msg, int *os_errno, int flag)
Definition: check_media.c:288
int Checkmediajob_destroy(struct CheckmediajoB **o, int flag)
Definition: check_media.c:604
int Xorriso_check_media_setup_job(struct XorrisO *xorriso, struct CheckmediajoB *job, char **argv, int old_idx, int end_idx, int flag)
Definition: check_media.c:649
int Xorriso_open_job_data_to(struct XorrisO *xorriso, struct CheckmediajoB *job, int flag)
Definition: check_media.c:1082
char * Spotlist__quality_name(int quality, char name[80], int bad_limit, int flag)
Definition: check_media.c:208
int Sectorbitmap_clone(struct SectorbitmaP *from, struct SectorbitmaP **clone, int flag)
Definition: check_media.c:549
int Spotlist_destroy(struct SpotlisT **o, int flag)
Definition: check_media.c:102
int Spotlist_count(struct SpotlisT *o, int flag)
Definition: check_media.c:147
int Checkmediajob_new(struct CheckmediajoB **o, int flag)
Definition: check_media.c:568
int Sectorbitmap_destroy(struct SectorbitmaP **o, int flag)
Definition: check_media.c:276
int Xorriso_sectormap_to_spotlist(struct XorrisO *xorriso, struct CheckmediajoB *job, struct SpotlisT **spotlist, int flag)
Definition: check_media.c:939
#define Xorriso_read_quality_md5_matcH
Definition: check_media.h:83
#define Xorriso_read_quality_md5_mismatcH
Definition: check_media.h:88
#define Xorriso_read_quality_unreadablE
Definition: check_media.h:92
int Xorriso_compare_2_files(struct XorrisO *xorriso, char *disk_adr, char *iso_adr, char *adr_common_tail, int *result, int flag)
Definition: cmp_update.c:309
int Xorriso_concat(struct XorrisO *xorriso, char *mode, char *target, int progc, char **progv, int filec, char **filev, int flag)
Definition: disk_ops.c:2074
int Xorriso_convert_uidstring(struct XorrisO *xorriso, char *uid_string, uid_t *uid, int flag)
Definition: disk_ops.c:154
int Xorriso_convert_modstring(struct XorrisO *xorriso, char *cmd, char *mode, mode_t *mode_and, mode_t *mode_or, int flag)
Definition: disk_ops.c:202
int Xorriso_restore_sorted(struct XorrisO *xorriso, int count, char **src_array, char **tgt_array, int *problem_count, int flag)
Definition: disk_ops.c:1427
int Xorriso_convert_gidstring(struct XorrisO *xorriso, char *gid_string, gid_t *gid, int flag)
Definition: disk_ops.c:178
int Xorriso_drive_snooze(struct XorrisO *xorriso, int flag)
Definition: drive_mgt.c:2329
int Xorriso_pretend_full_disc(struct XorrisO *xorriso, int flag)
Definition: drive_mgt.c:3544
int Xorriso_check_session_md5(struct XorrisO *xorriso, char *severity, int flag)
Definition: drive_mgt.c:2430
int Xorriso_reaquire_outdev(struct XorrisO *xorriso, int flag)
Definition: drive_mgt.c:907
int Xorriso_check_media(struct XorrisO *xorriso, struct SpotlisT **spotlist, struct CheckmediajoB *job, int flag)
Definition: drive_mgt.c:3213
int Xorriso_cdrskin(struct XorrisO *xorriso, char *whom, int argc, char **argv, int flag)
Definition: emulators.c:119
int Xorriso_genisofs(struct XorrisO *xorriso, char *whom, int argc, char **argv, int flag)
Definition: emulators.c:1346
int Findjob_set_action_chown(struct FindjoB *o, uid_t user, int flag)
Definition: findjob.c:1193
int Findjob_set_action_target(struct FindjoB *o, int action, char *target, int flag)
Definition: findjob.c:1163
int Findjob_set_damage_filter(struct FindjoB *o, int value, int flag)
Definition: findjob.c:867
int Findjob_set_action_chmod(struct FindjoB *o, mode_t mode_and, mode_t mode_or, int flag)
Definition: findjob.c:1237
int Findjob_destroy(struct FindjoB **o, int flag)
Definition: findjob.c:401
int Findjob_new(struct FindjoB **o, char *start_path, int flag)
Definition: findjob.c:355
int Findjob_set_action_chgrp(struct FindjoB *o, gid_t group, int flag)
Definition: findjob.c:1215
int Findjob_set_action_ad(struct FindjoB *o, int type, time_t date, int flag)
Definition: findjob.c:1261
static int Sfile_destroy_argv(int *argc, char ***argv, int flag)
#define SfileadrL
int Xorriso_set_hppa_boot_parm(struct XorrisO *xorriso, char *text, char *what, int flag)
Definition: iso_img.c:1268
int Xorriso_set_ignore_aclea(struct XorrisO *xorriso, int flag)
Definition: iso_img.c:39
int Xorriso_set_change_pending(struct XorrisO *xorriso, int flag)
Definition: iso_img.c:1004
int Xorriso_report_system_area(struct XorrisO *xorriso, char *form, int flag)
Definition: iso_img.c:2975
int Xorriso_change_is_pending(struct XorrisO *xorriso, int flag)
Definition: iso_img.c:995
int Xorriso_show_boot_info(struct XorrisO *xorriso, int flag)
Definition: iso_img.c:835
int Xorriso_set_alpha_boot(struct XorrisO *xorriso, char *path, int flag)
Definition: iso_img.c:1330
int Xorriso_add_mips_boot_file(struct XorrisO *xorriso, char *path, int flag)
Definition: iso_img.c:1227
int Xorriso_coordinate_system_area(struct XorrisO *xorriso, int sa_type, int options, char *cmd, int flag)
Definition: iso_img.c:1357
int Xorriso_cut_out(struct XorrisO *xorriso, char *disk_path, off_t startbyte, off_t bytecount, char *iso_rr_path, int flag)
Definition: iso_manip.c:1230
int Xorriso_graft_in(struct XorrisO *xorriso, void *boss_iter, char *disk_path, char *img_path, off_t offset, off_t cut_size, int flag)
Definition: iso_manip.c:789
int Xorriso_mkdir(struct XorrisO *xorriso, char *path, int flag)
Definition: iso_manip.c:1306
int Xorriso_set_uid(struct XorrisO *xorriso, char *in_path, uid_t uid, int flag)
Definition: iso_manip.c:2008
int Xorriso_set_st_mode(struct XorrisO *xorriso, char *in_path, mode_t mode_and, mode_t mode_or, int flag)
Definition: iso_manip.c:1979
int Xorriso_clone_tree(struct XorrisO *xorriso, void *boss_iter, char *origin, char *dest, int flag)
Definition: iso_manip.c:1808
int Xorriso_set_time(struct XorrisO *xorriso, char *in_path, time_t t, int flag)
Definition: iso_manip.c:2043
int Xorriso_findi_sorted(struct XorrisO *xorriso, struct FindjoB *job, off_t boss_mem, int filec, char **filev, int flag)
Definition: iso_manip.c:3572
int Xorriso_set_gid(struct XorrisO *xorriso, char *in_path, gid_t gid, int flag)
Definition: iso_manip.c:2025
int Xorriso_findi(struct XorrisO *xorriso, struct FindjoB *job, void *boss_iter, off_t boss_mem, void *dir_node_generic, char *dir_path, struct stat *dir_stbuf, int depth, int flag)
Definition: iso_manip.c:3355
int Xorriso_iso_lstat(struct XorrisO *xorriso, char *path, struct stat *stbuf, int flag)
Definition: iso_tree.c:363
int Xorriso_truncate_path_comps(struct XorrisO *xorriso, char *path, char *buffer, char **resultpt, int flag)
Definition: iso_tree.c:1640
int Xorriso_is_split(struct XorrisO *xorriso, char *path, void *node, int flag)
Definition: iso_tree.c:633
int Xorriso_normalize_img_path(struct XorrisO *xorriso, char *wd, char *img_path, char eff_path[], int flag)
Definition: iso_tree.c:55
int Xorriso__text_to_sev(char *severity_name, int *severity_number, int flag)
Definition: lib_mgt.c:387
int Xorriso_get_local_charset(struct XorrisO *xorriso, char **name, int flag)
Definition: lib_mgt.c:476
int Xorriso_set_abort_severity(struct XorrisO *xorriso, int flag)
Definition: lib_mgt.c:306
int Xorriso_preparer_string(struct XorrisO *xorriso, char xorriso_id[129], int flag)
Definition: lib_mgt.c:683
int Xorriso__sev_to_text(int severity, char **severity_name, int flag)
Definition: lib_mgt.c:371
int Xorriso_set_local_charset(struct XorrisO *xorriso, char *name, int flag)
Definition: lib_mgt.c:483
int Xorriso__severity_cmp(char *sev1, char *sev2)
Compare two severity texts for their severeness.
Definition: lib_mgt.c:401
int Xorriso_warn_of_wildcards(struct XorrisO *xorriso, char *path, int flag)
Definition: match.c:764
int Fileliste__target_source_limit(char *line, char sep, char **limit_pt, int flag)
Definition: misc_funct.c:1119
int Xorriso__hide_mode(char *mode, int flag)
Definition: misc_funct.c:1242
int Sregex_match(char *pattern, char *text, int flag)
Definition: misc_funct.c:1006
double Scanf_io_size(char *text, int flag)
Convert a text into a number of type double and multiply it by unit code [kmgtpe] (2^10 to 2^60) or [...
Definition: misc_funct.c:182
char * Text_shellsafe(char *in_text, char *out_text, int flag)
Definition: misc_funct.c:1044
int Hex_to_bin(char *hex, int bin_size, int *bin_count, unsigned char *bin_data, int flag)
Definition: misc_funct.c:1080
int Sregex_string(char **handle, char *text, int flag)
Definition: misc_funct.c:865
int Xorriso__to_upper(char *in, char *out, int out_size, int flag)
Definition: misc_funct.c:1301
int Xorriso_option_abstract_file(struct XorrisO *xorriso, char *name, int flag)
Definition: opts_a_c.c:66
int Xorriso_option_check_media_defaults(struct XorrisO *xorriso, int argc, char **argv, int *idx, int flag)
Definition: opts_a_c.c:1925
int Xorriso_option_blank(struct XorrisO *xorriso, char *in_mode, int flag)
Definition: opts_a_c.c:581
int Xorriso_option_cut_out(struct XorrisO *xorriso, char *disk_path, char *start, char *count, char *iso_rr_path, int flag)
Definition: opts_a_c.c:2779
int Xorriso_option_append_partition(struct XorrisO *xorriso, char *partno_text, char *type_text, char *image_path, int flag)
Definition: opts_a_c.c:295
int Xorriso_option_cp_clone(struct XorrisO *xorriso, int argc, char **argv, int *idx, int flag)
Definition: opts_a_c.c:2464
int Xorriso_option_compare(struct XorrisO *xorriso, char *disk_path, char *iso_path, int flag)
Definition: opts_a_c.c:2258
int Xorriso_option_chgrpi(struct XorrisO *xorriso, char *gid, int argc, char **argv, int *idx, int flag)
Definition: opts_a_c.c:1954
int Xorriso_option_biblio_file(struct XorrisO *xorriso, char *name, int flag)
Definition: opts_a_c.c:566
int Xorriso_option_chowni(struct XorrisO *xorriso, char *uid, int argc, char **argv, int *idx, int flag)
Definition: opts_a_c.c:2062
int Xorriso_option_cpx(struct XorrisO *xorriso, int argc, char **argv, int *idx, int flag)
Definition: opts_a_c.c:2645
int Xorriso_option_copyright_file(struct XorrisO *xorriso, char *name, int flag)
Definition: opts_a_c.c:2451
int Xorriso_option_commit_eject(struct XorrisO *xorriso, char *which, int flag)
Definition: opts_a_c.c:2234
int Xorriso_option_as(struct XorrisO *xorriso, int argc, char **argv, int *idx, int flag)
Definition: opts_a_c.c:397
int Xorriso_option_close(struct XorrisO *xorriso, char *mode, int flag)
Definition: opts_a_c.c:2124
int Xorriso_option_acl(struct XorrisO *xorriso, char *mode, int flag)
Definition: opts_a_c.c:78
int Xorriso_option_cpri(struct XorrisO *xorriso, int argc, char **argv, int *idx, int flag)
Definition: opts_a_c.c:2568
int Xorriso_option_ban_stdio_write(struct XorrisO *xorriso, int flag)
Definition: opts_a_c.c:558
int Xorriso_option_add_plainly(struct XorrisO *xorriso, char *mode, int flag)
Definition: opts_a_c.c:220
int Xorriso_option_cdx(struct XorrisO *xorriso, char *disk_path, int flag)
Definition: opts_a_c.c:1463
int Xorriso_option_chmodi(struct XorrisO *xorriso, char *mode, int argc, char **argv, int *idx, int flag)
Definition: opts_a_c.c:2007
int Xorriso_option_close_filter_list(struct XorrisO *xorriso, int flag)
Definition: opts_a_c.c:2169
int Xorriso_option_boot_image(struct XorrisO *xorriso, char *form, char *treatment, int flag)
Definition: opts_a_c.c:695
int Xorriso_option_close_damaged(struct XorrisO *xorriso, char *mode, int flag)
Definition: opts_a_c.c:2141
int Xorriso_option_add(struct XorrisO *xorriso, int argc, char **argv, int *idx, int flag)
Definition: opts_a_c.c:123
int Xorriso_option_commit(struct XorrisO *xorriso, int flag)
Definition: opts_a_c.c:2182
int Xorriso_option_calm_drive(struct XorrisO *xorriso, char *which, int flag)
Definition: opts_a_c.c:1377
int Xorriso_option_changes_pending(struct XorrisO *xorriso, char *state, int flag)
Definition: opts_a_c.c:1530
int Xorriso_option_concat(struct XorrisO *xorriso, int argc, char **argv, int *idx, int flag)
Definition: opts_a_c.c:2368
int Xorriso_option_clone(struct XorrisO *xorriso, char *origin, char *dest, int flag)
Definition: opts_a_c.c:2113
int Xorriso_option_backslash_codes(struct XorrisO *xorriso, char *mode, int flag)
Definition: opts_a_c.c:507
int Xorriso_option_compliance(struct XorrisO *xorriso, char *mode, int flag)
Definition: opts_a_c.c:2360
int Xorriso_option_abort_on(struct XorrisO *xorriso, char *in_severity, int flag)
Definition: opts_a_c.c:39
int Xorriso_option_auto_charset(struct XorrisO *xorriso, char *mode, int flag)
Definition: opts_a_c.c:491
int Xorriso_option_cdi(struct XorrisO *xorriso, char *iso_rr_path, int flag)
Definition: opts_a_c.c:1399
int Xorriso_option_check_md5(struct XorrisO *xorriso, int argc, char **argv, int *idx, int flag)
Definition: opts_a_c.c:1635
int Xorriso_option_charset(struct XorrisO *xorriso, char *name, int flag)
Definition: opts_a_c.c:1564
int Xorriso_option_alter_date(struct XorrisO *xorriso, char *time_type, char *timestring, int argc, char **argv, int *idx, int flag)
Definition: opts_a_c.c:242
int Xorriso_option_application_id(struct XorrisO *xorriso, char *name, int flag)
Definition: opts_a_c.c:362
int Xorriso_option_check_media(struct XorrisO *xorriso, int argc, char **argv, int *idx, int flag)
Definition: opts_a_c.c:1760
static void unescape_pathspec_part(char *rpt, int flag)
Definition: opts_a_c.c:100
int Xorriso_option_assert_volid(struct XorrisO *xorriso, char *pattern, char *severity, int flag)
Definition: opts_a_c.c:445
int Xorriso_option_application_use(struct XorrisO *xorriso, char *path, int flag)
Definition: opts_a_c.c:379
int Xorriso_option_eject(struct XorrisO *xorriso, char *which, int flag)
Definition: opts_d_h.c:409
int Xorriso_option_find(struct XorrisO *xorriso, int argc, char **argv, int *idx, int flag)
Definition: opts_d_h.c:818
int Xorriso_option_dev(struct XorrisO *xorriso, char *in_adr, int flag)
Definition: opts_d_h.c:72
int Xorriso_option_pwdx(struct XorrisO *xorriso, int flag)
Definition: opts_p_z.c:450
int Xorriso_option_pwdi(struct XorrisO *xorriso, int flag)
Definition: opts_p_z.c:436
int Xorriso_eval_problem_status(struct XorrisO *xorriso, int ret, int flag)
Evaluate an advise whether to abort or whether to go on with option processing.
Definition: parse_exec.c:307
int Xorriso_end_idx(struct XorrisO *xorriso, int argc, char **argv, int idx, int flag)
Definition: parse_exec.c:46
int Xorriso_convert_datestring(struct XorrisO *xorriso, char *cmd, char *time_type, char *timestring, int *t_type, time_t *t, int flag)
Definition: parse_exec.c:2852
int Xorriso_path_is_excluded(struct XorrisO *xorriso, char *path, int flag)
Definition: parse_exec.c:3130
int Xorriso_cpmv_args(struct XorrisO *xorriso, char *cmd, int argc, char **argv, int *idx, int *optc, char ***optv, char eff_dest[4096], int flag)
Definition: parse_exec.c:349
int Xorriso_get_problem_status(struct XorrisO *xorriso, char severity[80], int flag)
Obtain the current problem status of the xorriso handle.
Definition: parse_exec.c:215
int Xorriso_set_problem_status(struct XorrisO *xorriso, char *severity, int flag)
Set the current problem status of the xorriso handle.
Definition: parse_exec.c:231
int Xorriso_check_thing_len(struct XorrisO *xorriso, char *name, int size, char *cmd, char *thing, int flag)
Definition: parse_exec.c:461
int Xorriso_opt_args(struct XorrisO *xorriso, char *cmd, int argc, char **argv, int idx, int *end_idx, int *optc, char ***optv, int flag)
Definition: parse_exec.c:87
int Xorriso_check_name_len(struct XorrisO *xorriso, char *name, int size, char *cmd, int flag)
Definition: parse_exec.c:475
int Xorriso_check_md5(struct XorrisO *xorriso, void *in_node, char *path, int flag)
Definition: read_run.c:2595
int Xorriso_restore(struct XorrisO *xorriso, char *img_path, char *disk_path, off_t offset, off_t bytes, int flag)
Definition: read_run.c:1891
int Sfile_type(char *filename, int flag)
Definition: sfile.c:225
int Sfile_add_to_path(char path[4096], char *addon, int flag)
Definition: sfile.c:137
int Sfile_leafname(char *path, char leafname[4096], int flag)
Definition: sfile.c:116
int Sfile_str(char target[4096], char *source, int flag)
Definition: sfile.c:836
int Sfile_prepend_path(char *prefix, char path[4096], int flag)
Definition: sfile.c:161
#define Xorriso_free_meM(pt)
Definition: sfile.h:27
#define Xorriso_alloc_meM(pt, typ, count)
Definition: sfile.h:19
struct SectorbitmaP * sector_map
Definition: check_media.h:126
char data_to_path[SfileadrL]
Definition: check_media.h:117
char event_severity[20]
Definition: check_media.h:139
char sector_map_path[SfileadrL]
Definition: check_media.h:125
int iso_mbr_part_type
int system_area_options
unsigned char boot_id_string[29]
int part_like_isohybrid
int apm_block_size
char list_delimiter[81]
off_t pacifier_count
int do_follow_mount
int boot_image_cat_hidden
char boot_image_bin_form[16]
uint8_t appended_part_gpt_flags[8]
int displacement_sign
char boot_image_cat_path[4096]
int allow_graft_points
int bsl_interpretation
int partition_heads_per_cyl
int allow_restore
char efi_boot_partition[4096]
int keep_boot_image
char abstract_file[38]
int boot_platform_id
int boot_image_emul
int do_follow_links
int do_calm_drive
int appended_as_gpt
int appended_as_apm
int boot_efi_default
int find_check_md5_result
char * out_charset
int ban_stdio_write
int ino_behavior
int image_start_mode
int boot_img_full_size
char result_line[10 *4096]
int volset_change_pending
int sh_style_result
int boot_emul_default
int abort_on_severity
int no_volset_present
int filter_list_closed
uint8_t hfsp_serial_number[8]
char prep_partition[4096]
struct SectorbitmaP * in_sector_map
unsigned char boot_selection_crit[21]
char * appended_partitions[8]
int do_restore_sort_lba
char info_text[10 *4096]
uint8_t appended_part_type_guids[8][16]
char ascii_disc_label[129]
uint32_t partition_offset
int grow_blindly_msc2
int do_concat_split
int iso_mbr_part_flag
uint32_t displacement
int boot_img_size_default
uint8_t iso_gpt_type_guid[16]
char abort_on_text[20]
int patch_system_area
double pacifier_interval
int request_to_abort
int hfsp_block_size
char * in_charset
int partition_secs_per_head
int system_area_clear_loaded
char boot_image_bin_path[4096]
void * out_drive_handle
off_t boot_image_load_size
char assert_volid[4096]
int check_media_bad_limit
int disk_excl_mode
char wdx[4096]
void * in_drive_handle
char copyright_file[38]
int find_compare_result
char application_use[4096]
char application_id[129]
double last_update_time
int do_follow_param
char assert_volid_sev[80]
char grub2_sparc_core[4096]
int abort_on_is_default
int patch_isolinux_image
off_t pacifier_total
char biblio_file[38]
struct CheckmediajoB * check_media_default
uint8_t appended_part_types[8]
int boot_image_isohybrid
char wdi[4096]
int Xorriso_msgs_submit(struct XorrisO *xorriso, int error_code, char msg_text[], int os_errno, char severity[], int flag)
Submit a problem message to the xorriso problem reporting and handling system.
Definition: text_io.c:2504
int Xorriso_process_errfile(struct XorrisO *xorriso, int error_code, char msg_text[], int os_errno, int flag)
Write a message for option -errfile_log.
Definition: text_io.c:2438
int Xorriso_no_findjob(struct XorrisO *xorriso, char *cmd, int flag)
Definition: text_io.c:4110
int Xorriso_pacifier_callback(struct XorrisO *xorriso, char *what_done, off_t count, off_t todo, char *current_object, int flag)
Definition: text_io.c:3969
int Xorriso_no_malloc_memory(struct XorrisO *xorriso, char **to_free, int flag)
Definition: text_io.c:4077
int Xorriso_write_session_log(struct XorrisO *xorriso, int flag)
Definition: text_io.c:2638
int Xorriso_info(struct XorrisO *xorriso, int flag)
Definition: text_io.c:2367
int Xorriso_status(struct XorrisO *xorriso, char *filter, FILE *fp, int flag)
Definition: text_io.c:2764
int Xorriso_report_md5_outcome(struct XorrisO *xorriso, char *severity, int flag)
Definition: text_io.c:4118
char * Xorriso_esc_filepath(struct XorrisO *xorriso, char *in_text, char *out_text, int flag)
Definition: text_io.c:4742
int Xorriso_pacifier_reset(struct XorrisO *xorriso, int flag)
Definition: text_io.c:3937
int Xorriso_reassure(struct XorrisO *xorriso, char *cmd, char *which_will, int flag)
Definition: text_io.c:2609
int Xorriso_result(struct XorrisO *xorriso, int flag)
Definition: text_io.c:2337
int Xorriso_blank_media(struct XorrisO *xorriso, int flag)
Definition: write_run.c:1763
int Xorriso_relax_compliance(struct XorrisO *xorriso, char *mode, int flag)
Definition: write_run.c:2473
int Xorriso_set_system_area_path(struct XorrisO *xorriso, char *path, int flag)
Definition: write_run.c:3652
int Xorriso_parse_type_guid(struct XorrisO *xorriso, char *text, uint8_t guid[16], int *mbr_type, int flag)
Definition: write_run.c:3841
int Xorriso_parse_gpt_guid(struct XorrisO *xorriso, char *text, int flag)
Definition: write_run.c:3816
int Xorriso_blank_as_needed(struct XorrisO *xorriso, int flag)
Definition: write_run.c:2071
int Xorriso_write_session(struct XorrisO *xorriso, int flag)
Definition: write_run.c:1088
int Xorriso_close_damaged(struct XorrisO *xorriso, int flag)
Definition: write_run.c:3724
int Xorriso_retry_write_session(struct XorrisO *xorriso, int flag)
Definition: write_run.c:844
int Xorriso_update_iso_lba0(struct XorrisO *xorriso, int iso_lba, int isosize, char *head_buffer, struct CheckmediajoB *job, int flag)
Definition: write_run.c:3026
int Xorriso_attach_boot_image(struct XorrisO *xorriso, int flag)
Definition: write_run.c:604
int Xorriso_format_media(struct XorrisO *xorriso, off_t in_size, int flag)
Definition: write_run.c:1895
#define Xorriso_max_appended_partitionS
#define Xorriso_disc_label_sizE