diff -Naur megawave2/kernel/lib/include/mw.h megawave2.patched/kernel/lib/include/mw.h
--- megawave2/kernel/lib/include/mw.h	2006-03-07 11:17:09.000000000 +0100
+++ megawave2.patched/kernel/lib/include/mw.h	2009-12-18 15:43:24.000000000 +0100
@@ -73,7 +73,7 @@
 extern char           *_mw_itoa_(int);
 extern char           *_mw_uitoa_(unsigned int);
 extern char           *_mw_ltoa_(long);
-extern char           *_mw_ultoa_(unsigned long);
+extern char           *_mw_ultoa_(unsigned int);
 extern char           *_mw_ftoa_(float);
 extern char           *_mw_dtoa_(double);
 
@@ -194,10 +194,10 @@
                               ((((unsigned short) (b2)) & 0x00ff)<<8) )
 
 /* invert 4 bytes data : 0123 -> 3210 */
-#define _mw_get_flip_b4(b4) ( (( ((unsigned long) (b4)) & 0xff000000)>>24)+ \
-                              ((((unsigned long) (b4)) & 0x00ff0000)>>8) + \
-                              ((((unsigned long) (b4)) & 0x0000ff00)<<8) + \
-			      ((((unsigned long) (b4)) & 0x000000ff)<<24) ) 
+#define _mw_get_flip_b4(b4) ( (( ((unsigned int) (b4)) & 0xff000000)>>24)+ \
+                              ((((unsigned int) (b4)) & 0x00ff0000)>>8) + \
+                              ((((unsigned int) (b4)) & 0x0000ff00)<<8) + \
+			      ((((unsigned int) (b4)) & 0x000000ff)<<24) ) 
 
 /* In-place flipping */
 /* invert 2 bytes data : 01 -> 10 */
@@ -207,19 +207,19 @@
 #define _mw_in_flip_b4(b4)  (b4) = _mw_get_flip_b4(b4)
 
 
-/* For float, need to perform the flip by means of an unsigned long buffer 
+/* For float, need to perform the flip by means of an unsigned int buffer 
    fptr : input has to be a pointer to a float
-   flip_float : buffer of type unsigned long * (to be defined in the calling func.)
+   flip_float : buffer of type unsigned int * (to be defined in the calling func.)
    output : *fptr is the flipped float value.
 */
-#define _mw_in_flip_float(fptr) flip_float=(unsigned long *)(fptr); \
+#define _mw_in_flip_float(fptr) flip_float=(unsigned int *)(fptr); \
                                   _mw_in_flip_b4(*flip_float); 
 
 
 /* For double=(u1,u2), performs (flip(u2),flip(u1)) where u1,u2 are
    long (b4 = 32 bits). 
-   b4 : input has to be a pointer to a unsigned long.
-   flip_double : buffer of type unsigned long (to be defined in the calling func.)
+   b4 : input has to be a pointer to a unsigned int.
+   flip_double : buffer of type unsigned int (to be defined in the calling func.)
    output : *((double *) b4) is the flipped double value.   
 */
 
diff -Naur megawave2/kernel/lib/include/native_ftype.h megawave2.patched/kernel/lib/include/native_ftype.h
--- megawave2/kernel/lib/include/native_ftype.h	2006-03-17 17:08:42.000000000 +0100
+++ megawave2.patched/kernel/lib/include/native_ftype.h	2009-12-18 15:35:24.000000000 +0100
@@ -37,7 +37,7 @@
   You may change the order if you want to change default priorities.
 */
 
