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)  

text_io.c File Reference
#include <ctype.h>
#include <sys/types.h>
#include <unistd.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <sys/stat.h>
#include <sys/time.h>
#include <time.h>
#include <errno.h>
#include <signal.h>
#include <pthread.h>
#include <fcntl.h>
#include <iconv.h>
#include <langinfo.h>
#include <locale.h>
#include "xorriso.h"
#include "xorriso_private.h"
#include "xorrisoburn.h"
Include dependency graph for text_io.c:

Go to the source code of this file.

Data Structures

struct  Xorriso_msg_filteR
 
struct  Xorriso_msg_sievE
 

Macros

#define O_BINARY   0
 

Functions

int Xorriso_protect_stdout (struct XorrisO *xorriso, int flag)
 
int Xorriso_dialog_input (struct XorrisO *xorriso, char line[], int linesize, int flag)
 
int Xorriso_request_confirmation (struct XorrisO *xorriso, int flag)
 
int Xorriso_read_lines (struct XorrisO *xorriso, FILE *fp, int *linecount, int *argc, char ***argv, int flag)
 
int Xorriso_predict_linecount (struct XorrisO *xorriso, char *line, int *linecount, int flag)
 
int Xorriso_pager (struct XorrisO *xorriso, char *line, int flag)
 
static int Xorriso_obtain_lock (struct XorrisO *xorriso, pthread_mutex_t *lock_handle, char *purpose, int flag)
 
static int Xorriso_release_lock (struct XorrisO *xorriso, pthread_mutex_t *lock_handle, char *purpose, int flag)
 
static int Xorriso_lock_outlists (struct XorrisO *xorriso, int flag)
 
static int Xorriso_unlock_outlists (struct XorrisO *xorriso, int flag)
 
static int Xorriso_write_to_msglist (struct XorrisO *xorriso, struct Xorriso_lsT **xorriso_msglist, char *text, int flag)
 
int Xorriso_write_to_channel (struct XorrisO *xorriso, char *in_text, int channel_no, int flag)
 
int Xorriso_push_outlists (struct XorrisO *xorriso, int *stack_handle, int flag)
 Enable a new redirection of info and/or result channel. More...
 
int Xorriso_fetch_outlists (struct XorrisO *xorriso, int stack_handle, struct Xorriso_lsT **result_list, struct Xorriso_lsT **info_list, int flag)
 Obtain the currently collected text messages of redirected info and result channel. More...
 
int Xorriso_peek_outlists (struct XorrisO *xorriso, int stack_handle, int timeout, int flag)
 Inquire whether messages are pending in redirected result and info channel. More...
 
int Xorriso_pull_outlists (struct XorrisO *xorriso, int stack_handle, struct Xorriso_lsT **result_list, struct Xorriso_lsT **info_list, int flag)
 Disable the redirection given by stack_handle. More...
 
int Xorriso_info_handler_stderr (void *handle, char *text)
 
int Xorriso_result_handler_stdout (void *handle, char *text)
 
int Xorriso_result_handler_pkt (void *handle, char *text)
 
int Xorriso_process_msg_lists (struct XorrisO *xorriso, struct Xorriso_lsT *result_list, struct Xorriso_lsT *info_list, int *line_count, int flag)
 
static void * Xorriso_msg_watcher (void *state_pt)
 
int Xorriso_start_msg_watcher (struct XorrisO *xorriso, int(*result_handler)(void *handle, char *text), void *result_handle, int(*info_handler)(void *handle, char *text), void *info_handle, int flag)
 Redirect output by Xorriso_push_outlists() and start a thread which fetches this output and performs a call of a given function with each message that is obtained. More...
 
int Xorriso_stop_msg_watcher (struct XorrisO *xorriso, int flag)
 Revoke output redirection by Xorriso_start_msg_watcher() and end the watcher thread. More...
 
int Xorriso_msg_filter_destroy (struct Xorriso_msg_filteR **o, int flag)
 
int Xorriso_msg_filter_new (struct Xorriso_msg_filteR **o, char *name, struct Xorriso_msg_filteR *prev, struct Xorriso_msg_filteR *next, int flag)
 
int Xorriso_msg_filter_set_words (struct Xorriso_msg_filteR *m, int num_words, int *word_idx, int flag)
 
int Xorriso_msg_sieve_new (struct Xorriso_msg_sievE **o, int flag)
 
int Xorriso_msg_sieve_destroy (struct Xorriso_msg_sievE **o, int flag)
 
int Xorriso_sieve_add_filter (struct XorrisO *xorriso, char *name, int channels, char *prefix, char *separators, int num_words, int *word_idx, int max_results, int flag)
 Add a filter rule to the message sieve. More...
 
int Xorriso_sieve_dispose (struct XorrisO *xorriso, int flag)
 Dispose all filter rules. More...
 
int Xorriso_sieve_clear_results (struct XorrisO *xorriso, int flag)
 Dispose all recorded results. More...
 
int Xorriso_sieve_get_result (struct XorrisO *xorriso, char *name, int *argc, char ***argv, int *available, int flag)
 Inquire recorded results from a particular filter rule. More...
 
int Xorriso_sieve_big (struct XorrisO *xorriso, int flag)
 Install a large sieve with filters for about any interesting message of xorriso. More...
 
int Xorriso_sieve_filter_msg (struct XorrisO *xorriso, char *msg, int flag)
 
int Xorriso_result (struct XorrisO *xorriso, int flag)
 
int Xorriso_info (struct XorrisO *xorriso, int flag)
 
int Xorriso_mark (struct XorrisO *xorriso, int flag)
 
int Xorriso_restxt (struct XorrisO *xorriso, char *text)
 
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. More...
 
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. More...
 
int Xorriso_msgs_submit_void (void *xorriso, int error_code, char msg_text[], int os_errno, char severity[], int flag)
 Alternative call interface of Xorriso_msgs_submit with void* instead of struct XorrisO*. More...
 
int Xorriso_reassure (struct XorrisO *xorriso, char *cmd, char *which_will, int flag)
 
int Xorriso_write_session_log (struct XorrisO *xorriso, int flag)
 
int Xorriso_status_filter (struct XorrisO *xorriso, char *filter, char *line, int flag)
 
int Xorriso_status_result (struct XorrisO *xorriso, char *filter, FILE *fp, int flag)
 
int Xorriso_boot_status_sysarea (struct XorrisO *xorriso, char *filter, FILE *fp, int flag)
 
static char * Xorriso__speedname (int speed)
 
int Xorriso_status (struct XorrisO *xorriso, char *filter, FILE *fp, int flag)
 
int Xorriso_pacifier_reset (struct XorrisO *xorriso, int flag)
 
int Xorriso_pacifier_callback (struct XorrisO *xorriso, char *what_done, off_t count, off_t todo, char *current_object, int flag)
 
int Xorriso_reset_counters (struct XorrisO *xorriso, int flag)
 
int Xorriso_no_malloc_memory (struct XorrisO *xorriso, char **to_free, int flag)
 
int Xorriso_much_too_long (struct XorrisO *xorriso, int len, int flag)
 
int Xorriso_no_findjob (struct XorrisO *xorriso, char *cmd, int flag)
 
int Xorriso_report_md5_outcome (struct XorrisO *xorriso, char *severity, int flag)
 
int Xorriso_msg_op_parse (struct XorrisO *xorriso, char *line, char *prefix, char *separators, int max_words, int pflag, int input_lines, int flag)
 
int Xorriso_msg_op_parse_bulk (struct XorrisO *xorriso, char *prefix, char *separators, int max_words, int pflag, int bulk_lines, int flag)
 
int Xorriso_launch_frontend (struct XorrisO *xorriso, int argc, char **argv, char *cmd_pipe_adr, char *reply_pipe_adr, int flag)
 
int Xorriso_open_named_pipe (struct XorrisO *xorriso, char fd_names[3][20], int mem_fds[], char *pipe_paths[], int pipe_fds[], int i, int flag)
 
int Xorriso_named_pipe_loop (struct XorrisO *xorriso, char *pipe_paths[3], int flag)
 
char * Xorriso_esc_filepath (struct XorrisO *xorriso, char *in_text, char *out_text, int flag)
 
int Xorriso_set_info_text (struct XorrisO *xorriso, char *text, size_t trunc_len, int flag)
 

Macro Definition Documentation

◆ O_BINARY

#define O_BINARY   0

Definition at line 31 of file text_io.c.

Function Documentation

◆ Xorriso__speedname()

static char* Xorriso__speedname ( int  speed)
static

Definition at line 2745 of file text_io.c.

2746 {
2747  static char name[64];
2748 
2749  if(speed > 0) {
2750  sprintf(name, "%dkB/s", speed);
2751  return(name);
2752  } else if(speed == 0) {
2753  return("max");
2754  } else if(speed == -1) {
2755  return("min");
2756  } else if(speed == -2) {
2757  return("none");
2758  }
2759  sprintf(name, "%d", speed);
2760  return(name);
2761 }

Referenced by Xorriso_status().

◆ Xorriso_boot_status_sysarea()

int Xorriso_boot_status_sysarea ( struct XorrisO xorriso,
char *  filter,
FILE *  fp,
int  flag 
)

Definition at line 2713 of file text_io.c.

2715 {
2716  char *line, *form= "any", *spec= "system_area=";
2717  int sa_type;
2718 
2719  line= xorriso->result_line;
2720 
2721  sa_type= (xorriso->system_area_options & 0xfc) >> 2;
2722  if(sa_type != 0)
2723  return(2);
2724  if (xorriso->system_area_disk_path[0] == 0 && (flag & 1))
2725  return(2);
2726 
2727  if(xorriso->system_area_options & 1) {
2728  form= "grub";
2729  if(xorriso->system_area_options & (1 << 14))
2730  spec= "grub2_mbr=";
2731  } else if(xorriso->system_area_options & 2) {
2732  form= "isolinux";
2733  } if(xorriso->system_area_options & (1 << 14)) {
2734  form= "grub";
2735  spec= "grub2_mbr=";
2736  }
2737  sprintf(line, "-boot_image %s %s", form, spec);
2738  Text_shellsafe(xorriso->system_area_disk_path, line, 1);
2739  strcat(line, "\n");
2740  Xorriso_status_result(xorriso, filter, fp, flag & 2);
2741  return(1);
2742 }
char * Text_shellsafe(char *in_text, char *out_text, int flag)
Definition: misc_funct.c:1044
int system_area_options
char result_line[10 *4096]
char system_area_disk_path[4096]
int Xorriso_status_result(struct XorrisO *xorriso, char *filter, FILE *fp, int flag)
Definition: text_io.c:2687

References XorrisO::result_line, XorrisO::system_area_disk_path, XorrisO::system_area_options, Text_shellsafe(), and Xorriso_status_result().

Referenced by Xorriso_status().

◆ Xorriso_dialog_input()

int Xorriso_dialog_input ( struct XorrisO xorriso,
char  line[],
int  linesize,
int  flag 
)

Definition at line 316 of file text_io.c.

326 {
327  char **argv= NULL, *linept, *why_append= "";
328  int ret, argc= 0, base_length= 0, l, append_line;
329 #ifdef Xorriso_with_line_editoR
330  static char last_input[SfileadrL]= {""};
331  int no_history= 0;
332  char *cpt= NULL;
333 #endif /* Xorriso_with_line_editoR */
334  double tdiff;
335  struct timeval tv;
336  struct Xorriso_lsT *next_lst;
337 
338  gettimeofday(&tv, NULL);
339  tdiff= tv.tv_sec+(1.e-6*(double) tv.tv_usec);
340 
341  fflush(stdout);
342  linept= line;
343 
344 #ifdef Xorriso_with_line_editoR
345  no_history= (flag & 1) || xorriso->use_stdin;
346 #endif
347 
348 get_single:;
349 
350  if(xorriso->buffered_dialog != NULL && !(flag & (16 | 2))) {
351  /* Consume next buffered line */
352  next_lst= Xorriso_lst_get_next(xorriso->buffered_dialog, 0);
353  strcpy(line, Xorriso_lst_get_text(xorriso->buffered_dialog, 0));
354  Xorriso_lst_destroy(&(xorriso->buffered_dialog), 0);
355  xorriso->buffered_dialog= next_lst;
356  goto process_single;
357  }
358 
359 #ifdef Xorriso_with_line_editoR
360 
361  if(xorriso->use_stdin || xorriso->dev_fd_1>=0 ||
362  xorriso->tolerate_stdin_eof) {
363  if(flag&2) {
364  if(flag & 32)
365  goto put_into_history;
366  {ret= 1; goto ex;}
367  }
368  if(Sfile_fgets_n(linept,linesize - base_length - 1, stdin,
369  (xorriso->dialog == 2)) == NULL) {
370  if(xorriso->tolerate_stdin_eof)
371  {ret= -2; goto ex;}
372  /* need a very dramatic end */
373  kill(getpid(),SIGHUP);
374  {ret= -1; goto ex;}
375  }
376  goto process_single;
377  }
378  if(flag&2) {
379  cpt= NULL;
380  } else {
381  cpt= Xorriso_emul_readline(xorriso, 0);
382  if(cpt==NULL) {
383  /* need a very dramatic end */
384  kill(getpid(),SIGHUP);
385  {ret= -1; goto ex;}
386  }
387  l= strlen(cpt);
388  if(l >= linesize - base_length - 1) {
389  strncpy(linept, cpt, linesize - 1);
390  line[linesize - 1]= 0;
391  sprintf(xorriso->info_text,"Input line too long !");
392  Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "SORRY", 0);
393  goto new_empty;
394  } else
395  strcpy(linept, cpt);
396  }
397 
398 #else /* Xorriso_with_line_editoR */
399 
400  if(flag&2)
401  {ret= 1; goto ex;}
402  if(Sfile_fgets_n(linept, linesize - base_length - 1, stdin,
403  (xorriso->dialog == 2)) == NULL) {
404  if(xorriso->tolerate_stdin_eof)
405  {ret= -2; goto ex;}
406  /* need a very dramatic end */
407  kill(getpid(),SIGHUP);
408  {ret= -1; goto ex;}
409  }
410 
411 #endif /* ! Xorriso_with_line_editoR */
412 
413 process_single:;
414 
415  if(xorriso->dialog == 2 && !(flag & 8)) {
416  append_line= 0;
417  if(linept != line && strcmp(linept, "@@@") == 0) {
418  sprintf(xorriso->info_text, "Incomplete input line cleared by %s",
419  linept);
420  Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "NOTE",0);
421 new_empty:;
422  line[0]= 0;
423  linept= line;
424  sprintf(xorriso->info_text, "-------------------------------------\n");
425  Xorriso_info(xorriso,0);
426  sprintf(xorriso->info_text, "Enter new text for empty input line :\n");
427  Xorriso_info(xorriso,0);
428  goto get_single;
429  }
430  l= strlen(line);
431  ret= Sfile_make_argv("", line, &argc, &argv, 16);
432  if(ret < 0)
433  goto ex;
434  if(ret == 0 && !append_line) {
435  /* append a newline character */
436  if(l >= linesize - 1) {
437  sprintf(xorriso->info_text,"Input line too long !");
438  Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "SORRY", 0);
439  goto new_empty;
440  }
441  line[l]= '\n';
442  line[l + 1]= 0;
443  append_line= 1;
444  why_append= "Quoted newline char";
445  }
446  if(l > 0 && !append_line)
447  if(line[l - 1] == '\\') {
448  line[l - 1]= 0;
449  append_line= 1;
450  why_append= "Trailing backslash ";
451  }
452  if(append_line) {
453  base_length= strlen(line);
454  linept= line + base_length;
455  sprintf(xorriso->info_text,
456  "---------------------------------------------------------------\n");
457  Xorriso_info(xorriso,0);
458  sprintf(xorriso->info_text,
459  "%s : Enter rest of line (or @@@ to clear it) :\n", why_append);
460  Xorriso_info(xorriso,0);
461  goto get_single;
462  }
463  }
464 
465 #ifdef Xorriso_with_line_editoR
466 
467 put_into_history:;
468  if((flag & 32) || (line[0]!=0 && strcmp(last_input,line)!=0 && !no_history)) {
469  if(!((flag&4) &&
470  (strncmp(line,"-history:",9)==0 || strncmp(line,"-history ",9)==0))) {
471  Xorriso_emul_add_history(xorriso, line, 0);
472  strncpy(last_input,line,sizeof(last_input)-1);
473  last_input[sizeof(last_input)-1]= 0;
474  }
475  }
476 
477 #endif /* Xorriso_with_line_editoR */
478 
479  ret= 1;
480 ex:;
481 
482 #ifdef Xorriso_with_line_editoR
483  if(cpt!=NULL)
484  free(cpt);
485 #endif
486 
487  gettimeofday(&tv, NULL);
488  xorriso->idle_time+= tv.tv_sec+(1.e-6*(double) tv.tv_usec)-tdiff;
489  return(ret);
490 }
struct Xorriso_lsT * Xorriso_lst_get_next(struct Xorriso_lsT *entry, int flag)
Obtain the address of the next item in the chain of messages.
Definition: aux_objects.c:624
char * Xorriso_lst_get_text(struct Xorriso_lsT *entry, int flag)
Obtain the text message from the current list item.
Definition: aux_objects.c:636
int Xorriso_lst_destroy(struct Xorriso_lsT **lstring, int flag)
Destroy a single list item and connect its eventual list neighbors.
Definition: aux_objects.c:571
#define SfileadrL
int Sfile_make_argv(char *progname, char *line, int *argc, char ***argv, int flag)
Definition: sfile.c:828
char * Sfile_fgets_n(char *line, int maxl, FILE *fp, int flag)
Definition: sfile.c:33
char info_text[10 *4096]
int tolerate_stdin_eof
struct Xorriso_lsT * buffered_dialog
double idle_time
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_info(struct XorrisO *xorriso, int flag)
Definition: text_io.c:2367

References XorrisO::buffered_dialog, XorrisO::dev_fd_1, XorrisO::dialog, XorrisO::idle_time, XorrisO::info_text, Sfile_fgets_n(), Sfile_make_argv(), SfileadrL, XorrisO::tolerate_stdin_eof, XorrisO::use_stdin, Xorriso_info(), Xorriso_lst_destroy(), Xorriso_lst_get_next(), Xorriso_lst_get_text(), and Xorriso_msgs_submit().

Referenced by Xorriso_dialog(), Xorriso_msg_op_parse(), Xorriso_msg_op_parse_bulk(), Xorriso_named_pipe_loop(), Xorriso_option_history(), Xorriso_option_prompt(), and Xorriso_request_confirmation().

◆ Xorriso_esc_filepath()

char* Xorriso_esc_filepath ( struct XorrisO xorriso,
char *  in_text,
char *  out_text,
int  flag 
)

Definition at line 4742 of file text_io.c.

4744 {
4745  int l, w=0, limit= 5 * SfileadrL;
4746  char *res;
4747 
4748  if(xorriso->sh_style_result == 0) {
4749  res= Text_shellsafe(in_text, out_text, flag);
4750  return(res);
4751  }
4752  if(flag&1)
4753  w= strlen(out_text);
4754  if(flag & 2)
4755  limit= 10 * SfileadrL;
4756  l= strlen(in_text);
4757  if(w + l >= limit) {
4758  strcpy(out_text, "'xorriso: TEXT MUCH TOO LONG ... ");
4759  return(out_text);
4760  }
4761  strcpy(out_text + w, in_text);
4762  return(out_text);
4763 }
int sh_style_result

References SfileadrL, XorrisO::sh_style_result, and Text_shellsafe().

Referenced by Xorriso_findi_action(), Xorriso_findx_action(), Xorriso_ls(), Xorriso_ls_filev(), Xorriso_lsx_filev(), Xorriso_option_cdi(), Xorriso_option_cdx(), Xorriso_option_pwdi(), Xorriso_option_pwdx(), Xorriso_show_du_subs(), and Xorriso_show_dux_subs().

◆ Xorriso_fetch_outlists()

int Xorriso_fetch_outlists ( struct XorrisO xorriso,
int  stack_handle,
struct Xorriso_lsT **  result_list,
struct Xorriso_lsT **  info_list,
int  flag 
)

Obtain the currently collected text messages of redirected info and result channel.

The messages are handed out as two lists. Both lists have to be disposed via Xorriso_lst_destroy_all() when they are no longer needed. The message lists are either NULL or represented by their first Xorriso_lsT item.

This call is safe for being used by a concurrent thread while a xorriso API call is being executed on the same struct XorrisO. In such a situation, it should not be used with high frequency in order not to hamper the ongoing xorriso operation by blocking its message output facility. A hundred times per second should be enough.

Since
1.2.6
Parameters
xorrisoThe environment handle
stack_handleAn id number returned by Xorriso_push_outlists() and not yet revoked by Xorriso_pull_outlists(). Submit -1 to address the most recent valid id.
result_listResult and mark messages (usually directed to stdout)
info_listInfo and mark messages (usually directed to stderr)
flagBitfield for control purposes bit0= fetch result channel bit1= fetch info channel If bit0 and bit1 are 0, both channels get fetched.
Returns
1 on success, <=0 if failure

Definition at line 1206 of file text_io.c.

1209 {
1210  int ret, locked= 0;
1211 
1212 #ifdef Xorriso_fetch_with_msg_queueS
1213 
1214  ret= Xorriso_process_msg_queues(xorriso, 0);
1215  if(ret <= 0)
1216  goto ex;
1217 
1218 #endif /* Xorriso_fetch_with_msg_queueS */
1219 
1220  if((flag & 3) == 0)
1221  flag|= 3;
1222 
1223  ret= Xorriso_lock_outlists(xorriso, 0);
1224  if(ret <= 0)
1225  goto ex;
1226  locked= 1;
1227 
1228  if(stack_handle == -1)
1229  stack_handle= xorriso->msglist_stackfill - 1;
1230  if(stack_handle < 0 || stack_handle >= xorriso->msglist_stackfill) {
1231  Xorriso_unlock_outlists(xorriso, 0);
1232  locked= 0;
1233  Xorriso_msgs_submit(xorriso, 0,
1234  "Program error: Wrong message output redirection stack handle",
1235  0, "FATAL", 0);
1236  ret= -1; goto ex;
1237  }
1238 
1239  if(flag & 1) {
1240  *result_list= xorriso->result_msglists[stack_handle];
1241  xorriso->result_msglists[stack_handle]= NULL;
1242  }
1243  if(flag & 2) {
1244  *info_list= xorriso->info_msglists[stack_handle];
1245  xorriso->info_msglists[stack_handle]= NULL;
1246  }
1247 
1248  ret= 1;
1249 ex:;
1250  if(locked)
1251  Xorriso_unlock_outlists(xorriso, 0);
1252  return(ret);
1253 }
int Xorriso_process_msg_queues(struct XorrisO *xorriso, int flag)
Forward any pending messages from the library message queues to the xorriso message system which puts...
Definition: lib_mgt.c:519
int msglist_stackfill
struct Xorriso_lsT * info_msglists[Xorriso_max_outlist_stacK]
struct Xorriso_lsT * result_msglists[Xorriso_max_outlist_stacK]
static int Xorriso_unlock_outlists(struct XorrisO *xorriso, int flag)
Definition: text_io.c:875
static int Xorriso_lock_outlists(struct XorrisO *xorriso, int flag)
Definition: text_io.c:865

References XorrisO::info_msglists, XorrisO::msglist_stackfill, XorrisO::result_msglists, Xorriso_lock_outlists(), Xorriso_msgs_submit(), Xorriso_process_msg_queues(), and Xorriso_unlock_outlists().

Referenced by Xorriso_interpreter(), and Xorriso_msg_watcher().

◆ Xorriso_info()

int Xorriso_info ( struct XorrisO xorriso,
int  flag 
)

Definition at line 2367 of file text_io.c.

2373 {
2374  int ret;
2375  static int note_sev= 0;
2376 
2377  if(flag&2)
2378  if(xorriso->request_to_abort)
2379  return(1);
2380 
2381  if(note_sev==0)
2382  Xorriso__text_to_sev("NOTE", &note_sev, 0);
2383  if(note_sev<xorriso->report_about_severity &&
2384  note_sev<xorriso->abort_on_severity && !(flag&4))
2385  return(1);
2386 
2387  if(flag&1) {
2388  ret= Xorriso_pager(xorriso,xorriso->info_text,2);
2389  if(ret<=0)
2390  return(ret);
2391  if(ret==2)
2392  return(1);
2393  if(flag&2)
2394  if(xorriso->request_to_abort)
2395  return(1);
2396  }
2397  xorriso->bar_is_fresh= 0;
2398  ret=Xorriso_write_to_channel(xorriso, xorriso->info_text, 2, 0);
2399  return(ret);
2400 }
int Xorriso__text_to_sev(char *severity_name, int *severity_number, int flag)
Definition: lib_mgt.c:387
int bar_is_fresh
int request_to_abort
int Xorriso_pager(struct XorrisO *xorriso, char *line, int flag)
Definition: text_io.c:775
int Xorriso_write_to_channel(struct XorrisO *xorriso, char *in_text, int channel_no, int flag)
Definition: text_io.c:911

References XorrisO::bar_is_fresh, XorrisO::info_text, XorrisO::request_to_abort, Xorriso__text_to_sev(), Xorriso_pager(), and Xorriso_write_to_channel().

Referenced by Xorriso_aquire_drive(), Xorriso_blank_media(), Xorriso_burn_track(), Xorriso_cdrskin(), Xorriso_cdrskin_help(), Xorriso_check_session_md5(), Xorriso_clone_tree(), Xorriso_dialog(), Xorriso_dialog_input(), Xorriso_eval_problem_status(), Xorriso_execute_option(), Xorriso_extract_boot_images(), Xorriso_format_media(), Xorriso_genisofs(), Xorriso_genisofs_help(), Xorriso_give_up_drive(), Xorriso_ls(), Xorriso_ls_filev(), Xorriso_lsx_filev(), Xorriso_mark(), Xorriso_mkdir(), Xorriso_mount(), Xorriso_msg_op_parse(), Xorriso_msg_op_parse_bulk(), Xorriso_msgs_submit(), Xorriso_option_add(), Xorriso_option_cdi(), Xorriso_option_cdx(), Xorriso_option_check_media(), Xorriso_option_cpri(), Xorriso_option_cpx(), Xorriso_option_extract(), Xorriso_option_file_size_limit(), Xorriso_option_map(), Xorriso_option_mvi(), Xorriso_option_not_list(), Xorriso_option_options_from_file(), Xorriso_option_osirrox(), Xorriso_option_path_list(), Xorriso_option_print(), Xorriso_option_pwdi(), Xorriso_option_pwdx(), Xorriso_option_rmi(), Xorriso_option_update(), Xorriso_pager(), Xorriso_process_errfile(), Xorriso_process_msg_queues(), Xorriso_read_file_data(), Xorriso_reassure(), Xorriso_reassure_restore(), Xorriso_request_confirmation(), Xorriso_rmi(), Xorriso_show_devices(), Xorriso_toc_line(), and Xorriso_write_session().

◆ Xorriso_info_handler_stderr()

int Xorriso_info_handler_stderr ( void *  handle,
char *  text 
)

Definition at line 1354 of file text_io.c.

1355 {
1356  struct XorrisO *xorriso;
1357 
1358  xorriso= (struct XorrisO *) handle;
1359  if(xorriso->stderr_fp != NULL) {
1360  fprintf(xorriso->stderr_fp, "%s", text);
1361  fflush(xorriso->stderr_fp);
1362  } else {
1363  fprintf(stderr, "%s", text);
1364  fflush(stderr);
1365  }
1366  return(1);
1367 }
FILE * stderr_fp

References XorrisO::stderr_fp.

Referenced by Xorriso_process_msg_lists().

◆ Xorriso_launch_frontend()

int Xorriso_launch_frontend ( struct XorrisO xorriso,
int  argc,
char **  argv,
char *  cmd_pipe_adr,
char *  reply_pipe_adr,
int  flag 
)

Definition at line 4303 of file text_io.c.

4305 {
4306  int command_pipe[2], reply_pipe[2], ret, i, cpid, is_banned= 0;
4307  char **exec_argv= NULL, *sfe= NULL, *adrpt;
4308  struct stat stbuf;
4309 
4310  Xorriso_alloc_meM(sfe, char, 5 * SfileadrL);
4311  for(i= 0; i < 2; i++)
4312  command_pipe[i]= reply_pipe[i]= -1;
4313 
4314 #ifndef Xorriso_allow_launch_frontenD
4315  /* To be controlled by: configure --enable-external-filters */
4316 
4317  sprintf(xorriso->info_text, "-launch_frontend : Banned at compile time.");
4318  Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);
4319  sprintf(xorriso->info_text,
4320 "This may be changed at compile time by ./configure option --enable-external-filters");
4321  Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "HINT", 0);
4322  is_banned= 1;
4323 
4324 #endif /* ! Xorriso_allow_launch_frontenD */
4325 
4326 #ifndef Xorriso_allow_launch_frontend_suiD
4327 
4328  /* To be controlled by: configure --enable-external-filters-setuid */
4329 
4330  if(getuid() != geteuid()) {
4331  sprintf(xorriso->info_text,
4332  "-set_filter: UID and EUID differ. Will not run external programs.");
4333  Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FATAL", 0);
4334  sprintf(xorriso->info_text,
4335 "This may be changed at compile time by ./configure option --enable-external-filters-setuid");
4336  Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "HINT", 0);
4337  is_banned= 1;
4338  }
4339 
4340 #endif /* ! Xorriso_allow_launch_frontend_suiD */
4341 
4342  if(is_banned)
4343  {ret= 0; goto ex;}
4344 
4345  if(argc > 0) {
4346  if(strchr(argv[0], '/') == NULL) {
4347  sprintf(xorriso->info_text,
4348  "-launch_frontend : Command path does not contain a '/'-character");
4349  Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);
4350  {ret= 0; goto ex;}
4351  }
4352 
4353  /* Add a NULL pointer for execv() */
4354  Xorriso_alloc_meM(exec_argv, char *, argc + 1);
4355  for(i= 0; i < argc; i++)
4356  exec_argv[i]= argv[i];
4357  exec_argv[argc]= NULL;
4358  } else if(cmd_pipe_adr[0] == 0 || reply_pipe_adr[0] == 0)
4359  {ret= 0; goto ex;}
4360 
4361  if(cmd_pipe_adr[0] && reply_pipe_adr[0]) {
4362  /* Create named pipes if needed */
4363  for(i= 0; i < 2; i++) {
4364  if(i == 0)
4365  adrpt= cmd_pipe_adr;
4366  else
4367  adrpt= reply_pipe_adr;
4368  ret= stat(adrpt, &stbuf);
4369  if(ret == -1) {
4370  ret= mknod(adrpt, S_IFIFO | S_IRWXU | S_IRWXG | S_IRWXO | S_IRWXO,
4371  (dev_t) 0);
4372  if(ret == -1) {
4373  sprintf(xorriso->info_text,
4374  "-launch_frontend: Cannot create named pipe %s",
4375  Text_shellsafe(adrpt, sfe, 0));
4376  Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, errno,
4377  "FAILURE", 0);
4378  ret= 0; goto ex;
4379  }
4380  }
4381  }
4382  } else {
4383  ret= pipe(command_pipe);
4384  if (ret == -1) {
4385 no_pipe_open:
4386  sprintf(xorriso->info_text,
4387  "-launch_frontend: Failed to create a nameless pipe object");
4388  Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, errno, "FAILURE", 0);
4389  ret= 0; goto ex;
4390  }
4391  ret= pipe(reply_pipe);
4392  if (ret == -1)
4393  goto no_pipe_open;
4394  }
4395 
4396  if(argc > 0) {
4397  cpid = fork();
4398  if (cpid == -1) {
4399  sprintf(xorriso->info_text,
4400  "-launch_frontend: Failed to create a child process");
4401  Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, errno, "FAILURE", 0);
4402  ret= 0; goto ex;
4403  }
4404  } else
4405  cpid= -1; /* Dummy child id */
4406 
4407  if (cpid != 0) {
4408  /* Parent becomes the xorriso slave */
4409 
4410  xorriso->use_stdin= 1;
4411  if(cmd_pipe_adr[0] && reply_pipe_adr[0]) {
4412  command_pipe[0]= open(cmd_pipe_adr, O_RDONLY | O_BINARY);
4413  if(command_pipe[0] == -1) {
4414  sprintf(xorriso->info_text,
4415  "-launch_frontend: Failed to open named command pipe %s",
4416  Text_shellsafe(cmd_pipe_adr, sfe, 0));
4417  Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, errno,
4418  "FAILURE", 0);
4419  ret= 0; goto ex;
4420  }
4421  reply_pipe[1]= open(reply_pipe_adr, O_WRONLY | O_APPEND | O_BINARY);
4422  if(reply_pipe[1] == -1) {
4423  sprintf(xorriso->info_text,
4424  "-launch_frontend: Failed to open named reply pipe %s",
4425  Text_shellsafe(reply_pipe_adr, sfe, 0));
4426  Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, errno,
4427  "FAILURE", 0);
4428  ret= 0; goto ex;
4429  }
4430  } else {
4431  /* Close unused pipe ends */
4432  close(command_pipe[1]);
4433  close(reply_pipe[0]);
4434  }
4435  close(0);
4436  close(1);
4437  close(2);
4438  ret= dup2(command_pipe[0], 0);
4439  if(ret == -1) {
4440 no_dup:;
4441  sprintf(xorriso->info_text,
4442  "-launch_frontend: Failed to connect pipe to xorriso standard i/o channels");
4443  Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, errno, "FAILURE", 0);
4444  ret= -1; goto ex;
4445  }
4446  ret= dup2(reply_pipe[1], 1);
4447  if(ret == -1)
4448  goto no_dup;
4449  ret= dup2(reply_pipe[1], 2);
4450  if(ret == -1)
4451  goto no_dup;
4452  ret= 1; goto ex;
4453  }
4454 
4455  /* Child becomes the frontend program */
4456 
4457  /* Close unused pipe ends */;
4458  if(cmd_pipe_adr[0] && reply_pipe_adr[0]) {
4459  command_pipe[1]= open(cmd_pipe_adr, O_WRONLY | O_APPEND | O_BINARY);
4460  if(command_pipe[1] == -1) {
4461  fprintf(stderr,
4462  "xorriso: -launch_frontend: Failed to open named command pipe '%s'\n",
4463  cmd_pipe_adr);
4464  perror("xorriso: -launch_frontend");
4465  exit(1);
4466  }
4467  reply_pipe[0]= open(reply_pipe_adr, O_RDONLY | O_BINARY);
4468  if(reply_pipe[0] == -1) {
4469  fprintf(stderr,
4470  "xorriso: -launch_frontend: Failed to open named reply pipe '%s'\n",
4471  reply_pipe_adr);
4472  exit(1);
4473  }
4474  } else {
4475  close(command_pipe[0]);
4476  close(reply_pipe[1]);
4477  }
4478  close(0);
4479  close(1);
4480  ret= dup2(command_pipe[1], 1);
4481  if(ret == -1) {
4482  perror("xorriso: -launch_frontend: Error on redirecting standard output for frontend");
4483  exit(1);
4484  }
4485  ret= dup2(reply_pipe[0], 0);
4486  if(ret == -1) {
4487  perror("xorriso: -launch_frontend: Error on redirecting standard input for frontend");
4488  exit(1);
4489  }
4490 
4491  execv(exec_argv[0], exec_argv);
4492  fprintf(stderr, "xorriso: -launch_frontend: Failure to start program '%s'\n",
4493  exec_argv[0]);
4494  perror("xorriso: -launch_frontend");
4495  exit(1);
4496 
4497 ex:;
4498  Xorriso_free_meM(exec_argv);
4499  Xorriso_free_meM(sfe);
4500  return(ret);
4501 }
#define Xorriso_free_meM(pt)
Definition: sfile.h:27
#define Xorriso_alloc_meM(pt, typ, count)
Definition: sfile.h:19
#define O_BINARY
Definition: text_io.c:31

