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