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)  

aux_objects.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 <utime.h>
#include <dirent.h>
#include <errno.h>
#include "xorriso.h"
#include "xorriso_private.h"
Include dependency graph for aux_objects.c:

Go to the source code of this file.

Data Structures

struct  SplitparT
 
struct  DirseQ
 
struct  ExclusionS
 
struct  LinkiteM
 
struct  PermiteM
 

Functions

int Splitparts_new (struct SplitparT **o, int count, int flag)
 
int Splitparts_destroy (struct SplitparT **o, int count, int flag)
 
int Splitparts_set (struct SplitparT *o, int idx, char *name, int partno, int total_parts, off_t offset, off_t bytes, off_t total_bytes, int flag)
 
int Splitparts_get (struct SplitparT *o, int idx, char **name, int *partno, int *total_parts, off_t *offset, off_t *bytes, off_t *total_bytes, int flag)
 
int Splitpart__read_next_num (char *base_pt, char **next_pt, off_t *num, int flag)
 
int Splitpart__parse (char *name, int *partno, int *total_parts, off_t *offset, off_t *bytes, off_t *total_bytes, int flag)
 
int Splitpart__is_part_path (char *path, int flag)
 
int Splitpart__compose (char *adr, int partno, int total_parts, off_t offset, off_t bytes, off_t total_bytes, int flag)
 
int Splitparts_cmp (const void *v1, const void *v2)
 
int Splitparts_sort (struct SplitparT *o, int count, int flag)
 
int Dirseq_destroy (struct DirseQ **o, int flag)
 
int Dirseq_next_adrblock (struct DirseQ *o, char *replies[], int *reply_count, int max_replies, int flag)
 
int Dirseq_new (struct DirseQ **o, char *adr, int flag)
 
int Dirseq_set_next (struct DirseQ *o, struct DirseQ *next, int flag)
 
int Dirseq_get_next (struct DirseQ *o, struct DirseQ **next, int flag)
 
int Dirseq_get_adr (struct DirseQ *o, char **adrpt, int flag)
 
int Dirseq_rewind (struct DirseQ *o, int flag)
 
int Dirseq_next_adr (struct DirseQ *o, char reply[4096], int flag)
 
int Xorriso_lst_new_binary (struct Xorriso_lsT **lstring, char *data, int data_len, struct Xorriso_lsT *link, int flag)
 Create a new list item with arbitrary byte content. More...
 
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. More...
 
int Xorriso_lst_destroy (struct Xorriso_lsT **lstring, int flag)
 Destroy a single list item and connect its eventual list neighbors. More...
 
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. More...
 
int Xorriso_lst_append_binary (struct Xorriso_lsT **entry, char *data, int data_len, int flag)
 Create a new list item at the end of a given list. More...
 
struct Xorriso_lsTXorriso_lst_get_next (struct Xorriso_lsT *entry, int flag)
 Obtain the address of the next item in the chain of messages. More...
 
struct Xorriso_lsTXorriso_lst_get_prev (struct Xorriso_lsT *entry, int flag)
 Obtain the address of the previous item in the chain of messages. More...
 
char * Xorriso_lst_get_text (struct Xorriso_lsT *entry, int flag)
 Obtain the text message from the current list item. More...
 
int Xorriso_lst_detach_text (struct Xorriso_lsT *entry, int flag)
 
int Xorriso_lst_get_last (struct Xorriso_lsT *entry, struct Xorriso_lsT **last, int flag)
 
int Xorriso_lst_concat (struct Xorriso_lsT *first, struct Xorriso_lsT *second, int flag)
 
int Exclusions_new (struct ExclusionS **o, int flag)
 
int Exclusions_destroy (struct ExclusionS **o, int flag)
 
int Exclusions_add_not_paths (struct ExclusionS *o, int descrc, char **descrs, int pathc, char **paths, int flag)
 
int Exclusions_add_not_leafs (struct ExclusionS *o, char *not_leafs_descr, regex_t *re, int flag)
 
int Exclusions_match (struct ExclusionS *o, char *abs_path, int flag)
 
int Exclusions_get_descrs (struct ExclusionS *o, struct Xorriso_lsT **not_paths_descr, struct Xorriso_lsT **not_leafs_descr, int flag)
 
int Linkitem_new (struct LinkiteM **o, char *link_path, dev_t target_dev, ino_t target_ino, struct LinkiteM *next, int flag)
 
int Linkitem_destroy (struct LinkiteM **o, int flag)
 
int Linkitem_reset_stack (struct LinkiteM **o, struct LinkiteM *to, int flag)
 
int Linkitem_find (struct LinkiteM *stack, dev_t target_dev, ino_t target_ino, struct LinkiteM **result, int flag)
 
int Linkitem_get_link_count (struct LinkiteM *item, int flag)
 
int Permstack_push (struct PermiteM **o, char *disk_path, struct stat *stbuf, int flag)
 
int Permstack_pop (struct PermiteM **o, struct PermiteM *stopper, struct XorrisO *xorriso, int flag)
 

Variables

static char Splitpart_wordS [][16] = {"part_", "_of_", "_at_", "_with_", "_of_"}
 
static int Dirseq_buffer_sizE = 100
 

Function Documentation

◆ Dirseq_destroy()

int Dirseq_destroy ( struct DirseQ **  o,
int  flag 
)

Definition at line 336 of file aux_objects.c.

337 {
338  int i;
339 
340  if(*o==NULL)
341  return(0);
342  if((*o)->dirpt!=NULL)
343  closedir((*o)->dirpt);
344  if((*o)->buffer!=NULL) {
345  for(i=0;i<(*o)->buffer_size;i++)
346  if((*o)->buffer[i]!=NULL)
347  free((*o)->buffer[i]);
348  free((char *) (*o)->buffer);
349  }
350  free((char *) *o);
351  (*o)= NULL;
352  return(1);
353 }

Referenced by Dirseq_new(), Xorriso_add_tree(), Xorriso_findx(), Xorriso_obtain_pattern_files_x(), Xorriso_rmx(), Xorriso_show_dux_subs(), and Xorriso_sorted_dir_x().

◆ Dirseq_get_adr()

int Dirseq_get_adr ( struct DirseQ o,
char **  adrpt,
int  flag 
)

Definition at line 370 of file aux_objects.c.

371 {
372  *adrpt= o->adr;
373  return(1);
374 }
char adr[4096]
Definition: aux_objects.c:275

References DirseQ::adr.

◆ Dirseq_get_next()