References XorrisO::info_text, O_BINARY, SfileadrL, Text_shellsafe(), XorrisO::use_stdin, Xorriso_alloc_meM, Xorriso_free_meM, and Xorriso_msgs_submit().

Referenced by Xorriso_option_launch_frontend().

◆ Xorriso_lock_outlists()

static int Xorriso_lock_outlists ( struct XorrisO xorriso,
int  flag 
)
static

Definition at line 865 of file text_io.c.

866 {
867  int ret;
868 
869  ret= Xorriso_obtain_lock(xorriso, &(xorriso->result_msglists_lock),
870  "outlists", 0);
871  return(ret);
872 }
pthread_mutex_t result_msglists_lock
static int Xorriso_obtain_lock(struct XorrisO *xorriso, pthread_mutex_t *lock_handle, char *purpose, int flag)
Definition: text_io.c:817

References XorrisO::result_msglists_lock, and Xorriso_obtain_lock().

Referenced by Xorriso_fetch_outlists(), Xorriso_pull_outlists(), Xorriso_push_outlists(), and Xorriso_write_to_msglist().

◆ Xorriso_mark()

int Xorriso_mark ( struct XorrisO xorriso,
int  flag 
)

Definition at line 2403 of file text_io.c.

2404 {
2405  int ret= 1,r_ret,i_ret;
2406 
2407  if(xorriso->mark_text[0]==0)
2408  return(1);
2409  if(xorriso->packet_output)
2410  ret=Xorriso_write_to_channel(xorriso, xorriso->mark_text, 3, 0);
2411  else {
2412  sprintf(xorriso->result_line,"%s\n",xorriso->mark_text);
2413  r_ret= Xorriso_result(xorriso,1);
2414  strcpy(xorriso->info_text,xorriso->result_line);
2415  i_ret= Xorriso_info(xorriso,0);
2416  if(r_ret==0 || i_ret==0)
2417  ret= 0;
2418  }
2419  return(ret);
2420 }
int packet_output
char mark_text[4096]
int Xorriso_result(struct XorrisO *xorriso, int flag)
Definition: text_io.c:2337

References XorrisO::info_text, XorrisO::mark_text, XorrisO::packet_output, XorrisO::result_line, Xorriso_info(), Xorriso_result(), and Xorriso_write_to_channel().

Referenced by Xorriso_dialog(), Xorriso_named_pipe_loop(), and Xorriso_option_print().

◆ Xorriso_msg_filter_destroy()

int Xorriso_msg_filter_destroy ( struct Xorriso_msg_filteR **  o,
int  flag 
)

Definition at line 1762 of file text_io.c.

1763 {
1764  struct Xorriso_msg_filteR *m;
1765 
1766  if((*o)==NULL)
1767  return(0);
1768  m= *o;
1769  if(m->name != NULL)
1770  free(m->name);
1771  if(m->prefix != NULL)
1772  free(m->prefix);
1773  if(m->separators != NULL)
1774  free(m->separators);
1775  if(m->word_idx != NULL)
1776  free((char *) m->word_idx);
1777  if(m->results != NULL)
1778  Xorriso_lst_destroy_all(&(m->results), 0);
1779  if(m->prev != NULL)
1780  m->prev->next= m->next;
1781  if(m->next != NULL)
1782  m->next->prev= m->prev;
1783 
1784  free(*o);
1785  *o= NULL;
1786  return(1);
1787 }
int Xorriso_lst_destroy_all(struct Xorriso_lsT **lstring, int flag)
Destroy all list items which are directly or indirectly connected to the given link item.
Definition: aux_objects.c:591
struct Xorriso_msg_filteR * next
Definition: text_io.c:1717
struct Xorriso_msg_filteR * prev
Definition: text_io.c:1716
struct Xorriso_lsT * results
Definition: text_io.c:1711

References Xorriso_msg_filteR::name, Xorriso_msg_filteR::next, Xorriso_msg_filteR::prefix, Xorriso_msg_filteR::prev, Xorriso_msg_filteR::results, Xorriso_msg_filteR::separators, Xorriso_msg_filteR::word_idx, and Xorriso_lst_destroy_all().

Referenced by Xorriso_msg_filter_new(), and Xorriso_msg_sieve_destroy().

◆ Xorriso_msg_filter_new()

int Xorriso_msg_filter_new ( struct Xorriso_msg_filteR **  o,
char *  name,
struct Xorriso_msg_filteR prev,
struct Xorriso_msg_filteR next,
int  flag 
)

Definition at line 1722 of file text_io.c.

1726 {
1727  struct Xorriso_msg_filteR *m;
1728 
1729  m= (*o)= TSOB_FELD(struct Xorriso_msg_filteR, 1);
1730  if((*o) == NULL)
1731  return(-1);
1732  m->name= NULL;
1733  m->prefix= NULL;
1734  m->separators= NULL;
1735  m->channels= 7;
1736  m->num_words= 0;
1737  m->word_idx= NULL;
1738  m->last_word_line_end= flag & 1;
1739  m->max_results= 1;
1740  m->results= NULL;
1741  m->num_results= 0;
1742  m->num_delivered= 0;
1743  m->next_to_deliver= NULL;
1744 
1745  m->name= strdup(name);
1746  if(m->name == NULL)
1747  goto failure;
1748 
1749  m->prev= prev;
1750  if(prev != NULL)
1751  prev->next= m;
1752  m->next= next;
1753  if(next != NULL)
1754  next->prev= m;
1755  return(1);
1756 failure:
1758  return(-1);
1759 }
#define TSOB_FELD(typ, count)
Definition: sfile.h:15
struct Xorriso_lsT * next_to_deliver
Definition: text_io.c:1714
int Xorriso_msg_filter_destroy(struct Xorriso_msg_filteR **o, int flag)
Definition: text_io.c:1762

References Xorriso_msg_filteR::channels, Xorriso_msg_filteR::last_word_line_end, Xorriso_msg_filteR::max_results, Xorriso_msg_filteR::name, Xorriso_msg_filteR::next, Xorriso_msg_filteR::next_to_deliver, Xorriso_msg_filteR::num_delivered, Xorriso_msg_filteR::num_results, Xorriso_msg_filteR::num_words, Xorriso_msg_filteR::prefix, Xorriso_msg_filteR::prev, Xorriso_msg_filteR::results, Xorriso_msg_filteR::separators, TSOB_FELD, Xorriso_msg_filteR::word_idx, and Xorriso_msg_filter_destroy().

Referenced by Xorriso_sieve_add_filter().

◆ Xorriso_msg_filter_set_words()

int Xorriso_msg_filter_set_words ( struct Xorriso_msg_filteR m,
int  num_words,
int *  word_idx,
int  flag 
)

Definition at line 1790 of file text_io.c.

1792 {
1793  int i;
1794 
1795  if(m->word_idx != NULL)
1796  free(m->word_idx);
1797  m->num_words= 0;
1798  if(num_words <= 0)
1799  return(1);
1800  m->word_idx= TSOB_FELD(int, num_words);
1801  if(m->word_idx == NULL)
1802  return(-1);
1803  for(i= 0; i < num_words; i++)
1804  m->word_idx[i]= word_idx[i];
1805  m->num_words= num_words;
1806  return(1);
1807 }

References Xorriso_msg_filteR::num_words, TSOB_FELD, and Xorriso_msg_filteR::word_idx.

Referenced by Xorriso_sieve_add_filter().

◆ Xorriso_msg_op_parse()

int Xorriso_msg_op_parse ( struct XorrisO xorriso,
char *  line,
char *  prefix,
char *  separators,
int  max_words,
int  pflag,
int  input_lines,
int  flag 
)

Definition at line 4161 of file text_io.c.

4165 {
4166  int ret, i, l, pargc= 0, bsl_mem;
4167  char *pline= NULL, **pargv= NULL, *parse_line, *text= NULL, *text_pt;
4168 
4169  Xorriso_alloc_meM(pline, char, SfileadrL);
4170 
4171  if(!(flag & 1)) {
4172  if(input_lines > 1)
4173  sprintf(xorriso->info_text, "-msg_op parse: Enter %d lines of text\n",
4174  input_lines);
4175  else
4176  sprintf(xorriso->info_text, "-msg_op parse: Enter text line\n");
4177  Xorriso_info(xorriso, 0);
4178  }
4179 
4180  if(flag & 2) {
4181  parse_line= line;
4182  } else {
4183  pline[0]= 0;
4184  for(i= 0; i < input_lines; i++) {
4185  l= strlen(pline);
4186  ret= Xorriso_dialog_input(xorriso, pline + l, SfileadrL - l - 1, 8 | 1);
4187  if(ret <= 0)
4188  goto ex;
4189  if(i < input_lines - 1)
4190  strcat(pline, "\n");
4191  }
4192  parse_line= pline;
4193  }
4194  ret= Xorriso_parse_line(xorriso, parse_line, prefix, separators, max_words,
4195  &pargc, &pargv, pflag);
4196 
4197  /* Temporarily disable backslash encoding of result channel */
4198  bsl_mem= xorriso->bsl_interpretation;
4199  xorriso->bsl_interpretation&= ~32;
4200 
4201  xorriso->msg_sieve_disabled= 1;
4202  sprintf(xorriso->result_line, "%d\n", ret);
4203  Xorriso_result(xorriso, 1);
4204  if(ret == 1) {
4205  sprintf(xorriso->result_line, "%d\n", pargc);
4206  Xorriso_result(xorriso, 1);
4207  for(i= 0; i < pargc; i++) {
4208  text_pt= pargv[i];
4209  if (bsl_mem & 32) {
4210  ret= Sfile_bsl_encoder(&text, pargv[i], strlen(pargv[i]), 4);
4211  if(ret > 0)
4212  text_pt= text;
4213  }
4214  ret= Sfile_count_char(text_pt, '\n') + 1;
4215  sprintf(xorriso->result_line, "%d\n", ret);
4216  Xorriso_result(xorriso, 1);
4217  Sfile_str(xorriso->result_line, text_pt, 0);
4218  strcat(xorriso->result_line, "\n");
4219  Xorriso_result(xorriso, 1);
4220  Xorriso_free_meM(text);
4221  text= NULL;
4222  }
4223  } else {
4224  sprintf(xorriso->result_line, "0\n");
4225  Xorriso_result(xorriso, 1);
4226  }
4227  xorriso->bsl_interpretation= bsl_mem;
4228  ret= 1;
4229 ex:;
4230  Xorriso__dispose_words(&pargc, &pargv);
4231  Xorriso_free_meM(text);
4232  Xorriso_free_meM(pline);
4233  return ret;
4234 }
int parse_line(char *progname, char *line, char *prefix, char *separators, int max_words, int *argc, char ***argv, int flag)
int Xorriso_parse_line(struct XorrisO *xorriso, char *line, char *prefix, char *separators, int max_words, int *argc, char ***argv, int flag)
Definition: parse_exec.c:2066
void Xorriso__dispose_words(int *argc, char ***argv)
Definition: parse_exec.c:2120
int Sfile_bsl_encoder(char **result, char *text, size_t text_len, int flag)
Definition: sfile.c:562
int Sfile_str(char target[4096], char *source, int flag)
Definition: sfile.c:836
int Sfile_count_char(char *text, char to_count)
Definition: sfile.c:49
int bsl_interpretation
int msg_sieve_disabled
int Xorriso_dialog_input(struct XorrisO *xorriso, char line[], int linesize, int flag)
Definition: text_io.c:316

References XorrisO::bsl_interpretation, XorrisO::info_text, XorrisO::msg_sieve_disabled, parse_line(), XorrisO::result_line, Sfile_bsl_encoder(), Sfile_count_char(), Sfile_str(), SfileadrL, Xorriso_lsT::text, Xorriso__dispose_words(), Xorriso_alloc_meM, Xorriso_dialog_input(), Xorriso_free_meM, Xorriso_info(), Xorriso_parse_line(), and Xorriso_result().

Referenced by Xorriso_msg_op_parse_bulk(), and Xorriso_option_msg_op().

◆ Xorriso_msg_op_parse_bulk()

int Xorriso_msg_op_parse_bulk ( struct XorrisO xorriso,
char *  prefix,
char *  separators,
int  max_words,
int  pflag,
int  bulk_lines,
int  flag 
)

Definition at line 4239 of file text_io.c.

4243 {
4244  int ret, input_lines, i, j, l;
4245  char line[80];
4246  struct Xorriso_lsT *input_list= NULL, *input_end= NULL, *new_lst, *lst;
4247  char *pline= NULL;
4248 
4249  if(!(flag & 1)) {
4250  sprintf(xorriso->info_text,
4251  "Enter %d groups of lines. Each group begins by a line which tells the\n",
4252  bulk_lines);
4253  Xorriso_info(xorriso, 0);
4254  sprintf(xorriso->info_text,
4255  "number of following lines in the group. Then come the announced lines\n");
4256  Xorriso_info(xorriso, 0);
4257  sprintf(xorriso->info_text,
4258  "Do this blindly. No further prompt will appear. Best be a computer.\n");
4259  Xorriso_info(xorriso, 0);
4260  }
4261 
4262  Xorriso_alloc_meM(pline, char, SfileadrL);
4263 
4264  for(i= 0; i < bulk_lines; i++) {
4265  ret= Xorriso_dialog_input(xorriso, line, sizeof(line), 8 | 1);
4266  if(ret <= 0)
4267  goto ex;
4268  input_lines= -1;
4269  sscanf(line, "%d", &input_lines);
4270  pline[0]= 0;
4271  for(j= 0; j < input_lines; j++) {
4272  l= strlen(pline);
4273  ret= Xorriso_dialog_input(xorriso, pline + l, SfileadrL - l - 1, 8 | 1);
4274  if(ret <= 0)
4275  goto ex;
4276  if(j < input_lines - 1)
4277  strcat(pline, "\n");
4278  }
4279  ret= Xorriso_lst_new(&new_lst, pline, input_end, 0);
4280  if(ret <= 0)
4281  goto ex;
4282  if(input_list == NULL)
4283  input_list= new_lst;
4284  input_end= new_lst;
4285  }
4286 
4287  for(lst= input_list; lst != NULL; lst= Xorriso_lst_get_next(lst, 0)) {
4288  ret= Xorriso_msg_op_parse(xorriso, Xorriso_lst_get_text(lst, 0),
4289  prefix, separators, max_words, pflag,
4290  input_lines, 1 | 2);
4291  if(ret <= 0)
4292  goto ex;
4293  }
4294 
4295  ret= 1;
4296 ex:;
4297  Xorriso_lst_destroy_all(&input_list, 0);
4298  Xorriso_free_meM(pline);
4299  return(1);
4300 }
int Xorriso_lst_new(struct Xorriso_lsT **lstring, char *text, struct Xorriso_lsT *link, int flag)
Create a new list item with a 0-terminated text as content.
Definition: aux_objects.c:557
int Xorriso_msg_op_parse(struct XorrisO *xorriso, char *line, char *prefix, char *separators, int max_words, int pflag, int input_lines, int flag)
Definition: text_io.c:4161

References XorrisO::info_text, SfileadrL, Xorriso_alloc_meM, Xorriso_dialog_input(), Xorriso_free_meM, Xorriso_info(), Xorriso_lst_destroy_all(), Xorriso_lst_get_next(), Xorriso_lst_get_text(), Xorriso_lst_new(), and Xorriso_msg_op_parse().

Referenced by Xorriso_option_msg_op().

◆ Xorriso_msg_sieve_destroy()

int Xorriso_msg_sieve_destroy ( struct Xorriso_msg_sievE **  o,
int  flag 
)

Definition at line 1832 of file text_io.c.

1833 {
1834  struct Xorriso_msg_sievE *m;
1835  struct Xorriso_msg_filteR *f, *next_f= NULL;
1836 
1837  if((*o) == NULL)
1838  return(0);
1839  m= *o;
1840  for(f= m->first_filter; f != NULL; f= next_f) {
1841  next_f= f->next;
1843  }
1844  free(*o);
1845  *o= NULL;
1846  return(1);
1847 }
struct Xorriso_msg_filteR * first_filter
Definition: text_io.c:1814

References Xorriso_msg_sievE::first_filter, Xorriso_msg_filteR::next, and Xorriso_msg_filter_destroy().

Referenced by Xorriso_sieve_add_filter(), and Xorriso_sieve_dispose().

◆ Xorriso_msg_sieve_new()

int Xorriso_msg_sieve_new ( struct Xorriso_msg_sievE **  o,
int  flag 
)

Definition at line 1819 of file text_io.c.

1820 {
1821  struct Xorriso_msg_sievE *m;
1822 
1823  m= (*o)= TSOB_FELD(struct Xorriso_msg_sievE, 1);
1824  if((*o) == NULL)
1825  return(-1);
1826  m->num_filters= 0;
1827  m->first_filter= NULL;
1828  return(1);
1829 }

References Xorriso_msg_sievE::first_filter, Xorriso_msg_sievE::num_filters, and TSOB_FELD.

Referenced by Xorriso_sieve_add_filter().

◆ Xorriso_msg_watcher()

static void* Xorriso_msg_watcher ( void *  state_pt)
static

Definition at line 1454 of file text_io.c.

1455 {
1456  struct XorrisO *xorriso;
1457  int ret, u_wait= 25000, line_count, sleep_thresh= 20, lock_failure= 0;
1458  struct Xorriso_lsT *result_list= NULL, *info_list= NULL;
1459  static int debug_sev= 0;
1460 
1461  xorriso= (struct XorrisO *) state_pt;
1462 
1463  if(debug_sev == 0)
1464  Xorriso__text_to_sev("DEBUG", &debug_sev, 0);
1465 
1466  xorriso->msg_watcher_state= 2;
1467  if(xorriso->msgw_info_handler != NULL &&
1468  debug_sev < xorriso->report_about_severity &&
1469  debug_sev < xorriso->abort_on_severity)
1470  (*xorriso->msgw_info_handler)(xorriso,
1471  "xorriso : DEBUG : Concurrent message watcher started\n");
1472  while(1) {
1473  line_count= 0;
1474 
1475  /* Watch out for end request in xorriso */
1476  if(xorriso->msg_watcher_state == 3)
1477  break;
1478 
1479  ret= Xorriso_obtain_lock(xorriso, &(xorriso->msgw_fetch_lock),
1480  "message watcher fetch operation", 1);
1481  if(ret <= 0) {
1482  lock_failure= 1;
1483  break;
1484  }
1485  xorriso->msgw_msg_pending= 1;
1486  ret= Xorriso_fetch_outlists(xorriso, -1, &result_list, &info_list, 3);
1487  if(ret > 0) {
1488  /* Process fetched lines */
1489  xorriso->msgw_msg_pending= 2;
1490  Xorriso_release_lock(xorriso, &(xorriso->msgw_fetch_lock),
1491  "message watcher fetch operation", 1);
1492  ret= Xorriso_process_msg_lists(xorriso, result_list, info_list,
1493  &line_count, 0);
1494  xorriso->msgw_msg_pending= 0;
1495  Xorriso_lst_destroy_all(&result_list, 0);
1496  Xorriso_lst_destroy_all(&info_list, 0);
1497  if(ret < 0)
1498  break;
1499  } else {
1500  xorriso->msgw_msg_pending= 0;
1501  Xorriso_release_lock(xorriso, &(xorriso->msgw_fetch_lock),
1502  "message watcher fetch operation", 1);
1503  }
1504  xorriso->msgw_msg_pending= 0;
1505 
1506  if(ret < 0)
1507  break;
1508 
1509  if(line_count < sleep_thresh)
1510  usleep(u_wait);
1511  }
1512  if(xorriso->msgw_info_handler != NULL &&
1513  debug_sev < xorriso->report_about_severity &&
1514  debug_sev < xorriso->abort_on_severity &&
1515  !lock_failure)
1516  (*xorriso->msgw_info_handler)(xorriso,
1517  "xorriso : DEBUG : Concurrent message watcher ended\n");
1518  xorriso->msg_watcher_state= 0;
1519  return(NULL);
1520 }
int abort_on_severity
int msgw_msg_pending
int msg_watcher_state
int report_about_severity
int(* msgw_info_handler)(void *handle, char *text)
pthread_mutex_t msgw_fetch_lock
static int Xorriso_release_lock(struct XorrisO *xorriso, pthread_mutex_t *lock_handle, char *purpose, int flag)
Definition: text_io.c:842
int Xorriso_process_msg_lists(struct XorrisO *xorriso, struct Xorriso_lsT *result_list, struct Xorriso_lsT *info_list, int *line_count, int flag)
Definition: text_io.c:1416
int Xorriso_fetch_outlists(struct XorrisO *xorriso, int stack_handle, struct Xorriso_lsT **result_list, struct Xorriso_lsT **info_list, int flag)
Obtain the currently collected text messages of redirected info and result channel.
Definition: text_io.c:1206

References XorrisO::abort_on_severity, XorrisO::msg_watcher_state, XorrisO::msgw_fetch_lock, XorrisO::msgw_info_handler, XorrisO::msgw_msg_pending, XorrisO::report_about_severity, Xorriso__text_to_sev(), Xorriso_fetch_outlists(), Xorriso_lst_destroy_all(), Xorriso_obtain_lock(), Xorriso_process_msg_lists(), and Xorriso_release_lock().

Referenced by Xorriso_start_msg_watcher().

◆ Xorriso_msgs_submit()

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.

This will eventually increase problem status rank, which may at certain stages in the program be pardoned and reset to 0. The pardon is governed by Xorriso_option_abort_on() and by the anger of the affected program part. If no pardon has been given, then the problem status reaches the caller of option functions. Problem status should be inquired by Xorriso_eval_problem_status() and be reset before next option execution by Xorriso_set_problem_status(). The problem status itself does not cause the failure of option functions. But in case of failures for other reasons, a remnant overly severe problem status can cause overly harsh program reactions.

Parameters
xorrisoThe environment handle
error_codeThe unique error code of your message. Submit 0 if you do not have reserved error codes within the libburnia project.
msg_textNot more than 8196 characters of message text. A final newline character gets appended automatically.
os_errnoEventual errno related to the message. Submit 0 if the message is not related to a operating system error.
severityOne of "ABORT", "FATAL", "FAILURE", "MISHAP", "SORRY", "WARNING", "HINT", "NOTE", "UPDATE", "DEBUG". Defaults to "FATAL".
flagBitfield for control purposes bit0= use pager (as with result) bit1= permission to suppress output
Returns
1 if message was delivered, <=0 if failure

Definition at line 2504 of file text_io.c.

2507 {
2508  int ret, lt, li, sev, i;
2509  char *sev_text= "FATAL", prefix[80], *text= NULL;
2510  static char pfx_list[20][16]= {
2511  "xorriso : ", "libisofs: ", "libburn : ", "libisoburn: ",
2512  "", "", "", "", "", "", "", "", "", "", "", "" };
2513 
2514  if(flag&128)
2515  Xorriso_process_msg_queues(xorriso, 0);
2516 
2517  if(strcmp(severity, "ERRFILE")==0)
2518  Xorriso_process_errfile(xorriso, error_code, msg_text, os_errno, 0);
2519 
2520  /* Set problem status */
2521  ret= Xorriso__text_to_sev(severity, &sev, 0);
2522  if(ret<=0)
2523  Xorriso__text_to_sev(sev_text, &sev, 0);
2524  else
2525  sev_text= severity;
2526  if(xorriso->problem_status<sev)
2527  Xorriso_set_problem_status(xorriso, sev_text, 0);
2528 
2529  /* Report problem event */
2530  if(sev<xorriso->report_about_severity && sev<xorriso->abort_on_severity)
2531  {ret= 2; goto ex;}
2532  lt= strlen(msg_text);
2533  if(!(flag & 256)) {
2534  sprintf(prefix,"%s%s : ", pfx_list[(flag>>2)&15], sev_text);
2535  li= strlen(prefix);
2536  } else {
2537  prefix[0]= 0;
2538  li= 0;
2539  }
2540  if(lt > ((int) sizeof(xorriso->info_text)) - li - 2)
2541  lt= sizeof(xorriso->info_text)-li-2;
2542 
2543 #ifdef Xorriso_fetch_with_msg_queueS
2544 
2545  Xorriso_alloc_meM(text, char, sizeof(xorriso->info_text));
2546 
2547 #else /* Xorriso_fetch_with_msg_queueS */
2548 
2549  text= xorriso->info_text;
2550 
2551 #endif /* ! Xorriso_fetch_with_msg_queueS */
2552 
2553  if(msg_text == text) {
2554  if(li > 0) {
2555  for(i= lt; i>=0; i--)
2556  msg_text[i+li]= msg_text[i];
2557  for(i=0; i<li; i++)
2558  msg_text[i]= prefix[i];
2559  }
2560  } else {
2561  if(li > 0)
2562  strcpy(text, prefix);
2563  strncpy(text + li, msg_text, lt);
2564  }
2565  if((flag&64) && os_errno<=0)
2566  text[li+lt]= '\r';
2567  else
2568  text[li+lt]= '\n';
2569  text[li+lt+1]= 0;
2570  if(os_errno>0)
2571  sprintf(text + strlen(text) - 1, " : %s\n", strerror(os_errno));
2572 
2573 #ifdef Xorriso_fetch_with_msg_queueS
2574 
2575  Xorriso_write_to_channel(xorriso, text, 2, 0);
2576 
2577 #else /* Xorriso_fetch_with_msg_queueS */
2578 
2579  Xorriso_info(xorriso,4|(flag&3));
2580 
2581 #endif /* ! Xorriso_fetch_with_msg_queueS */
2582 
2583 ex:;
2584 
2585 #ifdef Xorriso_fetch_with_msg_queueS
2586  Xorriso_free_meM(text);
2587 #endif /* ! Xorriso_fetch_with_msg_queueS */
2588 
2589  return(ret);
2590 }
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 problem_status
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

References XorrisO::info_text, XorrisO::problem_status, Xorriso_lsT::text, Xorriso__text_to_sev(), Xorriso_alloc_meM, Xorriso_free_meM, Xorriso_info(), Xorriso_process_errfile(), Xorriso_process_msg_queues(), Xorriso_set_problem_status(), and Xorriso_write_to_channel().

