21 isPermanent=False
22 isHT=False
23 isStatus=False
24
25 if not (args.doStatus or args.doPermanent or args.doHT):
26 print "please specify doStatus, doPermanent, and/or doHT"
27 return
28
29
30 for line in OTxt:
31 if "permanent Status" in line:
32 isPermanent=True
33 if "HT Status" in line:
34 isHT=True
35 if "Status" in line and not ("permanent" in line or "HT" in line):
36 isStatus=True
37 if (args.doPermanent and not isPermanent) or (args.doHT and not isHT) or (args.doStatus and not isStatus):
38 print "check your inputs, they don't have the requested Status type"
39 return
40
41
42
43 for line in ITxt:
44 line=line.replace(" "," ")
45 line=line[0].
replace(
" ",
"")+line[1:]
46 line=line[:-1]+line[-1].
replace(
" ",
"")
47 tokens=line.split(" ")
48 if len(tokens)<6:
49 if not "Status:" in tokens:
50 print "length not satisfied: ",tokens
51 continue
52 Inewtokens.append(line.split("\n")[0])
53
54
55 seenStart=False
56 seenEnd=False
57 for line in OTxt:
58 line=line.replace(" "," ")
59 line=line[0].
replace(
" ",
"")+line[1:]
60 if isPermanent or isStatus:
61 line=line.replace("257","1")
62 line=line[:-1]+line[-1].
replace(
" ",
"")
63 if (isHT
or isStatus)
and "2" in line.split(
" ")[-1].
split(
"\n")[0]:
64
65 continue
66 tokens=line.split(" ")
67 if args.doPermanent:
68 if (not seenEnd) and "permanent" in tokens:
69 seenStart=True
70 elif seenStart and "Status:" in tokens:
71 seenEnd=True
72 elif args.doHT:
73 if (not seenEnd) and "HT" in tokens:
74 seenStart=True
75 elif seenStart and "Status:" in tokens:
76 seenEnd=True
77 elif args.doStatus:
78 if (not seenEnd) and "Status:" in tokens and not ("HT" in tokens or "permanent" in tokens):
79 seenStart=True
80 elif seenStart and ("HT" in tokens or "permanent" in tokens):
81 seenEnd=True
82 if seenStart and not seenEnd:
83 if len(tokens)<6 :
84 if not "Status:" in tokens:
85 print "length not satisfied: ",tokens
86 continue
87 Onewtokens.append(tokens[0]+" " \
88 +tokens[2]+" " \
89 +tokens[4]+" " \
90 +tokens[3]+" " \
91 +tokens[1]+" " \
92 +tokens[5].
split(
"\n")[0] \
93 )
94
95 print set(Inewtokens) ^
set(Onewtokens)
96
std::string replace(std::string s, const std::string &s2, const std::string &s3)
std::vector< std::string > split(const std::string &s, const std::string &t=":")