[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: test for network connection location
From: |
Rupert Swarbrick |
Subject: |
Re: test for network connection location |
Date: |
Mon, 14 Apr 2008 21:30:57 +0100 |
User-agent: |
Gnus/5.11 (Gnus v5.11) Emacs/22.2 (gnu/linux) |
Alan <wehmann@fnal.gov> writes:
> I haven't been able to think of a way to put a test in my .vm file
> that would distinguish between when my laptop is connected to the
> internet while at home, versus being connected while at work. In both
> cases I am interested in fetching mail from the IMAP server at work,
> but I'd like to configure three variables in .vm somewhat differently--
> depending on how the laptop is connected.
>
> While at home I am using wireless, via a modem with the brand name
> 2wire, with a DSL connection supplied by AT&T (formerly SBC). At work
> I usually connect via an Ethernet cable, but would like to keep the
> option of going wireless. I'd like to set up an environmental
> variable or some other test that could distinguish between these two
> connections, but haven't come up with anything yet. Also, I haven't
> yet invented a good search string to use, to find an existing post
> that suggests how to create such a test.
Hi there,
You haven't said what OS you're using, but I think I might have an
idea if you're using linux (which, frankly, is all that I know
about).
Why not use a shell command? For example, this (horrible) elisp
command checks whether the ESSID of the wireless I'm connected to is
PoorStudents (the one at home!)
(defun at-home-p ()
(string=
(shell-command-to-string
"/sbin/iwconfig wlan0 | grep ESSID | awk -F '\"' '{print $2}'")
"PoorStudents
"))
The slightly lame embedded newline is probably avoidable, but I wrote
this in a hurry...
Rupert
- Re: test for network connection location,
Rupert Swarbrick <=