home *** CD-ROM | disk | FTP | other *** search
/ Network Support Encyclopedia 96-1 / novell-nsepro-1996-1-cd2.iso / download / netware / vlmkt6.exe / WS_ODI.CPF < prev    next >
Text File  |  1993-09-28  |  13KB  |  431 lines

  1. /*
  2. **      Copyright (c) 1992 Novell, Inc.  All Rights Reserved.
  3. **
  4. **      THIS WORK IS SUBJECT TO U.S. AND INTERNATIONAL COPYRIGHT LAWS 
  5. **      AND TREATIES. NO PART OF THIS WORK MAY BE USED, PRACTICED, 
  6. **      PERFORMED COPIED, DISTRIBUTED, REVISED, MODIFIED, TRANSLATED, 
  7. **      ABRIDGED, CONDENSED, EXPANDED, COLLECTED, COMPILED, LINKED, 
  8. **      RECAST, TRANSFORMED OR ADAPTED WITHOUT THE PRIOR WRITTEN CONSENT
  9. **      OF NOVELL, INC.  ANY USE OR EXPLOITATION OF THIS WORK WITHOUT 
  10. **      AUTHORIZATION COULD SUBJECT THE PERPETRATOR TO CRIMINAL AND CIVIL
  11. **      LIABILITY.
  12. */
  13.  
  14. syntax (1.1); 
  15.  
  16. component (
  17.     /* CompID     */    WS_ODI,
  18.     /* CompVer    */    4.1,
  19.     /* CompStatus */    Retail
  20. );
  21.  
  22.  
  23.     string    srcPath;    /* Path to ODI directory */
  24.     string    targetName[57];    /* Names of the files */
  25.     string    sourceName[2];
  26.     string    sourceDirectory;
  27.     string    targetDirectory;
  28.     int    i;
  29.     int    srcVersion;    /* Version of source file */
  30.     int    dstVersion;    /* Version of destination file */
  31.     string    command;
  32.     string    drive;        /* splitpath() results */
  33.     string    directory;    /* splitpath() results */
  34.     string    fname;        /* splitpath() results */
  35.     string    ext;        /* splitpath() results */
  36.     int    fh;        /* File handle for fopen, etc. */
  37.     int    fho;        /* File handle for fopen, etc. */
  38.     int    rc;        /* Return code from various functions */
  39.     int    fc;
  40.     string    tempPath;
  41.     int    limit;
  42.     string    inputLine;
  43.     string    scanLine;
  44. static    string    MLIDname;
  45.     string    INSname;
  46.     string    pathMLID;
  47.     string    pathINS;
  48.     string    ch;
  49.     int    found;
  50.     int    lineNumber;
  51.     int    pushed;
  52.     int    installSLIP;
  53.     string    sourcePath;
  54.     string    null;
  55.     string    frameValues;
  56.     string    frame;
  57.     int    foundSET;
  58.     int    foundPATH;
  59.     string    searchPath;
  60. static    int    LWP41;
  61. static    int    sameLWP41dir;
  62. static    string    oldLWP41path;
  63. static    string    oldLANWP_BAT;
  64.     string    frameType;
  65.     string    protocolIPX;
  66.     string    protocolID;
  67.  
  68.  
  69. srcPath = GetSourcePath();
  70. AppendPath (srcPath, "NET\\ODI");
  71.  
  72. /*
  73. =====================================================
  74. =  MLID used (MLIDbasename obtained in ws_conf.cpf  =
  75. =====================================================
  76. */
  77. MLIDname = MLIDbasename + ".com";
  78. INSname = MLIDbasename + ".ins";
  79.  
  80.  
  81. /*
  82. =======================================================================
  83. =  Find out what Frame type IPX uses and put it in the NET.CFG file.  =
  84. =======================================================================
  85. */
  86. if (MLIDbasename == "NONE") {
  87.     rc = 1;
  88. } else {
  89.     rc = GetProtocolIPX (MLIDbasename, protocolID, frameType);
  90. } /* end if */
  91.  
  92. if (rc) {
  93.     protocolIPX = "Protocol IPX " + protocolID + " " + frameType;
  94. } else {
  95.     tempPath = srcPath + "\\frames.ins";
  96.     rc = SelectParameterValue (tempPath,            /* INS file */
  97.                    "Frame",            /* Parameter */
  98.                    frameType,            /* rtn value */
  99.                    0,                /* multiple */
  100.                    NETWARE_FRAME_TYPE_INFO,   /* instructions */
  101.                    NETWARE_FRAME_TYPE_HELP,    /* help */
  102.                    NETWARE_FRAME_TYPE_INFO);    /* info */
  103.  
  104.     scanLine = frameType;
  105.     strupr (scanLine);
  106.     if (searchstr (scanLine, "ETHERNET_802.3")) {
  107.         protocolIPX = "Protocol IPX 0 " + frameType;
  108.     } else if (searchstr (scanLine, "ETHERNET_802.2")) {
  109.         protocolIPX = "Protocol IPX E0 " + frameType;
  110.     } else if (searchstr (scanLine, "ETHERNET_II")) {
  111.         protocolIPX = "Protocol IPX 8137 " + frameType;
  112.     } else if (searchstr (scanLine, "ETHERNET_SNAP")) {
  113.         protocolIPX = "Protocol IPX 8137 " + frameType;
  114.     } else if (searchstr (scanLine, "TOKEN-RING")) {
  115.         protocolIPX = "Protocol IPX E0 " + frameType;
  116.     } else if (searchstr (scanLine, "TOKEN-RING_SNAP")) {
  117.         protocolIPX = "Protocol IPX 8137 " + frameType;
  118.     } else if (searchstr (scanLine, "IBM_PCN2_802.2")) {
  119.         protocolIPX = "Protocol IPX E0 " + frameType;
  120.     } else if (searchstr (scanLine, "IBM_PCN2_SNAP")) {
  121.         protocolIPX = "Protocol IPX 8137 " + frameType;
  122.     } else if (searchstr (scanLine, "FDDI_802.2")) {
  123.         protocolIPX = "Protocol IPX E0 " + frameType;
  124.     } else if (searchstr (scanLine, "FDDI_SNAP")) {
  125.         protocolIPX = "Protocol IPX 8137 " + frameType;
  126.     } else if (searchstr (scanLine, "NOVELL_RX-NET")) {
  127.         protocolIPX = "Protocol IPX FA " + frameType;
  128.     } else {
  129.         protocolIPX = "";
  130.     } /* end if */
  131. } /* end if */
  132.  
  133. if (MLIDbasename != "NONE") {
  134.  
  135.     if (frameType != "") {
  136.         PutProfileString ("Link Driver " + MLIDbasename,/* Application Name */
  137.                   "Frame " + frameType,        /* Key Name */
  138.                   " ",                /* New Key Value */
  139.                   pathNET_CFG,            /* File Name */
  140.                   "CFG");            /* File Type */
  141.     }
  142.  
  143.     if (protocolIPX != "") {
  144.         PutProfileString ("Link Driver " + MLIDbasename,/* App Name */
  145.                   protocolIPX,            /* Key Name */
  146.                   " ",                /* New Value */
  147.                   pathNET_CFG,            /* File Name */
  148.                   "CFG");            /* File Type */
  149.     } /* end if */
  150. } /* end if */
  151.  
  152.  
  153. /*
  154. ==============================================
  155. =  Configure NET.CFG for the MLID(s) useed.  =
  156. ==============================================
  157. */
  158. found = 0;
  159. pathINS = srcPath + "\\" + INSname;
  160. if (IsFile (pathINS)) found = 1;
  161.  
  162. frame = "Ethernet_II";
  163.  
  164. if (found) {
  165.     rc = CollectParameterValues (pathINS,        /* Path to .INS file */
  166.                      "Frame",        /* Param requested */
  167.                      frameValues);    /* Return values */
  168.  
  169.     i = 0;
  170.     while (i < rc) {
  171.         strupr (frameValues[i]);
  172.         if (searchstr (frameValues[i], "TOKEN-RING_SNAP" )) {
  173.             frame = "Token-Ring_SNAP";
  174.         } else    if (searchstr (frameValues[i], "NOVELL_RX-NET" )) {
  175.             frame = "NOVELL_RX-NET";
  176.         } else    if (searchstr (frameValues[i], "IBM_PCN2_SNAP" )) {
  177.             frame = "IBM_PCN2_SNAP";
  178.         } else    if (searchstr (frameValues[i], "FDDI_SNAP" )) {
  179.             frame = "FDDI_SNAP";
  180.         } /* end if */
  181.  
  182.         i = i + 1;
  183.     } /* end while */
  184. } else {
  185.     tempPath = srcPath + "\\ipframes.ins";
  186.     rc = SelectParameterValue (tempPath,            /* INS file */
  187.                    "Frame",            /* Parameter */
  188.                    frame,            /* rtn value */
  189.                    0,                /* multiple */
  190.                    TCPIP_FRAME_TYPE_INFO,    /* instructions */
  191.                    TCPIP_FRAME_TYPE_HELP,    /* help */
  192.                    TCPIP_FRAME_TYPE_INFO);    /* info */
  193. } /* end if */
  194.  
  195. /*
  196. ==============================================================================
  197. =  The default "Ethernet_II" may be wrong for a third party driver, but  if  =
  198. =  we  don't have a .INS file, we can't tell what the driver might support.  =
  199. =  The user will have to correct it if it is wrong.                 =
  200. ==============================================================================
  201. */
  202. if (MLIDbasename != "NONE") {
  203.     PutProfileString ("Link Driver " + MLIDbasename,/* Application Name */
  204.               "Frame " + frame,        /* Key Name */
  205.               " ",                /* New Value */
  206.               pathNET_CFG,            /* File Name */
  207.               "CFG");            /* File Type */
  208. } /* end if */
  209.  
  210. /*
  211. ================================================================
  212. =  Find out if the user wants to install the SLIP/PPP driver.  =
  213. ================================================================
  214. */
  215. PushHelpContext (INSTALL_SLIP_HELP);
  216. installSLIP = Confirm (INSTALL_SLIP, 18, 0, 0);
  217. PopHelpContext();
  218.  
  219. if (installSLIP) {
  220.     sourceDirectory = GetSourcePath() + "NET\\BIN\\";
  221.     pathINS = sourceDirectory + "slip_ppp.ins";
  222.     PushHelpContext (CONFIGURE_MLID_HELP);
  223.     PushInformationText (2, CONFIGURE_SLIP_INFO);
  224.     rc = ConfigureMLID (pathINS,        /* Path to .INS file */
  225.                 pathNET_CFG,    /* Path to NET.CFG to edit */
  226.                 "",            /* Skip list */
  227.                 DMA_HELP,        /* Help for DMA parameter */
  228.                 FRAME_TYPE_HELP,    /* Help for FRAME parameter */
  229.                 INTERRUPT_HELP,    /* Help for INT parameter */
  230.                 MEMORY_ADDRESS_HELP,/* Help for MEM parameter */
  231.                 NODE_ADDRESS_HELP,    /* Help for NODE parameter */
  232.                 PORT_HELP,        /* Help for PORT parameter */
  233.                 SLOT_HELP);        /* Help for SLOT parameter */
  234.     PopHelpContext();
  235.     PopInformationText();
  236. } /* end if */
  237.  
  238.  
  239. /*
  240. =================================================================
  241. =  Comment out the call to LANWP.BAT in the autoexec.bat file.  =
  242. =================================================================
  243. */
  244. tempPath = GetTempDir();
  245. AppendPath (tempPath, "INSTALL.TMP");
  246.  
  247. AddStatus (EDITING, AUTOEXEC_BAT, NO_MESSAGE);
  248.  
  249. if (silentcopy (pathAUTOEXEC_BAT, tempPath)) {
  250.     DisplayErrorCondition (FATAL);
  251. } /* end if */
  252.  
  253. LWP41 = 0;
  254. fh = fopen (tempPath, "r");
  255. fho = fopen (pathAUTOEXEC_BAT, "w");
  256. limit = 1;
  257. fc = fgets (inputLine, fh);
  258. lineNumber = 1;
  259. pushed = 0;
  260. while (fc) {
  261.     scanLine = inputLine;
  262.     strupr (scanLine);
  263.     rc = 0;
  264.     do {                /* Skip leading whitespace */
  265.         rc = rc + 1;
  266.         ch = substr (scanLine, rc, 1); 
  267.     } while ((ch == " ") || (ch == "\t"));
  268.     scanLine = substr (scanLine, rc, 255);
  269.  
  270.     foundSET = 0;
  271.     if (1 == searchstr (scanLine, "SET" )) {
  272.         rc = 3;            /* Skip the "set" keyword */
  273.         do {
  274.             rc = rc + 1;
  275.             ch = substr (scanLine, rc, 1); 
  276.         } while ((ch == " ") || (ch == "\t"));
  277.         scanLine = substr (scanLine, rc, 255);
  278.         foundSET = 1;
  279.     } /* end if */
  280.  
  281.     foundPATH = 0;
  282.     if (1 == searchstr (scanLine, "PATH")) {
  283.         ch = substr (scanLine, 5, 1); 
  284.         if ((ch == "=") || (ch == " ") || (ch == "\t")) {
  285.             rc = 4;            /* Skip the "path" keyword */
  286.             do {
  287.                 rc = rc + 1;
  288.                 ch = substr (scanLine, rc, 1); 
  289.             } while ((ch == " ") || (ch == "\t") || (ch == "="));
  290.             scanLine = substr (scanLine, rc, 255);
  291.  
  292.             rc = searchstr (scanLine, ":\\XLN\\BIN40");
  293.             if (rc) {
  294.                 searchPath = substr (scanLine, 1, rc - 2) +
  295.                          substr (scanLine, rc + 12, 255);
  296.             } else {
  297.                 searchPath = scanLine;
  298.             } /* end if */
  299.  
  300.             foundPATH = 1;
  301.         } /* end if */
  302.     } /* end if */
  303.  
  304.     if (foundSET ||
  305.         foundPATH ||
  306.         (1 == searchstr (scanLine, "REM" )) ||
  307.         (1 == searchstr (scanLine, ":"   ))) {
  308.         rc = fputs (inputLine, fho);
  309.     } else {
  310.         rc = searchstr (scanLine, " ");
  311.         if (!rc) rc = searchstr (scanLine, "\t");
  312.         if (rc) {
  313.             command = substr (scanLine, 1, rc - 1);
  314.         } else {
  315.             command = scanLine;
  316.         } /* end if */
  317.  
  318.         splitpath (command, drive, directory, fname, ext);
  319.         if (searchstr (fname, "CALL")) {
  320.             do {
  321.                 rc = rc + 1;
  322.                 ch = substr (scanLine, rc, 1); 
  323.             } while ((ch == " ") || (ch == "\t"));
  324.             scanLine = substr (scanLine, rc, 255);
  325.  
  326.             rc = searchstr (scanLine, " ");
  327.             if (!rc) rc = searchstr (scanLine, "\t");
  328.             if (rc) {
  329.                 command = substr (scanLine, 1, rc - 1);
  330.             } else {
  331.                 command = scanLine;
  332.             } /* end if */
  333.         } /* end if */
  334.  
  335.         splitpath (command, drive, directory, fname, ext);
  336.         if (fname == "LANWP") {
  337.             LWP41 = 1;
  338.             fputs ("REM " + inputLine, fho);
  339.         } else    fputs (inputLine, fho);
  340.     } /* end if */
  341.  
  342.     fc = fgets (inputLine, fh);
  343.  
  344.     if (!(lineNumber % 5)) {
  345.         if (pushed) {
  346.             PopInformationText();
  347.             pushed = 0;
  348.         } else {
  349.             PushInformationText (2, STILL_EDITING);
  350.             pushed = 1;
  351.         } /* end if */
  352.     } /* end if */
  353.     lineNumber = lineNumber + 1;
  354. } /* end while */
  355. if (pushed) PopInformationText();
  356.  
  357. rc = fclose (fh);
  358. rc = fclose (fho);
  359.  
  360. /*
  361. ==========================================================
  362. =  Create a LANWP.BAT file which will start up the       =
  363. =  existing ODI if LWP41, and the TCPIP transport        =
  364. ==========================================================
  365. */
  366. tempPath = "PATH " + targetPath + "\\BIN;" + searchPath;
  367. if (strlen (tempPath) > 127) {
  368.     PushHelpContext (PATH_TOO_LONG_HELP);
  369.     Alert (PATH_TOO_LONG, 18, 0);
  370.     PopHelpContext();
  371. } /* end if */
  372. tempPath = "PATH " + targetPath + "\\BIN;%path%";
  373.  
  374. fh = fopen (GetTempDir() + "\\lanwp.bat", "w");
  375. rc = fputs (targetPath + "\\BIN" + "\\yesno " + "\"Do you want to load the TCP/IP transport? [Y/N] \"", fh);
  376. rc = fputs ("if errorlevel 1 goto noload", fh);
  377. rc = fputs (tempPath, fh);
  378.  
  379. /*
  380. ==========================================================
  381. =  check and preserve NW shell and LWP "set name" if any =
  382. =  if it is LWP41                                        =
  383. ==========================================================
  384. */
  385. if (bootType != BOOT_BY_RPL) {
  386.     sameLWP41dir = 0;
  387.     oldLANWP_BAT = bootDrive + "\\lanwp.bat";
  388.     if (LWP41 && IsFile (oldLANWP_BAT)) {
  389.     fho = fopen (oldLANWP_BAT, "r");
  390.     fc = fgets (inputLine, fho);
  391.     while (fc) {
  392.         scanLine = inputLine;
  393.         strupr (scanLine);
  394.         rc = 0;
  395.         do {        /* Skip leading whitespace */
  396.             rc = rc + 1;
  397.             ch = substr (scanLine, rc, 1); 
  398.         } while ((ch == " ") || (ch == "\t"));
  399.         scanLine = substr (scanLine, rc, 255);
  400.         if (!searchstr(scanLine, "YESNO") && !searchstr(scanLine, "NOLOAD") &&
  401.             !searchstr(scanLine, "PATH") && !searchstr(scanLine, "BREAK") &&
  402.             !searchstr(scanLine, "TCPIP"))
  403.             rc = fputs (inputLine, fh);
  404.         if (1 == searchstr (scanLine, "PATH")) {
  405.             if (searchstr (scanLine, targetPath)) sameLWP41dir = 1;
  406.             if (!sameLWP41dir) {
  407.                 ch = substr (scanLine, 5, 1);
  408.                 if ((ch == "=") || (ch == " ") || (ch == "\t")) {
  409.                     rc = 4;            /* Skip the "path" keyword */
  410.                     do {
  411.                         rc = rc + 1;
  412.                         ch = substr (scanLine, rc, 1); 
  413.                     } while ((ch == " ") || (ch == "\t") || (ch == "="));
  414.                     oldLWP41path = substr (scanLine, rc, 255);
  415.                 }
  416.             }
  417.         }
  418.         fc = fgets (inputLine, fho);
  419.     } /* end while */
  420.     fclose (fho);
  421.     } 
  422. }
  423.  
  424. /*
  425. ======================================
  426. =  Invoke SLIP_PPP.COM if requested  =
  427. ======================================
  428. */
  429. if (installSLIP) rc = fputs ("\\slip_ppp.com", fh);
  430. rc = fclose (fh);
  431.