-static char *mw_native_ftypes[] = 
+static const char *mw_native_ftypes[] = 
 {
   "cimage","IMG","PM_C","GIF","TIFF","PGMA","PGMR","BMP",
 #ifdef JPEG
@@ -87,7 +87,7 @@
   A short description for each implemented file types.
 */
 
-static char *mw_ftypes_description[] = 
+static const char *mw_ftypes_description[] = 
 {
   "IMG", "Char image format defined by the defunct PCVision software and used by MegaWave1 [1x8-bits plane]",
   "PM_C", "PM char image format [1x8-bits plane]",
diff -Naur megawave2/kernel/lib/include/type_conv.h megawave2.patched/kernel/lib/include/type_conv.h
--- megawave2/kernel/lib/include/type_conv.h	2007-05-14 17:45:00.000000000 +0200
+++ megawave2.patched/kernel/lib/include/type_conv.h	2009-12-18 15:35:24.000000000 +0100
@@ -12,7 +12,7 @@
    o11,o12,...,o1n all possible output types in the conversion i->o.
 */
 
-static char *mw_type_conv_out[]=
+static const char *mw_type_conv_out[]=
 
 {
   "fimage","cimage","cfimage","ccimage",NULL,
@@ -56,7 +56,7 @@
    i11,i12,...,i1n all possible input types in the conversion i->o.
 */
 
-static char *mw_type_conv_in[]=
+static const char *mw_type_conv_in[]=
 
 {
   "fimage","cimage","cfimage","ccimage",NULL,
diff -Naur megawave2/kernel/lib/src/mwio.c megawave2.patched/kernel/lib/src/mwio.c
--- megawave2/kernel/lib/src/mwio.c	2006-03-21 18:24:38.000000000 +0100
+++ megawave2.patched/kernel/lib/src/mwio.c	2009-12-18 15:42:22.000000000 +0100
@@ -52,7 +52,7 @@
 
 {
   register unsigned short *ptr2;
-  register unsigned long *ptr4;
+  register unsigned int *ptr4;
   register long i;
 
   if (flip == TRUE)  /* Flip the image data (reverse byte order) */
@@ -72,7 +72,7 @@
 	  if (sizeof(*ptr4) != size)
 	    mwerror(FATAL, 0,
     "Cannot flip %d-bytes data with this machine architecture\n",size);
-	  for (i=0, ptr4 = (unsigned long *) ptr;
+	  for (i=0, ptr4 = (unsigned int *) ptr;
 		 i<dx*dy; i++,ptr4++)
 	    _mw_in_flip_b4(*ptr4);
 	  break;	  
diff -Naur megawave2/kernel/mwp/main.c megawave2.patched/kernel/mwp/main.c
--- megawave2/kernel/mwp/main.c	2001-12-27 22:56:44.000000000 +0100
+++ megawave2.patched/kernel/mwp/main.c	2009-12-18 15:35:05.000000000 +0100
@@ -103,6 +103,8 @@
 # endif
 #endif
 
+/* GF */
+#define TEST
 
 main(argc, argv)
 int argc;
diff -Naur megawave2/kernel/mwplight/mwpl_io.c megawave2.patched/kernel/mwplight/mwpl_io.c
--- megawave2/kernel/mwplight/mwpl_io.c	2007-04-24 16:37:40.000000000 +0200
+++ megawave2.patched/kernel/mwplight/mwpl_io.c	2009-12-18 15:47:40.000000000 +0100
@@ -312,9 +312,9 @@
 ~~~~~~~~~~
 */
 #ifdef __STDC__
-int getline(char *line)
+int getline2(char *line)
 #else
-int getline(line)
+int getline2(line)
 char *line;
 #endif
 
@@ -836,10 +836,13 @@
       }
     else
       {
+	strcpy(group_name,"global");
+/*	
 	if (strcmp(CWD,PWD)==0)
 	  Error("Invalid current directory \"%s\".\nExpecting subdir of \"%s\"", CWD,mwsrcdir);
 	else
 	  Error("Invalid current directory \"%s\" (or equivalently \"%s\").\nExpecting subdir of \"%s\"", CWD,PWD,mwsrcdir);
+*/
       }
 
   /*printf("[getgroupname] group_name=\"%s\"\n",group_name);*/
diff -Naur megawave2/kernel/mwplight/mwpl_parse.c megawave2.patched/kernel/mwplight/mwpl_parse.c
--- megawave2/kernel/mwplight/mwpl_parse.c	2007-04-16 14:51:32.000000000 +0200
+++ megawave2.patched/kernel/mwplight/mwpl_parse.c	2009-12-18 15:47:51.000000000 +0100
@@ -59,7 +59,7 @@
   if (!fs) Error("NULL file pointer fs");
   do
     {
-      l=getline(line);
+      l=getline2(line);
       removespaces(line);
       /*printf("line='%s'\n",line);*/
       if ((strcmp(line,HEADER_ID1)==0)||(strcmp(line,HEADER_ID1b)==0)) return(1);
diff -Naur megawave2/kernel/mwplight/mwpl_proto.h megawave2.patched/kernel/mwplight/mwpl_proto.h
--- megawave2/kernel/mwplight/mwpl_proto.h	2005-08-14 18:08:24.000000000 +0200
+++ megawave2.patched/kernel/mwplight/mwpl_proto.h	2009-12-18 15:46:42.000000000 +0100
@@ -49,7 +49,7 @@
 /* mwpl_io.c:211:NF */ extern char *getprintfstring (char *s); /* (s) char *s; */
 /* mwpl_io.c:246:NF */ extern void removespaces (char *in); /* (in) char *in; */
 /* mwpl_io.c:290:OF */ extern int skipline (void); /* () */
-/* mwpl_io.c:319:NF */ extern int getline (char *line); /* (line) char *line; */
+/* mwpl_io.c:319:NF */ extern int getline2 (char *line); /* (line) char *line; */
 /* mwpl_io.c:344:OF */ extern void skipcomment (void); /* () */
 /* mwpl_io.c:381:NF */ extern int getsentence (char *s); /* (s) char *s; */
 /* mwpl_io.c:442:OF */ extern void skipblock (void); /* () */
diff -Naur megawave2/kernel/mwplight/mwpl_tree.c megawave2.patched/kernel/mwplight/mwpl_tree.c
--- megawave2/kernel/mwplight/mwpl_tree.c	2006-02-23 16:39:57.000000000 +0100
+++ megawave2.patched/kernel/mwplight/mwpl_tree.c	2009-12-18 15:35:05.000000000 +0100
@@ -126,7 +126,7 @@
   Arg *a,*b;
   double m0,m1;
 
-  if ((H->Name[0]<'a')||(H->Name[0]>'z'))
+  if (((H->Name[0]<'a')||(H->Name[0]>'z'))&&((H->Name[0]<'A')||(H->Name[0]>'Z')))
     Error("Invalid header : incorrect module's name or missing name statement");
 
   if (strlen(H->Author)<3)
diff -Naur megawave2/kernel/mwplight/mwpl_tree.c.rej megawave2.patched/kernel/mwplight/mwpl_tree.c.rej
--- megawave2/kernel/mwplight/mwpl_tree.c.rej	1970-01-01 01:00:00.000000000 +0100
+++ megawave2.patched/kernel/mwplight/mwpl_tree.c.rej	2009-12-18 15:35:33.000000000 +0100
@@ -0,0 +1,17 @@
+***************
+*** 126,132 ****
+    Arg *a,*b;
+    double m0,m1;
+  
+-   if ((H->Name[0]<'a')||(H->Name[0]>'z'))
+      Error("Invalid header : incorrect module's name or missing name statement");
+  
+    if (strlen(H->Author)<3)
+--- 126,132 ----
+    Arg *a,*b;
+    double m0,m1;
+  
++   if (((H->Name[0]<'a')||(H->Name[0]>'z'))&&((H->Name[0]<'A')||(H->Name[0]>'Z')))
+      Error("Invalid header : incorrect module's name or missing name statement");
+  
+    if (strlen(H->Author)<3)
diff -Naur megawave2/kernel/shell/cmw2 megawave2.patched/kernel/shell/cmw2
--- megawave2/kernel/shell/cmw2	2007-06-15 14:20:28.000000000 +0200
+++ megawave2.patched/kernel/shell/cmw2	2009-12-18 15:35:05.000000000 +0100
@@ -162,13 +162,23 @@
 # Check if the current directory is a subdir of $MY_MEGAWAVE2 (user mode)
 # or of $MEGAWAVE2 (adm mode). So we do not need anymore -adm.
 
-dir=`/bin/pwd | grep $MY_MEGAWAVE2`
+# GF
+#dir=`/bin/pwd | grep $MY_MEGAWAVE2`
+dir=`pwd | grep $MY_MEGAWAVE2`
 if [ "$dir" = "" ]; then
- dir=`/bin/pwd | grep $MEGAWAVE2`
+# GF
+# dir=`/bin/pwd | grep $MEGAWAVE2`
+ dir=`pwd | grep $MEGAWAVE2`
  if [ "$dir" = "" ]; then
   echo "Your current directory is not valid. You must compile modules into subdir of"
   echo "$MY_MEGAWAVE2/src (user mode) or of $MEGAWAVE2/src (adm mode)."
-  exit 1
+ MWDESTDIR=$MY_MEGAWAVE2
+ LULIB="-l$USER_LIBMW"
+ ULIB=$USER_LIBMW
+ XULIB=$XUSER_LIBMW
+ macropt=""
+ adm_mode=0
+#  exit 1
  else
 # adm mode
   MWDESTDIR=$MEGAWAVE2
@@ -260,6 +270,7 @@
 		
     # MegaWave 2 preprocessor options
     -D*|-I*|-U*) MWOPTS="$MWOPTS $1"
+		COPTS="$COPTS $1"
 		;;
     -w)         MWOPTS="$MWOPTS $1"
 	        ;;
diff -Naur megawave2/kernel/shell/cmw2.rej megawave2.patched/kernel/shell/cmw2.rej
--- megawave2/kernel/shell/cmw2.rej	1970-01-01 01:00:00.000000000 +0100
+++ megawave2.patched/kernel/shell/cmw2.rej	2009-12-18 15:35:34.000000000 +0100
@@ -0,0 +1,16 @@
+***************
+*** 270,275 ****
+  		
+      # MegaWave 2 preprocessor options
+      -D*|-I*|-U*) MWOPTS="$MWOPTS $1"
+  		;;
+      -w)         MWOPTS="$MWOPTS $1"
+  	        ;;
+--- 270,276 ----
+  		
+      # MegaWave 2 preprocessor options
+      -D*|-I*|-U*) MWOPTS="$MWOPTS $1"
++ 		COPTS="$COPTS $1"
+  		;;
+      -w)         MWOPTS="$MWOPTS $1"
+  	        ;;
diff -Naur megawave2/src/curve/io/fkview.c megawave2.patched/src/curve/io/fkview.c
--- megawave2/src/curve/io/fkview.c	2007-05-06 14:41:12.000000000 +0200
+++ megawave2.patched/src/curve/io/fkview.c	2009-12-18 15:54:29.000000000 +0100
@@ -114,7 +114,7 @@
   }
 }
 
