aboutsummaryrefslogtreecommitdiff
path: root/libbb
diff options
context:
space:
mode:
authorDenis Vlasenko <vda.linux@googlemail.com>2008-12-23 23:36:47 +0000
committerDenis Vlasenko <vda.linux@googlemail.com>2008-12-23 23:36:47 +0000
commit4e12b1a2a9e68685dff61acaee1e1f6c377d978c (patch)
tree6d2745f77060d05f843eb186c5227246667d33cb /libbb
parentb3523b9cd3ba71b82e36466b17aae3d65a53203e (diff)
downloadbusybox-w32-4e12b1a2a9e68685dff61acaee1e1f6c377d978c.tar.gz
busybox-w32-4e12b1a2a9e68685dff61acaee1e1f6c377d978c.tar.bz2
busybox-w32-4e12b1a2a9e68685dff61acaee1e1f6c377d978c.zip
libbb: introduce and use xmalloc_ttyname (-32 in bss).
ash: small code shrink text data bss dec hex filename 793669 504 7524 801697 c3ba1 busybox_old 793659 504 7492 801655 c3b77 busybox_unstripped
Diffstat (limited to 'libbb')
-rw-r--r--libbb/xfuncs.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/libbb/xfuncs.c b/libbb/xfuncs.c
index f3c3c538c..a86efc298 100644
--- a/libbb/xfuncs.c
+++ b/libbb/xfuncs.c
@@ -268,6 +268,17 @@ off_t FAST_FUNC fdlength(int fd)
268} 268}
269#endif 269#endif
270 270
271char* FAST_FUNC xmalloc_ttyname(int fd)
272{
273 char *buf = xzalloc(128);
274 int r = ttyname_r(fd, buf, 127);
275 if (r) {
276 free(buf);
277 buf = NULL;
278 }
279 return buf;
280}
281
271/* It is perfectly ok to pass in a NULL for either width or for 282/* It is perfectly ok to pass in a NULL for either width or for
272 * height, in which case that value will not be set. */ 283 * height, in which case that value will not be set. */
273int FAST_FUNC get_terminal_width_height(int fd, unsigned *width, unsigned *height) 284int FAST_FUNC get_terminal_width_height(int fd, unsigned *width, unsigned *height)