Referenced by Permstack_pop(), Sfile_prepend_path(), Xoriso_handle_collision(), Xorriso_add_mips_boot_file(), Xorriso_add_tree(), Xorriso_adjust_session_size(), Xorriso_afile_fopen(), Xorriso_alloc_pattern_mem(), Xorriso_append_extattr_comp(), Xorriso_append_scdbackup_record(), Xorriso_apply_sort_file(), Xorriso_aquire_drive(), Xorriso_assert_volid(), Xorriso_atip(), Xorriso_attach_boot_image(), Xorriso_auto_chmod(), Xorriso_auto_driveadr(), Xorriso_auto_format(), Xorriso_blank_as_needed(), Xorriso_blank_media(), Xorriso_burn_track(), Xorriso_cannot_clone(), Xorriso_cannot_create_iter(), Xorriso_cdrskin(), Xorriso_check_burn_abort(), Xorriso_check_for_abort(), Xorriso_check_for_root_pattern(), Xorriso_check_interval(), Xorriso_check_intvl_string(), Xorriso_check_matchcount(), Xorriso_check_md5(), Xorriso_check_media(), Xorriso_check_media_setup_job(), Xorriso_check_multi(), Xorriso_check_session_md5(), Xorriso_check_temp_mem_limit(), Xorriso_check_thing_len(), Xorriso_chunk_md5(), Xorriso_clone_tree(), Xorriso_clone_under(), Xorriso_close_damaged(), Xorriso_compare_2_files(), Xorriso_concat(), Xorriso_convert_datestring(), Xorriso_convert_gidstring(), Xorriso_convert_modstring(), Xorriso_convert_uidstring(), Xorriso_coordinate_system_area(), Xorriso_copy_implicit_properties(), Xorriso_count_args(), Xorriso_cpmv_args(), Xorriso_cut_out(), Xorriso_decode_load_adr(), Xorriso_dialog_input(), Xorriso_dir_from_path(), Xorriso_execv(), Xorriso_expand_disk_pattern(), Xorriso_expand_pattern(), Xorriso_external_filter(), Xorriso_external_filter_banned(), Xorriso_extract_boot_images(), Xorriso_extract_cut(), Xorriso_fetch_outlists(), Xorriso_findi_action(), Xorriso_findi_iter(), Xorriso_findx(), Xorriso_findx_action(), Xorriso_format_media(), Xorriso_genisofs(), Xorriso_genisofs_fused_options(), Xorriso_genisofs_hide_list(), Xorriso_genisofs_ignore(), Xorriso_genisofs_platform(), Xorriso_get_attrs(), Xorriso_get_drive_handles(), Xorriso_get_volume(), Xorriso_getfacl(), Xorriso_give_up_drive(), Xorriso_gpt_crc(), Xorriso_graft_in(), Xorriso_graft_split(), Xorriso_graftable_pathspec(), Xorriso_handle_collision(), Xorriso_hfsplus_bless(), Xorriso_hfsplus_file_creator_type(), Xorriso_hop_link(), Xorriso_interpreter(), Xorriso_is_concat_target(), Xorriso_iso_file_open(), Xorriso_iso_file_to_fd(), Xorriso_jigdo_interpreter(), Xorriso_launch_frontend(), Xorriso_list_formats(), Xorriso_list_speeds(), Xorriso_list_speeds_sub(), Xorriso_ls_filev(), Xorriso_lsx_filev(), Xorriso_make_iso_write_opts(), Xorriso_make_mount_cmd(), Xorriso_make_return_value(), Xorriso_make_tmp_path(), Xorriso_make_write_options(), Xorriso_may_burn(), Xorriso_mkdir(), Xorriso_mount(), Xorriso_msgs_submit_void(), Xorriso_msinfo(), Xorriso_much_too_long(), Xorriso_named_pipe_loop(), Xorriso_no_findjob(), Xorriso_no_malloc_memory(), Xorriso_no_pattern_memory(), Xorriso_node_from_path(), Xorriso_normalize_acl_text(), Xorriso_normalize_img_path(), Xorriso_obtain_pattern_files_x(), Xorriso_open_job_data_to(), Xorriso_open_named_pipe(), Xorriso_opt_args(), Xorriso_option_abort_on(), Xorriso_option_acl(), Xorriso_option_add(), Xorriso_option_add_plainly(), Xorriso_option_append_partition(), Xorriso_option_application_use(), Xorriso_option_as(), Xorriso_option_assert_volid(), Xorriso_option_auto_charset(), Xorriso_option_backslash_codes(), Xorriso_option_blank(), Xorriso_option_boot_image(), Xorriso_option_cdi(), Xorriso_option_cdx(), Xorriso_option_changes_pending(), Xorriso_option_charset(), Xorriso_option_check_md5(), Xorriso_option_check_media(), Xorriso_option_close_damaged(), Xorriso_option_commit(), Xorriso_option_compare(), Xorriso_option_concat(), Xorriso_option_cp_clone(), Xorriso_option_cpri(), Xorriso_option_cpx(), Xorriso_option_cut_out(), Xorriso_option_dev(), Xorriso_option_devices(), Xorriso_option_dialog(), Xorriso_option_disk_dev_ino(), Xorriso_option_disk_pattern(), Xorriso_option_displacement(), Xorriso_option_drive_access(), Xorriso_option_drive_class(), Xorriso_option_dvd_obs(), Xorriso_option_early_stdio_test(), Xorriso_option_ecma119_map(), Xorriso_option_eject(), Xorriso_option_errfile_log(), Xorriso_option_error_behavior(), Xorriso_option_external_filter(), Xorriso_option_extract(), Xorriso_option_extract_boot_images(), Xorriso_option_extract_cut(), Xorriso_option_file_name_limit(), Xorriso_option_file_size_limit(), Xorriso_option_find(), Xorriso_option_follow(), Xorriso_option_fs(), Xorriso_option_hardlinks(), Xorriso_option_hfsplus(), Xorriso_option_hide(), Xorriso_option_iso_nowtime(), Xorriso_option_iso_rr_pattern(), Xorriso_option_joliet(), Xorriso_option_joliet_map(), Xorriso_option_launch_frontend(), Xorriso_option_list_delimiter(), Xorriso_option_lnsi(), Xorriso_option_load(), Xorriso_option_logfile(), Xorriso_option_lsi(), Xorriso_option_lsx(), Xorriso_option_map(), Xorriso_option_map_l(), Xorriso_option_md5(), Xorriso_option_modesty_on_drive(), Xorriso_option_mount(), Xorriso_option_mount_opts(), Xorriso_option_msg_op(), Xorriso_option_mvi(), Xorriso_option_named_pipe_loop(), Xorriso_option_not_leaf(), Xorriso_option_not_list(), Xorriso_option_not_mgt(), Xorriso_option_not_paths(), Xorriso_option_options_from_file(), Xorriso_option_osirrox(), Xorriso_option_overwrite(), Xorriso_option_pacifier(), Xorriso_option_padding(), Xorriso_option_page(), Xorriso_option_paste_in(), Xorriso_option_path_list(), Xorriso_option_pathspecs(), Xorriso_option_print(), Xorriso_option_print_size(), Xorriso_option_prog(), Xorriso_option_read_fs(), Xorriso_option_reassure(), Xorriso_option_report_about(), Xorriso_option_return_with(), Xorriso_option_rmi(), Xorriso_option_rockridge(), Xorriso_option_rom_toc_scan(), Xorriso_option_rr_reloc_dir(), Xorriso_option_scdbackup_tag(), Xorriso_option_scsi_dev_family(), Xorriso_option_scsi_log(), Xorriso_option_setfacl_listi(), Xorriso_option_setfacli(), Xorriso_option_setfattr_listi(), Xorriso_option_sh_style_result(), Xorriso_option_signal_handling(), Xorriso_option_sleep(), Xorriso_option_speed(), Xorriso_option_split_size(), Xorriso_option_stdio_sync(), Xorriso_option_tell_media_space(), Xorriso_option_temp_mem_limit(), Xorriso_option_toc_of(), Xorriso_option_update(), Xorriso_option_use_immed_bit(), Xorriso_option_volid(), Xorriso_option_volume_date(), Xorriso_option_write_type(), Xorriso_option_xattr(), Xorriso_option_zisofs(), Xorriso_overwrite_dest(), Xorriso_overwrite_iso_head(), Xorriso_pacifier_callback(), Xorriso_pacifier_loop(), Xorriso_parse_guid(), Xorriso_parse_line(), Xorriso_paste_in(), Xorriso_path_is_excluded(), Xorriso_path_is_hidden(), Xorriso_path_setfattr(), Xorriso_pipe_open(), Xorriso_prepare_expansion_pattern(), Xorriso_prepare_regex(), Xorriso_prescan_args(), Xorriso_pretend_full_disc(), Xorriso_process_msg_queues(), Xorriso_pull_outlists(), Xorriso_push_outlists(), Xorriso_read_file_data(), Xorriso_read_lines(), Xorriso_reaquire_outdev(), Xorriso_reassure(), Xorriso_reassure_restore(), Xorriso_refresh_ts_tags(), Xorriso_register_matched_adr(), Xorriso_register_node_target(), Xorriso_relax_compliance(), Xorriso_rename(), Xorriso_rename_suffix(), Xorriso_report_iso_error(), Xorriso_report_md5_outcome(), Xorriso_report_system_area(), Xorriso_resolve_link(), Xorriso_restore(), Xorriso_restore_disk_object(), Xorriso_restore_implicit_properties(), Xorriso_restore_is_identical(), Xorriso_restore_make_hl(), Xorriso_restore_node_array(), Xorriso_restore_overwrite(), Xorriso_restore_properties(), Xorriso_restore_tree(), Xorriso_retry_burn_track(), Xorriso_retry_write_session(), Xorriso_rmi(), Xorriso_rmx(), Xorriso_sanitize_image_size(), Xorriso_scan_report_lines(), Xorriso_sectormap_to_spotlist(), Xorriso_set_file_name_limit(), Xorriso_set_filter(), Xorriso_set_hfsplus_crtp(), Xorriso_set_hppa_boot_parm(), Xorriso_set_isolinux_options(), Xorriso_set_local_charset(), Xorriso_set_signal_handling(), Xorriso_set_st_mode(), Xorriso_set_system_area(), Xorriso_set_system_area_path(), Xorriso_set_volid(), Xorriso_setfacl(), Xorriso_setfattr(), Xorriso_show_devices(), Xorriso_show_dux_subs(), Xorriso_sieve_get_result(), Xorriso_sorted_node_array(), Xorriso_source_date_epoch(), Xorriso_split_report_line(), Xorriso_start_chunk_md5(), Xorriso_start_msg_watcher(), Xorriso_startup_libraries(), Xorriso_stop_msg_watcher(), Xorriso_toc(), Xorriso_tree_graft_node(), Xorriso_tree_restore_node(), Xorriso_truncate_const_find_name(), Xorriso_truncate_overwritable(), Xorriso_truncate_uniquely(), Xorriso_update_interpreter(), Xorriso_update_iso_lba0(), Xorriso_verify_sb_tag(), Xorriso_warn_of_wildcards(), Xorriso_write_application_use(), Xorriso_write_session(), and Xorriso_write_session_log().

◆ Xorriso_msgs_submit_void()

int Xorriso_msgs_submit_void ( void *  xorriso,
int  error_code,
char  msg_text[],
int  os_errno,
char  severity[],
int  flag 
)

Alternative call interface of Xorriso_msgs_submit with void* instead of struct XorrisO*.

Definition at line 2595 of file text_io.c.

2598 {
2599  int ret;
2600 
2601  ret= Xorriso_msgs_submit((struct XorrisO *) xorriso, error_code, msg_text,
2602  os_errno, severity, flag);
2603  return(ret);
2604 }

References Xorriso_msgs_submit().

Referenced by Xorriso_startup_libraries().

◆ Xorriso_much_too_long()

int Xorriso_much_too_long ( struct XorrisO xorriso,
int  len,
int  flag 
)

Definition at line 4097 of file text_io.c.

4098 {
4099  if(len>=SfileadrL || (flag&2)) {
4100  sprintf(xorriso->info_text,
4101  "Path given for file in %s is much too long (%d)",
4102  ((flag&1) ? "local filesystem" : "ISO image"), len);
4103  Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);
4104  return(0);
4105  }
4106  return(1);
4107 }

References XorrisO::info_text, SfileadrL, and Xorriso_msgs_submit().

Referenced by Xorriso_add_tree(), Xorriso_compare_2_files(), Xorriso_make_abs_adr(), Xorriso_restore_disk_object(), Xorriso_restore_tree(), Xorriso_rmi(), Xorriso_rmx(), Xorriso_show_du_subs(), Xorriso_show_dux_subs(), and Xorriso_update_interpreter().

◆ Xorriso_named_pipe_loop()

int Xorriso_named_pipe_loop ( struct XorrisO xorriso,
char *  pipe_paths[3],
int  flag 
)

Definition at line 4551 of file text_io.c.

4553 {
4554  char *line= NULL;
4555  int i, ret, mem_fds[3], pipe_fds[3], first_line, hret, pipes_are_valid= 0;
4556  int lst_ret, filling_buffer= 0;
4557  off_t mem_used= 0, mem_needed;
4558  struct stat stbuf;
4559  struct Xorriso_lsT *prev_lst= NULL;
4560  static char fd_names[3][20] = {
4561  "standard input", "standard output", "standard error" };
4562  char mem_text[80], limit_text[80];
4563 
4564  for(i= 0; i < 3; i++ )
4565  mem_fds[i]= pipe_fds[i]= -1;
4566 
4567  if(xorriso->tolerate_stdin_eof) {
4568  sprintf(xorriso->info_text,
4569  "Already in -named_pipe_loop. Ignoring further -named_pipe_loop command.");
4570  Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, errno, "SORRY", 0);
4571  return(0); /* intentionally not goto ex */
4572  }
4573 
4574  Xorriso_alloc_meM(line, char, SfileadrL);
4575 
4576  /* Memorize stdin, stdout, and stderr. Close originals. */
4577  for(i= 0; i < 3; i++ ) {
4578  if(pipe_paths[i][0] == 0 || strcmp(pipe_paths[i], "-") == 0)
4579  continue;
4580  if(stat(pipe_paths[i], &stbuf) == -1) {
4581  sprintf(xorriso->info_text,
4582  "-named_pipe_loop: Cannot determine properties of file ");
4583  Text_shellsafe(pipe_paths[i], xorriso->info_text, 1);
4584  Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, errno, "FAILURE", 0);
4585  ret= 0; goto ex;
4586  }
4587  if(!S_ISFIFO(stbuf.st_mode)) {
4588  sprintf(xorriso->info_text,
4589  "-named_pipe_loop: File is not a named pipe: ");
4590  Text_shellsafe(pipe_paths[i], xorriso->info_text, 1);
4591  Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);
4592  ret= 0; goto ex;
4593  }
4594  mem_fds[i]= dup(i);
4595  if(mem_fds[i] == -1) {
4596  sprintf(xorriso->info_text,
4597  "-named_pipe_loop: Cannot duplicate original %s", fd_names[i]);
4598  Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, errno, "FAILURE", 0);
4599  ret= 0; goto ex;
4600  }
4601  }
4602  pipes_are_valid= 1;
4603 
4604  while(1) {
4605  /* Open input pipe */
4606  ret= Xorriso_open_named_pipe(xorriso, fd_names, mem_fds, pipe_paths,
4607  pipe_fds, 0, 0);
4608  if(ret <= 0)
4609  goto ex;
4610 
4611  /* As long as the input connection exists */
4612  xorriso->tolerate_stdin_eof= 1;
4613  first_line= 1;
4614  if(flag & 2) {
4615  filling_buffer= 8 | 16; /* single line, no reading from buffered_dialog */
4616  prev_lst= NULL;
4617  mem_used= 0;
4618  }
4619  while(1) {
4620  /* Fetch input line */
4621  if((flag & 2) && xorriso->buffered_dialog == NULL && !filling_buffer) {
4622  ret= -2; /* EOF */
4623  } else {
4624  ret= Xorriso_dialog_input(xorriso, line, SfileadrL, 1 | filling_buffer);
4625  }
4626  if((flag & 2) && filling_buffer) {
4627  /* Fetch and buffer lines before opening output pipes */
4628 
4629  if(ret > 0) {
4630 
4631  /* Check for excessive memory consumption */;
4632  mem_needed= strlen(line) + 8 + sizeof(struct Xorriso_lsT);
4633  if(mem_used + mem_needed > xorriso->temp_mem_limit) {
4634  Sfile_scale((double) (mem_used + mem_needed), mem_text, 5, 1e4, 0);
4635  Sfile_scale((double) xorriso->temp_mem_limit,
4636  limit_text, 5, 1e4, 0);
4637  sprintf(xorriso->info_text,
4638  "-named_pipe_loop: List of buffered input lines exceeds -temp_mem_limit (%s > %s)",
4639  mem_text, limit_text);
4640  Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0,
4641  "FAILURE", 0);
4642  ret= -1; goto ex;
4643  }
4644  mem_used+= mem_needed;
4645 
4646  lst_ret= Xorriso_lst_new(&prev_lst, line, prev_lst, 0);
4647  if(lst_ret <= 0) {
4648  Xorriso_msgs_submit(xorriso, 0,
4649  "-named_pipe_loop: Cannot buffer all input lines", 0, "FATAL", 0);
4650  ret= -1; goto ex;
4651  } else {
4652  if(xorriso->buffered_dialog == NULL)
4653  xorriso->buffered_dialog= prev_lst;
4654  continue;
4655  }
4656  }
4657  filling_buffer= 0; /* start consuming buffer */
4658  continue;
4659  }
4660 
4661  /* Open output pipes late to allow the sender to open them after
4662  the first (and usually only) input line was transmitted:
4663  echo ... >stdin_pipe
4664  res=$(cat <stdout_pipe)
4665  This will work independently of the stdin_pipe buffer size.
4666  */
4667  if(first_line) {
4668  first_line= 0;
4669  for(i= 1; i < 3; i++) {
4670  hret= Xorriso_open_named_pipe(xorriso, fd_names, mem_fds, pipe_paths,
4671  pipe_fds, i, 0);
4672  if(hret <= 0 && ret > 0)
4673  {ret= hret; goto ex;}
4674  }
4675  }
4676 
4677  /* Now evaluate outcome of Xorriso_dialog_input() */
4678  if(ret == -2) /* EOF at stdin */
4679  break;
4680  if(ret <= 0) /* Other error */
4681  goto ex;
4682 
4683  /* Regular end of command */
4684  if(strcmp(line, "end_named_pipe_loop") == 0)
4685  {ret= 1; goto ex;}
4686 
4687  /* Perform xorriso command */
4688  ret= Xorriso_execute_option(xorriso, line, (1 << 16));
4689  if(ret <= 0)
4690  goto ex;
4691  if(ret == 3) /* e.g. -end command */
4692  goto ex;
4693  Xorriso_mark(xorriso,0);
4694  }
4695 
4696  /* Restore stdin, stdout and stderr */
4697  for(i= 0; i < 3; i++) {
4698  if(mem_fds[i] != -1) {
4699  if(pipe_fds[i] != -1)
4700  close(pipe_fds[i]);
4701  pipe_fds[i]= -1;
4702  close(i);
4703  dup2(mem_fds[i], i);
4704  }
4705  }
4706  }
4707 
4708  ret= 1;
4709 ex:;
4710  xorriso->tolerate_stdin_eof= 0;
4711  if(flag & 2)
4712  Xorriso_lst_destroy_all(&(xorriso->buffered_dialog), 0);
4713  /* Close any open pipes. Restore stdin, stdout and stderr. */
4714  for(i= 0; i < 3; i++) {
4715  if(pipe_fds[i] != -1) {
4716  if((flag & 1) && pipes_are_valid) {
4717  if(stat(pipe_paths[i], &stbuf) != -1) {
4718  if(S_ISFIFO(stbuf.st_mode)) {
4719  sprintf(xorriso->info_text, "Removing named pipe ");
4720  Text_shellsafe(pipe_paths[i], xorriso->info_text, 1);
4721  Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "NOTE", 0);
4722  unlink(pipe_paths[i]);
4723  }
4724  }
4725  }
4726  close(pipe_fds[i]);
4727  }
4728  if(mem_fds[i] != -1) {
4729  close(i);
4730  dup2(mem_fds[i], i);
4731  close(mem_fds[i]);
4732  }
4733  }
4734  Xorriso_free_meM(line);
4735  return(ret);
4736 }
int Xorriso_execute_option(struct XorrisO *xorriso, char *line, int flag)
Definition: parse_exec.c:2126
int Sfile_scale(double value, char *result, int siz, double thresh, int flag)
Definition: sfile.c:331
int temp_mem_limit
int Xorriso_open_named_pipe(struct XorrisO *xorriso, char fd_names[3][20], int mem_fds[], char *pipe_paths[], int pipe_fds[], int i, int flag)
Definition: text_io.c:4505
int Xorriso_mark(struct XorrisO *xorriso, int flag)
Definition: text_io.c:2403

References XorrisO::buffered_dialog, XorrisO::info_text, Sfile_scale(), SfileadrL, XorrisO::temp_mem_limit, Text_shellsafe(), XorrisO::tolerate_stdin_eof, Xorriso_alloc_meM, Xorriso_dialog_input(), Xorriso_execute_option(), Xorriso_free_meM, Xorriso_lst_destroy_all(), Xorriso_lst_new(), Xorriso_mark(), Xorriso_msgs_submit(), and Xorriso_open_named_pipe().

Referenced by Xorriso_option_named_pipe_loop().

◆ Xorriso_no_findjob()

◆ Xorriso_no_malloc_memory()

int Xorriso_no_malloc_memory ( struct XorrisO xorriso,
char **  to_free,
int  flag 
)

Definition at line 4077 of file text_io.c.

4078 {
4079  if(to_free!=NULL)
4080  if(*to_free!=NULL) {
4081  /* Eventual memory sacrifice to get on going */
4082  free(*to_free);
4083  *to_free= NULL;
4084  }
4085  sprintf(xorriso->info_text, "Out of virtual memory");
4086  if(flag & 1) {
4087  fprintf(stderr, "%s", xorriso->info_text);
4088  /* (No need to first check for problem status worse than ABORT) */
4089  Xorriso_set_problem_status(xorriso, "ABORT", 0);
4090  } else
4091  Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "ABORT", 0);
4092  return(1);
4093 }

References XorrisO::info_text, Xorriso_msgs_submit(), and Xorriso_set_problem_status().

Referenced by Xorriso_add_tree(), Xorriso_adjust_session_size(), Xorriso_check_interval(), Xorriso_check_md5_range(), Xorriso_chunk_md5(), Xorriso_findi(), Xorriso_findx_action(), Xorriso_genisofs(), Xorriso_getfacl(), Xorriso_getfattr(), Xorriso_jigdo_interpreter(), Xorriso_local_getfacl(), Xorriso_make_di_array(), Xorriso_md5_start(), Xorriso_new_hln_array(), Xorriso_new_node_array(), Xorriso_normalize_acl_text(), Xorriso_obtain_pattern_files_i(), Xorriso_obtain_pattern_files_x(), Xorriso_option_append_partition(), Xorriso_option_charset(), Xorriso_option_cpx(), Xorriso_option_map_l(), Xorriso_option_not_mgt(), Xorriso_option_setfacl_listi(), Xorriso_option_setfattr_listi(), Xorriso_path_from_node(), Xorriso_perform_attr_from_list(), Xorriso_refresh_sb_tag(), Xorriso_register_node_target(), Xorriso_restore_tree(), Xorriso_rmi(), Xorriso_rmx(), Xorriso_set_hfsplus_crtp(), Xorriso_sieve_add_filter(), Xorriso_sieve_filter_msg(), Xorriso_sieve_get_result(), Xorriso_sorted_dir_x(), Xorriso_truncate_uniquely(), and Xorriso_verify_sb_tag().

◆ Xorriso_obtain_lock()

static int Xorriso_obtain_lock ( struct XorrisO xorriso,
pthread_mutex_t *  lock_handle,
char *  purpose,
int  flag 
)
static

Definition at line 817 of file text_io.c.

820 {
821  int ret;
822  static int complaints= 0, complaint_limit= 5;
823 
824  ret= pthread_mutex_lock(lock_handle);
825  if(ret != 0) {
826  if(flag & 1)
827  return(-1);
828  /* Cannot report failure through the failing message output system */
829  complaints++;
830  if(complaints <= complaint_limit)
831  fprintf(stderr,
832  "xorriso : pthread_mutex_lock() for %s returns %d\n",
833  purpose, ret);
834  return(-1);
835  }
836  return(1);
837 }

Referenced by Xorriso_lock_outlists(), Xorriso_msg_watcher(), Xorriso_peek_outlists(), and Xorriso_stop_msg_watcher().

◆ Xorriso_open_named_pipe()

int Xorriso_open_named_pipe ( struct XorrisO xorriso,
char  fd_names[3][20],
int  mem_fds[],
char *  pipe_paths[],
int  pipe_fds[],
int  i,
int  flag 
)

Definition at line 4505 of file text_io.c.

4508 {
4509  if(mem_fds[i] == -1)
4510  return(2);
4511  pipe_fds[i]= open(pipe_paths[i], (i == 0 ? O_RDONLY : O_WRONLY) | O_BINARY);
4512  if(pipe_fds[i] == -1) {
4513  sprintf(xorriso->info_text,
4514  "-named_pipe_loop: Failed to open %s pipe ", fd_names[i]);
4515  Text_shellsafe(pipe_paths[i], xorriso->info_text, 1);
4516  Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, errno, "FAILURE",0);
4517  return(0);
4518  }
4519  close(i);
4520  dup2(pipe_fds[i], i);
4521  return(1);
4522 }

References XorrisO::info_text, O_BINARY, Text_shellsafe(), and Xorriso_msgs_submit().

Referenced by Xorriso_named_pipe_loop().

◆ Xorriso_pacifier_callback()

int Xorriso_pacifier_callback ( struct XorrisO xorriso,
char *  what_done,
off_t  count,
off_t  todo,
char *  current_object,
int  flag 
)

Definition at line 3969 of file text_io.c.

3972 {
3973  double current_time, since, interval_time, speed, speed_factor;
3974  char count_text[80], byte_text[80], profile_name[80], *speed_unit;
3975  int ret, profile_number, short_sec;
3976  off_t amount;
3977 
3978  current_time= Sfile_microtime(0);
3979  interval_time= current_time - xorriso->last_update_time;
3980  if(interval_time < xorriso->pacifier_interval
3981  && !(flag&1))
3982  return(1);
3983  xorriso->last_update_time= Sfile_microtime(0);
3984  since= current_time - xorriso->start_time;
3985  if((flag & 1) && since < 1.0 && xorriso->pacifier_interval >= 1.0)
3986  since= 1.0;
3987  if((flag & 1) && since < 0.1)
3988  since= 0.1;
3989  byte_text[0]= 0;
3990  if(flag&4) {
3991  strcat(byte_text, " (");
3992  Sfile_scale((double) xorriso->pacifier_byte_count,
3993  byte_text+strlen(byte_text), 7, 1e5, 0);
3994  strcat(byte_text, ")");
3995  }
3996  short_sec= 0;
3997  if(count<=0.0 && !(flag&2)) {
3998  if(since < 2)
3999  return(2);
4000  sprintf(xorriso->info_text,
4001  "Thank you for being patient for");
4002  } else if(todo<=0.0) {
4003  if(count<10000000)
4004  sprintf(count_text, "%7.f", (double) count);
4005  else
4006  Sfile_scale((double) count, count_text, 7, 1e5, 1);
4007  sprintf(xorriso->info_text, "%s %s%s in",
4008  count_text, what_done, byte_text);
4009  short_sec= (flag & 64);
4010  } else {
4011  sprintf(xorriso->info_text, "%.f of %.f %s%s in",
4012  (double) count, (double) todo, what_done, byte_text);
4013  short_sec= (flag & (8 | 64));
4014  }
4015  if(xorriso->pacifier_interval < 1.0) {
4016  sprintf(xorriso->info_text + strlen(xorriso->info_text),
4017  " %.1f", since);
4018  } else {
4019  sprintf(xorriso->info_text + strlen(xorriso->info_text),
4020  " %.f", since);
4021  }
4022  sprintf(xorriso->info_text + strlen(xorriso->info_text),
4023  " %s", short_sec ? "s" : "seconds");
4024 
4025  speed= -1.0;
4026  if(flag & 4)
4027  amount= xorriso->pacifier_byte_count;
4028  else
4029  amount= count;
4030  if((flag & 8)) {
4031  if(flag & 32) {
4032  if(since > 0)
4033  speed= amount / since;
4034  } else if(amount >= xorriso->pacifier_prev_count) {
4035  if(interval_time > 0)
4036  speed= (amount - xorriso->pacifier_prev_count) / interval_time;
4037  }
4038  }
4039  if(speed >= 0.0) {
4040  if(flag & 16)
4041  speed*= 2048.0;
4042  ret= Xorriso_get_profile(xorriso, &profile_number, profile_name,
4043  (flag >> 6) & 2);
4044  speed_factor= 1385000;
4045  speed_unit= "D";
4046  if(ret == 2) {
4047  speed_factor= 150.0*1024;
4048  speed_unit= "C";
4049  } else if(ret == 3) {
4050  speed_factor= 4495625;
4051  speed_unit= "B";
4052  }
4053  sprintf(xorriso->info_text+strlen(xorriso->info_text), " %s %.1fx%s",
4054  (flag & 32 ? "=" : ","), speed / speed_factor, speed_unit);
4055  }
4056  xorriso->pacifier_prev_count= amount;
4057  if(current_object[0]!=0)
4058  sprintf(xorriso->info_text+strlen(xorriso->info_text),
4059  ", now at %s", current_object);
4060  Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "UPDATE", (flag&64));
4061  return(1);
4062 }
int Xorriso_get_profile(struct XorrisO *xorriso, int *profile_number, char profile_name[80], int flag)
Definition: drive_mgt.c:2236
double Sfile_microtime(int flag)
Return a double representing seconds and microseconds since 1 Jan 1970.
Definition: sfile.c:883
double start_time
off_t pacifier_byte_count
double pacifier_interval
off_t pacifier_prev_count
double last_update_time

References XorrisO::info_text, XorrisO::last_update_time, XorrisO::pacifier_byte_count, XorrisO::pacifier_interval, XorrisO::pacifier_prev_count, Sfile_microtime(), Sfile_scale(), XorrisO::start_time, Xorriso_get_profile(), and Xorriso_msgs_submit().

Referenced by Xorriso__read_pacifier(), Xorriso_add_tree(), Xorriso_aquire_drive(), Xorriso_check_interval(), Xorriso_check_md5(), Xorriso_check_md5_range(), Xorriso_check_media(), Xorriso_compare_2_contents(), Xorriso_extract_cut(), Xorriso_genisofs(), Xorriso_graft_in(), Xorriso_make_md5(), Xorriso_option_add(), Xorriso_option_check_md5(), Xorriso_option_compare(), Xorriso_option_cpri(), Xorriso_option_cpx(), Xorriso_option_extract(), Xorriso_option_find(), Xorriso_option_map(), Xorriso_option_map_l(), Xorriso_option_paste_in(), Xorriso_option_path_list(), Xorriso_option_set_filter(), Xorriso_option_update(), Xorriso_restore_disk_object(), Xorriso_set_filter(), and Xorriso_tree_restore_node().

◆ Xorriso_pacifier_reset()

◆ Xorriso_pager()

int Xorriso_pager ( struct XorrisO xorriso,
char *  line,
int  flag 
)

Definition at line 775 of file text_io.c.

780 {
781  int ret,linecount;
782  char *info_text= NULL;
783 
784  if(xorriso->result_page_length<=0 || xorriso->request_not_to_ask ||
785  xorriso->dialog == 0)
786  {ret= 1; goto ex;}
787  Xorriso_predict_linecount(xorriso,line,&linecount,0);
788  if(xorriso->result_line_counter+linecount>xorriso->result_page_length) {
789 ask_for_page:;
790  if(info_text == NULL)
791  Xorriso_alloc_meM(info_text, char, 10*SfileadrL);
792  strcpy(info_text,xorriso->info_text);
793  sprintf(xorriso->info_text,"\n");
794  Xorriso_info(xorriso,0);
795  sprintf(xorriso->info_text,
796 ".... [Press Enter to continue. @,Enter avoids further stops. @@@ aborts] ....\n");
797  Xorriso_info(xorriso,0);
798  ret= Xorriso_request_confirmation(xorriso,flag&2);
799  strcpy(xorriso->info_text,info_text);
800  if(ret<=0)
801  goto ex;
802  if(ret==2)
803  {ret= 2; goto ex;}
804  if(ret==3)
805  goto ask_for_page;
806  }
807  xorriso->result_line_counter+= linecount;
808  ret= 1;
809 ex:;
810  Xorriso_free_meM(info_text);
811  return(ret);
812 }
int result_page_length
int request_not_to_ask
int result_line_counter
int Xorriso_predict_linecount(struct XorrisO *xorriso, char *line, int *linecount, int flag)
Definition: text_io.c:742
int Xorriso_request_confirmation(struct XorrisO *xorriso, int flag)
Definition: text_io.c:493

References XorrisO::dialog, XorrisO::info_text, XorrisO::request_not_to_ask, XorrisO::result_line_counter, XorrisO::result_page_length, SfileadrL, Xorriso_alloc_meM, Xorriso_free_meM, Xorriso_info(), Xorriso_predict_linecount(), and Xorriso_request_confirmation().

Referenced by Xorriso_info(), and Xorriso_result().

◆ Xorriso_peek_outlists()

int Xorriso_peek_outlists ( struct XorrisO xorriso,
int  stack_handle,
int  timeout,
int  flag 
)

Inquire whether messages are pending in redirected result and info channel.

This may be used to determine whether a concurrent message watcher already has obtained all pending messages.

Since
1.2.6
Parameters
xorrisoThe environment handle
stack_handleAn id number returned by Xorriso_push_outlists() and not yet revoked by Xorriso_pull_outlists(). Submit -1 to address the most recent valid id.
timeoutNumber of seconds after which to return despite flag bit 2
flagBitfield for control purposes bit0= fetch result channel bit1= fetch info channel bit2= wait and retry until return is 0 or -1 If bit0 and bit1 are 0, both channels get fetched.
Returns
If > 0: bit0= messages are pending in outlists bit1= message watcher is processing fetched messages Else: 0= no messages are pending anywhere -1= inappropriate stack_handle -2= locking failed

Definition at line 1256 of file text_io.c.

