diff options
| author | Richard M. Stallman | 2002-05-30 17:12:53 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 2002-05-30 17:12:53 +0000 |
| commit | 7aaacaff5b0198da233d761483f0ead18358d36e (patch) | |
| tree | 7cbaf646a25e1dd65826c9f994971a4f7f4171e1 | |
| parent | 9cd450a4f09c0b59656dd0ef846265dae53ce511 (diff) | |
| download | emacs-7aaacaff5b0198da233d761483f0ead18358d36e.tar.gz emacs-7aaacaff5b0198da233d761483f0ead18358d36e.zip | |
(open-network-stream, open-network-stream-nowait)
(open-network-stream-server, process-kill-without-query): Moved from simple.el.
| -rw-r--r-- | lisp/subr.el | 83 |
1 files changed, 83 insertions, 0 deletions
diff --git a/lisp/subr.el b/lisp/subr.el index 2636ccadea9..e6b0ca945a4 100644 --- a/lisp/subr.el +++ b/lisp/subr.el | |||
| @@ -913,6 +913,89 @@ evaluated whenever that feature is `provide'd." | |||
| 913 | This makes or adds to an entry on `after-load-alist'. | 913 | This makes or adds to an entry on `after-load-alist'. |
| 914 | FILE should be the name of a library, with no directory name." | 914 | FILE should be the name of a library, with no directory name." |
| 915 | (eval-after-load file (read))) | 915 | (eval-after-load file (read))) |
| 916 | |||
| 917 | ;;; make-network-process wrappers | ||
| 918 | |||
| 919 | (if (featurep 'make-network-process) | ||
| 920 | (progn | ||
| 921 | |||
| 922 | (defun open-network-stream (name buffer host service) | ||
| 923 | "Open a TCP connection for a service to a host. | ||
| 924 | Returns a subprocess-object to represent the connection. | ||
| 925 | Input and output work as for subprocesses; `delete-process' closes it. | ||
| 926 | Args are NAME BUFFER HOST SERVICE. | ||
| 927 | NAME is name for process. It is modified if necessary to make it unique. | ||
| 928 | BUFFER is the buffer (or buffer-name) to associate with the process. | ||
| 929 | Process output goes at end of that buffer, unless you specify | ||
| 930 | an output stream or filter function to handle the output. | ||
| 931 | BUFFER may be also nil, meaning that this process is not associated | ||
| 932 | with any buffer | ||
| 933 | Third arg is name of the host to connect to, or its IP address. | ||
| 934 | Fourth arg SERVICE is name of the service desired, or an integer | ||
| 935 | specifying a port number to connect to." | ||
| 936 | (make-network-process :name name :buffer buffer | ||
| 937 | :host host :service service)) | ||
| 938 | |||
| 939 | (defun open-network-stream-nowait (name buffer host service &optional sentinel filter) | ||
| 940 | "Initiate connection to a TCP connection for a service to a host. | ||
| 941 | It returns nil if non-blocking connects are not supported; otherwise, | ||
| 942 | it returns a subprocess-object to represent the connection. | ||
| 943 | |||
| 944 | This function is similar to `open-network-stream', except that this | ||
| 945 | function returns before the connection is established. When the | ||
| 946 | connection is completed, the sentinel function will be called with | ||
| 947 | second arg matching `open' (if successful) or `failed' (on error). | ||
| 948 | |||
| 949 | Args are NAME BUFFER HOST SERVICE SENTINEL FILTER. | ||
| 950 | NAME, BUFFER, HOST, and SERVICE are as for `open-network-stream'. | ||
| 951 | Optional args, SENTINEL and FILTER specifies the sentinel and filter | ||
| 952 | functions to be used for this network stream." | ||
| 953 | (if (featurep 'make-network-process '(:nowait t)) | ||
| 954 | (make-network-process :name name :buffer buffer :nowait t | ||
| 955 | :host host :service service | ||
| 956 | :filter filter :sentinel sentinel))) | ||
| 957 | |||
| 958 | (defun open-network-stream-server (name buffer service &optional sentinel filter) | ||
| 959 | "Create a network server process for a TCP service. | ||
| 960 | It returns nil if server processes are not supported; otherwise, | ||
| 961 | it returns a subprocess-object to represent the server. | ||
| 962 | |||
| 963 | When a client connects to the specified service, a new subprocess | ||
| 964 | is created to handle the new connection, and the sentinel function | ||
| 965 | is called for the new process. | ||
| 966 | |||
| 967 | Args are NAME BUFFER SERVICE SENTINEL FILTER. | ||
| 968 | NAME is name for the server process. Client processes are named by | ||
| 969 | appending the ip-address and port number of the client to NAME. | ||
| 970 | BUFFER is the buffer (or buffer-name) to associate with the server | ||
| 971 | process. Client processes will not get a buffer if a process filter | ||
| 972 | is specified or BUFFER is nil; otherwise, a new buffer is created for | ||
| 973 | the client process. The name is similar to the process name. | ||
| 974 | Third arg SERVICE is name of the service desired, or an integer | ||
| 975 | specifying a port number to connect to. It may also be t to selected | ||
| 976 | an unused port number for the server. | ||
| 977 | Optional args, SENTINEL and FILTER specifies the sentinel and filter | ||
| 978 | functions to be used for the client processes; the server process | ||
| 979 | does not use these function." | ||
| 980 | (if (featurep 'make-network-process '(:server t)) | ||
| 981 | (make-network-process :name name :buffer buffer | ||
| 982 | :service service :server t :noquery t | ||
| 983 | :sentinel sentinel :filter filter))) | ||
| 984 | |||
| 985 | )) ;; (featurep 'make-network-process) | ||
| 986 | |||
| 987 | |||
| 988 | ;; compatibility | ||
| 989 | |||
| 990 | (defun process-kill-without-query (process &optional flag) | ||
| 991 | "Say no query needed if PROCESS is running when Emacs is exited. | ||
| 992 | Optional second argument if non-nil says to require a query. | ||
| 993 | Value is t if a query was formerly required. | ||
| 994 | New code should not use this function; use `process-query-on-exit-flag' | ||
| 995 | or `set-process-query-on-exit-flag' instead." | ||
| 996 | (let ((old (process-query-on-exit-flag process))) | ||
| 997 | (set-process-query-on-exit-flag process nil) | ||
| 998 | old)) | ||
| 916 | 999 | ||
| 917 | 1000 | ||
| 918 | ;;;; Input and display facilities. | 1001 | ;;;; Input and display facilities. |