diff options
author | Mystery Man <unknown@mandriva.org> | 2002-09-04 21:08:29 +0000 |
---|---|---|
committer | Mystery Man <unknown@mandriva.org> | 2002-09-04 21:08:29 +0000 |
commit | 11f3a2c1890eca25f56dbb751de6e8021aec46fa (patch) | |
tree | 6b7d5fcb8f4f5dd1b60b80a4e123606c6953a2c0 /mdk-stage1/dietlibc/lib/ttyname.c | |
parent | 5b6711eb067f905e3f67f11eb4188033d7f779f9 (diff) | |
download | drakx-11f3a2c1890eca25f56dbb751de6e8021aec46fa.tar drakx-11f3a2c1890eca25f56dbb751de6e8021aec46fa.tar.gz drakx-11f3a2c1890eca25f56dbb751de6e8021aec46fa.tar.bz2 drakx-11f3a2c1890eca25f56dbb751de6e8021aec46fa.tar.xz drakx-11f3a2c1890eca25f56dbb751de6e8021aec46fa.zip |
This commit was manufactured by cvs2svn to create tag 'V1_1_9_35mdk'.V1_1_9_35mdk
Diffstat (limited to 'mdk-stage1/dietlibc/lib/ttyname.c')
-rw-r--r-- | mdk-stage1/dietlibc/lib/ttyname.c | 59 |
1 files changed, 0 insertions, 59 deletions
diff --git a/mdk-stage1/dietlibc/lib/ttyname.c b/mdk-stage1/dietlibc/lib/ttyname.c deleted file mode 100644 index a6b479088..000000000 --- a/mdk-stage1/dietlibc/lib/ttyname.c +++ /dev/null @@ -1,59 +0,0 @@ -#include "dietfeatures.h" -#include <unistd.h> -#include <sys/stat.h> - -#ifdef __linux__ - -extern int __ltostr(char *s, int size, unsigned long i, int base, char UpCase); - -char *ttyname(int fd) { -#ifdef SLASH_PROC_OK - char ibuf[20]; - static char obuf[20]; - strcpy(ibuf,"/proc/self/fd/"); - ibuf[__ltostr(ibuf+14,6,fd,10,0)+14]=0; - if (readlink(ibuf,obuf,sizeof(obuf)-1)<0) return 0; - return obuf; -#else - static char buf[20]="/dev/tty"; - struct stat s; - char *c=buf+8; - int n; - if (fstat(fd,&s)) return 0; - if (S_ISCHR(s.st_mode)) { - n=minor(s.st_rdev); - switch (major(s.st_rdev)) { - case 4: - buf[5]='t'; buf[7]='y'; - if (n>63) { - n-=64; - *c='S'; - ++c; - } -num: - c[__ltostr(c,6,n,10,0)]=0; - break; - case 2: - buf[5]='p'; buf[7]='y'; - buf[8]='p'-(n>>4); - buf[9]=n%4+'0'; - if (buf[9]>'9') *c+='a'-'0'; - buf[10]=0; - case 136: - case 137: - case 138: - case 139: - buf[5]='p'; buf[7]='s'; - n+=(major(s.st_rdev)-136)<<8; - *c='/'; ++c; - goto num; - default: - return 0; - } - return buf; - } - return 0; -#endif -} - -#endif |