00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049 #define MAIN
00050 #include "copyright.h"
00051 #undef MAIN
00052
00053 #include "utility.h"
00054 #include "system.h"
00055
00056
00057
00058
00059 extern void ThreadTest(void), Copy(char *unixFile, char *nachosFile);
00060 extern void Print(char *file), PerformanceTest(void);
00061 extern void StartProcess(char *file), ConsoleTest(char *in, char *out);
00062 extern void MailTest(int networkID);
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077
00078 int
00079 main(int argc, char **argv)
00080 {
00081 int argCount;
00082
00083
00084 DEBUG('t', "Entering main");
00085 (void) Initialize(argc, argv);
00086
00087 #ifdef THREADS
00088 ThreadTest();
00089 #endif
00090
00091 for (argc--, argv++; argc > 0; argc -= argCount, argv += argCount) {
00092 argCount = 1;
00093 if (!strcmp(*argv, "-z"))
00094 printf (copyright);
00095 #ifdef USER_PROGRAM
00096 if (!strcmp(*argv, "-x")) {
00097 ASSERT(argc > 1);
00098 StartProcess(*(argv + 1));
00099 argCount = 2;
00100 } else if (!strcmp(*argv, "-c")) {
00101 if (argc == 1)
00102 ConsoleTest(NULL, NULL);
00103 else {
00104 ASSERT(argc > 2);
00105 ConsoleTest(*(argv + 1), *(argv + 2));
00106 argCount = 3;
00107 }
00108 interrupt->Halt();
00109
00110
00111 }
00112 #endif // USER_PROGRAM
00113 #ifdef FILESYS
00114 if (!strcmp(*argv, "-cp")) {
00115 ASSERT(argc > 2);
00116 Copy(*(argv + 1), *(argv + 2));
00117 argCount = 3;
00118 } else if (!strcmp(*argv, "-p")) {
00119 ASSERT(argc > 1);
00120 Print(*(argv + 1));
00121 argCount = 2;
00122 } else if (!strcmp(*argv, "-r")) {
00123 ASSERT(argc > 1);
00124 fileSystem->Remove(*(argv + 1));
00125 argCount = 2;
00126 } else if (!strcmp(*argv, "-l")) {
00127 fileSystem->List();
00128 } else if (!strcmp(*argv, "-D")) {
00129 fileSystem->Print();
00130 } else if (!strcmp(*argv, "-t")) {
00131 PerformanceTest();
00132 }
00133 #endif // FILESYS
00134 #ifdef NETWORK
00135 if (!strcmp(*argv, "-o")) {
00136 ASSERT(argc > 1);
00137 Delay(2);
00138
00139
00140 MailTest(atoi(*(argv + 1)));
00141 argCount = 2;
00142 }
00143 #endif // NETWORK
00144 }
00145
00146 currentThread->Finish();
00147
00148
00149
00150
00151
00152
00153
00154 return(0);
00155 }
The University of Southern California does not screen or control the content on this website and thus does not guarantee the accuracy, integrity, or quality of such content. All content on this website is provided by and is the sole responsibility of the person from which such content originated, and such content does not necessarily reflect the opinions of the University administration or the Board of Trustees