1258 {
1259  int ret, locked= 0, yes= 0;
1260  static int u_wait= 19000;
1261  time_t start_time;
1262 
1263  if((flag & 3) == 0)
1264  flag|= 3;
1265  if(stack_handle == -1)
1266  stack_handle= xorriso->msglist_stackfill - 1;
1267  start_time= time(NULL);
1268 
1269 try_again:;
1270  ret= Xorriso_obtain_lock(xorriso, &(xorriso->msgw_fetch_lock),
1271  "message watcher fetch operation", 0);
1272  if(ret <= 0)
1273  {yes= -2; goto ex;}
1274  locked= 1;
1275 
1276  yes= 0;
1277  if(stack_handle < 0 || stack_handle >= xorriso->msglist_stackfill)
1278  {yes= -1; goto ex;}
1279  if(flag & 1)
1280  yes|= (xorriso->result_msglists[stack_handle] != NULL);
1281  if(flag & 2)
1282  yes|= (xorriso->info_msglists[stack_handle] != NULL);
1283  if(xorriso->msg_watcher_state == 2 && xorriso->msgw_msg_pending)
1284  yes|= 2;
1285 
1286  ret= Xorriso_release_lock(xorriso, &(xorriso->msgw_fetch_lock),
1287  "message watcher fetch operation", 0);
1288  if(ret <= 0)
1289  {yes= -2; goto ex;}
1290  locked= 0;
1291 
1292  if(yes && (flag & 4)) {
1293  usleep(u_wait);
1294  if(time(NULL) <= start_time + timeout)
1295  goto try_again;
1296  }
1297 
1298 ex:;
1299  if(locked) {
1300  ret= Xorriso_release_lock(xorriso, &(xorriso->msgw_fetch_lock),
1301  "message watcher fetch operation", 0);
1302  if(ret <= 0 && yes >= 0)
1303  yes= -2;
1304  }
1305  return(yes);
1306 }

References XorrisO::info_msglists, XorrisO::msg_watcher_state, XorrisO::msglist_stackfill, XorrisO::msgw_fetch_lock, XorrisO::msgw_msg_pending, XorrisO::result_msglists, Xorriso_obtain_lock(), and Xorriso_release_lock().

Referenced by Xorriso_interpreter().

◆ Xorriso_predict_linecount()

int Xorriso_predict_linecount ( struct XorrisO xorriso,
char *  line,
int *  linecount,
int  flag 
)

Definition at line 742 of file text_io.c.

744 {
745  int width,l;
746  char *spt,*ept;
747 
748  *linecount= 0;
749  spt= line;
750  width= xorriso->result_page_width;
751  while(1) {
752  ept= strchr(spt,'\n');
753  if(ept==NULL)
754  l= strlen(spt);
755  else
756  l= ept-spt;
757  l+= xorriso->result_open_line_len;
758  if(ept!=NULL && l==0)
759  (*linecount)++;
760  else {
761  (*linecount)+= l/width;
762  if(ept==NULL) {
763  xorriso->result_open_line_len= l%width;
764  break;
765  }
766  (*linecount)+= !!(l%width);
767  }
768  xorriso->result_open_line_len= 0;
769  spt= ept+1;
770  }
771  return(1);
772 }
int result_page_width
int result_open_line_len

References XorrisO::result_open_line_len, and XorrisO::result_page_width.

Referenced by Xorriso_pager().

◆ Xorriso_process_errfile()

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.

Parameters
xorrisoThe environment handle
error_codeThe unique error code of your message. Submit 0 if you do not have reserved error codes within the libburnia project.
msg_textNot more than 8196 characters of message text.
os_errnoEventual errno related to the message. Submit 0 if the message is not related to a operating system error.
flagbit0-7= meaning of msg_text ( 0= ERRFILE path , for internal use mainly ) 1= mark line text (only to be put out if enabled)
Returns
<=0 error , >0 success

Definition at line 2438 of file text_io.c.

2441 {
2442  char ttx[41];
2443  int purpose;
2444 
2445  if(strlen(msg_text)>SfileadrL)
2446  return(-1);
2447 
2448  purpose= flag&255;
2449  if(purpose==1 && !(xorriso->errfile_mode&1))
2450  return(2);
2451  if(xorriso->errfile_fp!=NULL) {
2452  if(purpose==1)
2453  fprintf(xorriso->errfile_fp, "----------------- %s %s\n",
2454  msg_text, Ftimetxt(time(0), ttx, 1));
2455  else
2456  fprintf(xorriso->errfile_fp, "%s\n", msg_text);
2457  fflush(xorriso->errfile_fp);
2458  return(1);
2459  }
2460  if(xorriso->errfile_log[0]==0)
2461  return(1);
2462  if(strcmp(xorriso->errfile_log, "-")==0 ||
2463  strcmp(xorriso->errfile_log, "-R")==0) {
2464  if(purpose==1)
2465  sprintf(xorriso->result_line, "----------------- %s %s\n",
2466  msg_text, Ftimetxt(time(0), ttx, 1));
2467  else
2468  sprintf(xorriso->result_line, "%s\n", msg_text);
2469  Xorriso_result(xorriso, 1);
2470  return(1);
2471  }
2472  if(strcmp(xorriso->errfile_log, "-I") == 0 &&
2473  xorriso->info_text != msg_text) { /* (Beware of stepping on own foot) */
2474  if(purpose==1)
2475  sprintf(xorriso->info_text, "ERRFILE_MARK=%s %s\n",
2476  msg_text, Ftimetxt(time(0), ttx, 1));
2477  else
2478  sprintf(xorriso->info_text, "ERRFILE=%s\n", msg_text);
2479  Xorriso_info(xorriso, 0);
2480  return(1);
2481  }
2482  return(2);
2483 }
char * Ftimetxt(time_t t, char timetext[40], int flag)
Definition: misc_funct.c:682
FILE * errfile_fp
int errfile_mode
char errfile_log[4096]

References XorrisO::errfile_fp, XorrisO::errfile_log, XorrisO::errfile_mode, Ftimetxt(), XorrisO::info_text, XorrisO::result_line, SfileadrL, Xorriso_info(), and Xorriso_result().

Referenced by main(), Xorriso_msgs_submit(), Xorriso_option_commit(), and Xorriso_option_errfile_log().

◆ Xorriso_process_msg_lists()

int Xorriso_process_msg_lists ( struct XorrisO xorriso,
struct Xorriso_lsT result_list,
struct Xorriso_lsT info_list,
int *  line_count,
int  flag 
)

Definition at line 1416 of file text_io.c.

1420 {
1421  struct Xorriso_lsT *lpt;
1422  int ret;
1423  int (*handler)(void *handle, char *text);
1424  void *handle;
1425 
1426  handler= xorriso->msgw_result_handler;
1427  handle= xorriso->msgw_result_handle;
1428  if(handler == NULL) {
1429  handler= Xorriso_result_handler_pkt;
1430  handle= xorriso;
1431  }
1432  for(lpt= result_list; lpt != NULL; lpt= lpt->next) {
1433  (*line_count)++;
1434  ret= (*handler)(handle, Xorriso_lst_get_text(lpt, 0));
1435  if(ret < 0)
1436  return(-1);
1437  }
1438  handler= xorriso->msgw_info_handler;
1439  handle= xorriso->msgw_info_handle;
1440  if(handler == NULL) {
1441  handler= Xorriso_info_handler_stderr;
1442  handle= xorriso;
1443  }
1444  for(lpt= info_list; lpt != NULL; lpt= lpt->next) {
1445  (*line_count)++;
1446  ret= (*handler)(handle, Xorriso_lst_get_text(lpt, 0));
1447  if(ret < 0)
1448  return(-1);
1449  }
1450  return(1);
1451 }
int(* msgw_result_handler)(void *handle, char *text)
void * msgw_info_handle
void * msgw_result_handle
struct Xorriso_lsT * next
Definition: aux_objects.h:70
char * text
Definition: aux_objects.h:69
int Xorriso_info_handler_stderr(void *handle, char *text)
Definition: text_io.c:1354
int Xorriso_result_handler_pkt(void *handle, char *text)
Definition: text_io.c:1378

References XorrisO::msgw_info_handle, XorrisO::msgw_info_handler, XorrisO::msgw_result_handle, XorrisO::msgw_result_handler, Xorriso_lsT::next, Xorriso_lsT::text, Xorriso_info_handler_stderr(), Xorriso_lst_get_text(), and Xorriso_result_handler_pkt().

Referenced by Xorriso_interpreter(), Xorriso_msg_watcher(), Xorriso_start_msg_watcher(), and Xorriso_stop_msg_watcher().

◆ Xorriso_protect_stdout()

int Xorriso_protect_stdout ( struct XorrisO xorriso,
int  flag 
)

Definition at line 63 of file text_io.c.

64 {
65  if(xorriso->dev_fd_1>=0)
66  return(2);
67  xorriso->dev_fd_1= dup(1);
68  close(1);
69  dup2(2,1);
70  return(1);
71 }

References XorrisO::dev_fd_1.

Referenced by Xorriso_new(), and Xorriso_prescan_args().

◆ Xorriso_pull_outlists()

int Xorriso_pull_outlists ( struct XorrisO xorriso,
int  stack_handle,
struct Xorriso_lsT **  result_list,
struct Xorriso_lsT **  info_list,
int  flag 
)

Disable the redirection given by stack_handle.

If it was the current receiver of messages then switch output to the next older redirection, or to the normal channels if no redirections are stacked any more. The messages collected by the disabled redirection are handed out as two lists. Both lists have to be disposed via Xorriso_lst_destroy_all() when they are no longer needed. The message lists are either NULL or represented by their first Xorriso_lsT item.

Parameters
xorrisoThe environment handle
stack_handleAn id number returned by Xorriso_push_outlists() and not yet revoked by Xorriso_pull_outlists(). This handle is invalid after the call. Submit -1 to address the most recent valid id.
result_listResult and mark messages (usually directed to stdout)
info_listInfo and mark messages (usually directed to stderr)
flagunused yet, submit 0
Returns
1 on success, <=0 if failure

Definition at line 1309 of file text_io.c.

1312 {
1313  int i, ret, locked= 0;
1314 
1315  ret= Xorriso_lock_outlists(xorriso, 0);
1316  if(ret <= 0)
1317  goto ex;
1318  locked= 1;
1319 
1320  if(stack_handle == -1)
1321  stack_handle= xorriso->msglist_stackfill - 1;
1322  if(stack_handle < 0 || stack_handle >= xorriso->msglist_stackfill) {
1323  Xorriso_unlock_outlists(xorriso, 0);
1324  locked= 0;
1325  Xorriso_msgs_submit(xorriso, 0,
1326  "Program error: Wrong message output redirection stack handle",
1327  0, "FATAL", 0);
1328  ret= -1; goto ex;
1329  }
1330 
1331  /* Concatenate all redirections above stack_handle */
1332  *result_list= NULL;
1333  *info_list= NULL;
1334  for(i = stack_handle; i < xorriso->msglist_stackfill; i++) {
1335  if(*result_list == NULL)
1336  *result_list= xorriso->result_msglists[i];
1337  else
1338  Xorriso_lst_concat(*result_list, xorriso->result_msglists[i], 0);
1339  if(*info_list == NULL)
1340  *info_list= xorriso->info_msglists[i];
1341  else
1342  Xorriso_lst_concat(*info_list, xorriso->info_msglists[i], 0);
1343  }
1344  xorriso->msglist_stackfill= stack_handle;
1345 
1346  ret= 1;
1347 ex:;
1348  if(locked)
1349  Xorriso_unlock_outlists(xorriso, 0);
1350  return(ret);
1351 }
int Xorriso_lst_concat(struct Xorriso_lsT *first, struct Xorriso_lsT *second, int flag)
Definition: aux_objects.c:659

References XorrisO::info_msglists, XorrisO::msglist_stackfill, XorrisO::result_msglists, Xorriso_lock_outlists(), Xorriso_lst_concat(), Xorriso_msgs_submit(), and Xorriso_unlock_outlists().

Referenced by Xorriso_interpreter(), Xorriso_start_msg_watcher(), Xorriso_stop_msg_watcher(), and Xorriso_toc_to_string().

◆ Xorriso_push_outlists()

int Xorriso_push_outlists ( struct XorrisO xorriso,
int *  stack_handle,
int  flag 
)

Enable a new redirection of info and/or result channel.

The normal message output and eventual older redirections will not see new messages until the redirection is ended by a call to Xorriso_pull_outlists() with the stack_handle value returned by this call. If Xorriso_option_pkt_output() is set to "on", then it will consolidate output in the result_list of Xorriso_fetch_outlists() and Xorriso_pull_outlists().

Parameters
xorrisoThe environment handle
stack_handlereturns an id number which is unique as long as its redirection is stacked. Do not interpret it and do not use it after its redirection was pulled from the stack.
flagBitfield for control purposes bit0= redirect result channel bit1= redirect info channel If bit0 and bit1 are 0, both channels get redirected.
Returns
1 on success, <=0 if failure

Definition at line 1174 of file text_io.c.

1176 {
1177  int ret, locked= 0;
1178 
1179  ret= Xorriso_lock_outlists(xorriso, 0);
1180  if(ret <= 0)
1181  goto ex;
1182  locked= 1;
1183  if(xorriso->msglist_stackfill + 1 >= Xorriso_max_outlist_stacK) {
1184  Xorriso_unlock_outlists(xorriso, 0);
1185  locked= 0;
1186  Xorriso_msgs_submit(xorriso, 0,
1187  "Overflow of message output redirection stack", 0, "FATAL", 0);
1188  ret= -1; goto ex;
1189  }
1190  if((flag & 3) == 0)
1191  flag|= 3;
1192  xorriso->msglist_stackfill++;
1193  xorriso->result_msglists[xorriso->msglist_stackfill - 1]= NULL;
1194  xorriso->info_msglists[xorriso->msglist_stackfill - 1]= NULL;
1195  xorriso->msglist_flags[xorriso->msglist_stackfill - 1]= flag & 3;
1196  *stack_handle= xorriso->msglist_stackfill - 1;
1197  ret= 1;
1198 ex:;
1199  if(locked)
1200  Xorriso_unlock_outlists(xorriso, 0);
1201  return(ret);
1202  return(1);
1203 }
int msglist_flags[Xorriso_max_outlist_stacK]
#define Xorriso_max_outlist_stacK
Maximum number of stacked redirections.
Definition: xorriso.h:998

References XorrisO::info_msglists, XorrisO::msglist_flags, XorrisO::msglist_stackfill, XorrisO::result_msglists, Xorriso_lock_outlists(), Xorriso_max_outlist_stacK, Xorriso_msgs_submit(), and Xorriso_unlock_outlists().

Referenced by Xorriso_interpreter(), Xorriso_start_msg_watcher(), and Xorriso_toc_to_string().

◆ Xorriso_read_lines()

int Xorriso_read_lines ( struct XorrisO xorriso,
FILE *  fp,
int *  linecount,
int *  argc,
char ***  argv,
int  flag 
)

Definition at line 644 of file text_io.c.

646 {
647  char *line= NULL, *linept, *fgot;
648  int l, base_length, append_line, ret, mem_linecount, i;
649 
650  Sfile_make_argv("", line, argc, argv, 2);
651  if(flag & 2)
652  {ret= 1; goto ex;}
653 
654  Xorriso_alloc_meM(line, char, 5 * SfileadrL + 2);
655 
656  mem_linecount= *linecount;
657  linept= line;
658  base_length= 0;
659  while(1) {
660  fgot= Sfile_fgets_n(linept, SfileadrL - base_length - 1, fp,
661  !!(flag & (1 | 8)));
662  if(fgot == NULL) {
663  if(ferror(fp))
664  {ret= 0; goto ex;}
665  if(linept != line) {
666  sprintf(xorriso->info_text,"Open quotation mark at end of input");
667  Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);
668  {ret= 0; goto ex;}
669  }
670  {ret= 2; goto ex;}
671  }
672  l= strlen(line);
673  (*linecount)++;
674  append_line= 0;
675  if(flag & 1) { /* check whether the line is incomplete yet */
676  ret= Sfile_make_argv("", line, argc, argv, 16);
677  if(ret < 0)
678  goto ex;
679  if(ret == 0 && !append_line) {
680  line[l]= '\n';
681  line[l + 1]= 0;
682  append_line= 1;
683  }
684  if(l > 0 && !append_line)
685  if(line[l - 1] == '\\') {
686  line[l - 1]= 0;
687  append_line= 1;
688  }
689  }
690  if(l >= SfileadrL) {
691  sprintf(xorriso->info_text,"Input line too long !");
692  Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);
693  {ret= 0; goto ex;}
694  }
695  if(!append_line)
696  break;
697  base_length= strlen(line);
698  linept= line + base_length;
699  }
700  if((flag & 1) && !(flag & 8)) {
701  ret= Sfile_make_argv("", line, argc, argv,
702  1 | ((xorriso->bsl_interpretation & 3) << 5));
703  if(ret < 0)
704  goto ex;
705  if(flag & 4)
706  for(i= 0; i < *argc; i++) {
707  if((*argv)[i][0] == 0) {
708  sprintf(xorriso->info_text, "Empty text as quoted argument in ");
709  } else if(strlen((*argv)[i]) >= SfileadrL) {
710  (*argv)[i][SfileadrL - 1]= 0;
711  sprintf(xorriso->info_text,
712  "Input text too long and now truncated in");
713  } else
714  continue;
715  if(mem_linecount + 1 < *linecount)
716  sprintf(xorriso->info_text + strlen(xorriso->info_text),
717  "lines %d to %d", mem_linecount + 1, *linecount);
718  else
719  sprintf(xorriso->info_text + strlen(xorriso->info_text),
720  "line %d", mem_linecount + 1);
721  Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "WARNING", 0);
722  }
723  } else {
724  (*argv)= Smem_malloC(sizeof(char *));
725  if(*argv == NULL)
726  {ret= -1; goto ex;}
727  (*argv)[0]= strdup(line);
728  if((*argv)[0] == NULL) {
729  free(*argv);
730  (*argv)= NULL;
731  {ret= -1; goto ex;}
732  }
733  *argc= 1;
734  }
735  ret= 1;
736 ex:;
737  Xorriso_free_meM(line);
738  return(ret);
739 }
#define Smem_malloC
Definition: sfile.h:16

References XorrisO::bsl_interpretation, XorrisO::info_text, Sfile_fgets_n(), Sfile_make_argv(), SfileadrL, Smem_malloC, Xorriso_alloc_meM, Xorriso_free_meM, and Xorriso_msgs_submit().

Referenced by Xorriso_genisofs_hide_list(), Xorriso_option_not_list(), Xorriso_option_options_from_file(), and Xorriso_option_path_list().

◆ Xorriso_reassure()

int Xorriso_reassure ( struct XorrisO xorriso,
char *  cmd,
char *  which_will,
int  flag 
)
Returns
-1= abort , 0= no , 1= yes

Definition at line 2609 of file text_io.c.

2611 {
2612  int ret;
2613 
2614  if(!xorriso->do_reassure)
2615  return(1);
2616  sprintf(xorriso->info_text, "Really perform %s which will %s ? (y/n)\n",
2617  cmd, which_will);
2618  Xorriso_info(xorriso, 4);
2619  do {
2620  ret= Xorriso_request_confirmation(xorriso, 2|4|16);
2621  } while(ret==3);
2622  if(ret==6 || ret==4) {
2623  sprintf(xorriso->info_text, "%s confirmed", cmd);
2624  Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "NOTE", 0);
2625  return(1);
2626  }
2627  if(ret==2) {
2628  sprintf(xorriso->info_text, "%s aborted", cmd);
2629  Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "NOTE", 0);
2630  return(-1);
2631  }
2632  sprintf(xorriso->info_text, "%s revoked", cmd);
2633  Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "NOTE", 0);
2634  return(0);
2635 }

References XorrisO::do_reassure, XorrisO::info_text, Xorriso_info(), Xorriso_msgs_submit(), and Xorriso_request_confirmation().

Referenced by Xorriso_option_blank(), Xorriso_option_close_damaged(), Xorriso_option_commit(), Xorriso_option_dev(), Xorriso_option_devices(), Xorriso_option_end(), Xorriso_option_load(), Xorriso_option_rollback(), and Xorriso_truncate_overwritable().

◆ Xorriso_release_lock()

static int Xorriso_release_lock ( struct XorrisO xorriso,
pthread_mutex_t *  lock_handle,
char *  purpose,
int  flag 
)
static

Definition at line 842 of file text_io.c.

845 {
846  int ret;
847  static int complaints= 0, complaint_limit= 5;
848 
849  ret= pthread_mutex_unlock(lock_handle);
850  if(ret != 0) {
851  if(flag & 1)
852  return(0);
853  /* Cannot report failure through the failing message output system */
854  complaints++;
855  if(complaints <= complaint_limit)
856  fprintf(stderr,
857  "xorriso : pthread_mutex_unlock() for %s returns %d\n",
858  purpose, ret);
859  return(0);
860  }
861  return(1);
862 }

Referenced by Xorriso_msg_watcher(), Xorriso_peek_outlists(), Xorriso_stop_msg_watcher(), and Xorriso_unlock_outlists().

◆ Xorriso_report_md5_outcome()

int Xorriso_report_md5_outcome ( struct XorrisO xorriso,
char *  severity,
int  flag 
)

Definition at line 4118 of file text_io.c.

4120 {
4121  int has_md5;
4122 
4123  has_md5= Xorriso_image_has_md5(xorriso, 0);
4124  if(xorriso->find_check_md5_result & 1) {
4125  sprintf(xorriso->result_line,
4126  "Mismatch detected between file contents and MD5 checksums.\n");
4127  } else if(xorriso->find_check_md5_result & 8) {
4128  sprintf(xorriso->result_line,
4129  "File contents and their MD5 checksums match.\n");
4130  } else {
4131  sprintf(xorriso->result_line,
4132  "Not a single file with MD5 checksum was found.");
4133  if(has_md5 <= 0)
4134  strcat(xorriso->result_line,
4135  " (There is no MD5 checksum array loaded.)\n");
4136  else
4137  strcat(xorriso->result_line, "\n");
4138  }
4139  Xorriso_result(xorriso,0);
4140  if(xorriso->find_check_md5_result & 2) {
4141  sprintf(xorriso->result_line,
4142  "Encountered errors other than non-match during MD5 checking.\n");
4143  Xorriso_result(xorriso,0);
4144  }
4145  if((xorriso->find_check_md5_result & 4) && has_md5) {
4146  sprintf(xorriso->result_line,
4147  "There were data files which have no MD5 and thus could not be checked.\n");
4148  Xorriso_result(xorriso,0);
4149  }
4150  if((xorriso->find_check_md5_result & 3) && strcmp(severity, "ALL") != 0) {
4151  sprintf(xorriso->info_text, "Event triggered by MD5 comparison mismatch");
4152  Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, severity, 0);
4153  }
4154  return(1);
4155 }
int Xorriso_image_has_md5(struct XorrisO *xorriso, int flag)
Definition: iso_img.c:220
int find_check_md5_result

References XorrisO::find_check_md5_result, XorrisO::info_text, XorrisO::result_line, Xorriso_image_has_md5(), Xorriso_msgs_submit(), and Xorriso_result().

Referenced by Xorriso_option_check_md5(), and Xorriso_option_find().

◆ Xorriso_request_confirmation()

int Xorriso_request_confirmation ( struct XorrisO xorriso,
int  flag 
)

Definition at line 493 of file text_io.c.

510 {
511  int ret;
512  char *line= NULL, *cpt, *previous_line= NULL;
513  char *abort_req_text,*abort_really_text;
514 
515  Xorriso_alloc_meM(line, char, SfileadrL);
516  Xorriso_alloc_meM(previous_line, char, SfileadrL);
517 
518  if(!xorriso->dialog) {
519  if(flag&16)
520  {ret= 6; goto ex;}
521  {ret= 1; goto ex;}
522  }
523  if(flag&8) {
524  abort_req_text= "request to end";
525  abort_really_text= "done reading";
526  } else {
527  abort_req_text= "request to abort";
528  abort_really_text= "abort this command";
529  }
530  ret= Xorriso_dialog_input(xorriso,line, SfileadrL, 1);
531  xorriso->result_line_counter= 0;
532  xorriso->result_page_counter++;
533  if(ret<=0)
534  if(xorriso->result_page_length>0)
535  xorriso->result_page_length= -xorriso->result_page_length;
536 
537  cpt= line;
538  if(strcmp(cpt,"@@@")==0 ||
539  strcmp(cpt,"x")==0 || strcmp(cpt,"X")==0 ||
540  strcmp(cpt,"q")==0 || strcmp(cpt,"Q")==0) {
541  if(flag&1) {
542  strcpy(previous_line,cpt);
543  sprintf(xorriso->info_text,
544  "... [%s = %s registered. Really %s ? (y/n) ] ...\n",
545  cpt,abort_req_text,abort_really_text);
546  Xorriso_info(xorriso,0);
547  ret= Xorriso_dialog_input(xorriso,line, SfileadrL, 1);
548  if(ret<=0)
549  goto ex;
550  cpt= line;
551  if(strcmp(cpt,previous_line)==0 ||
552  ((*cpt=='Y' || *cpt=='y' || *cpt=='j' || *cpt=='J' || *cpt=='1') &&
553  *(cpt+1)==0)) {
554  xorriso->request_to_abort= 1;
555  sprintf(xorriso->info_text,
556  "------- ( %s confirmed )\n",abort_req_text);
557  Xorriso_info(xorriso,0);
558  {ret= 2; goto ex;}
559  }
560  sprintf(xorriso->info_text, "....... ( %s revoked )\n",abort_req_text);
561  Xorriso_info(xorriso,0);
562  {ret= 3; goto ex;}
563  }
564  xorriso->request_to_abort= 1;
565  sprintf(xorriso->info_text,
566 "----------- [%s = request to abort registered. Operation ends ] ------------\n",
567  cpt);
568  Xorriso_info(xorriso,0);
569  {ret= 2; goto ex;}
570  } else if(*cpt=='@') {
571  if(strcmp(cpt,"@@")==0) {
572  goto klammer_affe;
573 
574  } else if(strcmp(cpt,"@")==0) {
575 klammer_affe:;
576  if(xorriso->result_page_length>0)
577  xorriso->result_page_length= -xorriso->result_page_length;
578  if(flag&1) {
579  sprintf(xorriso->info_text,
580 "... [@ = prompt suppression registered. Prompting disabled temporarily ] ...\n");
581  Xorriso_info(xorriso,0);
582  }
583 
584  } else {
585  Xorriso_dialog_input(xorriso,cpt,strlen(line)+1,2); /* write to history */
586  sprintf(xorriso->info_text,
587  "--- Unrecognized input beginning with @. Please enter something else.\n");
588  Xorriso_info(xorriso,0);
589  {ret= 3; goto ex;}
590  }
591  if(flag&2)
592  {ret= 4; goto ex;}
593  if(flag&1)
594  {ret= 3; goto ex;}
595  {ret= 1; goto ex;}
596  } else if(flag&4) {
597 
598  if(strcmp(cpt,"i")==0 || strcmp(cpt,"I")==0 ||
599  strcmp(cpt,"n")==0 || strcmp(cpt,"N")==0 ||
600  *cpt==0) {
601  {ret= 1; goto ex;}
602  } else if(strcmp(cpt,"r")==0 || strcmp(cpt,"R")==0 ||
603  strcmp(cpt,"y")==0 || strcmp(cpt,"Y")==0) {
604  {ret= 6; goto ex;}
605  } else {
606  /* >>> unknown input */
607  sprintf(xorriso->info_text,
608  "--- Please enter one of : empty line, i,n, r,y, q,x, @, @@@\n");
609  Xorriso_info(xorriso,0);
610  {ret= 3; goto ex;}
611  }
612 
613  } else if(*cpt!=0 && !(flag&1)) {
614  Xorriso_dialog_input(xorriso,cpt,strlen(line)+1,2); /* write to history */
615  strcpy(xorriso->pending_option,cpt);
616  xorriso->request_to_abort= 1;
617  sprintf(xorriso->info_text,
618 "-------------- [ Input of option registered. Operation ends ] ---------------\n");
619  Xorriso_info(xorriso,0);
620  {ret= 2; goto ex;}
621 
622  } else if(*cpt!=0) {
623  Xorriso_dialog_input(xorriso,cpt,strlen(line)+1,2); /* write to history */
624  sprintf(xorriso->info_text,
625  "--- Please enter one of : empty line, @, @@@\n");
626  Xorriso_info(xorriso,0);
627  {ret= 3; goto ex;}
628  }
629  ret= 1;
630 ex:;
631  Xorriso_free_meM(line);
632  Xorriso_free_meM(previous_line);
633  return(ret);
634 }
int result_page_counter
char pending_option[4096]

References XorrisO::dialog, XorrisO::info_text, XorrisO::pending_option, XorrisO::request_to_abort, XorrisO::result_line_counter, XorrisO::result_page_counter, XorrisO::result_page_length, SfileadrL, Xorriso_alloc_meM, Xorriso_dialog_input(), Xorriso_free_meM, and Xorriso_info().

Referenced by Xorriso_pager(), Xorriso_reassure(), Xorriso_reassure_restore(), and Xorriso_rmi().

◆ Xorriso_reset_counters()

int Xorriso_reset_counters ( struct XorrisO xorriso,
int  flag 
)

Definition at line 4065 of file text_io.c.

4066 {
4067  xorriso->error_count= 0;
4068  xorriso->insert_count= 0;
4069  xorriso->insert_bytes= 0;
4070  Xorriso_pacifier_reset(xorriso, 0);
4071  return(1);
4072 }
double insert_bytes
double error_count
double insert_count
int Xorriso_pacifier_reset(struct XorrisO *xorriso, int flag)
Definition: text_io.c:3937

References XorrisO::error_count, XorrisO::insert_bytes, XorrisO::insert_count, and Xorriso_pacifier_reset().

Referenced by Xorriso_execute_option(), and Xorriso_option_options_from_file().

◆ Xorriso_restxt()

int Xorriso_restxt ( struct XorrisO xorriso,
char *  text 
)

Definition at line 2423 of file text_io.c.

2424 {
2425  int ret;
2426 
2427  strncpy(xorriso->result_line,text,sizeof(xorriso->result_line)-1);
2428  xorriso->result_line[sizeof(xorriso->result_line)-1]= 0;
2429  ret= Xorriso_result(xorriso,0);
2430  return(ret);
2431 }

References XorrisO::result_line, Xorriso_lsT::text, and Xorriso_result().

Referenced by Xorriso_option_help().

◆ Xorriso_result()

int Xorriso_result ( struct XorrisO xorriso,
int  flag 
)

Definition at line 2337 of file text_io.c.

2341 {
2342  int ret, redirected= 0;
2343 
2344  if(flag&1)
2345  goto put_it_out;
2346  if(xorriso->request_to_abort)
2347  return(1);
2348  if(xorriso->msglist_stackfill > 0)
2349  if(xorriso->msglist_flags[xorriso->msglist_stackfill - 1] & 1)
2350  redirected= 1;
2351  if(xorriso->result_page_length>0 && !redirected) {
2352  ret= Xorriso_pager(xorriso,xorriso->result_line,2);
2353  if(ret<=0)
2354  return(ret);
2355  if(ret==2)
2356  return(1);
2357  if(xorriso->request_to_abort)
2358  return(1);
2359  }
2360 put_it_out:;
2361  xorriso->bar_is_fresh= 0;
2362  ret= Xorriso_write_to_channel(xorriso, xorriso->result_line, 1,0);
2363  return(ret);
2364 }

References XorrisO::bar_is_fresh, XorrisO::msglist_flags, XorrisO::msglist_stackfill, XorrisO::request_to_abort, XorrisO::result_line, XorrisO::result_page_length, Xorriso_pager(), and Xorriso_write_to_channel().

Referenced by Xorriso_atip(), Xorriso_cdrskin(), Xorriso_check_md5(), Xorriso_check_session_md5(), Xorriso_cmd_sorting_rank(), Xorriso_compare_2_contents(), Xorriso_compare_2_files(), Xorriso_exec_args_sorted(), Xorriso_findi_action(), Xorriso_findi_headline(), Xorriso_findx_action(), Xorriso_getfacl(), Xorriso_getfattr(), Xorriso_getfname(), Xorriso_gpt_crc(), Xorriso_list_extattr(), Xorriso_list_extras(), Xorriso_list_extras_result(), Xorriso_list_formats(), Xorriso_list_profiles(), Xorriso_list_speeds_sub(), Xorriso_ls(), Xorriso_ls_filev(), Xorriso_lsx_filev(), Xorriso_mark(), Xorriso_mount(), Xorriso_msg_op_parse(), Xorriso_option_boot_image(), Xorriso_option_cdi(), Xorriso_option_cdx(), Xorriso_option_changes_pending(), Xorriso_option_check_md5(), Xorriso_option_check_media(), Xorriso_option_compare(), Xorriso_option_find(), Xorriso_option_help(), Xorriso_option_msg_op(), Xorriso_option_print(), Xorriso_option_print_size(), Xorriso_option_prompt(), Xorriso_option_pwdi(), Xorriso_option_pwdx(), Xorriso_option_tell_media_space(), Xorriso_option_toc(), Xorriso_option_version(), Xorriso_process_errfile(), Xorriso_pvd_info(), Xorriso_report_damage(), Xorriso_report_lba(), Xorriso_report_lib_versions(), Xorriso_report_lines(), Xorriso_report_md5_outcome(), Xorriso_report_pvd_time(), Xorriso_report_system_area(), Xorriso_restxt(), Xorriso_show_devices(), Xorriso_show_du_subs(), Xorriso_show_dux_subs(), Xorriso_show_stream(), Xorriso_status_result(), Xorriso_test_outchar(), and Xorriso_toc_line().

