Added a MicroMod Master sample in examples/TestMasterMicroMod. Fixed some SDO abort code and callback problem in sdo.c.
authoretisserant
Tue, 17 Apr 2007 16:13:22 +0200
changeset 166 b6fbc1c59a44
parent 165 4ff8b68c6ee0
child 167 b2f8b91d89b5
Added a MicroMod Master sample in examples/TestMasterMicroMod. Fixed some SDO abort code and callback problem in sdo.c.
CanFestival-3.vc8.sln
configure
examples/Makefile.in
examples/TestMasterMicroMod/.cvsignore
examples/TestMasterMicroMod/Makefile.in
examples/TestMasterMicroMod/TestMaster.c
examples/TestMasterMicroMod/TestMaster.h
examples/TestMasterMicroMod/TestMaster.od
examples/TestMasterMicroMod/TestMasterMicroMod.c
examples/TestMasterMicroMod/TestMasterMicroMod.h
examples/TestMasterMicroMod/TestMasterMicroMod.vcproj
examples/TestMasterMicroMod/getopt.c
examples/TestMasterMicroMod/getopt.h
examples/TestMasterSlave/TestMasterSalve.vcproj
examples/TestMasterSlave/TestMasterSlave.vcproj
examples/TestMasterSlave/strace.txt
src/sdo.c
--- a/CanFestival-3.vc8.sln	Tue Apr 17 16:11:38 2007 +0200
+++ b/CanFestival-3.vc8.sln	Tue Apr 17 16:13:22 2007 +0200
@@ -9,7 +9,7 @@
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "can_peak_win32", "drivers\can_peak_win32\can_peak_win32.vcproj", "{732EC5B6-C6F1-4783-9BC8-924FFF67BF5A}"
 EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "TestMasterSlave", "examples\TestMasterSlave\TestMasterSalve.vcproj", "{B51A176D-5320-4534-913B-3025CED5B27E}"
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "TestMasterSlave", "examples\TestMasterSlave\TestMasterSlave.vcproj", "{B51A176D-5320-4534-913B-3025CED5B27E}"
 EndProject
 Global
 	GlobalSection(SolutionConfigurationPlatforms) = preSolution
--- a/configure	Tue Apr 17 16:11:38 2007 +0200
+++ b/configure	Tue Apr 17 16:13:22 2007 +0200
@@ -647,6 +647,11 @@
 \	examples/TestMasterSlave/Makefile.in
 fi
 
+if [ "$SUB_TARGET" = "unix" ]; then
+	MAKEFILES=$MAKEFILES\
+\	examples/TestMasterMicroMod/Makefile.in
+fi
+
 if [ "$SUB_TARGET" = "hcs12" ]; then
 	MAKEFILES=$MAKEFILES\
 \	examples/gene_SYNC_HCS12/Makefile.in
--- a/examples/Makefile.in	Tue Apr 17 16:11:38 2007 +0200
+++ b/examples/Makefile.in	Tue Apr 17 16:13:22 2007 +0200
@@ -27,32 +27,30 @@
 ifeq ($(TARGET),hc12)
 	$(MAKE) -C gene_SYNC_HCS12 $@
 endif
+
 ifeq ($(TARGET),unix)
 	$(MAKE) -C TestMasterSlave $@
+	$(MAKE) -C TestMasterMicroMod $@
 endif
 
 clean:
 ifeq ($(TARGET),hc12)
 	$(MAKE) -C gene_SYNC_HCS12 $@
 endif
+
 ifeq ($(TARGET),unix)
 	$(MAKE) -C TestMasterSlave $@
+	$(MAKE) -C TestMasterMicroMod $@
 endif
 
+
+
 mrproper: clean
 ifeq ($(TARGET),hc12)
 	$(MAKE) -C gene_SYNC_HCS12 $@
 endif
+
 ifeq ($(TARGET),unix)
 	$(MAKE) -C TestMasterSlave $@
