diff --git a/mkapachepw.py b/mkapachepw.py index 67adbb3..5d6a4e9 100755 --- a/mkapachepw.py +++ b/mkapachepw.py @@ -9,7 +9,7 @@ # Program Information PROGNAME = "mkapachepw" -RCSID = "$Id: mkapachepw.py,v 1.120 2005/04/11 22:11:24 root Exp $" +RCSID = "$Id: mkapachepw.py,v 1.121 2005/04/12 07:10:35 root Exp $" VERSION = RCSID.split()[2] # Copyright Information @@ -107,7 +107,7 @@ ##### uTable = [PROGNAME + " " + VERSION + " - %s\n" % COPYRIGHT, - "usage: " + PROGNAME + " [-sGUguIicqhv]", + "usage: " + PROGNAME + " [-sGUguIicqOohv]", " where,", " -s do not process system password/group files (default: process these files)", " -G list of groups to include (+group | +GID) or exclude (-group | -GID) (default: none)", @@ -118,6 +118,8 @@ " -i file include file containing other user information (default: none)", " -c do not permit entries to be overwritten (default: allow - only warn)", " -q quiet mode - suppresses warning messages", + " -O file group file name, - selects stdout (default: ./.htgroups)", + " -o file user file name, - selects stdout (default: ./.htusers)", " -h print this help information", " -v print detailed version information", ] @@ -294,7 +296,7 @@ OPTIONS = envopt.split() + OPTIONS try: - opts, args = getopt.getopt(OPTIONS, '-sG:U:g:u:I:i:cqhv') + opts, args = getopt.getopt(OPTIONS, '-sG:U:g:u:I:i:cqO:o:hv') except getopt.GetoptError: Usage() sys.exit(1) @@ -332,6 +334,10 @@ ALLOWCOLLISIONS = False if opt == "-q": QUIET = True + if opt == "-O": + GRFILE = val + if opt == "-o": + USRFILE = val if opt == "-h": Usage() sys.exit(0) @@ -434,7 +440,10 @@ # Group File try: - grfile = open(GRFILE, "w") + if GRFILE == '-': + grfile = sys.stdout + else: + grfile = open(GRFILE, "w") except: ErrorMsg(eFILEOPEN % GRFILE) sys.exit(3) @@ -456,7 +465,10 @@ # Password File try: - pwfile = open(USRFILE, "w") + if USRFILE == '-': + pwfile = sys.stdout + else: + pwfile = open(USRFILE, "w") except: ErrorMsg(eFILEOPEN % USRFILE) sys.exit(3)