diff --git a/RIGAL/rigsc.446/bin/genrigd b/RIGAL/rigsc.446/bin/genrigd
index 0846aa62be7bebf0da1f848899c011305c3742a1..8bf3de1f73d41ff98b718490c8e4549e55d3fbc0 100755
Binary files a/RIGAL/rigsc.446/bin/genrigd and b/RIGAL/rigsc.446/bin/genrigd differ
diff --git a/RIGAL/rigsc.446/bin/ic b/RIGAL/rigsc.446/bin/ic
index 24e8521bc6697b55bef0ac04d22c2ec840a68091..cb9566ee795b3dc311c7666f0491c2cbb1a017a3 100755
Binary files a/RIGAL/rigsc.446/bin/ic and b/RIGAL/rigsc.446/bin/ic differ
diff --git a/RIGAL/rigsc.446/bin/rc b/RIGAL/rigsc.446/bin/rc
index 22c2d4c929f46e69ce7383cdc624ac5788425936..69d5b25289190118f17f0188721a512ebfbce777 100755
Binary files a/RIGAL/rigsc.446/bin/rc and b/RIGAL/rigsc.446/bin/rc differ
diff --git a/RIGAL/rigsc.446/bin/v b/RIGAL/rigsc.446/bin/v
index 56e4f558099c466bdf8b4f70e6e8f50826d2b62f..c195549b6dd51df1a9d2740cdc6f677453744e40 100755
Binary files a/RIGAL/rigsc.446/bin/v and b/RIGAL/rigsc.446/bin/v differ
diff --git a/RIGAL/rigsc.446/examples/hanoi b/RIGAL/rigsc.446/examples/hanoi
deleted file mode 100755
index fa333fa7f195877ec29f47cce6939f118191e015..0000000000000000000000000000000000000000
Binary files a/RIGAL/rigsc.446/examples/hanoi and /dev/null differ
diff --git a/RIGAL/rigsc.446/examples/hanoi.rsc b/RIGAL/rigsc.446/examples/hanoi.rsc
deleted file mode 100644
index ffc1d2378446bb7bcbd0929c7c34cd6512b31a4c..0000000000000000000000000000000000000000
Binary files a/RIGAL/rigsc.446/examples/hanoi.rsc and /dev/null differ
diff --git a/RIGAL/rigsc.446/include/defpage.h b/RIGAL/rigsc.446/include/defpage.h
index 7e093bb6bca54ac9ecaffce67aecf024be2b993d..532737b68be8184b07f45538f649e3a9b25c1679 100644
--- a/RIGAL/rigsc.446/include/defpage.h
+++ b/RIGAL/rigsc.446/include/defpage.h
@@ -15,7 +15,7 @@ extern Void savea PV();
 
 extern Void closea PV();
 
-extern Void opens PP((Char d_drive));
+extern void opens (char d_drive);
 
 /********* loads  input  f : file specifikation string
                  output e : s_pointer of loud object **/
diff --git a/RIGAL/rigsc.446/include/globrig.h b/RIGAL/rigsc.446/include/globrig.h
index 067c1eb23fadbc2357a23695a96cbe614ff6c0af..d8e3701419b4a0b49fa611a97cbb3c8fd3f6ac87 100644
--- a/RIGAL/rigsc.446/include/globrig.h
+++ b/RIGAL/rigsc.446/include/globrig.h
@@ -1,3 +1,9 @@
+#include<stdio.h>
+#include<stdlib.h>
+#include<string.h>
+#include<stdbool.h>
+#include <ctype.h>
+
 /******** GLOBRIG.H ******/
 #define Char    char
 #define boolean char
@@ -9,13 +15,8 @@
 #define Static  static
 #define Local   static
 #define FileNotFound 1
-	char* __M__;
-
+	
+char* __M__;
 #define Malloc(n)  ((__M__ = malloc(n)) ? __M__ : (char*)_OutMem())
-#include <ctype.h>
-#include <stdio.h>
-#include <string.h>
-/* #include <malloc.h> commented out 8/24/09 */
-/*#include <stdlib.h>*/
 
 
diff --git a/RIGAL/rigsc.446/lib/riglib.a b/RIGAL/rigsc.446/lib/riglib.a
index d9327ba12ed3c3febce5442e37f535bd1706d26b..b562098389230a5958f11e432f0661335b6c139b 100644
Binary files a/RIGAL/rigsc.446/lib/riglib.a and b/RIGAL/rigsc.446/lib/riglib.a differ
diff --git a/RIGAL/rigsc.446/lint/check_tmp.out b/RIGAL/rigsc.446/lint/check_tmp.out
deleted file mode 100644
index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000
diff --git a/RIGAL/rigsc.446/lint/rig_lint.rsc b/RIGAL/rigsc.446/lint/rig_lint.rsc
deleted file mode 100644
index 90eedff0fa1a950dcebe643e755fa089acfa4f77..0000000000000000000000000000000000000000
Binary files a/RIGAL/rigsc.446/lint/rig_lint.rsc and /dev/null differ
diff --git a/RIGAL/rigsc.446/src/Makefile b/RIGAL/rigsc.446/src/Makefile
index 77625050944444761e12ce07802ecdda14479ff0..9a19a6a18e3349c4cff8b14a5f5bfcc118098306 100644
--- a/RIGAL/rigsc.446/src/Makefile
+++ b/RIGAL/rigsc.446/src/Makefile
@@ -4,16 +4,12 @@
 #
 
 # C compiler to use (Compiler path can be changed by the user)
-CCFLAGS = -g
-PCA =  cc $(CCFLAGS)  -c -D xsun=1 -I../include/
-# Specify -DLE for Little-endian architectures (Big-endian is default)!
-# Specify -Dbbs for BBS-version of scaner (LaTeX version is default)!
-
+#CCFLAGS = -g -DLE -m32 -I/usr/include -I../include 
+CCFLAGS =  -m32 -I/usr/include -I../include
+#PCA =  cc $(CCFLAGS) -D STATIC_CCFLAGS='"$(CCFLAGS)"' -c  xsun=1 -I../include/ -I/usr/include
+PCA =  cc $(CCFLAGS) -D STATIC_CCFLAGS='"$(CCFLAGS)"'  -c 
+# math lib for sin, cos, sqrt etc.
 LIBS = -lm
-# This is for sin, cos, sqrt etc.
-
-#  Other things are usually not changed by the user
-.INIT:  check$(rig) 
 
 # -------------------------------------------------
 #  MACRO DEFINITIONS
@@ -49,6 +45,12 @@ normal:   bins ../lib/riglib.a ../bin/anrig ../bin/genrigd ../bin/rig_lint test
 bins:     bin ../bin/rc ../bin/ic ../bin/v
 bin:
 	-mkdir ../bin
+
+#rigal_scratch:#
+#	rm -rf ../rigal_scratch
+#	cp -r ../rigv4_scripts ../rigal_scratch#
+#	mv ../rigal_scratch/Preloaded-examples-release-4 ../rigal_scratch/examples
+
 ../bin/rc:$(RCF_SRC) rc_.o
 	cc $(CCFLAGS)  -o ../bin/rc rc_.o $(RCF_SRC) 
 
