Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

cleaning app exit code for scripting purpose

reworked main log messages and info
  • Loading branch information...
commit b724ba1c5c70bc7d8182422ea0be605e4cc3cfe3 1 parent 140afff
Antoine Fraboulet authored
View
14 arch/atmega/atmega128.c
@@ -60,8 +60,8 @@ char* mcu_modelname(void)
void mcu_print_description(void)
{
- OUTPUT("mcu : %s\n",MCU_NAME);
- OUTPUT("model : %s\n",MCU_MODEL_NAME);
+ OUTPUT_BOXM("mcu : %s\n",MCU_NAME);
+ OUTPUT_BOXM("model : %s\n",MCU_MODEL_NAME);
}
/* ************************************************** */
@@ -173,15 +173,15 @@ void mcu_dump_stats(int64_t user_nanotime)
mean_cs = (float)MCU_CYCLE_CPT / ((float)MACHINE_TIME_GET_NANO() / (float)NANO);
mean_freq = mean_cs / (1000*1000);
- OUTPUT(" simulated mcu instructions : %"PRId64"\n",MCU_INSN_CPT);
- OUTPUT(" simulated mcu cycles : %"PRId64"\n",MCU_CYCLE_CPT);
- OUTPUT(" simulated mcu mean freq : %3.2f c/s (%3.2f MHz)\n",mean_cs,mean_freq);
+ OUTPUT_STATS(" simulated mcu instructions : %"PRId64"\n",MCU_INSN_CPT);
+ OUTPUT_STATS(" simulated mcu cycles : %"PRId64"\n",MCU_CYCLE_CPT);
+ OUTPUT_STATS(" simulated mcu mean freq : %3.2f c/s (%3.2f MHz)\n",mean_cs,mean_freq);
if (user_nanotime > 0)
{
simu_mean_cs = (float)MCU_CYCLE_CPT / ((float)user_nanotime / (float)NANO);
simu_mean_freq = simu_mean_cs / (1000*1000);
- OUTPUT(" simulation mean freq : %3.2f c/s (%3.2f MHz)\n",simu_mean_cs,simu_mean_freq);
- OUTPUT(" - does not take into account sleep modes\n");
+ OUTPUT_STATS(" simulation mean freq : %3.2f c/s (%3.2f MHz)\n",simu_mean_cs,simu_mean_freq);
+ OUTPUT_STATS(" - does not take into account sleep modes\n");
}
}
View
4 arch/mcugen/mcugen.c
@@ -249,8 +249,8 @@ void mcu_state_restore(void)
void mcu_print_description(void)
{
- OUTPUT("mcu : %s\n",MCU_NAME);
- OUTPUT("model : %s\n",MCU_MODEL_NAME);
+ OUTPUT_BOXM("mcu : %s\n",MCU_NAME);
+ OUTPUT_BOXM("model : %s\n",MCU_MODEL_NAME);
}
View
24 arch/msp430/msp430.c
@@ -75,11 +75,11 @@ char* mcu_modelname(void)
void mcu_print_description(void)
{
- OUTPUT("mcu : %s\n",MCU_NAME);
- OUTPUT("model : %s\n",MCU_MODEL_NAME);
- OUTPUT(" xin : %d\n",MCU_CLOCK.lfxt1_freq);
+ OUTPUT_BOXM("mcu : %s\n",MCU_NAME);
+ OUTPUT_BOXM("model : %s\n",MCU_MODEL_NAME);
+ OUTPUT_BOXM(" xin : %d\n",MCU_CLOCK.lfxt1_freq);
#if defined(__msp430_have_xt2)
- OUTPUT(" xt2 : %d\n",MCU_CLOCK.xt2_freq);
+ OUTPUT_BOXM(" xt2 : %d\n",MCU_CLOCK.xt2_freq);
#endif
}
@@ -476,19 +476,19 @@ void mcu_dump_stats(int64_t user_nanotime)
mean_cs = (float)MCU_CYCLE_CPT / ((float)MACHINE_TIME_GET_NANO() / (float)NANO);
mean_freq = mean_cs / (1000*1000);
- OUTPUT(" simulated mcu instructions : %"PRId64"\n",MCU_INSN_CPT);
- OUTPUT(" simulated mcu cycles : %"PRId64"\n",MCU_CYCLE_CPT);
- OUTPUT(" simulated mcu mean freq : %3.2f c/s (%3.2f MHz)\n",mean_cs,mean_freq);
+ OUTPUT_STATS(" simulated mcu instructions : %"PRId64"\n",MCU_INSN_CPT);
+ OUTPUT_STATS(" simulated mcu cycles : %"PRId64"\n",MCU_CYCLE_CPT);
+ OUTPUT_STATS(" simulated mcu mean freq : %3.2f c/s (%3.2f MHz)\n",mean_cs,mean_freq);
if (user_nanotime > 0)
{
simu_mean_cs = (float)MCU_CYCLE_CPT / ((float)user_nanotime / (float)NANO);
simu_mean_freq = simu_mean_cs / (1000*1000);
- OUTPUT(" simulation mean freq : %3.2f c/s (%3.2f MHz)\n",simu_mean_cs,simu_mean_freq);
- OUTPUT(" - does not take into account sleep modes\n");
+ OUTPUT_STATS(" simulation mean freq : %3.2f c/s (%3.2f MHz)\n",simu_mean_cs,simu_mean_freq);
+ OUTPUT_STATS(" - does not take into account sleep modes\n");
}
- OUTPUT(" mcu exit at PC : 0x%04x\n",mcu_get_pc());
- OUTPUT(" mcu exit in LPM mode : %s\n",msp430_lpm_names[RUNNING_MODE()]);
- OUTPUT(" mcu exit with IV : 0x%08x\n",MCU_IV);
+ OUTPUT_STATS(" mcu exit at PC : 0x%04x\n",mcu_get_pc());
+ OUTPUT_STATS(" mcu exit in LPM mode : %s\n",msp430_lpm_names[RUNNING_MODE()]);
+ OUTPUT_STATS(" mcu exit with IV : 0x%08x\n",MCU_IV);
}
/* ************************************************** */
View
2  arch/msp430/msp430_adc12.c
@@ -494,7 +494,7 @@ void msp430_adc12_update(void)
else
{
ERROR("msp430:adc12: channel out of bounds\n");
- machine_exit(1);
+ machine_exit_error();
}
}
else
View
8 arch/msp430/msp430_io.c
@@ -216,7 +216,7 @@ static void msp430_set_readptr8(addr_map_read8_t f, uint16_t addr)
else
{
ERROR("msp430:io: MCU create error, IO read8 0x%04x function not unique\n",addr);
- machine_exit(0);
+ machine_exit_error();
}
}
@@ -242,7 +242,7 @@ static void msp430_set_readptr16(addr_map_read16_t f, uint16_t addr)
#if defined(ADDR_MIRROR_START)
ERROR("msp430:io: %p : ram mirror\n", msp430_read16_ram_mirrored);
#endif
- machine_exit(0);
+ machine_exit_error();
}
}
@@ -258,7 +258,7 @@ static void msp430_set_writeptr8(addr_map_write8_t f, uint16_t addr)
else
{
ERROR("msp430:io: MCU create error, IO write8 0x%04x function not unique\n",addr);
- machine_exit(0);
+ machine_exit_error();
}
}
@@ -274,7 +274,7 @@ static void msp430_set_writeptr16(addr_map_write16_t f, uint16_t addr)
else
{
ERROR("msp430:io: MCU create error, IO write16 0x%04x function not unique\n",addr);
- machine_exit(0);
+ machine_exit_error();
}
}
View
6 devices/devices.c
@@ -81,12 +81,12 @@ int devices_reset(void)
void devices_print(void)
{
int i;
- OUTPUT("device list:\n");
+ OUTPUT_BOXM("device list:\n");
for(i=0; i < machine.device_max; i++)
{
if (machine.device[i].name != NULL)
{
- OUTPUT(" dev %02d : %s\n",i,machine.device[i].name);
+ OUTPUT_BOXM(" dev %02d : %s\n",i,machine.device[i].name);
}
}
}
@@ -102,7 +102,7 @@ void devices_dump_stats(int64_t user_nanotime)
{
if (machine.device[i].name != NULL)
{
- OUTPUT(" - %-28s:\n",machine.device[i].name);
+ OUTPUT_STATS(" - %-28s:\n",machine.device[i].name);
if (machine.device[i].statdump != NULL)
{
machine.device[i].statdump(i,user_nanotime);
View
2  devices/ds2411/ds2411_dev.c
@@ -1105,7 +1105,7 @@ void ds2411_ui_get_pos (int UNUSED dev, int *x, int *y)
void ds2411_statdump(int dev, wsimtime_t UNUSED user_nanotime)
{
- OUTPUT(" + id: %s\n", ds2411_id_to_str( & DS2411_ID ));
+ OUTPUT_STATS(" + id: %s\n", ds2411_id_to_str( & DS2411_ID ));
}
/***************************************************/
View
2  devices/ptty/ptty_dev.c
@@ -193,7 +193,7 @@ void ptty_statdump(int dev, wsimtime_t UNUSED user_nanotime)
{
if (opt_array[PTTY_SERID].io.value)
{
- OUTPUT(" + opt: %s\n", opt_array[PTTY_SERID].io.value);
+ OUTPUT_STATS(" + opt: %s\n", opt_array[PTTY_SERID].io.value);
}
}
View
8 liblogger/logger.h
@@ -64,6 +64,14 @@ void REAL_STDERR(char* fmp, ...);
void OUTPUT(char* fmt, ...); // verbose 0
void ERROR (char* fmt, ...); // verbose 0
+#define OUTPUT_BOXS(x...) OUTPUT(",----\n" x);
+#define OUTPUT_BOXM(x...) OUTPUT("| " x);
+#define OUTPUT_BOXE(x...) OUTPUT("`----\n" x);
+
+#define OUTPUT_STATS_START(x...) OUTPUT_BOXS(x)
+#define OUTPUT_STATS(x...) OUTPUT_BOXM(x)
+#define OUTPUT_STATS_STOP(x...) OUTPUT_BOXE(x)
+
#if defined(VERBOSE_IS_A_FUNC)
#else
#define VERBOSE(level, x...) \
View
3  libselect/libselect_socket.c
@@ -34,6 +34,7 @@
#define LISTENQ 2 // socket listen fifo size (backlog)
+void app_exit_error ();
/* ************************************************** */
/* ************************************************** */
@@ -144,7 +145,7 @@ void READ1(char *var, char* delim, int size, int n)
/* tcp:s:machine:port */
/* tcp:c:machine:port */
/* udp:local:port:remote:port */
- exit(1);
+ app_exit_error();
}
}
View
9 libtracer/tracer.c
@@ -26,8 +26,7 @@
#include "tracer_bin.h"
#include "tracer_vcd.h"
-#define APP_EXIT(i) exit(i)
-
+void app_exit_error();
/* ************************************************** */
/* ************************************************** */
@@ -244,7 +243,7 @@ tracer_event_add_id(int width, const char* name, const char* module)
tracer_width[i] == width)
{
ERROR("tracer: event %s.%s is already registered\n",module,name);
- APP_EXIT(1);
+ app_exit_error();
return -1;
}
}
@@ -255,13 +254,13 @@ tracer_event_add_id(int width, const char* name, const char* module)
if (id >= (TRACER_MAX_ID - 1))
{
ERROR("tracer: max event recording reached, could not register [%s] = %d\n",name,id);
- APP_EXIT(1);
+ app_exit_error();
}
if ((name == NULL) || (strlen(name) == 0))
{
ERROR("tracer: event id %d must have a valid name (non null)\n",id);
- APP_EXIT(1);
+ app_exit_error();
}
if (((width < 1) || (width > 64)) && (strcmp(name,"__WSIMLOGBUFFER") != 0))
View
3  libwsnet/wsnet1.c
@@ -779,10 +779,9 @@ static ssize_t worldsens1_packet_recv_internal(int fd, char* msg, size_t len, in
ERROR("= fd=%d, msg=0x%lx, len=%lu, srec=%ld, flags=%d, dump=%d\n",
fd, (unsigned long)msg, (long unsigned)len, (long)srec, flags, dump);
ERROR("= current time = %"PRIu64" ns\n",MACHINE_TIME_GET_NANO());
- //ERROR("= worldsens:recv: %s\n",strerror(errno));
ERROR("===================================================\n");
worldsens1_close_fds();
- machine_exit(0);
+ machine_exit_error();
}
if (dump)
View
42 machine/machine.c
@@ -15,10 +15,10 @@
#include "arch/common/hardware.h"
#include "devices/devices.h"
-#include "machine/machine.h"
#include "libelf/libelf.h"
#include "libetrace/libetrace.h"
#include "liblogger/logger.h"
+#include "src/common.h"
#include "machine_mon.h"
#include "machine.h"
@@ -240,10 +240,10 @@ int machine_get_node_id(void)
/* ************************************************** */
/* ************************************************** */
-void machine_exit(int arg)
+void machine_exit_error()
{
- REAL_STDERR("wsim: error, exit\n");
- exit(arg);
+ INFO("wsim:machine: exit error\n");
+ app_exit_error();
}
/* ************************************************** */
@@ -458,10 +458,11 @@ void machine_monitor(char* monitor, char *modify)
void machine_print_description()
{
- OUTPUT("== Machine description\n");
+ OUTPUT_BOXS("");
+ OUTPUT_BOXM("Machine description\n");
mcu_print_description();
devices_print();
- OUTPUT("==\n");
+ OUTPUT_BOXE("");
}
/* ************************************************** */
@@ -656,29 +657,24 @@ void machine_dump_stats(uint64_t user_nanotime)
ms = ( MACHINE_TIME_GET_NANO() - (s * NANO)) / MILLI;
us = ( MACHINE_TIME_GET_NANO() - (s * NANO)) / MICRO;
- OUTPUT("Machine stats:\n");
- OUTPUT("--------------\n");
- OUTPUT(" simulated time : %"PRId64" ns (%"PRId64".%03"PRId64" s)\n", MACHINE_TIME_GET_NANO(),s,ms);
+ OUTPUT_STATS("Machine stats:\n");
+ OUTPUT_STATS("--------------\n");
+ OUTPUT_STATS(" simulated time : %"PRId64" ns (%"PRId64".%03"PRId64" s)\n",
+ MACHINE_TIME_GET_NANO(),s,ms);
if (user_nanotime > 0)
{
speedup = (float)MACHINE_TIME_GET_NANO() / (float)user_nanotime;
- OUTPUT(" simulation speedup : %2.2f\n",speedup);
+ OUTPUT_STATS(" simulation speedup : %2.2f\n",speedup);
}
- OUTPUT(" machine exit with signal : %s\n",mcu_signal_str());
-
- OUTPUT("\n");
-
- OUTPUT("MCU:\n");
- OUTPUT("----\n");
+ OUTPUT_STATS(" machine exit with signal : %s\n",mcu_signal_str());
+ OUTPUT_STATS("\n");
+ OUTPUT_STATS("MCU:\n");
+ OUTPUT_STATS("----\n");
mcu_dump_stats(user_nanotime);
-
- OUTPUT("\n");
-
- OUTPUT("DEVICES:\n");
- OUTPUT("--------\n");
+ OUTPUT_STATS("\n");
+ OUTPUT_STATS("DEVICES:\n");
+ OUTPUT_STATS("--------\n");
devices_dump_stats(user_nanotime);
-
- OUTPUT("\n");
}
/**************************************************/
View
1  machine/machine.h
@@ -76,7 +76,6 @@ wsimtime_t machine_get_nanotime(void);
/**
* machine_run
**/
-void machine_exit (int arg);
void machine_run (struct machine_opt_t *m);
/**
View
2  machine/machine_fd.h
@@ -111,7 +111,7 @@ extern struct machine_t machine;
/* ************************************************** */
/* ************************************************** */
-void machine_exit (int arg);
+void machine_exit_error ();
#define MACHINE_TIME_GET_NANO() machine.state->nanotime
#define MACHINE_TIME_GET_INCR() machine.nanotime_incr
View
6 platforms/senslab/senslab.c
@@ -525,11 +525,11 @@ int devices_update(void)
case USART_MODE_SPI:
if (msp430_usart1_dev_read_spi(&val8))
{
- if ((!FLASH_CS + !RADIO_CSn + !DS1722_CS) > 1)
+ if ((!FLASH_CS + !RADIO_CSn + DS1722_CS) > 1)
{
- WARNING("senslab:devices: more than one device among flash / radio / thermometer enabled at the same time on SPI1\n");
+ WARNING("senslab:devices: more than one device among flash(%d)/radio(%d)/thermometer(%d) enabled at the same time on SPI1\n",!FLASH_CS,!RADIO_CSn,DS1722_CS);
}
- // HW_DMSG_MISC("senslab:write: to SPI1 devices: 0x%02x\n",val8);
+
machine.device[FLASH ].write(FLASH, M25P_D, val8);
machine.device[DS1722].write(DS1722, DS1722_D_MASK, val8);
machine.device[RADIO ].write(RADIO, RADIO_DATA_MASK, val8);
View
15 platforms/telosb/telosb.c
@@ -509,20 +509,11 @@ int devices_update()
*/
if ((SYSTEM_FLASH_CS == 0) && (SYSTEM_RADIO_CS == 0))
{
- WARNING("devices:telosb: Flash and Radio SPI are selected at the same time\n");
+ WARNING("telosb: Flash and Radio SPI are selected at the same time\n");
}
- /* tests can/should be removed */
- // if (SYSTEM_FLASH_CS == 0) /* M25P CS is negated */
- {
- machine.device[FLASH].write(FLASH, M25P_D, val8);
- }
-
- /* tests can/should be removed */
- // if (SYSTEM_RADIO_CS == 0) /* CC2420 CS is negated */
- {
- machine.device[RADIO].write(RADIO, CC2420_DATA_MASK, val8);
- }
+ machine.device[FLASH].write(FLASH, M25P_D, val8);
+ machine.device[RADIO].write(RADIO, CC2420_DATA_MASK, val8);
}
break;
case USART_MODE_UART:
View
22 src/common.h
@@ -0,0 +1,22 @@
+
+/**
+ * \file common.h
+ * \brief top level src include file
+ * \author Antoine Fraboulet
+ * \date 2011
+ **/
+
+#ifndef HW_COMMON_H
+#define HW_COMMON_H
+
+/* ************************************************** */
+/* ************************************************** */
+/* ************************************************** */
+
+void app_exit_error ();
+
+/* ************************************************** */
+/* ************************************************** */
+/* ************************************************** */
+
+#endif
View
85 src/main.c
@@ -71,7 +71,10 @@ static void main_end(enum wsim_end_mode_t mode);
void signal_quit(int signum)
{
- ERROR("wsim: received Unix signal %d (%s)\n",signum,host_signal_str(signum));
+ OUTPUT("================\n");
+ OUTPUT("== wsim stop ==\n");
+ OUTPUT("================\n");
+ INFO("\nwsim: received Unix signal %d (%s)\n",signum,host_signal_str(signum));
mcu_signal_add(SIG_HOST | signum);
main_end(WSIM_END_SIGNAL);
@@ -101,24 +104,24 @@ static void main_dump_stats()
OUTPUT("\n");
- OUTPUT("================\n");
- OUTPUT("WSim stats:\n");
- OUTPUT("-----------\n");
+ OUTPUT_STATS_START("");
+ OUTPUT_STATS("WSim stats:\n");
+ OUTPUT_STATS("-----------\n");
if (unanotime > 0)
{
int64_t sec = unanotime / NANO;
int64_t msec = (unanotime - sec*1000000000) / 1000000;
- OUTPUT(" simulation user time : %d.%03d s (%"PRId64" ns)\n", sec, msec, unanotime);
+ OUTPUT_STATS(" simulation user time : %d.%03d s (%"PRId64" ns)\n", sec, msec, unanotime);
/*
- * OUTPUT(" system simulation time : %d.%03d s\n",
+ * OUTPUT_BOXM(" system simulation time : %d.%03d s\n",
* ru.ru_stime.tv_sec, ru.ru_stime.tv_usec / 1000);
*/
}
- OUTPUT(" simulation backtracks : %d\n",machine.backtrack);
+ OUTPUT_STATS(" simulation backtracks : %d\n",machine.backtrack);
- OUTPUT("\n");
+ OUTPUT_STATS("\n");
machine_dump_stats(unanotime); /* system time */
- OUTPUT("================\n");
+ OUTPUT_STATS_STOP("");
}
/* ************************************************** */
@@ -169,27 +172,41 @@ static void main_run_mode(struct options_t* o)
/* ************************************************** */
/* ************************************************** */
+void app_exit_error()
+{
+ INFO ("wsim: error, exit\n");
+ ERROR("wsim: error, exit\n");
+ exit( EXIT_FAILURE );
+}
+
+/* ************************************************** */
+/* ************************************************** */
+/* ************************************************** */
+
static void main_end(enum wsim_end_mode_t mode)
{
main_dump_stats();
- MESSAGE("wsim:end mode %s (%d)\n", wsim_end_mode_str(mode), mode);
+
+ INFO("\n");
+ INFO("wsim: end mode %s (%d)\n", wsim_end_mode_str(mode), mode);
+
/* simulation done */
if (o.do_dump)
{
- INFO("wsim:dumper: dump machine state in [%s]\n",o.dumpfile);
+ INFO("wsim: dump machine state in [%s]\n",o.dumpfile);
machine_dump(o.dumpfile);
}
/* finishing traces */
if (o.do_trace)
{
- INFO("wsim:tracer: finalize trace in [%s]\n",o.tracefile);
+ INFO("wsim: finalize trace in [%s]\n",o.tracefile);
tracer_close();
}
if (o.do_etrace)
{
- INFO("wsim:tracer: finalize eTrace in [%s]\n",o.etracefile);
+ INFO("wsim: finalize etrace in [%s]\n",o.etracefile);
etracer_close();
}
@@ -199,7 +216,7 @@ static void main_end(enum wsim_end_mode_t mode)
logger_close();
logpkt_close();
ui_delete();
- exit(0);
+ exit( EXIT_SUCCESS );
}
/* ************************************************** */
@@ -234,21 +251,19 @@ int main(int argc, char* argv[])
/* do not use logger functions before that line */
logger_init(o.logfilename,o.verbose);
- /* init log radios packets*/
- logpkt_init(o.do_logpkt, o.logpkt, o.logpktfilename);
-
- OUTPUT_VERSION();
+ OUTPUT("%s\n",VERSION_STRING());
OUTPUT("copyright 2005, 2006, 2007, 2008, 2009, 2010, 2011\n");
OUTPUT("Citi Lab, INRIA, INSA de Lyon\n");
- OUTPUT("wsim:pid:%d\n",getpid());
+ OUTPUT("\n");
+ OUTPUT("wsim: pid %d\n",getpid());
switch (sizeof(long))
{
case 4:
- INFO("wsim: 32 bits edition\n");
+ INFO("wsim: 32-bit edition\n");
break;
case 8:
- INFO("wsim: 64 bits edition\n");
+ INFO("wsim: 64-bit edition\n");
break;
default:
INFO("wsim: alien edition\n");
@@ -264,6 +279,9 @@ int main(int argc, char* argv[])
/* event tracer */
tracer_init(o.tracefile, o.wsens_mode);
+ /* packet logger */
+ logpkt_init(o.do_logpkt, o.logpkt, o.logpktfilename);
+
/* libselect init */
libselect_init(o.wsens_mode);
@@ -318,13 +336,7 @@ int main(int argc, char* argv[])
{
ERROR("** Cannot load file, bailing out\n");
machine_delete();
- exit(0);
- }
-
- /* what has been created so far */
- if (o.verbose > 1)
- {
- machine_print_description();
+ machine_exit_error();
}
/* GUI */
@@ -353,7 +365,24 @@ int main(int argc, char* argv[])
tracer_start();
}
+ /* radios packets logger */
+ if (o.do_logpkt)
+ {
+ INFO("wsim: starting packet logger\n");
+ }
+
+ /* what has been created so far */
+ if (o.verbose > 1)
+ {
+ OUTPUT("\n");
+ machine_print_description();
+ }
+
/* go */
+ OUTPUT("\n");
+ OUTPUT("================\n");
+ OUTPUT("== wsim start ==\n");
+ OUTPUT("================\n");
main_run_mode(&o);
main_end(WSIM_END_NORMAL);
View
18 src/options.c
@@ -446,11 +446,11 @@ void options_read_cmdline(struct options_t *s, int *argc, char *argv[])
{
case OPT_MISSING:
fprintf(stderr,STR_MISSING,wsim_options.list[optindex]->longname);
- exit(1);
+ exit( EXIT_FAILURE );
case OPT_UNKNOWN:
fprintf(stderr,STR_UNKNOWN,argv[parseindex]);
options_usage(argv[0]);
- exit(1);
+ exit( EXIT_FAILURE );
case OPT_EOOPT: /* ok, do nothing */
break;
}
@@ -460,7 +460,7 @@ void options_read_cmdline(struct options_t *s, int *argc, char *argv[])
if (help_opt.isset)
{
options_usage(argv[0]);
- exit(0);
+ exit( EXIT_SUCCESS );
}
if (dump_opt.isset)
@@ -548,7 +548,7 @@ void options_read_cmdline(struct options_t *s, int *argc, char *argv[])
else
{
OPT_ERROR("mode must be set to gdb|console|run|insn|time\n");
- exit(1);
+ exit( EXIT_FAILURE );
}
}
else /* run mode not set */
@@ -557,7 +557,7 @@ void options_read_cmdline(struct options_t *s, int *argc, char *argv[])
if (modearg_opt.isset)
{
OPT_ERROR("modearg must be used according to mode=[gdb|insn|time]\n");
- exit(1);
+ exit( EXIT_FAILURE );
}
}
@@ -623,8 +623,8 @@ void options_read_cmdline(struct options_t *s, int *argc, char *argv[])
if (version_opt.isset)
{
- OUTPUT_VERSION();
- exit(EXIT_SUCCESS);
+ OPT_PRINT("%s\n",VERSION_STRING());
+ exit( EXIT_SUCCESS );
}
if (preload_opt.isset)
@@ -679,7 +679,7 @@ void options_read_cmdline(struct options_t *s, int *argc, char *argv[])
{
OPT_ERROR("\n ** missing node_id option ** \n\n");
options_usage(argv[0]);
- exit(1);
+ exit( EXIT_FAILURE );
}
if (realtime_opt.isset && (wsnet1_mode_opt.isset || wsnet2_mode_opt.isset))
@@ -706,7 +706,7 @@ void options_read_cmdline(struct options_t *s, int *argc, char *argv[])
{
OPT_ERROR("\n ** missing exec name, no program loaded ** \n\n");
options_usage(argv[0]);
- exit(1);
+ exit( EXIT_FAILURE );
}
}
}
View
4 src/revision.h
@@ -47,9 +47,7 @@ static char* extract_revision_number()
/* ************************************************** */
/* ************************************************** */
-#define OUTPUT_VERSION() \
- STDOUT("%s: version %s, rev %s, build %s.\n", \
- PACKAGE, PACKAGE_VERSION, extract_revision_number(), __DATE__)
+#define VERSION_STRING() ( "WSim version " PACKAGE_VERSION ", rev. " REVISION ", build " __DATE__ )
/* ************************************************** */
/* ************************************************** */
View
3  utils/console/.gitignore
@@ -0,0 +1,3 @@
+/aclocal.m4
+/autom4te.cache
+/configure
View
1  utils/console/doc/.gitignore
@@ -0,0 +1 @@
+/texinfo.tex
View
4 utils/console/src/main.c
@@ -75,7 +75,7 @@ void usage(char* name)
--log=name -l : logfile name \n\
--width=n -W : window width \n\
--height=n -H : window height \n",name);
- exit(1);
+ exit( EXIT_FAILURE );
}
/* ************************************************** */
@@ -375,7 +375,7 @@ main(int argc, char *argv[])
console.screen_height,console.io_mode)) == NULL)
{
fprintf(stderr,"Cannot create user interface\n");
- exit(1);
+ exit( EXIT_FAILURE );
}
if (console.io_mode == UI_MODE_OUTPUT)
View
2  utils/crctools/src/main.c
@@ -116,7 +116,7 @@ int main(int argc, char* argv[])
if (argc > 1)
{
usage();
- exit(0);
+ exit( EXIT_FAILURE );
}
fin = stdin;
View
3  utils/wsnet1/include/public/simulation.h
@@ -42,7 +42,8 @@ extern int g_m_nodes;
/**************************************************************************/
/**************************************************************************/
/**************************************************************************/
-int simulation_start (int arg, char * argv[]);
+void app_exit_error ();
+int simulation_start (int arg, char * argv[]);
#endif //_SIMULATION_H
View
6 utils/wsnet1/src/worldsens_wsnet.c
@@ -2,6 +2,12 @@
/* main function */
+void
+app_exit_error()
+{
+ exit( EXIT_FAILURE );
+}
+
int
main (int argc, char **argv)
{
View
4 utils/wtracer/src/main.c
@@ -56,7 +56,7 @@ void usage(char* prog)
wtracer --in=wsim.trc --out=- --format=vcd | gtkwave --vcd\n\
", prog);
- exit(1);
+ exit( EXIT_FAILURE );
}
/* ************************************************** */
@@ -220,7 +220,7 @@ int options_validation(tracer_t *t)
#define ERR_EXIT(x...) \
do { \
ERROR(x); \
- exit(1); \
+ exit( EXIT_FAILURE ); \
} while (0)
int main(int argc, char* argv[])
Please sign in to comment.
Something went wrong with that request. Please try again.