/usr/bin/nccstrip2.py is in ncc 2.8-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 | #!/usr/bin/env python
# This file is installed and used automatically by ncc each time it
# "links" nccout object files.
import sys
have = {}
def getsub (line, set):
global outlines
TS = ''
TL = [ line ]
for j in instream:
if j[0] not in set:
break
j = j[:-1]
TS += j
TL.append (j)
if line in have:
X = have [line]
if type(X) == type (''):
if X == TS:
return
have [line] = [X, TS]
else:
for k in have [line]:
if k == TS:
return
have [line].append (TS)
else:
have [line] = TS
outlines += len (TL)
output ("\n".join (TL) + "\n")
infile, outfile = sys.argv [1:]
outlines = inlines = 0
def readinput (infile):
global inlines
for l in infile:
yield l
inlines += 1
instream = readinput (open (infile))
if infile == outfile:
replace = True
outfile = "nccstriptmp"
else:
replace = False
write = open (outfile, "w").write
def output (x):
global outlines
outlines += 1
write (x + "\n")
for i in instream:
if i [0] == '#':
continue
if i [0] == 'D':
getsub (i[:-1], 'FgGsS')
elif i [0] == 'P':
getsub (i[:-1], 'YL')
else:
output (i[:-1])
if inlines:
print "nccstrip: -%.2f%%"% ((inlines - outlines) * 100.0 / inlines)
if replace:
import os
os.rename ("nccstriptmp", infile)
|