- int i ;
- int fd_flag ; /* fcntl flags */
-register union {
- struct hfintro *cmd ; /* p.cmd - intro des. */
- struct hfqphdevc *ph ; /* p.ph - physical dev.*/
- char *c ; /* p.c - char ptr */
- } p ; /* general pointer */
- int pty_new ; /* pty modes */
- int pty_old ;
- int retcode ;
- struct termios term_new ; /* terminal attributes */
- struct termios term_old ;
- struct devinfo devInfo ; /* defined in sys/devinfo.h */
-
-
-if ( ioctl( fd, IOCINFO, &devInfo ) == -1 ) return(-1) ;
-
-if ( devInfo.devtype != DD_PSEU ) /* is it a pty? */
- return (ioctl(fd, request, arg) ) ; /* no, do IOCTL */
-
- /******* START PTY **************/
- /** Pty found, possible HFT */
- /** set new file des as raw */
- /** as you can. */
- /********************************/
-
- /* Get current state of file */
- /* descriptor & save */
-if ( ( fd_flag = fcntl( fd, F_GETFL, 0 ) ) == -1 ) return (-1) ;
-if ( ioctl( fd, TCGETS, &term_old ) == -1 ) return (-1) ;
- /* set terminal attr to raw */
- /* and to delay on read */
-pty_new = pty_old | REMOTE ;
-memcpy( &term_new, &term_old, sizeof( term_new ) ) ;
-term_new.c_iflag = 0 ;
-term_new.c_oflag = 0 ;
-term_new.c_lflag = 0 ;
-/* term_new.c_line = 0 ; */
-for ( i = 1 ; i <= 5 ; i++ )
-term_new.c_cc[i] = 0 ;
-term_new.c_cc[0] = -1 ;
-ioctl( fd, TCSETS, &term_new ) ;
-if ( fcntl( fd, F_SETFL, fd_flag & ~O_NDELAY ) == -1 )
- return(-1) ;
- /* call spacific function */
-if ( request == HFSKBD )
- retcode = hfskbd( fd, request, arg.c) ;
-else /* assume HFQUERY */
- retcode = hfqry( fd, request, arg.c) ;
-
-fcntl( fd, F_SETFL, fd_flag ) ; /* reset terminal to original */
-ioctl( fd, TCSETS, &term_old ) ;
-
-
-return( retcode ) ; /* return error */
+ int i;
+ int fd_flag; /* fcntl flags */
+ register union {
+ struct hfintro *cmd; /* p.cmd - intro des. */
+ struct hfqphdevc *ph; /* p.ph - physical dev.*/
+ char *c; /* p.c - char ptr */
+ } p; /* general pointer */
+ int pty_new; /* pty modes */
+ int pty_old;
+ int retcode;
+ struct termios term_new; /* terminal attributes */
+ struct termios term_old;
+ struct devinfo devInfo; /* defined in sys/devinfo.h */
+
+
+ if (ioctl (fd, IOCINFO, &devInfo) == -1) return(-1);
+
+ if (devInfo.devtype != DD_PSEU) /* is it a pty? */
+ return (ioctl(fd, request, arg)); /* no, do IOCTL */
+
+ /******* START PTY **************/
+ /** Pty found, possible HFT */
+ /** set new file des as raw */
+ /** as you can. */
+ /********************************/
+
+ /* Get current state of file */
+ /* descriptor & save */
+ if ((fd_flag = fcntl (fd, F_GETFL, 0)) == -1) return (-1);
+ if (ioctl (fd, TCGETS, &term_old) == -1) return (-1);
+ /* set terminal attr to raw */
+ /* and to delay on read */
+ pty_new = pty_old | REMOTE;
+ memcpy (&term_new, &term_old, sizeof (term_new));
+ term_new.c_iflag = 0;
+ term_new.c_oflag = 0;
+ term_new.c_lflag = 0;
+ /* term_new.c_line = 0; */
+ for (i = 1; i <= 5; i++)
+ term_new.c_cc[i] = 0;
+ term_new.c_cc[0] = -1;
+ ioctl (fd, TCSETS, &term_new);
+ if (fcntl (fd, F_SETFL, fd_flag & ~O_NDELAY) == -1)
+ return(-1);
+ /* call spacific function */
+ if (request == HFSKBD)
+ retcode = hfskbd (fd, request, arg.c);
+ else /* assume HFQUERY */
+ retcode = hfqry (fd, request, arg.c);
+
+ fcntl (fd, F_SETFL, fd_flag); /* reset terminal to original */
+ ioctl (fd, TCSETS, &term_old);
+
+
+ return (retcode); /* return error */