home *** CD-ROM | disk | FTP | other *** search
- *** /tmp/,RCSt1024171 Sun Dec 30 01:19:03 1990
- --- mit/clients/xterm/misc.c Sat Dec 29 23:42:03 1990
- ***************
- *** 32,37 ****
- --- 32,38 ----
-
- #include <stdio.h>
- #include <X11/Xos.h>
- + #include <sys/param.h>
- #include <setjmp.h>
- #include <ctype.h>
- #include <pwd.h>
- ***************
- *** 596,601 ****
- --- 597,638 ----
- * One could write code to send back the display and host names,
- * but that could potentially open a fairly nasty security hole.
- */
- + case 51: /* echo DISPLAY variable to file 'buf' */
- + {
- + int fd;
- + if ( !buf || !*buf ) /* no file given */
- + fd = screen->respond;
- + else
- + fd = open( buf, O_WRONLY|O_CREAT, 0666 );
- + if ( fd >= 0 ) {
- + char *p = DisplayString( screen->display );
- + if ( ! p )
- + p = "";
- + write( fd, p, strlen( p ) );
- + write( fd, "\n", 1 );
- + if ( fd != screen->respond )
- + (void) close( fd );
- + }
- + }
- + break;
- + case 52: /* echo hostname to file 'buf' */
- + {
- + int fd;
- + if ( !buf || !*buf ) /* no file given */
- + fd = screen->respond;
- + else
- + fd = open( buf, O_WRONLY|O_CREAT, 0666 );
- + if ( fd >= 0 ) {
- + char hname[MAXHOSTNAMELEN+1];
- + if ( gethostname( hname, sizeof(hname) ) != 0 )
- + strcpy( hname, "unknown" );
- + write( fd, hname, strlen( hname ) );
- + write( fd, "\n", 1 );
- + if ( fd != screen->respond )
- + (void) close( fd );
- + }
- + }
- + break;
- }
- }
-
-