Merge pull request #19 from stikonas/master
Heirloom-devutils: yacc and lex
This commit is contained in:
commit
1946e02d44
19
README.md
19
README.md
|
@ -9,13 +9,13 @@ system.
|
||||||
1. `git clone https://github.com/fosslinux/live-bootstrap`
|
1. `git clone https://github.com/fosslinux/live-bootstrap`
|
||||||
2. `git submodule update --init --recursive`
|
2. `git submodule update --init --recursive`
|
||||||
3. Provide a kernel (vmlinuz file) as the name kernel in the root of the repository.
|
3. Provide a kernel (vmlinuz file) as the name kernel in the root of the repository.
|
||||||
4. `./rootfs.sh` - ensure your account has kvm priviliges and qemu installed.
|
4. `./rootfs.sh` - ensure your account has kvm privileges and qemu installed.
|
||||||
a. Alternatively, run `./rootfs.sh chroot` to run it in a chroot.
|
a. Alternatively, run `./rootfs.sh chroot` to run it in a chroot.
|
||||||
b. Alternatively, run `./rootfs.sh` but don't run the actual virtualization
|
b. Alternatively, run `./rootfs.sh` but don't run the actual virtualization
|
||||||
and instead copy sysa/tmp/initramfs.igz to a USB or some other device and
|
and instead copy sysa/tmp/initramfs.igz to a USB or some other device and
|
||||||
boot from bare metal.
|
boot from bare metal.
|
||||||
6. Wait.
|
6. Wait.
|
||||||
7. Currently, live-bootstrap dosen't provide anything to you, as it is incomplete.
|
7. Currently, live-bootstrap doesn't provide anything to you, as it is incomplete.
|
||||||
|
|
||||||
## Background
|
## Background
|
||||||
|
|
||||||
|
@ -77,8 +77,8 @@ packages. Here is a list of file types that we deem unsuitable for
|
||||||
bootstrapping.
|
bootstrapping.
|
||||||
|
|
||||||
1. Binaries (apart from seed hex0, kaem, kernel).
|
1. Binaries (apart from seed hex0, kaem, kernel).
|
||||||
2. Any pregenerated configure scripts, or Makefile.in's from autotools.
|
2. Any pre-generated configure scripts, or Makefile.in's from autotools.
|
||||||
3. Pregenerated bison/flex parsers (identifiable through a `.y` file).
|
3. Pre-generated bison/flex parsers (identifiable through a `.y` file).
|
||||||
4. Any source code/binaries downloaded within a software's build system that is
|
4. Any source code/binaries downloaded within a software's build system that is
|
||||||
outside of our control to verify before use in the build system.
|
outside of our control to verify before use in the build system.
|
||||||
5. Any non-free software. [1]
|
5. Any non-free software. [1]
|
||||||
|
@ -247,16 +247,21 @@ A few of the utilities cannot be easily compiled with Mes C library, so we skip
|
||||||
GNU `grep` is a pattern matching utility. Is is not immediately needed but will
|
GNU `grep` is a pattern matching utility. Is is not immediately needed but will
|
||||||
be useful later for autotools.
|
be useful later for autotools.
|
||||||
|
|
||||||
#### Part 17: bash 2.05b
|
#### Part 17: heirloom devtools
|
||||||
|
`lex` and `yacc` from the Heirloom project. The Heirloom project is a collection
|
||||||
|
of standard UNIX utilities derived from code by Caldera and Sun. Differently from
|
||||||
|
the analogous utilities from the GNU project, they can be compiled with a simple `Makefile`.
|
||||||
|
|
||||||
|
#### Part 21: bash 2.05b
|
||||||
|
|
||||||
GNU `bash` is the most well known shell and the most complex piece of software
|
GNU `bash` is the most well known shell and the most complex piece of software
|
||||||
so far. However, it comes with a number of great benefits over kaem, including
|
so far. However, it comes with a number of great benefits over kaem, including
|
||||||
proper POSIX sh support, globbing, etc.
|
proper POSIX sh support, globbing, etc.
|
||||||
|
|
||||||
NOTE: Currently, there is a bison pregenerated file here, which we are working
|
NOTE: Currently, there is a bison pre-generated file here, which we are working
|
||||||
to remove.
|
to remove.
|
||||||
|
|
||||||
#### Part 18: m4 1.4
|
#### Part 22: m4 1.4
|
||||||
|
|
||||||
`m4` is the first piece of software we need in the autotools suite. It allows
|
`m4` is the first piece of software we need in the autotools suite. It allows
|
||||||
macros to be defined and files to be generated from those macros.
|
macros to be defined and files to be generated from those macros.
|
||||||
|
|
|
@ -119,6 +119,9 @@ get_file https://ftp.gnu.org/gnu/coreutils/coreutils-5.0.tar.bz2
|
||||||
# grep 2.4
|
# grep 2.4
|
||||||
get_file https://ftp.gnu.org/gnu/grep/grep-2.4.tar.gz
|
get_file https://ftp.gnu.org/gnu/grep/grep-2.4.tar.gz
|
||||||
|
|
||||||
|
# heirloom-devtools
|
||||||
|
get_file http://downloads.sourceforge.net/project/heirloom/heirloom-devtools/070527/heirloom-devtools-070527.tar.bz2
|
||||||
|
|
||||||
# bash 2.05b
|
# bash 2.05b
|
||||||
get_file https://ftp.gnu.org/pub/gnu/bash/bash-2.05b.tar.gz
|
get_file https://ftp.gnu.org/pub/gnu/bash/bash-2.05b.tar.gz
|
||||||
|
|
||||||
|
|
|
@ -130,6 +130,12 @@ cd ${pkg}
|
||||||
kaem --file ${pkg}.kaem
|
kaem --file ${pkg}.kaem
|
||||||
cd ..
|
cd ..
|
||||||
|
|
||||||
|
# Part 16: heirloom-devtools
|
||||||
|
pkg="heirloom-devtools-070527"
|
||||||
|
cd ${pkg}
|
||||||
|
kaem --file ${pkg}.kaem
|
||||||
|
cd ..
|
||||||
|
|
||||||
# Part 17: bash
|
# Part 17: bash
|
||||||
pkg="bash-2.05b"
|
pkg="bash-2.05b"
|
||||||
cd ${pkg}
|
cd ${pkg}
|
||||||
|
|
|
@ -0,0 +1,39 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
set -ex
|
||||||
|
|
||||||
|
mkdir build
|
||||||
|
cd build
|
||||||
|
|
||||||
|
bindir=/after/bin
|
||||||
|
libdir=/after/lib
|
||||||
|
lexdir=/lex
|
||||||
|
|
||||||
|
# Extract
|
||||||
|
bunzip2 ../src/${pkg}.tar.bz2
|
||||||
|
tar xf ../src/${pkg}.tar ${pkg}/yacc ${pkg}/lex
|
||||||
|
cd ${pkg}
|
||||||
|
|
||||||
|
# Prepare and patch
|
||||||
|
patch -Np0 -i ../../patches/yacc_remove_wchar.patch
|
||||||
|
patch -Np0 -i ../../patches/lex_remove_wchar.patch
|
||||||
|
|
||||||
|
# Build yacc
|
||||||
|
cd yacc
|
||||||
|
make -f Makefile.mk CC=tcc AR=tcc\ -ar CFLAGS=-DMAXPATHLEN=100\ -DEILSEQ=84\ -DMB_LEN_MAX=100 LDFLAGS=-lgetopt RANLIB=true
|
||||||
|
|
||||||
|
# Install yacc
|
||||||
|
install yacc ${bindir}
|
||||||
|
install -m 644 yaccpar /
|
||||||
|
|
||||||
|
# Build lex
|
||||||
|
cd ../lex
|
||||||
|
make -f Makefile.mk CC=tcc AR=tcc\ -ar CFLAGS=-DEILSEQ=84\ -DMB_LEN_MAX=100 LDFLAGS=-lgetopt RANLIB=true
|
||||||
|
|
||||||
|
# Install lex
|
||||||
|
mkdir ${lexdir}
|
||||||
|
install lex ${bindir}
|
||||||
|
install libl.a ${libdir}
|
||||||
|
install -m 644 ncform ${lexdir}
|
||||||
|
|
||||||
|
cd ../../..
|
|
@ -0,0 +1,446 @@
|
||||||
|
From 508eb06d40498acf954fc51ecb9171d2ce2236f6 Mon Sep 17 00:00:00 2001
|
||||||
|
From: =?UTF-8?q?Andrius=20=C5=A0tikonas?= <andrius@stikonas.eu>
|
||||||
|
Date: Wed, 27 Jan 2021 00:40:19 +0000
|
||||||
|
Subject: [PATCH] Workaround for lex to work with mes libc.
|
||||||
|
|
||||||
|
---
|
||||||
|
lex/Makefile.mk | 2 +-
|
||||||
|
lex/allprint.c | 6 ++--
|
||||||
|
lex/ldefs.c | 8 -----
|
||||||
|
lex/main.c | 1 +
|
||||||
|
lex/parser.y | 77 +++++++++++++++++++++++++++++++++++--------------
|
||||||
|
lex/reject.c | 1 -
|
||||||
|
lex/sub1.c | 44 ++++++++++++++++++----------
|
||||||
|
lex/sub3.c | 2 +-
|
||||||
|
8 files changed, 89 insertions(+), 52 deletions(-)
|
||||||
|
|
||||||
|
diff --git lex/Makefile.mk lex/Makefile.mk
|
||||||
|
index 577f7cb..a413867 100644
|
||||||
|
--- lex/Makefile.mk
|
||||||
|
+++ lex/Makefile.mk
|
||||||
|
@@ -1,4 +1,4 @@
|
||||||
|
-XOBJ = main.o sub1.o sub2.o sub3.o header.o wcio.o parser.o getopt.o lsearch.o
|
||||||
|
+XOBJ = main.o sub1.o sub2.o sub3.o header.o parser.o getopt.o lsearch.o
|
||||||
|
|
||||||
|
LOBJ = allprint.o libmain.o reject.o yyless.o yywrap.o \
|
||||||
|
allprint_w.o reject_w.o yyless_w.o reject_e.o yyless_e.o
|
||||||
|
diff --git lex/allprint.c lex/allprint.c
|
||||||
|
index 6e82495..cb0c6bb 100644
|
||||||
|
--- lex/allprint.c
|
||||||
|
+++ lex/allprint.c
|
||||||
|
@@ -42,8 +42,6 @@
|
||||||
|
#include <sys/euc.h>
|
||||||
|
#include <widec.h>
|
||||||
|
#endif
|
||||||
|
-#include <wctype.h>
|
||||||
|
-#include <wchar.h>
|
||||||
|
|
||||||
|
extern FILE *yyout;
|
||||||
|
|
||||||
|
@@ -78,10 +76,10 @@ allprint(CHR c)
|
||||||
|
fprintf(yyout, "\\_");
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
- if (!iswprint(c))
|
||||||
|
+ if (!iwprint(c))
|
||||||
|
fprintf(yyout, "\\x%-2x", (int)c);
|
||||||
|
else
|
||||||
|
- putwc(c, yyout);
|
||||||
|
+ putc(c, yyout);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
diff --git lex/ldefs.c lex/ldefs.c
|
||||||
|
index ff99665..c5dcbaf 100644
|
||||||
|
--- lex/ldefs.c
|
||||||
|
+++ lex/ldefs.c
|
||||||
|
@@ -43,7 +43,6 @@
|
||||||
|
#ifdef __sun
|
||||||
|
#include <widec.h>
|
||||||
|
#endif
|
||||||
|
-#include <wctype.h>
|
||||||
|
|
||||||
|
#define CHR wchar_t
|
||||||
|
#define BYTE char
|
||||||
|
@@ -296,13 +295,6 @@ int mn1(int a, intptr_t d);
|
||||||
|
int mn0(int a);
|
||||||
|
int dupl(int n);
|
||||||
|
|
||||||
|
-#undef getwc
|
||||||
|
-#define getwc(f) lex_getwc(f)
|
||||||
|
-extern wint_t lex_getwc(FILE *);
|
||||||
|
-#undef putwc
|
||||||
|
-#define putwc(c, f) lex_putwc(c, f)
|
||||||
|
-extern wint_t lex_putwc(wchar_t, FILE *);
|
||||||
|
-
|
||||||
|
#undef index
|
||||||
|
#define index lex_index
|
||||||
|
|
||||||
|
diff --git lex/main.c lex/main.c
|
||||||
|
index 8aee8ea..52c892a 100644
|
||||||
|
--- lex/main.c
|
||||||
|
+++ lex/main.c
|
||||||
|
@@ -38,6 +38,7 @@
|
||||||
|
* Sccsid @(#)main.c 1.9 (gritter) 11/26/05
|
||||||
|
*/
|
||||||
|
|
||||||
|
+#include <getopt.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include "once.h"
|
||||||
|
#include "sgs.h"
|
||||||
|
diff --git lex/parser.y lex/parser.y
|
||||||
|
index b8618e3..34a7e9a 100644
|
||||||
|
--- lex/parser.y
|
||||||
|
+++ lex/parser.y
|
||||||
|
@@ -43,7 +43,6 @@
|
||||||
|
void yyerror(char *);
|
||||||
|
|
||||||
|
#include <ctype.h>
|
||||||
|
-#include <wchar.h>
|
||||||
|
#include <inttypes.h>
|
||||||
|
#ifndef __sun
|
||||||
|
#define wcsetno(c) 0
|
||||||
|
@@ -289,6 +288,19 @@ r: CHAR
|
||||||
|
;
|
||||||
|
|
||||||
|
%%
|
||||||
|
+
|
||||||
|
+/*
|
||||||
|
+Copy multibyte string into char string.
|
||||||
|
+Mes C library does not support wide strings, and fprintf truncates all strings to 1 character.
|
||||||
|
+This happens because wchar_t strings have 0 in a second byte.
|
||||||
|
+*/
|
||||||
|
+int
|
||||||
|
+wstrcpy(char const *destination, wchar_t const *source) {
|
||||||
|
+ int i;
|
||||||
|
+ for (i = 0; source[i] != 0; i++)
|
||||||
|
+ destination[i]=source[i];
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
int
|
||||||
|
yylex(void)
|
||||||
|
{
|
||||||
|
@@ -353,7 +365,7 @@ yylex(void)
|
||||||
|
(*(p+2) == 'O')) {
|
||||||
|
if(lgatflg)
|
||||||
|
error("Too late for %%pointer");
|
||||||
|
- while(*p && !iswspace(*p))
|
||||||
|
+ while(*p && !isspace(*p))
|
||||||
|
p++;
|
||||||
|
isArray = 0;
|
||||||
|
continue;
|
||||||
|
@@ -397,7 +409,7 @@ yylex(void)
|
||||||
|
(*(p+2) == 'R')) {
|
||||||
|
if(lgatflg)
|
||||||
|
error("Too late for %%array");
|
||||||
|
- while(*p && !iswspace(*p))
|
||||||
|
+ while(*p && !isspace(*p))
|
||||||
|
p++;
|
||||||
|
isArray = 1;
|
||||||
|
continue;
|
||||||
|
@@ -426,7 +438,7 @@ yylex(void)
|
||||||
|
if(handleeuc)
|
||||||
|
error("\
|
||||||
|
Character table (%t) is supported only in ASCII compatibility mode.\n");
|
||||||
|
- ZCH = wcstol(p+2, NULL, 10);
|
||||||
|
+ ZCH = strtol(p+2, NULL, 10);
|
||||||
|
if (ZCH < NCH) ZCH = NCH;
|
||||||
|
if (ZCH > 2*NCH) error("ch table needs redeclaration");
|
||||||
|
chset = TRUE;
|
||||||
|
@@ -438,13 +450,13 @@ Character table (%t) is supported only in ASCII compatibility mode.\n");
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
while(digit(*p)) p++;
|
||||||
|
- if(!iswspace(*p)) error("bad translation format");
|
||||||
|
- while(iswspace(*p)) p++;
|
||||||
|
+ if(!isspace(*p)) error("bad translation format");
|
||||||
|
+ while(isspace(*p)) p++;
|
||||||
|
t = p;
|
||||||
|
while(*t){
|
||||||
|
c = ctrans(&t);
|
||||||
|
if(ctable[(unsigned)c]){
|
||||||
|
- if (iswprint(c))
|
||||||
|
+ if (isprint(c))
|
||||||
|
warning("Character '%lc' used twice",c);
|
||||||
|
|
||||||
|
else
|
||||||
|
@@ -485,8 +497,12 @@ Character table (%t) is supported only in ASCII compatibility mode.\n");
|
||||||
|
while(getl(p) && scomp(p, L_PctCbr) != 0)
|
||||||
|
if(p[0]=='/' && p[1]=='*')
|
||||||
|
cpycom(p);
|
||||||
|
- else
|
||||||
|
- fprintf(fout,"%ls\n",p);
|
||||||
|
+ else {
|
||||||
|
+ char p2[100];
|
||||||
|
+ wstrcpy(p2, p);
|
||||||
|
+ fprintf(fout,"%ls\n",p2);
|
||||||
|
+ memset(p2, 0, sizeof p2);
|
||||||
|
+ }
|
||||||
|
if(p[0] == '%') continue;
|
||||||
|
if (*p) error("EOF before %%%%");
|
||||||
|
else error("EOF before %%}");
|
||||||
|
@@ -501,12 +517,12 @@ Character table (%t) is supported only in ASCII compatibility mode.\n");
|
||||||
|
start:
|
||||||
|
lgate();
|
||||||
|
|
||||||
|
- while(*p && !iswspace(*p) && ((*p) != (wchar_t)',')) p++;
|
||||||
|
+ while(*p && !isspace(*p) && ((*p) != (wchar_t)',')) p++;
|
||||||
|
n = TRUE;
|
||||||
|
while(n){
|
||||||
|
- while(*p && (iswspace(*p) || ((*p) == (wchar_t)','))) p++;
|
||||||
|
+ while(*p && (isspace(*p) || ((*p) == (wchar_t)','))) p++;
|
||||||
|
t = p;
|
||||||
|
- while(*p && !iswspace(*p) && ((*p) != (wchar_t)',')) {
|
||||||
|
+ while(*p && !isspace(*p) && ((*p) != (wchar_t)',')) {
|
||||||
|
if(!isascii(*p))
|
||||||
|
error("None-ASCII characters in start condition.");
|
||||||
|
p++;
|
||||||
|
@@ -516,7 +532,10 @@ start:
|
||||||
|
if (*t == 0) continue;
|
||||||
|
i = sptr*2;
|
||||||
|
if(!ratfor)fprintf(fout,"# ");
|
||||||
|
- fprintf(fout,"define %ls %d\n",t,i);
|
||||||
|
+ char t2[100];
|
||||||
|
+ wstrcpy(t2, t);
|
||||||
|
+ fprintf(fout,"define %ls %d\n",t2,i);
|
||||||
|
+ memset(t2, 0, sizeof t2);
|
||||||
|
scopy(t,sp);
|
||||||
|
sname[sptr] = sp;
|
||||||
|
/* XCU4: save exclusive flag with start name */
|
||||||
|
@@ -537,14 +556,20 @@ start:
|
||||||
|
case ' ': case '\t': /* must be code */
|
||||||
|
lgate();
|
||||||
|
if( p[1]=='/' && p[2]=='*' ) cpycom(p);
|
||||||
|
- else fprintf(fout, "%ls\n",p);
|
||||||
|
+
|
||||||
|
+ else {
|
||||||
|
+ char p2[100];
|
||||||
|
+ wstrcpy(p2, p);
|
||||||
|
+ fprintf(fout, "%ls\n",p2);
|
||||||
|
+ memset(p2, 0, sizeof p2);
|
||||||
|
+ }
|
||||||
|
continue;
|
||||||
|
case '/': /* look for comments */
|
||||||
|
lgate();
|
||||||
|
if((*(p+1))=='*') cpycom(p);
|
||||||
|
/* FALLTHRU */
|
||||||
|
default: /* definition */
|
||||||
|
- while(*p && !iswspace(*p)) p++;
|
||||||
|
+ while(*p && !isspace(*p)) p++;
|
||||||
|
if(*p == 0)
|
||||||
|
continue;
|
||||||
|
prev = *p;
|
||||||
|
@@ -557,7 +582,7 @@ start:
|
||||||
|
}
|
||||||
|
} else { /* still sect 1, but prev != '\n' */
|
||||||
|
p = bptr;
|
||||||
|
- while(*p && iswspace(*p)) p++;
|
||||||
|
+ while(*p && isspace(*p)) p++;
|
||||||
|
if(*p == 0)
|
||||||
|
warning("No translation given - null string assumed");
|
||||||
|
scopy(p,token);
|
||||||
|
@@ -632,8 +657,11 @@ start:
|
||||||
|
while(!eof&& getl(buf) && scomp(L_PctCbr,buf)!=0)
|
||||||
|
if(buf[0]=='/' && buf[1]=='*')
|
||||||
|
cpycom(buf);
|
||||||
|
- else
|
||||||
|
- fprintf(fout,"%ls\n",buf);
|
||||||
|
+ else {
|
||||||
|
+ char buf2[100];
|
||||||
|
+ wstrcpy(buf2, p);
|
||||||
|
+ fprintf(fout,"%ls\n",buf2);
|
||||||
|
+ }
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if(peek == '%'){
|
||||||
|
@@ -944,9 +972,16 @@ Character range specified between different codesets.");
|
||||||
|
else
|
||||||
|
fprintf(fout,
|
||||||
|
"\n# line %d \"%s\"\n", yyline-1, sargv[optind]);
|
||||||
|
- fprintf(fout,"%ls\n",buf);
|
||||||
|
- while(getl(buf) && !eof)
|
||||||
|
- fprintf(fout,"%ls\n",buf);
|
||||||
|
+ char buf2[100];
|
||||||
|
+ wstrcpy(buf2, buf);
|
||||||
|
+ fprintf(fout,"%ls\n",buf2);
|
||||||
|
+ memset(buf2, 0, sizeof buf2);
|
||||||
|
+ while(getl(buf) && !eof) {
|
||||||
|
+ wstrcpy(buf2, buf);
|
||||||
|
+ fprintf(fout,"%ls\n",buf2);
|
||||||
|
+ memset(buf2, 0, sizeof buf2);
|
||||||
|
+ }
|
||||||
|
+ memset(buf2, 0, sizeof buf2);
|
||||||
|
}
|
||||||
|
|
||||||
|
return(freturn(0));
|
||||||
|
diff --git lex/reject.c lex/reject.c
|
||||||
|
index 31928e7..ef08c57 100644
|
||||||
|
--- lex/reject.c
|
||||||
|
+++ lex/reject.c
|
||||||
|
@@ -38,7 +38,6 @@
|
||||||
|
#include <euc.h>
|
||||||
|
#include <widec.h>
|
||||||
|
#else /* !sun */
|
||||||
|
-#include <wchar.h>
|
||||||
|
#endif /* !sun */
|
||||||
|
#include <limits.h>
|
||||||
|
#endif
|
||||||
|
diff --git lex/sub1.c lex/sub1.c
|
||||||
|
index b867948..eead84b 100644
|
||||||
|
--- lex/sub1.c
|
||||||
|
+++ lex/sub1.c
|
||||||
|
@@ -38,7 +38,6 @@
|
||||||
|
|
||||||
|
#include "ldefs.c"
|
||||||
|
#include <limits.h>
|
||||||
|
-#include <wchar.h>
|
||||||
|
#include <ctype.h>
|
||||||
|
#include <stdarg.h>
|
||||||
|
|
||||||
|
@@ -394,6 +393,19 @@ cclinter(int sw)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
+int
|
||||||
|
+mbtowc(wchar_t *pwc, const char *s, size_t n)
|
||||||
|
+{
|
||||||
|
+ if (s != 0) {
|
||||||
|
+ if (n < 1)
|
||||||
|
+ return -1;
|
||||||
|
+ if (pwc != 0)
|
||||||
|
+ *pwc = *s & 0377;
|
||||||
|
+ return *s != '\0';
|
||||||
|
+ } else
|
||||||
|
+ return 0;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
int
|
||||||
|
usescape(int c)
|
||||||
|
{
|
||||||
|
@@ -546,7 +558,7 @@ cpyact(void)
|
||||||
|
break;
|
||||||
|
case ';':
|
||||||
|
if (brac == 0) {
|
||||||
|
- putwc(c, fout);
|
||||||
|
+ putc(c, fout);
|
||||||
|
putc('\n', fout);
|
||||||
|
return (1);
|
||||||
|
}
|
||||||
|
@@ -558,26 +570,26 @@ cpyact(void)
|
||||||
|
case '}':
|
||||||
|
brac--;
|
||||||
|
if (brac == 0) {
|
||||||
|
- putwc(c, fout);
|
||||||
|
+ putc(c, fout);
|
||||||
|
putc('\n', fout);
|
||||||
|
return (1);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case '/':
|
||||||
|
- putwc(c, fout);
|
||||||
|
+ putc(c, fout);
|
||||||
|
c = gch();
|
||||||
|
if (c != '*')
|
||||||
|
goto swt;
|
||||||
|
- putwc(c, fout);
|
||||||
|
+ putc(c, fout);
|
||||||
|
savline = yyline;
|
||||||
|
while (c = gch()) {
|
||||||
|
while (c == '*') {
|
||||||
|
- putwc(c, fout);
|
||||||
|
+ putc(c, fout);
|
||||||
|
if ((c = gch()) == '/') {
|
||||||
|
putc('/', fout);
|
||||||
|
while ((c = gch()) == ' ' ||
|
||||||
|
c == '\t' || c == '\n')
|
||||||
|
- putwc(c, fout);
|
||||||
|
+ putc(c, fout);
|
||||||
|
goto swt;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@@ -590,16 +602,16 @@ cpyact(void)
|
||||||
|
case '\'': /* character constant */
|
||||||
|
case '"': /* character string */
|
||||||
|
mth = c;
|
||||||
|
- putwc(c, fout);
|
||||||
|
+ putc(c, fout);
|
||||||
|
while (c = gch()) {
|
||||||
|
if (c == '\\') {
|
||||||
|
- putwc(c, fout);
|
||||||
|
+ putc(c, fout);
|
||||||
|
c = gch();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
if (c == mth)
|
||||||
|
goto loop;
|
||||||
|
- putwc(c, fout);
|
||||||
|
+ putc(c, fout);
|
||||||
|
if (c == '\n') {
|
||||||
|
yyline--;
|
||||||
|
error(
|
||||||
|
@@ -620,7 +632,7 @@ cpyact(void)
|
||||||
|
loop:
|
||||||
|
if (c != ' ' && c != '\t' && c != '\n')
|
||||||
|
sw = FALSE;
|
||||||
|
- putwc(c, fout);
|
||||||
|
+ putc(c, fout);
|
||||||
|
if (peek == '\n' && !brac && copy_line) {
|
||||||
|
putc('\n', fout);
|
||||||
|
return (1);
|
||||||
|
@@ -636,7 +648,7 @@ gch(void)
|
||||||
|
int c;
|
||||||
|
prev = pres;
|
||||||
|
c = pres = peek;
|
||||||
|
- peek = pushptr > pushc ? *--pushptr : getwc(fin);
|
||||||
|
+ peek = pushptr > pushc ? *--pushptr : getc(fin);
|
||||||
|
while (peek == EOF) {
|
||||||
|
if (no_input) {
|
||||||
|
if (!yyline)
|
||||||
|
@@ -650,7 +662,7 @@ gch(void)
|
||||||
|
if (fin == NULL)
|
||||||
|
error("Cannot open file -- %s",
|
||||||
|
sargv[optind]);
|
||||||
|
- peek = getwc(fin);
|
||||||
|
+ peek = getc(fin);
|
||||||
|
} else
|
||||||
|
break;
|
||||||
|
} else {
|
||||||
|
@@ -856,11 +868,11 @@ allprint(CHR c)
|
||||||
|
printf("\\_");
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
- if (!iswprint(c)) {
|
||||||
|
+ if (!isprint(c)) {
|
||||||
|
printf("\\x%-2x", c); /* up to fashion. */
|
||||||
|
charc += 3;
|
||||||
|
} else
|
||||||
|
- putwc(c, stdout);
|
||||||
|
+ putc(c, stdout);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
charc++;
|
||||||
|
@@ -903,7 +915,7 @@ sect1dump(void)
|
||||||
|
allprint(i);
|
||||||
|
putchar(' ');
|
||||||
|
iswprint(ctable[i]) ?
|
||||||
|
- putwc(ctable[i], stdout) :
|
||||||
|
+ putc(ctable[i], stdout) :
|
||||||
|
printf("%d", ctable[i]);
|
||||||
|
putchar('\n');
|
||||||
|
}
|
||||||
|
diff --git lex/sub3.c lex/sub3.c
|
||||||
|
index 186bcbc..aa07f66 100644
|
||||||
|
--- lex/sub3.c
|
||||||
|
+++ lex/sub3.c
|
||||||
|
@@ -147,7 +147,7 @@ remch(wchar_t c)
|
||||||
|
*/
|
||||||
|
if (!handleeuc) {
|
||||||
|
if (!isascii(c))
|
||||||
|
- if (iswprint(c))
|
||||||
|
+ if (isprint(c))
|
||||||
|
warning(
|
||||||
|
"Non-ASCII character '%lc' in pattern; use -w or -e lex option.", c);
|
||||||
|
else warning(
|
||||||
|
--
|
||||||
|
2.26.2
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue