Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
emacs
emacs
Commits
8fb5d2f1
Commit
8fb5d2f1
authored
Apr 21, 2004
by
Kim F. Storm
Browse files
(telnet): Add optional port arg.
parent
d88beab5
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
4 deletions
+16
-4
lisp/net/telnet.el
lisp/net/telnet.el
+16
-4
No files found.
lisp/net/telnet.el
View file @
8fb5d2f1
...
...
@@ -197,18 +197,28 @@ rejecting one login and prompting again for a username and password.")
;;;###autoload (add-hook 'same-window-regexps "\\*telnet-.*\\*\\(\\|<[0-9]+>\\)")
;;;###autoload
(
defun
telnet
(
host
)
(
defun
telnet
(
host
&optional
port
)
"Open a network login connection to host named HOST (a string).
Optional arg PORT specifies alternative port to connect to.
Interactively, use \\[universal-argument] prefix to be prompted for port number.
Communication with HOST is recorded in a buffer `*PROGRAM-HOST*'
where PROGRAM is the telnet program being used. This program
is controlled by the contents of the global variable `telnet-host-properties',
falling back on the value of the global variable `telnet-program'.
Normally input is edited in Emacs and sent a line at a time."
(
interactive
"sOpen connection to host: "
)
(
interactive
(
list
(
read-string
"Open connection to host: "
)
(
cond
((
null
current-prefix-arg
)
nil
)
((
consp
current-prefix-arg
)
(
read-string
"Port: "
))
(
t
(
prefix-numeric-value
current-prefix-arg
)))))
(
if
(
and
port
(
numberp
port
))
(
setq
port
(
int-to-string
port
)))
(
let*
((
comint-delimiter-argument-list
'
(
?\
?\t
))
(
properties
(
cdr
(
assoc
host
telnet-host-properties
)))
(
telnet-program
(
if
properties
(
car
properties
)
telnet-program
))
(
name
(
concat
telnet-program
"-"
(
comint-arguments
host
0
nil
)
))
(
hname
(
if
port
(
concat
host
":"
port
)
host
))
(
name
(
concat
telnet-program
"-"
(
comint-arguments
hname
0
nil
)
))
(
buffer
(
get-buffer
(
concat
"*"
name
"*"
)))
(
telnet-options
(
if
(
cdr
properties
)
(
cons
"-l"
(
cdr
properties
))))
process
)
...
...
@@ -221,7 +231,9 @@ Normally input is edited in Emacs and sent a line at a time."
;; Don't send the `open' cmd till telnet is ready for it.
(
accept-process-output
process
)
(
erase-buffer
)
(
send-string
process
(
concat
"open "
host
"\n"
))
(
send-string
process
(
concat
"open "
host
(
if
port
" "
""
)
(
or
port
""
)
"\n"
))
(
telnet-mode
)
(
setq
comint-input-sender
'telnet-simple-send
)
(
setq
telnet-count
telnet-initial-count
))))
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment