In contrast to Cygwin 1.5 Cygwin 1.7 doesn't allow to get __argc out of thin air anymore. Instead of finding a workaround I opted to remove the whole command line checking here which was added so revisions ago. The reasoning:

The WinPcap driver presumes to be obligatory for the application. Therefore it quits the whole application if it can't initialize successfully.

In former times the WinPcap driver required a cmdline parameter to initialize properly. The netsim target presumably doesn't consider the WinPcap driver obligatory for its applications so it checks the cmdline and starts the WinPcap driver only if it finds the WinPcap cmdline parameter present. Thus it prevents the WinPcap driver from failing to initialize which brings down the whole application.

However recently the WinPcap driver was changed to just use some default value if its cmdline parameter isn't found. So there's no more need to keep WinPcap from starting just to make sure it doesn't bring down the whole application. The presumption behind all this reasoning is that a WinPcap driver running with some (potentially wrong) default isn't worse than a WinPcap driver not running at all.
This commit is contained in:
oliverschmidt 2010-04-21 20:27:28 +00:00
parent 4c26783948
commit 5640f89259

View file

@ -30,7 +30,7 @@
*
* Author: Adam Dunkels <adam@sics.se>
*
* $Id: contiki-main.c,v 1.36 2010/02/23 18:44:08 adamdunkels Exp $
* $Id: contiki-main.c,v 1.37 2010/04/21 20:27:28 oliverschmidt Exp $
*/
#include "contiki.h"
@ -70,12 +70,6 @@ int snprintf(char *str, size_t size, const char *format, ...);
#include "dev/radio-sensor.h"
#include "dev/leds.h"
#ifdef __CYGWIN__
__attribute__((dllimport)) extern int __argc;
__attribute__((dllimport)) extern char **__argv[];
#endif /* __CYGWIN__ */
#ifdef __CYGWIN__
static struct uip_fw_netif extif =
{UIP_FW_NETIF(0,0,0,0, 0,0,0,0, wpcap_output)};
@ -135,23 +129,21 @@ contiki_main(int flag)
if(flag == 1) {
#ifdef __CYGWIN__
if(__argc > 2 && (*__argv)[1][0] != '-') {
process_start(&wpcap_process, NULL);
{
char buf[1024];
uip_ipaddr_t ifaddr;
extern uip_ipaddr_t winifaddr;
uip_ipaddr_copy(&ifaddr, &winifaddr);
snprintf(buf, sizeof(buf), "route add %d.%d.%d.%d mask %d.%d.%d.%d %d.%d.%d.%d",
uip_ipaddr_to_quad(&meshif.ipaddr),
uip_ipaddr_to_quad(&meshif.netmask),
uip_ipaddr_to_quad(&ifaddr));
printf("%s\n", buf);
system(buf);
signal(SIGTERM, remove_route);
}
process_start(&wpcap_process, NULL);
{
char buf[1024];
uip_ipaddr_t ifaddr;
extern uip_ipaddr_t winifaddr;
uip_ipaddr_copy(&ifaddr, &winifaddr);
snprintf(buf, sizeof(buf), "route add %d.%d.%d.%d mask %d.%d.%d.%d %d.%d.%d.%d",
uip_ipaddr_to_quad(&meshif.ipaddr),
uip_ipaddr_to_quad(&meshif.netmask),
uip_ipaddr_to_quad(&ifaddr));
printf("%s\n", buf);
system(buf);
signal(SIGTERM, remove_route);
}
#else /* __CYGWIN__ */
process_start(&tapdev_process, NULL);