unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* basic network detect
@ 2006-01-16 23:38 BRUCE INGALLS
  0 siblings, 0 replies; 5+ messages in thread
From: BRUCE INGALLS @ 2006-01-16 23:38 UTC (permalink / raw)


I wrote some code, but tested it on only one system. I wish to add it
to the next version of my GPL http://emacro.sf.net/ project.
The purpose is to, as feasibly as I can, test if the user has
 o  broadband
 o  dialup
 o  no network

Please run the following code on your unix/osx-like system. If it
fails, please email me directly the output of ifconfig (you can trim
out the actual numbers, such as IP address), or fill in your relevant
/dev device name.
Let me know, if ifconfig itself fails.

;;;cut here

(let ((ifconfig (shell-command-to-string "ifconfig")) ;posix: linux/osx/unix
      (ipconfig (shell-command-to-string "ipconfig"))) ;w32

      (cond
       ((string-match "Media disconnected" ipconfig)
	(message "w32 modem or no network"))

       ((string-match "IP Address" ipconfig)
	(message "w32 broadband, or currently (perhaps always?) connected"))

       ((string-match "eth[0-9]" ifconfig)
	(message "Linux ethernet"))

       ((string-match "tty" ifconfig)
	(message "Linux/Unix modem"))

       ((string-match "e[0-9]" ifconfig)
	(message "Solaris ethernet"))

       ((string-match "rl[0-9]" ifconfig)
	(message "BSD ethernet"))

       ((string-match "vr[0-9]" ifconfig)
	(message "BSD ethernet"))

       ((string-match "tr[0-9]" ifconfig)
	(message "Linux/Unix token ring"))

       ('t message "Default: nothing found = modem or no network")))

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: basic network detect
       [not found] <mailman.1364.1137454830.26925.help-gnu-emacs@gnu.org>
@ 2006-01-17 10:11 ` Mathias Dahl
  2006-01-17 13:45   ` Lennart Borgman
  2006-01-20 22:41 ` Peter Lee
  2006-01-23  8:33 ` Klaus Berndl
  2 siblings, 1 reply; 5+ messages in thread
From: Mathias Dahl @ 2006-01-17 10:11 UTC (permalink / raw)


BRUCE INGALLS <bruce.ingalls@gmail.com> writes:

> I wrote some code, but tested it on only one system. I wish to add it
> to the next version of my GPL http://emacro.sf.net/ project.
> The purpose is to, as feasibly as I can, test if the user has
>  o  broadband
>  o  dialup
>  o  no network

Running under WindowsXP, I get:

"w32 broadband, or currently (perhaps always?) connected", which is
quite true... :)

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: basic network detect
  2006-01-17 10:11 ` basic network detect Mathias Dahl
@ 2006-01-17 13:45   ` Lennart Borgman
  0 siblings, 0 replies; 5+ messages in thread
From: Lennart Borgman @ 2006-01-17 13:45 UTC (permalink / raw)
  Cc: help-gnu-emacs

Mathias Dahl wrote:
> BRUCE INGALLS <bruce.ingalls@gmail.com> writes:
>
>   
>> I wrote some code, but tested it on only one system. I wish to add it
>> to the next version of my GPL http://emacro.sf.net/ project.
>> The purpose is to, as feasibly as I can, test if the user has
>>  o  broadband
>>  o  dialup
>>  o  no network
>>     
>
> Running under WindowsXP, I get:
>
> "w32 broadband, or currently (perhaps always?) connected", which is
> quite true... :)
>   
I get the same on W2k.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: basic network detect
       [not found] <mailman.1364.1137454830.26925.help-gnu-emacs@gnu.org>
  2006-01-17 10:11 ` basic network detect Mathias Dahl
@ 2006-01-20 22:41 ` Peter Lee
  2006-01-23  8:33 ` Klaus Berndl
  2 siblings, 0 replies; 5+ messages in thread
From: Peter Lee @ 2006-01-20 22:41 UTC (permalink / raw)


>>>> BRUCE INGALLS writes:

    > I wrote some code, but tested it on only one system. I wish to add it
    > to the next version of my GPL http://emacro.sf.net/ project.
    > The purpose is to, as feasibly as I can, test if the user has
    >  o  broadband
    >  o  dialup
    >  o  no network

On Fedora Core 2 I get:
"Linux ethernet"

On WinXP I get:
"w32 broadband, or currently (perhaps always?) connected"

Both machines are on same local broadband network.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: basic network detect
       [not found] <mailman.1364.1137454830.26925.help-gnu-emacs@gnu.org>
  2006-01-17 10:11 ` basic network detect Mathias Dahl
  2006-01-20 22:41 ` Peter Lee
@ 2006-01-23  8:33 ` Klaus Berndl
  2 siblings, 0 replies; 5+ messages in thread
From: Klaus Berndl @ 2006-01-23  8:33 UTC (permalink / raw)


On Mon, 16 Jan 2006, BRUCE INGALLS wrote:



>  I wrote some code, but tested it on only one system. I wish to add it
>  to the next version of my GPL http://emacro.sf.net/ project.
>  The purpose is to, as feasibly as I can, test if the user has
>   o  broadband
>   o  dialup
>   o  no network
>  
>  Please run the following code on your unix/osx-like system. If it
>  fails, please email me directly the output of ifconfig (you can trim
>  out the actual numbers, such as IP address), or fill in your relevant
>  /dev device name.
>  Let me know, if ifconfig itself fails.
>  
> ;;;cut here
>  
>  (let ((ifconfig (shell-command-to-string "ifconfig")) ;posix:
>  linux/osx/unix
>        (ipconfig (shell-command-to-string "ipconfig"))) ;w32
>  
>        (cond
>         ((string-match "Media disconnected" ipconfig)
>  	(message "w32 modem or no network"))
>  
>         ((string-match "IP Address" ipconfig)
>  	(message "w32 broadband, or currently (perhaps always?) connected"))
>  
>         ((string-match "eth[0-9]" ifconfig)
>  	(message "Linux ethernet"))
>  
>         ((string-match "tty" ifconfig)
>  	(message "Linux/Unix modem"))
>  
>         ((string-match "e[0-9]" ifconfig)
>  	(message "Solaris ethernet"))
>  
>         ((string-match "rl[0-9]" ifconfig)
>  	(message "BSD ethernet"))
>  
>         ((string-match "vr[0-9]" ifconfig)
>  	(message "BSD ethernet"))
>  
>         ((string-match "tr[0-9]" ifconfig)
>  	(message "Linux/Unix token ring"))
>  
>         ('t message "Default: nothing found = modem or no network")))

Nice idea but some drawbacks:
- in the line there are two mistakes: t must not be quoted and missing open
  paren before `message' (but both really fast to fix i assume ;-)
- This codes works only with English/American operating systems! I'm using
  Windows XP in a German installation and there is no string "IP Address" but
  it's named "IP Adresse"... and I'm sure in french installation there is also
  no string "IP Address" ;-). So i suggest to add some i18n for the searched
  strings - at least for Windows XP (i do not know if there are "not English"
  installations of *nix?!).

  Maybe a customization variable where a user can specify the string to search
  with some proper defaults for the most occurring languages?

Ciao,
Klaus

-- 
Klaus Berndl			mailto: klaus.berndl@sdm.de
sd&m AG				http://www.sdm.de
software design & management	
Carl-Wery-Str. 42, 81739 Muenchen, Germany
Tel +49 89 63812-392, Fax -220

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2006-01-23  8:33 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <mailman.1364.1137454830.26925.help-gnu-emacs@gnu.org>
2006-01-17 10:11 ` basic network detect Mathias Dahl
2006-01-17 13:45   ` Lennart Borgman
2006-01-20 22:41 ` Peter Lee
2006-01-23  8:33 ` Klaus Berndl
2006-01-16 23:38 BRUCE INGALLS

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).