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