Logo
~Apps~
~Projects~
~Contact~

aslist.cpp File Reference

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

Include dependency graph for aslist.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 37 of file aslist.cpp.

References Parser::cmd(), and Parser::SetParserIO().

00038 {
00039         Parser cmdline;
00040         struct stat st;
00041         IOC ioc;
00042         int loop;
00043         int i;
00044         char slask[200];
00045         char *s;
00046 
00047         if (argc > 1)
00048         {
00049                 cmdline.SetParserIO(&ioc);
00050                 for (loop = 1; loop < argc; loop++)
00051                 {
00052                         s = strstr(argv[loop],"/");
00053                         if (s)
00054                         {
00055                                 *s = 0;
00056                                 chdir(argv[loop]);
00057                                 stat(s + 1,&st);
00058                         }
00059                         else
00060                         {
00061                                 stat(argv[loop],&st);
00062                         }
00063                         i = 0;
00064                         if (st.st_mode & 0100)
00065                                 i |= 1;
00066                         if (st.st_mode & 010)
00067                                 i |= 2;
00068                         if (st.st_mode & 01)
00069                                 i |= 4;
00070 // bits 0 .. 7 = tiabsrab
00071                         if ("TIABSRAB"[i] == 'A')
00072                         {
00073                                 sprintf(slask,"LOAD %s",s ? s + 1 : argv[loop]);
00074                                 cmdline.cmd( slask );
00075                                 strcpy(slask,"LIST");
00076                                 cmdline.cmd( slask );
00077                         }
00078                         if (s)
00079                         {
00080                                 chdir("..");
00081                         }
00082                 }
00083         } else
00084         {
00085                 printf("Usage: %s <A file> [-source]\n", *argv);
00086         }
00087         return 0;
00088 }

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