Skip to content
This repository was archived by the owner on Jun 16, 2025. It is now read-only.

Commit 4fa2020

Browse files
committed
Fix parsing of iso8859 characters
Thanks Paulo Andrade <pandrade@redhat.com> for the patch Resolves: rhbz#1417886
1 parent 0b14272 commit 4fa2020

File tree

1 file changed

+1
-45
lines changed

1 file changed

+1
-45
lines changed

src/cmd/ksh93/sh/fcin.c

Lines changed: 1 addition & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -150,56 +150,12 @@ extern void fcrestore(Fcin_t *fp)
150150
_Fcin = *fp;
151151
}
152152

153-
/* for testing purposes with small buffers */
154-
#if defined(IOBSIZE) && (IOBSIZE < 2*MB_LEN_MAX)
155-
# undef MB_LEN_MAX
156-
# define MB_LEN_MAX (IOBSIZE/2)
157-
#endif
158-
159-
struct Extra
160-
{
161-
unsigned char buff[2*MB_LEN_MAX];
162-
unsigned char *next;
163-
};
164-
165153
int _fcmbget(short *len)
166154
{
167-
static struct Extra extra;
168-
register int i, c, n;
169-
if(_Fcin.fcleft)
170-
{
171-
if((c = mbsize(extra.next)) < 0)
172-
c = 1;
173-
if((_Fcin.fcleft -= c) <=0)
174-
{
175-
_Fcin.fcptr = (unsigned char*)fcfirst() - _Fcin.fcleft;
176-
_Fcin.fcleft = 0;
177-
}
178-
*len = c;
179-
if(c==1)
180-
c = *extra.next++;
181-
else if(c==0)
182-
_Fcin.fcleft = 0;
183-
else
184-
c = mbchar(extra.next);
185-
return(c);
186-
}
155+
register int c;
187156
switch(*len = mbsize(_Fcin.fcptr))
188157
{
189158
case -1:
190-
if(_Fcin._fcfile && (n=(_Fcin.fclast-_Fcin.fcptr)) < MB_LEN_MAX)
191-
{
192-
memcpy(extra.buff, _Fcin.fcptr, n);
193-
_Fcin.fcptr = _Fcin.fclast;
194-
for(i=n; i < MB_LEN_MAX+n; i++)
195-
{
196-
if((extra.buff[i] = fcgetc(c))==0)
197-
break;
198-
}
199-
_Fcin.fcleft = n;
200-
extra.next = extra.buff;
201-
return(fcmbget(len));
202-
}
203159
*len = 1;
204160
/* fall through */
205161
case 0:

0 commit comments

Comments
 (0)