int Dirseq_get_next ( struct DirseQ o,
struct DirseQ **  next,
int  flag 
)

Definition at line 363 of file aux_objects.c.

364 {
365  *next= o->next;
366  return(1);
367 }
struct DirseQ * next
Definition: aux_objects.c:283

References DirseQ::next.

◆ Dirseq_new()

int Dirseq_new ( struct DirseQ **  o,
char *  adr,
int  flag 
)

Definition at line 291 of file aux_objects.c.

295 {
296  int ret,i,severe_error;
297  struct DirseQ *m;
298 
299  m= *o= TSOB_FELD(struct DirseQ,1);
300  if(m==NULL)
301  return(-1);
302  m->adr[0]= 0;
303  m->dirpt= NULL;
304  m->count= 0;
305  m->buffer= NULL;
306  m->buffer_size= 0;
307  m->buffer_fill= 0;
308  m->buffer_rpt= 0;
309  m->next= NULL;
310  if(Sfile_str(m->adr, adr, 0)<=0)
311  {ret= -1; goto failed;}
312  m->buffer= TSOB_FELD(char *,Dirseq_buffer_sizE);
313  if(m->buffer==NULL)
314  {ret= -1; goto failed;}
316  for(i= 0;i<m->buffer_size;i++)
317  m->buffer[i]= NULL;
318  if(adr[0]==0)
319  m->dirpt= opendir(".");
320  else
321  m->dirpt= opendir(adr);
322  if(m->dirpt==NULL) {
323  severe_error= (errno && errno!=ENOENT && errno!=EACCES && errno!=ENOTDIR);
324  if(severe_error || !(flag&1))
325  fprintf(stderr,"opendir(%s) failed : %s\n",adr,strerror(errno));
326  ret= -severe_error;
327  goto failed;
328  }
329  return(1);
330 failed:;
331  Dirseq_destroy(o,0);
332  return(ret);
333 }
static int Dirseq_buffer_sizE
Definition: aux_objects.c:272
int Dirseq_destroy(struct DirseQ **o, int flag)
Definition: aux_objects.c:336
int Sfile_str(char target[4096], char *source, int flag)
Definition: sfile.c:836
#define TSOB_FELD(typ, count)
Definition: sfile.h:15
int buffer_size
Definition: aux_objects.c:279
char ** buffer
Definition: aux_objects.c:278
int buffer_rpt
Definition: aux_objects.c:281
int buffer_fill
Definition: aux_objects.c:280
int count
Definition: aux_objects.c:277
DIR * dirpt
Definition: aux_objects.c:276

References DirseQ::adr, DirseQ::buffer, DirseQ::buffer_fill, DirseQ::buffer_rpt, DirseQ::buffer_size, DirseQ::count, DirseQ::dirpt, Dirseq_buffer_sizE, Dirseq_destroy(), DirseQ::next, Sfile_str(), and TSOB_FELD.

Referenced by Xorriso_add_tree(), Xorriso_findx(), Xorriso_obtain_pattern_files_x(), Xorriso_rmx(), Xorriso_show_dux_subs(), and Xorriso_sorted_dir_x().

◆ Dirseq_next_adr()

int Dirseq_next_adr ( struct DirseQ o,
char  reply[4096],
int  flag 
)

Definition at line 384 of file aux_objects.c.

398 {
399  int ret;
400  struct dirent *entry;
401  char *name;
402 
403  static int override_flag_0= 0,override_flag_1= 32;
404  flag= (flag&~override_flag_0)|override_flag_1;
405 
406  if((flag&1) && o->buffer_rpt>=o->buffer_fill) {
407  /* permission to buffer and buffer empty : load a buffer */
408  ret= Dirseq_next_adrblock(o,o->buffer,&(o->buffer_fill),
409  o->buffer_size,2|4|(flag&16));
410  if(ret<=0)
411  return(ret);
412  o->buffer_rpt= 0;
413  if((flag&32) && o->buffer_fill<o->buffer_size && o->buffer_fill>0)
414  Sort_argv(o->buffer_fill,o->buffer,0);
415  }
416  if(o->buffer_rpt<o->buffer_fill && !(flag&4)) {
417  ret= Sfile_str(reply,o->buffer[o->buffer_rpt],0);
418  Sregex_string(&(o->buffer[o->buffer_rpt]),NULL,0);
419  if(ret<=0)
420  return(-1);
421  (o->buffer_rpt)++;
422  if(!(flag&2))
423  o->count++;
424  return(1);
425  }
426  do {
427  entry= readdir(o->dirpt);
428  if(entry==NULL) {
429  /* >>> how to distinguish error from EOF , do i need a (FILE *) ? */
430  return(0);
431  }
432  if(strlen(entry->d_name)>=SfileadrL) {
433  fprintf(stderr,"--- oversized directory entry (number %d) :\n %s",
434  o->count+1,entry->d_name);
435  return(-1);
436  }
437  name= entry->d_name;
438  if(flag&8)
439  break;
440  /* skip "." and ".." */
441  } while(name[0]=='.' && ((name[1]=='.' && name[2]==0) || name[1]==0));
442  if(Sfile_str(reply,name,0)<=0)
443  return(-1);
444  if(!(flag&2))
445  o->count++;
446  return(1);
447 }
int Dirseq_next_adrblock(struct DirseQ *o, char *replies[], int *reply_count, int max_replies, int flag)
Definition: aux_objects.c:450
#define SfileadrL
int Sort_argv(int argc, char **argv, int flag)
Definition: misc_funct.c:40
int Sregex_string(char **handle, char *text, int flag)
Definition: misc_funct.c:865

References DirseQ::buffer, DirseQ::buffer_fill, DirseQ::buffer_rpt, DirseQ::buffer_size, DirseQ::count, DirseQ::dirpt, Dirseq_next_adrblock(), Sfile_str(), SfileadrL, Sort_argv(), and Sregex_string().

Referenced by Dirseq_next_adrblock(), Xorriso_add_tree(), Xorriso_findx(), Xorriso_obtain_pattern_files_x(), Xorriso_rmx(), Xorriso_show_dux_subs(), and Xorriso_sorted_dir_x().

◆ Dirseq_next_adrblock()

int Dirseq_next_adrblock ( struct DirseQ o,
char *  replies[],
int *  reply_count,
int  max_replies,
int  flag 
)

Definition at line 450 of file aux_objects.c.

