This file is indexed.

/usr/bin/ustr-import is in libustr-dev 1.0.4-3+b2.

This file is owned by root:root, with mode 0o755.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
#! /bin/sh -e

INCDIR=/usr/include
SHRDIR=/usr/share/libustr-dev
VERS=1.0
VERS_FULL=1.0.4
autoconf_64b=1
autoconf_vsnprintf=0

dbg=false
fulldbg=false
cfiles=false
defbytes=1
exact=0
usesz=0

cmdname="`basename $0`"

usage()
{
  echo " Format: $cmdname [-d][d] [-c] [-b b] [-e 1|0] [-s 1|0] gdb|all|<section> ..."
  echo "     List of options:"
  echo "         -d    = Turn debugging on, assert() trigger etc."
  echo "         -d    = Turn extra debugging on"
  echo "         -c    = Import/use .c files, instead of headers only"
  echo "         -b    = Specify default ref. bytes size: 0, 1, 2, 4 or 8"
  echo "         -e    = Exact allocations used by default"
  echo "         -s    = Sized value included by default"
  echo "     List of sections:"
  echo "         all   = All of the following"
  echo "         b     = Working with binary numbers in NBO format"
  echo "         cmp   = Comparing, strcmp() for Ustr's"
  echo "         cntl  = Control options dynamically"
  echo "         fmt   = Formatted output, sprintf() for Ustr's"
  echo "         gdb   = Copy just the .gdbinit file to the local dir"
  echo "         ins   = Inserting data"
  echo "         io    = Input Output"
  echo "         main  = The core, strcat() and delete for Ustr's"
  echo "         parse = Parsing integers, Ie. Nice versions of strtol()"
  echo "         pool  = A bundled memory pool API"
  echo "         replace = Replacing all occurances of data"
  echo "         sc    = Shortcut functions for Ustr's"
  echo "         set   = Setting data, strcpy() for Ustr's"
  echo "         split = Slit the data, strtok() / strsep() for Ustr's"
  echo "         spn   = Spanning, strspn() / strcspn() for Ustr's"
  echo "         srch  = Searching, strchr() / strstr() for Ustr's"
  echo "         sub   = Substituting data"
  echo "         utf8  = Working with UTF8"
  echo ""
  echo "     Ustr Version: $VERS_FULL"
  exit $1
}

if [ "x$1" = "x--help" ]; then
  usage 0
fi

if [ "x$1" = "x-dd" ]; then
  dbg=true
  fulldbg=true
  shift
else
if [ "x$1" = "x-d" ]; then
  dbg=true
  shift
fi

if [ "x$1" = "x-d" ]; then
  fulldbg=true
  shift
fi
fi

if [ "x$1" = "x-c" ]; then
  cfiles=true
  shift
fi

if [ "x$1" = "x-b" ]; then
  shift
  defbytes="$1"
  shift
fi

if [ "x$1" = "x-e" ]; then
  shift
  exact="$1"
  shift
fi

if [ "x$1" = "x-s" ]; then
  shift
  usesz="$1"
  shift
fi

all=false
b=false
cmp=false
cntl=false
fmt=false
ins=false
io=false
main=false
parse=false
pool=false
repl=false
sc=false
set=false
split=false
spn=false
srch=false
sub=false
utf8=false

gdb=false

for i in $@; do
  case "$i" in
    all)     all=true              ;;
    b)       b=true;     main=true ;;
    cmp)     cmp=true;   main=true ;;
    cntl)    cntl=true   main=true ;;
    fmt)     fmt=true;   main=true ;;
    gdb)     gdb=true;             ;;
    ins)     ins=true;   main=true ;;
    io)      io=true;    main=true ;;
    main)                main=true ;;
    parse)   parse=true; main=true ;;
    pool)    pool=true;  main=true ;;
    replace) repl=true;  main=true ;;
    sc)      sc=true;    main=true ;;
    set)     set=true;   main=true ;;
    split)   split=true; main=true ;;
    spn)     spn=true;   main=true ;;
    srch)    srch=true;  main=true ;;
    sub)     sub=true;   main=true ;;
    utf8)    utf8=true;  main=true ;;
    *)
      exec 1>&2
      usage 1
      ;;
  esac
