home *** CD-ROM | disk | FTP | other *** search
/ Network Support Encyclopedia 96-1 / novell-nsepro-1996-1-cd2.iso / download / netware / vlmkt6.exe / WS_LWP_D.CPF < prev    next >
Text File  |  1993-09-28  |  9KB  |  325 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_LWP_D,
  18.     /* CompVer    */    4.1,
  19.     /* CompStatus */    Retail
  20. );
  21.  
  22.     string    targetName[39];
  23.     string    sourceDirectory;
  24.     string    targetDirectory;
  25.     int    i;        /* Loop control variable */
  26.     string    userName;    /* For R-Utilities */
  27.     string    tempPath;    /* Path to temporary files */
  28.     int    fh;        /* File handle for fopen, etc. */
  29.     int    fho;        /* Output file handle for fopen, etc. */
  30.     int    fc;        /* Return code from fgets when rc is busy */
  31.     string    inputLine;    /* Line read from file */
  32.     string    scanLine;    /* 'inputLine' set to upper case */
  33.     int    rc;        /* Return code from various functions */
  34.     int    rc1;        /* String search results */
  35.     int    rc2;        /* String search results */
  36.     int    count;        /* Number of drivers loaded in CONFIG.SYS */
  37.     string    driverList;    /* List if drivers loaded in CONFIG.SYS */
  38.     int    ansiFound;    /* Found ANSI driver in CONFIG.SYS */
  39.     string    ansiPath;    /* Path to ANSI.SYS */
  40.     string  ch;
  41.     int    lineNumber;
  42.     int    pushed;
  43.     int    LWP401;
  44.     int    telapi;
  45.     string    telapiLine;
  46.  
  47.  
  48. /*
  49. =====================================
  50. =  Now edit the AUTOEXEC.BAT file.  =
  51. =====================================
  52. */
  53. userName = "";
  54.  
  55. if (bootType != BOOT_BY_RPL) {
  56.     tempPath = GetTempDir();
  57.     AppendPath (tempPath, "INSTALL.TMP");
  58.  
  59.     if (silentcopy (pathAUTOEXEC_BAT, tempPath)) {
  60.         DisplayErrorCondition (FATAL);
  61.     } /* end if */
  62.  
  63.     fh = fopen (tempPath, "r");
  64.     fho = fopen (pathAUTOEXEC_BAT, "w");
  65.  
  66.     fc = fgets (inputLine, fh);
  67.     lineNumber = 1;
  68.     pushed = 0;
  69.     LWP401 = 0;
  70.     telapi = 0;
  71.     while (fc) {
  72.         scanLine = inputLine;
  73.         strupr (scanLine);
  74.  
  75.         rc = 0;
  76.         do {            /* Skip leading whitespace */
  77.             rc = rc + 1;
  78.             ch = substr (scanLine, rc, 1); 
  79.         } while ((ch == " ") || (ch == "\t"));
  80.         scanLine = substr (scanLine, rc, 255);
  81.         if (1 == searchstr (scanLine, ":TCPIP")) {
  82.             /*
  83.             ======================================================
  84.             =  This section determines that whether the 4.01     =
  85.             =  installation is a LWP or OEM TCPIP by checking    =
  86.             =  if "SET NAME=" presents within ":TCPIP" and         =
  87.             =  ":NOTCPIP"                         =
  88.             ======================================================
  89.             */
  90.             fc = fgets (inputLine, fh);
  91.             rc = 0;
  92.             while (fc && !rc) {
  93.                 scanLine = inputLine;
  94.                 strupr (scanLine);
  95.  
  96.                 rc = searchstr (scanLine, ":NOTCPIP");
  97.                 if (!rc) {
  98.                    if (1 == searchstr (scanLine, "SET")) {
  99.                     rc1 = 3;            /* Skip the "set" keyword */
  100.                     do {
  101.                         rc1 = rc1 + 1;
  102.                         ch = substr (scanLine, rc1, 1); 
  103.                     } while ((ch == " ") || (ch == "\t"));
  104.                     scanLine = substr (scanLine, rc1, 255);
  105.                     if (1 == searchstr (scanLine, "NAME")) {
  106.                         rc1 = 4;        /* Skip the "name" keyword */
  107.                         do {
  108.                             rc1 = rc1 + 1;
  109.                             ch = substr (scanLine, rc1, 1); 
  110.                         } while ((ch == " ") || (ch == "\t"));
  111.                         ch = substr (scanLine, rc1, 1); 
  112.                         if (ch == "=") LWP401 = 1;
  113.                     }
  114.                    } else if (searchstr (scanLine, "TELAPI")) {
  115.                     telapiLine = inputLine;
  116.                     telapi = 1;
  117.                    }
  118.                    fc = fgets (inputLine, fh);
  119.                 } /* end if */
  120.             } /* end while */
  121.         } /* end if */
  122.         fc = fgets (inputLine, fh);
  123.         if (!(lineNumber % 5)) {
  124.             if (pushed) {
  125.                 PopInformationText();
  126.                 pushed = 0;
  127.             } else {
  128.                 PushInformationText (2, STILL_EDITING);
  129.                 pushed = 1;
  130.             } /* end if */
  131.         } /* end if */
  132.         lineNumber = lineNumber + 1;
  133.     } /* end while */
  134.     if (pushed) PopInformationText();
  135.     rc = fclose (fh);
  136.     fh = fopen (tempPath, "r");    /* reopen input file */
  137.  
  138.     fc = fgets (inputLine, fh);
  139.     lineNumber = 1;
  140.     pushed = 0;
  141.     while (fc) {
  142.         scanLine = inputLine;
  143.         strupr (scanLine);
  144.  
  145.         rc = 0;
  146.         do {            /* Skip leading whitespace */
  147.             rc = rc + 1;
  148.             ch = substr (scanLine, rc, 1); 
  149.         } while ((ch == " ") || (ch == "\t"));
  150.         scanLine = substr (scanLine, rc, 255);
  151.  
  152.         if (1 == searchstr (scanLine, "SET")) {
  153.             /*
  154.             ======================================================
  155.             =  Looks for "set path".  If "set path"  is  found,  =
  156.             =  the  leading "set" is deleted and control passes  =
  157.             =  to the PATH section below.                 =
  158.             ======================================================
  159.             */
  160.             rc = 3;            /* Skip the "set" keyword */
  161.             do {
  162.                 rc = rc + 1;
  163.                 ch = substr (scanLine, rc, 1); 
  164.             } while ((ch == " ") || (ch == "\t"));
  165.             scanLine = substr (scanLine, rc, 255);
  166.  
  167.             if (1 == searchstr (scanLine, "PATH")) {
  168.                 inputLine = substr (inputLine, rc, 255);
  169.             } /* end if */
  170.         } /* end if */
  171.         if ((1 == searchstr (scanLine, "PATH")) && (!LWP401)) {
  172.             /*
  173.             ======================================================
  174.             =  This section edits the path statement to  remove  =
  175.             =  the "\xln\bin40" component of the path.         =
  176.             ======================================================
  177.             */
  178.             ch = substr (scanLine, 5, 1); 
  179.             if ((ch == "=") || (ch == " ") || (ch == "\t")) {
  180.                 rc = searchstr (scanLine, ":\\XLN\\BIN40");
  181.                 if (rc) {
  182.                     scanLine =
  183.                         substr (scanLine, 1, rc - 2) +
  184.                         substr (scanLine, rc + 12, 99);
  185.                     inputLine =
  186.                         substr (inputLine, 1, rc - 2) +
  187.                         substr (inputLine, rc + 12, 99);
  188.                 } /* end if */
  189.             } /* end if */
  190.         } /* end if */
  191.         if (1 == searchstr (scanLine, ":TCPIP")) {
  192.             /*
  193.             ======================================================
  194.             =  Comment out the invokation of TCPIP and Telapi    =
  195.             =  in 4.01 configuration                             =
  196.             ======================================================
  197.             */
  198.             rc = fputs (inputLine, fho);
  199.             fc = fgets (inputLine, fh);
  200.             rc = 0;
  201.             while (fc && !rc) {
  202.                 scanLine = inputLine;
  203.                 strupr (scanLine);
  204.  
  205.                 rc = searchstr (scanLine, ":NOTCPIP");
  206.                 if (!rc) {
  207.                     if (1 == searchstr (scanLine, "REM")) {
  208.                         fputs (inputLine, fho);
  209.                     } else if ((searchstr (scanLine, "TCPIP") &&
  210.                            !searchstr (scanLine, "NOTCPIP")) ||
  211.                            searchstr (scanLine, "TELAPI")) {
  212.                             fputs ("REM " + inputLine, fho);
  213.                         } else {
  214.                             fputs (inputLine, fho);
  215.                         } /* end if */
  216.                     fc = fgets (inputLine, fh);
  217.                 } /* end if */
  218.             } /* end while */
  219.         } /* end if */
  220.  
  221.         /*
  222.         ==============================================================
  223.         =  If the line wasn't matched by any of the tests above, it  =
  224.         =  will  just  be  passed to the output file.  This has the  =
  225.         =  effect of  passing  all  REMed  statements  without  any  =
  226.         =  special test for them.                     =
  227.         ==============================================================
  228.         */
  229.         rc = fputs (inputLine, fho);
  230.         fc = fgets (inputLine, fh);
  231.  
  232.         if (!(lineNumber % 5)) {
  233.             if (pushed) {
  234.                 PopInformationText();
  235.                 pushed = 0;
  236.             } else {
  237.                 PushInformationText (2, STILL_EDITING);
  238.                 pushed = 1;
  239.             } /* end if */
  240.         } /* end if */
  241.         lineNumber = lineNumber + 1;
  242.     } /* end while */
  243.     if (pushed) PopInformationText();
  244.  
  245.     fputs ("CALL " + bootDrive + "\\lanwp.bat", fho);
  246.  
  247.     rc = fclose (fh);
  248.     rc = fclose (fho);
  249. } /* end if */
  250.  
  251.  
  252. /*
  253. =======================================================
  254. =  Now update the LANWP.BAT file to load tcpip, etc.  =
  255. =======================================================
  256. */
  257. fh = fopen (GetTempDir() + "\\lanwp.bat", "a");
  258.  
  259. /*
  260. =============================
  261. =  Invokation of TCPIP.EXE  =
  262. =============================
  263. */
  264. if (bootType == BOOT_BY_RPL) {
  265.     tempPath = "PATH " + targetPath + "\\BIN;%path%";
  266.     rc = fputs (tempPath, fh);
  267.     rc = fputs ("tcpip.exe -c=" + bootDrive + "\\net.cfg", fh);
  268. } else {
  269.     rc = fputs ("tcpip.exe", fh);
  270. } /* end if */
  271.  
  272. /*
  273. ==========================================================
  274. =  Preserve the invokation of TELAPI for LWP 4.01        =
  275. ==========================================================
  276. */
  277. if (telapi) rc = fputs(telapiLine, fh);
  278.  
  279. rc = fputs ("break on", fh);
  280. rc = fputs (":noload", fh);
  281.  
  282. rc = fclose (fh);
  283.  
  284.  
  285. if (bootType != BOOT_BY_RPL) {
  286.     if (LWP41 && IsFile (oldLANWP_BAT) && !sameLWP41dir) {
  287.     i = 0;
  288.     do {
  289.         rc = PutProfileString ("Protocol TCPIP",    /* appName */
  290.                    pathKeyName[i],        /* keyName */
  291.                    pathKeyValue[i]+";"+oldpathKeyValue[i],
  292.                             /* valueString */
  293.                    pathNET_CFG,        /* fileName */
  294.                    "CFG");            /* file type */
  295.  
  296.         i = i + 1;
  297.     } while (i <= 3);
  298.  
  299.  
  300.     tempPath = GetTempDir();
  301.     AppendPath (tempPath, "INSTALL.TMP");
  302.     if (silentcopy (GetTempDir()+"\\lanwp.bat", tempPath)) {
  303.         DisplayErrorCondition (FATAL);
  304.     } /* end if */
  305.     fh = fopen (tempPath, "r");
  306.     fho = fopen (GetTempDir() + "\\lanwp.bat", "w");
  307.     fc = fgets (inputLine, fh);
  308.     while (fc) {
  309.         scanLine = inputLine;
  310.         strupr (scanLine);
  311.         if (1 == searchstr (scanLine, "PATH")) {
  312.             tempPath = "PATH " + targetPath + "\\BIN;" + oldLWP41path;
  313.             fputs (tempPath, fho);
  314.         } else {
  315.             fputs (inputLine, fho);
  316.         }
  317.         fc = fgets (inputLine, fh);
  318.     }
  319.  
  320.     fclose (fh);
  321.     fclose (fho);
  322.     }
  323. }
  324.  
  325.