◆ Xorriso_result_handler_pkt()

int Xorriso_result_handler_pkt ( void *  handle,
char *  text 
)

Definition at line 1378 of file text_io.c.

1379 {
1380  int nl= -1, ret, l;
1381  struct XorrisO *xorriso;
1382 
1383  xorriso= (struct XorrisO *) handle;
1384 
1385  if(!xorriso->packet_output)
1386  return Xorriso_result_handler_stdout(handle, text);
1387 
1388  /* Interpret pkt_output */
1389  l= strlen(text);
1390  if(l >= 5) {
1391  if(strchr("RIM", text[0]) != NULL && text[1] == ':' &&
1392  strchr("01", text[2]) != NULL && text[3] == ':' && text[4] == ' ')
1393  nl= (text[2] == '1');
1394  }
1395  if(nl < 0) /* Not pkt_output format */
1396  return Xorriso_result_handler_stdout(handle, text);
1397 
1398  if(nl == 0) {
1399  /* Suppress newline */
1400  if(text[l - 1] == '\n')
1401  l--;
1402  }
1403 
1404  if(text[0] == 'R') {
1405  ret= fwrite(text + 5, l - 5, 1, stdout);
1406  } else {
1407  ret= fwrite(text + 5, l - 5, 1,
1408  xorriso->stderr_fp != NULL ? xorriso->stderr_fp : stderr);
1409  }
1410  if(ret <= 0)
1411  return(0);
1412  return(1);
1413 }
int Xorriso_result_handler_stdout(void *handle, char *text)
Definition: text_io.c:1370

References XorrisO::packet_output, XorrisO::stderr_fp, and Xorriso_result_handler_stdout().

Referenced by Xorriso_process_msg_lists().

◆ Xorriso_result_handler_stdout()

int Xorriso_result_handler_stdout ( void *  handle,
char *  text 
)

Definition at line 1370 of file text_io.c.

1371 {
1372  printf("%s", text);
1373  fflush(stdout);
1374  return(1);
1375 }

Referenced by Xorriso_result_handler_pkt().

◆ Xorriso_set_info_text()

int Xorriso_set_info_text ( struct XorrisO xorriso,
char *  text,
size_t  trunc_len,
int  flag 
)

Definition at line 4768 of file text_io.c.

4770 {
4771  size_t offst= 0, maxl;
4772 
4773  maxl= sizeof(xorriso->info_text) - 1;
4774  if(flag & 1)
4775  offst= strlen(xorriso->info_text);
4776  if(offst >= maxl)
4777  return(0);
4778  maxl-= offst;
4779  if(maxl > trunc_len)
4780  maxl= trunc_len;
4781  strncpy(xorriso->info_text + offst, text, maxl + 1);
4782  if(strlen(text) > maxl) {
4783  strcpy(xorriso->info_text + offst + maxl - 12, "#[truncated]");
4784  return(2);
4785  }
4786  return(1);
4787 }

References XorrisO::info_text, and Xorriso_lsT::text.

Referenced by Xorriso_option_setfacli().

◆ Xorriso_sieve_add_filter()

int Xorriso_sieve_add_filter ( struct XorrisO xorriso,
char *  name,
int  channels,
char *  prefix,
char *  separators,
int  num_words,
int *  word_idx,
int  max_results,
int  flag 
)

Add a filter rule to the message sieve.

Start watching output messages, if this is not already enabled.

Since
1.2.6
Parameters
xorrisoThe environment handle
nameThe filter name by which its recorded results shall be inquired via Xorriso_sieve_get_result()
channelsWhich of the output channels the filter shall watch bit0= result channel bit1= info channel bit2= mark channel
prefixThe line start to watch for. Will also be handed over to Xorriso_parse_line(). Empty text matches all lines. If the prefix begins by '?' characters, then these match any character at the beginning of a message. The prefix of the filter rule will then be adapted to really match the line, before it gets handed over to Xorriso_parse_line().
separatorsList of separator characters for Xorriso_parse_line()
num_wordsNumber of word indice in word_idx
word_idxArray with the argv indice to be picked from the the result of Xorriso_parse_line(). Must at least contain num_words elements.
max_resultsIf not 0, then the maximum number of line results that shall be recorded by the filter. When this number is exceeded, then results of older lines get discarded when new results get recorded.
flagBitfield for control purposes bit0= Last result word shall contain the remainder of the message line
Returns
<=0 error , >0 success

Definition at line 1851 of file text_io.c.

1855 {
1856  int ret;
1857  struct Xorriso_msg_sievE *sieve= NULL;
1858  struct Xorriso_msg_filteR *filter;
1859 
1860  if(xorriso->msg_sieve == NULL) {
1861  ret= Xorriso_msg_sieve_new(&sieve, 0);
1862  if(ret <= 0)
1863  goto no_mem;
1864  xorriso->msg_sieve= sieve;
1865  } else
1866  sieve= xorriso->msg_sieve;
1867  ret= Xorriso_msg_filter_new(&filter, name, NULL, sieve->first_filter,
1868  flag & 1);
1869  if(ret <= 0)
1870  goto no_mem;
1871  sieve->first_filter= filter;
1873  if(ret <= 0)
1874  goto no_mem;
1875  if(prefix != NULL)
1876  filter->prefix= strdup(prefix);
1877  if(separators != NULL)
1878  filter->separators= strdup(separators);
1879  filter->channels= channels;
1880  filter->max_results= max_results;
1881  (sieve->num_filters)++;
1882  return(1);
1883 
1884 no_mem:;
1885  Xorriso_msg_sieve_destroy(&sieve, 0);
1886  Xorriso_no_malloc_memory(xorriso, NULL, 0);
1887  return(-1);
1888 }
struct Xorriso_msg_sievE * msg_sieve
int Xorriso_msg_sieve_new(struct Xorriso_msg_sievE **o, int flag)
Definition: text_io.c:1819
int Xorriso_no_malloc_memory(struct XorrisO *xorriso, char **to_free, int flag)
Definition: text_io.c:4077
int Xorriso_msg_filter_new(struct Xorriso_msg_filteR **o, char *name, struct Xorriso_msg_filteR *prev, struct Xorriso_msg_filteR *next, int flag)
Definition: text_io.c:1722
int Xorriso_msg_filter_set_words(struct Xorriso_msg_filteR *m, int num_words, int *word_idx, int flag)
Definition: text_io.c:1790
int Xorriso_msg_sieve_destroy(struct Xorriso_msg_sievE **o, int flag)
Definition: text_io.c:1832

References Xorriso_msg_filteR::channels, Xorriso_msg_sievE::first_filter, Xorriso_msg_filteR::max_results, XorrisO::msg_sieve, Xorriso_msg_filteR::name, Xorriso_msg_sievE::num_filters, Xorriso_msg_filteR::num_words, Xorriso_msg_filteR::prefix, Xorriso_msg_filteR::separators, Xorriso_msg_filteR::word_idx, Xorriso_msg_filter_new(), Xorriso_msg_filter_set_words(), Xorriso_msg_sieve_destroy(), Xorriso_msg_sieve_new(), and Xorriso_no_malloc_memory().

Referenced by Xorriso_sieve_big().

◆ Xorriso_sieve_big()

int Xorriso_sieve_big ( struct XorrisO xorriso,
int  flag 
)

Install a large sieve with filters for about any interesting message of xorriso.

The filter rule names are mostly the same as the prefixes they search for. If you do not find the message prefix of your desire, then you may add a filter rule by Xorriso_sieve_add_filter(). If you do not want all these filter any more, call Xorriso_sieve_dispose().

You should obtain your recorded data often and then call Xorriso_sieve_clear_results(). It is nevertheless ok to perform several different xorriso information commands and to then obtain results from the sieve.

The installed filters in particular:

Name Recorded values, returned by Xorriso_sieve_get_result()

"-changes_pending" up to 1 result from -changes_pending show_status argv[0]= "yes" or "no" "? -dev" up to 10 results from -devices or -device_links (records drives with single digit index number) argv[0]= drive address argv[1]= permissions argv[2]= drive vendor argv[3]= product id "?? -dev" up to 90 results from -devices or -device_links (records drives with double digit index number) argv[0]= drive address argv[1]= permissions argv[2]= drive vendor argv[3]= product id "Abstract File:" up to 1 result from -pvd_info argv[0]= file name (Note: prefix is "Abstract File: ") "After commit :" up to 1 result from -tell_media_space argv[0]= number of blocks with "s" appended "App Id :" up to 1 result from -pvd_info argv[0]= id (Note: prefix is "App Id : ") "Biblio File :" up to 1 result from -pvd_info argv[0]= file name (Note: prefix is "Biblio File : ") "Build timestamp :" up to 1 result from -version argv[0]= timestamp (Note: prefix is "Build timestamp : ") "CopyrightFile:" up to 1 result from -pvd_info argv[0]= file name (Note: prefix is "CopyrightFile: ") "Creation Time:" up to 1 result from -pvd_info argv[0]= YYYYMMDDhhmmsscc (Note: prefix is "Creation Time: ") "DVD obs 64 kB:" up to 1 result from -list_extras argv[0]= "yes" or "no" "Drive access: " up to 2 result from -dev, -indev, -toc argv[0]= "exclusive", "shared" argv[1]= "readonly","restricted" "Drive current:" up to 2 results from -dev, -indev, -toc, others argv[0]= command ("-dev", "-outdev", "-indev") argv[1]= drive address "Drive type :" up to 2 results from -toc argv[0]= vendor argv[1]= product argv[2]= revision "Eff. Time :" up to 1 result from -pvd_info argv[0]= YYYYMMDDhhmmsscc (Note: prefix is "EffectiveTime: ") "Expir. Time :" up to 1 result from -pvd_info argv[0]= YYYYMMDDhhmmsscc (Note: prefix is "Expir. Time : ") "Ext. filters :" up to 1 result from -list_extras argv[0]= "yes" or "no" , possibly more info (Note: prefix is "Ext. filters : ") "File damaged :" up to 10000 results from -find ... -exec report_damage argv[0]= damage start byte in file argv[1]= damage range size in file argv[2]= file size argv[3]= path in ISO image "File data lba:" up to 10000 results from -find ... -exec report_lba argv[0]= extent number (all extents of same path together are the content of one file) argv[1]= start block number of extent argv[2]= number of blocks of extent argv[3]= overall file content size in all extents argv[4]= path in ISO image "Format idx :" up to 100 results from -list_formats argv[0]= index argv[1]= MMC code argv[2]= number of blocks with "s" appended argv[3]= roughly the size in MiB (Note: prefix is "Format idx ") "Format status:" up to 1 result from -list_formats argv[0]= status argv[1]= capacity "ISO session :" up to 10000 results from -toc argv[0]= Idx argv[1]= sbsector argv[2]= Size argv[3]= Volume Id "Image size :" up to 1 result from -print_size argv[0]= number of blocks with "s" appended "Jigdo files :" up to 1 result from -list_extras argv[0]= "yes" or "no" "Local ACL :" up to 1 result from -list_extras argv[0]= "yes" or "no" "Local xattr :" up to 1 result from -list_extras argv[0]= "yes" or "no" "MD5 MISMATCH:" up to 10000 results from -check_md5* argv[0]= path of mismatching file "MD5 tag range:" up to 10000 results from -check_media argv[0]= lba argv[1]= size in blocks argv[2]= result text (starting with "+", "-", or "0") "Media blocks :" up to 2 results from -toc argv[0]= readable argv[1]= writable argv[2]= overall "Media current:" up to 2 results from -dev, -indev, -toc, others argv[0]= media type / MMC profile name (Note: prefix is "Media current: " which eats extra blank) "Media nwa :" up to 1 result from -toc argv[0]= next writable address "Media product:" up to 2 results from -toc argv[0]= product id argv[1]= manufacturer "Media region :" up to 10000 results from -check_media argv[0]= lba argv[1]= size in blocks argv[2]= quality text (starting with "+", "-", or "0") "Media space :" up to 1 result from -tell_media_space argv[0]= number of blocks with "s" appended "Media status :" up to 2 results from -dev, -indev, -toc, others argv[0]= status description (Note: prefix is "Media status : ") "Media summary:" up to 2 results from -dev, -indev, -toc, others argv[0]= sessions argv[1]= data blocks (full count) argv[2]= data (with unit letter k,m,g) argv[3]= free (with unit letter k,m,g) "Modif. Time :" up to 1 result from -pvd_info argv[0]= YYYYMMDDhhmmsscc (Note: prefix is "Modif. Time : ") "PVD address :" up to 1 result from -pvd_info argv[0]= block address with "s" appended "Preparer Id :" up to 1 result from -pvd_info argv[0]= id (Note: prefix is "Preparer Id : ") "Profile :" up to 256 results from -list_profiles argv[0]= MMC code argv[1]= profile name in round brackets possibly appended: " (current)" "Publisher Id :" up to 1 result from -pvd_info argv[0]= id (Note: prefix is "Publisher Id : ") "Readline :" up to 1 result from -list_extras argv[0]= "yes" or "no" "Size lower :" up to 1 result from -findx ... -exec estimate_size argv[0]= size with appended "s" "Size upper :" up to 1 result from -findx ... -exec estimate_size argv[0]= size with appended "s" "System Id :" up to 1 result from -pvd_info argv[0]= id (Note: prefix is "System Id : ") "Version timestamp :" up to 1 result from -version argv[0]= timestamp "Volume Id :" up to 1 result from -pvd_info argv[0]= id (Note: Not output from -dev or -toc but from -pvd_info) "Volume Set Id:" up to 1 result from -pvd_info argv[0]= id (Note: prefix is "Volume Set Id: ") "Volume id :" up to 2 results from -dev, -indev, -toc, others argv[0]= volume id (Note: Not output from -pvd_info but from -dev or -toc) "Write speed :" up to 100 results from -list_speeds argv[0]= kilobytes per second argv[1]= speed factor "Write speed H:" up to 1 result from -list_speeds see "Write speed :" "Write speed L:" up to 1 result from -list_speeds see "Write speed :" "Write speed h:" up to 1 result from -list_speeds see "Write speed :" "Write speed l:" up to 1 result from -list_speeds see "Write speed :" "libburn in use :" up to 1 result from -version argv[0]= version text argv[1]= minimum version requirement "libburn OS adapter:" up to 1 result from -version argv[0]= adapter description (Note: prefix is "libburn OS adapter: ") "libisoburn in use :" up to 1 result from -version argv[0]= version text argv[1]= minimum version requirement "libisofs in use :" up to 1 result from -version argv[0]= version text argv[1]= minimum version requirement "libjte in use :" up to 1 result from -version argv[0]= version text argv[1]= minimum version requirement "xorriso version :" up to 1 result from -version argv[0]= version text "zisofs :" up to 1 result from -list_extras

argv[0]= "yes" or "no"

Since
1.2.6
Parameters
xorrisoThe environment handle
flagUnused yet. Submit 0.
Returns
<=0 error , >0 success

Definition at line 2026 of file text_io.c.

2027 {
2028  struct Xorriso_sieve_big_filteR {
2029  char *name;
2030  int channels;
2031  char *prefix;
2032  char *separators;
2033  int num_words;
2034  int word_idx[6];
2035  int max_results;
2036  int flag;
2037  };
2038  static struct Xorriso_sieve_big_filteR filters[] = {
2039  {"-changes_pending", 3, "-changes_pending", "", 1,
2040  { 0, -1, -1, -1, -1, -1}, 1, 0},
2041  {"? -dev", 3, "? -dev", "", 4, { 0, 1, 3, 4, -1, -1},
2042  10, 0},
2043  {"?? -dev", 3, "?? -dev", "", 4, { 0, 1, 3, 4, -1, -1},
2044  90, 0},
2045  {"Abstract File:", 3, "Abstract File: ", "", 1, { 0, -1, -1, -1, -1, -1},
2046  1, 1},
2047  {"After commit :", 3, "After commit :", "", 1, { 0, -1, -1, -1, -1, -1},
2048  1, 0},
2049  {"App Id :", 3, "App Id : ", "", 1, { 0, -1, -1, -1, -1, -1},
2050  1, 1},
2051  {"Biblio File :", 3, "Biblio File : ", "", 1, { 0, -1, -1, -1, -1, -1},
2052  1, 1},
2053  {"Build timestamp :", 3, "Build timestamp : ", "", 1,
2054  { 0, -1, -1, -1, -1, -1}, 1, 1},
2055  {"CopyrightFile:", 3, "CopyrightFile: ", "", 1, { 0, -1, -1, -1, -1, -1},
2056  1, 1},
2057  {"Creation Time:", 3, "Creation Time: ", "", 1, { 0, -1, -1, -1, -1, -1},
2058  1, 1},
2059  {"DVD obs 64 kB:", 3, "DVD obs 64 kB:", "", 1, { 0, -1, -1, -1, -1, -1},
2060  1, 0},
2061  {"Drive access :", 3, "Drive access : ", ": ", 2, { 0, 1, -1, -1, -1, -1},
2062  2, 0},
2063  {"Drive current:", 3, "Drive current:", "", 2, { 0, 1, -1, -1, -1, -1},
2064  2, 0},
2065  {"Drive id :", 3, "Drive id :", "", 1, { 0, -1, -1, -1, -1, -1},
2066  2, 0},
2067  {"Drive type :", 3, "Drive type :", "", 3, { 1, 3, 5, -1, -1, -1},
2068  2, 0},
2069  {"Eff. Time :", 3, "Eff. Time : ", "", 1, { 0, -1, -1, -1, -1, -1},
2070  1, 1},
2071  {"Expir. Time :", 3, "Expir. Time : ", "", 1, { 0, -1, -1, -1, -1, -1},
2072  1, 1},
2073  {"Ext. filters :", 3, "Ext. filters : ", "", 1, { 0, -1, -1, -1, -1, -1},
2074  1, 1},
2075  {"File damaged :", 3, "File damaged :", "", 4, { 0, 2, 4, 6, -1, -1},
2076  10000, 0},
2077  {"File data lba:", 3, "File data lba:", "", 5, { 0, 2, 4, 6, 8, -1},
2078  10000, 0},
2079  {"Format idx :", 3, "Format idx ", ",: ", 4, { 0, 1, 2, 3, -1, -1},
2080  100, 1},
2081  {"Format status:", 3, "Format status:", ", ", 2, { 0, 1, -1, -1, -1, -1},
2082  1, 1},
2083  {"ISO session :", 3, "ISO session :", "", 4, { 0, 2, 4, 6, -1, -1},
2084  10000, 1},
2085  {"Image size :", 3, "Image size :", "", 1, { 0, -1, -1, -1, -1, -1},
2086  1, 0},
2087  {"Jigdo files :", 3, "Jigdo files :", "", 1, { 0, -1, -1, -1, -1, -1},
2088  1, 0},
2089  {"Local ACL :", 3, "Local ACL :", "", 1, { 0, -1, -1, -1, -1, -1},
2090  1, 0},
2091  {"Local xattr :", 3, "Local xattr :", "", 1, { 0, -1, -1, -1, -1, -1},
2092  1, 0},
2093  {"MD5 MISMATCH:", 3, "MD5 MISMATCH:", "", 1, { 0, -1, -1, -1, -1, -1},
2094  10000, 0},
2095  {"MD5 tag range:", 3, "MD5 tag range:", "", 3, { 0, 2, 4, -1, -1, -1},
2096  10000, 1},
2097  {"Media blocks :", 3, "Media blocks :", "", 3, { 0, 3, 6, -1, -1, -1},
2098  2, 0},
2099  {"Media current:", 3, "Media current: ", "", 1, { 0, -1, -1, -1, -1, -1},
2100  2, 1},
2101  {"Media id :", 3, "Media id :", "", 1, { 0, -1, -1, -1, -1, -1},
2102  2, 0},
2103  {"Media nwa :", 3, "Media nwa :", "", 1, { 0, -1, -1, -1, -1, -1},
2104  1, 0},
2105  {"Media product:", 3, "Media product:", "", 2, { 0, 2, -1, -1, -1, -1},
2106  2, 1},
2107  {"Media region :", 3, "Media region :", "", 3, { 0, 2, 4, -1, -1, -1},
2108  10000, 1},
2109  {"Media space :", 3, "Media space :", "", 1, { 0, -1, -1, -1, -1, -1},
2110  1, 0},
2111  {"Media status :", 3, "Media status : ", "", 1, { 0, -1, -1, -1, -1, -1},
2112  2, 1},
2113  {"Media summary:", 3, "Media summary:", "", 4, { 0, 2, 5, 7, -1, -1},
2114  2, 0},
2115  {"Modif. Time :", 3, "Modif. Time : ", "", 1, { 0, -1, -1, -1, -1, -1},
2116  1, 1},
2117  {"PVD address :", 3, "PVD address :", "", 1, { 0, -1, -1, -1, -1, -1},
2118  1, 0},
2119  {"Preparer Id :", 3, "Preparer Id : ", "", 1, { 0, -1, -1, -1, -1, -1},
2120  1, 1},
2121  {"Profile :", 3, "Profile :", "", 2, { 0, 1, -1, -1, -1, -1},
2122  256, 1},
2123  {"Publisher Id :", 3, "Publisher Id : ", "", 1, { 0, -1, -1, -1, -1, -1},
2124  1, 1},
2125  {"Readline :", 3, "Readline :", "", 1, { 0, -1, -1, -1, -1, -1},
2126  1, 0},
2127  {"Size lower :", 3, "Size lower :", "", 1, { 0, -1, -1, -1, -1, -1},
2128  1, 0},
2129  {"Size upper :", 3, "Size upper :", "", 1, { 0, -1, -1, -1, -1, -1},
2130  1, 0},
2131  {"System Id :", 3, "System Id : ", "", 1, { 0, -1, -1, -1, -1, -1},
2132  1, 1},
2133  {"Version timestamp :", 3, "Version timestamp :", "", 1,
2134  { 0, -1, -1, -1, -1, -1}, 1, 0},
2135  {"Volume Id :", 3, "Volume Id : ", "", 1, { 0, -1, -1, -1, -1, -1},
2136  1, 1},
2137  {"Volume Set Id:", 3, "Volume Set Id: ", "", 1, { 0, -1, -1, -1, -1, -1},
2138  1, 1},
2139  {"Volume id :", 3, "Volume id :", "", 1, { 0, -1, -1, -1, -1, -1},
2140  2, 0},
2141  {"Write speed :", 3, "Write speed :", "", 2, { 0, 2, -1, -1, -1, -1},
2142  100, 0},
2143  {"Write speed H:", 3, "Write speed H:", "", 2, { 0, 2, -1, -1, -1, -1},
2144  1, 0},
2145  {"Write speed L:", 3, "Write speed L:", "", 2, { 0, 2, -1, -1, -1, -1},
2146  1, 0},
2147  {"Write speed h:", 3, "Write speed h:", "", 2, { 0, 2, -1, -1, -1, -1},
2148  1, 0},
2149  {"Write speed l:", 3, "Write speed l:", "", 2, { 0, 2, -1, -1, -1, -1},
2150  1, 0},
2151  {"libburn in use :", 3, "libburn in use :", "", 2,
2152  { 0, 1, -1, -1, -1, -1}, 1, 1},
2153  {"libburn OS adapter:", 3, "libburn OS adapter: ", "", 1,
2154  { 0, -1, -1, -1, -1, -1}, 1, 1},
2155  {"libisoburn in use :", 3, "libisoburn in use :", "", 2,
2156  { 0, 1, -1, -1, -1, -1}, 1, 1},
2157  {"libisofs in use :", 3, "libisofs in use :", "", 2,
2158  { 0, 1, -1, -1, -1, -1}, 1, 1},
2159  {"libjte in use :", 3, "libjte in use :", "", 2,
2160  { 0, 1, -1, -1, -1, -1}, 1, 1},
2161  {"xorriso version :", 3, "xorriso version :", "", 1,
2162  { 0, -1, -1, -1, -1, -1}, 1, 0},
2163  {"zisofs :", 3, "zisofs :", "", 1, { 0, -1, -1, -1, -1, -1},
2164  1, 0},
2165  {"@", 0, "@", "", 0, {-1, -1, -1, -1, -1, -1}, 0, 0}
2166  };
2167 
2168  struct Xorriso_sieve_big_filteR *f;
2169  int ret, i;
2170 
2171  for(i= 0; ; i++) {
2172  f= &(filters[i]);
2173  if(strcmp(f->name, "@") == 0)
2174  break;
2175  ret= Xorriso_sieve_add_filter(xorriso, f->name, f->channels, f->prefix,
2176  f->separators, f->num_words, f->word_idx,
2177  f->max_results, f->flag);
2178  if(ret <= 0)
2179  goto failure;
2180  }
2181  return(1);
2182 failure:
2183  Xorriso_sieve_dispose(xorriso, 0);
2184  return(-1);
2185 }
int Xorriso_sieve_add_filter(struct XorrisO *xorriso, char *name, int channels, char *prefix, char *separators, int num_words, int *word_idx, int max_results, int flag)
Add a filter rule to the message sieve.
Definition: text_io.c:1851
int Xorriso_sieve_dispose(struct XorrisO *xorriso, int flag)
Dispose all filter rules.
Definition: text_io.c:1892

References Xorriso_sieve_add_filter(), and Xorriso_sieve_dispose().

Referenced by Xorriso_option_msg_op().

◆ Xorriso_sieve_clear_results()

int Xorriso_sieve_clear_results ( struct XorrisO xorriso,
int  flag 
)

Dispose all recorded results.

Keep filter rules. Continue watching and recording.

Since
1.2.6
Parameters
xorrisoThe environment handle
flagUnused yet. Submit 0.
Returns
<=0 error , >0 success

Definition at line 1900 of file text_io.c.

1901 {
1902  struct Xorriso_msg_filteR *f;
1903 
1904  if(xorriso->msg_sieve == NULL)
1905  return(1);
1906  for(f= xorriso->msg_sieve->first_filter; f != NULL; f= f->next) {
1907  f->num_results= 0;
1908  f->num_delivered= 0;
1909  if(f->results != NULL)
1910  Xorriso_lst_destroy_all(&(f->results), 0);
1911  f->next_to_deliver= NULL;
1912  }
1913  return(1);
1914 }

References Xorriso_msg_sievE::first_filter, XorrisO::msg_sieve, Xorriso_msg_filteR::next, Xorriso_msg_filteR::next_to_deliver, Xorriso_msg_filteR::num_delivered, Xorriso_msg_filteR::num_results, Xorriso_msg_filteR::results, and Xorriso_lst_destroy_all().

Referenced by Xorriso_option_msg_op().

◆ Xorriso_sieve_dispose()

int Xorriso_sieve_dispose ( struct XorrisO xorriso,
int  flag 
)

Dispose all filter rules.

End watching and recording. This is the default state at library startup.

Since
1.2.6
Parameters
xorrisoThe environment handle
flagUnused yet. Submit 0.
Returns
<=0 error , >0 success

Definition at line 1892 of file text_io.c.

1893 {
1894  Xorriso_msg_sieve_destroy(&(xorriso->msg_sieve), 0);
1895  return(1);
1896 }

References XorrisO::msg_sieve, and Xorriso_msg_sieve_destroy().

Referenced by Xorriso_destroy(), Xorriso_option_msg_op(), and Xorriso_sieve_big().

◆ Xorriso_sieve_filter_msg()

int Xorriso_sieve_filter_msg ( struct XorrisO xorriso,
char *  msg,
int  flag 
)

Definition at line 2197 of file text_io.c.

2198 {
2199  int channel, ret, argc= 0, i, max_words, l, widx, skip;
2200  char **argv= NULL, *prefix_storage= NULL, *prefix, *cpt, *to_parse= NULL;
2201  struct Xorriso_msg_filteR *f;
2202  struct Xorriso_lsT *lst, *prev_lst, *next_lst;
2203 
2204  if(xorriso->msg_sieve == NULL || xorriso->msg_sieve_disabled)
2205  return(1);
2206 
2207  channel= flag & 3;
2208 
2209  for(f= xorriso->msg_sieve->first_filter; f != NULL; f= f->next) {
2210  if(!(f->channels & (1 << channel)))
2211  continue;
2212  prefix= f->prefix;
2213 
2214  if(prefix[0] == '?') {
2215  skip= 0;
2216  for(cpt= prefix; *cpt; cpt++)
2217  if(*cpt == '?')
2218  skip++;
2219  else
2220  break;
2221  l= strlen(prefix);
2222  if(strlen(msg) >= (unsigned int) l) {
2223  if(l - skip == 0 || strncmp(prefix + skip, msg + skip, l - skip) == 0) {
2224  Xorriso_free_meM(prefix_storage);
2225  prefix_storage= NULL;
2226  Xorriso_alloc_meM(prefix_storage, char, l + 1);
2227  strncpy(prefix_storage, msg, l);
2228  prefix_storage[l]= 0;
2229  prefix= prefix_storage;
2230  }
2231  }
2232  }
2233  if(prefix[0])
2234  if(strncmp(prefix, msg, strlen(prefix)) != 0)
2235  continue;
2236 
2237  if (to_parse != NULL)
2238  free(to_parse);
2239  to_parse= strdup(msg);
2240  if(to_parse == NULL)
2241  goto no_mem;
2242  l= strlen(to_parse);
2243  if(l > 0)
2244  if(to_parse[l - 1] == '\n')
2245  to_parse[l - 1]= 0;
2246 
2247  max_words= 0;
2248  if(f->last_word_line_end)
2249  if(f->num_words > 0) /* Let last word take rest of line */
2250  max_words= f->word_idx[f->num_words - 1];
2251  if(max_words <= 0 && f->last_word_line_end) {
2252  /* Copy rest of line as single word because Xorriso_parse_line understands
2253  max_words == 0 as unlimited number of words. But here it is desired
2254  to get the rest of line already in argv[0].
2255  */
2256  max_words= 0;
2257  argv= calloc(1, sizeof(char *));
2258  if(argv == NULL)
2259  goto no_mem;
2260  argc= 1;
2261  argv[0]= strdup(to_parse + strlen(prefix));
2262  if(argv[0] == NULL)
2263  goto no_mem;
2264  ret= 1;
2265  } else {
2266  ret= Xorriso_parse_line(xorriso, to_parse, prefix, f->separators,
2267  max_words, &argc, &argv, 0);
2268  }
2269  if(ret < 0)
2270  goto ex;
2271  if(ret == 0)
2272  continue;
2273 
2274  if(f->last_word_line_end && argc > max_words) {
2275  l= strlen(argv[max_words]);
2276  if(l > 0)
2277  if(argv[max_words][l - 1] == '\n')
2278  argv[max_words][l - 1]= 0;
2279  }
2280 
2281  if(f->max_results > 0 && f->num_results >= f->max_results) {
2282  /* Dispose surplus results */
2283  for(i= 0; i < f->num_words; i++) {
2284  if(f->results != NULL) {
2285  next_lst= f->results->next;
2286  Xorriso_lst_destroy(&(f->results), 0);
2287  f->results= next_lst;
2288  }
2289  }
2290  if(f->num_delivered > 0)
2291  (f->num_delivered)--;
2292  if(f->num_delivered == 0)
2293  f->next_to_deliver= NULL;
2294  f->num_results--;
2295  }
2296 
2297  if(f->results == NULL) {
2298  prev_lst= NULL;
2299  } else {
2300  for(prev_lst= f->results; prev_lst->next != NULL;
2301  prev_lst= prev_lst->next);
2302  }
2303  for(i= 0; i < f->num_words; i++) {
2304  widx= f->word_idx[i];
2305  if(widx >= argc || widx < 0)
2306  ret= Xorriso_lst_new(&lst, "", prev_lst, 0);
2307  else if(argv[widx] == NULL)
2308  ret= Xorriso_lst_new(&lst, "", prev_lst, 0);
2309  else
2310  ret= Xorriso_lst_new(&lst, argv[widx], prev_lst, 0);
2311  if(ret <= 0)
2312  goto no_mem;
2313  if(prev_lst == NULL)
2314  f->results= lst;
2315  prev_lst= lst;
2316  }
2317  (f->num_results)++;
2318  Xorriso__dispose_words(&argc, &argv);
2319  }
2320  ret= 1;
2321 ex:
2322  if(to_parse != NULL)
2323  free(to_parse);
2324  Xorriso_free_meM(prefix_storage);
2325  Xorriso__dispose_words(&argc, &argv);
2326  return(ret);
2327 no_mem:;
2328  Xorriso_no_malloc_memory(xorriso, NULL, 1); /* reports to stderr */
2329  ret= -1;
2330  goto ex;
2331 }