464 {
465  int i,ret;
466  char *reply= NULL;
467 
468  reply= TSOB_FELD(char, SfileadrL);
469  if(reply == NULL)
470  return(-1);
471 
472  *reply_count= 0;
473  for(i=0;i<max_replies;i++) {
474  ret= Dirseq_next_adr(o,reply,flag&(1|2|4));
475  if(ret<0)
476  goto ex;
477  if(ret==0)
478  break;
479  if(Sregex_string(&(replies[i]),reply,0)<=0)
480  {ret= -1; goto ex;}
481  (*reply_count)++;
482  }
483  if((*reply_count)==0)
484  {ret= 0; goto ex;}
485  if(flag&16)
486  Sort_argv(*reply_count,replies,0);
487  ret= 1;
488 ex:;
489  free(reply);
490  return(ret);
491 }
int Dirseq_next_adr(struct DirseQ *o, char reply[4096], int flag)
Definition: aux_objects.c:384

References Dirseq_next_adr(), SfileadrL, Sort_argv(), Sregex_string(), and TSOB_FELD.

Referenced by Dirseq_next_adr().

◆ Dirseq_rewind()

int Dirseq_rewind ( struct DirseQ o,
int  flag 
)

Definition at line 377 of file aux_objects.c.

378 {
379  rewinddir(o->dirpt);
380  return(1);
381 }

References DirseQ::dirpt.

Referenced by Xorriso_show_dux_subs().

◆ Dirseq_set_next()

int Dirseq_set_next ( struct DirseQ o,
struct DirseQ next,
int  flag 
)

Definition at line 356 of file aux_objects.c.

357 {
358  o->next= next;
359  return(1);
360 }

References DirseQ::next.

◆ Exclusions_add_not_leafs()

int Exclusions_add_not_leafs ( struct ExclusionS o,
char *  not_leafs_descr,
regex_t *  re,
int  flag 
)

Definition at line 764 of file aux_objects.c.

766 {
767  int ret;
768 
770  not_leafs_descr, strlen(not_leafs_descr)+1, 0);
771  if(ret<=0)
772  return(-1);
773  ret= Xorriso_lst_append_binary(&(o->not_leafs), (char *) re, sizeof(regex_t), 0);
774  if(ret<=0)
775  return(-1);
776  return(1);
777 }
int Xorriso_lst_append_binary(struct Xorriso_lsT **entry, char *data, int data_len, int flag)
Create a new list item at the end of a given list.
Definition: aux_objects.c:609
struct Xorriso_lsT * not_leafs
Definition: aux_objects.c:690
struct Xorriso_lsT * not_leafs_descr
Definition: aux_objects.c:687

References ExclusionS::not_leafs, ExclusionS::not_leafs_descr, and Xorriso_lst_append_binary().

Referenced by Xorriso_option_not_leaf().

◆ Exclusions_add_not_paths()

int Exclusions_add_not_paths ( struct ExclusionS o,
int  descrc,
char **  descrs,
int  pathc,
char **  paths,
int  flag 
)

Definition at line 730 of file aux_objects.c.

732 {
733  struct Xorriso_lsT *s, *new_s;
734  int i, ret;
735 
736  s= NULL;
737  if(o->not_paths_descr!=NULL)
738  for(s= o->not_paths_descr; s->next!=NULL; s= s->next);
739  for(i= 0; i<descrc; i++) {
740  ret= Xorriso_lst_new(&new_s, descrs[i], s, 0);
741  if(ret<=0)
742  return(ret);
743  if(o->not_paths_descr==NULL)
744  o->not_paths_descr= new_s;
745  s= new_s;
746  }
747  s= NULL;
748  if(o->not_paths!=NULL)
749  for(s= o->not_paths; s->next!=NULL; s= s->next);
750  for(i= 0; i<pathc; i++) {
751  ret= Xorriso_lst_new(&new_s, paths[i], s, 0);
752  if(ret<=0)
753  return(ret);
754  if(o->not_paths==NULL)
755  o->not_paths= new_s;
756  s= new_s;
757  }
758  return(1);
759 }
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
struct Xorriso_lsT * not_paths_descr
Definition: aux_objects.c:681
struct Xorriso_lsT * not_paths
Definition: aux_objects.c:684
struct Xorriso_lsT * next
Definition: aux_objects.h:70

References Xorriso_lsT::next, ExclusionS::not_paths, ExclusionS::not_paths_descr, and Xorriso_lst_new().

Referenced by Xorriso_option_not_paths().

◆ Exclusions_destroy()

int Exclusions_destroy ( struct ExclusionS **  o,
int  flag 
)

Definition at line 710 of file aux_objects.c.

711 {
712  struct Xorriso_lsT *s,*next;
713 
714  if((*o)==NULL)
715  return(0);
716  Xorriso_lst_destroy_all(&((*o)->not_paths_descr), 0);
717  Xorriso_lst_destroy_all(&((*o)->not_paths), 0);
718  Xorriso_lst_destroy_all(&((*o)->not_leafs_descr), 0);
719  for(s= (*o)->not_leafs; s!=NULL; s= next){
720  next= s->next;
721  regfree((regex_t *) s->text);
722  Xorriso_lst_destroy(&s, 0);
723  }
724  free((char *) *o);
725  (*o)= NULL;
726  return(1);
727 }
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
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
char * text
Definition: aux_objects.h:69

References Xorriso_lsT::next, Xorriso_lsT::text, Xorriso_lst_destroy(), and Xorriso_lst_destroy_all().

Referenced by Xorriso_destroy(), and Xorriso_option_not_mgt().

◆ Exclusions_get_descrs()

int Exclusions_get_descrs ( struct ExclusionS o,
struct Xorriso_lsT **  not_paths_descr,
struct Xorriso_lsT **  not_leafs_descr,
int  flag 
)

Definition at line 836 of file aux_objects.c.

839 {
840  *not_paths_descr= o->not_paths_descr;
841  *not_leafs_descr= o->not_leafs_descr;
842  return(1);
843 }

References ExclusionS::not_leafs_descr, and ExclusionS::not_paths_descr.

Referenced by Xorriso_status().

◆ Exclusions_match()

int Exclusions_match ( struct ExclusionS o,
char *  abs_path,
int  flag 
)

Definition at line 783 of file aux_objects.c.

