* src/regression/add.c, src/regression/add2.c, src/regression/add3.c,
[fw/sdcc] / link / z80 / lklex.c
index 8863809fd97f0274677dd5c9c756ab0b4b7de179..7bc34fcaa34a6655e9fd0c1b8bfd414ba1a9f1d7 100644 (file)
@@ -15,7 +15,7 @@
 
 #include <stdio.h>
 #include <string.h>
-#include <alloc.h>
+//#include <alloc.h>
 #include "aslink.h"
 
 /*)Module      lklex.c
@@ -81,7 +81,7 @@
 
 VOID
 getid(id, c)
-register c;
+register int c;
 char *id;
 {
        register char *p;
@@ -134,7 +134,7 @@ char *id;
 
 VOID
 getfid(str, c)
-register c;
+register int c;
 char *str;
 {
        register char *p;
@@ -144,6 +144,9 @@ char *str;
                if (p < &str[FILSPC-1])
                        *p++ = c;
                c = get();
+               if (c == ';')
+                       while (c)
+                               c = get();
 #ifdef SDK
        } while (c);
 #else /* SDK */
@@ -175,7 +178,7 @@ char *str;
 char
 getnb()
 {
-       register c;
+       register int c;
 
        while ((c=get())==' ' || c=='\t')
                ;
@@ -205,7 +208,7 @@ getnb()
 
 VOID
 skip(c)
-register c;
+register int c;
 {
        if (c < 0)
                c = getnb();
@@ -239,7 +242,7 @@ register c;
 char
 get()
 {
-       register c;
+       register int c;
 
        if ((c = *ip) != 0)
                ++ip;
@@ -315,7 +318,7 @@ unget(c)
 int
 getmap(d)
 {
-       register c, n, v;
+       register int c, n, v;
 
        if ((c = get()) == '\0')
                return (-1);
@@ -423,7 +426,7 @@ getmap(d)
 int
 getline()
 {
-       register i, ftype;
+       register int i, ftype;
        register char *fid;
 
 loop:  if (pflag && cfp && cfp->f_type == F_STD)
@@ -530,7 +533,7 @@ loop:       if (pflag && cfp && cfp->f_type == F_STD)
 int
 more()
 {
-       register c;
+       register int c;
 
        c = getnb();
        unget(c);
@@ -562,8 +565,39 @@ more()
 char
 endline()
 {
-       register c;
+       register int c;
 
        c = getnb();
        return( (c == '\0' || c == ';') ? 0 : c );
 }
+
+/*)Function    VOID    chop_crlf(str)
+ *
+ *             char    *str            string to chop
+ *
+ *     The function chop_crlf() removes trailing LF or CR/LF from
+ *     str, if present.
+ *
+ *     local variables:
+ *             int     i               string length
+ *
+ *     global variables:
+ *             none
+ *
+ *     functions called:
+ *             none
+ *
+ *     side effects:
+ *             none
+ */
+
+VOID
+chop_crlf(str)
+char *str;
+{
+       register int i;
+
+       i = strlen(str);
+       if (i >= 1 && str[i-1] == '\n') str[i-1] = 0;
+       if (i >= 2 && str[i-2] == '\r') str[i-2] = 0;
+}