library: Remove tty_to_dev()

This library call was imported into w as it was only used in
this program.  Converting a tty to a device is not really the
work for libprocps.
This commit is contained in:
Craig Small
2015-09-01 20:41:25 +10:00
parent a02911c1ea
commit 6252bf439f
3 changed files with 0 additions and 18 deletions

View File

@@ -36,7 +36,6 @@
/* Who uses what:
*
* tty_to_dev w (there is a fancy version in ps)
* dev_to_tty top, ps
*/
@@ -319,17 +318,3 @@ abbrev:
*ret = '\0';
return i;
}
/* name --> number */
int tty_to_dev(const char *restrict const name) {
struct stat sbuf;
static char buf[32];
if(name[0]=='/' && stat(name, &sbuf) >= 0) return sbuf.st_rdev;
snprintf(buf,32,"/dev/%s",name);
if(stat(buf, &sbuf) >= 0) return sbuf.st_rdev;
snprintf(buf,32,"/dev/tty%s",name);
if(stat(buf, &sbuf) >= 0) return sbuf.st_rdev;
snprintf(buf,32,"/dev/pts/%s",name);
if(stat(buf, &sbuf) >= 0) return sbuf.st_rdev;
return -1;
}