darylm503 4710c53dca AppPkg/Applications/Python: Add Python 2.7.2 sources since the release of Python 2.7.3 made them unavailable from the python.org web site.
These files are a subset of the python-2.7.2.tgz distribution from python.org.  Changed files from PyMod-2.7.2 have been copied into the corresponding directories of this tree, replacing the original files in the distribution.

Signed-off-by: daryl.mcdaniel@intel.com


git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@13197 6f19259b-4bc3-4df7-8a09-765794883524
2012-04-16 22:12:42 +00:00

59 lines
1.3 KiB
Python

#! /usr/bin/env python
# Python interface to the Internet finger daemon.
#
# Usage: finger [options] [user][@host] ...
#
# If no host is given, the finger daemon on the local host is contacted.
# Options are passed uninterpreted to the finger daemon!
import sys, string
from socket import *
# Hardcode the number of the finger port here.
# It's not likely to change soon...
#
FINGER_PORT = 79
# Function to do one remote finger invocation.
# Output goes directly to stdout (although this can be changed).
#
def finger(host, args):
s = socket(AF_INET, SOCK_STREAM)
s.connect((host, FINGER_PORT))
s.send(args + '\n')
while 1:
buf = s.recv(1024)
if not buf: break
sys.stdout.write(buf)
sys.stdout.flush()
# Main function: argument parsing.
#
def main():
options = ''
i = 1
while i < len(sys.argv) and sys.argv[i][:1] == '-':
options = options + sys.argv[i] + ' '
i = i+1
args = sys.argv[i:]
if not args:
args = ['']
for arg in args:
if '@' in arg:
at = string.index(arg, '@')
host = arg[at+1:]
arg = arg[:at]
else:
host = ''
finger(host, options + arg)
# Call the main function.
#
main()