15261
|
1 ;;; tcp.el --- TCP/IP stream emulation for GNU Emacs
|
14169
|
2
|
2908
|
3 ;; Copyright (C) 1988, 1989, 1993 Free Software Foundation, Inc.
|
|
4
|
14169
|
5 ;; Author: Masanobu Umeda
|
|
6 ;; Maintainer: umerin@mse.kyutech.ac.jp
|
2908
|
7
|
|
8 ;; This file is part of GNU Emacs.
|
|
9
|
2909
|
10 ;; GNU Emacs is free software; you can redistribute it and/or modify
|
|
11 ;; it under the terms of the GNU General Public License as published by
|
|
12 ;; the Free Software Foundation; either version 2, or (at your option)
|
|
13 ;; any later version.
|
2908
|
14
|
2909
|
15 ;; GNU Emacs is distributed in the hope that it will be useful,
|
|
16 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
17 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
18 ;; GNU General Public License for more details.
|
|
19
|
|
20 ;; You should have received a copy of the GNU General Public License
|
14169
|
21 ;; along with GNU Emacs; see the file COPYING. If not, write to the
|
|
22 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
|
23 ;; Boston, MA 02111-1307, USA.
|
2909
|
24
|
|
25 ;;; Commentary:
|
2908
|
26
|
|
27 ;; Notes on TCP package:
|
|
28 ;;
|
|
29 ;; This package provides a TCP/IP stream emulation for GNU Emacs. If
|
|
30 ;; the function `open-network-stream' is not defined in Emacs, but
|
|
31 ;; your operating system has a capability of network stream
|
|
32 ;; connection, this tcp package can be used for communicating with
|
|
33 ;; NNTP server.
|
|
34 ;;
|
|
35 ;; The tcp package runs inferior process which actually does the role
|
|
36 ;; of `open-network-stream'. The program `tcp' provided with this
|
|
37 ;; package can be used for such purpose. Before loading the package,
|
|
38 ;; compile `tcp.c' and install it as `tcp' in a directory in the emacs
|
|
39 ;; search path. If you modify `tcp.c', please send diffs to the author
|
|
40 ;; of GNUS. I'll include some of them in the next releases.
|
|
41
|
2909
|
42 ;;; Code:
|
|
43
|
2908
|
44 (provide 'tcp)
|
|
45
|
|
46 (defvar tcp-program-name "tcp"
|
|
47 "*The name of the program emulating open-network-stream function.")
|
|
48
|
|
49 (defun open-network-stream (name buffer host service)
|
|
50 "Open a TCP connection for a service to a host.
|
|
51 Returns a subprocess-object to represent the connection.
|
|
52 Input and output work as for subprocesses; `delete-process' closes it.
|
|
53 Args are NAME BUFFER HOST SERVICE.
|
|
54 NAME is name for process. It is modified if necessary to make it unique.
|
|
55 BUFFER is the buffer (or buffer-name) to associate with the process.
|
|
56 Process output goes at end of that buffer, unless you specify
|
|
57 an output stream or filter function to handle the output.
|
|
58 BUFFER may be also nil, meaning that this process is not associated
|
|
59 with any buffer
|
|
60 Third arg is name of the host to connect to.
|
|
61 Fourth arg SERVICE is name of the service desired, or an integer
|
|
62 specifying a port number to connect to."
|
|
63 (let ((proc (start-process name buffer
|
|
64 tcp-program-name
|
|
65 host
|
|
66 (if (stringp service)
|
|
67 service
|
|
68 (int-to-string service))
|
|
69 )))
|
|
70 (process-kill-without-query proc)
|
|
71 ;; Return process
|
|
72 proc
|
|
73 ))
|
2909
|
74
|
|
75 ;;; tcp.el ends here
|