bump version
[buildroot.git] / package / util-linux / util-linux-remove-deprecated-functions.patch
blobede6ed356930489bcdac0886f71bf82d414383f5
1 diff -ur util-linux-2.12r/fdisk/cfdisk.c util-linux-2.12r-patched/fdisk/cfdisk.c
2 --- util-linux-2.12r/fdisk/cfdisk.c 2005-09-09 16:44:57.000000000 -0500
3 +++ util-linux-2.12r-patched/fdisk/cfdisk.c 2006-12-04 23:21:09.646235820 -0600
4 @@ -353,7 +353,7 @@
5 /* Some libc's have their own basename() */
6 static char *
7 my_basename(char *devname) {
8 - char *s = rindex(devname, '/');
9 + char *s = strrchr(devname, '/');
10 return s ? s+1 : devname;
13 diff -ur util-linux-2.12r/fdisk/fdiskbsdlabel.c util-linux-2.12r-patched/fdisk/fdiskbsdlabel.c
14 --- util-linux-2.12r/fdisk/fdiskbsdlabel.c 2003-07-13 16:12:47.000000000 -0500
15 +++ util-linux-2.12r-patched/fdisk/fdiskbsdlabel.c 2006-12-04 23:21:09.646235820 -0600
16 @@ -538,10 +538,10 @@
18 /* We need a backup of the disklabel (xbsd_dlabel might have changed). */
19 d = &disklabelbuffer[BSD_LABELSECTOR * SECTOR_SIZE];
20 - bcopy (d, &dl, sizeof (struct xbsd_disklabel));
21 + memcpy (&dl, d, sizeof (struct xbsd_disklabel));
23 /* The disklabel will be overwritten by 0's from bootxx anyway */
24 - bzero (d, sizeof (struct xbsd_disklabel));
25 + memset (d, 0, sizeof (struct xbsd_disklabel));
27 snprintf (path, sizeof(path), "%s/boot%s", bootdir, dkbasename);
28 if (!xbsd_get_bootstrap (path, &disklabelbuffer[xbsd_dlabel.d_secsize],
29 @@ -555,7 +555,7 @@
30 exit ( EXIT_FAILURE );
33 - bcopy (&dl, d, sizeof (struct xbsd_disklabel));
34 + memcpy (d, &dl, sizeof (struct xbsd_disklabel));
36 #if defined (__powerpc__) || defined (__hppa__)
37 sector = 0;
38 @@ -657,7 +657,7 @@
39 struct geom g;
41 get_geometry (fd, &g);
42 - bzero (d, sizeof (struct xbsd_disklabel));
43 + memset (d, 0, sizeof (struct xbsd_disklabel));
45 d -> d_magic = BSD_DISKMAGIC;
47 @@ -740,8 +740,8 @@
48 if (BSD_BBSIZE != read (fd, disklabelbuffer, BSD_BBSIZE))
49 fatal (unable_to_read);
51 - bcopy (&disklabelbuffer[BSD_LABELSECTOR * SECTOR_SIZE + BSD_LABELOFFSET],
52 - d, sizeof (struct xbsd_disklabel));
53 + memcpy (d, &disklabelbuffer[BSD_LABELSECTOR * SECTOR_SIZE + BSD_LABELOFFSET],
54 + sizeof (struct xbsd_disklabel));
56 if (d -> d_magic != BSD_DISKMAGIC || d -> d_magic2 != BSD_DISKMAGIC)
57 return 0;
58 @@ -776,7 +776,7 @@
59 /* This is necessary if we want to write the bootstrap later,
60 otherwise we'd write the old disklabel with the bootstrap.
62 - bcopy (d, &disklabelbuffer[BSD_LABELSECTOR * SECTOR_SIZE + BSD_LABELOFFSET],
63 + memcpy (&disklabelbuffer[BSD_LABELSECTOR * SECTOR_SIZE + BSD_LABELOFFSET], d,
64 sizeof (struct xbsd_disklabel));
66 #if defined (__alpha__) && BSD_LABELSECTOR == 0
67 diff -ur util-linux-2.12r/fdisk/sfdisk.c util-linux-2.12r-patched/fdisk/sfdisk.c
68 --- util-linux-2.12r/fdisk/sfdisk.c 2005-01-04 16:31:57.000000000 -0600
69 +++ util-linux-2.12r-patched/fdisk/sfdisk.c 2006-12-04 23:21:09.650236137 -0600
70 @@ -1730,12 +1730,12 @@
71 eof = 1;
72 return RD_EOF;
74 - if (!(lp = index(lp, '\n')))
75 + if (!(lp = strchr(lp, '\n')))
76 fatal(_("long or incomplete input line - quitting\n"));
77 *lp = 0;
79 /* remove comments, if any */
80 - if ((lp = index(line+2, '#')) != 0)
81 + if ((lp = strchr(line+2, '#')) != 0)
82 *lp = 0;
84 /* recognize a few commands - to be expanded */
85 @@ -1745,7 +1745,7 @@
88 /* dump style? - then bad input is fatal */
89 - if ((ip = index(line+2, ':')) != 0) {
90 + if ((ip = strchr(line+2, ':')) != 0) {
91 struct dumpfld *d;
93 nxtfld:
94 @@ -2514,7 +2514,7 @@
96 if (argc < 1)
97 fatal(_("no command?\n"));
98 - if ((progn = rindex(argv[0], '/')) == NULL)
99 + if ((progn = strrchr(argv[0], '/')) == NULL)
100 progn = argv[0];
101 else
102 progn++;
103 diff -ur util-linux-2.12r/login-utils/login.c util-linux-2.12r-patched/login-utils/login.c
104 --- util-linux-2.12r/login-utils/login.c 2004-12-04 20:37:12.000000000 -0600
105 +++ util-linux-2.12r-patched/login-utils/login.c 2006-12-04 23:21:09.650236137 -0600
106 @@ -97,8 +97,6 @@
107 #include <sys/file.h>
108 #include <termios.h>
109 #include <string.h>
110 -#define index strchr
111 -#define rindex strrchr
112 #include <sys/ioctl.h>
113 #include <sys/wait.h>
114 #include <signal.h>
115 @@ -1192,7 +1190,7 @@
116 childArgv[childArgc++] = buff;
117 } else {
118 tbuf[0] = '-';
119 - xstrncpy(tbuf + 1, ((p = rindex(pwd->pw_shell, '/')) ?
120 + xstrncpy(tbuf + 1, ((p = strrchr(pwd->pw_shell, '/')) ?
121 p + 1 : pwd->pw_shell),
122 sizeof(tbuf)-1);
124 diff -ur util-linux-2.12r/login-utils/passwd.c util-linux-2.12r-patched/login-utils/passwd.c
125 --- util-linux-2.12r/login-utils/passwd.c 2002-03-08 17:00:11.000000000 -0600
126 +++ util-linux-2.12r-patched/login-utils/passwd.c 2006-12-04 23:21:09.650236137 -0600
127 @@ -194,7 +194,7 @@
128 if ( c-gecos && (g = (char *)malloc (c-gecos+1)) ) {
129 strncpy (g, gecos, c-gecos);
130 g[c-gecos] = 0;
131 - while ( (c=rindex(g, ' ')) ) {
132 + while ( (c=strrchr(g, ' ')) ) {
133 if ( !check_passwd_string(passwd, c+1) ) {
134 printf(_("Please don't use something like your realname as password!\n"));
135 free (g);
136 diff -ur util-linux-2.12r/login-utils/vipw.c util-linux-2.12r-patched/login-utils/vipw.c
137 --- util-linux-2.12r/login-utils/vipw.c 2004-03-04 15:54:44.000000000 -0600
138 +++ util-linux-2.12r-patched/login-utils/vipw.c 2006-12-04 23:21:09.650236137 -0600
139 @@ -314,7 +314,7 @@
140 textdomain(PACKAGE);
142 bzero(tmp_file, FILENAMELEN);
143 - progname = (rindex(argv[0], '/')) ? rindex(argv[0], '/') + 1 : argv[0];
144 + progname = (strrchr(argv[0], '/')) ? strrchr(argv[0], '/') + 1 : argv[0];
145 if (!strcmp(progname, "vigr")) {
146 program = VIGR;
147 xstrncpy(orig_file, GROUP_FILE, sizeof(orig_file));
148 diff -ur util-linux-2.12r/login-utils/wall.c util-linux-2.12r-patched/login-utils/wall.c
149 --- util-linux-2.12r/login-utils/wall.c 2002-03-08 17:00:19.000000000 -0600
150 +++ util-linux-2.12r-patched/login-utils/wall.c 2006-12-04 23:21:09.650236137 -0600
151 @@ -87,7 +87,7 @@
152 textdomain(PACKAGE);
154 progname = argv[0];
155 - p = rindex(progname, '/');
156 + p = strrchr(progname, '/');
157 if (p)
158 progname = p+1;
160 diff -ur util-linux-2.12r/misc-utils/logger.c util-linux-2.12r-patched/misc-utils/logger.c
161 --- util-linux-2.12r/misc-utils/logger.c 2004-09-06 16:13:49.000000000 -0500
162 +++ util-linux-2.12r-patched/misc-utils/logger.c 2006-12-04 23:21:09.650236137 -0600
163 @@ -198,7 +198,7 @@
164 } else {
165 if (p != buf)
166 *p++ = ' ';
167 - bcopy(*argv++, p, len);
168 + memcpy(p, *argv++, len);
169 *(p += len) = '\0';
172 diff -ur util-linux-2.12r/misc-utils/whereis.c util-linux-2.12r-patched/misc-utils/whereis.c
173 --- util-linux-2.12r/misc-utils/whereis.c 2001-03-15 04:09:58.000000000 -0600
174 +++ util-linux-2.12r-patched/misc-utils/whereis.c 2006-12-04 23:21:09.650236137 -0600
175 @@ -323,14 +323,14 @@
176 char dirbuf[1024];
177 struct stat statbuf;
179 - dd = index(dir, '*');
180 + dd = strchr(dir, '*');
181 if (!dd)
182 goto noglob;
184 l = strlen(dir);
185 if (l < sizeof(dirbuf)) { /* refuse excessively long names */
186 strcpy (dirbuf, dir);
187 - d = index(dirbuf, '*');
188 + d = strchr(dirbuf, '*');
189 *d = 0;
190 dirp = opendir(dirbuf);
191 if (dirp == NULL)
192 diff -ur util-linux-2.12r/mount/mntent.c util-linux-2.12r-patched/mount/mntent.c
193 --- util-linux-2.12r/mount/mntent.c 2004-10-13 15:57:34.000000000 -0500
194 +++ util-linux-2.12r-patched/mount/mntent.c 2006-12-04 23:21:09.650236137 -0600
195 @@ -158,7 +158,7 @@
196 return NULL;
198 mfp->mntent_lineno++;
199 - s = index (buf, '\n');
200 + s = strchr (buf, '\n');
201 if (s == NULL) {
202 /* Missing final newline? Otherwise extremely */
203 /* long line - assume file was corrupted */
204 @@ -166,7 +166,7 @@
205 fprintf(stderr, _("[mntent]: warning: no final "
206 "newline at the end of %s\n"),
207 mfp->mntent_file);
208 - s = index (buf, 0);
209 + s = strchr (buf, 0);
210 } else {
211 mfp->mntent_errs = 1;
212 goto err;
213 diff -ur util-linux-2.12r/mount/mount.c util-linux-2.12r-patched/mount/mount.c
214 --- util-linux-2.12r/mount/mount.c 2004-12-21 16:00:36.000000000 -0600
215 +++ util-linux-2.12r-patched/mount/mount.c 2006-12-04 23:21:09.654236454 -0600
216 @@ -488,11 +488,11 @@
218 /* Accept a comma-separated list of types, and try them one by one */
219 /* A list like "nonfs,.." indicates types not to use */
220 - if (*types && strncmp(*types, "no", 2) && index(*types,',')) {
221 + if (*types && strncmp(*types, "no", 2) && strchr(*types,',')) {
222 char *t = strdup(*types);
223 char *p;
225 - while((p = index(t,',')) != NULL) {
226 + while((p = strchr(t,',')) != NULL) {
227 *p = 0;
228 args.type = *types = t;
229 if(do_mount_syscall (&args) == 0)
230 diff -ur util-linux-2.12r/mount/mount_by_label.c util-linux-2.12r-patched/mount/mount_by_label.c
231 --- util-linux-2.12r/mount/mount_by_label.c 2004-12-21 17:15:33.000000000 -0600
232 +++ util-linux-2.12r-patched/mount/mount_by_label.c 2006-12-04 23:21:09.654236454 -0600
233 @@ -213,7 +213,7 @@
234 fseek(procpt, 0, SEEK_SET);
236 while (fgets(line, sizeof(line), procpt)) {
237 - if (!index(line, '\n'))
238 + if (!strchr(line, '\n'))
239 break;
241 if (sscanf (line, " %d %d %d %[^\n ]",
242 diff -ur util-linux-2.12r/mount/sundries.c util-linux-2.12r-patched/mount/sundries.c
243 --- util-linux-2.12r/mount/sundries.c 2004-12-21 13:12:31.000000000 -0600
244 +++ util-linux-2.12r-patched/mount/sundries.c 2006-12-04 23:21:09.654236454 -0600
245 @@ -138,7 +138,7 @@
246 if (strncmp(p, type, len) == 0 &&
247 (p[len] == 0 || p[len] == ','))
248 return !no;
249 - p = index(p,',');
250 + p = strchr(p,',');
251 if (!p)
252 break;
253 p++;
254 diff -ur util-linux-2.12r/mount/umount.c util-linux-2.12r-patched/mount/umount.c
255 --- util-linux-2.12r/mount/umount.c 2005-09-10 13:07:38.000000000 -0500
256 +++ util-linux-2.12r-patched/mount/umount.c 2006-12-04 23:21:09.654236454 -0600
257 @@ -338,7 +338,7 @@
258 if (res < 0)
259 umnt_err2 = errno;
260 /* Do not complain about remote NFS mount points */
261 - if (errno == ENOENT && index(spec, ':'))
262 + if (errno == ENOENT && strchr(spec, ':'))
263 umnt_err2 = 0;
266 diff -ur util-linux-2.12r/text-utils/colcrt.c util-linux-2.12r-patched/text-utils/colcrt.c
267 --- util-linux-2.12r/text-utils/colcrt.c 2001-03-15 04:09:59.000000000 -0600
268 +++ util-linux-2.12r-patched/text-utils/colcrt.c 2006-12-04 23:23:45.614600041 -0600
269 @@ -252,8 +252,8 @@
271 putwchar('\n');
273 - bcopy(page[ol], page, (267 - ol) * 132 * sizeof(wchar_t));
274 - bzero(page[267- ol], ol * 132 * sizeof(wchar_t));
275 + memcpy(page, page[ol], (267 - ol) * 132 * sizeof(wchar_t));
276 + memset(page[267- ol], 0, ol * 132 * sizeof(wchar_t));
277 outline -= ol;
278 outcol = 0;
279 first = 1;
280 diff -ur util-linux-2.12r/text-utils/display.c util-linux-2.12r-patched/text-utils/display.c
281 --- util-linux-2.12r/text-utils/display.c 2002-03-08 17:05:39.000000000 -0600
282 +++ util-linux-2.12r-patched/text-utils/display.c 2006-12-04 23:24:32.478315487 -0600
283 @@ -163,7 +163,7 @@
284 pr->cchar[0] = 's';
285 pr->cchar[1] = 0;
286 for (p1 = pr->fmt; *p1 != '%'; ++p1);
287 - for (p2 = ++p1; *p1 && index(spec, *p1); ++p1);
288 + for (p2 = ++p1; *p1 && strchr(spec, *p1); ++p1);
289 while ((*p2++ = *p1++) != 0) ;
292 diff -ur util-linux-2.12r/text-utils/parse.c util-linux-2.12r-patched/text-utils/parse.c
293 --- util-linux-2.12r/text-utils/parse.c 2002-03-08 17:07:00.000000000 -0600
294 +++ util-linux-2.12r-patched/text-utils/parse.c 2006-12-04 23:24:19.913319294 -0600
295 @@ -64,7 +64,7 @@
296 exit(1);
298 while (fgets(buf, sizeof(buf), fp)) {
299 - if ((p = index(buf, '\n')) == NULL) {
300 + if ((p = strchr(buf, '\n')) == NULL) {
301 (void)fprintf(stderr, _("hexdump: line too long.\n"));
302 while ((ch = getchar()) != '\n' && ch != EOF);
303 continue;
304 @@ -171,7 +171,7 @@
305 * skip any special chars -- save precision in
306 * case it's a %s format.
308 - while (index(spec + 1, *++fmt));
309 + while (strchr(spec + 1, *++fmt));
310 if (*fmt == '.' && isdigit((unsigned char)*++fmt)) {
311 prec = atoi(fmt);
312 while (isdigit((unsigned char)*++fmt));
313 @@ -244,10 +244,10 @@
314 if (fu->bcnt) {
315 sokay = USEBCNT;
316 /* skip to conversion character */
317 - for (++p1; index(spec, *p1); ++p1);
318 + for (++p1; strchr(spec, *p1); ++p1);
319 } else {
320 /* skip any special chars, field width */
321 - while (index(spec + 1, *++p1));
322 + while (strchr(spec + 1, *++p1));
323 if (*p1 == '.' &&
324 isdigit((unsigned char)*++p1)) {
325 sokay = USEPREC;