784 {
785  struct Xorriso_lsT *s;
786  char *leaf= NULL, *leaf_pt;
787  regmatch_t match[1];
788  int ret, was_non_slash, l;
789 
790  /* test abs_paths */
791  if(flag&1) {
792  for(s= o->not_paths; s!=NULL; s= s->next) {
793  l= strlen(s->text);
794  if(strncmp(abs_path, s->text, l)==0)
795  if(abs_path[l]=='/' || abs_path[l]==0)
796  {ret= 1; goto ex;}
797  }
798  } else {
799  for(s= o->not_paths; s!=NULL; s= s->next)
800  if(strcmp(abs_path, s->text)==0)
801  {ret= 1; goto ex;}
802  }
803 
804  /* determine leafname */
805  was_non_slash= 0;
806  for(leaf_pt= abs_path+strlen(abs_path); leaf_pt >= abs_path; leaf_pt--) {
807  if(*leaf_pt=='/') {
808  if(was_non_slash) {
809  leaf_pt++;
810  break;
811  }
812  } else if(*leaf_pt!=0)
813  was_non_slash= 1;
814  }
815  if(strlen(leaf_pt)>=SfileadrL)
816  {ret= -1; goto ex;}
817  leaf= strdup(leaf_pt);
818  leaf_pt= strchr(leaf, '/');
819  if(leaf_pt!=NULL)
820  *leaf_pt= 0;
821 
822  /* test with leaf expressions */
823  for(s= o->not_leafs; s!=NULL; s= s->next) {
824  ret= regexec((regex_t *) s->text, leaf, 1, match, 0);
825  if(ret==0)
826  {ret= 2; goto ex;}
827  }
828  ret= 0;
829 ex:
830  if(leaf != NULL)
831  free(leaf);
832  return(ret);
833 }

References Xorriso_lsT::next, ExclusionS::not_leafs, ExclusionS::not_paths, SfileadrL, and Xorriso_lsT::text.

Referenced by Xorriso_path_is_excluded(), and Xorriso_path_is_hidden().

◆ Exclusions_new()

int Exclusions_new ( struct ExclusionS **  o,
int  flag 
)

Definition at line 695 of file aux_objects.c.

696 {
697  struct ExclusionS *m;
698 
699  m= *o= TSOB_FELD(struct ExclusionS, 1);
700  if(m==NULL)
701  return(-1);
702  m->not_paths_descr= NULL;
703  m->not_paths= NULL;
704  m->not_leafs_descr= NULL;
705  m->not_leafs= NULL;
706  return(1);
707 }

References ExclusionS::not_leafs, ExclusionS::not_leafs_descr, ExclusionS::not_paths, ExclusionS::not_paths_descr, and TSOB_FELD.

Referenced by Xorriso_new(), and Xorriso_option_not_mgt().

◆ Linkitem_destroy()

int Linkitem_destroy ( struct LinkiteM **  o,
int  flag 
)

Definition at line 883 of file aux_objects.c.

884 {
885  if((*o)==NULL)
886  return(0);
887  if((*o)->link_path!=NULL)
888  free((*o)->link_path);
889  free((char *) (*o));
890  *o= NULL;
891  return(1);
892 }

Referenced by Linkitem_new(), and Linkitem_reset_stack().

◆ Linkitem_find()

int Linkitem_find ( struct LinkiteM stack,
dev_t  target_dev,
ino_t  target_ino,
struct LinkiteM **  result,
int  flag 
)

Definition at line 915 of file aux_objects.c.

917 {
918  struct LinkiteM *m;
919 
920  for(m= stack; m!=NULL; m= m->next) {
921  if(target_dev == m->target_dev && target_ino == m->target_ino) {
922  *result= m;
923  return(1);
924  }
925  }
926  return(0);
927 }
struct LinkiteM * next
Definition: aux_objects.c:855
ino_t target_ino
Definition: aux_objects.c:853
dev_t target_dev
Definition: aux_objects.c:852

References LinkiteM::next, LinkiteM::target_dev, and LinkiteM::target_ino.

Referenced by Xorriso_hop_link().

◆ Linkitem_get_link_count()

int Linkitem_get_link_count ( struct LinkiteM item,
int  flag 
)

Definition at line 930 of file aux_objects.c.

931 {
932  return(item->link_count);
933 }
int link_count
Definition: aux_objects.c:854

References LinkiteM::link_count.

Referenced by Xorriso_hop_link().

◆ Linkitem_new()

int Linkitem_new ( struct LinkiteM **  o,
char *  link_path,
dev_t  target_dev,
ino_t  target_ino,
struct LinkiteM next,
int  flag 
)

Definition at line 859 of file aux_objects.c.

861 {
862  struct LinkiteM *m;
863 
864  m= *o= TSOB_FELD(struct LinkiteM,1);
865  if(m==NULL)
866  return(-1);
869  m->next= next;
870  m->link_count= 1;
871  if(next!=NULL)
872  m->link_count= m->next->link_count+1;
873  m->link_path= strdup(link_path);
874  if(m->link_path==NULL)
875  goto failed;
876  return(1);
877 failed:;
878  Linkitem_destroy(o, 0);
879  return(-1);
880 }
int Linkitem_destroy(struct LinkiteM **o, int flag)
Definition: aux_objects.c:883
char * link_path
Definition: aux_objects.c:851

References LinkiteM::link_count, LinkiteM::link_path, Linkitem_destroy(), LinkiteM::next, LinkiteM::target_dev, LinkiteM::target_ino, and TSOB_FELD.

Referenced by Xorriso_hop_link().

◆ Linkitem_reset_stack()

int Linkitem_reset_stack ( struct LinkiteM **  o,
struct LinkiteM to,
int  flag 
)

Definition at line 895 of file aux_objects.c.

896 {
897  struct LinkiteM *m, *m_next= NULL;
898 
899  /* Prevent memory corruption */
900  for(m= *o; m!=to; m= m->next)
901  if(m==NULL) { /* this may actually not happen */
902  *o= to;
903  return(-1);
904  }
905 
906  for(m= *o; m!=to; m= m_next) {
907  m_next= m->next;
908  Linkitem_destroy(&m, 0);
909  }
910  *o= to;
911  return(1);
912 }

References Linkitem_destroy(), and LinkiteM::next.

Referenced by Xorriso_add_tree(), Xorriso_findx(), Xorriso_restore_tree(), and Xorriso_show_dux_subs().

◆ Permstack_pop()

int Permstack_pop ( struct PermiteM **  o,
struct PermiteM stopper,
struct XorrisO xorriso,
int  flag 
)

Definition at line 975 of file aux_objects.c.