-endif
-
-install:
-ifeq ($(TARGET),unix)
-	$(MAKE) -C TestMasterSlave $@
-endif
-
-uninstall:
-ifeq ($(TARGET),unix)
-	$(MAKE) -C TestMasterSlave $@
-endif
+	$(MAKE) -C TestMasterMicroMod $@
+endif
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/examples/TestMasterMicroMod/.cvsignore	Tue Apr 17 16:13:22 2007 +0200
@@ -0,0 +1,2 @@
+Makefile
+TestMasterMicroMod
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/examples/TestMasterMicroMod/Makefile.in	Tue Apr 17 16:13:22 2007 +0200
@@ -0,0 +1,72 @@
+#! gmake
+
+#
+# Copyright (C) 2006 Laurent Bessard
+# 
+# This file is part of canfestival, a library implementing the canopen
+# stack
+# 
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+# 
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# Lesser General Public License for more details.
+# 
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+# 
+
+CC = SUB_CC
+OPT_CFLAGS = -O2
+CFLAGS = SUB_OPT_CFLAGS
+PROG_CFLAGS = SUB_PROG_CFLAGS
+EXE_CFLAGS = SUB_EXE_CFLAGS
+OS_NAME = SUB_OS_NAME
+ARCH_NAME = SUB_ARCH_NAME
+PREFIX = SUB_PREFIX
+TARGET = SUB_TARGET
+CAN_DRIVER = SUB_CAN_DRIVER
+TIMERS_DRIVER = SUB_TIMERS_DRIVER
+
+INCLUDES = -I../../include -I../../include/$(TARGET) -I../../include/$(CAN_DRIVER) -I../../include/$(TIMERS_DRIVER)
+
+MASTER_OBJS = TestMaster.o TestMasterMicroMod.o
+
+OBJS = $(MASTER_OBJS) ../../src/libcanfestival.a ../../drivers/$(TARGET)/libcanfestival_$(TARGET).a
+
+ifeq ($(TIMERS_DRIVER),timers_xeno)
+	PROGDEFINES = -DUSE_XENO
+endif
+
+all: TestMasterMicroMod
+
+../../drivers/$(TARGET)/libcanfestival_$(TARGET).a:
+	$(MAKE) -C ../../drivers/$(TARGET) libcanfestival_$(TARGET).a
+
+
+TestMasterMicroMod: TestMaster.c $(OBJS)
+	$(CC) $(CFLAGS) $(PROG_CFLAGS) ${PROGDEFINES} $(INCLUDES) -o $@ $(OBJS) $(EXE_CFLAGS)
+
+	
+TestMaster.c: TestMaster.od
+	$(MAKE) -C ../../objdictgen gnosis
+	python ../../objdictgen/objdictgen.py TestMaster.od TestMaster.c
+
+%o: %c
+	$(CC) $(CFLAGS) $(PROG_CFLAGS) ${PROGDEFINES} $(INCLUDES) -o $@ -c $<
+
+clean:
+	rm -f $(MASTER_OBJS)
+	rm -f TestMasterMicroMod
+
+mrproper: clean
+	rm -f TestMaster.c
+	
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/examples/TestMasterMicroMod/TestMaster.c	Tue Apr 17 16:13:22 2007 +0200
@@ -0,0 +1,488 @@
+
+/* File generated by gen_cfile.py. Should not be modified. */
+
+#include "TestMaster.h"
+
+/**************************************************************************/
+/* Declaration of the mapped variables                                    */
+/**************************************************************************/
+UNS8 DO = 0x0;		/* Mapped at index 0x2000, subindex 0x00 */
+UNS8 AO1 = 0x0;		/* Mapped at index 0x2001, subindex 0x00 */
+UNS8 AO2 = 0x0;		/* Mapped at index 0x2002, subindex 0x00 */
+UNS8 AO3 = 0x0;		/* Mapped at index 0x2003, subindex 0x00 */
+UNS8 DI = 0x0;		/* Mapped at index 0x2004, subindex 0x00 */
+UNS8 AI1 = 0x0;		/* Mapped at index 0x2005, subindex 0x00 */
+UNS8 AI2 = 0x0;		/* Mapped at index 0x2006, subindex 0x00 */
+UNS8 AI3 = 0x0;		/* Mapped at index 0x2007, subindex 0x00 */
+UNS8 AI4 = 0x0;		/* Mapped at index 0x2008, subindex 0x00 */
+UNS8 AI5 = 0x0;		/* Mapped at index 0x2009, subindex 0x00 */
+UNS8 AI6 = 0x0;		/* Mapped at index 0x200A, subindex 0x00 */
+UNS8 AI7 = 0x0;		/* Mapped at index 0x200B, subindex 0x00 */
+UNS8 AI8 = 0x0;		/* Mapped at index 0x200C, subindex 0x00 */
+UNS8 AO4 = 0x0;		/* Mapped at index 0x200D, subindex 0x00 */
+
+/**************************************************************************/
+/* Declaration of the value range types                                   */
+/**************************************************************************/
+
+UNS32 TestMaster_valueRangeTest (UNS8 typeValue, void * value)
+{
+  switch (typeValue) {
+  }
+  return 0;
+}
+
+/**************************************************************************/
+/* The node id                                                            */
+/**************************************************************************/
+/* node_id default value.*/
+UNS8 TestMaster_bDeviceNodeId = 0x01;
+
+/**************************************************************************/
+/* Array of message processing information */
+
+const UNS8 TestMaster_iam_a_slave = 0;
+
+TIMER_HANDLE TestMaster_heartBeatTimers[1] = {TIMER_NONE,};
+
+/*
+$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
+
+                               OBJECT DICTIONARY
+
+$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
+*/
+
+/* index 0x1000 :   Device Type. */
+                    UNS32 TestMaster_obj1000 = 0x191;	/* 401 */
+                    subindex TestMaster_Index1000[] = 
+                     {
+                       { RO, uint32, sizeof (UNS32), (void*)&TestMaster_obj1000 }
+                     };
+
+/* index 0x1001 :   Error Register. */
+                    UNS8 TestMaster_obj1001 = 0x0;	/* 0 */
+                    subindex TestMaster_Index1001[] = 
+                     {
+                       { RO, uint8, sizeof (UNS8), (void*)&TestMaster_obj1001 }
+                     };
+
+/* index 0x1005 :   SYNC COB ID. */
+                    UNS32 TestMaster_obj1005 = 0x40000080;	/* 1073741952 */
+                    ODCallback_t TestMaster_Index1005_callbacks[] = 
+                     {
+                       NULL,
+                     };
+                    subindex TestMaster_Index1005[] = 
+                     {
+                       { RW, uint32, sizeof (UNS32), (void*)&TestMaster_obj1005 }
+                     };
+
+/* index 0x1006 :   Communication / Cycle Period. */
+                    UNS32 TestMaster_obj1006 = 0xC350;	/* 50000 */
+                    ODCallback_t TestMaster_Index1006_callbacks[] = 
+                     {
+                       NULL,
+                     };
+                    subindex TestMaster_Index1006[] = 
+                     {
+                       { RW, uint32, sizeof (UNS32), (void*)&TestMaster_obj1006 }
+                     };
+
+/* index 0x1016 :   Consumer Heartbeat Time. */
+                    UNS8 TestMaster_highestSubIndex_obj1016 = 1; /* number of subindex - 1*/
+                    UNS32 TestMaster_obj1016[] = 
+                    {
+                      0x4005DC	/* 4195804 */
+                    };
+                    subindex TestMaster_Index1016[] = 
+                     {
+                       { RO, uint8, sizeof (UNS8), (void*)&TestMaster_highestSubIndex_obj1016 },
+                       { RW, uint32, sizeof (UNS32), (void*)&TestMaster_obj1016[0] }
+                     };
+
+/* index 0x1017 :   Producer Heartbeat Time */ 
+                    UNS16 TestMaster_obj1017 = 0x0;   /* 0 */
+
+/* index 0x1018 :   Identity. */
+                    UNS8 TestMaster_highestSubIndex_obj1018 = 4; /* number of subindex - 1*/
+                    UNS32 TestMaster_obj1018_Vendor_ID = 0x0;	/* 0 */
+                    UNS32 TestMaster_obj1018_Product_Code = 0x0;	/* 0 */
+                    UNS32 TestMaster_obj1018_Revision_Number = 0x0;	/* 0 */
+                    UNS32 TestMaster_obj1018_Serial_Number = 0x0;	/* 0 */
+                    subindex TestMaster_Index1018[] = 
+                     {
+                       { RO, uint8, sizeof (UNS8), (void*)&TestMaster_highestSubIndex_obj1018 },
+                       { RO, uint32, sizeof (UNS32), (void*)&TestMaster_obj1018_Vendor_ID },
+                       { RO, uint32, sizeof (UNS32), (void*)&TestMaster_obj1018_Product_Code },
+                       { RO, uint32, sizeof (UNS32), (void*)&TestMaster_obj1018_Revision_Number },
+                       { RO, uint32, sizeof (UNS32), (void*)&TestMaster_obj1018_Serial_Number }
+                     };
+
+/* index 0x1280 :   Client SDO 1 Parameter. */
+                    UNS8 TestMaster_highestSubIndex_obj1280 = 3; /* number of subindex - 1*/
+                    UNS32 TestMaster_obj1280_COB_ID_Client_to_Server_Transmit_SDO = 0x640;	/* 1600 */
+                    UNS32 TestMaster_obj1280_COB_ID_Server_to_Client_Receive_SDO = 0x5C0;	/* 1472 */
+                    UNS32 TestMaster_obj1280_Node_ID_of_the_SDO_Server = 0x40;	/* 64 */
+                    subindex TestMaster_Index1280[] = 
+                     {
+                       { RO, uint8, sizeof (UNS8), (void*)&TestMaster_highestSubIndex_obj1280 },
+                       { RW, uint32, sizeof (UNS32), (void*)&TestMaster_obj1280_COB_ID_Client_to_Server_Transmit_SDO },
+                       { RW, uint32, sizeof (UNS32), (void*)&TestMaster_obj1280_COB_ID_Server_to_Client_Receive_SDO },
+                       { RW, uint32, sizeof (UNS32), (void*)&TestMaster_obj1280_Node_ID_of_the_SDO_Server }
+                     };
+
+/* index 0x1400 :   Receive PDO 1 Parameter. */
+                    UNS8 TestMaster_highestSubIndex_obj1400 = 5; /* number of subindex - 1*/
+                    UNS32 TestMaster_obj1400_COB_ID_used_by_PDO = 0x220;	/* 544 */
+                    UNS8 TestMaster_obj1400_Transmission_Type = 0x1;	/* 1 */
+                    UNS16 TestMaster_obj1400_Inhibit_Time = 0x0;	/* 0 */
+                    UNS16 TestMaster_obj1400_Compatibility_Entry = 0x0;	/* 0 */
+                    UNS16 TestMaster_obj1400_Event_Timer = 0x0;	/* 0 */
+                    subindex TestMaster_Index1400[] = 
+                     {
+                       { RO, uint8, sizeof (UNS8), (void*)&TestMaster_highestSubIndex_obj1400 },
+                       { RW, uint32, sizeof (UNS32), (void*)&TestMaster_obj1400_COB_ID_used_by_PDO },
+                       { RW, uint8, sizeof (UNS8), (void*)&TestMaster_obj1400_Transmission_Type },
+                       { RW, uint16, sizeof (UNS16), (void*)&TestMaster_obj1400_Inhibit_Time },
+                       { RW, uint16, sizeof (UNS16), (void*)&TestMaster_obj1400_Compatibility_Entry },
+                       { RW, uint16, sizeof (UNS16), (void*)&TestMaster_obj1400_Event_Timer }
+                     };
+
+/* index 0x1401 :   Receive PDO 2 Parameter. */
+                    UNS8 TestMaster_highestSubIndex_obj1401 = 5; /* number of subindex - 1*/
+                    UNS32 TestMaster_obj1401_COB_ID_used_by_PDO = 0x320;	/* 800 */
+                    UNS8 TestMaster_obj1401_Transmission_Type = 0x1;	/* 1 */
+                    UNS16 TestMaster_obj1401_Inhibit_Time = 0x0;	/* 0 */
+                    UNS16 TestMaster_obj1401_Compatibility_Entry = 0x0;	/* 0 */
+                    UNS16 TestMaster_obj1401_Event_Timer = 0x0;	/* 0 */
+                    subindex TestMaster_Index1401[] = 
+                     {
+                       { RO, uint8, sizeof (UNS8), (void*)&TestMaster_highestSubIndex_obj1401 },
+                       { RW, uint32, sizeof (UNS32), (void*)&TestMaster_obj1401_COB_ID_used_by_PDO },
+                       { RW, uint8, sizeof (UNS8), (void*)&TestMaster_obj1401_Transmission_Type },
+                       { RW, uint16, sizeof (UNS16), (void*)&TestMaster_obj1401_Inhibit_Time },
+                       { RW, uint16, sizeof (UNS16), (void*)&TestMaster_obj1401_Compatibility_Entry },
+                       { RW, uint16, sizeof (UNS16), (void*)&TestMaster_obj1401_Event_Timer }
+                     };
+
+/* index 0x1402 :   Receive PDO 3 Parameter. */
+                    UNS8 TestMaster_highestSubIndex_obj1402 = 5; /* number of subindex - 1*/
+                    UNS32 TestMaster_obj1402_COB_ID_used_by_PDO = 0x420;	/* 1056 */
+                    UNS8 TestMaster_obj1402_Transmission_Type = 0x1;	/* 1 */
+                    UNS16 TestMaster_obj1402_Inhibit_Time = 0x0;	/* 0 */
+                    UNS16 TestMaster_obj1402_Compatibility_Entry = 0x0;	/* 0 */
+                    UNS16 TestMaster_obj1402_Event_Timer = 0x0;	/* 0 */
+                    subindex TestMaster_Index1402[] = 
+                     {
+                       { RO, uint8, sizeof (UNS8), (void*)&TestMaster_highestSubIndex_obj1402 },
+                       { RW, uint32, sizeof (UNS32), (void*)&TestMaster_obj1402_COB_ID_used_by_PDO },
+                       { RW, uint8, sizeof (UNS8), (void*)&TestMaster_obj1402_Transmission_Type },
+                       { RW, uint16, sizeof (UNS16), (void*)&TestMaster_obj1402_Inhibit_Time },
+                       { RW, uint16, sizeof (UNS16), (void*)&TestMaster_obj1402_Compatibility_Entry },
+                       { RW, uint16, sizeof (UNS16), (void*)&TestMaster_obj1402_Event_Timer }
+                     };
+
+/* index 0x1600 :   Receive PDO 1 Mapping. */
+                    UNS8 TestMaster_highestSubIndex_obj1600 = 1; /* number of subindex - 1*/
+                    UNS32 TestMaster_obj1600[] = 
+                    {
+                      0x20040008	/* 537133064 */
+                    };
+                    subindex TestMaster_Index1600[] = 
+                     {
+                       { RW, uint8, sizeof (UNS8), (void*)&TestMaster_highestSubIndex_obj1600 },
+                       { RW, uint32, sizeof (UNS32), (void*)&TestMaster_obj1600[0] }
+                     };
+
+/* index 0x1601 :   Receive PDO 2 Mapping. */
+                    UNS8 TestMaster_highestSubIndex_obj1601 = 4; /* number of subindex - 1*/
+                    UNS32 TestMaster_obj1601[] = 
+                    {
+                      0x20050008,	/* 537198600 */
+                      0x20060008,	/* 537264136 */
+                      0x20070008,	/* 537329672 */
+                      0x20080008	/* 537395208 */
+                    };
+                    subindex TestMaster_Index1601[] = 
+                     {
+                       { RW, uint8, sizeof (UNS8), (void*)&TestMaster_highestSubIndex_obj1601 },
+                       { RW, uint32, sizeof (UNS32), (void*)&TestMaster_obj1601[0] },
+                       { RW, uint32, sizeof (UNS32), (void*)&TestMaster_obj1601[1] },
+                       { RW, uint32, sizeof (UNS32), (void*)&TestMaster_obj1601[2] },
+                       { RW, uint32, sizeof (UNS32), (void*)&TestMaster_obj1601[3] }
+                     };
+
+/* index 0x1602 :   Receive PDO 3 Mapping. */
+                    UNS8 TestMaster_highestSubIndex_obj1602 = 4; /* number of subindex - 1*/
+                    UNS32 TestMaster_obj1602[] = 
+                    {
+                      0x20090008,	/* 537460744 */
+                      0x200A0008,	/* 537526280 */
+                      0x200B0008,	/* 537591816 */
+                      0x200C0008	/* 537657352 */
+                    };
+                    subindex TestMaster_Index1602[] = 
+                     {
+                       { RW, uint8, sizeof (UNS8), (void*)&TestMaster_highestSubIndex_obj1602 },
+                       { RW, uint32, sizeof (UNS32), (void*)&TestMaster_obj1602[0] },
+                       { RW, uint32, sizeof (UNS32), (void*)&TestMaster_obj1602[1] },
+                       { RW, uint32, sizeof (UNS32), (void*)&TestMaster_obj1602[2] },
+                       { RW, uint32, sizeof (UNS32), (void*)&TestMaster_obj1602[3] }
+                     };
+
+/* index 0x1800 :   Transmit PDO 1 Parameter. */
+                    UNS8 TestMaster_highestSubIndex_obj1800 = 5; /* number of subindex - 1*/
+                    UNS32 TestMaster_obj1800_COB_ID_used_by_PDO = 0x240;	/* 576 */
+                    UNS8 TestMaster_obj1800_Transmission_Type = 0x1;	/* 1 */
+                    UNS16 TestMaster_obj1800_Inhibit_Time = 0x0;	/* 0 */
+                    UNS16 TestMaster_obj1800_Compatibility_Entry = 0x0;	/* 0 */
+                    UNS16 TestMaster_obj1800_Event_Timer = 0x0;	/* 0 */
+                    subindex TestMaster_Index1800[] = 
+                     {
+                       { RO, uint8, sizeof (UNS8), (void*)&TestMaster_highestSubIndex_obj1800 },
+                       { RW, uint32, sizeof (UNS32), (void*)&TestMaster_obj1800_COB_ID_used_by_PDO },
+                       { RW, uint8, sizeof (UNS8), (void*)&TestMaster_obj1800_Transmission_Type },
+                       { RW, uint16, sizeof (UNS16), (void*)&TestMaster_obj1800_Inhibit_Time },
+                       { RW, uint16, sizeof (UNS16), (void*)&TestMaster_obj1800_Compatibility_Entry },
+                       { RW, uint16, sizeof (UNS16), (void*)&TestMaster_obj1800_Event_Timer }
+                     };
+
+/* index 0x1801 :   Transmit PDO 2 Parameter. */
+                    UNS8 TestMaster_highestSubIndex_obj1801 = 5; /* number of subindex - 1*/
+                    UNS32 TestMaster_obj1801_COB_ID_used_by_PDO = 0x0;	/* 0 */
+                    UNS8 TestMaster_obj1801_Transmission_Type = 0x0;	/* 0 */
+                    UNS16 TestMaster_obj1801_Inhibit_Time = 0x0;	/* 0 */
+                    UNS16 TestMaster_obj1801_Compatibility_Entry = 0x0;	/* 0 */
+                    UNS16 TestMaster_obj1801_Event_Timer = 0x0;	/* 0 */
+                    subindex TestMaster_Index1801[] = 
+                     {
+                       { RO, uint8, sizeof (UNS8), (void*)&TestMaster_highestSubIndex_obj1801 },
+                       { RW, uint32, sizeof (UNS32), (void*)&TestMaster_obj1801_COB_ID_used_by_PDO },
+                       { RW, uint8, sizeof (UNS8), (void*)&TestMaster_obj1801_Transmission_Type },
+                       { RW, uint16, sizeof (UNS16), (void*)&TestMaster_obj1801_Inhibit_Time },
+                       { RW, uint16, sizeof (UNS16), (void*)&TestMaster_obj1801_Compatibility_Entry },
+                       { RW, uint16, sizeof (UNS16), (void*)&TestMaster_obj1801_Event_Timer }
+                     };
+
+/* index 0x1A00 :   Transmit PDO 1 Mapping. */
+                    UNS8 TestMaster_highestSubIndex_obj1A00 = 1; /* number of subindex - 1*/
+                    UNS32 TestMaster_obj1A00[] = 
+                    {
+                      0x20000008	/* 536870920 */
+                    };
+                    subindex TestMaster_Index1A00[] = 
+                     {
+                       { RW, uint8, sizeof (UNS8), (void*)&TestMaster_highestSubIndex_obj1A00 },
+                       { RW, uint32, sizeof (UNS32), (void*)&TestMaster_obj1A00[0] }
+                     };
+
+/* index 0x1A01 :   Transmit PDO 2 Mapping. */
+                    UNS8 TestMaster_highestSubIndex_obj1A01 = 4; /* number of subindex - 1*/
+                    UNS32 TestMaster_obj1A01[] = 
+                    {
+                      0x20010008,	/* 536936456 */
+                      0x20020008,	/* 537001992 */
+                      0x20030008,	/* 537067528 */
+                      0x200D0008	/* 537722888 */
+                    };
+                    subindex TestMaster_Index1A01[] = 
+                     {
+                       { RW, uint8, sizeof (UNS8), (void*)&TestMaster_highestSubIndex_obj1A01 },
+                       { RW, uint32, sizeof (UNS32), (void*)&TestMaster_obj1A01[0] },
+                       { RW, uint32, sizeof (UNS32), (void*)&TestMaster_obj1A01[1] },
+                       { RW, uint32, sizeof (UNS32), (void*)&TestMaster_obj1A01[2] },
+                       { RW, uint32, sizeof (UNS32), (void*)&TestMaster_obj1A01[3] }
+                     };
+
+/* index 0x2000 :   Mapped variable DO */
+                    subindex TestMaster_Index2000[] = 
+                     {
+                       { RW, uint8, sizeof (UNS8), (void*)&DO }
+                     };
+
+/* index 0x2001 :   Mapped variable AO1 */
+                    subindex TestMaster_Index2001[] = 
+                     {
+                       { RW, uint8, sizeof (UNS8), (void*)&AO1 }
+                     };
+
+/* index 0x2002 :   Mapped variable AO2 */
+                    subindex TestMaster_Index2002[] = 
+                     {
+                       { RW, uint8, sizeof (UNS8), (void*)&AO2 }
+                     };
+
+/* index 0x2003 :   Mapped variable AO3 */
+                    subindex TestMaster_Index2003[] = 
+                     {
+                       { RW, uint8, sizeof (UNS8), (void*)&AO3 }
+                     };
+
+/* index 0x2004 :   Mapped variable DI */
+                    subindex TestMaster_Index2004[] = 
+                     {
+                       { RW, uint8, sizeof (UNS8), (void*)&DI }
+                     };
+
+/* index 0x2005 :   Mapped variable AI1 */
+                    subindex TestMaster_Index2005[] = 
+                     {
+                       { RW, uint8, sizeof (UNS8), (void*)&AI1 }
+                     };
+
+/* index 0x2006 :   Mapped variable AI2 */
+                    subindex TestMaster_Index2006[] = 
+                     {
+                       { RW, uint8, sizeof (UNS8), (void*)&AI2 }
+                     };
+
+/* index 0x2007 :   Mapped variable AI3 */
+                    subindex TestMaster_Index2007[] = 
+                     {
+                       { RW, uint8, sizeof (UNS8), (void*)&AI3 }
+                     };
+
+/* index 0x2008 :   Mapped variable AI4 */
+                    subindex TestMaster_Index2008[] = 
+                     {
+                       { RW, uint8, sizeof (UNS8), (void*)&AI4 }
+                     };
+
+/* index 0x2009 :   Mapped variable AI5 */
+                    subindex TestMaster_Index2009[] = 
+                     {
+                       { RW, uint8, sizeof (UNS8), (void*)&AI5 }
+                     };
+
+/* index 0x200A :   Mapped variable AI6 */
+                    subindex TestMaster_Index200A[] = 
+                     {
+                       { RW, uint8, sizeof (UNS8), (void*)&AI6 }
+                     };
+
+/* index 0x200B :   Mapped variable AI7 */
+                    subindex TestMaster_Index200B[] = 
+                     {
+                       { RW, uint8, sizeof (UNS8), (void*)&AI7 }
+                     };
+
+/* index 0x200C :   Mapped variable AI8 */
+                    subindex TestMaster_Index200C[] = 
+                     {
+                       { RW, uint8, sizeof (UNS8), (void*)&AI8 }
+                     };
+
+/* index 0x200D :   Mapped variable AO4 */
+                    subindex TestMaster_Index200D[] = 
+                     {
+                       { RW, uint8, sizeof (UNS8), (void*)&AO4 }
+                     };
+
+const indextable TestMaster_objdict[] = 
+{
+  { (subindex*)TestMaster_Index1000,sizeof(TestMaster_Index1000)/sizeof(TestMaster_Index1000[0]), 0x1000},
+  { (subindex*)TestMaster_Index1001,sizeof(TestMaster_Index1001)/sizeof(TestMaster_Index1001[0]), 0x1001},
+  { (subindex*)TestMaster_Index1005,sizeof(TestMaster_Index1005)/sizeof(TestMaster_Index1005[0]), 0x1005},
+  { (subindex*)TestMaster_Index1006,sizeof(TestMaster_Index1006)/sizeof(TestMaster_Index1006[0]), 0x1006},
+  { (subindex*)TestMaster_Index1016,sizeof(TestMaster_Index1016)/sizeof(TestMaster_Index1016[0]), 0x1016},
+  { (subindex*)TestMaster_Index1018,sizeof(TestMaster_Index1018)/sizeof(TestMaster_Index1018[0]), 0x1018},
+  { (subindex*)TestMaster_Index1280,sizeof(TestMaster_Index1280)/sizeof(TestMaster_Index1280[0]), 0x1280},
+  { (subindex*)TestMaster_Index1400,sizeof(TestMaster_Index1400)/sizeof(TestMaster_Index1400[0]), 0x1400},
+  { (subindex*)TestMaster_Index1401,sizeof(TestMaster_Index1401)/sizeof(TestMaster_Index1401[0]), 0x1401},
+  { (subindex*)TestMaster_Index1402,sizeof(TestMaster_Index1402)/sizeof(TestMaster_Index1402[0]), 0x1402},
+  { (subindex*)TestMaster_Index1600,sizeof(TestMaster_Index1600)/sizeof(TestMaster_Index1600[0]), 0x1600},
+  { (subindex*)TestMaster_Index1601,sizeof(TestMaster_Index1601)/sizeof(TestMaster_Index1601[0]), 0x1601},
+  { (subindex*)TestMaster_Index1602,sizeof(TestMaster_Index1602)/sizeof(TestMaster_Index1602[0]), 0x1602},
+  { (subindex*)TestMaster_Index1800,sizeof(TestMaster_Index1800)/sizeof(TestMaster_Index1800[0]), 0x1800},
+  { (subindex*)TestMaster_Index1801,sizeof(TestMaster_Index1801)/sizeof(TestMaster_Index1801[0]), 0x1801},
+  { (subindex*)TestMaster_Index1A00,sizeof(TestMaster_Index1A00)/sizeof(TestMaster_Index1A00[0]), 0x1A00},
+  { (subindex*)TestMaster_Index1A01,sizeof(TestMaster_Index1A01)/sizeof(TestMaster_Index1A01[0]), 0x1A01},
+  { (subindex*)TestMaster_Index2000,sizeof(TestMaster_Index2000)/sizeof(TestMaster_Index2000[0]), 0x2000},
+  { (subindex*)TestMaster_Index2001,sizeof(TestMaster_Index2001)/sizeof(TestMaster_Index2001[0]), 0x2001},
+  { (subindex*)TestMaster_Index2002,sizeof(TestMaster_Index2002)/sizeof(TestMaster_Index2002[0]), 0x2002},
+  { (subindex*)TestMaster_Index2003,sizeof(TestMaster_Index2003)/sizeof(TestMaster_Index2003[0]), 0x2003},
+  { (subindex*)TestMaster_Index2004,sizeof(TestMaster_Index2004)/sizeof(TestMaster_Index2004[0]), 0x2004},
+  { (subindex*)TestMaster_Index2005,sizeof(TestMaster_Index2005)/sizeof(TestMaster_Index2005[0]), 0x2005},
+  { (subindex*)TestMaster_Index2006,sizeof(TestMaster_Index2006)/sizeof(TestMaster_Index2006[0]), 0x2006},
+  { (subindex*)TestMaster_Index2007,sizeof(TestMaster_Index2007)/sizeof(TestMaster_Index2007[0]), 0x2007},
+  { (subindex*)TestMaster_Index2008,sizeof(TestMaster_Index2008)/sizeof(TestMaster_Index2008[0]), 0x2008},
+  { (subindex*)TestMaster_Index2009,sizeof(TestMaster_Index2009)/sizeof(TestMaster_Index2009[0]), 0x2009},
+  { (subindex*)TestMaster_Index200A,sizeof(TestMaster_Index200A)/sizeof(TestMaster_Index200A[0]), 0x200A},
+  { (subindex*)TestMaster_Index200B,sizeof(TestMaster_Index200B)/sizeof(TestMaster_Index200B[0]), 0x200B},
+  { (subindex*)TestMaster_Index200C,sizeof(TestMaster_Index200C)/sizeof(TestMaster_Index200C[0]), 0x200C},
+  { (subindex*)TestMaster_Index200D,sizeof(TestMaster_Index200D)/sizeof(TestMaster_Index200D[0]), 0x200D},
+};
+
+const indextable * TestMaster_scanIndexOD (UNS16 wIndex, UNS32 * errorCode, ODCallback_t **callbacks)
+{
+	int i;
+	*callbacks = NULL;
+	switch(wIndex){
+		case 0x1000: i = 0;break;
+		case 0x1001: i = 1;break;
+		case 0x1005: i = 2;*callbacks = TestMaster_Index1005_callbacks; break;
+		case 0x1006: i = 3;*callbacks = TestMaster_Index1006_callbacks; break;
+		case 0x1016: i = 4;break;
+		case 0x1018: i = 5;break;
+		case 0x1280: i = 6;break;
+		case 0x1400: i = 7;break;
+		case 0x1401: i = 8;break;
+		case 0x1402: i = 9;break;
+		case 0x1600: i = 10;break;
+		case 0x1601: i = 11;break;
+		case 0x1602: i = 12;break;
+		case 0x1800: i = 13;break;
+		case 0x1801: i = 14;break;
+		case 0x1A00: i = 15;break;
+		case 0x1A01: i = 16;break;
+		case 0x2000: i = 17;break;
+		case 0x2001: i = 18;break;
+		case 0x2002: i = 19;break;
+		case 0x2003: i = 20;break;
+		case 0x2004: i = 21;break;
+		case 0x2005: i = 22;break;
+		case 0x2006: i = 23;break;
+		case 0x2007: i = 24;break;
+		case 0x2008: i = 25;break;
+		case 0x2009: i = 26;break;
+		case 0x200A: i = 27;break;
+		case 0x200B: i = 28;break;
+		case 0x200C: i = 29;break;
+		case 0x200D: i = 30;break;
+		default:
+			*errorCode = OD_NO_SUCH_OBJECT;
+			return NULL;
+	}
+	*errorCode = OD_SUCCESSFUL;
+	return &TestMaster_objdict[i];
+}
+
+/* To count at which received SYNC a PDO must be sent.
+ * Even if no pdoTransmit are defined, at least one entry is computed
+ * for compilations issues.
+ */
+UNS8 TestMaster_count_sync[2] = {0,};
+
+quick_index TestMaster_firstIndex = {
+  0, /* SDO_SVR */
+  6, /* SDO_CLT */
+  7, /* PDO_RCV */
+  10, /* PDO_RCV_MAP */
+  13, /* PDO_TRS */
+  15 /* PDO_TRS_MAP */
+};
+
+quick_index TestMaster_lastIndex = {
+  0, /* SDO_SVR */
+  6, /* SDO_CLT */
+  9, /* PDO_RCV */
+  12, /* PDO_RCV_MAP */
+  14, /* PDO_TRS */
+  16 /* PDO_TRS_MAP */
+};
+
+UNS16 TestMaster_ObjdictSize = sizeof(TestMaster_objdict)/sizeof(TestMaster_objdict[0]); 
+
+CO_Data TestMaster_Data = CANOPEN_NODE_DATA_INITIALIZER(TestMaster);
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/examples/TestMasterMicroMod/TestMaster.h	Tue Apr 17 16:13:22 2007 +0200
@@ -0,0 +1,26 @@
+
+/* File generated by gen_cfile.py. Should not be modified. */
+
+#include "data.h"
+
+/* Prototypes of function provided by object dictionnary */
+UNS32 TestMaster_valueRangeTest (UNS8 typeValue, void * value);
+const indextable * TestMaster_scanIndexOD (UNS16 wIndex, UNS32 * errorCode, ODCallback_t **callbacks);
+
+/* Master node data struct */
+extern CO_Data TestMaster_Data;
+
+extern UNS8 DO;		/* Mapped at index 0x2000, subindex 0x00*/
+extern UNS8 AO1;		/* Mapped at index 0x2001, subindex 0x00*/
+extern UNS8 AO2;		/* Mapped at index 0x2002, subindex 0x00*/
+extern UNS8 AO3;		/* Mapped at index 0x2003, subindex 0x00*/
+extern UNS8 DI;		/* Mapped at index 0x2004, subindex 0x00*/
+extern UNS8 AI1;		/* Mapped at index 0x2005, subindex 0x00*/
+extern UNS8 AI2;		/* Mapped at index 0x2006, subindex 0x00*/
+extern UNS8 AI3;		/* Mapped at index 0x2007, subindex 0x00*/
+extern UNS8 AI4;		/* Mapped at index 0x2008, subindex 0x00*/
+extern UNS8 AI5;		/* Mapped at index 0x2009, subindex 0x00*/
+extern UNS8 AI6;		/* Mapped at index 0x200A, subindex 0x00*/
+extern UNS8 AI7;		/* Mapped at index 0x200B, subindex 0x00*/
+extern UNS8 AI8;		/* Mapped at index 0x200C, subindex 0x00*/
+extern UNS8 AO4;		/* Mapped at index 0x200D, subindex 0x00*/
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/examples/TestMasterMicroMod/TestMaster.od	Tue Apr 17 16:13:22 2007 +0200
@@ -0,0 +1,764 @@
+<?xml version="1.0"?>
+<!DOCTYPE PyObject SYSTEM "PyObjects.dtd">
+<PyObject module="node" class="Node" id="13563304">
+<attr name="Profile" type="dict" id="16353264" >
+</attr>
+<attr name="Name" type="string">TestMaster</attr>
+<attr name="Dictionary" type="dict" id="12555760" >
+  <entry>
+    <key type="numeric" value="4096" />
+    <val type="numeric" value="401" />
+  </entry>
+  <entry>
+    <key type="numeric" value="4097" />
+    <val type="numeric" value="0" />
+  </entry>
+  <entry>
+    <key type="numeric" value="5122" />
+    <val type="list" id="13564528" >
+      <item type="numeric" value="1056" />
+      <item type="numeric" value="1" />
+      <item type="numeric" value="0" />
+      <item type="numeric" value="0" />
+      <item type="numeric" value="0" />
+    </val>
+  </entry>
+  <entry>
+    <key type="numeric" value="8195" />
+    <val type="numeric" value="0" />
+  </entry>
+  <entry>
+    <key type="numeric" value="8196" />
+    <val type="numeric" value="0" />
+  </entry>
+  <entry>
+    <key type="numeric" value="4101" />
+    <val type="numeric" value="1073741952" />
+  </entry>
+  <entry>
+    <key type="numeric" value="4102" />
+    <val type="numeric" value="50000" />
+  </entry>
+  <entry>
+    <key type="numeric" value="5121" />
+    <val type="list" id="13564888" >
+      <item type="numeric" value="800" />
+      <item type="numeric" value="1" />
+      <item type="numeric" value="0" />
+      <item type="numeric" value="0" />
+      <item type="numeric" value="0" />
+    </val>
+  </entry>
+  <entry>
+    <key type="numeric" value="8200" />
+    <val type="numeric" value="0" />
+  </entry>
+  <entry>
+    <key type="numeric" value="8201" />
+    <val type="numeric" value="0" />
+  </entry>
+  <entry>
+    <key type="numeric" value="8202" />
+    <val type="numeric" value="0" />
+  </entry>
+  <entry>
+    <key type="numeric" value="8203" />
+    <val type="numeric" value="0" />
+  </entry>
+  <entry>
+    <key type="numeric" value="8204" />
+    <val type="numeric" value="0" />
+  </entry>
+  <entry>
+    <key type="numeric" value="5634" />
+    <val type="list" id="13566248" >
+      <item type="numeric" value="537460744" />
+      <item type="numeric" value="537526280" />
+      <item type="numeric" value="537591816" />
+      <item type="numeric" value="537657352" />
+    </val>
+  </entry>
+  <entry>
+    <key type="numeric" value="4118" />
+    <val type="list" id="13563880" >
+      <item type="numeric" value="4195804" />
+    </val>
+  </entry>
+  <entry>
+    <key type="numeric" value="4120" />
+    <val type="list" id="13564672" >
+      <item type="numeric" value="0" />
+      <item type="numeric" value="0" />
+      <item type="numeric" value="0" />
+      <item type="numeric" value="0" />
+    </val>
+  </entry>
+  <entry>
+    <key type="numeric" value="4736" />
+    <val type="list" id="13563376" >
+      <item type="numeric" value="1600" />
+      <item type="numeric" value="1472" />
+      <item type="numeric" value="64" />
+    </val>
+  </entry>
+  <entry>
+    <key type="numeric" value="8197" />
+    <val type="numeric" value="0" />
+  </entry>
+  <entry>
+    <key type="numeric" value="8193" />
+    <val type="numeric" value="0" />
+  </entry>
+  <entry>
+    <key type="numeric" value="8198" />
+    <val type="numeric" value="0" />
+  </entry>
+  <entry>
+    <key type="numeric" value="5120" />
+    <val type="list" id="13564312" >
+      <item type="numeric" value="544" />
+      <item type="numeric" value="1" />
+      <item type="numeric" value="0" />
+      <item type="numeric" value="0" />
+      <item type="numeric" value="0" />
+    </val>
+  </entry>
+  <entry>
+    <key type="numeric" value="8192" />
+    <val type="numeric" value="0" />
+  </entry>
+  <entry>
+    <key type="numeric" value="8199" />
+    <val type="numeric" value="0" />
+  </entry>
+  <entry>
+    <key type="numeric" value="5632" />
+    <val type="list" id="13564744" >
+      <item type="numeric" value="537133064" />
+    </val>
+  </entry>
+  <entry>
+    <key type="numeric" value="8194" />
+    <val type="numeric" value="0" />
+  </entry>
+  <entry>
+    <key type="numeric" value="6144" />
+    <val type="list" id="13565536" >
+      <item type="numeric" value="576" />
+      <item type="numeric" value="1" />
+      <item type="numeric" value="0" />
+      <item type="numeric" value="0" />
+      <item type="numeric" value="0" />
+    </val>
+  </entry>
+  <entry>
+    <key type="numeric" value="8205" />
+    <val type="numeric" value="0" />
+  </entry>
+  <entry>
+    <key type="numeric" value="5633" />
+    <val type="list" id="13565320" >
+      <item type="numeric" value="537198600" />
+      <item type="numeric" value="537264136" />
+      <item type="numeric" value="537329672" />
+      <item type="numeric" value="537395208" />
+    </val>
+  </entry>
+  <entry>
+    <key type="numeric" value="6656" />
+    <val type="list" id="13565392" >
+      <item type="numeric" value="536870920" />
+    </val>
+  </entry>
+  <entry>
+    <key type="numeric" value="6145" />
+    <val type="list" id="13566320" >
+      <item type="numeric" value="0" />
+      <item type="numeric" value="0" />
+      <item type="numeric" value="0" />
+      <item type="numeric" value="0" />
+      <item type="numeric" value="0" />
+    </val>
+  </entry>
+  <entry>
+    <key type="numeric" value="6657" />
+    <val type="list" id="13565680" >
+      <item type="numeric" value="536936456" />
+      <item type="numeric" value="537001992" />
+      <item type="numeric" value="537067528" />
+      <item type="numeric" value="537722888" />
+    </val>
+  </entry>
+</attr>
+<attr name="SpecificMenu" type="list" id="13560504" >
+</attr>
+<attr name="ParamsDictionary" type="dict" id="10607920" >
+</attr>
+<attr name="UserMapping" type="dict" id="12611152" >
+  <entry>
+    <key type="numeric" value="8192" />
+    <val type="dict" id="13920224" >
+      <entry>
+        <key type="string" value="need" />
+        <val type="False" value="" />
+      </entry>
+      <entry>
+        <key type="string" value="values" />
+        <val type="list" id="13567256" >
+          <item type="dict" id="13481616" >
+            <entry>
+              <key type="string" value="access" />
+              <val type="string" value="rw" />
+            </entry>
+            <entry>
+              <key type="string" value="pdo" />
+              <val type="True" value="" />
+            </entry>
+            <entry>
+              <key type="string" value="type" />
+              <val type="numeric" value="5" />
+            </entry>
+            <entry>
+              <key type="string" value="name" />
+              <val type="string">DO</val>
+            </entry>
+          </item>
+        </val>
+      </entry>
+      <entry>
+        <key type="string" value="name" />
+        <val type="string">DO</val>
+      </entry>
+      <entry>
+        <key type="string" value="struct" />
+        <val type="numeric" value="1" />
+      </entry>
+    </val>
+  </entry>
+  <entry>
+    <key type="numeric" value="8193" />
+    <val type="dict" id="13949856" >
+      <entry>
+        <key type="string" value="need" />
+        <val type="False" value="" />
+      </entry>
+      <entry>
+        <key type="string" value="values" />
+        <val type="list" id="13566176" >
+          <item type="dict" id="13903232" >
+            <entry>
+              <key type="string" value="access" />
+              <val type="string" value="rw" />
+            </entry>
+            <entry>
+              <key type="string" value="pdo" />
+              <val type="True" value="" />
+            </entry>
+            <entry>
+              <key type="string" value="type" />
+              <val type="numeric" value="5" />
+            </entry>
+            <entry>
+              <key type="string" value="name" />
+              <val type="string">AO1</val>
+            </entry>
+          </item>
+        </val>
+      </entry>
+      <entry>
+        <key type="string" value="name" />
+        <val type="string">AO1</val>
+      </entry>
+      <entry>
+        <key type="string" value="struct" />
+        <val type="numeric" value="1" />
+      </entry>
+    </val>
+  </entry>
+  <entry>
+    <key type="numeric" value="8194" />
+    <val type="dict" id="13903520" >
+      <entry>
+        <key type="string" value="need" />
+        <val type="False" value="" />
+      </entry>
+      <entry>
+        <key type="string" value="values" />
+        <val type="list" id="13567472" >
+          <item type="dict" id="16992224" >
+            <entry>
+              <key type="string" value="access" />
+              <val type="string" value="rw" />
+            </entry>
+            <entry>
+              <key type="string" value="pdo" />
+              <val type="True" value="" />
+            </entry>
+            <entry>
+              <key type="string" value="type" />
+              <val type="numeric" value="5" />
+            </entry>
+            <entry>
+              <key type="string" value="name" />
+              <val type="string">AO2</val>
+            </entry>
+          </item>
+        </val>
+      </entry>
+      <entry>
+        <key type="string" value="name" />
+        <val type="string">AO2</val>
+      </entry>
+      <entry>
+        <key type="string" value="struct" />
+        <val type="numeric" value="1" />
+      </entry>
+    </val>
+  </entry>
+  <entry>
+    <key type="numeric" value="8195" />
+    <val type="dict" id="16358544" >
+      <entry>
+        <key type="string" value="need" />
+        <val type="False" value="" />
+      </entry>
+      <entry>
+        <key type="string" value="values" />
+        <val type="list" id="13565464" >
+          <item type="dict" id="16993584" >
+            <entry>
+              <key type="string" value="access" />
+              <val type="string" value="rw" />
+            </entry>
+            <entry>
+              <key type="string" value="pdo" />
+              <val type="True" value="" />
+            </entry>
+            <entry>
+              <key type="string" value="type" />
+              <val type="numeric" value="5" />
+            </entry>
+            <entry>
+              <key type="string" value="name" />
+              <val type="string">AO3</val>
+            </entry>
+          </item>
+        </val>
+      </entry>
+      <entry>
+        <key type="string" value="name" />
+        <val type="string">AO3</val>
+      </entry>
+      <entry>
+        <key type="string" value="struct" />
+        <val type="numeric" value="1" />
+      </entry>
+    </val>
+  </entry>
+  <entry>
+    <key type="numeric" value="8196" />
+    <val type="dict" id="16994160" >
+      <entry>
+        <key type="string" value="need" />
+        <val type="False" value="" />
+      </entry>
+      <entry>
+        <key type="string" value="values" />
+        <val type="list" id="13565176" >
+          <item type="dict" id="16993872" >
+            <entry>
+              <key type="string" value="access" />
+              <val type="string" value="rw" />
+            </entry>
+            <entry>
+              <key type="string" value="pdo" />
+              <val type="True" value="" />
+            </entry>
+            <entry>
+              <key type="string" value="type" />
+              <val type="numeric" value="5" />
+            </entry>
+            <entry>
+              <key type="string" value="name" />
+              <val type="string">DI</val>
+            </entry>
+          </item>
+        </val>
+      </entry>
+      <entry>
+        <key type="string" value="name" />
+        <val type="string">DI</val>
+      </entry>
+      <entry>
+        <key type="string" value="struct" />
+        <val type="numeric" value="1" />
+      </entry>
+    </val>
+  </entry>
+  <entry>
+    <key type="numeric" value="8197" />
+    <val type="dict" id="17134288" >
+      <entry>
+        <key type="string" value="need" />
+        <val type="False" value="" />
+      </entry>
+      <entry>
+        <key type="string" value="values" />
+        <val type="list" id="13568048" >
+          <item type="dict" id="16994448" >
+            <entry>
+              <key type="string" value="access" />
+              <val type="string" value="rw" />
+            </entry>
+            <entry>
+              <key type="string" value="pdo" />
+              <val type="True" value="" />
+            </entry>
+            <entry>
+              <key type="string" value="type" />
+              <val type="numeric" value="5" />
+            </entry>
+            <entry>
+              <key type="string" value="name" />
+              <val type="string">AI1</val>
+            </entry>
+          </item>
+        </val>
+      </entry>
+      <entry>
+        <key type="string" value="name" />
+        <val type="string">AI1</val>
+      </entry>
+      <entry>
+        <key type="string" value="struct" />
+        <val type="numeric" value="1" />
+      </entry>
+    </val>
+  </entry>
+  <entry>
+    <key type="numeric" value="8198" />
+    <val type="dict" id="17136448" >
+      <entry>
+        <key type="string" value="need" />
+        <val type="False" value="" />
+      </entry>
+      <entry>
+        <key type="string" value="values" />
+        <val type="list" id="13565896" >
+          <item type="dict" id="17134736" >
+            <entry>
+              <key type="string" value="access" />
+              <val type="string" value="rw" />
+            </entry>
+            <entry>
+              <key type="string" value="pdo" />
+              <val type="True" value="" />
+            </entry>
+            <entry>
+              <key type="string" value="type" />
+              <val type="numeric" value="5" />
+            </entry>
+            <entry>
+              <key type="string" value="name" />
+              <val type="string">AI2</val>
+            </entry>
+          </item>
+        </val>
+      </entry>
+      <entry>
+        <key type="string" value="name" />
+        <val type="string">AI2</val>
+      </entry>
+      <entry>
+        <key type="string" value="struct" />
+        <val type="numeric" value="1" />
+      </entry>
+    </val>
+  </entry>
+  <entry>
+    <key type="numeric" value="8199" />
+    <val type="dict" id="17137216" >
+      <entry>
+        <key type="string" value="need" />
+        <val type="False" value="" />
+      </entry>
+      <entry>
+        <key type="string" value="values" />
+        <val type="list" id="13571784" >
+          <item type="dict" id="17136928" >
+            <entry>
+              <key type="string" value="access" />
+              <val type="string" value="rw" />
+            </entry>
+            <entry>
+              <key type="string" value="pdo" />
+              <val type="True" value="" />
+            </entry>
+            <entry>
+              <key type="string" value="type" />
+              <val type="numeric" value="5" />
+            </entry>
+            <entry>
+              <key type="string" value="name" />
+              <val type="string">AI3</val>
+            </entry>
+          </item>
+        </val>
+      </entry>
+      <entry>
+        <key type="string" value="name" />
+        <val type="string">AI3</val>
+      </entry>
+      <entry>
+        <key type="string" value="struct" />
+        <val type="numeric" value="1" />
+      </entry>
+    </val>
+  </entry>
+  <entry>
+    <key type="numeric" value="8200" />
+    <val type="dict" id="17137840" >
+      <entry>
+        <key type="string" value="need" />
+        <val type="False" value="" />
+      </entry>
+      <entry>
+        <key type="string" value="values" />
+        <val type="list" id="13571928" >
+          <item type="dict" id="17137552" >
+            <entry>
+              <key type="string" value="access" />
+              <val type="string" value="rw" />
+            </entry>
+            <entry>
+              <key type="string" value="pdo" />
+              <val type="True" value="" />
+            </entry>
+            <entry>
+              <key type="string" value="type" />
+              <val type="numeric" value="5" />
+            </entry>
+            <entry>
+              <key type="string" value="name" />
+              <val type="string">AI4</val>
+            </entry>
+          </item>
+        </val>
+      </entry>
+      <entry>
+        <key type="string" value="name" />
+        <val type="string">AI4</val>
+      </entry>
+      <entry>
+        <key type="string" value="struct" />
+        <val type="numeric" value="1" />
+      </entry>
+    </val>
+  </entry>
+  <entry>
+    <key type="numeric" value="8201" />
+    <val type="dict" id="17138272" >
+      <entry>
+        <key type="string" value="need" />
+        <val type="False" value="" />
+      </entry>
+      <entry>
+        <key type="string" value="values" />
+        <val type="list" id="13560864" >
+          <item type="dict" id="17139280" >
+            <entry>
+              <key type="string" value="access" />
+              <val type="string" value="rw" />
+            </entry>
+            <entry>
+              <key type="string" value="pdo" />
+              <val type="True" value="" />
+            </entry>
+            <entry>
+              <key type="string" value="type" />
+              <val type="numeric" value="5" />
+            </entry>
+            <entry>
+              <key type="string" value="name" />
+              <val type="string">AI5</val>
+            </entry>
+          </item>
+        </val>
+      </entry>
+      <entry>
+        <key type="string" value="name" />
+        <val type="string">AI5</val>
+      </entry>
+      <entry>
+        <key type="string" value="struct" />
+        <val type="numeric" value="1" />
+      </entry>
+    </val>
+  </entry>
+  <entry>
+    <key type="numeric" value="8202" />
+    <val type="dict" id="17138848" >
+      <entry>
+        <key type="string" value="need" />
+        <val type="False" value="" />
+      </entry>
+      <entry>
+        <key type="string" value="values" />
+        <val type="list" id="13568552" >
+          <item type="dict" id="17138560" >
+            <entry>
+              <key type="string" value="access" />
+              <val type="string" value="rw" />
+            </entry>
+            <entry>
+              <key type="string" value="pdo" />
+              <val type="True" value="" />
+            </entry>
+            <entry>
+              <key type="string" value="type" />
+              <val type="numeric" value="5" />
+            </entry>
+            <entry>
+              <key type="string" value="name" />
+              <val type="string">AI6</val>
+            </entry>
+          </item>
+        </val>
+      </entry>
+      <entry>
+        <key type="string" value="name" />
+        <val type="string">AI6</val>
+      </entry>
+      <entry>
+        <key type="string" value="struct" />
+        <val type="numeric" value="1" />
+      </entry>
+    </val>
+  </entry>
+  <entry>
+    <key type="numeric" value="8203" />
+    <val type="dict" id="17139920" >
+      <entry>
+        <key type="string" value="need" />
+        <val type="False" value="" />
+      </entry>
+      <entry>
+        <key type="string" value="values" />
+        <val type="list" id="16192000" >
+          <item type="dict" id="17141472" >
+            <entry>
+              <key type="string" value="access" />
+              <val type="string" value="rw" />
+            </entry>
+            <entry>
+              <key type="string" value="pdo" />
+              <val type="True" value="" />
+            </entry>
+            <entry>
+              <key type="string" value="type" />
+              <val type="numeric" value="5" />
+            </entry>
+            <entry>
+              <key type="string" value="name" />
+              <val type="string">AI7</val>
+            </entry>
+          </item>
+        </val>
+      </entry>
+      <entry>
+        <key type="string" value="name" />
+        <val type="string">AI7</val>
+      </entry>
+      <entry>
+        <key type="string" value="struct" />
+        <val type="numeric" value="1" />
+      </entry>
+    </val>
+  </entry>
+  <entry>
+    <key type="numeric" value="8204" />
+    <val type="dict" id="17140432" >
+      <entry>
+        <key type="string" value="need" />
+        <val type="False" value="" />
+      </entry>
+      <entry>
+        <key type="string" value="values" />
+        <val type="list" id="16191640" >
+          <item type="dict" id="17142064" >
+            <entry>
+              <key type="string" value="access" />
+              <val type="string" value="rw" />
+            </entry>
+            <entry>
+              <key type="string" value="pdo" />
+              <val type="True" value="" />
+            </entry>
+            <entry>
+              <key type="string" value="type" />
+              <val type="numeric" value="5" />
+            </entry>
+            <entry>
+              <key type="string" value="name" />
+              <val type="string">AI8</val>
+            </entry>
+          </item>
+        </val>
+      </entry>
+      <entry>
+        <key type="string" value="name" />
+        <val type="string">AI8</val>
+      </entry>
+      <entry>
+        <key type="string" value="struct" />
+        <val type="numeric" value="1" />
+      </entry>
+    </val>
+  </entry>
+  <entry>
+    <key type="numeric" value="8205" />
+    <val type="dict" id="17141008" >
+      <entry>
+        <key type="string" value="need" />
+        <val type="False" value="" />
+      </entry>
+      <entry>
+        <key type="string" value="values" />
+        <val type="list" id="16192432" >
+          <item type="dict" id="17140720" >
+            <entry>
+              <key type="string" value="access" />
+              <val type="string" value="rw" />
+            </entry>
+            <entry>
+              <key type="string" value="pdo" />
+              <val type="True" value="" />
+            </entry>
+            <entry>
+              <key type="string" value="type" />
+              <val type="numeric" value="5" />
+            </entry>
+            <entry>
+              <key type="string" value="name" />
+              <val type="string">AO4</val>
+            </entry>
+          </item>
+        </val>
+      </entry>
+      <entry>
+        <key type="string" value="name" />
+        <val type="string">AO4</val>
+      </entry>
+      <entry>
+        <key type="string" value="struct" />
+        <val type="numeric" value="1" />
+      </entry>
+    </val>
+  </entry>
+</attr>
+<attr name="DS302" type="dict" id="17144304" >
+</attr>
+<attr name="ProfileName" type="string" value="DS-301" />
+<attr name="Type" type="string">master</attr>
+<attr name="ID" type="numeric" value="1" />
+</PyObject>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/examples/TestMasterMicroMod/TestMasterMicroMod.c	Tue Apr 17 16:13:22 2007 +0200
@@ -0,0 +1,383 @@
+/*
+This file is part of CanFestival, a library implementing CanOpen Stack. 
+
+Copyright (C): Edouard TISSERANT and Francis DUPIN
+
+See COPYING file for copyrights details.
+
+This library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Lesser General Public
+License as published by the Free Software Foundation; either
+version 2.1 of the License, or (at your option) any later version.
+
+This library is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public
+License along with this library; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*/
+
+#if defined(WIN32) && !defined(__CYGWIN__)
+#include <windows.h>
+#include "getopt.h"
+void pause(void)
+{
+	system("PAUSE");
+}
+#else
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+#include <signal.h>
+#endif
+
+#include "canfestival.h"
+#include "TestMasterMicroMod.h"
+#include "TestMaster.h"
+UNS8 slavenodeid;
+
+
+/*****************************************************************************/
+void TestMaster_heartbeatError(UNS8 heartbeatID)
+{
+	eprintf("TestMaster_heartbeatError %d\n", heartbeatID);
+}
+
+/*****************************************************************************/
+void TestMaster_SDOtimeoutError (UNS8 line)
+{
+	eprintf("TestMaster_SDOtimeoutError %d\n", line);
+}
+
+/********************************************************
+ * ConfigureSlaveNode is responsible to
+ *  - setup master RPDO 1 to receive TPDO 1 from id 0x40
+ *  - setup master TPDO 1 to send RPDO 1 to id 0x40
+ ********************************************************/
+void TestMaster_initialisation()
+{
+	UNS32 PDO1_COBID = 0x0180 + slavenodeid; 
+	UNS32 PDO2_COBID = 0x0200 + slavenodeid;
+	UNS8 size = sizeof(UNS32); 
+
+	eprintf("TestMaster_initialisation\n");
+
+	/*****************************************
+	 * Define RPDOs to match slave ID=0x40 TPDOs*
+	 *****************************************/
+	setODentry( &TestMaster_Data, /*CO_Data* d*/
+			0x1400, /*UNS16 index*/
+			0x01, /*UNS8 subind*/ 
+			&PDO1_COBID, /*void * pSourceData,*/ 
+			&size, /* UNS8 * pExpectedSize*/
+			RW);  /* UNS8 checkAccess */
+			
+
+	/*****************************************
+	 * Define TPDOs to match slave ID=0x40 RPDOs*
+	 *****************************************/
+	setODentry( &TestMaster_Data, /*CO_Data* d*/
+			0x1800, /*UNS16 index*/
+			0x01, /*UNS8 subind*/ 
+			&PDO2_COBID, /*void * pSourceData,*/ 
+			&size, /* UNS8 * pExpectedSize*/
+			RW);  /* UNS8 checkAccess */
+}
+
+/********************************************************
+ * ConfigureSlaveNode is responsible to
+ *  - setup slave TPDO 1 transmit time
+ *  - setup slave TPDO 2 transmit time
+ *  - setup slave Heartbeat Producer time
+ *  - switch to operational mode
+ *  - send NMT to slave
+ ********************************************************
+ * This an example of :
+ * Network Dictionary Access (SDO) with Callback 
+ * Slave node state change request (NMT) 
+ ********************************************************
+ * This is called first by TestMaster_preOperational
+ * then it called again each time a SDO exchange is
+ * finished.
+ ********************************************************/
+static void ConfigureSlaveNode(CO_Data* d, UNS8 nodeId)
+{
+	// Step counts number of times ConfigureSlaveNode is called
+	static step = 1;
+	
+	UNS8 Transmission_Type = 0x01;
+	UNS16 Heartbeat_Producer_Time = 0x03E8; 
+	UNS32 abortCode;
+	UNS8 res;
+	eprintf("Master : ConfigureSlaveNode %2.2x\n", nodeId);
+	switch(step++){
+		case 1: /*First step : setup Slave's TPDO 1 to be transmitted on SYNC*/
+			eprintf("Master : set slave %2.2x TPDO 1 transmit type\n", nodeId);
+			res = writeNetworkDictCallBack (d, /*CO_Data* d*/
+					/**TestSlave_Data.bDeviceNodeId, UNS8 nodeId*/
+					nodeId, /*UNS8 nodeId*/
+					0x1800, /*UNS16 index*/
+					0x02, /*UNS8 subindex*/
+					1, /*UNS8 count*/
+					0, /*UNS8 dataType*/
+					&Transmission_Type,/*void *data*/
+					ConfigureSlaveNode); /*SDOCallback_t Callback*/			
+		break;
+					
+					
+		case 2:	/*Second step*/
+			if(getWriteResultNetworkDict (d, slavenodeid, &abortCode) != SDO_FINISHED)
+				eprintf("Master : Couldn't set slave %2.2x TPDO 1 transmit type. AbortCode :%4.4x \n", nodeId, abortCode);
+
+			/* Finalise last SDO transfer with this node */
+			closeSDOtransfer(&TestMaster_Data,
+					/**TestSlave_Data.bDeviceNodeId, UNS8 nodeId*/
+					slavenodeid, /*UNS8 nodeId*/
+					SDO_CLIENT);
+
+			eprintf("Master : set slave %2.2x RPDO 1 receive type\n", nodeId);
+			res = writeNetworkDictCallBack (d, /*CO_Data* d*/
+					/**TestSlave_Data.bDeviceNodeId, UNS8 nodeId*/
+					slavenodeid, /*UNS8 nodeId*/
+					0x1400, /*UNS16 index*/
+					0x02, /*UNS8 subindex*/
+					1, /*UNS8 count*/
+					0, /*UNS8 dataType*/
+					&Transmission_Type,/*void *data*/
+					ConfigureSlaveNode); /*SDOCallback_t Callback*/	
+		break;
+		
+		case 3:	/*Second step*/
+			if(getWriteResultNetworkDict (d, slavenodeid, &abortCode) != SDO_FINISHED)
+			eprintf("Master : Couldn't set slave %2.2x RPDO 1 transmit type. AbortCode :%4.4x \n", nodeId, abortCode);
+
+			/* Finalise last SDO transfer with this node */
+			closeSDOtransfer(&TestMaster_Data,
+					/**TestSlave_Data.bDeviceNodeId, UNS8 nodeId*/
+					slavenodeid, /*UNS8 nodeId*/
+					SDO_CLIENT);
+
+			eprintf("Master : set slave %2.2x heartbeat producer time \n", nodeId);
+			res = writeNetworkDictCallBack (d, /*CO_Data* d*/
+					/**TestSlave_Data.bDeviceNodeId, UNS8 nodeId*/
+					slavenodeid, /*UNS8 nodeId*/
+					0x1017, /*UNS16 index*/
+					0x00, /*UNS8 subindex*/
+					2, /*UNS8 count*/
+					0, /*UNS8 dataType*/
+					&Heartbeat_Producer_Time,/*void *data*/
+					ConfigureSlaveNode); /*SDOCallback_t Callback*/			
+		break;
+		
+		case 4:	/*Second step*/
+
+			if(getWriteResultNetworkDict (d, slavenodeid, &abortCode) != SDO_FINISHED)
+			eprintf("Master : Couldn't set slave %2.2x Heartbeat_Producer_Time. AbortCode :%4.4x \n", nodeId, abortCode);
+
+			/* Finalise last SDO transfer with this node */
+			closeSDOtransfer(&TestMaster_Data,
+					/**TestSlave_Data.bDeviceNodeId, UNS8 nodeId*/
+					slavenodeid, /*UNS8 nodeId*/
+					SDO_CLIENT);
+
+			/* Put the master in operational mode */
+			setState(d, Operational);
+			  
+			/* Ask slave node to go in operational mode */
+			masterSendNMTstateChange (d, slavenodeid, NMT_Start_Node);
+	}
+			
+}
+
+void TestMaster_preOperational()
+{
+
+	eprintf("TestMaster_preOperational\n");
+	ConfigureSlaveNode(&TestMaster_Data, slavenodeid);
+	
+}
+
+void TestMaster_operational()
+{
+	eprintf("TestMaster_operational\n");
+}
+
+void TestMaster_stopped()
+{
+	eprintf("TestMaster_stopped\n");
+}
+
+void TestMaster_post_sync()
+{
+	DO++;
+	eprintf("MicroMod Digital Out: %2.2x In: %2.2d\n",DO,DI);
+}
+
+void TestMaster_post_TPDO()
+{
+//	eprintf("TestMaster_post_TPDO\n");	
+}
+
+//s_BOARD SlaveBoard = {"0", "500K"};
+s_BOARD MasterBoard = {"32", "125K"};
+
+#if !defined(WIN32) || defined(__CYGWIN__)
+void catch_signal(int sig)
+{
+  signal(SIGTERM, catch_signal);
+  signal(SIGINT, catch_signal);
+  
+  eprintf("Got Signal %d\n",sig);
+}
+#endif
+
+void help()
+{
+  printf("**************************************************************\n");
+  printf("*  TestMasterMicroMod                                        *\n");
+  printf("*                                                            *\n");
+  printf("*  A simple example for PC.                                  *\n");
+  printf("*  A CanOpen master that control a MicroMod module:          *\n");
+  printf("*  - setup module TPDO 1 transmit type (ignored ???)         *\n");
+  printf("*  - setup module RPDO 1 transmit type (ignored ???)         *\n");
+  printf("*  - setup module hearbeatbeat period                        *\n");
+  printf("*  - set state to operational                                *\n");
+  printf("*  - send periodic SYNC (ignored ???)                        *\n");
+  printf("*  - send periodic RPDO 1 to Micromod (digital output)       *\n");
+  printf("*  - listen Micromod's TPDO 1 (digital input)                *\n");
+  printf("*                                                            *\n");
+  printf("*   Usage:                                                   *\n");
+  printf("*   ./TestMasterMicroMod  [OPTIONS]                          *\n");
+  printf("*                                                            *\n");
+  printf("*   OPTIONS:                                                 *\n");
+  printf("*     -l : Can library [\"libcanfestival_can_virtual.so\"]     *\n");
+  printf("*                                                            *\n");
+  printf("*    Slave:                                                  *\n");
+  printf("*     -i : Slave Node id format [0x01 , 0x7F]                *\n");
+  printf("*                                                            *\n");
+  printf("*    Master:                                                 *\n");
+  printf("*     -m : bus name [\"1\"]                                    *\n");
+  printf("*     -M : 1M,500K,250K,125K,100K,50K,20K,10K,none(disable)  *\n");
+  printf("*                                                            *\n");
+  printf("**************************************************************\n");
+}
+
+/***************************  INIT  *****************************************/
+void InitNodes(CO_Data* d, UNS32 id)
+{
+	/****************************** INITIALISATION MASTER *******************************/
+	if(MasterBoard.baudrate){
+		/* Defining the node Id */
+		setNodeId(&TestMaster_Data, 0x01);
+
+		/* init */
+		setState(&TestMaster_Data, Initialisation);
+	}
+}
+
+/****************************************************************************/
+/***************************  MAIN  *****************************************/
+/****************************************************************************/
+int main(int argc,char **argv)
+{
+
+  char c;
+  extern char *optarg;
+  char* LibraryPath="libcanfestival_can_virtual.so";
+  char *snodeid;
+  while ((c = getopt(argc, argv, "-m:s:M:S:l:i:")) != EOF)
+  {
+    switch(c)
+    {
+      case 'm' :
+        if (optarg[0] == 0)
+        {
+          help();
+          exit(1);
+        }
+        MasterBoard.busname = optarg;
+        break;
+      case 'M' :
+        if (optarg[0] == 0)
+        {
+          help();
+          exit(1);
+        }
+        MasterBoard.baudrate = optarg;
+        break;
+      case 'l' :
+        if (optarg[0] == 0)
+        {
+          help();
+          exit(1);
+        }
+        LibraryPath = optarg;
+        break;
+      case 'i' :
+        if (optarg[0] == 0)
+        {
+          help();
+          exit(1);
+        }
+        snodeid = optarg;
+		sscanf(snodeid,"%x",&slavenodeid);
+        break;
+      default:
+        help();
+        exit(1);
+    }
+  }
+
+#if !defined(WIN32) || defined(__CYGWIN__)
+  /* install signal handler for manual break */
+	signal(SIGTERM, catch_signal);
+	signal(SIGINT, catch_signal);
+#endif
+
+#ifndef NOT_USE_DYNAMIC_LOADING
+	LoadCanDriver(LibraryPath);
+#endif		
+
+	if(MasterBoard.baudrate){
+		
+		TestMaster_Data.heartbeatError = TestMaster_heartbeatError;
+		TestMaster_Data.SDOtimeoutError = TestMaster_SDOtimeoutError;
+		TestMaster_Data.initialisation = TestMaster_initialisation;
+		TestMaster_Data.preOperational = TestMaster_preOperational;
+		TestMaster_Data.operational = TestMaster_operational;
+		TestMaster_Data.stopped = TestMaster_stopped;
+		TestMaster_Data.post_sync = TestMaster_post_sync;
+		TestMaster_Data.post_TPDO = TestMaster_post_TPDO;
+		
+		if(!canOpen(&MasterBoard,&TestMaster_Data)){
+			eprintf("Cannot open Master Board\n");
+			goto fail_master;
+		}
+	}
+	
+	// Start timer thread
+	StartTimerLoop(&InitNodes);
+
+	// wait Ctrl-C
+	pause();
+	eprintf("Finishing.\n");
+	
+	// Reset the slave node for next use (will stop emitting heartbeat)
+	masterSendNMTstateChange (&TestMaster_Data, slavenodeid, NMT_Reset_Node);
+	
+	// Stop master
+	setState(&TestMaster_Data, Stopped);
+	
+	// Stop timer thread
+	StopTimerLoop();
+	
+fail_master:
+	if(MasterBoard.baudrate) canClose(&TestMaster_Data);	
+
+  return 0;
+}
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/examples/TestMasterMicroMod/TestMasterMicroMod.h	Tue Apr 17 16:13:22 2007 +0200
@@ -0,0 +1,59 @@
+/*
+This file is part of CanFestival, a library implementing CanOpen Stack. 
+
+Copyright (C): Edouard TISSERANT and Francis DUPIN
+
+See COPYING file for copyrights details.
+
+This library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Lesser General Public
+License as published by the Free Software Foundation; either
+version 2.1 of the License, or (at your option) any later version.
+
+This library is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public
+License along with this library; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*/
+#ifdef USE_XENO
+#define eprintf(...)
+#else
+#define eprintf(...) printf (__VA_ARGS__)
+#endif
+//void print_message(Message *m);
+
+/*UNS8 canSend(CAN_HANDLE fd0, Message *m);*/
+
+#include "canfestival.h"
+
+/*
+#define CAN_FIFO_LENGTH 100
+
+#define DECLARE_A_CAN_FIFO \
+static Message FIFO[CAN_FIFO_LENGTH];\
+static int FIFO_First = 0;\
+static int FIFO_Last = 0;\
+\
+static void PutInFIFO(Message *m)\
+{\
+	FIFO[FIFO_Last++] = *m;\
+	FIFO_Last %= CAN_FIFO_LENGTH;\
+}\
+\
+static void GetFromFIFO(Message *m)\
+{\
+	*m = FIFO[FIFO_First++];\
+	FIFO_First %= CAN_FIFO_LENGTH;\
+}\
+\
+static void TransmitMessage(CO_Data* d, UNS32 id)\
+{\
+	Message m;\
+	GetFromFIFO(&m);\
+	canDispatch(d, &m);\
+}
+*/
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/examples/TestMasterMicroMod/TestMasterMicroMod.vcproj	Tue Apr 17 16:13:22 2007 +0200
@@ -0,0 +1,228 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+	ProjectType="Visual C++"
+	Version="8,00"
+	Name="TestMasterMicroMod"
+	ProjectGUID="{B51A176D-5320-4534-913B-3025CED5B27E}"
+	Keyword="Win32Proj"
+	>
+	<Platforms>
+		<Platform
+			Name="Win32"
+		/>
+	</Platforms>
+	<ToolFiles>
+	</ToolFiles>
+	<Configurations>
+		<Configuration
+			Name="Debug|Win32"
+			OutputDirectory="../../Debug"
+			IntermediateDirectory="Debug"
+			ConfigurationType="1"
+			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+			CharacterSet="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="0"
+				AdditionalIncludeDirectories="../../include;../../include/win32"
+				PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
+				MinimalRebuild="true"
+				BasicRuntimeChecks="3"
+				RuntimeLibrary="3"
+				UsePrecompiledHeader="0"
+				WarningLevel="3"
+				Detect64BitPortabilityProblems="false"
+				DebugInformationFormat="4"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				AdditionalDependencies="CanFestival-3.lib"
+				OutputFile="$(OutDir)/TestMasterMicroMod.exe"
+				LinkIncremental="2"
+				AdditionalLibraryDirectories="../../Debug UNICODE"
+				GenerateDebugInformation="true"
+				ProgramDatabaseFile="$(OutDir)/TestMasterMicroMod.pdb"
+				SubSystem="1"
+				OptimizeForWindows98="1"
+				TargetMachine="1"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCWebDeploymentTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Release|Win32"
+			OutputDirectory="../../Release"
+			IntermediateDirectory="Release"
+			ConfigurationType="1"
+			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+			CharacterSet="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				AdditionalIncludeDirectories="../../include;../../include/win32"
+				PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
+				RuntimeLibrary="2"
+				UsePrecompiledHeader="0"
+				WarningLevel="3"
+				Detect64BitPortabilityProblems="false"
+				DebugInformationFormat="3"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				AdditionalDependencies="CanFestival-3.lib"
+				OutputFile="$(OutDir)/TestMasterMicroMod.exe"
+				LinkIncremental="1"
+				AdditionalLibraryDirectories="../../Release"
+				GenerateDebugInformation="true"
+				SubSystem="1"
+				OptimizeReferences="2"
+				EnableCOMDATFolding="2"
+				OptimizeForWindows98="1"
+				TargetMachine="1"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCWebDeploymentTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+	</Configurations>
+	<References>
+	</References>
+	<Files>
+		<Filter
+			Name="Source Files"
+			Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
+			UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
+			>
+			<File
+				RelativePath=".\getopt.c"
+				>
+			</File>
+			<File
+				RelativePath=".\TestMaster.c"
+				>
+			</File>
+			<File
+				RelativePath=".\TestMasterMicroMod.c"
+				>
+			</File>
+		</Filter>
+		<Filter
+			Name="Header Files"
+			Filter="h;hpp;hxx;hm;inl;inc;xsd"
+			UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
+			>
+			<File
+				RelativePath=".\getopt.h"
+				>
+			</File>
+			<File
+				RelativePath=".\TestMaster.h"
+				>
+			</File>
+			<File
+				RelativePath=".\TestMasterMicroMod.h"
+				>
+			</File>
+		</Filter>
+		<Filter
+			Name="Resource Files"
+			Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx"
+			UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
+			>
+		</Filter>
+	</Files>
+	<Globals>
+	</Globals>
+</VisualStudioProject>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/examples/TestMasterMicroMod/getopt.c	Tue Apr 17 16:13:22 2007 +0200
@@ -0,0 +1,1260 @@
+/* from http://www.pwilson.net/getopt.html */
+
+/* Getopt for GNU.
+   NOTE: getopt is now part of the C library, so if you don't know what
+   "Keep this file name-space clean" means, talk to drepper@gnu.org
+   before changing it!
+   Copyright (C) 1987,88,89,90,91,92,93,94,95,96,98,99,2000,2001
+        Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+/* This tells Alpha OSF/1 not to define a getopt prototype in <stdio.h>.
+   Ditto for AIX 3.2 and <stdlib.h>.  */
+#ifndef _NO_PROTO
+# define _NO_PROTO
+#endif
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#if !defined __STDC__ || !__STDC__
+/* This is a separate conditional since some stdc systems
+   reject `defined (const)'.  */
+# ifndef const
+#  define const
+# endif
+#endif
+
+#include <stdio.h>
+
+/* Comment out all this code if we are using the GNU C Library, and are not
+   actually compiling the library itself.  This code is part of the GNU C
+   Library, but also included in many other GNU distributions.  Compiling
+   and linking in this code is a waste when using the GNU C library
+   (especially if it is a shared library).  Rather than having every GNU
+   program understand `configure --with-gnu-libc' and omit the object files,
+   it is simpler to just do this in the source for each such file.  */
+
+#define GETOPT_INTERFACE_VERSION 2
+#if !defined _LIBC && defined __GLIBC__ && __GLIBC__ >= 2
+# include <gnu-versions.h>
+# if _GNU_GETOPT_INTERFACE_VERSION == GETOPT_INTERFACE_VERSION
+#  define ELIDE_CODE
+# endif
+#endif
+
+#ifndef ELIDE_CODE
+
+
+/* This needs to come after some library #include
+   to get __GNU_LIBRARY__ defined.  */
+#ifdef  __GNU_LIBRARY__
+/* Don't include stdlib.h for non-GNU C libraries because some of them
+   contain conflicting prototypes for getopt.  */
+# include <stdlib.h>
+# include <unistd.h>
+#endif  /* GNU C library.  */
+
+#ifdef VMS
+# include <unixlib.h>
+# if HAVE_STRING_H - 0
+#  include <string.h>
+# endif
+#endif
+
+#ifndef _
+/* This is for other GNU distributions with internationalized messages.  */
+# if (HAVE_LIBINTL_H && ENABLE_NLS) || defined _LIBC
+#  include <libintl.h>
+#  ifndef _
+#   define _(msgid)     gettext (msgid)
+#  endif
+# else
+#  define _(msgid)      (msgid)
+# endif
+# if defined _LIBC && defined USE_IN_LIBIO
+#  include <wchar.h>
+# endif
+#endif
+
+/* This version of `getopt' appears to the caller like standard Unix `getopt'
+   but it behaves differently for the user, since it allows the user
+   to intersperse the options with the other arguments.
+
+   As `getopt' works, it permutes the elements of ARGV so that,
+   when it is done, all the options precede everything else.  Thus
+   all application programs are extended to handle flexible argument order.
+
+   Setting the environment variable POSIXLY_CORRECT disables permutation.
+   Then the behavior is completely standard.
+
+   GNU application programs can use a third alternative mode in which
+   they can distinguish the relative order of options and other arguments.  */
+
+#include "getopt.h"
+
+/* For communication from `getopt' to the caller.
+   When `getopt' finds an option that takes an argument,
+   the argument value is returned here.
+   Also, when `ordering' is RETURN_IN_ORDER,
+   each non-option ARGV-element is returned here.  */
+
+char *optarg;
+
+/* Index in ARGV of the next element to be scanned.
+   This is used for communication to and from the caller
+   and for communication between successive calls to `getopt'.
+
+   On entry to `getopt', zero means this is the first call; initialize.
+
+   When `getopt' returns -1, this is the index of the first of the
+   non-option elements that the caller should itself scan.
+
+   Otherwise, `optind' communicates from one call to the next
+   how much of ARGV has been scanned so far.  */
+
+/* 1003.2 says this must be 1 before any call.  */
+int optind = 1;
+
+/* Formerly, initialization of getopt depended on optind==0, which
+   causes problems with re-calling getopt as programs generally don't
+   know that. */
+
+int __getopt_initialized;
+
+/* The next char to be scanned in the option-element
+   in which the last option character we returned was found.
+   This allows us to pick up the scan where we left off.
+
+   If this is zero, or a null string, it means resume the scan
+   by advancing to the next ARGV-element.  */
+
+static char *nextchar;
+
+/* Callers store zero here to inhibit the error message
+   for unrecognized options.  */
+
+int opterr = 1;
+
+/* Set to an option character which was unrecognized.
+   This must be initialized on some systems to avoid linking in the
+   system's own getopt implementation.  */
+
+int optopt = '?';
+
+/* Describe how to deal with options that follow non-option ARGV-elements.
+
+   If the caller did not specify anything,
+   the default is REQUIRE_ORDER if the environment variable
+   POSIXLY_CORRECT is defined, PERMUTE otherwise.
+
+   REQUIRE_ORDER means don't recognize them as options;
+   stop option processing when the first non-option is seen.
+   This is what Unix does.
+   This mode of operation is selected by either setting the environment
+   variable POSIXLY_CORRECT, or using `+' as the first character
+   of the list of option characters.
+
+   PERMUTE is the default.  We permute the contents of ARGV as we scan,
+   so that eventually all the non-options are at the end.  This allows options
+   to be given in any order, even with programs that were not written to
+   expect this.
+
+   RETURN_IN_ORDER is an option available to programs that were written
+   to expect options and other ARGV-elements in any order and that care about
+   the ordering of the two.  We describe each non-option ARGV-element
+   as if it were the argument of an option with character code 1.
+   Using `-' as the first character of the list of option characters
+   selects this mode of operation.
+
+   The special argument `--' forces an end of option-scanning regardless
+   of the value of `ordering'.  In the case of RETURN_IN_ORDER, only
+   `--' can cause `getopt' to return -1 with `optind' != ARGC.  */
+
+static enum
+{
+  REQUIRE_ORDER, PERMUTE, RETURN_IN_ORDER
+} ordering;
+
+/* Value of POSIXLY_CORRECT environment variable.  */
+static char *posixly_correct;
+
+#ifdef  __GNU_LIBRARY__
+/* We want to avoid inclusion of string.h with non-GNU libraries
+   because there are many ways it can cause trouble.
+   On some systems, it contains special magic macros that don't work
+   in GCC.  */
+# include <string.h>
+# define my_index       strchr
+#else
+
+# if HAVE_STRING_H || WIN32 /* Pete Wilson mod 7/28/02 */
+#  include <string.h>
+# else
+#  include <strings.h>
+# endif
+
+/* Avoid depending on library functions or files
+   whose names are inconsistent.  */
+
+#ifndef getenv
+extern char *getenv ();
+#endif
+
+static char *
+my_index (str, chr)
+     const char *str;
+     int chr;
+{
+  while (*str)
+    {
+      if (*str == chr)
+        return (char *) str;
+      str++;
+    }
+  return 0;
+}
+
+/* If using GCC, we can safely declare strlen this way.
+   If not using GCC, it is ok not to declare it.  */
+#ifdef __GNUC__
+/* Note that Motorola Delta 68k R3V7 comes with GCC but not stddef.h.
+   That was relevant to code that was here before.  */
+# if (!defined __STDC__ || !__STDC__) && !defined strlen
+/* gcc with -traditional declares the built-in strlen to return int,
+   and has done so at least since version 2.4.5. -- rms.  */
+extern int strlen (const char *);
+# endif /* not __STDC__ */
+#endif /* __GNUC__ */
+
+#endif /* not __GNU_LIBRARY__ */
+
+/* Handle permutation of arguments.  */
+
+/* Describe the part of ARGV that contains non-options that have
+   been skipped.  `first_nonopt' is the index in ARGV of the first of them;
+   `last_nonopt' is the index after the last of them.  */
+
+static int first_nonopt;
+static int last_nonopt;
+
+#ifdef _LIBC
+/* Stored original parameters.
+   XXX This is no good solution.  We should rather copy the args so
+   that we can compare them later.  But we must not use malloc(3).  */
+extern int __libc_argc;
+extern char **__libc_argv;
+
+/* Bash 2.0 gives us an environment variable containing flags
+   indicating ARGV elements that should not be considered arguments.  */
+
+# ifdef USE_NONOPTION_FLAGS
+/* Defined in getopt_init.c  */
+extern char *__getopt_nonoption_flags;
+
+static int nonoption_flags_max_len;
+static int nonoption_flags_len;
+# endif
+
+# ifdef USE_NONOPTION_FLAGS
+#  define SWAP_FLAGS(ch1, ch2) \
+  if (nonoption_flags_len > 0)                                                \
+    {                                                                         \
+      char __tmp = __getopt_nonoption_flags[ch1];                             \
+      __getopt_nonoption_flags[ch1] = __getopt_nonoption_flags[ch2];          \
+      __getopt_nonoption_flags[ch2] = __tmp;                                  \
+    }
+# else
+#  define SWAP_FLAGS(ch1, ch2)
+# endif
+#else   /* !_LIBC */
+# define SWAP_FLAGS(ch1, ch2)
+#endif  /* _LIBC */
+
+/* Exchange two adjacent subsequences of ARGV.
+   One subsequence is elements [first_nonopt,last_nonopt)
+   which contains all the non-options that have been skipped so far.
+   The other is elements [last_nonopt,optind), which contains all
+   the options processed since those non-options were skipped.
+
+   `first_nonopt' and `last_nonopt' are relocated so that they describe
+   the new indices of the non-options in ARGV after they are moved.  */
+
+#if defined __STDC__ && __STDC__
+static void exchange (char **);
+#endif
+
+static void
+exchange (argv)
+     char **argv;
+{
+  int bottom = first_nonopt;
+  int middle = last_nonopt;
+  int top = optind;
+  char *tem;
+
+  /* Exchange the shorter segment with the far end of the longer segment.
+     That puts the shorter segment into the right place.
+     It leaves the longer segment in the right place overall,
+     but it consists of two parts that need to be swapped next.  */
+
+#if defined _LIBC && defined USE_NONOPTION_FLAGS
+  /* First make sure the handling of the `__getopt_nonoption_flags'
+     string can work normally.  Our top argument must be in the range
+     of the string.  */
+  if (nonoption_flags_len > 0 && top >= nonoption_flags_max_len)
+    {
+      /* We must extend the array.  The user plays games with us and
+         presents new arguments.  */
+      char *new_str = malloc (top + 1);
+      if (new_str == NULL)
+        nonoption_flags_len = nonoption_flags_max_len = 0;
+      else
+        {
+          memset (__mempcpy (new_str, __getopt_nonoption_flags,
+                             nonoption_flags_max_len),
+                  '\0', top + 1 - nonoption_flags_max_len);
+          nonoption_flags_max_len = top + 1;
+          __getopt_nonoption_flags = new_str;
+        }
+    }
+#endif
+
+  while (top > middle && middle > bottom)
+    {
+      if (top - middle > middle - bottom)
+        {
+          /* Bottom segment is the short one.  */
+          int len = middle - bottom;
+          register int i;
+
+          /* Swap it with the top part of the top segment.  */
+          for (i = 0; i < len; i++)
+            {
+              tem = argv[bottom + i];
+              argv[bottom + i] = argv[top - (middle - bottom) + i];
+              argv[top - (middle - bottom) + i] = tem;
+              SWAP_FLAGS (bottom + i, top - (middle - bottom) + i);
+            }
+          /* Exclude the moved bottom segment from further swapping.  */
+          top -= len;
+        }
+      else
+        {
+          /* Top segment is the short one.  */
+          int len = top - middle;
+          register int i;
+
+          /* Swap it with the bottom part of the bottom segment.  */
+          for (i = 0; i < len; i++)
+            {
+              tem = argv[bottom + i];
+              argv[bottom + i] = argv[middle + i];
+              argv[middle + i] = tem;
+              SWAP_FLAGS (bottom + i, middle + i);
+            }
+          /* Exclude the moved top segment from further swapping.  */
+          bottom += len;
+        }
+    }
+
+  /* Update records for the slots the non-options now occupy.  */
+
+  first_nonopt += (optind - last_nonopt);
+  last_nonopt = optind;
+}
+
+/* Initialize the internal data when the first call is made.  */
+
+#if defined __STDC__ && __STDC__
+static const char *_getopt_initialize (int, char *const *, const char *);
+#endif
+static const char *
+_getopt_initialize (argc, argv, optstring)
+     int argc;
+     char *const *argv;
+     const char *optstring;
+{
+  /* Start processing options with ARGV-element 1 (since ARGV-element 0
+     is the program name); the sequence of previously skipped
+     non-option ARGV-elements is empty.  */
+
+  first_nonopt = last_nonopt = optind;
+
+  nextchar = NULL;
+
+  posixly_correct = getenv ("POSIXLY_CORRECT");
+
+  /* Determine how to handle the ordering of options and nonoptions.  */
+
+  if (optstring[0] == '-')
+    {
+      ordering = RETURN_IN_ORDER;
+      ++optstring;
+    }
+  else if (optstring[0] == '+')
+    {
+      ordering = REQUIRE_ORDER;
+      ++optstring;
+    }
+  else if (posixly_correct != NULL)
+    ordering = REQUIRE_ORDER;
+  else
+    ordering = PERMUTE;
+
+#if defined _LIBC && defined USE_NONOPTION_FLAGS
+  if (posixly_correct == NULL
+      && argc == __libc_argc && argv == __libc_argv)
+    {
+      if (nonoption_flags_max_len == 0)
+        {
+          if (__getopt_nonoption_flags == NULL
+              || __getopt_nonoption_flags[0] == '\0')
+            nonoption_flags_max_len = -1;
+          else
+            {
+              const char *orig_str = __getopt_nonoption_flags;
+              int len = nonoption_flags_max_len = strlen (orig_str);
+              if (nonoption_flags_max_len < argc)
+                nonoption_flags_max_len = argc;
+              __getopt_nonoption_flags =
+                (char *) malloc (nonoption_flags_max_len);
+              if (__getopt_nonoption_flags == NULL)
+                nonoption_flags_max_len = -1;
+              else
+                memset (__mempcpy (__getopt_nonoption_flags, orig_str, len),
+                        '\0', nonoption_flags_max_len - len);
+            }
+        }
+      nonoption_flags_len = nonoption_flags_max_len;
+    }
+  else
+    nonoption_flags_len = 0;
+#endif
+
+  return optstring;
+}
+
+/* Scan elements of ARGV (whose length is ARGC) for option characters
+   given in OPTSTRING.
+
+   If an element of ARGV starts with '-', and is not exactly "-" or "--",
+   then it is an option element.  The characters of this element
+   (aside from the initial '-') are option characters.  If `getopt'
+   is called repeatedly, it returns successively each of the option characters
+   from each of the option elements.
+
+   If `getopt' finds another option character, it returns that character,
+   updating `optind' and `nextchar' so that the next call to `getopt' can
+   resume the scan with the following option character or ARGV-element.
+
+   If there are no more option characters, `getopt' returns -1.
+   Then `optind' is the index in ARGV of the first ARGV-element
+   that is not an option.  (The ARGV-elements have been permuted
+   so that those that are not options now come last.)
+
+   OPTSTRING is a string containing the legitimate option characters.
+   If an option character is seen that is not listed in OPTSTRING,
+   return '?' after printing an error message.  If you set `opterr' to
+   zero, the error message is suppressed but we still return '?'.
+
+   If a char in OPTSTRING is followed by a colon, that means it wants an arg,
+   so the following text in the same ARGV-element, or the text of the following
+   ARGV-element, is returned in `optarg'.  Two colons mean an option that
+   wants an optional arg; if there is text in the current ARGV-element,
+   it is returned in `optarg', otherwise `optarg' is set to zero.
+
+   If OPTSTRING starts with `-' or `+', it requests different methods of
+   handling the non-option ARGV-elements.
+   See the comments about RETURN_IN_ORDER and REQUIRE_ORDER, above.
+
+   Long-named options begin with `--' instead of `-'.
+   Their names may be abbreviated as long as the abbreviation is unique
+   or is an exact match for some defined option.  If they have an
+   argument, it follows the option name in the same ARGV-element, separated
+   from the option name by a `=', or else the in next ARGV-element.
+   When `getopt' finds a long-named option, it returns 0 if that option's
+   `flag' field is nonzero, the value of the option's `val' field
+   if the `flag' field is zero.
+
+   The elements of ARGV aren't really const, because we permute them.
+   But we pretend they're const in the prototype to be compatible
+   with other systems.
+
+   LONGOPTS is a vector of `struct option' terminated by an
+   element containing a name which is zero.
+
+   LONGIND returns the index in LONGOPT of the long-named option found.
+   It is only valid when a long-named option has been found by the most
+   recent call.
+
+   If LONG_ONLY is nonzero, '-' as well as '--' can introduce
+   long-named options.  */
+
+int
+_getopt_internal (argc, argv, optstring, longopts, longind, long_only)
+     int argc;
+     char *const *argv;
+     const char *optstring;
+     const struct option *longopts;
+     int *longind;
+     int long_only;
+{
+  int print_errors = opterr;
+  if (optstring[0] == ':')
+    print_errors = 0;
+
+  if (argc < 1)
+    return -1;
+
+  optarg = NULL;
+
+  if (optind == 0 || !__getopt_initialized)
+    {
+      if (optind == 0)
+        optind = 1;     /* Don't scan ARGV[0], the program name.  */
+      optstring = _getopt_initialize (argc, argv, optstring);
+      __getopt_initialized = 1;
+    }
+
+  /* Test whether ARGV[optind] points to a non-option argument.
+     Either it does not have option syntax, or there is an environment flag
+     from the shell indicating it is not an option.  The later information
+     is only used when the used in the GNU libc.  */
+#if defined _LIBC && defined USE_NONOPTION_FLAGS
+# define NONOPTION_P (argv[optind][0] != '-' || argv[optind][1] == '\0'       \
+                      || (optind < nonoption_flags_len                        \
+                          && __getopt_nonoption_flags[optind] == '1'))
+#else
+# define NONOPTION_P (argv[optind][0] != '-' || argv[optind][1] == '\0')
+#endif
+
+  if (nextchar == NULL || *nextchar == '\0')
+    {
+      /* Advance to the next ARGV-element.  */
+
+      /* Give FIRST_NONOPT and LAST_NONOPT rational values if OPTIND has been
+         moved back by the user (who may also have changed the arguments).  */
+      if (last_nonopt > optind)
+        last_nonopt = optind;
+      if (first_nonopt > optind)
+        first_nonopt = optind;
+
+      if (ordering == PERMUTE)
+        {
+          /* If we have just processed some options following some non-options,
+             exchange them so that the options come first.  */
+
+          if (first_nonopt != last_nonopt && last_nonopt != optind)
+            exchange ((char **) argv);
+          else if (last_nonopt != optind)
+            first_nonopt = optind;
+
+          /* Skip any additional non-options
+             and extend the range of non-options previously skipped.  */
+
+          while (optind < argc && NONOPTION_P)
+            optind++;
+          last_nonopt = optind;
+        }
+
+      /* The special ARGV-element `--' means premature end of options.
+         Skip it like a null option,
+         then exchange with previous non-options as if it were an option,
+         then skip everything else like a non-option.  */
+
+      if (optind != argc && !strcmp (argv[optind], "--"))
+        {
+          optind++;
+
+          if (first_nonopt != last_nonopt && last_nonopt != optind)
+            exchange ((char **) argv);
+          else if (first_nonopt == last_nonopt)
+            first_nonopt = optind;
+          last_nonopt = argc;
+
+          optind = argc;
+        }
+
+      /* If we have done all the ARGV-elements, stop the scan
+         and back over any non-options that we skipped and permuted.  */
+
+      if (optind == argc)
+        {
+          /* Set the next-arg-index to point at the non-options
+             that we previously skipped, so the caller will digest them.  */
+          if (first_nonopt != last_nonopt)
+            optind = first_nonopt;
+          return -1;
+        }
+
+      /* If we have come to a non-option and did not permute it,
+         either stop the scan or describe it to the caller and pass it by.  */
+
+      if (NONOPTION_P)
+        {
+          if (ordering == REQUIRE_ORDER)
+            return -1;
+          optarg = argv[optind++];
+          return 1;
+        }
+
+      /* We have found another option-ARGV-element.
+         Skip the initial punctuation.  */
+
+      nextchar = (argv[optind] + 1
+                  + (longopts != NULL && argv[optind][1] == '-'));
+    }
+
+  /* Decode the current option-ARGV-element.  */
+
+  /* Check whether the ARGV-element is a long option.
+
+     If long_only and the ARGV-element has the form "-f", where f is
+     a valid short option, don't consider it an abbreviated form of
+     a long option that starts with f.  Otherwise there would be no
+     way to give the -f short option.
+
+     On the other hand, if there's a long option "fubar" and
+     the ARGV-element is "-fu", do consider that an abbreviation of
+     the long option, just like "--fu", and not "-f" with arg "u".
+
+     This distinction seems to be the most useful approach.  */
+
+  if (longopts != NULL
+      && (argv[optind][1] == '-'
+          || (long_only && (argv[optind][2] || !my_index (optstring, argv[optind][1])))))
+    {
+      char *nameend;
+      const struct option *p;
+      const struct option *pfound = NULL;
+      int exact = 0;
+      int ambig = 0;
+      int indfound = -1;
+      int option_index;
+
+      for (nameend = nextchar; *nameend && *nameend != '='; nameend++)
+        /* Do nothing.  */ ;
+
+      /* Test all long options for either exact match
+         or abbreviated matches.  */
+      for (p = longopts, option_index = 0; p->name; p++, option_index++)
+        if (!strncmp (p->name, nextchar, nameend - nextchar))
+          {
+            if ((unsigned int) (nameend - nextchar)
+                == (unsigned int) strlen (p->name))
+              {
+                /* Exact match found.  */
+                pfound = p;
+                indfound = option_index;
+                exact = 1;
+                break;
+              }
+            else if (pfound == NULL)
+              {
+                /* First nonexact match found.  */
+                pfound = p;
+                indfound = option_index;
+              }
+            else if (long_only
+                     || pfound->has_arg != p->has_arg
+                     || pfound->flag != p->flag
+                     || pfound->val != p->val)
+              /* Second or later nonexact match found.  */
+              ambig = 1;
+          }
+
+      if (ambig && !exact)
+        {
+          if (print_errors)
+            {
+#if defined _LIBC && defined USE_IN_LIBIO
+              char *buf;
+
+              __asprintf (&buf, _("%s: option `%s' is ambiguous\n"),
+                          argv[0], argv[optind]);
+
+              if (_IO_fwide (stderr, 0) > 0)
+                __fwprintf (stderr, L"%s", buf);
+              else
+                fputs (buf, stderr);
+
+              free (buf);
+#else
+              fprintf (stderr, _("%s: option `%s' is ambiguous\n"),
+                       argv[0], argv[optind]);
+#endif
+            }
+          nextchar += strlen (nextchar);
+          optind++;
+          optopt = 0;
+          return '?';
+        }
+
+      if (pfound != NULL)
+        {
+          option_index = indfound;
+          optind++;
+          if (*nameend)
+            {
+              /* Don't test has_arg with >, because some C compilers don't
+                 allow it to be used on enums.  */
+              if (pfound->has_arg)
+                optarg = nameend + 1;
+              else
+                {
+                  if (print_errors)
+                    {
+#if defined _LIBC && defined USE_IN_LIBIO
+                      char *buf;
+#endif
+
+                      if (argv[optind - 1][1] == '-')
+                        {
+                          /* --option */
+#if defined _LIBC && defined USE_IN_LIBIO
+                          __asprintf (&buf, _("\
+%s: option `--%s' doesn't allow an argument\n"),
+                                      argv[0], pfound->name);
+#else
+                          fprintf (stderr, _("\
+%s: option `--%s' doesn't allow an argument\n"),
+                                   argv[0], pfound->name);
+#endif
+                        }
+                      else
+                        {
+                          /* +option or -option */
+#if defined _LIBC && defined USE_IN_LIBIO
+                          __asprintf (&buf, _("\
+%s: option `%c%s' doesn't allow an argument\n"),
+                                      argv[0], argv[optind - 1][0],
+                                      pfound->name);
+#else
+                          fprintf (stderr, _("\
+%s: option `%c%s' doesn't allow an argument\n"),
+                                   argv[0], argv[optind - 1][0], pfound->name);
+#endif
+                        }
+
+#if defined _LIBC && defined USE_IN_LIBIO
+                      if (_IO_fwide (stderr, 0) > 0)
+                        __fwprintf (stderr, L"%s", buf);
+                      else
+                        fputs (buf, stderr);
+
+                      free (buf);
+#endif
+                    }
+
+                  nextchar += strlen (nextchar);
+
+                  optopt = pfound->val;
+                  return '?';
+                }
+            }
+          else if (pfound->has_arg == 1)
+            {
+              if (optind < argc)
+                optarg = argv[optind++];
+              else
+                {
+                  if (print_errors)
+                    {
+#if defined _LIBC && defined USE_IN_LIBIO
+                      char *buf;
+
+                      __asprintf (&buf,
+                                  _("%s: option `%s' requires an argument\n"),
+                                  argv[0], argv[optind - 1]);
+
+                      if (_IO_fwide (stderr, 0) > 0)
+                        __fwprintf (stderr, L"%s", buf);
+                      else
+                        fputs (buf, stderr);
+
+                      free (buf);
+#else
+                      fprintf (stderr,
+                               _("%s: option `%s' requires an argument\n"),
+                               argv[0], argv[optind - 1]);
+#endif
+                    }
+                  nextchar += strlen (nextchar);
+                  optopt = pfound->val;
+                  return optstring[0] == ':' ? ':' : '?';
+                }
+            }
+          nextchar += strlen (nextchar);
+          if (longind != NULL)
+            *longind = option_index;
+          if (pfound->flag)
+            {
+              *(pfound->flag) = pfound->val;
+              return 0;
+            }
+          return pfound->val;
+        }
+
+      /* Can't find it as a long option.  If this is not getopt_long_only,
+         or the option starts with '--' or is not a valid short
+         option, then it's an error.
+         Otherwise interpret it as a short option.  */
+      if (!long_only || argv[optind][1] == '-'
+          || my_index (optstring, *nextchar) == NULL)
+        {
+          if (print_errors)
+            {
+#if defined _LIBC && defined USE_IN_LIBIO
+              char *buf;
+#endif
+
+              if (argv[optind][1] == '-')
+                {
+                  /* --option */
+#if defined _LIBC && defined USE_IN_LIBIO
+                  __asprintf (&buf, _("%s: unrecognized option `--%s'\n"),
+                              argv[0], nextchar);
+#else
+                  fprintf (stderr, _("%s: unrecognized option `--%s'\n"),
+                           argv[0], nextchar);
+#endif
+                }
+              else
+                {
+                  /* +option or -option */
+#if defined _LIBC && defined USE_IN_LIBIO
+                  __asprintf (&buf, _("%s: unrecognized option `%c%s'\n"),
+                              argv[0], argv[optind][0], nextchar);
+#else
+                  fprintf (stderr, _("%s: unrecognized option `%c%s'\n"),
+                           argv[0], argv[optind][0], nextchar);
+#endif
+                }
+
+#if defined _LIBC && defined USE_IN_LIBIO
+              if (_IO_fwide (stderr, 0) > 0)
+                __fwprintf (stderr, L"%s", buf);
+              else
+                fputs (buf, stderr);
+
+              free (buf);
+#endif
+            }
+          nextchar = (char *) "";
+          optind++;
+          optopt = 0;
+          return '?';
+        }
+    }
+
+  /* Look at and handle the next short option-character.  */
+
+  {
+    char c = *nextchar++;
+    char *temp = my_index (optstring, c);
+
+    /* Increment `optind' when we start to process its last character.  */
+    if (*nextchar == '\0')
+      ++optind;
+
+    if (temp == NULL || c == ':')
+      {
+        if (print_errors)
+          {
+#if defined _LIBC && defined USE_IN_LIBIO
+              char *buf;
+#endif
+
+            if (posixly_correct)
+              {
+                /* 1003.2 specifies the format of this message.  */
+#if defined _LIBC && defined USE_IN_LIBIO
+                __asprintf (&buf, _("%s: illegal option -- %c\n"),
+                            argv[0], c);
+#else
+                fprintf (stderr, _("%s: illegal option -- %c\n"), argv[0], c);
+#endif
+              }
+            else
+              {
+#if defined _LIBC && defined USE_IN_LIBIO
+                __asprintf (&buf, _("%s: invalid option -- %c\n"),
+                            argv[0], c);
+#else
+                fprintf (stderr, _("%s: invalid option -- %c\n"), argv[0], c);
+#endif
+              }
+
+#if defined _LIBC && defined USE_IN_LIBIO
+            if (_IO_fwide (stderr, 0) > 0)
+              __fwprintf (stderr, L"%s", buf);
+            else
+              fputs (buf, stderr);
+
+            free (buf);
+#endif
+          }
+        optopt = c;
+        return '?';
+      }
+    /* Convenience. Treat POSIX -W foo same as long option --foo */
+    if (temp[0] == 'W' && temp[1] == ';')
+      {
+        char *nameend;
+        const struct option *p;
+        const struct option *pfound = NULL;
+        int exact = 0;
+        int ambig = 0;
+        int indfound = 0;
+        int option_index;
+
+        /* This is an option that requires an argument.  */
+        if (*nextchar != '\0')
+          {
+            optarg = nextchar;
+            /* If we end this ARGV-element by taking the rest as an arg,
+               we must advance to the next element now.  */
+            optind++;
+          }
+        else if (optind == argc)
+          {
+            if (print_errors)
+              {
+                /* 1003.2 specifies the format of this message.  */
+#if defined _LIBC && defined USE_IN_LIBIO
+                char *buf;
+
+                __asprintf (&buf, _("%s: option requires an argument -- %c\n"),
+                            argv[0], c);
+
+                if (_IO_fwide (stderr, 0) > 0)
+                  __fwprintf (stderr, L"%s", buf);
+                else
+                  fputs (buf, stderr);
+
+                free (buf);
+#else
+                fprintf (stderr, _("%s: option requires an argument -- %c\n"),
+                         argv[0], c);
+#endif
+              }
+            optopt = c;
+            if (optstring[0] == ':')
+              c = ':';
+            else
+              c = '?';
+            return c;
+          }
+        else
+          /* We already incremented `optind' once;
+             increment it again when taking next ARGV-elt as argument.  */
+          optarg = argv[optind++];
+
+        /* optarg is now the argument, see if it's in the
+           table of longopts.  */
+
+        for (nextchar = nameend = optarg; *nameend && *nameend != '='; nameend++)
+          /* Do nothing.  */ ;
+
+        /* Test all long options for either exact match
+           or abbreviated matches.  */
+        for (p = longopts, option_index = 0; p->name; p++, option_index++)
+          if (!strncmp (p->name, nextchar, nameend - nextchar))
+            {
+              if ((unsigned int) (nameend - nextchar) == strlen (p->name))
+                {
+                  /* Exact match found.  */
+                  pfound = p;
+                  indfound = option_index;
+                  exact = 1;
+                  break;
+                }
+              else if (pfound == NULL)
+                {
+                  /* First nonexact match found.  */
+                  pfound = p;
+                  indfound = option_index;
+                }
+              else
+                /* Second or later nonexact match found.  */
+                ambig = 1;
+            }
+        if (ambig && !exact)
+          {
+            if (print_errors)
+              {
+#if defined _LIBC && defined USE_IN_LIBIO
+                char *buf;
+
+                __asprintf (&buf, _("%s: option `-W %s' is ambiguous\n"),
+                            argv[0], argv[optind]);
+
+                if (_IO_fwide (stderr, 0) > 0)
+                  __fwprintf (stderr, L"%s", buf);
+                else
+                  fputs (buf, stderr);
+
+                free (buf);
+#else
+                fprintf (stderr, _("%s: option `-W %s' is ambiguous\n"),
+                         argv[0], argv[optind]);
+#endif
+              }
+            nextchar += strlen (nextchar);
+            optind++;
+            return '?';
+          }
+        if (pfound != NULL)
+          {
+            option_index = indfound;
+            if (*nameend)
+              {
+                /* Don't test has_arg with >, because some C compilers don't
+                   allow it to be used on enums.  */
+                if (pfound->has_arg)
+                  optarg = nameend + 1;
+                else
+                  {
+                    if (print_errors)
+                      {
+#if defined _LIBC && defined USE_IN_LIBIO
+                        char *buf;
+
+                        __asprintf (&buf, _("\
+%s: option `-W %s' doesn't allow an argument\n"),
+                                    argv[0], pfound->name);
+
+                        if (_IO_fwide (stderr, 0) > 0)
+                          __fwprintf (stderr, L"%s", buf);
+                        else
+                          fputs (buf, stderr);
+
+                        free (buf);
+#else
+                        fprintf (stderr, _("\
+%s: option `-W %s' doesn't allow an argument\n"),
+                                 argv[0], pfound->name);
+#endif
+                      }
+
+                    nextchar += strlen (nextchar);
+                    return '?';
+                  }
+              }
+            else if (pfound->has_arg == 1)
+              {
+                if (optind < argc)
+                  optarg = argv[optind++];
+                else
+                  {
+                    if (print_errors)
+                      {
+#if defined _LIBC && defined USE_IN_LIBIO
+                        char *buf;
+
+                        __asprintf (&buf, _("\
+%s: option `%s' requires an argument\n"),
+                                    argv[0], argv[optind - 1]);
+
+                        if (_IO_fwide (stderr, 0) > 0)
+                          __fwprintf (stderr, L"%s", buf);
+                        else
+                          fputs (buf, stderr);
+
+                        free (buf);
+#else
+                        fprintf (stderr,
+                                 _("%s: option `%s' requires an argument\n"),
+                                 argv[0], argv[optind - 1]);
+#endif
+                      }
+                    nextchar += strlen (nextchar);
+                    return optstring[0] == ':' ? ':' : '?';
+                  }
+              }
+            nextchar += strlen (nextchar);
+            if (longind != NULL)
+              *longind = option_index;
+            if (pfound->flag)
+              {
+                *(pfound->flag) = pfound->val;
+                return 0;
+              }
+            return pfound->val;
+          }
+          nextchar = NULL;
+          return 'W';   /* Let the application handle it.   */
+      }
+    if (temp[1] == ':')
+      {
+        if (temp[2] == ':')
+          {
+            /* This is an option that accepts an argument optionally.  */
+            if (*nextchar != '\0')
+              {
+                optarg = nextchar;
+                optind++;
+              }
+            else
+              optarg = NULL;
+            nextchar = NULL;
+          }
+        else
+          {
+            /* This is an option that requires an argument.  */
+            if (*nextchar != '\0')
+              {
+                optarg = nextchar;
+                /* If we end this ARGV-element by taking the rest as an arg,
+                   we must advance to the next element now.  */
+                optind++;
+              }
+            else if (optind == argc)
+              {
+                if (print_errors)
+                  {
+                    /* 1003.2 specifies the format of this message.  */
+#if defined _LIBC && defined USE_IN_LIBIO
+                    char *buf;
+
+                    __asprintf (&buf,
+                                _("%s: option requires an argument -- %c\n"),
+                                argv[0], c);
+
+                    if (_IO_fwide (stderr, 0) > 0)
+                      __fwprintf (stderr, L"%s", buf);
+                    else
+                      fputs (buf, stderr);
+
+                    free (buf);
+#else
+                    fprintf (stderr,
+                             _("%s: option requires an argument -- %c\n"),
+                             argv[0], c);
+#endif
+                  }
+                optopt = c;
+                if (optstring[0] == ':')
+                  c = ':';
+                else
+                  c = '?';
+              }
+            else
+              /* We already incremented `optind' once;
+                 increment it again when taking next ARGV-elt as argument.  */
+              optarg = argv[optind++];
+            nextchar = NULL;
+          }
+      }
+    return c;
+  }
+}
+
+int
+getopt (argc, argv, optstring)
+     int argc;
+     char *const *argv;
+     const char *optstring;
+{
+  return _getopt_internal (argc, argv, optstring,
+                           (const struct option *) 0,
+                           (int *) 0,
+                           0);
+}
+
+#endif  /* Not ELIDE_CODE.  */
+
+
+/* Compile with -DTEST to make an executable for use in testing
+   the above definition of `getopt'.  */
+
+/* #define TEST */        /* Pete Wilson mod 7/28/02 */
+#ifdef TEST
+
+#ifndef exit         /* Pete Wilson mod 7/28/02 */
+  int exit(int);     /* Pete Wilson mod 7/28/02 */
+#endif               /* Pete Wilson mod 7/28/02 */
+
+int
+main (argc, argv)
+     int argc;
+     char **argv;
+{
+  int c;
+  int digit_optind = 0;
+
+  while (1)
+    {
+      int this_option_optind = optind ? optind : 1;
+
+      c = getopt (argc, argv, "abc:d:0123456789");
+      if (c == -1)
+        break;
+
+      switch (c)
+        {
+        case '0':
+        case '1':
+        case '2':
+        case '3':
+        case '4':
+        case '5':
+        case '6':
+        case '7':
+        case '8':
+        case '9':
+          if (digit_optind != 0 && digit_optind != this_option_optind)
+            printf ("digits occur in two different argv-elements.\n");
+          digit_optind = this_option_optind;
+          printf ("option %c\n", c);
+          break;
+
+        case 'a':
+          printf ("option a\n");
+          break;
+
+        case 'b':
+          printf ("option b\n");
+          break;
+
+        case 'c':
+          printf ("option c with value `%s'\n", optarg);
+          break;
+
+        case '?':
+          break;
+
+        default:
+          printf ("?? getopt returned character code 0%o ??\n", c);
+        }
+    }
+
+  if (optind < argc)
+    {
+      printf ("non-option ARGV-elements: ");
+      while (optind < argc)
+        printf ("%s ", argv[optind++]);
+      printf ("\n");
+    }
+
+  exit (0);
+}
+
+#endif /* TEST */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/examples/TestMasterMicroMod/getopt.h	Tue Apr 17 16:13:22 2007 +0200
@@ -0,0 +1,191 @@
+/* from http://www.pwilson.net/getopt.html */
+
+/* getopt.h */
+/* Declarations for getopt.
+   Copyright (C) 1989-1994, 1996-1999, 2001 Free Software 
+   Foundation, Inc. This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute 
+   it and/or modify it under the terms of the GNU Lesser 
+   General Public License as published by the Free Software 
+   Foundation; either version 2.1 of the License, or 
+   (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will 
+   be useful, but WITHOUT ANY WARRANTY; without even the 
+   implied warranty of MERCHANTABILITY or FITNESS FOR A 
+   PARTICULAR PURPOSE.  See the GNU Lesser General Public 
+   License for more details.
+
+   You should have received a copy of the GNU Lesser General 
+   Public License along with the GNU C Library; if not, write 
+   to the Free Software Foundation, Inc., 59 Temple Place,
+   Suite 330, Boston, MA 02111-1307 USA.  */
+
+  
+
+  
+
+#ifndef _GETOPT_H
+
+#ifndef __need_getopt
+# define _GETOPT_H 1
+#endif
+
+/* If __GNU_LIBRARY__ is not already defined, either we are being used
+   standalone, or this is the first header included in the source file.
+   If we are being used with glibc, we need to include <features.h>, but
+   that does not exist if we are standalone.  So: if __GNU_LIBRARY__ is
+   not defined, include <ctype.h>, which will pull in <features.h> for us
+   if it's from glibc.  (Why ctype.h?  It's guaranteed to exist and it
+   doesn't flood the namespace with stuff the way some other headers do.)  */
+#if !defined __GNU_LIBRARY__
+# include <ctype.h>
+#endif
+
+#ifdef  __cplusplus
+extern "C" {
+#endif
+
+/* For communication from `getopt' to the caller.
+   When `getopt' finds an option that takes an argument,
+   the argument value is returned here.
+   Also, when `ordering' is RETURN_IN_ORDER,
+   each non-option ARGV-element is returned here.  */
+
+extern char *optarg;
+
+/* Index in ARGV of the next element to be scanned.
+   This is used for communication to and from the caller
+   and for communication between successive calls to `getopt'.
+
+   On entry to `getopt', zero means this is the first call; initialize.
+
+   When `getopt' returns -1, this is the index of the first of the
+   non-option elements that the caller should itself scan.
+
+   Otherwise, `optind' communicates from one call to the next
+   how much of ARGV has been scanned so far.  */
+
+extern int optind;
+
+/* Callers store zero here to inhibit the error message `getopt' prints
+   for unrecognized options.  */
+
+extern int opterr;
+
+/* Set to an option character which was unrecognized.  */
+
+extern int optopt;
+
+#ifndef __need_getopt
+/* Describe the long-named options requested by the application.
+   The LONG_OPTIONS argument to getopt_long or getopt_long_only is a vector
+   of `struct option' terminated by an element containing a name which is
+   zero.
+
+   The field `has_arg' is:
+   no_argument          (or 0) if the option does not take an argument,
+   required_argument    (or 1) if the option requires an argument,
+   optional_argument    (or 2) if the option takes an optional argument.
+
+   If the field `flag' is not NULL, it points to a variable that is set
+   to the value given in the field `val' when the option is found, but
+   left unchanged if the option is not found.
+
+   To have a long-named option do something other than set an `int' to
+   a compiled-in constant, such as set a value from `optarg', set the
+   option's `flag' field to zero and its `val' field to a nonzero
+   value (the equivalent single-letter option character, if there is
+   one).  For long options that have a zero `flag' field, `getopt'
+   returns the contents of the `val' field.  */
+
+struct option
+{
+# if (defined __STDC__ && __STDC__) || defined __cplusplus
+  const char *name;
+# else
+  char *name;
+# endif
+  /* has_arg can't be an enum because some compilers complain about
+     type mismatches in all the code that assumes it is an int.  */
+  int has_arg;
+  int *flag;
+  int val;
+};
+
+/* Names for the values of the `has_arg' field of `struct option'.  */
+
+# define no_argument            0
+# define required_argument      1
+# define optional_argument      2
+#endif  /* need getopt */
+
+
+/* Get definitions and prototypes for functions to process the
+   arguments in ARGV (ARGC of them, minus the program name) for
+   options given in OPTS.
+
+   Return the option character from OPTS just read.  Return -1 when
+   there are no more options.  For unrecognized options, or options
+   missing arguments, `optopt' is set to the option letter, and '?' is
+   returned.
+
+   The OPTS string is a list of characters which are recognized option
+   letters, optionally followed by colons, specifying that that letter
+   takes an argument, to be placed in `optarg'.
+
+   If a letter in OPTS is followed by two colons, its argument is
+   optional.  This behavior is specific to the GNU `getopt'.
+
+   The argument `--' causes premature termination of argument
+   scanning, explicitly telling `getopt' that there are no more
+   options.
+
+   If OPTS begins with `--', then non-option arguments are treated as
+   arguments to the option '\0'.  This behavior is specific to the GNU
+   `getopt'.  */
+
+#if (defined __STDC__ && __STDC__) || defined __cplusplus
+# ifdef __GNU_LIBRARY__
+/* Many other libraries have conflicting prototypes for getopt, with
+   differences in the consts, in stdlib.h.  To avoid compilation
+   errors, only prototype getopt for the GNU C library.  */
+extern int getopt (int ___argc, char *const *___argv, const char *__shortopts);
+# else /* not __GNU_LIBRARY__ */
+extern int getopt ();
+# endif /* __GNU_LIBRARY__ */
+
+# ifndef __need_getopt
+extern int getopt_long (int ___argc, char *const *___argv,
+                        const char *__shortopts,
+                        const struct option *__longopts, int *__longind);
+extern int getopt_long_only (int ___argc, char *const *___argv,
+                             const char *__shortopts,
+                             const struct option *__longopts, int *__longind);
+
+/* Internal only.  Users should not call this directly.  */
+extern int _getopt_internal (int ___argc, char *const *___argv,
+                             const char *__shortopts,
+                             const struct option *__longopts, int *__longind,
+                             int __long_only);
+# endif
+#else /* not __STDC__ */
+extern int getopt ();
+# ifndef __need_getopt
+extern int getopt_long ();
+extern int getopt_long_only ();
+
+extern int _getopt_internal ();
+# endif
+#endif /* __STDC__ */
+
+#ifdef  __cplusplus
+}
+#endif
+
+/* Make sure we later can get all the definitions and declarations.  */
+#undef __need_getopt
+
+#endif /* getopt.h */
+
--- a/examples/TestMasterSlave/TestMasterSalve.vcproj	Tue Apr 17 16:11:38 2007 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,252 +0,0 @@
-<?xml version="1.0" encoding="Windows-1252"?>
-<VisualStudioProject
-	ProjectType="Visual C++"
-	Version="8,00"
-	Name="TestMasterSlave"
-	ProjectGUID="{B51A176D-5320-4534-913B-3025CED5B27E}"
-	Keyword="Win32Proj"
-	>
-	<Platforms>
-		<Platform
-			Name="Win32"
-		/>
-	</Platforms>
-	<ToolFiles>
-	</ToolFiles>
-	<Configurations>
-		<Configuration
-			Name="Debug|Win32"
-			OutputDirectory="../../Debug"
-			IntermediateDirectory="Debug"
-			ConfigurationType="1"
-			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
-			CharacterSet="2"
-			>
-			<Tool
-				Name="VCPreBuildEventTool"
-			/>
-			<Tool
-				Name="VCCustomBuildTool"
-			/>
-			<Tool
-				Name="VCXMLDataGeneratorTool"
-			/>
-			<Tool
-				Name="VCWebServiceProxyGeneratorTool"
-			/>
-			<Tool
-				Name="VCMIDLTool"
-			/>
-			<Tool
-				Name="VCCLCompilerTool"
-				Optimization="0"
-				AdditionalIncludeDirectories="../../include;../../include/win32"
-				PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
-				MinimalRebuild="true"
-				BasicRuntimeChecks="3"
-				RuntimeLibrary="3"
-				UsePrecompiledHeader="0"
-				WarningLevel="3"
-				Detect64BitPortabilityProblems="false"
-				DebugInformationFormat="4"
-			/>
-			<Tool
-				Name="VCManagedResourceCompilerTool"
-			/>
-			<Tool
-				Name="VCResourceCompilerTool"
-			/>
-			<Tool
-				Name="VCPreLinkEventTool"
-			/>
-			<Tool
-				Name="VCLinkerTool"
-				AdditionalDependencies="CanFestival-3.lib"
-				OutputFile="$(OutDir)/TestMasterSlave.exe"
-				LinkIncremental="2"
-				AdditionalLibraryDirectories="../../Debug UNICODE"
-				GenerateDebugInformation="true"
-				ProgramDatabaseFile="$(OutDir)/TestMasterSlave.pdb"
-				SubSystem="1"
-				OptimizeForWindows98="1"
-				TargetMachine="1"
-			/>
-			<Tool
-				Name="VCALinkTool"
-			/>
-			<Tool
-				Name="VCManifestTool"
-			/>
-			<Tool
-				Name="VCXDCMakeTool"
-			/>
-			<Tool
-				Name="VCBscMakeTool"
-			/>
-			<Tool
-				Name="VCFxCopTool"
-			/>
-			<Tool
-				Name="VCAppVerifierTool"
-			/>
-			<Tool
-				Name="VCWebDeploymentTool"
-			/>
-			<Tool
-				Name="VCPostBuildEventTool"
-			/>
-		</Configuration>
-		<Configuration
-			Name="Release|Win32"
-			OutputDirectory="../../Release"
-			IntermediateDirectory="Release"
-			ConfigurationType="1"
-			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
-			CharacterSet="2"
-			>
-			<Tool
-				Name="VCPreBuildEventTool"
-			/>
-			<Tool
-				Name="VCCustomBuildTool"
-			/>
-			<Tool
-				Name="VCXMLDataGeneratorTool"
-			/>
-			<Tool
-				Name="VCWebServiceProxyGeneratorTool"
-			/>
-			<Tool
-				Name="VCMIDLTool"
-			/>
-			<Tool
-				Name="VCCLCompilerTool"
-				AdditionalIncludeDirectories="../../include;../../include/win32"
-				PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
-				RuntimeLibrary="2"
-				UsePrecompiledHeader="0"
-				WarningLevel="3"
-				Detect64BitPortabilityProblems="false"
-				DebugInformationFormat="3"
-			/>
-			<Tool
-				Name="VCManagedResourceCompilerTool"
-			/>
-			<Tool
-				Name="VCResourceCompilerTool"
-			/>
-			<Tool
-				Name="VCPreLinkEventTool"
-			/>
-			<Tool
-				Name="VCLinkerTool"
-				AdditionalDependencies="CanFestival-3.lib"
-				OutputFile="$(OutDir)/TestMasterSlave.exe"
-				LinkIncremental="1"
-				AdditionalLibraryDirectories="../../Release"
-				GenerateDebugInformation="true"
-				SubSystem="1"
-				OptimizeReferences="2"
-				EnableCOMDATFolding="2"
-				OptimizeForWindows98="1"
-				TargetMachine="1"
-			/>
-			<Tool
-				Name="VCALinkTool"
-			/>
-			<Tool
-				Name="VCManifestTool"
-			/>
-			<Tool
-				Name="VCXDCMakeTool"
-			/>
-			<Tool
-				Name="VCBscMakeTool"
-			/>
-			<Tool
-				Name="VCFxCopTool"
-			/>
-			<Tool
-				Name="VCAppVerifierTool"
-			/>
-			<Tool
-				Name="VCWebDeploymentTool"
-			/>
-			<Tool
-				Name="VCPostBuildEventTool"
-			/>
-		</Configuration>
-	</Configurations>
-	<References>
-	</References>
-	<Files>
-		<Filter
-			Name="Source Files"
-			Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
-			UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
-			>
-			<File
-				RelativePath=".\getopt.c"
-				>
-			</File>
-			<File
-				RelativePath=".\Master.c"
-				>
-			</File>
-			<File
-				RelativePath=".\Slave.c"
-				>
-			</File>
-			<File
-				RelativePath=".\TestMaster.c"
-				>
-			</File>
-			<File
-				RelativePath=".\TestMasterSlave.c"
-				>
-			</File>
-			<File
-				RelativePath=".\TestSlave.c"
-				>
-			</File>
-		</Filter>
-		<Filter
-			Name="Header Files"
-			Filter="h;hpp;hxx;hm;inl;inc;xsd"
-			UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
-			>
-			<File
-				RelativePath=".\getopt.h"
-				>
-			</File>
-			<File
-				RelativePath=".\Master.h"
-				>
-			</File>
-			<File
-				RelativePath=".\Slave.h"
-				>
-			</File>
-			<File
-				RelativePath=".\TestMaster.h"
-				>
-			</File>
-			<File
-				RelativePath=".\TestMasterSlave.h"
-				>
-			</File>
-			<File
-				RelativePath=".\TestSlave.h"
-				>
-			</File>
-		</Filter>
-		<Filter
-			Name="Resource Files"
-			Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx"
-			UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
-			>
-		</Filter>
-	</Files>
-	<Globals>
-	</Globals>
-</VisualStudioProject>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/examples/TestMasterSlave/TestMasterSlave.vcproj	Tue Apr 17 16:13:22 2007 +0200
@@ -0,0 +1,252 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+	ProjectType="Visual C++"
+	Version="8,00"
+	Name="TestMasterSlave"
+	ProjectGUID="{B51A176D-5320-4534-913B-3025CED5B27E}"
+	Keyword="Win32Proj"
+	>
+	<Platforms>
+		<Platform
+			Name="Win32"
+		/>
+	</Platforms>
+	<ToolFiles>
+	</ToolFiles>
+	<Configurations>
+		<Configuration
+			Name="Debug|Win32"
+			OutputDirectory="../../Debug"
+			IntermediateDirectory="Debug"
+			ConfigurationType="1"
+			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+			CharacterSet="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="0"
+				AdditionalIncludeDirectories="../../include;../../include/win32"
+				PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
+				MinimalRebuild="true"
+				BasicRuntimeChecks="3"
+				RuntimeLibrary="3"
+				UsePrecompiledHeader="0"
+				WarningLevel="3"
+				Detect64BitPortabilityProblems="false"
+				DebugInformationFormat="4"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				AdditionalDependencies="CanFestival-3.lib"
+				OutputFile="$(OutDir)/TestMasterSlave.exe"
+				LinkIncremental="2"
+				AdditionalLibraryDirectories="../../Debug UNICODE"
+				GenerateDebugInformation="true"
+				ProgramDatabaseFile="$(OutDir)/TestMasterSlave.pdb"
+				SubSystem="1"
+				OptimizeForWindows98="1"
+				TargetMachine="1"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCWebDeploymentTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Release|Win32"
+			OutputDirectory="../../Release"
+			IntermediateDirectory="Release"
+			ConfigurationType="1"
+			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+			CharacterSet="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				AdditionalIncludeDirectories="../../include;../../include/win32"
+				PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
+				RuntimeLibrary="2"
+				UsePrecompiledHeader="0"
+				WarningLevel="3"
+				Detect64BitPortabilityProblems="false"
+				DebugInformationFormat="3"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				AdditionalDependencies="CanFestival-3.lib"
+				OutputFile="$(OutDir)/TestMasterSlave.exe"
+				LinkIncremental="1"
+				AdditionalLibraryDirectories="../../Release"
+				GenerateDebugInformation="true"
+				SubSystem="1"
+				OptimizeReferences="2"
+				EnableCOMDATFolding="2"
+				OptimizeForWindows98="1"
+				TargetMachine="1"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCWebDeploymentTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+	</Configurations>
+	<References>
+	</References>
+	<Files>
+		<Filter
+			Name="Source Files"
+			Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
+			UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
+			>
+			<File
+				RelativePath=".\getopt.c"
+				>
+			</File>
+			<File
+				RelativePath=".\Master.c"
+				>
+			</File>
+			<File
+				RelativePath=".\Slave.c"
+				>
+			</File>
+			<File
+				RelativePath=".\TestMaster.c"
+				>
+			</File>
+			<File
+				RelativePath=".\TestMasterSlave.c"
+				>
+			</File>
+			<File
+				RelativePath=".\TestSlave.c"
+				>
+			</File>
+		</Filter>
+		<Filter
+			Name="Header Files"
+			Filter="h;hpp;hxx;hm;inl;inc;xsd"
+			UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
+			>
+			<File
+				RelativePath=".\getopt.h"
+				>
+			</File>
+			<File
+				RelativePath=".\Master.h"
+				>
+			</File>
+			<File
+				RelativePath=".\Slave.h"
+				>
+			</File>
+			<File
+				RelativePath=".\TestMaster.h"
+				>
+			</File>
+			<File
+				RelativePath=".\TestMasterSlave.h"
+				>
+			</File>
+			<File
+				RelativePath=".\TestSlave.h"
+				>
+			</File>
+		</Filter>
+		<Filter
+			Name="Resource Files"
+			Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx"
+			UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
+			>
+		</Filter>
+	</Files>
+	<Globals>
+	</Globals>
+</VisualStudioProject>
--- a/examples/TestMasterSlave/strace.txt	Tue Apr 17 16:11:38 2007 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,239 +0,0 @@
-execve("./TestMasterSlave", ["./TestMasterSlave"], [/* 60 vars */]) = 0
-uname({sys="Linux", node="recto", ...}) = 0
-brk(0)                                  = 0x509000
-mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x2aaaaaac0000
-access("/etc/ld.so.preload", R_OK)      = -1 ENOENT (No such file or directory)
-open("/etc/ld.so.cache", O_RDONLY)      = 3
-fstat(3, {st_mode=S_IFREG|0644, st_size=192295, ...}) = 0
-mmap(NULL, 192295, PROT_READ, MAP_PRIVATE, 3, 0) = 0x2aaaaaac1000
-close(3)                                = 0
-open("/lib/libpthread.so.0", O_RDONLY)  = 3
-read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\240V\0\0"..., 640) = 640
-lseek(3, 624, SEEK_SET)                 = 624
-read(3, "\4\0\0\0\20\0\0\0\1\0\0\0GNU\0\0\0\0\0\2\0\0\0\6\0\0\0"..., 32) = 32
-fstat(3, {st_mode=S_IFREG|0755, st_size=118250, ...}) = 0
-mmap(NULL, 1131368, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x2aaaaabc1000
-mprotect(0x2aaaaabd1000, 1065832, PROT_NONE) = 0
-mmap(0x2aaaaacd0000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0xf000) = 0x2aaaaacd0000
-mmap(0x2aaaaacd2000, 13160, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x2aaaaacd2000
-close(3)                                = 0
-open("/lib/libc.so.6", O_RDONLY)        = 3
-read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\20\307\1"..., 640) = 640
-lseek(3, 64, SEEK_SET)                  = 64
-read(3, "\6\0\0\0\5\0\0\0@\0\0\0\0\0\0\0@\0\0\0\0\0\0\0@\0\0\0\0"..., 616) = 616
-lseek(3, 680, SEEK_SET)                 = 680
-read(3, "\4\0\0\0\20\0\0\0\1\0\0\0GNU\0\0\0\0\0\2\0\0\0\6\0\0\0"..., 32) = 32
-fstat(3, {st_mode=S_IFREG|0755, st_size=1273952, ...}) = 0
-lseek(3, 64, SEEK_SET)                  = 64
-read(3, "\6\0\0\0\5\0\0\0@\0\0\0\0\0\0\0@\0\0\0\0\0\0\0@\0\0\0\0"..., 616) = 616
-mmap(NULL, 2252808, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x2aaaaacd6000
-mprotect(0x2aaaaadf3000, 1085448, PROT_NONE) = 0
-mmap(0x2aaaaaef2000, 24576, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x11c000) = 0x2aaaaaef2000
-mmap(0x2aaaaaef8000, 16392, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x2aaaaaef8000
-close(3)                                = 0
-mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x2aaaaaefd000
-mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x2aaaaaefe000
-mprotect(0x2aaaaaef2000, 12288, PROT_READ) = 0
-mprotect(0x2aaaaacd0000, 4096, PROT_READ) = 0
-mprotect(0x2aaaaabbf000, 4096, PROT_READ) = 0
-arch_prctl(ARCH_SET_FS, 0x2aaaaaefde80) = 0
-munmap(0x2aaaaaac1000, 192295)          = 0
-set_tid_address(0x2aaaaaefdf10)         = 25127
-rt_sigaction(SIGRTMIN, {0x2aaaaabc6240, [], SA_RESTORER|SA_SIGINFO, 0x2aaaaabcd370}, NULL, 8) = 0
-rt_sigaction(SIGRT_1, {0x2aaaaabc62c0, [], SA_RESTORER|SA_RESTART|SA_SIGINFO, 0x2aaaaabcd370}, NULL, 8) = 0
-rt_sigprocmask(SIG_UNBLOCK, [RTMIN RT_1], NULL, 8) = 0
-getrlimit(RLIMIT_STACK, {rlim_cur=8192*1024, rlim_max=RLIM_INFINITY}) = 0
-_sysctl({{CTL_KERN, KERN_VERSION}, 2, 0x7fffff967810, 31, (nil), 0}) = 0
-open("/dev/urandom", O_RDONLY)          = 3
-read(3, "\327\236\37f?\202\314\203", 8) = 8
-close(3)                                = 0
-rt_sigaction(SIGTERM, {0x401130, [TERM], SA_RESTORER|SA_RESTART, 0x2aaaaad04a20}, {SIG_DFL}, 8) = 0
-rt_sigaction(SIGINT, {0x401130, [INT], SA_RESTORER|SA_RESTART, 0x2aaaaad04a20}, {SIG_DFL}, 8) = 0
-pipe([3, 4])                            = 0
-mmap(NULL, 8392704, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS|0x40, -1, 0) = 0x40000000
-brk(0)                                  = 0x509000
-brk(0x52a000)                           = 0x52a000
-mprotect(0x40000000, 4096, PROT_NONE)   = 0
-clone(child_stack=0x40800280, flags=CLONE_VM|CLONE_FS|CLONE_FILES|CLONE_SIGHAND|CLONE_THREAD|CLONE_SYSVSEM|CLONE_SETTLS|CLONE_PARENT_SETTID|CLONE_CHILD_CLEARTID, parent_tidptr=0x408009f0, tls=0x40800960, child_tidptr=0x408009f0) = 25128
-pipe([5, 6])                            = 0
-mmap(NULL, 8392704, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS|0x40, -1, 0) = 0x40801000
-mprotect(0x40801000, 4096, PROT_NONE)   = 0
-clone(child_stack=0x41001280, flags=CLONE_VM|CLONE_FS|CLONE_FILES|CLONE_SIGHAND|CLONE_THREAD|CLONE_SYSVSEM|CLONE_SETTLS|CLONE_PARENT_SETTID|CLONE_CHILD_CLEARTID, parent_tidptr=0x410019f0, tls=0x41001960, child_tidptr=0x410019f0) = 25129
-rt_sigaction(SIGALRM, {0x4017f0, [ALRM], SA_RESTORER|SA_RESTART, 0x2aaaaad04a20}, {SIG_DFL}, 8) = 0
-setitimer(ITIMER_REAL, {it_interval={0, 0}, it_value={0, 1}}, {it_interval={0, 0}, it_value={0, 0}}) = 0
-setitimer(ITIMER_REAL, {it_interval={0, 0}, it_value={0, 18446744073709551615}}, {it_interval={0, 0}, it_value={0, 8000}}) = 0
-fstat(1, {st_mode=S_IFCHR|0600, st_rdev=makedev(136, 2), ...}) = 0
-mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x2aaaaaac1000
-write(1, "TestMaster_initialisation\n", 26) = 26
-write(1, "M->S NODE_GUARD rtr:0 len:1 00\n", 31) = 31
-write(4, "\1\7\0\0\0\0\0\0\0\1\0\0\0\0\0\0\31\0\0\0\0\0\0\0", 24) = 24
-setitimer(ITIMER_REAL, {it_interval={0, 0}, it_value={0, 50000}}, {it_interval={0, 0}, it_value={0, 0}}) = 0
-write(1, "TestMaster_preOperational\n", 26) = 26
-write(1, "TestSlave_initialisation\n", 25) = 25
-write(1, "S->M NODE_GUARD rtr:0 len:1 00\n", 31) = 31
-write(6, "\2\7\0\0\0\0\0\0\0\1\0\0\0\0\0\0\30\0\0\0\0\0\0\0", 24) = 24
-write(1, "TestSlave_preOperational\n", 25) = 25
-write(1, "TestMaster_operational\n", 23) = 23
-write(1, "M->S NMT rtr:0 len:2 01 02\n", 27) = 27
-write(4, "\0\0\0\0\0\0\0\0\0\2\1\2\0\0\0\0\0O@\0\0\0\0\0", 24) = 24
-pause()                                 = ? ERESTARTNOHAND (To be restarted)
---- SIGALRM (Alarm clock) @ 0 (0) ---
-rt_sigaction(SIGALRM, {0x4017f0, [ALRM], SA_RESTORER|SA_RESTART, 0x2aaaaad04a20}, {0x4017f0, [ALRM], SA_RESTORER|SA_RESTART, 0x2aaaaad04a20}, 8) = 0
-rt_sigreturn(0x508af0)                  = -1 EINTR (Interrupted system call)
-setitimer(ITIMER_REAL, {it_interval={0, 0}, it_value={0, 49983}}, {it_interval={0, 0}, it_value={0, 0}}) = 0
-write(1, "M->S SYNC rtr:0 len:0\n", 22) = 22
-write(4, "\200\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0", 24) = 24
-write(1, "TestMaster_post_sync\n", 21)  = 21
-write(1, "Master: 0 0 0 0\n", 16)       = 16
-write(1, "TestMaster_post_TPDO\n", 21)  = 21
-write(1, "M->S SDOrx rtr:0 len:8 40 02 20 "..., 47) = 47
-write(4, "\2\6\0\0\0\0\0\0\0\10@\2 \0\0\0\0\0\226\377\377\177\0\0"..., 24) = 24
-pause()                                 = ? ERESTARTNOHAND (To be restarted)
---- SIGALRM (Alarm clock) @ 0 (0) ---
-rt_sigaction(SIGALRM, {0x4017f0, [ALRM], SA_RESTORER|SA_RESTART, 0x2aaaaad04a20}, {0x4017f0, [ALRM], SA_RESTORER|SA_RESTART, 0x2aaaaad04a20}, 8) = 0
-rt_sigreturn(0x508af0)                  = -1 EINTR (Interrupted system call)
-setitimer(ITIMER_REAL, {it_interval={0, 0}, it_value={0, 49982}}, {it_interval={0, 0}, it_value={0, 0}}) = 0
-write(1, "M->S SYNC rtr:0 len:0\n", 22) = 22
-write(4, "\200\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0", 24) = 24
-write(1, "TestMaster_post_sync\n", 21)  = 21
-write(1, "Master: 1 2 3 4\n", 16)       = 16
-write(1, "TestMaster_post_TPDO\n", 21)  = 21
-write(1, "Got SDO answer (0x2002, 0x00), 0"..., 35) = 35
-pause()                                 = ? ERESTARTNOHAND (To be restarted)
---- SIGALRM (Alarm clock) @ 0 (0) ---
-rt_sigaction(SIGALRM, {0x4017f0, [ALRM], SA_RESTORER|SA_RESTART, 0x2aaaaad04a20}, {0x4017f0, [ALRM], SA_RESTORER|SA_RESTART, 0x2aaaaad04a20}, 8) = 0
-rt_sigreturn(0x508af0)                  = -1 EINTR (Interrupted system call)
-setitimer(ITIMER_REAL, {it_interval={0, 0}, it_value={0, 49982}}, {it_interval={0, 0}, it_value={0, 0}}) = 0
-write(1, "M->S SYNC rtr:0 len:0\n", 22) = 22
-write(4, "\200\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0", 24) = 24
-write(1, "TestMaster_post_sync\n", 21)  = 21
-write(1, "Master: 2 4 6 8\n", 16)       = 16
-write(1, "TestMaster_post_TPDO\n", 21)  = 21
-pause()                                 = ? ERESTARTNOHAND (To be restarted)
---- SIGALRM (Alarm clock) @ 0 (0) ---
-rt_sigaction(SIGALRM, {0x4017f0, [ALRM], SA_RESTORER|SA_RESTART, 0x2aaaaad04a20}, {0x4017f0, [ALRM], SA_RESTORER|SA_RESTART, 0x2aaaaad04a20}, 8) = 0
-rt_sigreturn(0x508af0)                  = -1 EINTR (Interrupted system call)
-setitimer(ITIMER_REAL, {it_interval={0, 0}, it_value={0, 49968}}, {it_interval={0, 0}, it_value={0, 0}}) = 0
-write(1, "M->S SYNC rtr:0 len:0\n", 22) = 22
-write(4, "\200\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0", 24) = 24
-write(1, "TestMaster_post_sync\n", 21)  = 21
-write(1, "Master: 3 6 9 12\n", 17)      = 17
-write(1, "TestMaster_post_TPDO\n", 21)  = 21
-pause()                                 = ? ERESTARTNOHAND (To be restarted)
---- SIGALRM (Alarm clock) @ 0 (0) ---
-rt_sigaction(SIGALRM, {0x4017f0, [ALRM], SA_RESTORER|SA_RESTART, 0x2aaaaad04a20}, {0x4017f0, [ALRM], SA_RESTORER|SA_RESTART, 0x2aaaaad04a20}, 8) = 0
-rt_sigreturn(0x508af0)                  = -1 EINTR (Interrupted system call)
-setitimer(ITIMER_REAL, {it_interval={0, 0}, it_value={0, 49975}}, {it_interval={0, 0}, it_value={0, 0}}) = 0
-write(1, "M->S SYNC rtr:0 len:0\n", 22) = 22
-write(4, "\200\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0", 24) = 24
-write(1, "TestMaster_post_sync\n", 21)  = 21
-write(1, "Master: 4 8 12 16\n", 18)     = 18
-write(1, "TestMaster_post_TPDO\n", 21)  = 21
-pause()                                 = ? ERESTARTNOHAND (To be restarted)
---- SIGALRM (Alarm clock) @ 0 (0) ---
-rt_sigaction(SIGALRM, {0x4017f0, [ALRM], SA_RESTORER|SA_RESTART, 0x2aaaaad04a20}, {0x4017f0, [ALRM], SA_RESTORER|SA_RESTART, 0x2aaaaad04a20}, 8) = 0
-rt_sigreturn(0x508af0)                  = -1 EINTR (Interrupted system call)
-setitimer(ITIMER_REAL, {it_interval={0, 0}, it_value={0, 49982}}, {it_interval={0, 0}, it_value={0, 0}}) = 0
-write(1, "M->S SYNC rtr:0 len:0\n", 22) = 22
-write(4, "\200\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0", 24) = 24
-write(1, "TestMaster_post_sync\n", 21)  = 21
-write(1, "Master: 5 10 15 20\n", 19)    = 19
-write(1, "TestMaster_post_TPDO\n", 21)  = 21
-pause()                                 = ? ERESTARTNOHAND (To be restarted)
---- SIGALRM (Alarm clock) @ 0 (0) ---
-rt_sigaction(SIGALRM, {0x4017f0, [ALRM], SA_RESTORER|SA_RESTART, 0x2aaaaad04a20}, {0x4017f0, [ALRM], SA_RESTORER|SA_RESTART, 0x2aaaaad04a20}, 8) = 0
-rt_sigreturn(0x508af0)                  = -1 EINTR (Interrupted system call)
-setitimer(ITIMER_REAL, {it_interval={0, 0}, it_value={0, 49983}}, {it_interval={0, 0}, it_value={0, 0}}) = 0
-write(1, "M->S SYNC rtr:0 len:0\n", 22) = 22
-write(4, "\200\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0", 24) = 24
-write(1, "TestMaster_post_sync\n", 21)  = 21
-write(1, "Master: 6 12 18 24\n", 19)    = 19
-write(1, "TestMaster_post_TPDO\n", 21)  = 21
-pause()                                 = ? ERESTARTNOHAND (To be restarted)
---- SIGALRM (Alarm clock) @ 0 (0) ---
-rt_sigaction(SIGALRM, {0x4017f0, [ALRM], SA_RESTORER|SA_RESTART, 0x2aaaaad04a20}, {0x4017f0, [ALRM], SA_RESTORER|SA_RESTART, 0x2aaaaad04a20}, 8) = 0
-rt_sigreturn(0x508af0)                  = -1 EINTR (Interrupted system call)
-setitimer(ITIMER_REAL, {it_interval={0, 0}, it_value={0, 49984}}, {it_interval={0, 0}, it_value={0, 0}}) = 0
-write(1, "M->S SYNC rtr:0 len:0\n", 22) = 22
-write(4, "\200\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0", 24) = 24
-write(1, "TestMaster_post_sync\n", 21)  = 21
-write(1, "Master: 7 14 21 28\n", 19)    = 19
-write(1, "TestMaster_post_TPDO\n", 21)  = 21
-pause()                                 = ? ERESTARTNOHAND (To be restarted)
---- SIGALRM (Alarm clock) @ 0 (0) ---
-rt_sigaction(SIGALRM, {0x4017f0, [ALRM], SA_RESTORER|SA_RESTART, 0x2aaaaad04a20}, {0x4017f0, [ALRM], SA_RESTORER|SA_RESTART, 0x2aaaaad04a20}, 8) = 0
-rt_sigreturn(0x508af0)                  = -1 EINTR (Interrupted system call)
-setitimer(ITIMER_REAL, {it_interval={0, 0}, it_value={0, 49983}}, {it_interval={0, 0}, it_value={0, 0}}) = 0
-write(1, "M->S SYNC rtr:0 len:0\n", 22) = 22
-write(4, "\200\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0", 24) = 24
-write(1, "TestMaster_post_sync\n", 21)  = 21
-write(1, "Master: 8 16 24 32\n", 19)    = 19
-write(1, "TestMaster_post_TPDO\n", 21)  = 21
-pause()                                 = ? ERESTARTNOHAND (To be restarted)
---- SIGALRM (Alarm clock) @ 0 (0) ---
-rt_sigaction(SIGALRM, {0x4017f0, [ALRM], SA_RESTORER|SA_RESTART, 0x2aaaaad04a20}, {0x4017f0, [ALRM], SA_RESTORER|SA_RESTART, 0x2aaaaad04a20}, 8) = 0
-rt_sigreturn(0x508af0)                  = -1 EINTR (Interrupted system call)
-setitimer(ITIMER_REAL, {it_interval={0, 0}, it_value={0, 49983}}, {it_interval={0, 0}, it_value={0, 0}}) = 0
-write(1, "M->S SYNC rtr:0 len:0\n", 22) = 22
-write(4, "\200\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0", 24) = 24
-write(1, "TestMaster_post_sync\n", 21)  = 21
-write(1, "Master: 9 18 27 36\n", 19)    = 19
-write(1, "TestMaster_post_TPDO\n", 21)  = 21
-pause()                                 = ? ERESTARTNOHAND (To be restarted)
---- SIGALRM (Alarm clock) @ 0 (0) ---
-rt_sigaction(SIGALRM, {0x4017f0, [ALRM], SA_RESTORER|SA_RESTART, 0x2aaaaad04a20}, {0x4017f0, [ALRM], SA_RESTORER|SA_RESTART, 0x2aaaaad04a20}, 8) = 0
-rt_sigreturn(0x508af0)                  = -1 EINTR (Interrupted system call)
-setitimer(ITIMER_REAL, {it_interval={0, 0}, it_value={0, 49984}}, {it_interval={0, 0}, it_value={0, 0}}) = 0
-write(1, "M->S SYNC rtr:0 len:0\n", 22) = 22
-write(4, "\200\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0", 24) = 24
-write(1, "TestMaster_post_sync\n", 21)  = 21
-write(1, "Master: 10 20 30 40\n", 20)   = 20
-write(1, "TestMaster_post_TPDO\n", 21)  = 21
-write(1, "M->S SDOrx rtr:0 len:8 40 02 20 "..., 47) = 47
-write(4, "\2\6\0\0\0\0\0\0\0\10@\2 \0\0\0\0\0\226\377\377\177\0\0"..., 24) = 24
-pause()                                 = ? ERESTARTNOHAND (To be restarted)
---- SIGALRM (Alarm clock) @ 0 (0) ---
-rt_sigaction(SIGALRM, {0x4017f0, [ALRM], SA_RESTORER|SA_RESTART, 0x2aaaaad04a20}, {0x4017f0, [ALRM], SA_RESTORER|SA_RESTART, 0x2aaaaad04a20}, 8) = 0
-rt_sigreturn(0x508af0)                  = -1 EINTR (Interrupted system call)
-setitimer(ITIMER_REAL, {it_interval={0, 0}, it_value={0, 49970}}, {it_interval={0, 0}, it_value={0, 0}}) = 0
-write(1, "M->S SYNC rtr:0 len:0\n", 22) = 22
-write(4, "\200\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0", 24) = 24
-write(1, "TestMaster_post_sync\n", 21)  = 21
-write(1, "Master: 11 22 33 44\n", 20)   = 20
-write(1, "TestMaster_post_TPDO\n", 21)  = 21
-write(1, "Got SDO answer (0x2002, 0x00), 0"..., 35) = 35
-pause()                                 = ? ERESTARTNOHAND (To be restarted)
---- SIGALRM (Alarm clock) @ 0 (0) ---
-rt_sigaction(SIGALRM, {0x4017f0, [ALRM], SA_RESTORER|SA_RESTART, 0x2aaaaad04a20}, {0x4017f0, [ALRM], SA_RESTORER|SA_RESTART, 0x2aaaaad04a20}, 8) = 0
-rt_sigreturn(0x508af0)                  = -1 EINTR (Interrupted system call)
-setitimer(ITIMER_REAL, {it_interval={0, 0}, it_value={0, 49983}}, {it_interval={0, 0}, it_value={0, 0}}) = 0
-write(1, "M->S SYNC rtr:0 len:0\n", 22) = 22
-write(4, "\200\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0", 24) = 24
-write(1, "TestMaster_post_sync\n", 21)  = 21
-write(1, "Master: 12 24 36 48\n", 20)   = 20
-write(1, "TestMaster_post_TPDO\n", 21)  = 21
-pause()                                 = ? ERESTARTNOHAND (To be restarted)
---- SIGALRM (Alarm clock) @ 0 (0) ---
-rt_sigaction(SIGALRM, {0x4017f0, [ALRM], SA_RESTORER|SA_RESTART, 0x2aaaaad04a20}, {0x4017f0, [ALRM], SA_RESTORER|SA_RESTART, 0x2aaaaad04a20}, 8) = 0
-rt_sigreturn(0x508af0)                  = -1 EINTR (Interrupted system call)
-setitimer(ITIMER_REAL, {it_interval={0, 0}, it_value={0, 49984}}, {it_interval={0, 0}, it_value={0, 0}}) = 0
-write(1, "M->S SYNC rtr:0 len:0\n", 22) = 22
-write(4, "\200\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0", 24) = 24
-write(1, "TestMaster_post_sync\n", 21)  = 21
-write(1, "Master: 13 26 39 52\n", 20)   = 20
-write(1, "TestMaster_post_TPDO\n", 21)  = 21
-pause()                                 = ? ERESTARTNOHAND (To be restarted)
---- SIGALRM (Alarm clock) @ 0 (0) ---
-rt_sigaction(SIGALRM, {0x4017f0, [ALRM], SA_RESTORER|SA_RESTART, 0x2aaaaad04a20}, {0x4017f0, [ALRM], SA_RESTORER|SA_RESTART, 0x2aaaaad04a20}, 8) = 0
-rt_sigreturn(0x508af0)                  = -1 EINTR (Interrupted system call)
-setitimer(ITIMER_REAL, {it_interval={0, 0}, it_value={0, 49984}}, {it_interval={0, 0}, it_value={0, 0}}) = 0
-write(1, "M->S SYNC rtr:0 len:0\n", 22) = 22
-write(4, "\200\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0", 24) = 24
-write(1, "TestMaster_post_sync\n", 21)  = 21
-write(1, "Master: 14 28 42 56\n", 20)   = 20
-write(1, "TestMaster_post_TPDO\n", 21)  = 21
-pause()                                 = ? ERESTARTNOHAND (To be restarted)
---- SIGINT (Interrupt) @ 0 (0) ---
-rt_sigaction(SIGTERM, {0x401130, [TERM], SA_RESTORER|SA_RESTART, 0x2aaaaad04a20}, {0x401130, [TERM], SA_RESTORER|SA_RESTART, 0x2aaaaad04a20}, 8) = 0
-rt_sigaction(SIGINT, {0x401130, [INT], SA_RESTORER|SA_RESTART, 0x2aaaaad04a20}, {0x401130, [INT], SA_RESTORER|SA_RESTART, 0x2aaaaad04a20}, 8) = 0
-kill(0, SIGALRM
\ No newline at end of file
--- a/src/sdo.c	Tue Apr 17 16:11:38 2007 +0200
+++ b/src/sdo.c	Tue Apr 17 16:13:22 2007 +0200
@@ -1045,6 +1045,7 @@
 	/* The line *must* be released by the core program. */
 	StopSDO_TIMER(line)
 	d->transfers[line].state = SDO_ABORTED_RCV;
+	d->transfers[line].abortCode = abortCode;
 	MSG_WAR(0x3AB0, "SD0. Received SDO abort. Line state ABORTED. Code : ", abortCode);
 	if(d->transfers[line].Callback) (*d->transfers[line].Callback)(d,nodeId);
       }