Author: ks156
Date: 2009-01-15 16:26:01 +0100 (Thu, 15 Jan 2009)
New Revision: 3470
Modified:
software_suite_v2/software/tux_wifi_channel/trunk/wifi_channel_win32.c
Log:
* Reindented and retabed
Modified: software_suite_v2/software/tux_wifi_channel/trunk/wifi_channel_win32.c
===================================================================
--- software_suite_v2/software/tux_wifi_channel/trunk/wifi_channel_win32.c
2009-01-15 15:11:01 UTC (rev 3469)
+++ software_suite_v2/software/tux_wifi_channel/trunk/wifi_channel_win32.c
2009-01-15 15:26:01 UTC (rev 3470)
@@ -421,9 +421,9 @@
* is not constant )*/
while(temp != 0)
{
- cpSsid=(NDIS_WLAN_BSSID *)((char*)cpSsid +
cpSsid->Length);
- temp--;
- }
+ cpSsid=(NDIS_WLAN_BSSID *)((char*)cpSsid +
cpSsid->Length);
+ temp--;
+ }
/* If the SSID of the current BSSID structure is the prior SSID
* then get its channel */
@@ -509,20 +509,20 @@
/* Version is vista or more recently */
else
{
- /*
- * This way to retrieve the Wifi channel currently used is a
bit tricky.
- * Previously, an easiest code was written, but was parsing
directly the
- * strings.
- * The major problem is that netsh return translated strings.
So it's
- * it's almost impossible to do it working for all languages !
- *
- * This maner search for string untralsted, like SSID or BSSID,
and count
- * the lines to retrieve the channel.
- */
+ /*
+ * This way to retrieve the Wifi channel currently used is a bit
tricky.
+ * Previously, an easiest code was written, but was parsing directly
the
+ * strings.
+ * The major problem is that netsh return translated strings. So it's
+ * it's almost impossible to do it working for all languages !
+ *
+ * This maner search for string untralsted, like SSID or BSSID, and
count
+ * the lines to retrieve the channel.
+ */
FILE *pcmd;
char buff[80];
char connected_SSID[32];
- char current_SSID[32];
+ char current_SSID[32];
/* If no SSID specified then attempt to retrieve the current
* used SSID */
@@ -534,13 +534,13 @@
{
while(fgets(buff, 80, pcmd))
{
- /* Parse the string : Be sure to
considere the SSID line,
- * and not BSSID */
+ /* Parse the string : Be sure to considere the SSID line,
+ * and not BSSID */
if ((strstr(buff, "SSID") != NULL) &&
(strstr(buff, "BSSID") == NULL))
{
sscanf(strrchr(buff, ':'), ": %s", &connected_SSID[0]);
- /* Assign the active SSID */
+ /* Assign the active SSID */
requested_SSID = connected_SSID;
break;
}
@@ -548,48 +548,49 @@
fclose(pcmd);
}
}
-
- /* Search the channel */
+
+ /* Search the channel */
pcmd = popen("netsh wlan show network mode=BSSID", "r");
-
+
if (pcmd != NULL)
{
while(fgets(buff, 80, pcmd))
{
- /* Search for the correct SSID */
- if ((strstr(buff, "SSID") != NULL) &&
- (strstr(buff, "BSSID") == NULL))
+ /* Search for the correct SSID */
+ if ((strstr(buff, "SSID") != NULL) &&
+ (strstr(buff, "BSSID") == NULL))
{
sscanf(strrchr(buff, ':'), ": %s", ¤t_SSID[0]);
- /* If the current scanned SSID is the
requested one, continue */
- if (strcmp(current_SSID,requested_SSID)
== 0)
- {
- break;
- }
- }
- }
- while (fgets(buff, 80, pcmd))
- {
- /* Search for BSSID */
- if (strstr(buff, "BSSID") != NULL)
- {
- /* Dummy reads :
- - Signal
- - RF type
- */
- fgets(buff, 80, pcmd);
- fgets(buff, 80, pcmd);
-
- /* Retrive the channel */
- fgets(buff, 80, pcmd);
- sscanf(strrchr(buff, ':'), ": %d",
&channel);
-
- break;
- }
- }
- fclose(pcmd);
- }
- printf("[VISTA] Channel found : %d\n", channel);
- }
- return channel;
+ /* If the current scanned SSID is the requested one,
+ * continue */
+ if (strcmp(current_SSID,requested_SSID) == 0)
+ {
+ break;
+ }
+ }
+ }
+ while (fgets(buff, 80, pcmd))
+ {
+ /* Search for BSSID */
+ if (strstr(buff, "BSSID") != NULL)
+ {
+ /* Dummy reads :
+ - Signal
+ - RF type
+ */
+ fgets(buff, 80, pcmd);
+ fgets(buff, 80, pcmd);
+
+ /* Retrive the channel */
+ fgets(buff, 80, pcmd);
+ sscanf(strrchr(buff, ':'), ": %d", &channel);
+
+ break;
+ }
+ }
+ fclose(pcmd);
+ }
+ printf("[VISTA] Channel found : %d\n", channel);
+ }
+ return channel;
}
------------------------------------------------------------------------------
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword
_______________________________________________
Tux-droid-svn mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tux-droid-svn