"Fossies" - the Fresh Open Source Software Archive

Member "xorriso-1.5.4/xorriso/sfile.h" (30 Jan 2021, 4570 Bytes) of package /linux/misc/xorriso-1.5.4.pl02.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. For more information about "sfile.h" see the Fossies "Dox" file reference documentation and the last Fossies "Diffs" side-by-side code changes report: 1.5.2_vs_1.5.4.

    1 
    2 /* xorriso - creates, loads, manipulates and burns ISO 9660 filesystem images.
    3 
    4    Copyright 2007-2020 Thomas Schmitt, <scdbackup@gmx.net>
    5 
    6    Provided under GPL version 2 or later.
    7 
    8    This file contains declarations of functions around files and strings.
    9 */
   10 
   11 
   12 #ifndef Xorriso_pvt_sfile_includeD
   13 #define Xorriso_pvt_sfile_includeD yes
   14 
   15 #define TSOB_FELD(typ, count) (typ *) calloc(1, (count)*sizeof(typ));
   16 #define Smem_malloC malloc
   17 #define Smem_freE free
   18 
   19 #define Xorriso_alloc_meM(pt, typ, count) { \
   20   pt= (typ *) calloc(1, (count) * sizeof(typ)); \
   21   if(pt == NULL) { \
   22     Xorriso_no_malloc_memory(xorriso, NULL, 0); \
   23     ret= -1; \
   24     goto ex; \
   25   } }
   26 
   27 #define Xorriso_free_meM(pt) { \
   28   if(pt != NULL) \
   29     free((char *) pt); \
   30   }
   31 
   32 
   33 #define SfileadrL 4096
   34 
   35 
   36 int Sfile_str(char target[SfileadrL], char *source, int flag); 
   37  
   38 double Sfile_microtime(int flag);
   39   
   40 int Sfile_add_to_path(char path[SfileadrL], char *addon, int flag);
   41   
   42 int Sfile_scale(double value, char *result, int siz, double thresh, int flag);
   43   
   44 int Sfile_destroy_argv(int *argc, char ***argv, int flag);
   45 
   46 int Sfile_count_char(char *text, char to_count);
   47 
   48  
   49 /*
   50  bit0= do not ignore trailing slash
   51  bit1= do not ignore empty components (other than the empty root name)
   52 */
   53 int Sfile_count_components(char *path, int flag);
   54 
   55 /*
   56  @param flag
   57  bit0= return -1 if file is missing
   58  bit1= return a hardlink with siblings as type 5
   59  bit2= evaluate eventual link target rather than the link object itself
   60  bit3= return a socket or a char device as types 7 or 8 rather than 0
   61  @return
   62   0=unknown
   63   1=regular
   64   2=directory
   65   3=symbolic link
   66   4=named pipe
   67   5=multiple hardlink (with bit1)
   68   6=block device
   69   7=socket (with bit3)
   70   8=character device (with bit3)
   71  | 1024 if interpreted as /dev/fd/#fd#
   72  | 2048 if interpreted as /dev/fd/#fd# and not fstatable
   73 */
   74 int Sfile_type(char *filename, int flag);
   75 
   76 /* @param flag bit0= only encode inside quotes
   77                bit1= encode < 32 outside quotes except 7, 8, 9, 10, 12, 13
   78                bit2= encode in any case above 126
   79                bit3= encode in any case shellsafe:
   80                      <=42 , 59, 60, 62, 63, 92, 94, 96, >=123
   81 */
   82 int Sfile_bsl_encoder(char **result, char *text, size_t text_len, int flag);
   83 
   84 int Sfile_argv_bsl(int argc, char ***argv, int flag);
   85 
   86 /*
   87  bit0= read progname as first argument from line
   88  bit1= just release argument list argv and return
   89  bit2= abort with return(0) if incomplete quotes are found
   90  bit3= eventually prepend missing '-' to first argument read from line
   91  bit4= like bit2 but only check quote completeness, do not allocate memory
   92  bit5+6= interpretation of backslashes:
   93        0= no interpretation, leave unchanged
   94        1= only inside double quotes
   95        2= outside single quotes
   96        3= everywhere
   97  bit7= append a NULL element to argv
   98 */
   99 int Sfile_make_argv(char *progname, char *line, int *argc, char ***argv,
  100                     int flag);
  101 int Sfile_sep_make_argv(char *progname, char *line, char *separators,
  102                         int max_argc, int *argc, char ***argv, int flag);
  103 
  104 /* YYMMDD[.hhmm[ss]] */
  105 int Sfile_decode_datestr(struct tm *reply, char *text, int flag);
  106 
  107 int Sfile_off_t_text(char text[80], off_t num, int flag);
  108 int Sfile_text_to_off_t(char *text, off_t *num, int flag);
  109 
  110 int Sfile_leafname(char *path, char leafname[SfileadrL], int flag);
  111 
  112 /* @param flag bit0= do not clip of carriage return at line end
  113 */
  114 char *Sfile_fgets_n(char *line, int maxl, FILE *fp, int flag);
  115 
  116 /*
  117  bit0=with hours+minutes
  118  bit1=with seconds
  119 
  120  bit8= local time rather than UTC
  121 */
  122 char *Sfile_datestr(time_t tim, short int flag);
  123 
  124 /* Converts backslash codes into single characters:
  125     \a BEL 7 , \b BS 8 , \e ESC 27 , \f FF 12 , \n LF 10 , \r CR 13 ,
  126     \t  HT 9 , \v VT 11 , \\ \ 92
  127     \[0-9][0-9][0-9] octal code , \x[0-9a-f][0-9a-f] hex code ,
  128     \cX control-x (ascii(X)-64)
  129    @param upto  maximum number of characters to examine for backslash.
  130                 The scope of a backslash (0 to 3 characters) is not affected.
  131    @param eaten returns the difference in length between input and output
  132    @param flag bit0= only determine *eaten, do not convert
  133                bit1= convert \000 to binary 0
  134 */
  135 int Sfile_bsl_interpreter(char *text, int upto, int *eaten, int flag);
  136 
  137 int Sfile_prepend_path(char *prefix, char path[SfileadrL], int flag);
  138 
  139 int Sfile_home_adr_s(char *filename, char *fileadr, int fa_size, int flag);
  140 
  141 int Sfile_get_dev_fd_no(char *filename, int flag);
  142 
  143 int Sfile_flatten_utf8_heads(char *name, int idx, int flag);
  144 
  145 #endif /* ! Xorriso_pvt_sfile_includeD */
  146