References Xorriso_msg_filteR::channels, Xorriso_msg_sievE::first_filter, Xorriso_msg_filteR::last_word_line_end, Xorriso_msg_filteR::max_results, XorrisO::msg_sieve, XorrisO::msg_sieve_disabled, Xorriso_lsT::next, Xorriso_msg_filteR::next, Xorriso_msg_filteR::next_to_deliver, Xorriso_msg_filteR::num_delivered, Xorriso_msg_filteR::num_results, Xorriso_msg_filteR::num_words, Xorriso_msg_filteR::prefix, Xorriso_msg_filteR::results, Xorriso_msg_filteR::separators, Xorriso_msg_filteR::word_idx, Xorriso__dispose_words(), Xorriso_alloc_meM, Xorriso_free_meM, Xorriso_lst_destroy(), Xorriso_lst_new(), Xorriso_no_malloc_memory(), and Xorriso_parse_line().

Referenced by Xorriso_write_to_channel().

◆ Xorriso_sieve_get_result()

int Xorriso_sieve_get_result ( struct XorrisO xorriso,
char *  name,
int *  argc,
char ***  argv,
int *  available,
int  flag 
)

Inquire recorded results from a particular filter rule.

Parameters
xorrisoThe environment handle
nameThe filter name as given by Xorriso_sieve_add_filter()
argcWill return the number of allocated and filled word strings.
argvWill return the array of word strings. Do not forget to dispose the allocated memory by a call to Xorriso__dispose_words().
availableWill return the number of results which are still available for further calls of Xorriso_sieve_get_result() with the given name.
flagBitfield for control purposes: bit0= Reset reading to first matching result. bit1= Only inquire number of available results. Do not allocate memory. bit2= If *argv is not NULL, then free it before attaching new memory. bit3= Do not read recorded data but rather list all filter names.
Returns
<0 error: -1 = memory shortage -2 = no filter rule found 0 No more data available for the given name With bit3: No filter rules installed. >0 argc and argv are valid

Definition at line 1925 of file text_io.c.

1927 {
1928  struct Xorriso_msg_filteR *f;
1929  struct Xorriso_lsT *lst;
1930  int i;
1931 
1932  if(flag & 4)
1933  Xorriso__dispose_words(argc, argv);
1934  *argc= 0;
1935  *argv= NULL;
1936 
1937  if(xorriso->msg_sieve == NULL)
1938  return(0);
1939 
1940  if(flag & 8) {
1941  if(xorriso->msg_sieve->num_filters <= 0)
1942  return(0);
1943  *argv= calloc(xorriso->msg_sieve->num_filters, sizeof(char *));
1944  if(*argv == NULL)
1945  goto no_mem;
1946  *argc= xorriso->msg_sieve->num_filters;
1947  for(i= 0; i < *argc; i++)
1948  (*argv)[i]= NULL;
1949  i= 0;
1950  for(f= xorriso->msg_sieve->first_filter; f != NULL; f= f->next) {
1951  (*argv)[*argc - i - 1]= strdup(f->name);
1952  if((*argv)[*argc - i - 1] == NULL)
1953  goto no_mem;
1954  i++;
1955  }
1956  *argc= i;
1957  return(1);
1958  }
1959 
1960  for(f= xorriso->msg_sieve->first_filter; f != NULL; f= f->next) {
1961  if(strcmp(f->name, name) != 0)
1962  continue;
1963  *available= f->num_results - f->num_delivered;
1964  if(*available <= 0)
1965  return(0);
1966  if(flag & 2)
1967  return(1);
1968 
1969  if(flag & 1) {
1970  f->num_delivered= 0;
1971  f->next_to_deliver= NULL;
1972  }
1973  if(f->next_to_deliver == NULL) {
1974  f->next_to_deliver= f->results;
1975  for(i= 0; i < f->num_words * f->num_delivered; i++)
1976  if(f->next_to_deliver != NULL)
1978  }
1979  if(f->next_to_deliver == NULL) {
1980  /* Should not happen */
1981  goto unexpected_null;
1982  }
1983  if(f->num_words <= 0)
1984  return(1);
1985 
1986  *argv= calloc(f->num_words, sizeof(char *));
1987  if(*argv == NULL)
1988  goto no_mem;
1989  *argc= f->num_words;
1990  for(i= 0; i < *argc; i++)
1991  (*argv)[i]= NULL;
1992 
1993  lst= f->next_to_deliver;
1994  for(i= 0; i < *argc; i++) {
1995  if(lst != NULL) {
1996  (*argv)[i]= strdup(Xorriso_lst_get_text(lst, 0));
1997  if((*argv)[i] == NULL)
1998  goto no_mem;
1999  } else {
2000  /* should not happen */
2001 unexpected_null:;
2002  Xorriso_msgs_submit(xorriso, 0,
2003  "Program error: Unexpected NULL pointer in message sieve.",
2004  0, "WARNING", 0);
2005  if(*argv != NULL)
2006  Xorriso__dispose_words(argc, argv);
2007  *available= 0;
2008  return(-2);
2009  }
2010  lst= Xorriso_lst_get_next(lst, 0);
2011  }
2012  f->next_to_deliver= lst;
2013  (f->num_delivered)++;
2014  (*available)--;
2015  return(1);
2016  }
2017  return(-2);
2018 no_mem:
2019  if(*argv != NULL)
2020  Xorriso__dispose_words(argc, argv);
2021  Xorriso_no_malloc_memory(xorriso, NULL, 0);
2022  return(-1);
2023 }

References Xorriso_msg_sievE::first_filter, XorrisO::msg_sieve, Xorriso_msg_filteR::name, Xorriso_msg_filteR::next, Xorriso_msg_filteR::next_to_deliver, Xorriso_msg_filteR::num_delivered, Xorriso_msg_sievE::num_filters, Xorriso_msg_filteR::num_results, Xorriso_msg_filteR::num_words, Xorriso_msg_filteR::results, Xorriso__dispose_words(), Xorriso_lst_get_next(), Xorriso_lst_get_text(), Xorriso_msgs_submit(), and Xorriso_no_malloc_memory().

Referenced by Xorriso_option_msg_op().

◆ Xorriso_start_msg_watcher()

int Xorriso_start_msg_watcher ( struct XorrisO xorriso,
int(*)(void *handle, char *text)  result_handler,
void *  result_handle,
int(*)(void *handle, char *text)  info_handler,
void *  info_handle,
int  flag 
)

Redirect output by Xorriso_push_outlists() and start a thread which fetches this output and performs a call of a given function with each message that is obtained.

Since
1.2.6
Parameters
xorrisoThe environment handle
result_handlerPointer to the function which shall be called with each result message. A NULL pointer causes output to be directed to stdout or to be interpreted as -pkt_output format if this is enabled by Xorriso_option_pkt_output(). The function should return 1. A return value of -1 urges not to call again with further lines.
result_handleThe first argument of (*result_handler)(). It shall point to a memory object that knows all necessary external parameters for running (*result_handler)(). Submit NULL if result_handler is NULL.
info_handlerPointer to the function which shall be called with each info message. A NULL pointer causes output to be directed to stderr or to -as mkisofs -log-file. The function should return 1. A return value of -1 urges not to call again with further lines.
info_handleThe first argument of (*info_handler)(). It shall point to a memory object that knows all necessary external parameters for running (*info_handler)(). Submit NULL if info_handler is NULL.
flagunused yet, submit 0
Returns
1 on success, <=0 if failure (e.g. there is already a watcher active)

Definition at line 1523 of file text_io.c.

1529 {
1530  int ret, u_wait= 1000, locked= 0, pushed= 0, uret, line_count= 0;
1531  struct Xorriso_lsT *result_list= NULL, *info_list= NULL;
1532  pthread_attr_t attr;
1533  pthread_attr_t *attr_pt = NULL;
1534  pthread_t thread;
1535 
1536  ret= pthread_mutex_lock(&(xorriso->msg_watcher_lock));
1537  if(ret != 0) {
1538  Xorriso_msgs_submit(xorriso, 0,
1539  "Cannot acquire mutex lock for managing concurrent message watcher",
1540  ret, "FATAL", 0);
1541  ret= -1; goto ex;
1542  }
1543  locked= 1;
1544 
1545  /* Check for running watcher */
1546  if(xorriso->msg_watcher_state > 0) {
1547  sprintf(xorriso->info_text,
1548  "There is already a concurrent message watcher running");
1549  Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, errno, "FAILURE", 0);
1550  ret= 0; goto ex;
1551  }
1552 
1553  ret= Xorriso_push_outlists(xorriso, &(xorriso->msgw_stack_handle), 3);
1554  if(ret <= 0)
1555  goto ex;
1556  pushed= 1;
1557 
1558  /* Register watcher */
1559  xorriso->msgw_result_handler= result_handler;
1560  xorriso->msgw_result_handle= result_handle;
1561  xorriso->msgw_info_handler= info_handler;
1562  xorriso->msgw_info_handle= info_handle;
1563  xorriso->msg_watcher_state= 1;
1564 
1565  /* Start thread */
1566  pthread_attr_init(&attr);
1567  pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
1568  attr_pt= &attr;
1569  ret= pthread_create(&thread, attr_pt, Xorriso_msg_watcher, xorriso);
1570  if(ret != 0) {
1571  sprintf(xorriso->info_text,
1572  "Cannot create thread for concurrent message watcher");
1573  Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, errno, "FAILURE", 0);
1574  ret= 0; goto ex;
1575  }
1576 
1577  /* Wait until watcher has indicated start */
1578  while(xorriso->msg_watcher_state == 1) {
1579 
1580  /* >>> have a timeout ? */;
1581 
1582  usleep(u_wait);
1583  }
1584 
1585  ret= 1;
1586 ex:;
1587  if(ret <= 0 && pushed) {
1588  uret= Xorriso_pull_outlists(xorriso, xorriso->msgw_stack_handle,
1589  &result_list, &info_list, 0);
1590  if(uret > 0) {
1591  xorriso->msgw_result_handler= NULL;
1592  xorriso->msgw_info_handler= NULL;
1593  Xorriso_process_msg_lists(xorriso, result_list, info_list,
1594  &line_count, 0);
1595  Xorriso_lst_destroy_all(&result_list, 0);
1596  Xorriso_lst_destroy_all(&info_list, 0);
1597  }
1598  }
1599  if(locked) {
1600  uret= pthread_mutex_unlock(&(xorriso->msg_watcher_lock));
1601  if(uret != 0) {
1602  Xorriso_msgs_submit(xorriso, 0,
1603  "Cannot release mutex lock for managing concurrent message watcher",
1604  uret, "FATAL", 0);
1605  ret= -1;
1606  }
1607  }
1608  return(ret);
1609 }
pthread_mutex_t msg_watcher_lock
int msgw_stack_handle
int Xorriso_push_outlists(struct XorrisO *xorriso, int *stack_handle, int flag)
Enable a new redirection of info and/or result channel.
Definition: text_io.c:1174
int Xorriso_pull_outlists(struct XorrisO *xorriso, int stack_handle, struct Xorriso_lsT **result_list, struct Xorriso_lsT **info_list, int flag)
Disable the redirection given by stack_handle.
Definition: text_io.c:1309
static void * Xorriso_msg_watcher(void *state_pt)
Definition: text_io.c:1454

References XorrisO::info_text, XorrisO::msg_watcher_lock, XorrisO::msg_watcher_state, XorrisO::msgw_info_handle, XorrisO::msgw_info_handler, XorrisO::msgw_result_handle, XorrisO::msgw_result_handler, XorrisO::msgw_stack_handle, Xorriso_lst_destroy_all(), Xorriso_msg_watcher(), Xorriso_msgs_submit(), Xorriso_process_msg_lists(), Xorriso_pull_outlists(), and Xorriso_push_outlists().

Referenced by Xorriso_interpreter().

◆ Xorriso_status()

int Xorriso_status ( struct XorrisO xorriso,
char *  filter,
FILE *  fp,
int  flag 
)

Definition at line 2764 of file text_io.c.