done

if $all; then
  b=true
  cmp=true
  cntl=true
  fmt=true
  gdb=true
  ins=true
  io=true
  main=true
  parse=true
  pool=true
  repl=true
  sc=true
  set=true
  spn=true
  srch=true
  split=true
  sub=true
  utf8=true
else
  if $split; then
    set=true
    spn=true
    srch=true
  fi
  if $repl; then
    set=true
    spn=true
    srch=true
    sub=true
  fi
  if $sub; then
    ins=true
    srch=true
  fi
  if $sc; then
    spn=true
  fi
  if $spn; then
    srch=true
    utf8=true
  fi
  if $srch; then
    cmp=true
  fi

  # *.c requires file to compile...
  if $sc && $cfiles; then
    utf8=true
  fi
  if $sub && $cfiles; then
    fmt=true
  fi
  if $set && $cfiles; then
    fmt=true
  fi
  if $ins && $cfiles; then
    fmt=true
  fi
fi

if $gdb; then
  cp "$SHRDIR/.gdbinit" .
  if ! $main; then
    exit;
  fi
else
  if ! $main; then
    exec 1>&2
    usage 1
  fi
  cp "$SHRDIR/.gdbinit" .
fi

if $cntl && ! $cfiles; then
 cntl=false
 echo "Warn: Can't do dynamic configuration without cfiles." 1>&2
fi

# ---------------------------------------------
# Copy all the files locally...
# ---------------------------------------------
copy()
{
  name="$1"
  cp "$INCDIR/ustr-$name.h" .
  if test -f "$SHRDIR/ustr-$name-internal.h"; then
    cp "$SHRDIR/ustr-$name-internal.h" .
  fi

  if test -f "$SHRDIR/ustr-$name-code.h"; then
    cp "$SHRDIR/ustr-$name-code.h" .
  fi

  if $cfiles && test -f "$SHRDIR/ustr-$name-opt-code.c"; then
    if $dbg; then
      cp "$SHRDIR/ustr-$name-dbg-code.c" .
    else
      cp "$SHRDIR/ustr-$name-opt-code.c" .
    fi
  fi
}

if $b; then
  copy b
fi

if $cmp; then
  copy cmp
fi

if $cntl; then
  copy cntl
  cp "$SHRDIR/malloc-check.h" .
fi

# conf is generated from scratch
copy compiler

if $fmt; then
  copy fmt
fi

if $ins; then
  copy ins
fi

if $io; then
  copy io
fi

copy main

if $parse; then
  copy parse
fi

if $pool; then
  copy pool
fi

if $repl; then
  copy replace
fi

if $sc; then
  copy sc
fi

if $set; then
  copy set
fi

if $split; then
  copy split
fi

if $spn; then
  copy spn
fi

if $srch; then
  copy srch
fi

if $sub; then
  copy sub
fi

if $utf8; then
  copy utf8
fi

# ---------------------------------
# Generate a valid ustr-conf.h file
# ---------------------------------
outname=ustr-conf.h
if $dbg; then
  outname=ustr-conf-debug.h
fi

echo "/* This file is auto generated from $cmdname */" > $outname
echo >> $outname
echo >> $outname
echo '#ifndef USTR_CONF_H'   >> $outname
echo '#define USTR_CONF_H 1' >> $outname
echo >> $outname
echo >> $outname

if $cfiles; then
  # So they can still override, just change the default
  echo "/* The default is now to link against libc. */" >> $outname
  echo "#ifndef USTR_CONF_INCLUDE_CODEONLY_HEADERS"     >> $outname
  echo '#define USTR_CONF_INCLUDE_CODEONLY_HEADERS 0'   >> $outname
  echo "#endif" >> $outname
  echo >> $outname
else
  echo "/* Same default, newer position. */"            >> $outname
  echo "#ifndef USTR_CONF_INCLUDE_CODEONLY_HEADERS"     >> $outname
  echo '#define USTR_CONF_INCLUDE_CODEONLY_HEADERS 1'   >> $outname
  echo "#endif" >> $outname
  echo >> $outname
fi

  echo "/* We can't: if defined(__GLIBC__) && (!defined(_GNU_SOURCE) || !_GNU_SOURCE)" >> $outname
  echo " *  because by the time we've included a libc header it's too late. */ " >> $outname
  echo "#ifndef _GNU_SOURCE" >> $outname
  echo "#define _GNU_SOURCE 1" >> $outname
  echo "#endif" >> $outname
  echo >> $outname
  echo >> $outname

if $cfiles; then
  echo "#if ! USTR_CONF_INCLUDE_CODEONLY_HEADERS" >> $outname
  echo "/* If you aren't just using the headers, these should match the .c's */" >> $outname
  echo >> $outname
  echo "# define USTR_CONF_HAVE_64bit_SIZE_MAX $autoconf_64b" >> $outname
  echo "# define USTR_CONF_HAVE_RETARDED_VSNPRINTF $autoconf_vsnprintf" >> $outname
if [ -f "/usr/include/stdint.h" ]; then
  echo "# define USTR_CONF_HAVE_STDINT_H 1" >> $outname
else
  echo "# define USTR_CONF_HAVE_STDINT_H 0" >> $outname
fi

if $cntl; then
  echo "# define USTR_CONF_HAVE_DYNAMIC_CONF 1" >> $outname
else
  echo "# define USTR_CONF_HAVE_DYNAMIC_CONF 0" >> $outname
fi
  echo >> $outname
  echo "# define USTR_CONF_USE_DYNAMIC_CONF  USTR_CONF_HAVE_DYNAMIC_CONF" >> $outname


  echo >> $outname
  echo "# define USTR_CONF_REF_BYTES   $defbytes" >> $outname
  echo "# define USTR_CONF_EXACT_BYTES $exact"    >> $outname
  echo "# define USTR_CONF_USE_SIZE    $usesz"    >> $outname

  echo >> $outname
if $dbg; then
  echo '# define USTR_CONF_USE_ASSERT 1' >> $outname
else
  echo '# define USTR_CONF_USE_ASSERT 0' >> $outname
fi

if $fulldbg; then
  echo '# define USTR_CONF_USE_EOS_MARK 1' >> $outname
else
  echo '# define USTR_CONF_USE_EOS_MARK 0' >> $outname
fi

  echo >> $outname

  echo "#else" >> $outname
fi

  echo "/* Same defaults, but can be altered at will. */" >> $outname
  echo "/* Note that you really shouldn't alter the _HAVE_* ones. */" >> $outname
  echo >> $outname
  echo "# ifndef USTR_CONF_HAVE_64bit_SIZE_MAX"               >> $outname
  echo "# define USTR_CONF_HAVE_64bit_SIZE_MAX $autoconf_64b" >> $outname
  echo "# endif" >> $outname
  echo "# ifndef USTR_CONF_HAVE_RETARDED_VSNPRINTF"           >> $outname
  echo "# define USTR_CONF_HAVE_RETARDED_VSNPRINTF $autoconf_vsnprintf" >> $outname
  echo "# endif" >> $outname
  echo "# ifndef USTR_CONF_HAVE_STDINT_H" >> $outname
if [ -f "/usr/include/stdint.h" ]; then
  echo "# define USTR_CONF_HAVE_STDINT_H 1" >> $outname
else
  echo "# define USTR_CONF_HAVE_STDINT_H 0" >> $outname
fi
  echo "# endif" >> $outname
  echo "# ifndef USTR_CONF_HAVE_DYNAMIC_CONF" >> $outname
if $cntl; then
  echo "# define USTR_CONF_HAVE_DYNAMIC_CONF 1" >> $outname
else
  echo "# define USTR_CONF_HAVE_DYNAMIC_CONF 0" >> $outname
fi
  echo "# endif" >> $outname
  echo >> $outname
  echo "/* no USE_DYNAMIC_CONF ... leave as default */" >> $outname
  echo >> $outname
  echo "# ifndef USTR_CONF_REF_BYTES"           >> $outname
  echo "# define USTR_CONF_REF_BYTES $defbytes" >> $outname
  echo "# endif" >> $outname
  echo "# ifndef USTR_CONF_EXACT_BYTES"         >> $outname
  echo "# define USTR_CONF_EXACT_BYTES $exact"  >> $outname
  echo "# endif" >> $outname
  echo "# ifndef USTR_CONF_USE_SIZE"            >> $outname
  echo "# define USTR_CONF_USE_SIZE    $usesz"  >> $outname
  echo "# endif" >> $outname

  echo >> $outname
  echo "# ifndef USTR_CONF_USE_ASSERT"          >> $outname