@@ -106,10 +108,10 @@ bin:
 
 test: ../test/rigcrf.rig  ../bin/rc ../lib/riglib.a ../bin/anrig ../bin/genrigd
 	(cd ../test;\
-	 $(rig)/rc rigcrf;\
-	 $(rig)/ic rigcrf rigcrf;\
-	 $(rig)/rc  rigcrf -c;\
-	 rigcrf rigcrf)
+	 ../bin/rc rigcrf;\
+	 ../bin/ic rigcrf rigcrf;\
+	 ../bin/rc  rigcrf -c;\
+	 ./rigcrf rigcrf)
 
 ##------------------ Hidden possibilities
 z:       anrigz genrigz
@@ -117,14 +119,14 @@ anrigz:
 	(cd anrig;\
 	 ../../bin/rc anrig;\
 	 ../../bin/anrig;\
-         ../../bin/genrigd S -p N.TMP;\
+	 ../../bin/genrigd S -p N.TMP;\
 	 /bin/rm *.RC2 *.RC4 *.TMP)
 
 genrigz:
 	(cd genrig;\
 	 ../../bin/rc genrigd;\
 	 ../../bin/anrig;\
-         ../../bin/genrigd S -p N.TMP;\
+	 ../../bin/genrigd S -p N.TMP;\
 	 /bin/rm *.RC2 *.RC4 *.TMP)
 ##---------------------------------------
 VERSION = 446
@@ -135,35 +137,31 @@ tar:	clean
 	cp ../rigsc.$(VERSION).tar.Z /info/ftp/pub/labs/pelab/rigal/
 ##--------------------------------------
 clean:
-	mv ../test/rigcrf.rig .
-	-rm -f *.o */*.o  *.RC2 */*.RC2  *.RC4 */*.RC4    */*.rsc  ../lint/*.o ../lint/*.RC2 ../lint/*.RC4  \
-	 ../examples/hanoi ../*/*.rsc ../*/*.out ../*/*/*.out ../test/*
-	mv rigcrf.rig ../test/
+	-rm -f *.o */*.o  *.RC2 */*.RC2  *.RC4 */*.RC4 */*.rsc
+	-rm -f ../lint/*.o ../lint/*.RC2 ../lint/*.RC4
+	-rm -f ../*/*.rsc ../*/*.out ../*/*/*.out
+	-rm -f ../test/rigcrf ../test/rigcrf.crf ../test/rigcrf.crt
+	-rm -f ../test/xcrg_0.c
+##--------------------------------------
+clean_bkups: 
+	-rm -rf ../bin_bkup ../lib_bkup
 ##--------------------------------------
 .c.o:   $(INCLIB_SRC)
 	$(PCA) $< -o $@
-check:
-	@echo '********************************************************'
-	@echo '*' User ERROR: you have not set \"rig\" environment variable to $(PWD)/../bin
-	@echo '********************************************************'
-	____FATAL___ERROR___
-check$(rig):
-	@echo VARIABLE rig have been set to $(rig)
-	@echo ---------------------------------------
 ##----------------------------------------
-# Prepare distribution 
-mkdist$(RFILE)$(RDIR):
-	@echo '*** to prepare for distribution write make mkdist RFILE=fff RDIR=/u/vaden/xyz/xyz/'
-mkdist: 
-	(cd $(RDIR);\
-	$(rig)/rc $(RFILE);\
-	$(rig)/anrig;\
-	$(rig)/genrigd S -p N.TMP;\
-	/bin/rm *.RC2 *.RC4 *.TMP)
-	cp ../include/*  $(RDIR)
-	cp $(DISTLIB) $(RDIR)
-	(cd $(RDIR);\
-	echo 'cc -O  -w  -D xsun=1 ' $(DISTLIB) ' xc*.c -o ' $(RFILE) $(LIBS)   > cmd)
-mkdist2:
-	(cd 	$(RDIR);\
-	cc -O -w -D xsun=1  $(DISTLIB)  xc*.c -o $(RFILE) $(LIBS)  ;/bin/rm *.o)
+## Prepare distribution 
+#mkdist$(RFILE)$(RDIR):
+#	@echo '*** to prepare for distribution write make mkdist RFILE=fff RDIR=/u/vaden/xyz/xyz/'
+#mkdist: 
+#	(cd $(RDIR);\
+#	../bin/rc $(RFILE);\
+#	../bin/anrig;\
+#	../bin/genrigd S -p N.TMP;\
+#	/bin/rm *.RC2 *.RC4 *.TMP)
+#	cp ../include/*  $(RDIR)
+#	cp $(DISTLIB) $(RDIR)
+#	(cd $(RDIR);\
+#	echo 'cc -O  -w  -D xsun=1 ' $(DISTLIB) ' xc*.c -o ' $(RFILE) $(LIBS)   > cmd)
+#mkdist2:
+#	(cd 	$(RDIR);\
+###	cc -O -w -D xsun=1  $(DISTLIB)  xc*.c -o $(RFILE) $(LIBS)  ;/bin/rm *.o)
diff --git a/RIGAL/rigsc.446/src/cim.c b/RIGAL/rigsc.446/src/cim.c
index 470b019cc10494770548b6b83c909a0b0390923f..0a2364954bc47491bd31b08a325c7d6b44fe6b61 100644
--- a/RIGAL/rigsc.446/src/cim.c
+++ b/RIGAL/rigsc.446/src/cim.c
@@ -950,7 +950,6 @@ long p, ot;
   ptr_ opptr;   /* pointer po s-kodu operatora */
   a aadr;   /* a-adres atoma */
   a opcel;   /* rawen opptr.cel*/
-  boolean succmakeflag;   /* uspehno oformleno imq */
 
   /* ========= osnownaq procedura ========== */
 
@@ -1225,7 +1224,6 @@ long *rez;
   ptr_ p2, stmtbeg, p3;
   boolean islist;
   /* deskriptor atoma -selektora */
-  long n;
   atomdescriptor *WITH;
 
 
@@ -1567,11 +1565,18 @@ ptr_ *pl, *p;
       y = pl->cel;
       if (y != null_) {
 	pointr(y, &s2.sa);
-	*success = (s.svd->dtype == variable ||
-		    s.svd->dtype == idvariable && s2.sad->dtype == idatom ||
-		    s.svd->dtype == nvariable && s2.sad->dtype == number);
+	*success = ( 
+                (
+                 (s.svd->dtype  == variable  )    )||
+		        ( 
+                 (s.svd->dtype  == idvariable) && 
+                 (s2.sad->dtype == idatom    )    )||
+		        (
+                 (s.svd->dtype  == nvariable ) && 
+                 (s2.sad->dtype == number)        ) 
+                );
       } else
-	*success = (s.svd->dtype != idvariable && s.svd->dtype != nvariable);
+	*success = ( (s.svd->dtype != idvariable) && (s.svd->dtype != nvariable) );
       /* if y=null */
     }  /* pl.nel<>0 */
 
