Logo
~Apps~
~Projects~
~Contact~

asexec.cpp File Reference

#include <stdio.h>
#include <string.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <stdlib.h>
#include "a.h"
#include "Parser.h"
#include "ParserIO.h"

Include dependency graph for asexec.cpp:

Go to the source code of this file.


Classes

class  IOC

Functions

int main (int argc, char *argv[])

Function Documentation

int main int  argc,
char *  argv[]
 

Definition at line 38 of file asexec.cpp.

References Parser::cmd(), Parser::flush_obuf(), ParserIO::m_more, and Parser::SetParserIO().

00039 {
00040         Parser cmdline;
00041         IOC ioc;
00042         int n;
00043         char slask[200];
00044 
00045         cmdline.SetParserIO(&ioc);
00046         ioc.m_more = 1;
00047 
00048         if (argc > 1)
00049         {
00050                 sprintf(slask,"RUN %s",argv[1]);
00051                 cmdline.cmd( slask );
00052                 return 0;
00053         }
00054 
00055         printf("Welcome to asexec, the linux applesoft interpreter\n");
00056         *slask = 0;
00057         while ( strncasecmp(slask,"quit",4) )
00058         {
00059                 cmdline.flush_obuf();
00060                 printf("\n>");
00061                 fflush(stdout);
00062                 if ( (n = read(0, slask, 200)) == -1)
00063                 {
00064                         perror("read() failed");
00065                         exit(-1);
00066                 }
00067                 slask[n] = 0;
00068                 if (strncasecmp(slask,"quit",4))
00069                 {
00070                         cmdline.cmd( slask );
00071                 }
00072         }
00073         printf("Exit from asexec\n");
00074         return 0;
00075 }

Page, code, and content Copyright (C) 2005 by Anders Hedström
Generated on Mon Aug 29 20:21:47 2005 for C++ Sockets by  doxygen 1.4.4