// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
/** The simplest way to initiate a dial up: this function dials the given
ISP (exact meaning of the parameter depends on the platform), returns
/** The simplest way to initiate a dial up: this function dials the given
ISP (exact meaning of the parameter depends on the platform), returns
// this just means that a RAS connection exists, under Unix we check that
// the "well-known host" (as specified by SetWellKnownHost) is reachable
virtual bool IsOnline() const
// this just means that a RAS connection exists, under Unix we check that
// the "well-known host" (as specified by SetWellKnownHost) is reachable
virtual bool IsOnline() const
// so, in general, the user should be allowed to override it. This function
// allows to forcefully set the online status - whatever our internal
// algorithm may think about it.
// so, in general, the user should be allowed to override it. This function
// allows to forcefully set the online status - whatever our internal
// algorithm may think about it.
virtual bool EnableAutoCheckOnlineStatus(size_t nSeconds);
// disable automatic check for connection status change - notice that the
virtual bool EnableAutoCheckOnlineStatus(size_t nSeconds);
// disable automatic check for connection status change - notice that the
- if(m_IsOnline == Net_Connected)
- return FALSE;
- m_ISPname = isp;
- wxString cmd;
- if(m_ConnectCommand.Find(wxT("%s")))
- cmd.Printf(m_ConnectCommand,m_ISPname.c_str());
- else
- cmd = m_ConnectCommand;
+ if(m_IsOnline == Net_Connected)
+ return false;
+ m_ISPname = isp;
+ wxString cmd;
+ if(m_ConnectCommand.Find(wxT("%s")))
+ cmd.Printf(m_ConnectCommand,m_ISPname.c_str());
+ else
+ cmd = m_ConnectCommand;
- if ( async )
- {
- m_DialProcess = new wxDialProcess(this);
- m_DialPId = (int)wxExecute(cmd, FALSE, m_DialProcess);
- if(m_DialPId == 0)
- {
- delete m_DialProcess;
- m_DialProcess = NULL;
- return FALSE;
- }
- else
- return TRUE;
- }
- else
- return wxExecute(cmd, /* sync */ TRUE) == 0;
+ if ( async )
+ {
+ m_DialProcess = new wxDialProcess(this);
+ m_DialPId = (int)wxExecute(cmd, false, m_DialProcess);
+ if(m_DialPId == 0)
+ {
+ delete m_DialProcess;
+ m_DialProcess = NULL;
+ return false;
+ }
+ else
+ return true;
+ }
+ else
+ return wxExecute(cmd, /* sync */ true) == 0;
- if(m_IsOnline == Net_No)
- return FALSE;
- if(IsDialing())
- {
- wxLogError(_("Already dialling ISP."));
- return FALSE;
- }
- wxString cmd;
- if(m_HangUpCommand.Find(wxT("%s")))
- cmd.Printf(m_HangUpCommand,m_ISPname.c_str(), m_DialProcess);
- else
- cmd = m_HangUpCommand;
- return wxExecute(cmd, /* sync */ TRUE) == 0;
+ if(m_IsOnline == Net_No)
+ return false;
+ if(IsDialing())
+ {
+ wxLogError(_("Already dialling ISP."));
+ return false;
+ }
+ wxString cmd;
+ if(m_HangUpCommand.Find(wxT("%s")))
+ cmd.Printf(m_HangUpCommand,m_ISPname.c_str(), m_DialProcess);
+ else
+ cmd = m_HangUpCommand;
+ return wxExecute(cmd, /* sync */ true) == 0;
_T("/usr/sbin"), // SunOS, Solaris, AIX, HP-UX
_T("/usr/etc"), // IRIX
_T("/usr/sbin"), // SunOS, Solaris, AIX, HP-UX
_T("/usr/etc"), // IRIX
wxASSERT_MSG( m_IfconfigPath.length(),
_T("can't use ifconfig if it wasn't found") );
wxASSERT_MSG( m_IfconfigPath.length(),
_T("can't use ifconfig if it wasn't found") );
/* I tried to add an option to wxExecute() to not close stdout,
so we could let ifconfig write directly to the tmpfile, but
this does not work. That should be faster, as it doesn´t call
the shell first. I have no idea why. :-( (KB) */
/* I tried to add an option to wxExecute() to not close stdout,
so we could let ifconfig write directly to the tmpfile, but
this does not work. That should be faster, as it doesn´t call
the shell first. I have no idea why. :-( (KB) */
- hasModem = strstr(output,"ipdptp") != (char *)NULL;
- hasLAN = strstr(output, "hme") != (char *)NULL;
+ hasModem = strstr(output.fn_str(),"ipdptp") != (char *)NULL;
+ hasLAN = strstr(output.fn_str(), "hme") != (char *)NULL;
- hasModem = strstr(output,"ppp") // ppp
- || strstr(output,"sl") // slip
- || strstr(output,"pl"); // plip
- hasLAN = strstr(output, "eth") != NULL;
+ hasModem = strstr(output.fn_str(),"ppp") // ppp
+ || strstr(output.fn_str(),"sl") // slip
+ || strstr(output.fn_str(),"pl"); // plip
+ hasLAN = strstr(output.fn_str(), "eth") != NULL;
- // First time check for ping location. We only use the variant
- // which does not take arguments, a la GNU.
- if(m_CanUsePing == -1) // unknown
- {
+ // First time check for ping location. We only use the variant
+ // which does not take arguments, a la GNU.
+ if(m_CanUsePing == -1) // unknown
+ {
- if(wxFileExists("SYS$SYSTEM:TCPIP$PING.EXE"))
- m_PingPath = "$SYS$SYSTEM:TCPIP$PING";
+ if (wxFileExists( wxT("SYS$SYSTEM:TCPIP$PING.EXE") ))
+ m_PingPath = wxT("$SYS$SYSTEM:TCPIP$PING");
+#elif defined(__AIX__)
+ m_PingPath = _T("/etc/ping");
+#elif defined(__SGI__)
+ m_PingPath = _T("/usr/etc/ping");
- if(wxFileExists("/bin/ping"))
- m_PingPath = "/bin/ping";
- else if(wxFileExists("/usr/sbin/ping"))
- m_PingPath = "/usr/sbin/ping";
+ if (wxFileExists( wxT("/bin/ping") ))
+ m_PingPath = wxT("/bin/ping");
+ else if (wxFileExists( wxT("/usr/sbin/ping") ))
+ m_PingPath = wxT("/usr/sbin/ping");
- wxLogNull ln; // suppress all error messages
- wxASSERT(m_PingPath.length());
- wxString cmd;
- cmd << m_PingPath << ' ';
+ wxLogNull ln; // suppress all error messages
+ wxASSERT(m_PingPath.length());
+ wxString cmd;
+ cmd << m_PingPath << wxT(' ');
- // nothing to add to ping command
-#elif defined(__LINUX__) || defined ( __FREEBSD__) || defined(__WXMAC__) || defined( __VMS )
- cmd << "-c 1 "; // only ping once
+ // nothing to add to ping command
+#elif defined(__AIX__) || \
+ defined (__BSD__) || \
+ defined(__LINUX__) || \
+ defined(__OSF__) || \
+ defined(__SGI__) || \
+ defined(__VMS)
+ cmd << wxT("-c 1 "); // only ping once