all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: BRUCE INGALLS <bruce.ingalls@gmail.com>
Subject: basic network detect
Date: Mon, 16 Jan 2006 18:38:01 -0500	[thread overview]
Message-ID: <534d19de0601161538x3f6e06a6q1f79bd3e6b01ec1f@mail.gmail.com> (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")))

             reply	other threads:[~2006-01-16 23:38 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-01-16 23:38 BRUCE INGALLS [this message]
     [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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=534d19de0601161538x3f6e06a6q1f79bd3e6b01ec1f@mail.gmail.com \
    --to=bruce.ingalls@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.