This file is indexed.

/usr/lib/sptk/bin/gseries is in sptk 3.9-1.

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
#!/bin/csh -f
# ----------------------------------------------------------------- #
#             The Speech Signal Processing Toolkit (SPTK)           #
#             developed by SPTK Working Group                       #
#             http://sp-tk.sourceforge.net/                         #
# ----------------------------------------------------------------- #
#                                                                   #
#  Copyright (c) 1984-2007  Tokyo Institute of Technology           #
#                           Interdisciplinary Graduate School of    #
#                           Science and Engineering                 #
#                                                                   #
#                1996-2015  Nagoya Institute of Technology          #
#                           Department of Computer Science          #
#                                                                   #
# All rights reserved.                                              #
#                                                                   #
# Redistribution and use in source and binary forms, with or        #
# without modification, are permitted provided that the following   #
# conditions are met:                                               #
#                                                                   #
# - Redistributions of source code must retain the above copyright  #
#   notice, this list of conditions and the following disclaimer.   #
# - Redistributions in binary form must reproduce the above         #
#   copyright notice, this list of conditions and the following     #
#   disclaimer in the documentation and/or other materials provided #
#   with the distribution.                                          #
# - Neither the name of the SPTK working group nor the names of its #
#   contributors may be used to endorse or promote products derived #
#   from this software without specific prior written permission.   #
#                                                                   #
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND            #
# CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,       #
# INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF          #
# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE          #
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS #
# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,          #
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED   #
# TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,     #
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON #
# ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,   #
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY    #
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE           #
# POSSIBILITY OF SUCH DAMAGE.                                       #
# ----------------------------------------------------------------- #

#########################################################################
#                                                                       #
#   Draw a discrete series                                              #
#                                                                       #
#                                               2012.11  T.Okada        #
#                                                                       #
#########################################################################

onintr clean

set path    = ( /usr/lib/sptk/bin $path )
set sptkver = '3.9'
set cvsid   = '$Id: gseries.in,v 1.9 2015/12/14 05:45:40 uratec Exp $'

set cmnd = $0
set cmnd = $cmnd:t
set file

@ start     = 0
@ term      = -1
@ numscreen = 5
@ numdata   = 50
set ymax    = 50
set pen     = 1
set F       = 1
set type    = f
set mtype   = "\1"
set magic   = 0
set MAGIC   = 0

set flagy2      = 0
set flagfile    = 0
set flagnumdata = 0
set flagnumscreen = 0
set flagy       = 0
set flagmagic   = 0
set flagMAGIC   = 0
set magic_count = 0
set MAGIC_count = 0

