Guido van Rossum | 8bcd301 | 1995-04-28 14:31:36 +0000 | [diff] [blame^] | 1 | "Customize this file to change the default client etc." |
| 2 | |
| 3 | import string |
| 4 | |
| 5 | HOST = 'voorn.cwi.nl' |
| 6 | PORT = 4127 |
| 7 | DIRECTORY = '/ufs/guido/voorn/python-RCS/Demo/pdist' |
| 8 | VERBOSE = 1 |
| 9 | |
| 10 | def openrcsclient(opts = []): |
| 11 | "open an RCSProxy client based on a list of options returned by getopt" |
| 12 | import RCSProxy |
| 13 | host = HOST |
| 14 | port = PORT |
| 15 | directory = DIRECTORY |
| 16 | verbose = VERBOSE |
| 17 | for o, a in opts: |
| 18 | if o == '-h': |
| 19 | host = a |
| 20 | if ':' in host: |
| 21 | i = string.find(host, ':') |
| 22 | host, p = host[:i], host[i+1:] |
| 23 | if p: |
| 24 | port = string.atoi(p) |
| 25 | if o == '-p': |
| 26 | port = string.atoi(a) |
| 27 | if o == '-d': |
| 28 | directory = a |
| 29 | if o == '-v': |
| 30 | verbose = verbose + 1 |
| 31 | if o == '-q': |
| 32 | verbose = 0 |
| 33 | address = (host, port) |
| 34 | x = RCSProxy.RCSProxyClient(address, verbose) |
| 35 | if directory: |
| 36 | x.cd(directory) |
| 37 | return x |