977 {
978  int ret;
979  struct utimbuf utime_buffer;
980  struct PermiteM *m, *m_next;
981 
982  if((*o)==stopper)
983  return(1);
984  for(m= *o; m!=NULL; m= m->next)
985  if(m->next==stopper)
986  break;
987  if(m==NULL) {
988  sprintf(xorriso->info_text,
989  "Program error: Permstack_pop() : cannot find stopper");
990  Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FATAL", 0);
991  return(-1);
992  }
993 
994  for(m= *o; m!=stopper; m= m_next) {
995  ret= chmod(m->disk_path, m->stbuf.st_mode);
996  if(ret==-1) {
997  if(xorriso!=NULL) {
998  sprintf(xorriso->info_text,
999  "Cannot change access permissions of disk directory: chmod %o ",
1000  (unsigned int) (m->stbuf.st_mode & 07777));
1001  Text_shellsafe(m->disk_path, xorriso->info_text, 1);
1002  Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, errno, "FAILURE",
1003  0);
1004  }
1005  }
1006  if(!(flag&1)) {
1007  ret= chown(m->disk_path, m->stbuf.st_uid, m->stbuf.st_gid);
1008  /* don't complain if it fails */
1009  if(!(flag&2)) {
1010  utime_buffer.actime= m->stbuf.st_atime;
1011  utime_buffer.modtime= m->stbuf.st_mtime;
1012  ret= utime(m->disk_path,&utime_buffer);
1013  if(ret==-1 && xorriso!=NULL) {
1014  sprintf(xorriso->info_text,
1015  "Cannot change timestamps of disk directory: ");
1016  Text_shellsafe(m->disk_path, xorriso->info_text, 1);
1017  Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, errno, "FAILURE",
1018  0);
1019  }
1020  }
1021  }
1022  m_next= m->next;
1023  free(m->disk_path);
1024  free((char *) m);
1025  *o= m_next;
1026  }
1027  return(1);
1028 }
char * Text_shellsafe(char *in_text, char *out_text, int flag)
Definition: misc_funct.c:1044
char * disk_path
Definition: aux_objects.c:940
struct stat stbuf
Definition: aux_objects.c:941
struct PermiteM * next
Definition: aux_objects.c:942
char info_text[10 *4096]
int Xorriso_msgs_submit(struct XorrisO *xorriso, int error_code, char msg_text[], int os_errno, char severity[], int flag)
Submit a problem message to the xorriso problem reporting and handling system.
Definition: text_io.c:2504

References PermiteM::disk_path, XorrisO::info_text, PermiteM::next, PermiteM::stbuf, Text_shellsafe(), and Xorriso_msgs_submit().

Referenced by Xorriso_handle_collision(), Xorriso_restore(), Xorriso_restore_make_hl(), Xorriso_restore_node_array(), Xorriso_restore_tree(), and Xorriso_rmx().

◆ Permstack_push()

int Permstack_push ( struct PermiteM **  o,
char *  disk_path,
struct stat *  stbuf,
int  flag 
)

Definition at line 946 of file aux_objects.c.

948 {
949  struct PermiteM *m;
950 
951  m= TSOB_FELD(struct PermiteM,1);
952  if(m==NULL)
953  return(-1);
954  m->disk_path= NULL;
955  memcpy(&(m->stbuf), stbuf, sizeof(struct stat));
956  m->next= *o;
957 
958  m->disk_path= strdup(disk_path);
959  if(m->disk_path==NULL)
960  goto failed;
961 
962  *o= m;
963  return(1);
964 failed:;
965  if(m->disk_path!=NULL)
966  free(m->disk_path);
967  free((char *) m);
968  return(-1);
969 }

References PermiteM::disk_path, PermiteM::next, PermiteM::stbuf, and TSOB_FELD.

Referenced by Xorriso_auto_chmod(), and Xorriso_restore_properties().

◆ Splitpart__compose()

int Splitpart__compose ( char *  adr,
int  partno,
int  total_parts,
off_t  offset,
off_t  bytes,
off_t  total_bytes,
int  flag 
)

Definition at line 218 of file aux_objects.c.

220 {
221  sprintf(adr, "%s%d%s%d%s", Splitpart_wordS[0], partno, Splitpart_wordS[1],
222  total_parts, Splitpart_wordS[2]);
223  if((offset % (1024*1024))==0 && offset>0) {
224  Sfile_off_t_text(adr+strlen(adr), offset / (1024*1024), 0);
225  strcat(adr, "m");
226  } else
227  Sfile_off_t_text(adr+strlen(adr), offset, 0);
228  strcat(adr, Splitpart_wordS[3]);
229  if((bytes % (1024*1024))==0) {
230  Sfile_off_t_text(adr+strlen(adr), bytes / (1024*1024), 0);
231  strcat(adr, "m");
232  } else
233  Sfile_off_t_text(adr+strlen(adr), bytes, 0);
234  strcat(adr, Splitpart_wordS[4]);
235  Sfile_off_t_text(adr+strlen(adr), total_bytes, 0);
236  return(1);
237 }
static char Splitpart_wordS[][16]
Definition: aux_objects.c:59
int Sfile_off_t_text(char text[80], off_t num, int flag)
Definition: sfile.c:389

References Sfile_off_t_text(), and Splitpart_wordS.

Referenced by Xorriso_graft_split(), and Xorriso_update_interpreter().

◆ Splitpart__is_part_path()

int Splitpart__is_part_path ( char *  path,
int  flag 
)

Definition at line 199 of file aux_objects.c.

200 {
201  int partno, total_parts, ret;
202  off_t offset, bytes, total_bytes;
203  char *name;
204 
205  name= strrchr(path, '/');
206  if(name == NULL)
207  name= path;
208  else
209  name++;
210  ret= Splitpart__parse(name, &partno, &total_parts, &offset, &bytes,
211  &total_bytes, 0);
212  return(ret > 0);
213 }
int Splitpart__parse(char *name, int *partno, int *total_parts, off_t *offset, off_t *bytes, off_t *total_bytes, int flag)
Definition: aux_objects.c:153

References Splitpart__parse().

◆ Splitpart__parse()

int Splitpart__parse ( char *  name,
int *  partno,
int *  total_parts,
off_t *  offset,
off_t *  bytes,
off_t *  total_bytes,
int  flag 
)

Definition at line 153 of file aux_objects.c.

