+ // assume that the test doesn't work
+ int netDevice = NetDevice_Unknown;
+
+ // first time check for ifconfig location
+ if ( m_CanUseIfconfig == -1 ) // unknown
+ {
+ static const wxChar *ifconfigLocations[] =
+ {
+ _T("/sbin"), // Linux, FreeBSD, Darwin
+ _T("/usr/sbin"), // SunOS, Solaris, AIX, HP-UX
+ _T("/usr/etc"), // IRIX
+ _T("/etc"), // AIX 5
+ };
+
+ for ( size_t n = 0; n < WXSIZEOF(ifconfigLocations); n++ )
+ {
+ wxString path(ifconfigLocations[n]);
+ path << _T("/ifconfig");
+
+ if ( wxFileExists(path) )
+ {
+ m_IfconfigPath = path;
+ break;
+ }
+ }
+ }
+
+ if ( m_CanUseIfconfig != 0 ) // unknown or yes
+ {
+ wxLogNull ln; // suppress all error messages
+
+ wxASSERT_MSG( m_IfconfigPath.length(),
+ _T("can't use ifconfig if it wasn't found") );
+
+ wxString tmpfile = wxGetTempFileName( wxT("_wxdialuptest") );
+ wxString cmd = wxT("/bin/sh -c \'");
+ cmd << m_IfconfigPath;
+#if defined(__AIX__) || \
+ defined(__OSF__) || \
+ defined(__SOLARIS__) || defined (__SUNOS__)
+ // need to add -a flag
+ cmd << wxT(" -a");
+#elif defined(__LINUX__) || defined(__SGI__)
+ // nothing to be added to ifconfig
+#elif defined(__FREEBSD__) || defined(__DARWIN__)
+ // add -l flag
+ cmd << wxT(" -l");
+#elif defined(__HPUX__)
+ // VZ: a wild guess (but without it, ifconfig fails completely)
+ cmd << wxT(" ppp0");
+#else
+ #if defined(__GNUG__)
+ #warning "No ifconfig information for this OS."
+ #else
+ #pragma warning "No ifconfig information for this OS."
+ #endif
+
+ m_CanUseIfconfig = 0;
+ return -1;