diff --git a/RIGAL/rigsc.446/src/defsun3.c b/RIGAL/rigsc.446/src/defsun3.c
index 84d5e15bc3f940db523c85050b25e6110b045470..570a1f3ba245a7646bd51625410586002ea16412 100644
--- a/RIGAL/rigsc.446/src/defsun3.c
+++ b/RIGAL/rigsc.446/src/defsun3.c
@@ -7,7 +7,7 @@
 
 #ifdef MIPSEL
 /* For DEC variant, ULTRIX computers,
-/* Little endian variant of MIPS architecture:
+   Little endian variant of MIPS architecture:
    changed ... */
 #define dos             1
 #endif 
@@ -45,8 +45,7 @@
 #define m_wrong         "1014 - Internal error - wrong Spointer"
 
 
-static Void mess(messstr)
-Char *messstr;
+static Void mess(char *messstr)
 {
   printf("\n--------------------------\n");
   printf("Paging manager : %s\n", messstr);
@@ -191,7 +190,9 @@ dinformtype dinform;
 Void init_dinform()
 {
   char dt;
+  _REC_dinformtype *WITH;
 
+#ifdef bad_sets
   long SET[4];
   long SET1[4];
   long SET2[4];
@@ -199,19 +200,16 @@ Void init_dinform()
   long SET5[5], SET6[5];
   long SET7[9];
 
-  _REC_dinformtype *WITH;
-
-#ifdef bad_sets
   P_addsetr(P_expset(digit, 0L), '0', '9');
-  P_addset(P_expset(SET5, 0L), '~');
-  P_addset(SET5, '|');
-  P_addset(SET5, '`');
-  P_addset(SET5, '{');
-  P_setunion(letter, P_setunion(SET6,
-      P_setunion(SET4, P_setunion(SET2, P_addset(P_expset(SET, 0L), '_'),
-				  P_addsetr(P_expset(SET1, 0L), 'A', 'Z')),
-		 P_addsetr(P_expset(SET3, 0L), 'a', 'z')),
-      P_addset(SET5, '}')), P_addsetr(P_expset(SET7, 0L), 128, 255));
+  P_addset(P_expset( SET5, 0L), '~');
+  P_addset( SET5, '|');
+  P_addset( SET5, '`');
+  P_addset( SET5, '{');
+  P_setunion(letter, P_setunion( SET6,
+      P_setunion( SET4, P_setunion( SET2, P_addset(P_expset(SET, 0L), '_'),
+				  P_addsetr(P_expset( SET1, 0L), 'A', 'Z')),
+		 P_addsetr(P_expset( SET3, 0L), 'a', 'z')),
+      P_addset( SET5, '}')), P_addsetr(P_expset( SET7, 0L), 128, 255));
 /* p2c: defsun3.z, line 805: Note:
  * Line breaker spent 0.7+0.19 seconds, 5000 tries on line 1049 [251] */
   /* all these additional characters are added only for compatibility
@@ -259,9 +257,7 @@ longint adiscread, adiscwrite, adiscpage, sdiscread, sdiscwrite, sdiscpage;
 
 
 /*******************************************************/
-Static Void nextsp(sptr, length)
-sa_pointer *sptr;
-word length;
+static void nextsp(sa_pointer *sptr,word length)
 {
   newstru *WITH; /* pazofpa -> newstru, 5-jul-93 */
   WITH = &sptr->newstruct;
@@ -278,8 +274,7 @@ word length;
 
 /*******************************************************/
 /**** pointx ieksejam vajadzibam - loti lidzigs vecajam pointr(s) ****/
-Static long pointx(e1)
-long e1;
+static long pointx(long e1)
 {
   sa_pointer mm;
 
@@ -302,7 +297,7 @@ long e1;
 
 
 /******************************************** opena *****/
-Void opena()
+void opena()
 {
   long i;
   a_block *WITH;
@@ -328,8 +323,7 @@ struct LOC_putatm {
   long intpage;
 } ;
 
-Local Void pagecheck(LINK)
-struct LOC_putatm *LINK;
+static void pagecheck(struct LOC_putatm *LINK)
 {
   long j, k, l, garums;
   a_block *WITH;
@@ -383,9 +377,7 @@ _L99: ;
 
 
 /*********************************** putatm(ad,na,e) *****/
-Void putatm(ad, na_, e)
-Char *ad;
-long na_, *e;
+void putatm(char *ad, long na_,long *e)
 {
   struct LOC_putatm V;
   long i;
@@ -421,10 +413,7 @@ long na_, *e;
 
 
 /************************************* pointa(e,ad,na) *****/
-Void pointa(e, ad, na)
-long e;
-Char *ad;
-long *na;
+void pointa(long e,char *ad,long *na)
 {
   long i, j;
   sa_pointer atbilde;
@@ -441,7 +430,7 @@ long *na;
       (*na)++;
     }
   } else {
-    WITH = &a_bufp[atbilde.struct_.page];
+    WITH = &a_bufp[(int) atbilde.struct_.page];
     *na = WITH->inform[atbilde.struct_.offset - 1];
     j = atbilde.struct_.offset + 1;
     FORLIM = *na;
@@ -473,8 +462,7 @@ Void closes()
 
 
 /******************************************** vola *****/
-Void vola(dr, dw, dp)
-long *dr, *dw, *dp;
+void vola(long *dr,long  *dw,long  *dp)
 {
   *dr = adiscread;
   *dw = adiscwrite;
@@ -484,8 +472,7 @@ long *dr, *dw, *dp;
 
 /** * * * * * *  s - m a n a g e r * * * * * * * * * * **/
 /******************************************** opens *****/
-Void opens(d_drive)
-Char d_drive;
+void opens(char d_drive)
 {
   s_buf *ptr;
   long k;
@@ -514,8 +501,7 @@ Char d_drive;
 
 
 /****************************************** pointr (e1,e2) *****/
-Void pointr(e1, e2)
-long e1, *e2;
+void pointr(long e1,long  *e2)
 {
   sa_pointer sap;
 /*printf("  pointr %p \n",e1);*/
@@ -527,8 +513,7 @@ long e1, *e2;
 
 
 /****************************************** points (e1,e2) *****/
-Void points(e1, e2)
-long e1, *e2;
+void points(long e1,long  *e2)
 {
   sa_pointer sap;
 
@@ -540,8 +525,7 @@ long e1, *e2;
 
 
 /***************************************** gets1 (e1,e2) *****/
-Void gets1(e1, e2)
-long *e1, *e2;
+void gets1(long *e1,long *e2)
 {
   absadr absa;
   object_type *WITH;
@@ -559,8 +543,7 @@ long *e1, *e2;
 
 
 /***************************************** gets2 (e1,e2) *****/
-Void gets2(e1, e2)
-long *e1, *e2;
+void gets2(long *e1,long *e2)
 {
   absadr absa;
   object_type *WITH;
@@ -578,8 +561,7 @@ long *e1, *e2;
 
 
 /***************************************** gets5 (e1,e2) *****/
-Void gets5(e1, e2)
-long *e1, *e2;
+void gets5(long *e1,long *e2)
 {
   long i;
   absadr absa;
@@ -596,9 +578,7 @@ long *e1, *e2;
 
 
 /*************************************** loads (f,e) *****/
-Void loads(f, e)
-Char *f;
-long *e;
+void loads(char *f, long *e)
 {
   FILE *infile;
   sa_pointer bulta1, bulta2, rab1;
@@ -789,8 +769,7 @@ struct LOC_saves {
   } buffer;
 } ;
 
-Local Void move_(LINK)
-struct LOC_saves *LINK;
+static void move_(struct LOC_saves *LINK)
 {
   long i, garums;
   object_type *WITH;
@@ -812,8 +791,7 @@ struct LOC_saves *LINK;
   nextsp(&LINK->bulta2, (int)(garums + 2));
 }
 
-Local Void writeblock(LINK)
-struct LOC_saves *LINK;
+static void writeblock(struct LOC_saves *LINK)
 {
   fwrite(LINK->buffer.U3.b1, sizeof(x512), 1, LINK->outfile);
   /*** write   1 ***/
@@ -821,9 +799,7 @@ struct LOC_saves *LINK;
 
 
 /*************************************** saves (f,e) *****/
-Void saves(f, e)
-Char *f;
-long *e;
+void saves(char *f,long *e)
 {
   struct LOC_saves V;
   long i, j, k;
@@ -1007,8 +983,7 @@ struct LOC_savesn {
   } buffer;
 } ;
 
-Local Void move__(LINK)
-struct LOC_savesn *LINK;
+static void move__(struct LOC_savesn *LINK)
 {
   long i, garums;
   object_type *WITH;
@@ -1027,8 +1002,7 @@ struct LOC_savesn *LINK;
   nextsp(&LINK->bulta2, (int)garums);
 }
 
-Local Void writeblock_(LINK)
-struct LOC_savesn *LINK;
+static void writeblock_(struct LOC_savesn *LINK)
 {
 
    fwrite(LINK->buffer.U3.b1, sizeof(x512), 1, LINK->outfile);
@@ -1038,9 +1012,7 @@ struct LOC_savesn *LINK;
 
 
 /*************************************** savesn (f,e) *****/
-Void savesn(f, e)
-Char *f;
-long *e;
+void savesn(char *f, long *e)
 {
   struct LOC_savesn V;
   long i, j, k;
@@ -1200,8 +1172,7 @@ _Lara:
 
 
 /*************************************** vols *****/
-Void vols(dr, dw, dp)
-long *dr, *dw, *dp;
+void vols(long *dr,long  *dw,long *dp)
 {
   *dr = sdiscread;
   *dw = sdiscwrite;
@@ -1216,8 +1187,7 @@ struct LOC_reopen {
   absadr p2, p3;
 } ;
 
-Local Void move___(LINK)
-struct LOC_reopen *LINK;
+static void move___(struct LOC_reopen *LINK)
 {
   long i, garums;
   object_type *WITH;
@@ -1238,8 +1208,7 @@ struct LOC_reopen *LINK;
 
 
 /*************************************** reopen (f,e) *****/
-Void reopen(f, e)
-long *f, *e;
+void reopen(long *f,long *e)
 {
   struct LOC_reopen V;
   long i, k;
diff --git a/RIGAL/rigsc.446/src/erm.c b/RIGAL/rigsc.446/src/erm.c
index 752d97bc9a0957efd7c838390423d014fbcb8e86..4f2e400a5b001be4a08a7db2e110c7bf5cfd713c 100644
--- a/RIGAL/rigsc.446/src/erm.c
+++ b/RIGAL/rigsc.446/src/erm.c
@@ -714,10 +714,28 @@ long op;
 
 
 
-  if (dts[0] == dummy && dts[1] == dummy || dts[0] == number ||
-      dts[1] == number) {
-    if (op == cgt && n[0] > n[1] || op == clt && n[0] < n[1] ||
-	op == cge && n[0] >= n[1] || op == cle && n[0] <= n[1])
+  if (
+      ( 
+       (dts[0] == dummy) && 
+       (dts[1] == dummy)    ) || 
+        dts[0] == number      ||
+        dts[1] == number
+     ) 
+   {
+    if (
+         ( 
+           (op   == cgt  ) && 
+           (n[0] > n[1] )    ) || 
+         ( 
+           (op   == clt  ) && 
+           (n[0] < n[1] )    ) ||
+         (
+	       (op   == cge  ) && 
+           (n[0] >= n[1] )   ) || 
+         ( 
+           (op   == cle  ) && 
+           (n[0] <= n[1] )   )
+       )
       rez = atomt;
     else {  /* arifmetika */
       if (op >= cmult && op <= cminus) {  /* sozdatx atom rezulxtata */
@@ -796,12 +814,9 @@ long op;
 
   }
 
-_L33:
   base--;
   v[base - 2] = rez;
 
-
-
 }
 
 
@@ -1047,11 +1062,16 @@ long n;
   case 17:   /* #_ruletoatom, #_varntoatm */
     if (k == null_)
       *success = false;
-    else {
-      if (x.srd->dtype == rulename && rulenum == 16 ||
-	  (((1L << ((long)x.svd->dtype)) &
-	    ((1L << ((long)fvariable + 1)) - (1L << ((long)variable)))) != 0 &&
-	   rulenum == 17)) {
+    else 
+     {
+      if (
+           ( 
+             (x.srd->dtype == rulename)  && 
+             (rulenum      == 16      )    )||
+	       ( (((1L << ((long)x.svd->dtype)) & ((1L << ((long)fvariable + 1)) - (1L << ((long)variable))) ) != 0  &&
+	         (rulenum      == 17))         )
+         )
+   {
 	gets1(&s, &y.sa);
 	WITH1 = y.sad;
 	WITH1->dtype = idatom;
@@ -1327,7 +1347,6 @@ Void copyop()
   /*======================*/
   /* wyhod */
 
-  long k;
   mpd x, y, z;
   a r1, r2, r3;
 
@@ -1440,10 +1459,10 @@ long o;
   getval(&v[base - 3]);
   getval(&v[base - 2]);
   eqop1(o, v[base - 3], v[base - 2], &rez);
-  if (rez && o == cequ || !rez && o == cnequ)
+  if ( (rez && (o == cequ) ) || ( !rez && (o == cnequ) ) )
     v[base - 3] = atomt;
   else
-    v[base - 3] = null_;
+    v[base - 3] = null_;  
   base--;
 }  /* eqop */
 
@@ -1952,14 +1971,13 @@ long code;
   /*===============*/
   /* inicializaciq */
   /*===============*/
-  long k, k1;
+  long  k1;
   mpd x;
   long iii;
   Char m[10];
   a rez, s;
   atomdescriptor *WITH;
 
-  k = 1;
   vs[0] = code;
   debugrule = debug;
   base = 1;
@@ -2541,8 +2559,6 @@ Static Void errstrmes(n, m)
 long n;
 Char *m;
 {
-  Char STR2[130];
-
   switch (n) {
 
   case 1:
diff --git a/RIGAL/rigsc.446/src/ic.c b/RIGAL/rigsc.446/src/ic.c
index 13bd9e755cf74051d1473d8404df48986412f7aa..e5be0d1f4e5ceb4ff77b79bf83c4d338aabc8ef1 100644
--- a/RIGAL/rigsc.446/src/ic.c
+++ b/RIGAL/rigsc.446/src/ic.c
@@ -15,9 +15,7 @@ boolean debug;
 long pp1, pp2, pp3, i;
 
 
-main(argc, argv)
-int argc;
-Char *argv[];
+int main(int argc, char *argv[])
 {
   out = NULL;
   out_open = false;
diff --git a/RIGAL/rigsc.446/src/ley_.c b/RIGAL/rigsc.446/src/ley_.c
index 16ee18ba630f7cd50aa1de44a9fed28e77d7756c..661d880fc42f4a28bb23e394848b519c38fcc5fb 100644
--- a/RIGAL/rigsc.446/src/ley_.c
+++ b/RIGAL/rigsc.446/src/ley_.c
@@ -111,8 +111,15 @@ struct LOC_ley *LINK;
   else
     printf("Rigal internal error Push-101\n");
   points(pp->UU.U1.curfragment, &x.sa);
-  if (x.smld->dtype == listmain && pp->nel == mainlistelnum ||
-      x.sfld->dtype == listfragm && pp->nel == fragmlistelnum) {
+  if (
+       ( 
+         (x.smld->dtype == listmain       )  && 
+         (pp->nel       == mainlistelnum  )     ) ||
+       ( 
+         (x.sfld->dtype == listfragm      )  && 
+         (pp->nel       == fragmlistelnum )     )
+     )
+   {
     /* w slu~ae dostiveniq konca fragmenta spiska */
     gets5(&a1, &x1.sa);
     if (x.smld->dtype == listmain)   /* podceplenie */
@@ -267,7 +274,7 @@ error_rec_type *error_rec_;
   long len;   /* current line length */
   ptr_ p;
   mpd y;
-  boolean is_ident, x_lists;
+  boolean is_ident;
   /*  srb,srl,slb,sll: string; */
 /*  Char table[256]; */
   boolean maybe_octal;
@@ -278,8 +285,6 @@ error_rec_type *error_rec_;
 
 
   Char twochar_string[161];
-  long rline;
-  Char c;
   long FORLIM;
   int fff;
   numberdescriptor *WITH;
@@ -299,7 +304,6 @@ error_rec_type *error_rec_;
   strcpy(V.fistack[0].f, first_file);
 
   V.errflag = false;
-  x_lists = false;
   for (V.i = 1; V.i <= 33; V.i++) {
     twochar_symbols[V.i - 1][0] = twochar_string[V.i * 3 - 3];
     twochar_symbols[V.i - 1][1] = twochar_string[V.i * 3 - 2];
@@ -343,7 +347,9 @@ _L1:
 	infile[V.fistacklen - 1] = NULL;
 	V.fistacklen--;
 	/* adding letter 'C'=continuation flag */
-	sprintf(ff1, "%sC", V.fistack[V.fistacklen - 1].f);
+    if (strlen(ff1) < 80)  ff1[(int)strlen(ff1)]='C';
+    else exit(0);
+	//sprintf(ff1, "%sC", V.fistack[V.fistacklen - 1].f);
 	FORLIM = strlen(ff1);
 	for (j = 0; j < FORLIM; j++)
 	  V.s[j] = ff1[j];
@@ -431,9 +437,16 @@ _L95:
               and give s to  makeatom */
     j = 1;
     jj = 1;
-    while (V.i + j <= len &&
-	   (s1[V.i + j - 1] != '\'' ||
-	    s1[V.i + j - 1] == '\'' && s1[V.i + j] == '\'')) {
+    while (
+            (
+              ( V.i + j         <= len  )         &&
+	          ( 
+                ( s1[V.i + j - 1] != '\'' )     ||
+	            ( ( s1[V.i + j - 1] == '\'' ) && 
+                  ( s1[V.i + j    ] == '\'' )  )   ) 
+            )
+          )
+         {
       if (s1[V.i + j - 1] == '\'' && s1[V.i + j] == '\'')
 	j++;
       /* if two apostrophes then we move to second
diff --git a/RIGAL/rigsc.446/src/ou2.c b/RIGAL/rigsc.446/src/ou2.c
index 83c262f6a936ebdd07b08a8c97eb4be405db8993..256f148fb6997229c354871eb9d2a98b2a0cad97 100644
--- a/RIGAL/rigsc.446/src/ou2.c
+++ b/RIGAL/rigsc.446/src/ou2.c
@@ -171,7 +171,7 @@ struct LOC_pscr *LINK;
 {
   /** recursive **/
   ptr_ pp;
-  boolean nofirstflag, treenamed;
+  boolean nofirstflag;
 
   if (!sm) {
     if (is_short(root, LINK)) {
@@ -247,9 +247,8 @@ struct LOC_pscr *LINK;
     LINK->shift += sh_depth;
     if (!sm)
       printf("%*c", (int)LINK->shift, ' ');
-    treenamed = false;
+
     if (LINK->x.smtd->name != 0) {
-      treenamed = true;
       poutrec(LINK->x.smtd->name, sm, LINK);
       printf("::");
       if (!sm)
@@ -526,14 +525,14 @@ struct LOC_pout *LINK;
 }
 
 
-Local Void poutrec_(root, sm, LINK)
+static void poutrec_(root, sm, LINK)
 long root;
 boolean sm;
 struct LOC_pout *LINK;
 {
   /** recursive **/
   ptr_ pp;
-  boolean nofirstflag, treenamed;
+  bool nofirstflag;
 
   if (!sm) {
     if (is_short_(root, LINK)) {
@@ -609,9 +608,8 @@ struct LOC_pout *LINK;
     LINK->shift += sh_depth;
     if (!sm)
       fprintf(out, "%*c", (int)LINK->shift, ' ');
-    treenamed = false;
+
     if (LINK->x.smtd->name != 0) {
-      treenamed = true;
       poutrec_(LINK->x.smtd->name, sm, LINK);
       fprintf(out, "::");
       if (!sm)
diff --git a/RIGAL/rigsc.446/src/rc_.c b/RIGAL/rigsc.446/src/rc_.c
index afda7caad90896f133322d01fd1ffe97a48991ed..6ef21cc7df9b1f04a13ab0e4aa385380483253c2 100644
--- a/RIGAL/rigsc.446/src/rc_.c
+++ b/RIGAL/rigsc.446/src/rc_.c
@@ -334,8 +334,8 @@ struct LOC_chepro *LINK;
   }
   for (q = 0; q <= 9; q++)
     LINK->bufrec.b10[q] = ' ';
-  m1[ki] = a1;   /* zakreplqet adres */
-  etalon[ki] = aadr;   /* zakreplqet a-adres */
+  m1[(int)ki] = a1;   /* zakreplqet adres */
+  etalon[(int)ki] = aadr;   /* zakreplqet a-adres */
   /*==$ifdef harddebug*/
   /*      if bb7 then
           writeln('razm. ', str80[1], str80[2], str80[3], ki: 3,
@@ -350,7 +350,7 @@ Void chepro()
   Char onechar_array[12];
   c2 twochar_symbols[29];
 
-  long ii, i;
+  long i;
   /* a1: a;*/
   ptr_ f1;
 
@@ -541,22 +541,6 @@ Void chepro()
 }
 
 
-Static Char *home_dir(Result,argum)
-Char *Result;
-char *argum;
-{
-  filespecification s;
-  long i;
-
-  strcpy(s,argum);
-  i = strlen(s);
-  while (i > 1 && s[i - 1] != '\\')
-    i--;
-  sprintf(Result, "%.*s", (int)i, s);
-  return Result;
-}
-
-
 /* Local variables for che11: */
 struct LOC_che11 {
   mpd x;
@@ -721,7 +705,6 @@ _L69:
   if (er)
     goto _L77;
 _L77:
-_L97:
   *rezche = rrr.UU.U1.mainadr;
   *error_rec_rw = error_rec_ch;
   /*different places of rec=rw and chefun*/
@@ -741,9 +724,17 @@ _L97:
       _EscIO(FileNotFound);
     fprintf(V.batfile, "#!/bin/csh -f\n");
 
+    char *binpath = realpath(an_argv[0], NULL);
+    fprintf(stderr,"BINPATH = %s\n",binpath);
+    if (binpath == NULL) binpath = strdup(getenv("_"));
+    fprintf(V.batfile, "set rig=`dirname %s`\n", binpath);
+    fprintf(V.batfile, "echo $rig\n");
+    free(binpath);
+    binpath = NULL;
+
     fprintf(V.batfile, "$rig/anrig -p N.TMP\n");
     fprintf(V.batfile, "$rig/genrigd  S -p N.TMP\n");
-    fprintf(V.batfile, " cc   -w ");
+    fprintf(V.batfile, " cc  -g -w -m32 ");
     for (i = 1; i < an_argc; i++) {
       strcpy(stt,an_argv[i]);
       brt(stt);
@@ -754,13 +745,13 @@ _L97:
 	}
       }
     }
-    fprintf(V.batfile, " -I{$rig}/../include  -I.  xcrg.c  xcrg_0.c\\\n");
+    fprintf(V.batfile, " -I../include  -I.  xcrg.c  xcrg_0.c\\\n");
     FORLIM = V.icc;
     for (i = 1; i <= FORLIM; i++)
       fprintf(V.batfile, "xcrg_%ld.c\\\n", i);
     fprintf(V.batfile, "-o %s\\\n", main_name);
-    fprintf(V.batfile, "$rig/../lib/riglib.a -lm\n");
-
+    //fprintf(V.batfile, "../lib/riglib.a -lm\n");
+    fprintf(V.batfile, "../lib/riglib.a -lm \n");
     for (i = 1; i < an_argc; i++) {
       strcpy(stt,an_argv[i]);
       brt(stt);
@@ -773,7 +764,7 @@ _L97:
       fprintf(V.batfile, "rm -f xcrg_%ld.c  xcrg_%ld.o \n", i, i);
     fprintf(V.batfile, "rm -f xcrg.c  xcrg.o xcrga.h xcrg.h\n");
     fprintf(V.batfile, "rm -f *.RC2 *.RC4  RIGCOMP.TMP N.TMP\n");
-
+    fprintf(V.batfile, "rm -f check_tmp.out $0\n");
 _L99:
     /*
 writeln(batfile,'echo Terminated successfully, result is ',main_name);*/
@@ -1286,14 +1277,15 @@ _L1: ;
 Void err(err_num)
 long err_num;
 {
+  ptr_ listp;
   long cint;
-  ptr_ local, listp;
-  string80 m;
+  char m[256];
   boolean found, var_mes;
   mpd x;
   string80 STR1;
 
-  local = l;
+  memset(m,0,256);
+  listp = l;
   /*  writeln;
     writeln('RIGAL SYNTAX ERROR NO.',err_num);*/
   switch (err_num) {
@@ -1710,11 +1702,11 @@ long err_num;
     break;
 
   case 526:
-    sprintf(m, "RULE %s WAS NOT DEFINED IN PROGRAM", error_rec_ch.message);
+    snprintf(m, 256, "RULE %s WAS NOT DEFINED IN PROGRAM", error_rec_ch.message);
     break;
 
   case 527:
-    sprintf(m, "RULE %s WAS DEFINED TWO TIMES", error_rec_ch.message);
+    snprintf(m, 256,"RULE %s WAS DEFINED TWO TIMES", error_rec_ch.message);
     break;
 
   case 528:
@@ -1732,8 +1724,7 @@ long err_num;
   }
   /*  writeln(m);*/
   /*  write(' BEFORE THIS TEXT:');*/
-  listp = local;
-  /*  for cint:=1 to 13 do begin dout(listp.cel);next(listp);end;*/
+
   cint = 1;
   found = false;
   var_mes = true;
@@ -1741,8 +1732,8 @@ long err_num;
   sprintf(error_rec_ch.message, "%s ", long_to_str(STR1, err_num));
   error_rec_ch.address = 0;
   if (err_num < 500) {
-    while (local.nel != 0 && cint < 50 && !found) {
-      pointr(local.cel, &x.sa);
+    while (listp.nel != 0 && cint < 50 && !found) {
+      pointr(listp.cel, &x.sa);
       switch (x.sad->dtype) {
 
       case atom:
@@ -1773,11 +1764,11 @@ long err_num;
 		  aa_str(STR1, x.svd->name));
 	  var_mes = false;
 	}
-	next(&local);
+	next(&listp);
 	break;
 
       default:
-	next(&local);
+	next(&listp);
 	break;
       }/*case*/
     }  /* while */
@@ -2191,7 +2182,7 @@ _L1: ;
 Local Void bltnvar(rname, rnum)
 long rname, *rnum;
 {
-  a a1;
+
   long ii;
   mpd x, x1;
 
@@ -2226,7 +2217,7 @@ long *siz, *act;
 {
   /* processes sequence of pattersn, puts code to list "m",
      count of patterns is "siz", count of action pieces is "act"  */
-  boolean pattern;
+
   long s1, ac1, arcnumber;   /* number of arc patterns*/
   ptr_ z, z1, l1, l3;
   a spopcode, a_title, a_arcvar, a_varname, limiter, a_bltnvar;
@@ -2241,7 +2232,7 @@ long *siz, *act;
   *act = 0;   /* counter of non-empty actions */
   specoperator = false;   /* net operatora */
   agregname = false;   /* net agregata */
-  pattern = true;   /* w na~ale ovidaetsq shablon,a ne operator */
+
 
   do {
 
@@ -2813,7 +2804,7 @@ _L99:
 	push(m, a_varname);
       }
     }  /* if/pattern */
-_L111:
+
     if (er)
       goto _L1;
     /*
@@ -2850,8 +2841,15 @@ long adr;
   else
     printf("Rigal internal error Push-101\n");
   points(pp->UU.U1.curfragment, &x.sa);
-  if (x.smld->dtype == listmain && pp->nel == mainlistelnum ||
-      x.sfld->dtype == listfragm && pp->nel == fragmlistelnum) {
+  if (
+      (
+       (x.smld->dtype == listmain       )  && 
+       (pp->nel       == mainlistelnum  )     )||
+      (
+       (x.sfld->dtype == listfragm      ) && 
+       (pp->nel       == fragmlistelnum )     )
+    )
+   {
     /* w slu~ae dostiveniq konca fragmenta spiska */
     gets5(&a1, &x1.sa);
     if (x.smld->dtype == listmain)   /* podceplenie */
@@ -3199,7 +3197,7 @@ long av, ar;
   /* or       0 var var var ... */
   /* program chepil also checks context conditions using this table */
   ptr_ f2, f5;   /* pointers for traversing the table */
-  long vnum, nb, rn, i;   /* counters */
+  long vnum, nb, rn;   /* counters */
   boolean bb2;   /*local flags */
   mpd x, x1;   /* deskriptors */
   a p1, aar;
@@ -3355,12 +3353,7 @@ string80 str_val, stt;
 Char zzz[256];
 Char zzz2[256];
 
-
-extern void system PP((void /*Char*/ *zz)); /* commented out 8/24/09 */
-
-extern void execl PP((Char *zz, Char *zz1, Char *rca));
-
-
+/*
 Static Void copy_line()
 {
   char *TEMP;
@@ -3374,11 +3367,9 @@ Static Void copy_line()
   if (strcmp(STR1, "--:"))
     fprintf(lstn, "%s\n", str_val);
 }
+*/
 
-
-main(argc, argv)
-int argc;
-Char *argv[];
+int main(int argc,char *argv[])
 {
 
   Char STR1[256];
diff --git a/RIGAL/rigsc.446/src/scan.c b/RIGAL/rigsc.446/src/scan.c
index a9140c441db535bd725791dd48441c0035c01818..799d84f6e3d026198b31e45d9f15b1a0131f81ed 100644
--- a/RIGAL/rigsc.446/src/scan.c
+++ b/RIGAL/rigsc.446/src/scan.c
@@ -115,13 +115,13 @@ long *xxx;
   (*xxx)++;
 }
 
-
+/*
 Static Void jnc2(xxx, yyy)
 long *xxx, yyy;
 {
   *xxx += yyy;
 }
-
+*/
 
 Static Void jncx(xxx)
 long *xxx;
@@ -518,11 +518,8 @@ Static Void readline()
 {
   /*****************************/
   /* sets new values for "s" and "i" global variables */
-  unsigned Char c;
-  long rline;
   atomdescriptor *WITH;
   long FORLIM;
-  int fff;
   int len;
   i = 1;
   /* in any case, so; only here it is initialized.
@@ -1394,9 +1391,16 @@ _L1:   /* we return to this label if token is not ready still */
     i_saved = i;   /* remember starting position */
     aadr = take_digits(&j);
 
-    if (j < 10 &&
-	(s[i + j - 1] == '.' && s[i + j] == '.' ||
-	 s[i + j - 1] != '.' && s[i + j - 1] != 'E' && s[i + j - 1] != 'e')) {
+    if ( j < 10 &&
+	     ( 
+          ( (s[i + j - 1] == '.') && 
+            (s[i + j    ] == '.')      ) ||
+	      ( (s[i + j - 1] != '.') && 
+            (s[i + j - 1] != 'E') && 
+            (s[i + j - 1] != 'e')      ) 
+         )
+       )
+      {
       putnumber();
       jnc2x(&i, j);
       goto _L99;
diff --git a/RIGAL/rigsc.446/src/scanmif.c b/RIGAL/rigsc.446/src/scanmif.c
index 58750c5cab145fa2182bf110c70eb7a7021ba6f7..f4df8c3c053f1b4dce66e36cdb9f0cfc788b4af7 100644
--- a/RIGAL/rigsc.446/src/scanmif.c
+++ b/RIGAL/rigsc.446/src/scanmif.c
@@ -108,13 +108,13 @@ long *xxx;
   (*xxx)++;
 }
 
-
+/*
 Static Void jnc2_(xxx, yyy)
 long *xxx, yyy;
 {
   *xxx += yyy;
 }
-
+*/
 
 Static Void jncx_(xxx)
 long *xxx;
@@ -285,25 +285,25 @@ Void initialize_scan_variables_mif()
 
   for (TEMP = '\0'; TEMP <= 255; TEMP++) {
     c = TEMP;
-    upcase_tab[c] = c;
+    upcase_tab[(int) c] = c;
   }
   for (c = 'a'; c <= 'z'; c++)   /*ascii*/
-    upcase_tab[c] = c - 32;
+    upcase_tab[(int) c] = c - 32;
   for (TEMP = 160; TEMP <= 175; TEMP++) {
     c = TEMP;
-    upcase_tab[c] = c - 32;
+    upcase_tab[(int) c] = c - 32;
   }
   /*russian*/
   for (TEMP = 224; TEMP <= 239; TEMP++) {
     c = TEMP;
-    upcase_tab[c] = c - 60;
+    upcase_tab[(int) c] = c - 60;
   }
   /*russian*/
   for (c = '\0'; c <= '\037'; c++)
-    as[c] = is_control;
+    as[(int) c] = is_control;
   for (TEMP = 128; TEMP <= 255; TEMP++) {
     c = TEMP;
-    as[c] = is_letter;
+    as[(int) c] = is_letter;
   }
   /* russian and pseudographics */
   for (TEMP = ' '; TEMP <= '\177'; TEMP++) {
@@ -311,7 +311,7 @@ Void initialize_scan_variables_mif()
     /* not used actually */
 
 
-    as[c] = is_printable;
+    as[(int) c] = is_printable;
   }
   as[new_line_code] = is_control;
 
@@ -319,11 +319,11 @@ Void initialize_scan_variables_mif()
   as['\t'] = is_space;
   /* these are allowed to be first letter of identifiers */
   for (c = 'A'; c <= 'Z'; c++)
-    as[c] = is_letter;
+    as[(int)c] = is_letter;
   for (c = 'a'; c <= 'z'; c++)
-    as[c] = is_letter;
+    as[(int)c] = is_letter;
   for (c = '0'; c <= '9'; c++)
-    as[c] = is_digit;
+    as[(int)c] = is_digit;
   /* allowed to be non-first letter of odentifier */
   as['_'] = is_underscore;
 
@@ -519,11 +519,9 @@ Static Void readline_()
 {
   /*****************************/
   /* sets new values for "s" and "i" global variables */
-  Char c;
-  long rline;
   atomdescriptor *WITH;
   long FORLIM;
-  int fff;
+
   i = 1;
   /* in any case, so; only here it is initialized.
           it is column number.
@@ -820,7 +818,6 @@ _L99: ;
 Static Void setlexics_()
 {
   /*************************/
-  long j, FORLIM;
 
   as['<'] = is_control;
   as['>'] = is_control;
@@ -880,7 +877,7 @@ Static Void token_()
 _L1:   /* we return to this label if token_ is not ready still */
 
   b123.b1 = s[i - 1];
-  isa = as[b123.b1];   /* type of this character */
+  isa = as[(int) b123.b1];   /* type of this character */
 
 
   if (isa == is_control) {  /*1*/
@@ -930,7 +927,7 @@ _L1:   /* we return to this label if token_ is not ready still */
       /* error = control char in string */
       dt = cont_char_to_dt_(b123.b1);
       i++;
-      if (dt == set_coord && as[s[i - 1]] == is_digit) {
+      if (dt == set_coord && as[(int) s[i - 1]] == is_digit) {
 	/* this control character sets coordinate to value given in input */
 	coord_mark = take_digits_(&j);
 	last_mark_byte_number = line_byte_number + i;
@@ -1304,7 +1301,7 @@ _L1:   /* we return to this label if token_ is not ready still */
 	j = 0;
 	do {
 	  jncx_(&j);
-	} while (s[i + j - 1] != '}' && as[s[i + j - 1]] != is_control);
+	} while (s[i + j - 1] != '}' && as[(int) s[i + j - 1]] != is_control);
 	if (s[i + j - 1] == '}')
 	  jncx_(&j);
 	putatom_(j);
@@ -1365,9 +1362,9 @@ _L1:   /* we return to this label if token_ is not ready still */
       if ((b123.b1 == '0')
           &&
           ( 
-            (as[b123.b2[1]] == is_letter)|| 
-            (as[b123.b2[1]] == is_digit) || 
-            (as[b123.b2[1]] == is_underscore)
+            (as[(int)b123.b2[1]] == is_letter)|| 
+            (as[(int)b123.b2[1]] == is_digit) || 
+            (as[(int)b123.b2[1]] == is_underscore)
           )
          ) 
       {  /*3*/
@@ -1385,8 +1382,15 @@ _L1:   /* we return to this label if token_ is not ready still */
     aadr = take_digits_(&j);
 
     if (j < 10 &&
-	(s[i + j - 1] == '.' && s[i + j] == '.' ||
-	 s[i + j - 1] != '.' && s[i + j - 1] != 'E' && s[i + j - 1] != 'e')) {
+	( 
+     ( (s[i + j - 1] == '.') && 
+       (s[i + j    ] == '.')       )||
+	 ( (s[i + j - 1] != '.') && 
+       (s[i + j - 1] != 'E') && 
+       (s[i + j - 1] != 'e')       ) 
+    )
+       ) 
+    {
       putnumber_();
       jnc2x_(&i, j);
       goto _L99;
@@ -1452,13 +1456,13 @@ Static long take_letters_()
   jj = 0;
   while (true) {
     c = s[i + jj - 1];
-    isa = as[c];
+    isa = as[(int)c];
     if (isa != is_letter && isa != is_digit && isa != is_underscore) {
       Result = jj;
       goto _L99;
     }
     if (to_uppercase)
-      s[i + jj - 1] = upcase_tab[c];
+      s[i + jj - 1] = upcase_tab[(int)c];
     jncx_(&jj);
   }
 _L99:
@@ -1480,7 +1484,7 @@ long *jj;
   summator = 0;
   while (true) {
     c = s[i + *jj - 1];
-    if (as[c] != is_digit) {
+    if (as[(int)c] != is_digit) {
       Result = summator;
       goto _L99;
     }
diff --git a/RIGAL/rigsc.446/src/sevice.c b/RIGAL/rigsc.446/src/sevice.c
index 2328caee7636830d983ec8136d77e5eba177b95b..bc2b278f43bddae8777fe862aa4240417bd79089 100644
--- a/RIGAL/rigsc.446/src/sevice.c
+++ b/RIGAL/rigsc.446/src/sevice.c
@@ -30,26 +30,7 @@ Char *Result;
 double ar;
 {
  sprintf(Result,"%E",ar);
-/*
-  boolean neg;
-  string80 bs, cs;
-
-  neg = false;
-  if (ar < 0) {
-    ar = -ar;
-    neg = true;
-  }
-  long_to_str(bs, (long)ar);
-  long_to_str(cs, (long)((ar - (long)ar + 1.0) * 100000L));
-  cs[0] = '.';
-  if (neg) {
-    sprintf(Result, "-%s%s", bs, cs);
-    return Result;
-  } else {
-    sprintf(Result, "%s%s", bs, cs);
-    return Result;
-  }
-*/
+ return Result;
 }
 
 boolean is_rig_letter(let)
@@ -118,10 +99,7 @@ Char *ssr_;
   string80 ssr;
   long l;
   a rez;
-  aa atm;
-  longint intval;
-  boolean id;
-  long i;
+  longint intval; 
 
   strcpy(ssr, ssr_);
   rez = null_;
@@ -143,7 +121,6 @@ Char *ssr_;
   long l;
   a rez;
   aa atm;
-  longint intval;
   boolean id;
   long i;
   mpd x;
diff --git a/RIGAL/rigsc.446/src/usemod.c b/RIGAL/rigsc.446/src/usemod.c
index 68185d96ae1b61195817de592a835ad0e6be9973..92cd5cd0da7b9d87fa5817710194afafe17e0c54 100644
--- a/RIGAL/rigsc.446/src/usemod.c
+++ b/RIGAL/rigsc.446/src/usemod.c
@@ -55,16 +55,15 @@ Char *stringval;
 
 
 
-
-Static Char bc(a_)
-long a_;
+/*
+static char bc(long a_)
 {
   if (a_ >= 10)
     return ((Char)(a_ + 55));
   else
     return ((Char)(a_ + 48));
 }
-
+*/
 
 Static Void dump(adr, sad)
 long adr, sad;
@@ -220,8 +219,6 @@ long p1, p2, p3, *rez;
 {
   FILE *inpfile;
   string80 s;
-  Char c;
-  long rline;
   int fff;
 
   inpfile = NULL;
@@ -789,7 +786,6 @@ long p1, p2, p3, *rez;
      requires variable name(string)
      returns null if absent
       or value (converted to number if possible) */
-  string80 pc;
 
   *rez = 0;
   if (plstr(p1, str_, &l, true, sv1)) {
diff --git a/RIGAL/rigsc.446/src/v.c b/RIGAL/rigsc.446/src/v.c
index fd051927ed16a7e5e7260d03720f3573afe8211b..669a06c1eb739e9d56b59f393ff109024953e76d 100644
--- a/RIGAL/rigsc.446/src/v.c
+++ b/RIGAL/rigsc.446/src/v.c
@@ -4,9 +4,7 @@
 #include "ley.h"
 #include "nef2.h"
 
-main(argc, argv)
-int argc;
-Char *argv[];
+int main(int argc,char *argv[])
 {
   string80 s;
   a a1;