156 {
157  int ret;
158  off_t num;
159  char *cpt, *ept;
160 
161  cpt= name;
162  if(strncmp(cpt, Splitpart_wordS[0], strlen(Splitpart_wordS[0])) != 0)
163  return(0);
164  ret= Splitpart__read_next_num(cpt, &ept, &num, 0);
165  if(ret<=0)
166  return(ret);
167  *partno= num;
168  cpt= ept;
169  if(strncmp(cpt, Splitpart_wordS[1], strlen(Splitpart_wordS[1])) != 0)
170  return(0);
171  ret= Splitpart__read_next_num(cpt, &ept, &num, 0);
172  if(ret<=0)
173  return(ret);
174  *total_parts= num;
175  cpt= ept;
176  if(strncmp(cpt, Splitpart_wordS[2], strlen(Splitpart_wordS[2])) != 0)
177  return(0);
178  ret= Splitpart__read_next_num(cpt, &ept, offset, 0);
179  if(ret<=0)
180  return(ret);
181  cpt= ept;
182  if(strncmp(cpt, Splitpart_wordS[3], strlen(Splitpart_wordS[3])) != 0)
183  return(0);
184  ret= Splitpart__read_next_num(cpt, &ept, bytes, 0);
185  if(ret<=0)
186  return(ret);
187  cpt= ept;
188  if(strncmp(cpt, Splitpart_wordS[4], strlen(Splitpart_wordS[4])) != 0)
189  return(0);
190  ret= Splitpart__read_next_num(cpt, &ept, total_bytes, 0);
191  if(ret<=0)
192  return(ret);
193  if(*ept != 0)
194  return(0);
195  return(1);
196 }
int Splitpart__read_next_num(char *base_pt, char **next_pt, off_t *num, int flag)
Definition: aux_objects.c:129

References Splitpart__read_next_num(), and Splitpart_wordS.

Referenced by Splitpart__is_part_path(), and Xorriso_identify_split().

◆ Splitpart__read_next_num()

int Splitpart__read_next_num ( char *  base_pt,
char **  next_pt,
off_t *  num,
int  flag 
)

Definition at line 129 of file aux_objects.c.

