File: finger

package info (click to toggle)
newlisp 10.7.5-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, forky, sid, trixie
  • size: 6,248 kB
  • sloc: ansic: 33,280; lisp: 4,181; sh: 609; makefile: 215
file content (36 lines) | stat: -rwxr-xr-x 891 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#!/usr/bin/env newlisp
#
# v 1.1 changes for changed 'main-args'
# v 1.2 eliminated 'net-cleanup'
# v 1.3 replaced concat with append
# v 1.4 direct string form of net-send, eplace name with user
# v 1.5 change net-receive for 10.0
#

(define (finger nameSite , socket buffer user site)
	  (map set '(user site) (parse nameSite "@"))
	  (set 'socket (net-connect site 79))
	  (if (not socket)
	  	(begin
			(print "Could not connect\n")
			(exit)))
	  (if (not (net-send socket (append user "\r\n")))
	  	(print "no connection\n")
		(net-finger-receive socket)))
		
(define (net-finger-receive socket , str)
	(if (not (net-receive socket str 512)) 
		(print "Receive failed\n")
	(print "\n" str "\n"))
	(if socket (net-close socket)))

(set 'params (main-args))
(if (< (length params) 3) 
  (begin 
    (print "USAGE: finger name@host\n")
    (exit)))
(finger (nth 2 params))
(exit)

;eof;