diff options
author | nslu2-linux.adm@bkbits.net <nslu2-linux.adm@bkbits.net> | 2004-12-28 00:40:06 +0000 |
---|---|---|
committer | nslu2-linux.adm@bkbits.net <nslu2-linux.adm@bkbits.net> | 2004-12-28 00:40:06 +0000 |
commit | b923f73c764154d3ac04cc57479fda6a30a33776 (patch) | |
tree | 800901875088bc9f91840aff66b10b850ba120c7 /packages | |
parent | da1aa74cec5175da25babd5e64d86c5bdb145313 (diff) |
Merge bk://oe-devel.bkbits.net/openembedded
into bkbits.net:/repos/n/nslu2-linux/openembedded
2004/12/28 00:56:43+01:00 handhelds.org!zecke
BusyBox getkey:
-More Cish and goto an error handler instead of directly returning a value
2004/12/28 00:40:54+01:00 handhelds.org!zecke
Merge bk://oe-devel@oe-devel.bkbits.net/openembedded
into handhelds.org:/home/ich/programming/oe/openembedded
2004/12/28 00:40:37+01:00 handhelds.org!zecke
BusyBox getkey applet patch:
-Make it more robust and check if STDIN_FILENO is a terminal
-Place braces on a new line (hopefully the right way of making it consistent)
BKrev: 41d0ab66AxH6f5YekH41lUKHGimJBw
Diffstat (limited to 'packages')
-rw-r--r-- | packages/busybox/busybox-1.00/add-getkey-applet.patch | 43 |
1 files changed, 31 insertions, 12 deletions
diff --git a/packages/busybox/busybox-1.00/add-getkey-applet.patch b/packages/busybox/busybox-1.00/add-getkey-applet.patch index 54b58936d5..6ce0df21bd 100644 --- a/packages/busybox/busybox-1.00/add-getkey-applet.patch +++ b/packages/busybox/busybox-1.00/add-getkey-applet.patch @@ -5,7 +5,7 @@ --- /dev/null +++ busybox-1.00/console-tools/getkey.c -@@ -0,0 +1,75 @@ +@@ -0,0 +1,94 @@ +/* vi: set sw=4 ts=4: */ +/* + * getkey.c - Michael 'Mickey' Lauer @@ -30,8 +30,18 @@ +{ + int status = EXIT_FAILURE; + -+ if ( argc < 2 ) { -+ bb_show_usage(); ++ if ( argc < 2 ) ++ { ++ bb_show_usage(); ++ } ++ ++ /* ++ * If no terminal is attached it is quite useless ++ * to treat it like one. ++ */ ++ if( !isatty(STDIN_FILENO) ) ++ { ++ goto error_hard; + } + + //bb_printf( "DEBUG: time = '%s'\n", argv[1] ); @@ -41,8 +51,10 @@ + struct termios attr; + + if ( tcgetattr(STDIN_FILENO, &orig) == -1 ) -+ return EXIT_FAILURE; -+ ++ { ++ goto error_hard; ++ } ++ + attr = orig; + attr.c_cc[VMIN] = 0; + attr.c_cc[VTIME] = 0; @@ -51,7 +63,9 @@ + attr.c_cflag &= ~PARENB; + attr.c_lflag &= ~(ICANON/*|ECHO*/); + if ( tcsetattr(STDIN_FILENO,TCSANOW,&attr) == -1 ) -+ return EXIT_FAILURE; ++ { ++ goto error_hard; ++ } + + fd_set rfds; + struct timeval tv; @@ -65,20 +79,25 @@ + + if ( argc == 3 ) + { -+ bb_printf( argv[2], tv.tv_sec ); -+ bb_printf( "\n" ); -+ fflush(stdout); ++ bb_printf( argv[2], tv.tv_sec ); ++ bb_printf( "\n" ); ++ fflush(stdout); + } + retval = select(1, &rfds, NULL, NULL, &tv); + if (retval > 0) + { -+ status = EXIT_SUCCESS; ++ status = EXIT_SUCCESS; + } + + if (tcsetattr(STDIN_FILENO,TCSANOW,&orig) == -1 ) -+ return EXIT_FAILURE; -+ ++ { ++ goto error_hard; ++ } ++ + return status; ++ ++error_hard : ++ return EXIT_FAILURE; +}; + --- busybox-1.00/console-tools/Makefile.in~add-getkey-applet.patch |