2773 {
2774  int is_default, no_defaults, i, ret, adr_mode, do_single, behavior;
2775  int show_indev= 1, show_outdev= 1, show_dev= 0;
2776  int do_drive_access, did_drive_access;
2777  int part_table_implicit= 0;
2778  char *line, *sfe= NULL, mode[80], *form, *treatment;
2779  char *in_pt, *out_pt, *nl_charset, *local_charset, *mode_pt;
2780  char *dev_filter= NULL, *xorriso_id= NULL;
2781  static char channel_prefixes[4][4]= {".","R","I","M"};
2782  static char load_names[][20]= {"auto", "session", "track", "lba", "volid"};
2783  static int max_load_mode= 4;
2784  static char scsi_family[8][8]=
2785  {"default", "sr", "scd", "st", "sg", "", "", ""};
2786  struct Xorriso_lsT *paths, *leafs, *s, *plst, *vlst;
2787 
2788  Xorriso_alloc_meM(sfe, char, 5 * SfileadrL + 80);
2789  Xorriso_alloc_meM(xorriso_id, char, 129);
2790 
2791  no_defaults= flag&1;
2792  line= xorriso->result_line;
2793 
2794  if(xorriso->no_rc) {
2795  sprintf(line,"-no_rc\n");
2796  Xorriso_status_result(xorriso,filter,fp,flag&2);
2797  }
2798 
2799  is_default= strcmp(xorriso->list_delimiter, "--") == 0;
2800  sprintf(line,"-list_delimiter %s\n", xorriso->list_delimiter);
2801  if(!(is_default && no_defaults))
2802  Xorriso_status_result(xorriso,filter,fp,flag&2);
2803 
2804  is_default= 0;
2805  if(xorriso->dialog == 2)
2806  sprintf(line,"-dialog on\n");
2807  else if(xorriso->dialog == 1)
2808  sprintf(line,"-dialog single_line\n");
2809  else {
2810  sprintf(line,"-dialog off\n");
2811  is_default= 1;
2812  }
2813  if(!(is_default && no_defaults))
2814  Xorriso_status_result(xorriso,filter,fp,flag&2);
2815 
2816  is_default= (xorriso->result_page_length==0 && xorriso->result_page_width==80);
2817  sprintf(line,"-page %d %d\n",
2818  (xorriso->result_page_length>=0?xorriso->result_page_length
2819  :-xorriso->result_page_length),
2820  xorriso->result_page_width);
2821  if(!(is_default && no_defaults))
2822  Xorriso_status_result(xorriso,filter,fp,flag&2);
2823 
2824  is_default= (xorriso->use_stdin==0);
2825  sprintf(line,"-use_readline %s\n", (xorriso->use_stdin?"off":"on"));
2826  if(!(is_default && no_defaults))
2827  Xorriso_status_result(xorriso,filter,fp,flag&2);
2828 
2829  is_default= (xorriso->sh_style_result == 0);
2830  sprintf(line, "-sh_style_result %s\n",
2831  xorriso->sh_style_result ? "on" : "off");
2832  if(!(is_default && no_defaults))
2833  Xorriso_status_result(xorriso,filter,fp,flag&2);
2834 
2835  is_default= (xorriso->bsl_interpretation == 0);
2836  strcpy(line, "-backslash_codes ");
2837  if(xorriso->bsl_interpretation == 0)
2838  strcat(line, "off");
2839  else if(xorriso->bsl_interpretation == (3 | 16 | 32 | 64))
2840  strcat(line, "on");
2841  else {
2842  if((xorriso->bsl_interpretation & 3) == 1)
2843  strcat(line, "in_double_quotes");
2844  else if((xorriso->bsl_interpretation & 3) == 2)
2845  strcat(line, "in_quotes");
2846  else if((xorriso->bsl_interpretation & 3) == 3)
2847  strcat(line, "with_quoted_input");
2848  if(xorriso->bsl_interpretation & 16) {
2849  if(strlen(line) > 17)
2850  strcat(line, ":");
2851  strcat(line, "with_program_arguments");
2852  }
2853  if((xorriso->bsl_interpretation & (32 | 64)) == (32 | 64)) {
2854  if(strlen(line) > 17)
2855  strcat(line, ":");
2856  strcat(line, "encode_output");
2857  } else {
2858  if(xorriso->bsl_interpretation & 32) {
2859  if(strlen(line) > 17)
2860  strcat(line, ":");
2861  strcat(line, "encode_results");
2862  }
2863  if(xorriso->bsl_interpretation & 64) {
2864  if(strlen(line) > 17)
2865  strcat(line, ":");
2866  strcat(line, "encode_infos");
2867  }
2868  }
2869  }
2870  strcat(line, "\n");
2871  if(!(is_default && no_defaults))
2872  Xorriso_status_result(xorriso,filter,fp,flag&2);
2873 
2874  is_default= !xorriso->packet_output;
2875  sprintf(line,"-pkt_output %s\n",(xorriso->packet_output?"on":"off"));
2876  if(!(is_default && no_defaults))
2877  Xorriso_status_result(xorriso,filter,fp,flag&2);
2878 
2879  for(i=0;i<4;i++) {
2880  is_default= (xorriso->logfile[i][0] == 0);
2881  sprintf(line,"-logfile %s %s\n",
2882  channel_prefixes[i],Text_shellsafe(xorriso->logfile[i],sfe,0));
2883  if(!(is_default && no_defaults))
2884  Xorriso_status_result(xorriso,filter,fp,flag&2);
2885  }
2886 
2887  is_default= (xorriso->errfile_log[0]==0);
2888  sprintf(line,"-errfile_log %s\n",Text_shellsafe(xorriso->errfile_log,sfe,0));
2889  if(!(is_default && no_defaults))
2890  Xorriso_status_result(xorriso,filter,fp,flag&2);
2891 
2892  if(xorriso->check_media_default == NULL) {
2893  is_default= 1;
2894  sprintf(line, "-check_media_defaults reset=now %s\n",
2895  xorriso->list_delimiter);
2896  } else {
2897  ret= Xorriso_check_media_list_job(xorriso, xorriso->check_media_default,
2898  line, no_defaults);
2899  is_default= (ret == 2);
2900  strcat(line, "\n");
2901  }
2902  if(!(is_default && no_defaults))
2903  Xorriso_status_result(xorriso,filter,fp,flag&2);
2904 
2905  behavior= Xorriso__get_signal_behavior(0);
2906  is_default= (behavior == 1);
2907  treatment= "on";
2908  if(behavior == 0)
2909  treatment= "off";
2910  else if(behavior == 2)
2911  treatment= "sig_dfl";
2912  else if(behavior == 3)
2913  treatment= "sig_ign";
2914  sprintf(line,"-signal_handling %s\n", treatment);
2915  if(!(is_default && no_defaults))
2916  Xorriso_status_result(xorriso,filter,fp,flag&2);
2917 
2918  is_default= (xorriso->img_read_error_mode==2);
2919  treatment= "best_effort";
2920  if(xorriso->img_read_error_mode==1)
2921  treatment= "failure";
2922  else if(xorriso->img_read_error_mode==2)
2923  treatment= "fatal";
2924  sprintf(line,"-error_behavior image_loading %s\n", treatment);
2925  if(!(is_default && no_defaults))
2926  Xorriso_status_result(xorriso,filter,fp,flag&2);
2927  is_default= (xorriso->extract_error_mode == 1);
2928  treatment= "keep";
2929  if(xorriso->extract_error_mode == 0)
2930  treatment= "best_effort";
2931  else if(xorriso->extract_error_mode == 2)
2932  treatment= "delete";
2933  sprintf(line,"-error_behavior file_extraction %s\n", treatment);
2934  if(!(is_default && no_defaults))
2935  Xorriso_status_result(xorriso,filter,fp,flag&2);
2936 
2937  is_default= (xorriso->mark_text[0]==0);
2938  sprintf(line,"-mark %s\n",Text_shellsafe(xorriso->mark_text,sfe,0));
2939  if(!(is_default && no_defaults))
2940  Xorriso_status_result(xorriso,filter,fp,flag&2);
2941 
2942  is_default= (xorriso->temp_mem_limit==16*1024*1024);
2943  if((xorriso->temp_mem_limit/1024/1024)*1024*1024==xorriso->temp_mem_limit)
2944  sprintf(line,"-temp_mem_limit %dm\n", xorriso->temp_mem_limit/1024/1024);
2945  else
2946  sprintf(line,"-temp_mem_limit %dk\n", xorriso->temp_mem_limit/1024);
2947  if(!(is_default && no_defaults))
2948  Xorriso_status_result(xorriso,filter,fp,flag&2);
2949 
2950 
2951  sprintf(line,"-prog %s\n",Text_shellsafe(xorriso->progname,sfe,0));
2952  Xorriso_status_result(xorriso,filter,fp,flag&2);
2953 
2954  if(xorriso->ban_stdio_write) {
2955  sprintf(line,"-ban_stdio_write\n");
2956  Xorriso_status_result(xorriso,filter,fp,flag&2);
2957  }
2958 
2959  is_default= ((xorriso->early_stdio_test & 14) == 0);
2960  sprintf(line, "-early_stdio_test %s\n",
2961  xorriso->early_stdio_test & 6 ? xorriso->early_stdio_test & 8 ?
2962  "appendable_wo" : "on" : "off");
2963  if(!(is_default && no_defaults))
2964  Xorriso_status_result(xorriso,filter,fp,flag&2);
2965 
2966  is_default= ((xorriso->cache_default & 3) == 3);
2967  sprintf(line, "-data_cache_size ");
2968  if(xorriso->cache_default & 1)
2969  sprintf(line + strlen(line), "default ");
2970  else
2971  sprintf(line + strlen(line), "%d ", xorriso->cache_num_tiles);
2972  if(xorriso->cache_default & 2)
2973  sprintf(line + strlen(line), "default\n");
2974  else
2975  sprintf(line + strlen(line), "%d\n", xorriso->cache_tile_blocks);
2976  if(!(is_default && no_defaults))
2977  Xorriso_status_result(xorriso,filter,fp,flag&2);
2978 
2979  is_default= (xorriso->allow_restore==0 && xorriso->do_concat_split==1 &&
2980  xorriso->do_auto_chmod==0 && xorriso->drives_exclusive == 1);
2981  mode_pt= "off";
2982  if(xorriso->allow_restore == -2)
2983  mode_pt= "blocked";
2984  else if(xorriso->allow_restore == -1)
2985  mode_pt= "banned";
2986  else if(xorriso->allow_restore == 1)
2987  mode_pt= "on";
2988  else if(xorriso->allow_restore == 2)
2989  mode_pt= "device_files";
2990  if(xorriso->allow_restore == -1)
2991  sprintf(line,"-osirrox %s\n", mode_pt);
2992  else
2993  sprintf(line,"-osirrox %s:%s:%s:%s:%s\n", mode_pt,
2994  xorriso->do_concat_split ? "concat_split_on" : "concat_split_off",
2995  xorriso->do_auto_chmod ? "auto_chmod_on" : "auto_chmod_off",
2996  xorriso->do_restore_sort_lba ? "sort_lba_on" : "sort_lba_off",
2997  xorriso->drives_exclusive ? "o_excl_on" : "o_excl_off");
2998  if(!(is_default && no_defaults))
2999  Xorriso_status_result(xorriso,filter,fp,flag&2);
3000 
3001  is_default = ((xorriso->do_strict_acl & 1) == 0 &&
3002  (xorriso->do_md5 & (64 | 128)) == 0 &&
3003  xorriso->sparse_min_gap == 0);
3004  sprintf(line,"-osirrox %s:%s:sparse=",
3005  (xorriso->do_strict_acl & 1) ? "strict_acl_on" : "strict_acl_off",
3006  (xorriso->do_md5 & 64) ?
3007  (xorriso->do_md5 & 128) ? "check_md5_force" : "check_md5_on"
3008  : "check_md5_off");
3009  if(xorriso->sparse_min_gap <= 0)
3010  strcat(line, "off");
3011  else
3012  Sfile_off_t_text(line + strlen(line), xorriso->sparse_min_gap, 0);
3013  strcat(line, "\n");
3014  if(!(is_default && no_defaults))
3015  Xorriso_status_result(xorriso, filter, fp, flag & 2);
3016 
3017  is_default= (xorriso->mount_opts_flag == 0);
3018  sprintf(line,"-mount_opts %s\n",
3019  xorriso->mount_opts_flag & 1 ? "shared" : "exclusive");
3020  if(!(is_default && no_defaults))
3021  Xorriso_status_result(xorriso,filter,fp,flag&2);
3022 
3023  Xorriso_boot_image_status(xorriso, filter, fp, flag & 3);
3024 
3025  Xorriso_boot_status_sysarea(xorriso, filter, fp, flag & 3);
3026 
3027  is_default= (xorriso->partition_offset == 0);
3028  sprintf(line,"-boot_image any partition_offset=%lu\n",
3029  (unsigned long int) xorriso->partition_offset);
3030  if(!(is_default && no_defaults))
3031  Xorriso_status_result(xorriso,filter,fp,flag&2);
3032  is_default= (xorriso->partition_secs_per_head == 0);
3033  sprintf(line,"-boot_image any partition_sec_hd=%lu\n",
3034  (unsigned long int) xorriso->partition_secs_per_head);
3035  if(!(is_default && no_defaults))
3036  Xorriso_status_result(xorriso,filter,fp,flag&2);
3037  is_default= (xorriso->partition_heads_per_cyl == 0);
3038  sprintf(line,"-boot_image any partition_hd_cyl=%lu\n",
3039  (unsigned long int) xorriso->partition_heads_per_cyl);
3040  if(!(is_default && no_defaults))
3041  Xorriso_status_result(xorriso,filter,fp,flag&2);
3042 
3043  ret= (xorriso->system_area_options & 0x300) >> 8;
3044  is_default= (ret == 0);
3045  sprintf(line,"-boot_image any partition_cyl_align=%s\n",
3046  ret == 0 ? "auto" : ret == 1 ? "on" : ret == 3 ? "all" : "off");
3047  if(!(is_default && no_defaults))
3048  Xorriso_status_result(xorriso,filter,fp,flag&2);
3049 
3050  if((xorriso->system_area_disk_path[0] || !part_table_implicit) &&
3051  (xorriso->partition_offset == 0 || (xorriso->system_area_options & 2))) {
3052  is_default= ((xorriso->system_area_options & 3) == 0);
3053  sprintf(line,"-boot_image %s partition_table=%s\n",
3054  xorriso->system_area_options & 2 ? "isolinux" : "grub",
3055  xorriso->system_area_options & 3 ? "on" : "off");
3056  if(!(is_default && no_defaults))
3057  Xorriso_status_result(xorriso,filter,fp,flag&2);
3058  }
3059 
3060  is_default= ((xorriso->system_area_options & (1 << 15)) == 0);
3061  sprintf(line, "-boot_image any mbr_force_bootable=%s\n",
3062  (xorriso->system_area_options & (1 << 15)) ? "on" : "off");
3063  if(!(is_default && no_defaults))
3064  Xorriso_status_result(xorriso,filter,fp,flag&2);
3065 
3066  is_default= (xorriso->appended_as_gpt == 0 && xorriso->appended_as_apm == 0);
3067  if(is_default) {
3068  sprintf(line, "-boot_image any appended_part_as=mbr\n");
3069  if(!no_defaults)
3070  Xorriso_status_result(xorriso,filter,fp,flag&2);
3071  } else {
3072  if(xorriso->appended_as_gpt) {
3073  sprintf(line, "-boot_image any appended_part_as=gpt\n");
3074  Xorriso_status_result(xorriso,filter,fp,flag&2);
3075  }
3076  if(xorriso->appended_as_apm) {
3077  sprintf(line, "-boot_image any appended_part_as=apm\n");
3078  Xorriso_status_result(xorriso,filter,fp,flag&2);
3079  }
3080  }
3081 
3082  is_default= (xorriso->part_like_isohybrid == 0);
3083  sprintf(line, "-boot_image any part_like_isohybrid=%s\n",
3084  xorriso->part_like_isohybrid ? "on" : "off");
3085  if(!(is_default && no_defaults))
3086  Xorriso_status_result(xorriso,filter,fp,flag&2);
3087 
3088  is_default= (xorriso->iso_mbr_part_type == -1);
3089  sprintf(line, "-boot_image any iso_mbr_part_type=");
3090  if(xorriso->iso_mbr_part_flag & 1) {
3091  Xorriso__format_guid(xorriso->iso_gpt_type_guid, line + strlen(line), 0);
3092  strcat(line, "\n");
3093  } else if(xorriso->iso_mbr_part_type == -1) {
3094  sprintf(line + strlen(line), "default\n");
3095  } else {
3096  sprintf(line + strlen(line), "0x%-2.2x\n",
3097  (unsigned int) xorriso->iso_mbr_part_type);
3098  }
3099  if(!(is_default && no_defaults))
3100  Xorriso_status_result(xorriso,filter,fp,flag&2);
3101 
3102  is_default= (xorriso->gpt_guid_mode == 0);
3103  sprintf(line, "-boot_image any gpt_disk_guid=%s",
3104  xorriso->gpt_guid_mode == 0 ? "random" :
3105  xorriso->gpt_guid_mode == 2 ? "volume_date_uuid" : "");
3106  if(xorriso->gpt_guid_mode == 1)
3107  for(i= 0; i < 16; i++)
3108  sprintf(line + strlen(line), "%-2.2x",
3109  (unsigned int) xorriso->gpt_guid[i]);
3110  strcat(line, "\n");
3111  if(!(is_default && no_defaults))
3112  Xorriso_status_result(xorriso,filter,fp,flag&2);
3113 
3114  ret= ((xorriso->system_area_options & 0x3cfc) == 0x400);
3115  is_default= (ret == 0);
3116  sprintf(line, "-boot_image any chrp_boot_part=%s\n",
3117  ret == 1 ? "on" : "off");
3118  if(!(is_default && no_defaults))
3119  Xorriso_status_result(xorriso, filter, fp, flag & 2);
3120 
3121  is_default= (xorriso->prep_partition[0] == 0);
3122  sprintf(line,"-boot_image any prep_boot_part=%s\n",
3123  Text_shellsafe(xorriso->prep_partition, sfe, 0));
3124  if(!(is_default && no_defaults))
3125  Xorriso_status_result(xorriso, filter, fp, flag & 2);
3126 
3127  is_default= (xorriso->efi_boot_partition[0] == 0);
3128  sprintf(line,"-boot_image any efi_boot_part=%s\n",
3129  Text_shellsafe(xorriso->efi_boot_partition, sfe, 0));
3130  if(!(is_default && no_defaults))
3131  Xorriso_status_result(xorriso, filter, fp, flag & 2);
3132 
3133 #ifdef Xorriso_with_isohybriD
3134  if(strcmp(form, "isolinux") == 0) {
3135  static char modes[4][6]= {"off", "auto", "on", "force"};
3136  is_default= (xorriso->boot_image_isohybrid == 1);
3137  sprintf(line,"-boot_image isolinux isohybrid=%s\n",
3138  modes[xorriso->boot_image_isohybrid & 3]);
3139  if(!(is_default && no_defaults))
3140  Xorriso_status_result(xorriso,filter,fp,flag&2);
3141  }
3142 #endif /* Xorriso_with_isohybriD */
3143 
3144  is_default= 1;
3145  for(i= 0; i < 8; i++)
3146  if(xorriso->hfsp_serial_number[i])
3147  is_default= 0;
3148  sprintf(line, "-boot_image any hfsplus_serial=");
3149  for(i= 0; i < 8; i++)
3150  sprintf(line + strlen(line), "%-2.2X",
3151  (unsigned int) xorriso->hfsp_serial_number[i]);
3152  strcat(line, "\n");
3153  if(!(is_default && no_defaults))
3154  Xorriso_status_result(xorriso, filter, fp, flag & 2);
3155 
3156  is_default= (xorriso->hfsp_block_size == 0);
3157  sprintf(line, "-boot_image any hfsplus_block_size=%d\n",
3158  xorriso->hfsp_block_size);
3159  if(!(is_default && no_defaults))
3160  Xorriso_status_result(xorriso, filter, fp, flag & 2);
3161 
3162  is_default= (xorriso->apm_block_size == 0);
3163  sprintf(line, "-boot_image any apm_block_size=%d\n",
3164  xorriso->apm_block_size);
3165  if(!(is_default && no_defaults))
3166  Xorriso_status_result(xorriso, filter, fp, flag & 2);
3167 
3168  sprintf(line,"-cd ");
3169  if(filter != NULL)
3170  if(strncmp(filter, "-cdi", 4) == 0)
3171  sprintf(line,"-cdi ");
3172  sprintf(line + strlen(line),"%s\n",
3173  (xorriso->wdi[0] ? Text_shellsafe(xorriso->wdi,sfe,0) : "'/'"));
3174  Xorriso_status_result(xorriso,filter,fp,flag&2);
3175  sprintf(line,"-cdx %s\n",
3176  (xorriso->wdx[0] ? Text_shellsafe(xorriso->wdx,sfe,0) : "'/'"));
3177  Xorriso_status_result(xorriso,filter,fp,flag&2);
3178 
3179  is_default= (xorriso->split_size==0);
3180  strcpy(line,"-split_size ");
3181  if(xorriso->split_size % (1024*1024) || xorriso->split_size==0) {
3182  Sfile_off_t_text(line+strlen(line), xorriso->split_size, 0);
3183  } else {
3184  Sfile_off_t_text(line+strlen(line), xorriso->split_size / (1024*1024), 0);
3185  strcat(line, "m");
3186  }
3187  strcat(line, "\n");
3188  if(!(is_default && no_defaults))
3189  Xorriso_status_result(xorriso,filter,fp,flag&2);
3190 
3191  is_default= (xorriso->add_plainly==0);
3192  sprintf(line,"-add_plainly %s\n",
3193  (xorriso->add_plainly == 1 ? "unknown" :
3194  xorriso->add_plainly == 2 ? "dashed" :
3195  xorriso->add_plainly == 3 ? "any" : "none"));
3196  if(!(is_default && no_defaults))
3197  Xorriso_status_result(xorriso,filter,fp,flag&2);
3198 
3199  ret= Exclusions_get_descrs(xorriso->disk_exclusions, &paths, &leafs, 0);
3200  if(ret>0) {
3201  for(; paths!=NULL; paths= paths->next) {
3202  sprintf(line, "-not_paths %s %s\n",
3203  Text_shellsafe(paths->text, sfe, 0), xorriso->list_delimiter);
3204  Xorriso_status_result(xorriso,filter,fp,flag&2);
3205  }
3206  for(; leafs!=NULL; leafs= leafs->next) {
3207  sprintf(line,"-not_leaf %s\n", Text_shellsafe(leafs->text, sfe, 0));
3208  Xorriso_status_result(xorriso,filter,fp,flag&2);
3209  }
3210  }
3211 
3212  is_default= (xorriso->file_name_limit == 255);
3213  sprintf(line, "-file_name_limit %d\n", xorriso->file_name_limit);
3214  if(!(is_default && no_defaults))
3215  Xorriso_status_result(xorriso,filter,fp,flag&2);
3216 
3217  is_default= (xorriso->file_size_limit ==
3219  if(xorriso->file_size_limit <= 0)
3220  sprintf(line, "-file_size_limit off %s\n", xorriso->list_delimiter);
3221  else
3222  sprintf(line, "-file_size_limit %.f %s\n",
3223  (double) xorriso->file_size_limit, xorriso->list_delimiter);
3224  if(!(is_default && no_defaults))
3225  Xorriso_status_result(xorriso,filter,fp,flag&2);
3226 
3227  is_default= (xorriso->disk_excl_mode==1);
3228  sprintf(line, "-not_mgt %s:%s:%s:%s\n",
3229  (xorriso->disk_excl_mode&1 ? "on" : "off"),
3230  (xorriso->disk_excl_mode&2 ? "param_on" : "param_off"),
3231  (xorriso->disk_excl_mode&4 ? "subtree_on" : "subtree_off"),
3232  (xorriso->disk_excl_mode&8 ? "ignore_on" : "ignore_off"));
3233  if(!(is_default && no_defaults))
3234  Xorriso_status_result(xorriso,filter,fp,flag&2);
3235 
3236  is_default= (xorriso->do_override_now_time == 0);
3237  if(xorriso->do_override_now_time)
3238  sprintf(line, "-iso_nowtime =%.f\n", (double) xorriso->now_time_override);
3239  else
3240  sprintf(line, "-iso_nowtime dynamic\n");
3241  if(!(is_default && no_defaults))
3242  Xorriso_status_result(xorriso, filter, fp, flag & 2);
3243 
3244  is_default= (xorriso->do_iso_rr_pattern==1);
3245  sprintf(line,"-iso_rr_pattern %s\n",
3246  (xorriso->do_iso_rr_pattern == 1 ? "on" :
3247  (xorriso->do_iso_rr_pattern == 2 ? "ls" : "off")));
3248  if(!(is_default && no_defaults))
3249  Xorriso_status_result(xorriso,filter,fp,flag&2);
3250 
3251  is_default= (xorriso->do_disk_pattern==2);
3252  sprintf(line,"-disk_pattern %s\n",
3253  (xorriso->do_disk_pattern == 1 ? "on" :
3254  (xorriso->do_disk_pattern == 2 ? "ls" : "off")));
3255  if(!(is_default && no_defaults))
3256  Xorriso_status_result(xorriso,filter,fp,flag&2);
3257 
3258  is_default= xorriso->volid_default;
3259  sprintf(line,"-volid %s\n",Text_shellsafe(xorriso->volid,sfe,0));
3260  if(!(is_default && no_defaults))
3261  Xorriso_status_result(xorriso,filter,fp,flag&2);
3262  if(is_default && xorriso->loaded_volid[0] &&
3263  strcmp(xorriso->loaded_volid, xorriso->volid)!=0 && !no_defaults) {
3264  sprintf(line,"# loaded image effective -volid %s\n",
3265  Text_shellsafe(xorriso->loaded_volid,sfe,0));
3266  Xorriso_status_result(xorriso,filter,fp,flag&2);
3267  }
3268 
3269  Xorriso_preparer_string(xorriso, xorriso_id, 0);
3270  is_default= (strcmp(xorriso->preparer_id, xorriso_id) == 0);
3271  sprintf(line,"-preparer_id %s\n",Text_shellsafe(xorriso->preparer_id,sfe,0));
3272  if(!(is_default && no_defaults))
3273  Xorriso_status_result(xorriso,filter,fp,flag&2);
3274 
3275  is_default= (xorriso->publisher[0]==0);
3276  sprintf(line,"-publisher %s\n",Text_shellsafe(xorriso->publisher,sfe,0));
3277  if(!(is_default && no_defaults))
3278  Xorriso_status_result(xorriso,filter,fp,flag&2);
3279 
3280  is_default= (xorriso->application_id[0]==0);
3281  sprintf(line,"-application_id %s\n",
3282  Text_shellsafe(xorriso->application_id,sfe,0));
3283  if(!(is_default && no_defaults))
3284  Xorriso_status_result(xorriso,filter,fp,flag&2);
3285 
3286  is_default= (xorriso->system_id[0]==0);
3287  sprintf(line,"-system_id %s\n", Text_shellsafe(xorriso->system_id,sfe,0));
3288  if(!(is_default && no_defaults))
3289  Xorriso_status_result(xorriso,filter,fp,flag&2);
3290 
3291  is_default= (xorriso->volset_id[0]==0);
3292  sprintf(line,"-volset_id %s\n", Text_shellsafe(xorriso->volset_id,sfe,0));
3293  if(!(is_default && no_defaults))
3294  Xorriso_status_result(xorriso,filter,fp,flag&2);
3295 
3296  is_default= (xorriso->vol_creation_time == 0);
3297  sprintf(line,"-volume_date c %s\n",
3298  is_default ? "default" :
3299  Ftimetxt(xorriso->vol_creation_time, sfe, 2));
3300  if(!(is_default && no_defaults))
3301  Xorriso_status_result(xorriso,filter,fp,flag&2);
3302 
3303  is_default= (xorriso->vol_modification_time == 0);
3304  sprintf(line,"-volume_date m %s\n",
3305  xorriso->vol_uuid[0] ? "overridden" :
3306  is_default ? "default" :
3307  Ftimetxt(xorriso->vol_modification_time, sfe, 2));
3308  if(!(is_default && no_defaults))
3309  Xorriso_status_result(xorriso,filter,fp,flag&2);
3310 
3311  is_default= (xorriso->vol_expiration_time == 0);
3312  sprintf(line,"-volume_date x %s\n",
3313  is_default ? "default" :
3314  Ftimetxt(xorriso->vol_expiration_time, sfe, 2));
3315  if(!(is_default && no_defaults))
3316  Xorriso_status_result(xorriso,filter,fp,flag&2);
3317 
3318  is_default= (xorriso->vol_effective_time == 0);
3319  sprintf(line,"-volume_date f %s\n",
3320  is_default ? "default" :
3321  Ftimetxt(xorriso->vol_effective_time, sfe, 2));
3322  if(!(is_default && no_defaults))
3323  Xorriso_status_result(xorriso,filter,fp,flag&2);
3324 
3325  is_default= (xorriso->vol_uuid[0] == 0);
3326  sprintf(line,"-volume_date uuid %s\n",
3327  Text_shellsafe(xorriso->vol_uuid,sfe,0));
3328  if(!(is_default && no_defaults))
3329  Xorriso_status_result(xorriso,filter,fp,flag&2);
3330 
3331  is_default= (xorriso->all_file_dates[0] == 0);
3332  sprintf(line,"-volume_date all_file_dates %s\n",
3333  Text_shellsafe(xorriso->all_file_dates,sfe,0));
3334  if(!(is_default && no_defaults))
3335  Xorriso_status_result(xorriso,filter,fp,flag&2);
3336 
3337  is_default= (xorriso->copyright_file[0] == 0);
3338  sprintf(line,"-copyright_file %s\n",
3339  Text_shellsafe(xorriso->copyright_file,sfe,0));
3340  if(!(is_default && no_defaults))
3341  Xorriso_status_result(xorriso,filter,fp,flag&2);
3342 
3343  is_default= (xorriso->biblio_file[0]==0);
3344  sprintf(line,"-biblio_file %s\n",Text_shellsafe(xorriso->biblio_file,sfe,0));
3345  if(!(is_default && no_defaults))
3346  Xorriso_status_result(xorriso,filter,fp,flag&2);
3347 
3348  is_default= (xorriso->abstract_file[0]==0);
3349  sprintf(line,"-abstract_file %s\n",
3350  Text_shellsafe(xorriso->abstract_file,sfe,0));
3351  if(!(is_default && no_defaults))
3352  Xorriso_status_result(xorriso,filter,fp,flag&2);
3353 
3354  is_default= (strcmp(xorriso->application_use, " ") == 0);
3355  sprintf(line, "-application_use %s\n",
3356  Text_shellsafe(xorriso->application_use, sfe, 0));
3357  if(!(is_default && no_defaults))
3358  Xorriso_status_result(xorriso,filter,fp,flag&2);
3359 
3360  is_default= (xorriso->do_joliet==0);
3361  sprintf(line,"-joliet %s\n", (xorriso->do_joliet == 1 ? "on" : "off"));
3362  if(!(is_default && no_defaults))
3363  Xorriso_status_result(xorriso,filter,fp,flag&2);
3364 
3365  is_default= (xorriso->do_rockridge == 1);
3366  sprintf(line, "-rockridge %s\n", (xorriso->do_rockridge == 1 ? "on" : "off"));
3367  if(!(is_default && no_defaults))
3368  Xorriso_status_result(xorriso,filter,fp,flag&2);
3369 
3370  is_default= (xorriso->do_hfsplus == 0);
3371  sprintf(line,"-hfsplus %s\n", (xorriso->do_hfsplus == 1 ? "on" : "off"));
3372  if(!(is_default && no_defaults))
3373  Xorriso_status_result(xorriso,filter,fp,flag&2);
3374 
3375  Xorriso_lst_get_last(xorriso->jigdo_params, &plst, 0);
3376  Xorriso_lst_get_last(xorriso->jigdo_values, &vlst, 0);
3377  if(plst == NULL || vlst == NULL) {
3378  is_default= 1;
3379  sprintf(line,"-jigdo clear 'all'\n");
3380  if(!(is_default && no_defaults))
3381  Xorriso_status_result(xorriso, filter, fp, flag & 2);
3382  }
3383  while(plst != NULL && vlst != NULL) {
3384  sprintf(line,"-jigdo %s %s\n", Xorriso_lst_get_text(plst, 0),
3385  Text_shellsafe(Xorriso_lst_get_text(vlst, 0), sfe, 0));
3386  Xorriso_status_result(xorriso, filter, fp, flag & 2);
3387  plst= Xorriso_lst_get_prev(plst, 0);
3388  vlst= Xorriso_lst_get_prev(vlst, 0);
3389  }
3390 
3391  if(xorriso->do_global_uid) {
3392  sprintf(line,"-uid %lu\n", (unsigned long) xorriso->global_uid);
3393  Xorriso_status_result(xorriso,filter,fp,flag&2);
3394  }
3395 
3396  if(xorriso->do_global_gid) {
3397  sprintf(line,"-gid %lu\n", (unsigned long) xorriso->global_gid);
3398  Xorriso_status_result(xorriso,filter,fp,flag&2);
3399  }
3400 
3401  Xorriso_status_extf(xorriso, filter, fp, flag & 2);
3402  Xorriso_status_zisofs(xorriso, filter, fp, flag & 3);
3403 
3404  is_default= !xorriso->allow_graft_points;
3405  sprintf(line,"-pathspecs %s\n",
3406  (xorriso->allow_graft_points & 2) ? "as_mkisofs" :
3407  xorriso->allow_graft_points ? "on" : "off");
3408  if(!(is_default && no_defaults))
3409  Xorriso_status_result(xorriso,filter,fp,flag&2);
3410 
3411  is_default= (xorriso->do_follow_pattern && (!xorriso->do_follow_param)
3412  && xorriso->do_follow_mount && (!xorriso->do_follow_links)
3413  && xorriso->follow_link_limit==100
3414  && (!xorriso->do_follow_concat));
3415  mode[0]= 0;
3416  if(xorriso->do_follow_pattern &&
3417  !(xorriso->do_follow_links && xorriso->do_follow_mount))
3418  strcat(mode,":pattern");
3419  if(xorriso->do_follow_param && !(xorriso->do_follow_links))
3420  strcat(mode,":param");
3421  if(xorriso->do_follow_links)
3422  strcat(mode,":link");
3423  if(xorriso->do_follow_concat)
3424  strcat(mode,":concat");
3425  if(xorriso->do_follow_mount)
3426  strcat(mode,":mount");
3427  if(mode[0]==0)
3428  strcpy(mode, ":off");
3429  sprintf(mode+strlen(mode), ":limit=%d", xorriso->follow_link_limit);
3430  sprintf(line,"-follow %s\n", mode+1);
3431  if(!(is_default && no_defaults))
3432  Xorriso_status_result(xorriso,filter,fp,flag&2);
3433 
3434  is_default= (xorriso->do_overwrite==2);
3435  sprintf(line,"-overwrite %s\n",(xorriso->do_overwrite == 1 ? "on" :
3436  (xorriso->do_overwrite == 2 ? "nondir" : "off")));
3437  if(!(is_default && no_defaults))
3438  Xorriso_status_result(xorriso,filter,fp,flag&2);
3439 
3440  is_default= !xorriso->do_reassure;
3441  sprintf(line,"-reassure %s\n",(xorriso->do_reassure == 1 ? "on" :
3442  (xorriso->do_reassure == 2 ? "tree" : "off")));
3443  if(!(is_default && no_defaults))
3444  Xorriso_status_result(xorriso,filter,fp,flag&2);
3445 
3446  is_default= (xorriso->read_speed == -2);
3447  sprintf(line,"-read_speed %s\n", Xorriso__speedname(xorriso->read_speed));
3448  if(!(is_default && no_defaults))
3449  Xorriso_status_result(xorriso,filter,fp,flag&2);
3450  is_default= (xorriso->read_speed_force <= 0);
3451  sprintf(line,"-read_speed soft_force:%s\n",
3452  xorriso->read_speed_force <= 0 ?
3453  "0" : Xorriso__speedname(xorriso->read_speed_force));
3454  if(!(is_default && no_defaults))
3455  Xorriso_status_result(xorriso,filter,fp,flag&2);
3456  is_default= (xorriso->read_speed_corr == 250000);
3457  sprintf(line,"-read_speed soft_corr:%d\n", xorriso->read_speed_corr);
3458  if(!(is_default && no_defaults))
3459  Xorriso_status_result(xorriso,filter,fp,flag&2);
3460 
3461  is_default= !(xorriso->auto_close || xorriso->do_close);
3462  sprintf(line,"-close %s\n",xorriso->auto_close ? "as_needed" :
3463  xorriso->do_close ? "on" : "off");
3464  if(!(is_default && no_defaults))
3465  Xorriso_status_result(xorriso,filter,fp,flag&2);
3466 
3467  is_default= (xorriso->do_tao == 0);
3468  sprintf(line,"-write_type %s\n",
3469  xorriso->do_tao == 0 ? "auto" : xorriso->do_tao > 0 ? "tao" : "sao/dao");
3470  if(!(is_default && no_defaults))
3471  Xorriso_status_result(xorriso,filter,fp,flag&2);
3472 
3473  is_default= !xorriso->do_dummy;
3474  sprintf(line,"-dummy %s\n",(xorriso->do_dummy ? "on" : "off"));
3475  if(!(is_default && no_defaults))
3476  Xorriso_status_result(xorriso,filter,fp,flag&2);
3477 
3478  is_default= (xorriso->write_speed==0);
3479  sprintf(line,"-speed %s\n", Xorriso__speedname(xorriso->write_speed));
3480  if(!(is_default && no_defaults))
3481  Xorriso_status_result(xorriso,filter,fp,flag&2);
3482 
3483  is_default= (xorriso->do_stream_recording==0);
3484  strcpy(mode, "off");
3485  if(xorriso->do_stream_recording == 1)
3486  strcpy(mode, "full");
3487  if(xorriso->do_stream_recording == 2)
3488  strcpy(mode, "data");
3489  else if(xorriso->do_stream_recording == 32)
3490  strcpy(mode, "on");
3491  else if(xorriso->do_stream_recording >= 16)
3492  sprintf(mode, "%ds", xorriso->do_stream_recording);
3493  sprintf(line,"-stream_recording %s\n", mode);
3494  if(!(is_default && no_defaults))
3495  Xorriso_status_result(xorriso,filter,fp,flag&2);
3496 
3497  is_default= (xorriso->modesty_on_drive == 0 &&
3498  xorriso->min_buffer_usec == 5000 &&
3499  xorriso->max_buffer_usec == 25000 &&
3500  xorriso->buffer_timeout_sec == 120 &&
3501  xorriso->min_buffer_percent == 90 &&
3502  xorriso->max_buffer_percent == 95);
3503  if(xorriso->modesty_on_drive == 0)
3504  strcpy(mode, "off");
3505  else if(xorriso->modesty_on_drive == 1)
3506  strcpy(mode, "on");
3507  else
3508  sprintf(mode, "%d", xorriso->modesty_on_drive);
3509  sprintf(mode + strlen(mode), ":min_percent=%d", xorriso->min_buffer_percent);
3510  sprintf(mode + strlen(mode), ":max_percent=%d", xorriso->max_buffer_percent);
3511  if(xorriso->buffer_timeout_sec >= 0)
3512  sprintf(mode + strlen(mode), ":timeout_sec=%d", xorriso->buffer_timeout_sec);
3513  if(xorriso->min_buffer_usec >= 0)
3514  sprintf(mode + strlen(mode), ":min_usec=%d", xorriso->min_buffer_usec);
3515  if(xorriso->max_buffer_usec >= 0)
3516  sprintf(mode + strlen(mode), ":max_usec=%d", xorriso->max_buffer_usec);
3517  sprintf(line,"-modesty_on_drive %s\n", mode);
3518  if(!(is_default && no_defaults))
3519  Xorriso_status_result(xorriso,filter,fp,flag&2);
3520 
3521  is_default= (xorriso->dvd_obs == 0);
3522  strcpy(mode, "default");
3523  if(xorriso->dvd_obs == 32768 || xorriso->dvd_obs == 65536)
3524  sprintf(mode, "%dk", xorriso->dvd_obs / 1024);
3525  sprintf(line,"-dvd_obs %s\n", mode);
3526  if(!(is_default && no_defaults))
3527  Xorriso_status_result(xorriso,filter,fp,flag&2);
3528 
3529  is_default= (xorriso->use_immed_bit == 0);
3530  strcpy(line, "-use_immed_bit ");
3531  if(xorriso->use_immed_bit == 0) {
3532  strcat(line, "default");
3533  if(xorriso->use_immed_bit_default > 0)
3534  strcat(line, "/on");
3535  else if(xorriso->use_immed_bit_default < 0)
3536  strcat(line, "/off");
3537  strcat(line, "\n");
3538  } else if(xorriso->use_immed_bit > 0) {
3539  strcat(line, "on\n");
3540  } else if(xorriso->use_immed_bit < 0) {
3541  strcat(line, "off\n");
3542  }
3543  if(!(is_default && no_defaults))
3544  Xorriso_status_result(xorriso,filter,fp,flag&2);
3545 
3546  is_default= (xorriso->stdio_sync == 0);
3547  strcpy(line, "-stdio_sync ");
3548  if(xorriso->stdio_sync == -1)
3549  strcat(line, "off");
3550  else if(xorriso->stdio_sync == 0)
3551  strcat(line, "on");
3552  else if(xorriso->stdio_sync == 1)
3553  strcat(line, "end");
3554  else if(xorriso->stdio_sync % 512) {
3555  Sfile_off_t_text(line+strlen(line), (off_t) (xorriso->stdio_sync * 2048),
3556  0);
3557  } else {
3558  Sfile_off_t_text(line+strlen(line), (off_t) (xorriso->stdio_sync / 512), 0);
3559  strcat(line, "m");
3560  }
3561  strcat(line, "\n");
3562  if(!(is_default && no_defaults))
3563  Xorriso_status_result(xorriso,filter,fp,flag&2);
3564 
3565  is_default= (xorriso->fs==4*512);
3566  if((xorriso->fs/512)*512==xorriso->fs)
3567  sprintf(line,"-fs %dm\n", xorriso->fs/512);
3568  else
3569  sprintf(line,"-fs %dk\n", xorriso->fs*2);
3570  if(!(is_default && no_defaults))
3571  Xorriso_status_result(xorriso,filter,fp,flag&2);
3572 
3573  is_default= (xorriso->padding==300*1024);
3574  sprintf(line,"-padding %dk\n", xorriso->padding/1024);
3575  if(!(is_default && no_defaults))
3576  Xorriso_status_result(xorriso,filter,fp,flag&2);
3577  is_default= (xorriso->do_padding_by_libisofs == 0);
3578  sprintf(line,"-padding %s\n",
3579  xorriso->do_padding_by_libisofs ? "included" : "appended");
3580  if(!(is_default && no_defaults))
3581  Xorriso_status_result(xorriso,filter,fp,flag&2);
3582 
3583  is_default= (strcmp(xorriso->report_about_text,"UPDATE")==0);
3584  sprintf(line,"-report_about %s\n",xorriso->report_about_text);
3585  if(!(is_default && no_defaults))
3586  Xorriso_status_result(xorriso,filter,fp,flag&2);
3587 
3588  is_default= (xorriso->scsi_log == 0);
3589  sprintf(line,"-scsi_log %s\n", xorriso->scsi_log ? "on" : "off");
3590  if(!(is_default && no_defaults))
3591  Xorriso_status_result(xorriso,filter,fp,flag&2);
3592 
3593  is_default= (xorriso->session_logfile[0]==0);
3594  sprintf(line,"-session_log %s\n",
3595  Text_shellsafe(xorriso->session_logfile,sfe,0));
3596  if(!(is_default && no_defaults))
3597  Xorriso_status_result(xorriso,filter,fp,flag&2);
3598 
3599  is_default= (xorriso->pacifier_style==0);
3600  sprintf(line,"-pacifier '%s'\n",
3601  xorriso->pacifier_style==1 ? "mkisofs" :
3602  xorriso->pacifier_style==2 ? "cdrecord" : "xorriso");
3603  if(!(is_default && no_defaults))
3604  Xorriso_status_result(xorriso,filter,fp,flag&2);
3605  is_default= (xorriso->pacifier_interval == 1.0);
3606  sprintf(line,"-pacifier interval=%f\n", xorriso->pacifier_interval);
3607  if(!(is_default && no_defaults))
3608  Xorriso_status_result(xorriso,filter,fp,flag&2);
3609 
3610  is_default= (strcmp(xorriso->return_with_text,"SORRY")==0 &&
3611  xorriso->return_with_value==32);
3612  sprintf(line,"-return_with %s %d\n",
3613  xorriso->return_with_text, xorriso->return_with_value);
3614  if(!(is_default && no_defaults))
3615  Xorriso_status_result(xorriso,filter,fp,flag&2);
3616 
3617  is_default= 0;
3618  sprintf(line,"-abort_on %s\n",xorriso->abort_on_text);
3619  if(!(is_default && no_defaults))
3620  Xorriso_status_result(xorriso,filter,fp,flag&2);
3621 
3622  if(xorriso->status_history_max!=Xorriso_status_history_maX || !no_defaults) {
3623  sprintf(line,"-status_history_max %d\n",xorriso->status_history_max);
3624  Xorriso_status_result(xorriso,filter,fp,flag&2);
3625  }
3626 
3627 #ifdef Xorriso_with_line_editoR
3628 
3629  if((flag & 8) && xorriso->status_history_max > 0 && !xorriso->use_stdin)
3630  Xorriso_status_history(xorriso, filter, fp, flag & 2);
3631 
3632 #endif /* Xorriso_with_line_editoR */
3633 
3634  is_default= (xorriso->toc_emulation_flag == 0);
3635  sprintf(line,"-rom_toc_scan %s:%s:%s\n",
3636  xorriso->toc_emulation_flag & 4 ? "force" :
3637  xorriso->toc_emulation_flag & 1 ? "on" : "off",
3638  xorriso->toc_emulation_flag & 2 ? "emul_off" : "emul_on",
3639  xorriso->toc_emulation_flag & 8 ? "emul_wide" : "emul_narrow");
3640  if(!(is_default && no_defaults))
3641  Xorriso_status_result(xorriso, filter, fp, flag & 2);
3642 
3643  is_default= (xorriso->displacement == 0);
3644  sprintf(line, "-displacement %s%lu\n",
3645  xorriso->displacement_sign < 0 ? "-" : "",
3646  (unsigned long) xorriso->displacement);
3647  if(!(is_default && no_defaults))
3648  Xorriso_status_result(xorriso, filter, fp, flag & 2);
3649 
3650  adr_mode= xorriso->image_start_mode & 0xffff;
3651  if(adr_mode>=0 && adr_mode<=max_load_mode) {
3652  is_default= (adr_mode==0);
3653  sprintf(line,"-load %s ", load_names[adr_mode]);
3654  if(adr_mode==0)
3655  sprintf(line+strlen(line),"''\n");
3656  else if(adr_mode>=1 && adr_mode<=3)
3657  sprintf(line+strlen(line),"%s\n", xorriso->image_start_value);
3658  else
3659  sprintf(line+strlen(line),"%s\n",
3660  Text_shellsafe(xorriso->image_start_value, sfe, 0));
3661  if(!(is_default && no_defaults))
3662  Xorriso_status_result(xorriso,filter,fp,flag&2);
3663  }
3664 
3665  is_default= (xorriso->read_fs == 0);
3666  sprintf(line, "-read_fs %s\n",
3667  xorriso->read_fs == 0 ? "any" :
3668  xorriso->read_fs == 1 ? "norock" :
3669  xorriso->read_fs == 2 ? "nojoliet" : "ecma119");
3670  if(!(is_default && no_defaults))
3671  Xorriso_status_result(xorriso, filter, fp, flag & 2);
3672 
3673  is_default= (xorriso->do_calm_drive & 1);
3674  sprintf(line,"-calm_drive %s\n", xorriso->do_calm_drive & 1 ? "on" : "off");
3675  if(!(is_default && no_defaults))
3676  Xorriso_status_result(xorriso,filter,fp,flag&2);
3677 
3678  is_default= (xorriso->grow_blindly_msc2<0);
3679  sprintf(sfe, "%d", xorriso->grow_blindly_msc2);
3680  sprintf(line,"-grow_blindly %s\n",
3681  xorriso->grow_blindly_msc2 < 0 ? "off" : sfe);
3682  if(!(is_default && no_defaults))
3683  Xorriso_status_result(xorriso,filter,fp,flag&2);
3684 
3685  Xorriso_get_local_charset(xorriso, &local_charset, 0);
3686  nl_charset= nl_langinfo(CODESET);
3687  is_default= (strcmp(local_charset, nl_charset) == 0);
3688  sprintf(line, "-local_charset %s\n", Text_shellsafe(local_charset, sfe, 0));
3689  if(!(is_default && no_defaults))
3690  Xorriso_status_result(xorriso, filter, fp, flag & 2);
3691 
3692  is_default= (xorriso->out_charset == NULL && xorriso->in_charset == NULL);
3693  in_pt= "";
3694  if(xorriso->in_charset != NULL)
3695  in_pt= xorriso->in_charset;
3696  out_pt= "";
3697  if(xorriso->out_charset != NULL)
3698  out_pt= xorriso->out_charset;
3699  do_single= 0;
3700  ret= Xorriso_status_filter(xorriso, filter, "-in_charset", 0);
3701  if(ret <= 0)
3702  ret= Xorriso_status_filter(xorriso, filter, "-out_charset", 0);
3703  if(ret > 0)
3704  do_single= 1;
3705  if(strcmp(in_pt, out_pt) == 0 && !do_single) {
3706  sprintf(line, "-charset %s\n", Text_shellsafe(in_pt, sfe, 0));
3707  if(!(is_default && no_defaults))
3708  Xorriso_status_result(xorriso, filter, fp, flag & 2);
3709  } else {
3710  sprintf(line, "-in_charset %s\n", Text_shellsafe(in_pt, sfe, 0));
3711  if(!(is_default && no_defaults))
3712  Xorriso_status_result(xorriso, filter, fp, flag & 2);
3713  sprintf(line, "-out_charset %s\n", Text_shellsafe(out_pt, sfe, 0));
3714  if(!(is_default && no_defaults))
3715  Xorriso_status_result(xorriso, filter, fp, flag & 2);
3716  }
3717  is_default= ((xorriso->do_aaip & (256 | 512)) == 0);
3718  sprintf(line,"-auto_charset %s\n", (xorriso->do_aaip & 256 ? "on" : "off"));
3719  if(!(is_default && no_defaults))
3720  Xorriso_status_result(xorriso,filter,fp,flag&2);
3721 
3722  is_default= ((xorriso->ino_behavior & 31) == 7);
3723  switch (xorriso->ino_behavior & 15) {
3724  case 0: form= "on";
3725  break; case 8: form= "without_update";
3726  break; default: form= "off";
3727  }
3728  sprintf(line,"-hardlinks %s:%s:%s\n", form,
3729  xorriso->ino_behavior & 32 ?
3730  "no_lsl_count" : "lsl_count",
3731  xorriso->ino_behavior & 16 ?
3732  "cheap_sorted_extract" : "normal_extract");
3733  if(!(is_default && no_defaults))
3734  Xorriso_status_result(xorriso,filter,fp,flag&2);
3735 
3736  is_default= ((xorriso->do_aaip & (1 | 4)) == 0);
3737  sprintf(line,"-acl %s\n", (xorriso->do_aaip & 1 ? "on" : "off"));
3738  if(!(is_default && no_defaults))
3739  Xorriso_status_result(xorriso,filter,fp,flag&2);
3740  is_default= ((xorriso->do_aaip & (2 | 8)) == 0);
3741  sprintf(line,"-xattr %s\n", (xorriso->do_aaip & 4 ?
3742  xorriso->do_aaip & 1024 ? "any" : "user"
3743  : "off"));
3744  if(!(is_default && no_defaults))
3745  Xorriso_status_result(xorriso,filter,fp,flag&2);
3746  is_default= ((xorriso->do_aaip & (16 | 32 | 64)) == 0);
3747  sprintf(line,"-disk_dev_ino %s\n",
3748  (xorriso->do_aaip & 16 ? (xorriso->do_aaip & 128 ? "ino_only" : "on" )
3749  : "off"));
3750  if(!(is_default && no_defaults))
3751  Xorriso_status_result(xorriso,filter,fp,flag&2);
3752 
3753  is_default= ((xorriso->do_md5 & 31) == 0);
3754  sprintf(line, "-md5 ");
3755  if(xorriso->do_md5 & 1) {
3756  if((xorriso->do_md5 & 8) == 8) {
3757  strcat(line, "all");
3758  } else {
3759  strcat(line, "on");
3760  if(xorriso->do_md5 & 8)
3761  strcat(line, ":stability_check_on");
3762  }
3763  if(xorriso->do_md5 & 32)
3764  strcat(line, ":load_check_off");
3765  strcat(line, "\n");
3766  } else
3767  strcat(line, "off\n");
3768  if(!(is_default && no_defaults))
3769  Xorriso_status_result(xorriso,filter,fp,flag&2);
3770 
3771  is_default= (xorriso->ecma119_map == 1);
3772  sprintf(line, "-ecma119_map ");
3773  if(xorriso->ecma119_map == 0)
3774  strcat(line, "unmapped\n");
3775  else if(xorriso->ecma119_map == 2)
3776  strcat(line, "uppercase\n");
3777  else if(xorriso->ecma119_map == 3)
3778  strcat(line, "lowercase\n");
3779  else
3780  strcat(line, "stripped\n");
3781  if(!(is_default && no_defaults))
3782  Xorriso_status_result(xorriso,filter,fp,flag&2);
3783 
3784  is_default= (xorriso->joliet_map == 1);
3785  sprintf(line, "-joliet_map ");
3786  if(xorriso->joliet_map == 0)
3787  strcat(line, "unmapped\n");
3788  else
3789  strcat(line, "stripped\n");
3790  if(!(is_default && no_defaults))
3791  Xorriso_status_result(xorriso,filter,fp,flag&2);
3792 
3793  is_default= (xorriso->scdbackup_tag_name[0] == 0 &&
3794  xorriso->scdbackup_tag_listname[0] == 0);
3795  sprintf(line, "-scdbackup_tag ");
3796  Text_shellsafe(xorriso->scdbackup_tag_listname, line, 1);
3797  strcat(line, " ");
3798  Text_shellsafe(xorriso->scdbackup_tag_name, line, 1);
3799  strcat(line, "\n");
3800  if(!(is_default && no_defaults))
3801  Xorriso_status_result(xorriso,filter,fp,flag&2);
3802 
3803  is_default= (Xorriso_get_relax_text(xorriso, sfe, 0) == 2);
3804  sprintf(line,"-compliance %s\n", sfe);
3805  if(!(is_default && no_defaults))
3806  Xorriso_status_result(xorriso,filter,fp,flag&2);
3807 
3808  is_default= (xorriso->rr_reloc_dir[0] == 0);
3809  sprintf(line, "-rr_reloc_dir ");
3810  Text_shellsafe(xorriso->rr_reloc_dir, line, 1);
3811  strcat(line, "\n");
3812  if(!(is_default && no_defaults))
3813  Xorriso_status_result(xorriso,filter,fp,flag&2);
3814 
3815  is_default= (xorriso->assert_volid[0] == 0);
3816  sprintf(line, "-assert_volid ");
3817  Text_shellsafe(xorriso->assert_volid, line, 1);
3818  strcat(line, " ");
3819  Text_shellsafe(xorriso->assert_volid_sev, line, 1);
3820  strcat(line, "\n");
3821  if(!(is_default && no_defaults))
3822  Xorriso_status_result(xorriso,filter,fp,flag&2);
3823 
3824  is_default= 1;
3825  if(xorriso->drive_blacklist != NULL || xorriso->drive_whitelist != NULL ||
3826  xorriso->drive_greylist == NULL)
3827  is_default= 0;
3828  if(xorriso->drive_greylist != NULL) {
3829  if(strcmp(Xorriso_get_pattern(xorriso, xorriso->drive_greylist, 0, 0),
3830  "/dev") != 0)
3831  is_default= 0;
3832  if(Xorriso_get_pattern(xorriso, xorriso->drive_greylist, 1, 0) != NULL)
3833  is_default= 0;
3834  }
3835  if(!(is_default && no_defaults)) {
3836  for(s= xorriso->drive_blacklist; s != NULL; s= Xorriso_lst_get_next(s, 0)) {
3837  sprintf(line, "-drive_class 'banned' %s\n",
3838  Text_shellsafe(Xorriso_lst_get_text(s, 0), sfe, 0));
3839  Xorriso_status_result(xorriso,filter,fp,flag&2);
3840  }
3841  for(s= xorriso->drive_greylist; s != NULL; s= Xorriso_lst_get_next(s, 0)) {
3842  sprintf(line, "-drive_class 'caution' %s\n",
3843  Text_shellsafe(Xorriso_lst_get_text(s, 0), sfe, 0));
3844  Xorriso_status_result(xorriso,filter,fp,flag&2);
3845  }
3846  for(s= xorriso->drive_whitelist; s != NULL; s= Xorriso_lst_get_next(s, 0)) {
3847  sprintf(line, "-drive_class 'harmless' %s\n",
3848  Text_shellsafe(Xorriso_lst_get_text(s, 0), sfe, 0));
3849  Xorriso_status_result(xorriso,filter,fp,flag&2);
3850  }
3851  }
3852 
3853  is_default= (xorriso->drives_exclusive == 1 && xorriso->drives_access == 1);
3854  sprintf(line, "-drive_access %s:%s\n",
3855  xorriso->drives_exclusive ? "exclusive" : "shared",
3856  xorriso->drives_access == 0 ? "readonly" : "unrestricted");
3857  if(!(is_default && no_defaults))
3858  Xorriso_status_result(xorriso, filter, fp, flag & 2);
3859 
3860  is_default= (xorriso->linux_scsi_dev_family == 0);
3861  sprintf(line, "-scsi_dev_family %s\n",
3862  scsi_family[xorriso->linux_scsi_dev_family & 7]);
3863  if(!(is_default && no_defaults))
3864  Xorriso_status_result(xorriso,filter,fp,flag&2);
3865 
3866  do_single= do_drive_access= 0;
3867  dev_filter= filter;
3868  if(dev_filter != NULL) {
3869  show_dev= Xorriso_status_filter(xorriso, filter, "-dev", 0);
3870  if(show_dev > 0)
3871  dev_filter= NULL;
3872  }
3873  if(dev_filter != NULL) {
3874  show_indev= Xorriso_status_filter(xorriso, filter, "-indev", 0);
3875  show_outdev= Xorriso_status_filter(xorriso, filter, "-outdev", 0);
3876  if(show_outdev > 0 || show_indev > 0)
3877  do_single= 1;
3878  }
3879  if((xorriso->drives_exclusive != xorriso->indev_is_exclusive ||
3880  xorriso->drives_access != xorriso->indev_access) && xorriso->indev[0]) {
3881  do_single= 1;
3882  do_drive_access|= 1;
3883  }
3884  if((xorriso->drives_exclusive != xorriso->outdev_is_exclusive ||
3885  xorriso->drives_access != xorriso->outdev_access) &&
3886  xorriso->outdev[0]) {
3887  do_single= 1;
3888  do_drive_access|= 2;
3889  }
3890  if(strcmp(xorriso->indev, xorriso->outdev) == 0 && !do_single) {
3891  sprintf(line,"-dev %s\n", Text_shellsafe(xorriso->indev,sfe,0));
3892  Xorriso_status_result(xorriso, dev_filter, fp, flag & 2);
3893  } else {
3894  did_drive_access= 0;
3895  if((do_drive_access & 1) && xorriso->indev[0] && show_indev) {
3896  sprintf(line,"-drive_access %s:%s\n",
3897  xorriso->indev_is_exclusive ? "exclusive" : "shared",
3898  xorriso->indev_access == 0 ? "readonly" : "unrestricted");
3899  Xorriso_status_result(xorriso, NULL, fp, flag & 2);
3900  did_drive_access= 1;
3901  }
3902  sprintf(line,"-indev %s\n", Text_shellsafe(xorriso->indev,sfe,0));
3903  Xorriso_status_result(xorriso, dev_filter, fp, flag & 2);
3904  if(did_drive_access) {
3905  sprintf(line,"-drive_access %s:%s\n",
3906  xorriso->drives_exclusive ? "exclusive" : "shared",
3907  xorriso->drives_access == 0 ? "readonly" : "unrestricted");
3908  Xorriso_status_result(xorriso, NULL, fp, flag & 2);
3909  }
3910 
3911  did_drive_access= 0;
3912  if((do_drive_access & 2) && xorriso->outdev[0] && show_outdev) {
3913  sprintf(line,"-drive_access %s:%s\n",
3914  xorriso->outdev_is_exclusive ? "exclusive" : "shared",
3915  xorriso->outdev_access == 0 ? "readonly" : "unrestricted");
3916  Xorriso_status_result(xorriso, NULL, fp, flag & 2);
3917  did_drive_access= 1;
3918  }
3919  sprintf(line,"-outdev %s\n", Text_shellsafe(xorriso->outdev,sfe,0));
3920  Xorriso_status_result(xorriso, dev_filter, fp, flag & 2);
3921  if(did_drive_access) {
3922  sprintf(line,"-drive_access %s:%s\n",
3923  xorriso->drives_exclusive ? "exclusive" : "shared",
3924  xorriso->drives_access == 0 ? "readonly" : "unrestricted");
3925  Xorriso_status_result(xorriso, NULL, fp, flag & 2);
3926  }
3927  }
3928 
3929  ret= 1;
3930 ex:;
3931  Xorriso_free_meM(sfe);
3932  Xorriso_free_meM(xorriso_id);
3933  return(ret);
3934 }
int Exclusions_get_descrs(struct ExclusionS *o, struct Xorriso_lsT **not_paths_descr, struct Xorriso_lsT **not_leafs_descr, int flag)
Definition: aux_objects.c:836
int Xorriso_lst_get_last(struct Xorriso_lsT *entry, struct Xorriso_lsT **last, int flag)
Definition: aux_objects.c:649
struct Xorriso_lsT * Xorriso_lst_get_prev(struct Xorriso_lsT *entry, int flag)
Obtain the address of the previous item in the chain of messages.
Definition: aux_objects.c:630
int Xorriso__get_signal_behavior(int flag)
Definition: base_obj.c:799
int Xorriso_check_media_list_job(struct XorrisO *xorriso, struct CheckmediajoB *job, char *report, int flag)
Definition: check_media.c:841
int Xorriso_status_extf(struct XorrisO *xorriso, char *filter, FILE *fp, int flag)
Definition: filters.c:619
int Xorriso_status_zisofs(struct XorrisO *xorriso, char *filter, FILE *fp, int flag)
Definition: filters.c:745
int Xorriso_boot_image_status(struct XorrisO *xorriso, char *filter, FILE *fp, int flag)
Definition: iso_img.c:662
int Xorriso_get_local_charset(struct XorrisO *xorriso, char **name, int flag)
Definition: lib_mgt.c:476
int Xorriso_preparer_string(struct XorrisO *xorriso, char xorriso_id[129], int flag)
Definition: lib_mgt.c:683
char * Xorriso_get_pattern(struct XorrisO *xorriso, struct Xorriso_lsT *patternlist, int index, int flag)
Definition: match.c:321
int Xorriso__format_guid(uint8_t guid[16], char *text, int flag)
Definition: misc_funct.c:1341
int Sfile_off_t_text(char text[80], off_t num, int flag)
Definition: sfile.c:389
int iso_mbr_part_type
char publisher[129]
char volset_id[129]
int do_strict_acl
int part_like_isohybrid
int apm_block_size
char list_delimiter[81]
int do_follow_mount
int do_iso_rr_pattern
uid_t global_uid
int do_disk_pattern
off_t file_size_limit
int pacifier_style
int linux_scsi_dev_family
int outdev_is_exclusive
time_t now_time_override
struct ExclusionS * disk_exclusions
int displacement_sign
int do_padding_by_libisofs
char preparer_id[129]
int do_rockridge
int modesty_on_drive
int read_speed_force
int allow_graft_points
int partition_heads_per_cyl
int allow_restore
char efi_boot_partition[4096]
off_t sparse_min_gap
char progname[4096]
char abstract_file[38]
int do_follow_pattern
off_t split_size
uint8_t gpt_guid[16]
char indev[4096]
int early_stdio_test
int do_follow_links
int do_calm_drive
int appended_as_gpt
int img_read_error_mode
int appended_as_apm
time_t vol_effective_time
int cache_tile_blocks
char scdbackup_tag_listname[4096]
char * out_charset
int use_immed_bit
char system_id[33]
int ban_stdio_write
int ino_behavior
char all_file_dates[80]
int status_history_max
int do_overwrite
time_t vol_creation_time
int image_start_mode
int cache_num_tiles
int drives_access
int min_buffer_percent
char volid[33]
uint8_t hfsp_serial_number[8]
char prep_partition[4096]
gid_t global_gid
int do_auto_chmod
int drives_exclusive
int cache_default
int do_restore_sort_lba
int do_follow_concat
int max_buffer_usec
uint32_t partition_offset
int grow_blindly_msc2
int do_concat_split
char vol_uuid[17]
int iso_mbr_part_flag
uint32_t displacement
char logfile[4][4096]
int min_buffer_usec
int mount_opts_flag
uint8_t iso_gpt_type_guid[16]
int file_name_limit
char abort_on_text[20]
int buffer_timeout_sec
char rr_reloc_dir[256]
int do_override_now_time
int do_global_gid
int follow_link_limit
char scdbackup_tag_name[81]
int hfsp_block_size
int volid_default
char * in_charset
int partition_secs_per_head
char image_start_value[81]
int do_global_uid
time_t vol_modification_time
int outdev_access
char return_with_text[20]
int max_buffer_percent
struct Xorriso_lsT * drive_blacklist
int extract_error_mode
char session_logfile[4096]
char loaded_volid[33]
int return_with_value
char assert_volid[4096]
int disk_excl_mode
char wdx[4096]
char outdev[4096]
char copyright_file[38]
int indev_access
char application_use[4096]
char application_id[129]
char report_about_text[20]
int do_follow_param
char assert_volid_sev[80]
int gpt_guid_mode
struct Xorriso_lsT * jigdo_values
int use_immed_bit_default
int toc_emulation_flag
int do_stream_recording
struct Xorriso_lsT * jigdo_params
struct Xorriso_lsT * drive_whitelist
char biblio_file[38]
struct CheckmediajoB * check_media_default
time_t vol_expiration_time
int indev_is_exclusive
struct Xorriso_lsT * drive_greylist
int boot_image_isohybrid
char wdi[4096]
int read_speed_corr
int Xorriso_boot_status_sysarea(struct XorrisO *xorriso, char *filter, FILE *fp, int flag)
Definition: text_io.c:2713
static char * Xorriso__speedname(int speed)
Definition: text_io.c:2745
int Xorriso_status_filter(struct XorrisO *xorriso, char *filter, char *line, int flag)
Definition: text_io.c:2676
int Xorriso_get_relax_text(struct XorrisO *xorriso, char mode[1024], int flag)
Definition: write_run.c:2716
#define Xorriso_default_file_size_limiT
#define Xorriso_status_history_maX

References XorrisO::abort_on_text, XorrisO::abstract_file, XorrisO::add_plainly, XorrisO::all_file_dates, XorrisO::allow_graft_points, XorrisO::allow_restore, XorrisO::apm_block_size, XorrisO::appended_as_apm, XorrisO::appended_as_gpt, XorrisO::application_id, XorrisO::application_use, XorrisO::assert_volid, XorrisO::assert_volid_sev, XorrisO::auto_close, XorrisO::ban_stdio_write, XorrisO::biblio_file, XorrisO::boot_image_isohybrid, XorrisO::bsl_interpretation, XorrisO::buffer_timeout_sec, XorrisO::cache_default, XorrisO::cache_num_tiles, XorrisO::cache_tile_blocks, XorrisO::check_media_default, XorrisO::copyright_file, XorrisO::dialog, XorrisO::disk_excl_mode, XorrisO::disk_exclusions, XorrisO::displacement, XorrisO::displacement_sign, XorrisO::do_aaip, XorrisO::do_auto_chmod, XorrisO::do_calm_drive, XorrisO::do_close, XorrisO::do_concat_split, XorrisO::do_disk_pattern, XorrisO::do_dummy, XorrisO::do_follow_concat, XorrisO::do_follow_links, XorrisO::do_follow_mount, XorrisO::do_follow_param, XorrisO::do_follow_pattern, XorrisO::do_global_gid, XorrisO::do_global_uid, XorrisO::do_hfsplus, XorrisO::do_iso_rr_pattern, XorrisO::do_joliet, XorrisO::do_md5, XorrisO::do_override_now_time, XorrisO::do_overwrite, XorrisO::do_padding_by_libisofs, XorrisO::do_reassure, XorrisO::do_restore_sort_lba, XorrisO::do_rockridge, XorrisO::do_stream_recording, XorrisO::do_strict_acl, XorrisO::do_tao, XorrisO::drive_blacklist, XorrisO::drive_greylist, XorrisO::drive_whitelist, XorrisO::drives_access, XorrisO::drives_exclusive, XorrisO::dvd_obs, XorrisO::early_stdio_test, XorrisO::ecma119_map, XorrisO::efi_boot_partition, XorrisO::errfile_log, Exclusions_get_descrs(), XorrisO::extract_error_mode, XorrisO::file_name_limit, XorrisO::file_size_limit, XorrisO::follow_link_limit, XorrisO::fs, Ftimetxt(), XorrisO::global_gid, XorrisO::global_uid, XorrisO::gpt_guid, XorrisO::gpt_guid_mode, XorrisO::grow_blindly_msc2, XorrisO::hfsp_block_size, XorrisO::hfsp_serial_number, XorrisO::image_start_mode, XorrisO::image_start_value, XorrisO::img_read_error_mode, XorrisO::in_charset, XorrisO::indev, XorrisO::indev_access, XorrisO::indev_is_exclusive, XorrisO::ino_behavior, XorrisO::iso_gpt_type_guid, XorrisO::iso_mbr_part_flag, XorrisO::iso_mbr_part_type, XorrisO::jigdo_params, XorrisO::jigdo_values, XorrisO::joliet_map, XorrisO::linux_scsi_dev_family, XorrisO::list_delimiter, XorrisO::loaded_volid, XorrisO::logfile, XorrisO::mark_text, XorrisO::max_buffer_percent, XorrisO::max_buffer_usec, XorrisO::min_buffer_percent, XorrisO::min_buffer_usec, XorrisO::modesty_on_drive, XorrisO::mount_opts_flag, Xorriso_lsT::next, XorrisO::no_rc, XorrisO::now_time_override, XorrisO::out_charset, XorrisO::outdev, XorrisO::outdev_access, XorrisO::outdev_is_exclusive, XorrisO::pacifier_interval, XorrisO::pacifier_style, XorrisO::packet_output, XorrisO::padding, XorrisO::part_like_isohybrid, XorrisO::partition_heads_per_cyl, XorrisO::partition_offset, XorrisO::partition_secs_per_head, XorrisO::prep_partition, XorrisO::preparer_id, XorrisO::progname, XorrisO::publisher, XorrisO::read_fs, XorrisO::read_speed, XorrisO::read_speed_corr, XorrisO::read_speed_force, XorrisO::report_about_text, XorrisO::result_line, XorrisO::result_page_length, XorrisO::result_page_width, XorrisO::return_with_text, XorrisO::return_with_value, XorrisO::rr_reloc_dir, XorrisO::scdbackup_tag_listname, XorrisO::scdbackup_tag_name, XorrisO::scsi_log, XorrisO::session_logfile, Sfile_off_t_text(), SfileadrL, XorrisO::sh_style_result, XorrisO::sparse_min_gap, XorrisO::split_size, XorrisO::status_history_max, XorrisO::stdio_sync, XorrisO::system_area_disk_path, XorrisO::system_area_options, XorrisO::system_id, XorrisO::temp_mem_limit, Xorriso_lsT::text, Text_shellsafe(), XorrisO::toc_emulation_flag, XorrisO::use_immed_bit, XorrisO::use_immed_bit_default, XorrisO::use_stdin, XorrisO::vol_creation_time, XorrisO::vol_effective_time, XorrisO::vol_expiration_time, XorrisO::vol_modification_time, XorrisO::vol_uuid, XorrisO::volid, XorrisO::volid_default, XorrisO::volset_id, XorrisO::wdi, XorrisO::wdx, XorrisO::write_speed, Xorriso__format_guid(), Xorriso__get_signal_behavior(), Xorriso__speedname(), Xorriso_alloc_meM, Xorriso_boot_image_status(), Xorriso_boot_status_sysarea(), Xorriso_check_media_list_job(), Xorriso_default_file_size_limiT, Xorriso_free_meM, Xorriso_get_local_charset(), Xorriso_get_pattern(), Xorriso_get_relax_text(), Xorriso_lst_get_last(), Xorriso_lst_get_next(), Xorriso_lst_get_prev(), Xorriso_lst_get_text(), Xorriso_preparer_string(), Xorriso_status_extf(), Xorriso_status_filter(), Xorriso_status_history_maX, Xorriso_status_result(), and Xorriso_status_zisofs().

Referenced by Xorriso_option_boot_image(), and Xorriso_option_status().

◆ Xorriso_status_filter()

int Xorriso_status_filter ( struct XorrisO xorriso,
char *  filter,
char *  line,
int  flag 
)

Definition at line 2676 of file text_io.c.

2678 {
2679  if(filter!=NULL)
2680  if(filter[0]=='-')
2681  if(strncmp(filter, line, strlen(filter))!=0)
2682  return(0);
2683  return(1);
2684 }

Referenced by Xorriso_status(), and Xorriso_status_result().

◆ Xorriso_status_result()

int Xorriso_status_result ( struct XorrisO xorriso,
char *  filter,
FILE *  fp,
int  flag 
)

Definition at line 2687 of file text_io.c.

2692 {
2693  int ret;
2694 
2695  ret= Xorriso_status_filter(xorriso, filter, xorriso->result_line, 0);
2696  if(ret <= 0)
2697  return(2);
2698  if(!(flag&2))
2699  Xorriso_result(xorriso,0);
2700  if(fp!=NULL) {
2701  ret= fwrite(xorriso->result_line,strlen(xorriso->result_line),1,fp);
2702  if(ret<=0)
2703  return(ret);
2704  }
2705  return(1);
2706 }

References XorrisO::result_line, Xorriso_result(), and Xorriso_status_filter().

Referenced by Xorriso_append_part_status(), Xorriso_boot_image_status(), Xorriso_boot_item_status(), Xorriso_boot_status_non_mbr(), Xorriso_boot_status_sysarea(), Xorriso_status(), Xorriso_status_extf(), Xorriso_status_hppa(), and Xorriso_status_zisofs().

◆ Xorriso_stop_msg_watcher()

int Xorriso_stop_msg_watcher ( struct XorrisO xorriso,
int  flag 
)

Revoke output redirection by Xorriso_start_msg_watcher() and end the watcher thread.

If text messages are delivered when Xorriso_pull_outlists() is called, then they get put out through the active handler functions.

Since
1.2.6
Parameters
xorrisoThe environment handle
flagBitfield for control purposes: bit0= do not issue SORRY message if no message watcher is active
Returns
1 on success, <=0 if failure

Definition at line 1614 of file text_io.c.

1615 {
1616  int ret, u_wait= 1000, locked= 0, uret, line_count= 0;
1617  struct Xorriso_lsT *result_list= NULL, *info_list= NULL;
1618 
1619  if((flag & 1) && xorriso->msg_watcher_state != 2)
1620  /* Roughly tolerate non-running watcher */
1621  {ret= 0; goto ex;}
1622 
1623  ret= pthread_mutex_lock(&(xorriso->msg_watcher_lock));
1624  if(ret != 0) {
1625  Xorriso_msgs_submit(xorriso, 0,
1626  "Cannot acquire mutex lock for managing concurrent message watcher",
1627  ret, "FATAL", 0);
1628  ret= -1; goto ex;
1629  }
1630  locked= 1;
1631 
1632  /* Check for running watcher */
1633  if(xorriso->msg_watcher_state != 2) {
1634  sprintf(xorriso->info_text,
1635  "There is no concurrent message watcher running");
1636  Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, errno, "SORRY", 0);
1637  ret= 0; goto ex;
1638  }
1639 
1640  /* Inform watcher of desire to stop it */
1641  xorriso->msg_watcher_state= 3;
1642 
1643  /* Wait until watcher has indicated its end */
1644  while(xorriso->msg_watcher_state != 0) {
1645 
1646  /* >>> have a timeout ? */;
1647 
1648  usleep(u_wait);
1649  }
1650 
1651  ret= Xorriso_obtain_lock(xorriso, &(xorriso->msgw_fetch_lock),
1652  "message watcher fetch operation", 1);
1653  if(ret <= 0) {
1654  Xorriso_msgs_submit(xorriso, 0,
1655  "Cannot obtain mutex lock for managing concurrent message watcher",
1656  ret, "FATAL", 0);
1657  ret= -1;
1658  goto ex;
1659  }
1660  xorriso->msgw_msg_pending= 1;
1661  ret= Xorriso_pull_outlists(xorriso, xorriso->msgw_stack_handle,
1662  &result_list, &info_list, 0);
1663  if(ret > 0) {
1664  xorriso->msgw_msg_pending= 2;
1665  Xorriso_release_lock(xorriso, &(xorriso->msgw_fetch_lock),
1666  "message watcher fetch operation", 1);
1667  Xorriso_process_msg_lists(xorriso, result_list, info_list,
1668  &line_count, 0);
1669  xorriso->msgw_msg_pending= 0;
1670  Xorriso_lst_destroy_all(&result_list, 0);
1671  Xorriso_lst_destroy_all(&info_list, 0);
1672  } else {
1673  xorriso->msgw_msg_pending= 0;
1674  Xorriso_release_lock(xorriso, &(xorriso->msgw_fetch_lock),
1675  "message watcher fetch operation", 1);
1676  }
1677 
1678  xorriso->msgw_result_handler= NULL;
1679  xorriso->msgw_info_handler= NULL;
1680 
1681  ret= 1;
1682 ex:;
1683  if(locked) {
1684  uret= pthread_mutex_unlock(&(xorriso->msg_watcher_lock));
1685  if(uret != 0) {
1686  Xorriso_msgs_submit(xorriso, 0,
1687  "Cannot release mutex lock for managing concurrent message watcher",
1688  uret, "FATAL", 0);
1689  ret= -1;
1690  }
1691  }
1692  return(ret);
1693 }

