#include <stdio.h>
#include <string.h>
-#include <alloc.h>
+//#include <alloc.h>
#include "aslink.h"
/*)Module lklex.c
* char get()
* VOID getfid()
* VOID getid()
- * int getline()
+ * int lk_getline()
* int getmap()
* char getnb()
* int more()
VOID
getid(id, c)
-register c;
+register int c;
char *id;
{
register char *p;
VOID
getfid(str, c)
-register c;
+register int c;
char *str;
{
register char *p;
if (p < &str[FILSPC-1])
*p++ = c;
c = get();
+ if (c == ';')
+ while (c)
+ c = get();
#ifdef SDK
} while (c);
#else /* SDK */
char
getnb()
{
- register c;
+ register int c;
while ((c=get())==' ' || c=='\t')
;
VOID
skip(c)
-register c;
+register int c;
{
if (c < 0)
c = getnb();
char
get()
{
- register c;
+ register int c;
if ((c = *ip) != 0)
++ip;
int
getmap(d)
{
- register c, n, v;
+ register int c, n, v;
if ((c = get()) == '\0')
return (-1);
return (c);
}
-/*)Function int getline()
+/*)Function int lk_getline()
*
- * The function getline() reads a line of input text from a
+ * The function lk_getline() reads a line of input text from a
* .rel source text file, a .lnk command file or from stdin.
* Lines of text are processed from a single .lnk file or
* multiple .rel files until all files have been read.
* The input text line is copied into the global string ib[]
* and converted to a NULL terminated string. The function
- * getline() returns a (1) after succesfully reading a line
+ * lk_getline() returns a (1) after succesfully reading a line
* or a (0) if all files have been read.
* This function also opens each input .lst file and output
* .rst file as each .rel file is processed.
*/
int
-getline()
+lk_getline()
{
- register i, ftype;
+ register int i, ftype;
register char *fid;
loop: if (pflag && cfp && cfp->f_type == F_STD)
int
more()
{
- register c;
+ register int c;
c = getnb();
unget(c);
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;
+}