Imported Debian patch 2.9.0-5
[debian/cc1111] / debian / patches / 01_fix_getline
1 --- a/as/link/hc08/Makefile.in
2 +++ b/as/link/hc08/Makefile.in
3 @@ -46,7 +46,7 @@
4  
5  ASXXLIBSRC = strcmpi.c
6  
7 -LKLIBSRC = getline.c lkaomf51.c lkar.c lkdata.c lkeval.c \
8 +LKLIBSRC = lk_readnl.c lkaomf51.c lkar.c lkdata.c lkeval.c \
9             lkhead.c lklex.c lklib.c lklibr.c lklist.c \
10             lknoice.c lkrel.c lksdcclib.c lkstore.c lksym.c
11  
12 --- a/as/link/lklib.c
13 +++ b/as/link/lklib.c
14 @@ -31,7 +31,7 @@
15  
16  #include <string.h>
17  
18 -#include "getline.h"
19 +#include "lk_readnl.h"
20  #include "aslink.h"
21  #include "lklibr.h"
22  #include "lkrel.h"
23 @@ -51,7 +51,7 @@
24  {
25    char relfil[NINPUT];
26  
27 -  while (getline (relfil, sizeof (relfil), libfp) != NULL)
28 +  while (lk_readnl (relfil, sizeof (relfil), libfp) != NULL)
29      {
30        FILE *fp;
31        char str[PATH_MAX];
32 @@ -126,7 +126,7 @@
33  
34    D ("Searching symbol: %s\n", name);
35  
36 -  while (getline (relfil, sizeof (relfil), libfp) != NULL)
37 +  while (lk_readnl (relfil, sizeof (relfil), libfp) != NULL)
38      {
39        char str[PATH_MAX];
40        FILE *fp;
41 @@ -206,7 +206,7 @@
42   *
43   *   functions called:
44   *      int     fclose()    c_library
45 - *      char    *getline()  getline.c
46 + *      char    *lk_readnl()  lk_readnl.c
47   *      FILE *  fopen()     c_library
48   *      VOID    link_main() lkmain.c
49   *      int     strlen()    c_library
50 --- a/as/link/lksdcclib.c
51 +++ b/as/link/lksdcclib.c
52 @@ -32,13 +32,13 @@
53  #include <stdlib.h>
54  #include <string.h>
55  
56 -#include "getline.h"
57 +#include "lk_readnl.h"
58  #include "aslink.h"
59  #include "lklibr.h"
60  #include "lkrel.h"
61  
62  #define EQ(A,B) !strcmp((A),(B))
63 -#define MAXLINE 254             /*when using getline */
64 +#define MAXLINE 254             /*when using lk_readnl */
65  
66  
67  static int
68 @@ -72,14 +72,14 @@
69    char str[NINPUT];
70    int state = 0;
71  
72 -  while (getline (str, sizeof (str), libfp) != NULL)
73 +  while (lk_readnl (str, sizeof (str), libfp) != NULL)
74      {
75        switch (state)
76          {
77          case 0:
78            if (EQ (str, "<FILE>"))
79              {
80 -              if (NULL != getline (str, sizeof (str), libfp) && EQ (str, ModName))
81 +              if (NULL != lk_readnl (str, sizeof (str), libfp) && EQ (str, ModName))
82                  state = 1;
83                else
84                  return 0;
85 @@ -105,7 +105,7 @@
86    long IndexOffset = 0;
87    pmlibrarysymbol ThisSym = NULL;
88  
89 -  while (getline (FLine, sizeof (FLine), libfp))
90 +  while (lk_readnl (FLine, sizeof (FLine), libfp))
91      {
92        switch (state)
93          {
94 @@ -113,7 +113,7 @@
95            if (EQ (FLine, "<INDEX>"))
96              {
97                /*The next line has the size of the index */
98 -              getline (FLine, sizeof (FLine), libfp);
99 +              lk_readnl (FLine, sizeof (FLine), libfp);
100                IndexOffset = atol (FLine);
101                state = 1;
102              }
103 @@ -128,7 +128,7 @@
104  
105                /* The next line has the name of the module and the offset
106                   of the corresponding embedded file in the library */
107 -              getline (FLine, sizeof (FLine), libfp);
108 +              lk_readnl (FLine, sizeof (FLine), libfp);
109                sscanf (FLine, "%s %ld", ModName, &FileOffset);
110                state = 2;
111  
112 @@ -205,7 +205,7 @@
113    int state = 0;
114    int ret = 0;
115  
116 -  while (getline (str, sizeof (str), libfp) != NULL)
117 +  while (lk_readnl (str, sizeof (str), libfp) != NULL)
118      {
119        switch (state)
120          {
121 @@ -239,7 +239,7 @@
122    int state = 0;
123    long IndexOffset = 0, FileOffset;
124  
125 -  while (getline (FLine, sizeof (FLine), libfp))
126 +  while (lk_readnl (FLine, sizeof (FLine), libfp))
127      {
128        char filspc[PATH_MAX];
129  
130 @@ -260,7 +260,7 @@
131            if (EQ (FLine, "<INDEX>"))
132              {
133                /* The next line has the size of the index */
134 -              getline (FLine, sizeof (FLine), libfp);
135 +              lk_readnl (FLine, sizeof (FLine), libfp);
136                IndexOffset = atol (FLine);
137                state = 1;
138              }
139 @@ -271,7 +271,7 @@
140              {
141                /* The next line has the name of the module and the offset
142                   of the corresponding embedded file in the library */
143 -              getline (FLine, sizeof (FLine), libfp);
144 +              lk_readnl (FLine, sizeof (FLine), libfp);
145                sscanf (FLine, "%s %ld", ModName, &FileOffset);
146                state = 2;
147              }
148 --- a/sim/ucsim/cmd.src/newcmdposix.cc
149 +++ b/sim/ucsim/cmd.src/newcmdposix.cc
150 @@ -207,7 +207,7 @@
151    char *s= NULL;
152  
153  #ifdef HAVE_GETLINE
154 -  if (getline(&s, 0, in) < 0)
155 +  if (lk_readln(&s, 0, in) < 0)
156      return(0);
157  #elif defined HAVE_GETDELIM
158    size_t n= 30;
159 --- a/as/link/lkrel.c
160 +++ b/as/link/lkrel.c
161 @@ -32,7 +32,7 @@
162  #include <string.h>
163  #include <assert.h>
164  
165 -#include "getline.h"
166 +#include "lk_readnl.h"
167  #include "aslink.h"
168  #include "lkrel.h"
169  
170 @@ -79,7 +79,7 @@
171  
172        end = (size >= 0) ? ftell (libfp) + size : -1;
173  
174 -      while ((end < 0 || ftell (libfp) < end) && getline (str, sizeof (str), libfp) != NULL)
175 +      while ((end < 0 || ftell (libfp) < end) && lk_readnl (str, sizeof (str), libfp) != NULL)
176          {
177            if (0 == strcmp (str, "</REL>"))
178              return 1;
179 @@ -110,7 +110,7 @@
180     * our object file and don't go into the next one.
181     */
182  
183 -  while ((end < 0 || ftell (fp) < end) && getline (buf, sizeof (buf), fp) != NULL)
184 +  while ((end < 0 || ftell (fp) < end) && lk_readnl (buf, sizeof (buf), fp) != NULL)
185      {
186        char symname[NINPUT];
187        char c;
188 --- a/as/link/mcs51/Makefile.in
189 +++ b/as/link/mcs51/Makefile.in
190 @@ -46,7 +46,7 @@
191  
192  ASXXLIBSRC = strcmpi.c
193  
194 -LKLIBSRC = getline.c lkaomf51.c lkar.c lkdata.c lkeval.c \
195 +LKLIBSRC = lk_readnl.c lkaomf51.c lkar.c lkdata.c lkeval.c \
196             lkhead.c lklex.c lklib.c lklibr.c lklist.c \
197             lknoice.c lkrel.c lksdcclib.c lkstore.c lksym.c
198  
199 --- a/as/link/z80/Makefile.in
200 +++ b/as/link/z80/Makefile.in
201 @@ -13,7 +13,7 @@
202  
203  LKLIB = $(srcdir)/..
204  
205 -LKLIBSRC = getline.c lkaomf51.c lkar.c lkdata.c lkeval.c \
206 +LKLIBSRC = lk_readnl.c lkaomf51.c lkar.c lkdata.c lkeval.c \
207             lkhead.c lklex.c lklib.c lklibr.c lklist.c \
208             lknoice.c lkrel.c lksdcclib.c lkstore.c lksym.c
209