I know about using "scselect" to get the name of the currently
selected Location, but what I really want to know is the name
of the wireless network currently being used. (If one's
location is set to "Automatic", scselect is useless.)
A command-line solution is desired.
This is a bit skanky, but you can do it with 'scutil'; therefore, you
may be able to look at source and figure out how to do it with a small
command-line app.
This is one way to find out:
$ scutil
> open ### Open a connection to configd
> list ### List the content of the data store
...
subKey [40] = State:/Network/Interface/en1/AirPort
...
### There will be a boat-load of these, some with "Setup:" tags, and
some
### with "State:" tags. The former are entries from the
SystemConfiguration
### database, kept by configd and the Network Control Panel (and Frey's
### 'ncutil' command-line app). The latter are ephemeral values that
### represent the current state of the system.
### Look for the key with AirPort in it; that's the one to "get":
> get State:/Network/Interface/en1/AirPort
### This displays what you just "got"
> d.show
<dictionary> {
BSSID : <data> YourMacAddressHere
SSID : YourNetworkNameHere
Card Mode : 1
Link Status : 4
Power Status : 1
}
The SSID field is the one for you.
You can duplicate this with code of your own, using the
SystemConfiguration framework. 'scutil' code, available on the Darwin
site, should show you how to use it.
I don't know that you can find the AirPort State key easily, just using
'scutil'. Someone else on the list may have a better idea (or try the
darwin-development list).
Regards,
Justin
--
Justin C. Walker, Curmudgeon-At-Large *
Institute for General Semantics | Men are from Earth.
| Women are from Earth.
| Deal with it.
*--------------------------------------*-------------------------------*
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Unix-porting mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/unix-porting/email@hidden