00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #include <string.h>
00019 #include <stdio.h>
00020 #include "rcs.hh"
00021 #include "emcglb.h"
00022 #include "emccfg.h"
00023
00024
00025 #ifndef __GNUC__
00026 #ifndef __attribute__
00027 #define __attribute__(x)
00028 #endif
00029 #endif
00030
00031 static char __attribute__((unused)) ident[] = "$Id: emcargs.cc,v 1.6 2001/06/29 20:27:29 wshackle Exp $";
00032
00033 int emcGetArgs(int argc, char *argv[])
00034 {
00035 int t;
00036
00037
00038 for (t = 1; t < argc; t++) {
00039 if (!strcmp(argv[t], "-ini")) {
00040 if (t == argc - 1) {
00041 return -1;
00042 }
00043 else {
00044 strcpy(EMC_INIFILE, argv[t+1]);
00045 t++;
00046 }
00047 continue;
00048 }
00049 if (!strcmp(argv[t], "-rcsdebug")) {
00050 set_rcs_print_flag(PRINT_EVERYTHING);
00051 max_rcs_errors_to_print=-1;
00052 continue;
00053 }
00054 #ifndef linux_2_0_36
00055 if (!strcmp(argv[t], "-queryhost")) {
00056 char qhost[80];
00057 printf("EMC Host?");
00058 fgets(qhost,80,stdin);
00059 for (int i = 0; i < 80; i++) {
00060 if (qhost[i] == '\r' || qhost[i] == '\n' || qhost[i] == ' ') {
00061 qhost[i]=0;
00062 break;
00063 }
00064 }
00065 nmlSetHostAlias(qhost,"localhost");
00066 nmlForceRemoteConnection();
00067
00068
00069
00070 continue;
00071 }
00072 if (!strcmp(argv[t], "-host")) {
00073 if (t == argc - 1) {
00074 return -1;
00075 }
00076 else {
00077 nmlSetHostAlias(argv[t+1],"localhost");
00078 nmlForceRemoteConnection();
00079
00080
00081
00082 t++;
00083 }
00084 continue;
00085 }
00086 #endif
00087 }
00088
00089
00090 return 0;
00091 }
00092