Main Page   Class Hierarchy   Alphabetical List   Data Structures   File List   Data Fields   Globals  

emcargs.cc

Go to the documentation of this file.
00001 /*
00002   emcags.cc
00003 
00004   Globals initialized to values in emccfg.h
00005 
00006   Modification history:
00007 
00008   19-Nov-1999 WPS ifdef'd out -host and -queryhost of linux_2_0_36
00009   17-Nov-1999 WPS moved emcGetArgs from emcglb.c to this file.
00010   10-Nov-1999 WPS added -host  and -queryhost option to emcGetArgs.
00011   16-Sep-1999  FMP took out errors in emcGetArgs for unrecognized args
00012   21-Jul-1999  FMP removed -d from emcGetArgs() since DEBUG is now in
00013   ini file; added EMC_NMLFILE in emcGetArgs()
00014   6-Jul-1998  FMP added EMC_DEBUG, emcGetArgs()
00015   17-Nov-1999 WPS created.
00016   */
00017 
00018 #include <string.h>             /* strcpy() */
00019 #include <stdio.h>       /* fgets() */
00020 #include "rcs.hh"               /* nmlSetHostAlias() */
00021 #include "emcglb.h"             /* these decls */
00022 #include "emccfg.h"             /* their initial values */
00023 
00024 /* ident tag */
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   /* process command line args, indexing argv[] from [1] */
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"); /* If localhost appears in .nml file it will overriden by this argument. */
00066       nmlForceRemoteConnection();
00067       /* The only good reason for aliasing the host that I know of is to
00068          connect to a remote server so we will ignore the LOCAL/REMOTE
00069          field in the .nml file and always connect remotely. */
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"); /* If localhost appears in .nml file it will overriden by this argument. */
00078         nmlForceRemoteConnection();
00079         /* The only good reason for aliasing the host that I know of is to
00080            connect to a remote server so we will ignore the LOCAL/REMOTE
00081            field in the .nml file and always connect remotely. */
00082         t++;
00083       }
00084       continue;
00085     }
00086 #endif
00087   }
00088   /* else not recognized-- ignore */
00089 
00090   return 0;
00091 }
00092 

Generated on Sun Dec 2 15:27:38 2001 for EMC by doxygen1.2.11.1 written by Dimitri van Heesch, © 1997-2001