References XorrisO::info_text, XorrisO::msg_watcher_lock, XorrisO::msg_watcher_state, XorrisO::msgw_fetch_lock, XorrisO::msgw_info_handler, XorrisO::msgw_msg_pending, XorrisO::msgw_result_handler, XorrisO::msgw_stack_handle, Xorriso_lst_destroy_all(), Xorriso_msgs_submit(), Xorriso_obtain_lock(), Xorriso_process_msg_lists(), Xorriso_pull_outlists(), and Xorriso_release_lock().

Referenced by main(), and Xorriso_interpreter().

◆ Xorriso_unlock_outlists()

static int Xorriso_unlock_outlists ( struct XorrisO xorriso,
int  flag 
)
static

Definition at line 875 of file text_io.c.

876 {
877  int ret;
878 
879  ret= Xorriso_release_lock(xorriso, &(xorriso->result_msglists_lock),
880  "outlists", 0);
881  return(ret);
882 }

References XorrisO::result_msglists_lock, and Xorriso_release_lock().

Referenced by Xorriso_fetch_outlists(), Xorriso_pull_outlists(), Xorriso_push_outlists(), and Xorriso_write_to_msglist().

◆ Xorriso_write_session_log()

int Xorriso_write_session_log ( struct XorrisO xorriso,
int  flag 
)

Definition at line 2638 of file text_io.c.

2639 {
2640  FILE *fp= NULL;
2641  char *sfe= NULL, timetext[40], *rpt, *wpt;
2642  int ret;
2643 
2644  if(xorriso->session_logfile[0]==0)
2645  {ret= 2; goto ex;}
2646 
2647  Xorriso_alloc_meM(sfe, char, 5 * SfileadrL);
2648 
2649  fp= fopen(xorriso->session_logfile, "a");
2650  if(fp==0) {
2651  sprintf(xorriso->info_text, "-session_log: Cannot open file %s",
2652  Text_shellsafe(xorriso->session_logfile, sfe, 0));
2653  Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);
2654  {ret= 0; goto ex;}
2655  }
2656  wpt= sfe;
2657  for(rpt= xorriso->volid; *rpt!=0; rpt++) {
2658  if(*rpt=='\n') {
2659  *(wpt++)= '\\';
2660  *(wpt++)= 'n';
2661  } else
2662  *(wpt++)= *rpt;
2663  }
2664  *wpt= 0;
2665  fprintf(fp, "%s %d %d %s\n",
2666  Ftimetxt(time(0), timetext, 2), xorriso->session_lba,
2667  xorriso->session_blocks, sfe);
2668  fclose(fp);
2669  ret= 1;
2670 ex:;
2671  Xorriso_free_meM(sfe);
2672  return(ret);
2673 }
int session_blocks

References Ftimetxt(), XorrisO::info_text, XorrisO::session_blocks, XorrisO::session_lba, XorrisO::session_logfile, SfileadrL, Text_shellsafe(), XorrisO::volid, Xorriso_alloc_meM, Xorriso_free_meM, and Xorriso_msgs_submit().

Referenced by Xorriso_option_commit().

◆ Xorriso_write_to_channel()

int Xorriso_write_to_channel ( struct XorrisO xorriso,
char *  in_text,
int  channel_no,
int  flag 
)

Definition at line 911 of file text_io.c.

920 {
921  char *rpt, *npt, *text= NULL, *line= NULL;
922  int ret= 1, info_redirected= 0, result_redirected= 0, l;
923  char prefix[16];
924  FILE *logfile_fp, *pktlog_fp;
925  static int num_channels= 4;
926  static char channel_prefixes[4][4]= {".","R","I","M"};
927  int Xorriso_sieve_filter_msg(struct XorrisO *xorriso, char *msg, int flag);
928 
929 #ifdef Xorriso_fetch_with_msg_queueS
930  static int complaints= 0, complaint_limit= 5;
931  int locked= 0, uret;
932 #endif
933 
934  text= in_text; /* might change due to backslash encoding */
935 
936  if(channel_no<0 || channel_no>=num_channels)
937  {ret= -1; goto ex;}
938 
939 #ifdef Xorriso_fetch_with_msg_queueS
940  ret= pthread_mutex_lock(&(xorriso->write_to_channel_lock));
941  if(ret != 0) {
942  /* Cannot report failure through the failing message output system */
943  complaints++;
944  if(complaints <= complaint_limit)
945  fprintf(stderr,
946  "xorriso : pthread_mutex_lock() for write_to_channel returns %d\n",
947  ret);
948  /* Intentionally not aborting here */;
949  } else
950  locked= 1;
951 #endif /* Xorriso_fetch_with_msg_queueS */
952 
953  /* Logfiles */
954  logfile_fp= xorriso->logfile_fp[channel_no];
955  pktlog_fp= xorriso->pktlog_fp;
956  if((flag&2) && logfile_fp!=NULL) {
957  fprintf(logfile_fp,
958  "! end ! end ! end ! end ! end ! end ! end ! end xorriso log : %s : %s\n",
959  channel_prefixes[channel_no],Sfile_datestr(time(0),1|2|256));
960  fclose(logfile_fp);
961  xorriso->logfile_fp[channel_no]= logfile_fp= NULL;
962  }
963  if((flag&4) && pktlog_fp!=NULL) {
964  fprintf(pktlog_fp,
965  "I:1:! end ! end ! end ! end ! end ! end ! end ! end xorriso log : %s : %s\n",
966  channel_prefixes[channel_no],Sfile_datestr(time(0),1|2|256));
967  fclose(pktlog_fp);
968  xorriso->pktlog_fp= pktlog_fp= NULL;
969  }
970  if((flag & 8) && xorriso->stderr_fp != NULL) {
971  fclose(xorriso->stderr_fp);
972  xorriso->stderr_fp= NULL;
973  }
974  if(flag&(1<<15))
975  {ret= 1; goto ex;}
976  if((flag&2)) {
977  xorriso->logfile_fp[channel_no]= logfile_fp= fopen(text,"a");
978  if(logfile_fp==NULL)
979  {ret= 0; goto ex;}
980  fprintf(logfile_fp,
981  "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! xorriso log : %s : %s\n",
982  channel_prefixes[channel_no],