-double trunc(v,ref)
+double trunc2(v,ref)
      double v,ref;
 {
   ref = v/ref;
@@ -301,7 +301,7 @@
 	if (s_flag) y = Y1+(int)((double)(Y2-Y1)*(v-sy1)/(sy2-sy1));
 	else        y = Y2+(int)((double)(Y1-Y2)*(v-sy1)/(sy2-sy1));
 	if (y>=Y1 && y<=Y2) {
-	  snprintf(str,STRSIZE,"%g",trunc(v,truncref));
+	  snprintf(str,STRSIZE,"%g",trunc2(v,truncref));
 	  i = strlen(str);
 	  if (i>size_strleft) size_strleft=i;
 	}
@@ -329,7 +329,7 @@
 	  case 2: mw_draw_ccimage(image,X2+1,y,X2+7,y,255,0,0);
 	  case 1: mw_draw_ccimage(image,X1-7,y,X1-1,y,255,0,0);
 	  }
-	  snprintf(str,STRSIZE,"%g",trunc(v,truncref));
+	  snprintf(str,STRSIZE,"%g",trunc2(v,truncref));
 	  ccputstring(image,X1-7-FONTWIDTH*strlen(str),y-FONTHEIGHT/2,
 		      &fgcolor,&bgcolor,NULL,str);
 	}
