From: Ian Jackson Date: Thu, 15 Dec 2011 00:57:51 +0000 (+0000) Subject: make-secnet-sites: refactor to break out new function "pfilepath" X-Git-Tag: debian/0.3.0_beta1~34 X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ian/git?p=secnet.git;a=commitdiff_plain;h=9b8369e07aeba5ed2c69fb4a7f74d07c8cebe015 make-secnet-sites: refactor to break out new function "pfilepath" No intentional functional change. Signed-off-by: Ian Jackson --- diff --git a/make-secnet-sites b/make-secnet-sites index 4c6f0f4..f102b1f 100755 --- a/make-secnet-sites +++ b/make-secnet-sites @@ -379,6 +379,11 @@ def pline(i): complain("unknown keyword '%s'"%(keyword)) +def pfilepath(pathname): + f=open(pathname) + pfile(pathname,f.readlines()) + f.close() + def pfile(name,lines): "Process a file" global file,line @@ -450,19 +455,14 @@ else: if not ok: print "caller not in group %s"%group sys.exit(1) - f=open(header) - headerinput=f.readlines() - f.close() - pfile(header,headerinput) + pfilepath(header) userinput=sys.stdin.readlines() pfile("user input",userinput) else: if len(sys.argv)>3: print "Too many arguments" sys.exit(1) - f=open(sys.argv[1]) - pfile(sys.argv[1],f.readlines()) - f.close() + pfilepath(sys.argv[1]) of=sys.stdout if len(sys.argv)>2: of=open(sys.argv[2],'w')