[BusyBox] multiple cin patch
Bryan Rittmeyer
bryan at ixiacom.com
Fri Jan 26 04:14:43 UTC 2001
Hi,
The current CVS version of busybox generates a linker warning, since
"FILE *cin" is used in both ls.c and more.c (presumably for the new
termios stuff that was just added):
sh-linux-gnu-gcc -s -Wl,-warn-common -ml -m4 -o busybox cat.o
chmod_chown_chgrp.o clear.o cmdedit.o cp_mv.o dd.o df.o dmesg.o du.o
echo.o find.o free.o grep.o gunzip.o halt.o init.o insmod.o kill.o ln.o
ls.o lsmod.o md5sum.o mkdir.o mknod.o more.o mount.o ping.o ps.o pwd.o
reset.o rm.o rmdir.o rmmod.o sh.o sleep.o syslogd.o tar.o touch.o
umount.o uname.o uptime.o wc.o which.o busybox.o messages.o usage.o
utility.o
more.o: warning: multiple common of `cin'
ls.o: warning: previous common is here
I figured I might as well continue my history of submitting extremely
minor patches:
--- more-orig.c Thu Jan 25 20:10:25 2001
+++ more.c Thu Jan 25 20:10:54 2001
@@ -47,13 +47,13 @@
# define getTermSettings(fd,argp) tcgetattr(fd, argp);
# endif
-FILE *cin;
+FILE *morecin;
static struct termios initial_settings, new_settings;
static void gotsig(int sig)
{
- setTermSettings(fileno(cin), &initial_settings);
+ setTermSettings(fileno(morecin), &initial_settings);
putchar('\n');
exit(EXIT_FAILURE);
}
@@ -87,16 +87,16 @@
fstat(fileno(file), &st);
#ifdef BB_FEATURE_USE_TERMIOS
- cin = fopen("/dev/tty", "r");
- if (!cin)
- cin = fopen("/dev/console", "r");
- getTermSettings(fileno(cin), &initial_settings);
+ morecin = fopen("/dev/tty", "r");
+ if (!morecin)
+ morecin = fopen("/dev/console", "r");
+ getTermSettings(fileno(morecin), &initial_settings);
new_settings = initial_settings;
new_settings.c_cc[VMIN] = 1;
new_settings.c_cc[VTIME] = 0;
new_settings.c_lflag &= ~ICANON;
new_settings.c_lflag &= ~ECHO;
- setTermSettings(fileno(cin), &new_settings);
+ setTermSettings(fileno(morecin), &new_settings);
# ifdef BB_FEATURE_AUTOWIDTH
ioctl(fileno(stdout), TIOCGWINSZ, &win);
@@ -144,7 +144,7 @@
* to get input from the user.
*/
#ifdef BB_FEATURE_USE_TERMIOS
- input = getc(cin);
+ input = getc(morecin);
#else
input = getc(stdin);
#endif
and:
--- ls-orig.c Thu Jan 25 20:10:28 2001
+++ ls.c Thu Jan 25 20:11:27 2001
@@ -198,13 +198,13 @@
# define getTermSettings(fd,argp) tcgetattr(fd, argp);
# endif
-FILE *cin;
+FILE *lscin;
static struct termios initial_settings, new_settings;
static void gotsig(int sig)
{
- setTermSettings(fileno(cin), &initial_settings);
+ setTermSettings(fileno(lscin), &initial_settings);
putchar('\n');
exit(EXIT_FAILURE);
}
@@ -752,16 +752,16 @@
#endif
#ifdef BB_FEATURE_AUTOWIDTH
#ifdef BB_FEATURE_USE_TERMIOS
- cin = fopen("/dev/tty", "r");
- if (!cin)
- cin = fopen("/dev/console", "r");
- getTermSettings(fileno(cin), &initial_settings);
+ lscin = fopen("/dev/tty", "r");
+ if (!lscin)
+ lscin = fopen("/dev/console", "r");
+ getTermSettings(fileno(lscin), &initial_settings);
new_settings = initial_settings;
new_settings.c_cc[VMIN] = 1;
new_settings.c_cc[VTIME] = 0;
new_settings.c_lflag &= ~ICANON;
new_settings.c_lflag &= ~ECHO;
- setTermSettings(fileno(cin), &new_settings);
+ setTermSettings(fileno(lscin), &new_settings);
ioctl(fileno(stdout), TIOCGWINSZ, &win);
if (win.ws_row > 4)
at the very least, this shuts up the linker:
sh-linux-gnu-gcc -s -Wl,-warn-common -ml -m4 -o busybox cat.o
chmod_chown_chgrp.o clear.o cmdedit.o cp_mv.o dd.o df.o dmesg.o du.o
echo.o find.o free.o grep.o gunzip.o halt.o init.o insmod.o kill.o ln.o
ls.o lsmod.o md5sum.o mkdir.o mknod.o more.o mount.o ping.o ps.o pwd.o
reset.o rm.o rmdir.o rmmod.o sh.o sleep.o syslogd.o tar.o touch.o
umount.o uname.o uptime.o wc.o which.o busybox.o messages.o usage.o
utility.o
sh-linux-gnu-strip --remove-section=.note --remove-section=.comment
busybox
Cheers,
Bryan
--
Bryan Rittmeyer
mailto:bryan at ixiacom.com
Ixia Communications
26601 W. Agoura Rd.
Calabasas, CA 91302
More information about the busybox
mailing list