@@ -355,7 +355,7 @@
 	  case 2: mw_draw_ccimage(image,x,Y1-7,x,Y1-1,255,0,0);
 	  case 1: mw_draw_ccimage(image,x,Y2+1,x,Y2+7,255,0,0);
 	  }
-	  snprintf(str,STRSIZE,"%g",trunc(v,truncref));
+	  snprintf(str,STRSIZE,"%g",trunc2(v,truncref));
 	  ccputstring(image,x-strlen(str)*FONTWIDTH/2,Y2+7,
 		      &fgcolor,&bgcolor,NULL,str);
 	}
diff -Naur megawave2/src/signal/splot.c megawave2.patched/src/signal/splot.c
--- megawave2/src/signal/splot.c	2007-05-06 14:41:12.000000000 +0200
+++ megawave2.patched/src/signal/splot.c	2009-12-18 15:52:54.000000000 +0100
@@ -98,7 +98,7 @@
   return(0);
 }
 
-double trunc(v,ref)
+double trunc2(v,ref)
      double v,ref;
 {
   ref = v/ref; 
@@ -178,7 +178,7 @@
     for (k=0;(v=yofs+(double)k*ystep*(double)ysub)<=sy2;k++) {
       y = Y2+(int)((double)(Y1-Y2)*(v-sy1)/(sy2-sy1));
       if (y>=Y1 && y<=Y2) {
-	snprintf(str,STRSIZE,"%g",trunc(v,truncref));
+	snprintf(str,STRSIZE,"%g",trunc2(v,truncref));
 	i = strlen(str);
 	if (i>max) max=i;
       }
@@ -201,7 +201,7 @@
 	  case 2: mw_draw_ccimage(image,X2+1,y,X2+7,y,255,0,0);
 	  case 1: mw_draw_ccimage(image,X1-7,y,X1-1,y,255,0,0);
 	  }
-	  snprintf(str,STRSIZE,"%g",trunc(v,truncref));
+	  snprintf(str,STRSIZE,"%g",trunc2(v,truncref));
 	  ccputstring(image,X1-7-FONTWIDTH*strlen(str),y-FONTHEIGHT/2,
 		      &fgcolor,&bgcolor,NULL,str);
 	}
@@ -227,7 +227,7 @@
 	  case 2: mw_draw_ccimage(image,x,Y1-7,x,Y1-1,255,0,0);
 	  case 1: mw_draw_ccimage(image,x,Y2+1,x,Y2+7,255,0,0);
 	  }
-	  snprintf(str,STRSIZE,"%g",trunc(v,truncref));
+	  snprintf(str,STRSIZE,"%g",trunc2(v,truncref));
 	  ccputstring(image,x-strlen(str)*FONTWIDTH/2,Y2+7,
 		      &fgcolor,&bgcolor,NULL,str);
 	}