131 {
132  char *cpt, *ept, scale[4];
133  double sfak;
134 
135  *num= 0;
136  for(cpt= base_pt; *cpt!=0 && !isdigit(*cpt); cpt++);
137  if(*cpt==0)
138  return(0);
139  for(ept= cpt; *ept!=0 && isdigit(*ept); ept++)
140  *num= (*num)*10+(*ept)-'0';
141  scale[0]= '1';
142  scale[1]= *ept;
143  scale[2]= 0;
144  sfak= Scanf_io_size(scale, 0);
145  *num *= (off_t) sfak;
146  if(sfak > 1.0)
147  ept++;
148  *next_pt= ept;
149  return(1);
150 }
double Scanf_io_size(char *text, int flag)
Convert a text into a number of type double and multiply it by unit code [kmgtpe] (2^10 to 2^60) or [...
Definition: misc_funct.c:182

References Scanf_io_size().

Referenced by Splitpart__parse().

◆ Splitparts_cmp()

int Splitparts_cmp ( const void *  v1,
const void *  v2 
)

Definition at line 240 of file aux_objects.c.

241 {
242  struct SplitparT *p1, *p2;
243 
244  p1= (struct SplitparT *) v1;
245  p2= (struct SplitparT *) v2;
246 
247  if(p1->partno>p2->partno)
248  return(1);
249  if(p1->partno<p2->partno)
250  return(-1);
251  if(p1->offset>p2->offset)
252  return(1);
253  if(p1->offset<p2->offset)
254  return(-1);
255  return(0);
256 }
int partno
Definition: aux_objects.c:52
off_t offset
Definition: aux_objects.c:54

References SplitparT::offset, and SplitparT::partno.

Referenced by Splitparts_sort().

◆ Splitparts_destroy()

int Splitparts_destroy ( struct SplitparT **  o,
int  count,
int  flag 
)

Definition at line 81 of file aux_objects.c.

82 {
83  int i;
84 
85  if((*o)==NULL)
86  return(0);
87  for(i= 0; i<count; i++) {
88  if((*o)[i].name!=NULL)
89  free((*o)[i].name);
90  }
91  free(*o);
92  *o= NULL;
93  return(1);
94 }

Referenced by Xorriso_compare_2_files(), Xorriso_is_split(), Xorriso_restore_disk_object(), and Xorriso_update_interpreter().

◆ Splitparts_get()

int Splitparts_get ( struct SplitparT o,
int  idx,
char **  name,
int *  partno,
int *  total_parts,
off_t *  offset,
off_t *  bytes,
off_t *  total_bytes,
int  flag 
)

Definition at line 115 of file aux_objects.c.

118 {
119  *name= o[idx].name;
120  *partno= o[idx].partno;
121  *total_parts= o[idx].total_parts;
122  *offset= o[idx].offset;
123  *bytes= o[idx].bytes;
124  *total_bytes= o[idx].total_bytes;
125  return(1);
126 }
off_t bytes
Definition: aux_objects.c:55
off_t total_bytes
Definition: aux_objects.c:56
int total_parts
Definition: aux_objects.c:53
char * name
Definition: aux_objects.c:51

References SplitparT::bytes, SplitparT::name, SplitparT::offset, SplitparT::partno, SplitparT::total_bytes, and SplitparT::total_parts.

Referenced by Xorriso_compare_2_files(), Xorriso_identify_split(), Xorriso_restore_disk_object(), and Xorriso_update_interpreter().

◆ Splitparts_new()

int Splitparts_new ( struct SplitparT **  o,
int  count,
int  flag 
)

Definition at line 62 of file aux_objects.c.

63 {
64  int i;
65 
66  (*o)= TSOB_FELD(struct SplitparT, count);
67  if((*o)==NULL)
68  return(-1);
69  for(i= 0; i<count; i++) {
70  (*o)[i].name= NULL;
71  (*o)[i].partno= 0;
72  (*o)[i].total_parts= 0;
73  (*o)[i].offset= 0;
74  (*o)[i].bytes= 0;
75  (*o)[i].total_bytes= 0;
76  }
77  return(1);
78 }

References TSOB_FELD.

Referenced by Xorriso_identify_split().

◆ Splitparts_set()

int Splitparts_set ( struct SplitparT o,
int  idx,
char *  name,
int  partno,
int  total_parts,
off_t  offset,
off_t  bytes,
off_t  total_bytes,
int  flag 
)

Definition at line 97 of file aux_objects.c.

100 {
101  if(o[idx].name!=NULL)
102  free(o[idx].name);
103  o[idx].name= strdup(name);
104  if(o[idx].name==NULL)
105  return(-1);
106  o[idx].partno= partno;
107  o[idx].total_parts= total_parts;
108  o[idx].offset= offset;
109  o[idx].bytes= bytes;
110  o[idx].total_bytes= total_bytes;
111  return(1);
112 }

References SplitparT::bytes, SplitparT::name, SplitparT::offset, SplitparT::partno, SplitparT::total_bytes, and SplitparT::total_parts.

Referenced by Xorriso_identify_split().

◆ Splitparts_sort()

int Splitparts_sort ( struct SplitparT o,
int  count,
int  flag 
)

Definition at line 259 of file aux_objects.c.

260 {
261  qsort(o, (size_t) count, sizeof(struct SplitparT), Splitparts_cmp);
262  return(1);
263 }
int Splitparts_cmp(const void *v1, const void *v2)
Definition: aux_objects.c:240

References Splitparts_cmp().

Referenced by Xorriso_identify_split().

◆ Xorriso_lst_append_binary()

int Xorriso_lst_append_binary ( struct Xorriso_lsT **  entry,
char *  data,
int  data_len,
int  flag 
)

Create a new list item at the end of a given list.

Parameters
entryContains as input a pointer to a pointer to any existing list item. As output this list item pointer may be changed to the address of the new list item: if ((*entry == 0) || (flag & 1))
dataAn array of bytes to be copied into the new object
data_lenNumber of bytes to be copied
flagBitfield for control purposes bit0= Return new object address in *entry bit1= do not copy data (e.g. because *data is invalid) bit2= attach data directly by pointer rather than by copying
Returns
<=0 error, 1 ok

Definition at line 609 of file aux_objects.c.

611 {
612  struct Xorriso_lsT *target= NULL,*newby;
613 
614  if(*entry!=NULL)
615  for(target= *entry; target->next!=NULL; target= target->next);
616  if(Xorriso_lst_new_binary(&newby, data, data_len, target, flag & ~1)<=0)
617  return(-1);
618  if(*entry==NULL || (flag & 1))
619  *entry= newby;
620  return(1);
621 }
int Xorriso_lst_new_binary(struct Xorriso_lsT **lstring, char *data, int data_len, struct Xorriso_lsT *link, int flag)
Create a new list item with arbitrary byte content.
Definition: aux_objects.c:506

References Xorriso_lsT::next, and Xorriso_lst_new_binary().

Referenced by Exclusions_add_not_leafs(), Xorriso_external_filter(), Xorriso_option_map_l(), Xorriso_restore(), and Xorriso_write_to_msglist().

◆ Xorriso_lst_concat()

int Xorriso_lst_concat ( struct Xorriso_lsT first,
struct Xorriso_lsT second,
int  flag 
)

Definition at line 659 of file aux_objects.c.

661 {
662  struct Xorriso_lsT *last;
663 
664  Xorriso_lst_get_last(first, &last, 0);
665  if(last != NULL)
666  last->next= second;
667  if(second != NULL)
668  second->prev= last;
669  return(1);
670 }
int Xorriso_lst_get_last(struct Xorriso_lsT *entry, struct Xorriso_lsT **last, int flag)
Definition: aux_objects.c:649
struct Xorriso_lsT * prev
Definition: aux_objects.h:70

References Xorriso_lsT::next, Xorriso_lsT::prev, and Xorriso_lst_get_last().

Referenced by Xorriso_pull_outlists().

◆ Xorriso_lst_destroy()

int Xorriso_lst_destroy ( struct Xorriso_lsT **  lstring,
int  flag 
)

Destroy a single list item and connect its eventual list neighbors.

Parameters
lstringpointer to the pointer to be freed and set to NULL
flagunused yet, submit 0
Returns
0= *lstring was already NULL, 1= ok

Definition at line 571 of file aux_objects.c.

572 {
573  struct Xorriso_lsT *s;
574 
575  s= *lstring;
576  if(s==NULL)
577  return(0);
578  if(s->prev!=NULL)
579  s->prev->next= s->next;
580  if(s->next!=NULL)
581  s->next->prev= s->prev;
582  if(s->text!=NULL)
583  Smem_freE(s->text);
584  Smem_freE((char *) s);
585  if(!(flag&1))
586  *lstring= NULL;
587  return(1);
588 }
#define Smem_freE
Definition: sfile.h:17

References Xorriso_lsT::next, Xorriso_lsT::prev, Smem_freE, and Xorriso_lsT::text.

Referenced by Exclusions_destroy(), Xorriso_destroy_all_extf(), Xorriso_dialog_input(), Xorriso_external_filter(), Xorriso_lst_destroy_all(), Xorriso_lst_new_binary(), and Xorriso_sieve_filter_msg().

◆ Xorriso_lst_destroy_all()

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.

All pointers obtained by Xorriso_lst_get_text() become invalid by this. Apply this to each of the two list handles obtained by Xorriso_pull_outlists() when the lists are no longer needed.

Parameters
lstring*lstring will be freed and set to NULL. It is not dangerous to submit a pointer to a NULL-pointer.
flagunused yet, submit 0
Returns
-1= lstring was NULL (i.e. wrong use of this call), 0= *lstring was already NULL, 1= item actually disposed

Definition at line 591 of file aux_objects.c.

592 {
593  struct Xorriso_lsT *s,*next;
594 
595  if(lstring==NULL)
596  return(-1);
597  if((*lstring)==NULL)
598  return(0);
599  for(s= *lstring; s->prev!=NULL; s= s->prev);
600  for(;s!=NULL;s= next){
601  next= s->next;
602  Xorriso_lst_destroy(&s,0);
603  }
604  *lstring= NULL;
605  return(1);
606 }

References Xorriso_lsT::next, Xorriso_lsT::prev, and Xorriso_lst_destroy().

Referenced by Exclusions_destroy(), Xorriso_destroy(), Xorriso_destroy_di_array(), Xorriso_destroy_node_array(), Xorriso_jigdo_interpreter(), Xorriso_msg_filter_destroy(), Xorriso_msg_op_parse_bulk(), Xorriso_msg_watcher(), Xorriso_named_pipe_loop(), Xorriso_option_drive_class(), Xorriso_option_setfattr_listi(), Xorriso_sieve_clear_results(), Xorriso_start_msg_watcher(), Xorriso_stop_msg_watcher(), and Xorriso_toc_to_string().

◆ Xorriso_lst_detach_text()

int Xorriso_lst_detach_text ( struct Xorriso_lsT entry,
int  flag 
)

Definition at line 642 of file aux_objects.c.

643 {
644  entry->text= NULL;
645  return(1);
646 }

References Xorriso_lsT::text.

Referenced by Xorriso_destroy_all_extf(), and Xorriso_external_filter().

◆ Xorriso_lst_get_last()

int Xorriso_lst_get_last ( struct Xorriso_lsT entry,
struct Xorriso_lsT **  last,
int  flag 
)

Definition at line 649 of file aux_objects.c.

651 {
652  *last= NULL;
653  if(entry != NULL)
654  for((*last)= entry; (*last)->next != NULL; (*last)= (*last)->next);
655  return(1);
656 }

References Xorriso_lsT::next.

Referenced by Xorriso_lst_concat(), and Xorriso_status().

◆ Xorriso_lst_get_next()

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.

An iteration over the output of Xorriso_pull_outlists() starts at the returned result_list or info_list and ends when this function returns NULL.

Parameters
entryThe current list item
flagunused yet, submit 0
Returns
Pointer to the next list item or NULL if end of list. This pointer does not have to be freed.

Definition at line 624 of file aux_objects.c.

625 {
626  return(entry->next);
627 }

References Xorriso_lsT::next.

Referenced by Xorriso_destroy_all_extf(), Xorriso_dialog_input(), Xorriso_external_filter(), Xorriso_finish_hl_update(), Xorriso_get_pattern(), Xorriso_is_in_patternlist(), Xorriso_lookup_extf(), Xorriso_make_restore_path(), Xorriso_msg_op_parse_bulk(), Xorriso_perform_attr_from_list(), Xorriso_sieve_get_result(), Xorriso_status(), Xorriso_status_extf(), and Xorriso_toc_to_string().

◆ Xorriso_lst_get_prev()

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.

Parameters
entryThe current list item
flagunused yet, submit 0
Returns
Pointer to the previous list item or NULL if start of list. This pointer does not have to be freed.

Definition at line 630 of file aux_objects.c.

631 {
632  return(entry->prev);
633 }

References Xorriso_lsT::prev.

Referenced by Xorriso_status().

◆ Xorriso_lst_get_text()

char* Xorriso_lst_get_text ( struct Xorriso_lsT entry,
int  flag 
)

Obtain the text message from the current list item.

Parameters
entryThe current list item
flagunused yet, submit 0
Returns
Pointer to the text content of the list item. This pointer does not have to be freed.

Definition at line 636 of file aux_objects.c.

637 {
638  return(entry->text);
639 }

References Xorriso_lsT::text.

Referenced by Xorriso_destroy_all_extf(), Xorriso_dialog_input(), Xorriso_external_filter(), Xorriso_finish_hl_update(), Xorriso_get_pattern(), Xorriso_is_in_patternlist(), Xorriso_lookup_extf(), Xorriso_make_restore_path(), Xorriso_msg_op_parse_bulk(), Xorriso_perform_attr_from_list(), Xorriso_process_msg_lists(), Xorriso_set_filter(), Xorriso_sieve_get_result(), Xorriso_status(), Xorriso_status_extf(), and Xorriso_toc_to_string().

◆ Xorriso_lst_new()

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.

Parameters
lstringThe newly created object or NULL on failure
textA 0-terminated array of bytes
linkXorriso_lsT object to which the new object shall be linked
flagsee Xorriso_lst_new_binary
Returns
<=0 error, 1 ok

Definition at line 557 of file aux_objects.c.

559 {
560  int ret;
561 
562  ret= Xorriso_lst_new_binary(lstring,text,strlen(text)+1,link,flag);
563  return(ret);
564 }

References Xorriso_lsT::text, and Xorriso_lst_new_binary().

Referenced by Exclusions_add_not_paths(), Xorriso_jigdo_interpreter(), Xorriso_msg_op_parse_bulk(), Xorriso_named_pipe_loop(), Xorriso_new(), Xorriso_option_drive_class(), Xorriso_option_setfattr_listi(), Xorriso_option_update(), and Xorriso_sieve_filter_msg().

◆ Xorriso_lst_new_binary()

int Xorriso_lst_new_binary ( struct Xorriso_lsT **  lstring,
char *  data,
int  data_len,
struct Xorriso_lsT link,
int  flag 
)

Create a new list item with arbitrary byte content.

Parameters
lstringThe newly created object or NULL on failure
dataAn array of bytes to be copied into the new object
data_lenNumber of bytes to be copied
linkXorriso_lsT object to which the new object shall be linked
flagBitfield for control purposes bit0= insert before link rather than after it bit1= do not copy data (e.g. because *data is invalid) bit2= attach data directly by pointer rather than by copying
Returns
<=0 error, 1 ok

Definition at line 506 of file aux_objects.c.

508 {
509  struct Xorriso_lsT *s;
510 
511  s= TSOB_FELD(struct Xorriso_lsT,1);
512  if(s==NULL)
513  return(-1);
514  s->text= NULL;
515  s->next= s->prev= NULL;
516 
517  if(flag & 4) {
518  s->text= data;
519  } else {
520  if(data_len<=0)
521  goto failed;
522  s->text= Smem_malloC(data_len);
523  if(s->text==NULL)
524  goto failed;
525  if(!(flag&2))
526  memcpy(s->text,data,data_len);
527  }
528 
529  if(link==NULL) {
530  ;
531  } else if(flag&1) {
532  s->next= link;
533  s->prev= link->prev;
534  if(link->prev!=NULL)
535  link->prev->next= s;
536  link->prev= s;
537  } else {
538  s->prev= link;
539  s->next= link->next;
540  if(link->next!=NULL)
541  link->next->prev= s;
542  link->next= s;
543  }
544  *lstring= s;
545  return(1);
546 failed:;
547  *lstring= s;
548  Xorriso_lst_destroy(lstring,0);
549  return(-1);
550 }
#define Smem_malloC
Definition: sfile.h:16

References Xorriso_lsT::next, Xorriso_lsT::prev, Smem_malloC, Xorriso_lsT::text, TSOB_FELD, and Xorriso_lst_destroy().

Referenced by Xorriso_lst_append_binary(), and Xorriso_lst_new().

Variable Documentation

◆ Dirseq_buffer_sizE

int Dirseq_buffer_sizE = 100
static

Definition at line 272 of file aux_objects.c.

Referenced by Dirseq_new().

◆ Splitpart_wordS

char Splitpart_wordS[][16] = {"part_", "_of_", "_at_", "_with_", "_of_"}
static

Definition at line 59 of file aux_objects.c.

Referenced by Splitpart__compose(), and Splitpart__parse().