#include <sys/io.h>
#include <stdio.h>
#include <unistd.h>
/* #include <io.h> */
#include <string.h>
#include <libio.h>
#include <stdlib.h>
#include <sys/ioctl.h>
#include <termios.h>
#include <unistd.h>
int main()
{
void end () {
/* The Beggining of the end.... */
outb(0, LPT1PORT);
usleep(10000);
if (ioperm(LPT1PORT, 3, 0)) {perror("ioperm"); exit(1);}
/* We don't need the port anymore */
ioctl(0,TCSETS,&oldT);
/* Better set the terminal back to normal... :-) */
exit(0);
/* Buh bye */
}
ioctl(0,TCGETS,&oldT);
/* get current terminal mode */
newT=oldT;
/* copy it into our new structure */
newT.c_lflag &= ~ECHO;
/* toggle echo */
newT.c_lflag &= ~ICANON;
/* toggle no line delimination */
ioctl(0,TCSETS,"wT"); /
* initialize our new terminal mode */
char i[1];
while(1==1){
read(0,&i[0],1);
/* read one char from the buffer */
printf("\nu pressed %c\n", i[0]);
if (i[0] == '8') { forward(i[0]); }
if (i[0] == '2') { reverse(i[0]); }
if (i[0] == '4') { left(i[0]); }
if (i[0] == '6') { right(i[0]); }
if (i[0] == '7') { forwardleft(i[0]); }
if (i[0] == '9') { forwardright(i[0]); }
if (i[0] == '1') { reverseleft(i[0]); }
if (i[0] == '3') { reverseright(i[0]); }
if (i[0] == '5') { stop(i[0]); }
if (i[0] == 'q') { end(); }
/* end of rccar.c */