help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: telnet in buffer using elisp -- is this the best way?


From: Tim X
Subject: Re: telnet in buffer using elisp -- is this the best way?
Date: Tue, 13 Jul 2004 17:59:45 +1000
User-agent: Gnus/5.1006 (Gnus v5.10.6) Emacs/21.3 (gnu/linux)

>>>>> "Tennis" == Tennis Smith <tennis_smith@yahoo-remove-to-reply.com> writes:

 Tennis> Hi Apologies for the basic nature of the questions, but my
 Tennis> area is s/w testing, not elisp writing. ;-)

 Tennis> I frequently have the need to telnet into routers, via
 Tennis> console ports thru a term server or a native ip address.
 Tennis> I've built some *very* basic elisp functions for doing this,
 Tennis> but I'm wondering if there is a better way. The number of
 Tennis> routers in my environment continues to grow (Im in a testing
 Tennis> group, we have hundreds of the things). So, this approach has
 Tennis> become a real problem since each router requires a separate
 Tennis> function to access it.

 Tennis> Here are a couple examples:

 Tennis> (defun 5gw-con () (interactive) (telnet "10.10.10.58 2008")
 Tennis> (rename-buffer "ef-gw-5-con"))

 Tennis> (defun 5gw-con2 () (interactive) (telnet "10.10.10.58 2009")
 Tennis> (rename-buffer "ef-gw-5-con"))

 Tennis> (defun 7gw () (interactive) (telnet "10.10.10.40")
 Tennis> (rename-buffer "ef-gw-7"))

 Tennis> There's an additional issue too. Sometimes the same address
 Tennis> will be used in multiple places. Note that the first two
 Tennis> examples uses an ip/port combination. In this case the port
 Tennis> will be changing, but the base ip address will stay the
 Tennis> same. Is there a way to specify the ip address in _one_ place
 Tennis> and have it be used in multiple places?

 Tennis> Is there a better way to do all this?

Well, just off the top of my head -

I would maintain a text file something like
router_name ip:port

Then I'd generalize my function so that it takes a single argument -
the router name and have the function obtain the ip address (possibly
with port spec) from the lookup file. You have only one function and a
lookup file to maintain.

tim





 Tennis> -- Remove "-remove-to-reply" to respond to my email address
 Tennis> directly.



-- 
Tim Cross
The e-mail address on this message is FALSE (obviously!). My real e-mail is
to a company in Australia called rapttech and my login is tcross - if you 
really need to send mail, you should be able to work it out!


reply via email to

[Prev in Thread] Current Thread [Next in Thread]