@ i = 0
while ($i < $#argv)
        @ i++
        switch ("$argv[$i]")
        case -s:
                @ i++
                set start = $argv[$i]
                breaksw
        case -e:
                @ i++
                set term = $argv[$i]
                breaksw
        case -n:
                @ i++
                @ numdata = $argv[$i]
                set flagnumdata = 1
                breaksw
        case -i:
                @ i++
                set numscreen = $argv[$i]
                set flagnumscreen = 1
                breaksw
        case -y:
                @ i++
                set ymax = $argv[$i]
                set flagy = 1
                breaksw
        case -y2:
                @ i++
                set ymin = $argv[$i]
                set flagy = 1
                set flagy2 = 1
                breaksw
        case -m:
                @ i++
                set mtype = "\$argv[$i]"
                breaksw
        case -p:
                @ i++
                set pen = $argv[$i]
                breaksw
        case -F:
                @ i++
                set F   = $argv[$i]
                breaksw
        case -magic:
                @ i++
                set magic = $argv[$i]
                set flagmagic = 1
                @ magic_count++
                breaksw
        case -MAGIC:
                @ i++
                set MAGIC = $argv[$i]
                set flagMAGIC = 1
                @ MAGIC_count++
                breaksw
        case +c:
                set type = c
                breaksw
        case +s:
                set type = s
                breaksw
        case +i3:
                set type = i3
                breaksw
        case +i:
                set type = i
                breaksw
        case +l:
                set type = l
                breaksw
        case +le:
                set type = le
                breaksw
        case +C:
                set type = C
                breaksw
        case +S:
                set type = S
                breaksw
        case +I:
                set type = I
                breaksw
        case +I3:
                set type = I3
                breaksw
        case +L:
                set type = L
                breaksw
        case +LE:
                set type = LE
                breaksw
        case +f:
                set type = f
                breaksw
        case +d:
                set type = d
                breaksw
        case +de:
                set type = de
                breaksw
        case -h:
                set exit_status = 0
                goto usage
                breaksw
        default:
                set file = "$argv[$i]"
                set flagfile = 1
                if ( ! -f "$file" ) then
                        echo2 "${cmnd} : Cannot open file ${file}\!"
                        set exit_status = 1
                        goto usage
                endif
                breaksw
        endsw
end

if ( $magic_count > 1 || $MAGIC_count > 1 ) then
        echo2 "${cmnd} : Can't specify -magic or -MAGIC option multiple times\!"
        set exit_status = 1
        goto usage
endif

# when input stream is stdin
if ("$file" == "") then
    rm -fr /tmp/sptk-gseries-$uid-$$
    cat > /tmp/sptk-gseries-$uid-$$
    set file=/tmp/sptk-gseries-$uid-$$
endif

if ( ($start != 0) || ($term > 0) ) then
    if ( $flagmagic && $flagMAGIC ) then
               x2x +${type}f "$file" | sopr -magic $magic -MAGIC $MAGIC | x2x +f${type} > /tmp/$$
    else if ( $flagmagic ) then
        if ( $term < 0 ) then
           set wctmp = `x2x +${type}a "$file" | wc -l`
             @ wctmp = `echo "$wctmp - 1" | bc -l`
        else
           set wctmp = `echo "$term" | bc -l`
        endif
           set mwc = `x2x +${type}f "$file" | bcut -s $start -e $wctmp | sopr -magic $magic | x2x +fa | wc -l` 
           x2x +${type}f "$file" | bcut -s $start -e $wctmp | sopr -magic $magic | x2x +f${type} > /tmp/$$
           @ reduced = `echo "$wctmp + 1 - $start - $mwc" | bc -l`
           @ term = `echo "$wctmp - $reduced + 1" | bc -l`
           set mterm = `echo "$mwc - 1" | bc -l`
           x2x +${type}f /tmp/$$ | bcp -S $start -l $mwc -s 0 -e $mterm -f 0 | x2x +f${type} > /tmp/$$-1
           cat /tmp/$$-1 > /tmp/$$
    else if ( $flagMAGIC ) then
               echo2 "${cmnd} : -MAGIC option need magic number\!"
               set exit_status = 1
               goto usage
    else
        cat "$file" > /tmp/$$
    endif
else
    if ( $flagmagic && $flagMAGIC ) then
           x2x +${type}f "$file" | sopr -magic $magic -MAGIC $MAGIC | x2x +f${type} > /tmp/$$
    else if ( $flagmagic ) then
           x2x +${type}f "$file" | sopr -magic $magic | x2x +f${type} > /tmp/$$
    else if ( $flagMAGIC ) then
           echo2 "${cmnd} : -MAGIC option need magic number\!"
           set exit_status = 1
           goto usage
    else
        cat "$file" > /tmp/$$
    endif
endif

rm -fr /tmp/sptk-gseries-$uid-$$

set file = /tmp/$$

goto main

usage:
        echo2 ''
        echo2 " $cmnd - draw a discrete series"
        echo2 ''
        echo2 '  usage:'
        echo2 "       $cmnd [ options ] [ infile ] > stdout"
        echo2 '  options:'
        echo2 '       -F  F         : factor                        [1]'
        echo2 '       -s  s         : start point                   [0]'
        echo2 '       -e  e         : end point                     [EOF]'
        echo2 '       -n  n         : data number of one screen     [N/A]'
        echo2 '       -i  i         : number of screen              [5]'
        echo2 '       -y  ymax      : maximum amplitude             [N/A]'
        echo2 '       -y2 ymin      : minimum amplitude             [-ymax]'
        echo2 '       -m  mtype     : mark type                     [1]'
        echo2 '       -p  p         : pen number                    [1]'
        echo2 '       -magic  magic : remove magic number           [N/A]'
        echo2 '       -MAGIC  MAGIC : replace magic number by MAGIC [N/A]'
        echo2 '       +type         : input data type               [f]'
        echo2 '                        c  (char)         C  (unsigned char) '
        echo2 '                        s  (short)        S  (unsigned short)'
        echo2 '                        i3 (int, 3byte)   I3 (unsigned int, 3byte)'
        echo2 '                        i  (int)          I  (unsigned int)'
        echo2 '                        l  (long)         L  (unsigned long)'
        echo2 '                        le (long long)    LE (unsigned long) '
        echo2 '                        f  (float)        d  (double)'
        echo2 '                        de (long double)'
        echo2 '       -h            : print this message'
        echo2 '  infile:'
        echo2 '       impluse response                              [stdin]'
        echo2 '  stdout:'
        echo2 '       XY-plotter command'
        echo2 '  notice:'
        echo2 '       If options of amplitude are not used,'
        echo2 '        value of amplitude is automatically determined.'
        echo2 '       If -n option is not used,'
        echo2 '        entire impluse response is displayed.'
        echo2 '       Can not use -n option and -i option.'
        echo2 '       If -magic option is not given,'
        echo2 '        return error.'                    
        echo2 '       If -magic or -MAGIC option is given mutiple times,'
        echo2 '       return error.'
        echo2 ''
        echo2 " SPTK: version $sptkver"
        echo2 " CVS Info: $cvsid"
        echo2 ''
exit $exit_status

main:

if ( $flagnumdata && $flagnumscreen ) then
          echo2 "${cmnd} : Cannot use -i and -n at the same time\!"
          set exit_status = 1
          goto usage
else if ( $flagnumscreen ) then
        if ( $term > 0 ) then
                @ wc = $term
        else
                set wc = ` x2x +${type}a $file | wc -l `
        endif
        @ wc = $wc - $start
        @ allnumdata = $wc
        @ rest = $wc % $numscreen
        @ wc /= $numscreen
        if ($rest) @ wc++
        @ numdata = $wc
else if ( $flagnumdata ) then
        if ( $term > 0 ) then
                @ wc = $term
        else
                set wc = ` x2x +${type}a $file | wc -l `
        endif
        @ wc = $wc - $start
        @ allnumdata = $wc
        @ rest = $wc % $numdata
        @ numscreen = $wc / $numdata
        if ($rest) @ numscreen++
else
        if ( $term > 0 ) then
                @ wc = $term
        else
                set wc = ` x2x +${type}a $file | wc -l `
        endif
        @ wc = $wc - $start
        @ allnumdata = $wc
        @ rest = $wc % $numscreen
        @ wc /= $numscreen
        if ($rest) @ wc++
        @ numdata = $wc
endif

if ( ! $flagy ) then
        set val = (`x2x +${type}f < $file | sopr -ABS  | minmax -o 2 | x2x +fa`)

	set ymax = $val
	set ymin = -$val
endif

if ( ! $flagy2 ) then
        set ymin = -$ymax
endif

set width  = 1.7 
set height = 0.4

@ n1  = $numdata - 1
@ end = $start + $n1

set ox  = `echo "20 * $F" | bc -l`
set oy  = `echo "225 * $F" | bc -l`

@ xs  = $start
@ xe  = $xs + $n1

if ( $numdata < 10 ) then
        @ dx = 1
else
        @ dx = $numdata / 10
endif

set numscreentmp = $numscreen
set count = `echo "$start" | bc -l`

while ( $numscreen > 0 )

        @ i = 0
        set xscale = ()
        set x = 0

        while (1)
               @ x = $dx * $i + $xs
            if ( $x <= $xe - $dx ) then
                 set xscale = ($xscale $x)
               @ i++
            else 
                 set xscale = ($xscale $x)
                 break
            endif
        end

        set xsw = `echo "$xs - 0.01" | bc -l`
        set xew = `echo "$xe + 0.01" | bc -l`

        @ tmp = $numscreen % 5
        echo "x $xsw $xew" >! /tmp/$$-$tmp
        echo "y $ymin $ymax" >> /tmp/$$-$tmp
        echo "xscale $xscale" >> /tmp/$$-$tmp
        echo "yscale $ymin $ymax" >> /tmp/$$-$tmp
        echo "ygrid 0" >> /tmp/$$-$tmp

        if ( ($numscreen == 1) && ($numdata > ($allnumdata % $numscreentmp)) ) then
        @ end = $term
        endif

     foreach line (`x2x +${type}f < $file | bcut -s $start -e $end | x2x +fa`)
       echo "box $count 0 $count $line" >> /tmp/$$-$tmp
       echo "$count $line $mtype" >> /tmp/$$-$tmp
       @ count += 1
     end

        fig -o $ox $oy -W $width -H $height -p $pen -F $F /tmp/$$-$tmp

        @ numscreen--
        set oy  =  `echo "$oy - 50 * $F" | bc -l`
        @ xs    += $numdata
        @ xe    += $numdata
        @ start += $numdata
        @ end   += $numdata

end

clean:

/bin/rm -f /tmp/$$

set i = 4
while ( $i >= 0 )
/bin/rm -f /tmp/$$-$i
@ i--
end