2908
|
1 ;;; TCP/IP stream emulation for GNU Emacs
|
|
2 ;; Copyright (C) 1988, 1989, 1993 Free Software Foundation, Inc.
|
|
3
|
|
4 ;;; Author: Masanobu Umeda
|
|
5 ;;; Maintainer: umerin@mse.kyutech.ac.jp
|
|
6
|
|
7 ;; This file is part of GNU Emacs.
|
|
8
|
|
9 ;; GNU Emacs is distributed in the hope that it will be useful,
|
|
10 ;; but WITHOUT ANY WARRANTY. No author or distributor
|
|
11 ;; accepts responsibility to anyone for the consequences of using it
|
|
12 ;; or for whether it serves any particular purpose or works at all,
|
|
13 ;; unless he says so in writing. Refer to the GNU Emacs General Public
|
|
14 ;; License for full details.
|
|
15
|
|
16 ;; Everyone is granted permission to copy, modify and redistribute
|
|
17 ;; GNU Emacs, but only under the conditions described in the
|
|
18 ;; GNU Emacs General Public License. A copy of this license is
|
|
19 ;; supposed to have been given to you along with GNU Emacs so you
|
|
20 ;; can know your rights and responsibilities. It should be in a
|
|
21 ;; file named COPYING. Among other things, the copyright notice
|
|
22 ;; and this notice must be preserved on all copies.
|
|
23
|
|
24 ;; Notes on TCP package:
|
|
25 ;;
|
|
26 ;; This package provides a TCP/IP stream emulation for GNU Emacs. If
|
|
27 ;; the function `open-network-stream' is not defined in Emacs, but
|
|
28 ;; your operating system has a capability of network stream
|
|
29 ;; connection, this tcp package can be used for communicating with
|
|
30 ;; NNTP server.
|
|
31 ;;
|
|
32 ;; The tcp package runs inferior process which actually does the role
|
|
33 ;; of `open-network-stream'. The program `tcp' provided with this
|
|
34 ;; package can be used for such purpose. Before loading the package,
|
|
35 ;; compile `tcp.c' and install it as `tcp' in a directory in the emacs
|
|
36 ;; search path. If you modify `tcp.c', please send diffs to the author
|
|
37 ;; of GNUS. I'll include some of them in the next releases.
|
|
38
|
|
39 (provide 'tcp)
|
|
40
|
|
41 (defvar tcp-program-name "tcp"
|
|
42 "*The name of the program emulating open-network-stream function.")
|
|
43
|
|
44 (defun open-network-stream (name buffer host service)
|
|
45 "Open a TCP connection for a service to a host.
|
|
46 Returns a subprocess-object to represent the connection.
|
|
47 Input and output work as for subprocesses; `delete-process' closes it.
|
|
48 Args are NAME BUFFER HOST SERVICE.
|
|
49 NAME is name for process. It is modified if necessary to make it unique.
|
|
50 BUFFER is the buffer (or buffer-name) to associate with the process.
|
|
51 Process output goes at end of that buffer, unless you specify
|
|
52 an output stream or filter function to handle the output.
|
|
53 BUFFER may be also nil, meaning that this process is not associated
|
|
54 with any buffer
|
|
55 Third arg is name of the host to connect to.
|
|
56 Fourth arg SERVICE is name of the service desired, or an integer
|
|
57 specifying a port number to connect to."
|
|
58 (let ((proc (start-process name buffer
|
|
59 tcp-program-name
|
|
60 host
|
|
61 (if (stringp service)
|
|
62 service
|
|
63 (int-to-string service))
|
|
64 )))
|
|
65 (process-kill-without-query proc)
|
|
66 ;; Return process
|
|
67 proc
|
|
68 ))
|