if $dbg; then
  echo '# define USTR_CONF_USE_ASSERT 1'        >> $outname
else
  echo '# define USTR_CONF_USE_ASSERT 0'        >> $outname
fi
  echo "# endif" >> $outname

  echo "# ifndef USTR_CONF_USE_EOS_MARK"   >> $outname
if $fulldbg; then
  echo '# define USTR_CONF_USE_EOS_MARK 1' >> $outname
else
  echo '# define USTR_CONF_USE_EOS_MARK 0' >> $outname
fi
  echo "# endif" >> $outname

if $cfiles; then
  echo >> $outname
  echo "#endif" >> $outname
  echo >> $outname
fi

echo >> $outname
echo >> $outname
echo '#endif' >> $outname

# ----------------------------
# Generate a valid ustr.h file
# ----------------------------
outname=ustr.h
if $dbg; then
  outname=ustr-debug.h
fi


echo "/* This file is auto generated from $cmdname */" > $outname
echo >> $outname
echo >> $outname
echo '#ifndef USTR_H'   >> $outname
echo '#define USTR_H 1' >> $outname
echo >> $outname
echo >> $outname

if $cfiles; then
  # So they can still override, just change the default
  echo "#ifndef USTR_CONF_INCLUDE_CODEONLY_HEADERS" >> $outname
  echo '#define USTR_CONF_INCLUDE_CODEONLY_HEADERS 0' >> $outname
  echo "#endif" >> $outname
  echo >> $outname
fi

echo >> $outname

echo "#ifndef USTR_DEBUG"   >> $outname
if $dbg; then
echo "#define USTR_DEBUG 1" >> $outname
else
echo "#define USTR_DEBUG 0" >> $outname
fi
echo "#endif"               >> $outname

echo >> $outname
echo >> $outname

# Everything deps. on CONF
echo "#if USTR_DEBUG" >> $outname
echo '# include "ustr-conf-debug.h"' >> $outname
echo "#else" >> $outname
echo '# include "ustr-conf.h"' >> $outname
echo "#endif" >> $outname

echo >> $outname

# Everything deps. on MAIN
echo '#include "ustr-main.h"'   >> $outname

if $b; then
  echo '#include "ustr-b.h"' >> $outname
fi

if $cmp; then
  echo '#include "ustr-cmp.h"'  >> $outname
fi

# ustr-cntl is hacked into ustr-main.h ... for various reasons.

if $fmt; then
  echo '#include "ustr-fmt.h"'  >> $outname
fi

if $io; then
  echo '#include "ustr-io.h"' >> $outname
fi

if $ins; then # INS weak deps. on FMT
  echo '#include "ustr-ins.h"' >> $outname
fi

if $parse; then
  echo '#include "ustr-parse.h"'  >> $outname
fi

if $pool; then
  echo '#include "ustr-pool.h"'  >> $outname
fi

if $set; then # SET weak deps. on FMT
  echo '#include "ustr-set.h"'  >> $outname
fi

if $srch; then
  echo '#include "ustr-srch.h"' >> $outname
fi

if $spn; then # SPN deps. on SRCH and weak deps. on UTF8
  echo '#include "ustr-spn.h"'  >> $outname
fi

if $split; then # SPLIT hard deps. on set, spn, srch
  echo '#include "ustr-split.h"' >> $outname
fi

if $sub; then # SUB hard deps. on ins, srch, weak dep. on FMT
  echo '#include "ustr-sub.h"' >> $outname
fi

if $repl; then # REPLACE hard deps. on set, spn, srch, sub
  echo '#include "ustr-replace.h"' >> $outname
fi

if $utf8; then
  echo '#include "ustr-utf8.h"' >> $outname
fi

if $sc; then
  echo '#include "ustr-sc.h"' >> $outname
fi

echo >> $outname
echo >> $outname
echo '#endif' >> $outname