#!/usr/bin/env python import birchscript import os import os.path import sys # TEXTWIN - a c-shell script (version 30 Oct 94) # Start textedit with a specified fontsize # Set default parameters FONTLIB = "/usr/lib/fonts/fixedwidthfonts" FONTSIZE = "18" FONTNAME = "cour.b" FILENAME = "" ##################################################################### # Read options from the command line and set parameters #################################################################### numargs = len(sys.argv) if numargs != 0: #--------------------------------------------------- #parameters given in command line mode = "command" index = 1 while index <= numargs: current_arg = sys.argv[index] if current_arg == "-s": index += 1 FONTSIZE = sys.argv[index] elif current_arg == "-h": print 'Usage: textwin [-s fontsize | -h]' exit else: FILENAME = current_arg index += 1 ##################################################################### # Run the window in the background. #################################################################### birchscript.forkrun(["textedit", "-Wt", os.path.join(FONTLIB, FONTNAME + "." + FONTSIZE), FILENAME])