- Timestamp:
- Sep 15, 2002, 4:45:38 PM (22 years ago)
- Branches:
- master, barnowl_perlaim, debian, owl, release-1.10, release-1.4, release-1.5, release-1.6, release-1.7, release-1.8, release-1.9
- Children:
- 425c013
- Parents:
- 61e79a9
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
util.c
r61e79a9 r5145235 2 2 #include <stdlib.h> 3 3 #include <string.h> 4 #include <unistd.h> 4 5 #include <malloc.h> 5 6 #include <ctype.h> … … 496 497 char *owl_util_get_default_tty() { 497 498 /* call must free the return */ 498 char *out ;499 char *out, *tmp; 499 500 500 501 if (getenv("DISPLAY")) { 501 502 out=owl_strdup(getenv("DISPLAY")); 502 } else if ( ttyname(fileno(stdout))) {503 out= strdup(ttyname(fileno(stdout)));503 } else if ((tmp=ttyname(fileno(stdout)))!=NULL) { 504 out=owl_strdup(tmp); 504 505 if (!strncmp(out, "/dev/", 5)) { 505 506 owl_free(out); 506 out= strdup(ttyname(fileno(stdout)+5));507 out=owl_strdup(tmp+5); 507 508 } 508 509 } else { 509 out= strdup("unknown");510 out=owl_strdup("unknown"); 510 511 } 511 512 return(out);
Note: See TracChangeset
for help on using the changeset viewer.