home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 5 Edit / 05-Edit.zip / ppwizard.zip / ftplikei.ih < prev    next >
Text File  |  2000-02-19  |  60KB  |  1,134 lines

  1. ;----------------------------------------------------------------------------
  2. ;     MODULE NAME:   FTPLIKEI.IH
  3. ;
  4. ;         $Author:   Dennis_Bareis  $
  5. ;       $Revision:   1.1  $
  6. ;           $Date:   19 Feb 2000 15:05:50  $
  7. ;        $Logfile:   E:/DB/PVCS.IT/OS2/PPWIZARD/FTPLIKEI.IHV  $
  8. ;
  9. ;     DESCRIPTION:   DO NOT INCLUDE THIS FILE YOURSELF!!!! USE FTPLIKE.IH!
  10. ;                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  11. ;                    Further comments at the end of this file!
  12. ;
  13. ;----------------------------------------------------------------------------
  14.  
  15. ;--- First time through? ----------------------------------------------------
  16. #ifndef _FTPLIKE_INITIALIZED
  17.    ;--- Try to ensure that header called correctly! -------------------------
  18.    #ifndef FTPLIKE_CALLED_CORRECTLY
  19.            #error ^Please include "FTPLIKE.IH" not "FTPLIKEI.IH"!^
  20.    #endif
  21.  
  22.    ;--- Define the version number of this header file -----------------------
  23.    #define+  VERSION_FTPLIKE_IH    00.045
  24.    #require  00.030
  25.  
  26.    ;--- Check prerequisites -------------------------------------------------
  27.    #ifndef FTPLIKE_DIRECTORY
  28.            #error ^You must define the "FTPLIKE_DIRECTORY" value (local directory)!^
  29.    #endif
  30.    #ifndef FTPLIKE_DIRECTORY_WEB
  31.            #error ^You must define the "FTPLIKE_DIRECTORY_WEB" value (web location)!^
  32.    #endif
  33.  
  34.    ;--- Include macro push/pop support --------------------------------------
  35.    #ifndef VERSION_PUSHPOPM_H
  36.            #include "PushPopM.H"
  37.    #endif
  38.  
  39.    ;--- Include Better Sort Header ------------------------------------------
  40.    #ifndef VERSION_PPWSORT_H
  41.            #include "PPWSORT.H"
  42.    #endif
  43.  
  44.    ;--- Use same date time on all generated pages ---------------------------
  45.    #ifndef FTPLIKE_DATETIME
  46.            #evaluate FTPLIKE_DATETIME @date('WeekDay') || ' ' || date('Month') || ' ' || substr(date('Sorted'), 7, 2) || ' ' || left(date('Sorted'), 4) || ' at ' || time('Civil')@
  47.    #endif
  48.  
  49.    ;--- Total numbers accross FTP pages -------------------------------------
  50.    #RexxVar FtpTotalDirCnt  = 0          ;;Number of directories
  51.    #RexxVar FtpTotalFileCnt = 0          ;;Number of files
  52.  
  53.    ;--- Remember the output level where it all began! -----------------------
  54.    #Rexxvar FtpStartLevel = <?OutputLevel>
  55.  
  56.    ;--- We start processing "non virtual" directories -----------------------
  57.    #RexxVar  RealDirTree = 'Y'
  58.  
  59.    ;--- Work out what filemasks users wants ---------------------------------
  60.    #ifndef FTPLIKE_FILE_MASKS
  61.            ;--- Default is to process all files -----------------------------
  62.            #if ['<?OpSys>' = 'UNIX']
  63.                #define FTPLIKE_FILE_MASKS
  64.            #else
  65.                #define FTPLIKE_FILE_MASKS *.*
  66.            #endif
  67.    #endif
  68.    #ifndef FTPLIKE_DIR_MASKS
  69.            ;--- Default is to process all directories -----------------------
  70.            #if ['<?OpSys>' = 'UNIX']
  71.                #define FTPLIKE_DIR_MASKS
  72.            #else
  73.                #define FTPLIKE_DIR_MASKS *.*
  74.            #endif
  75.    #endif
  76.  
  77.    ;--- Do best we can for input dependancies -------------------------------
  78.    #ifdef  FTPLIKE_FOLLOW_SUBDIRECTORIES
  79.            #DependsOn  INPUT  ^*FILES=+<$FTPLIKE_DIRECTORY><?DirSlash><$FTPLIKE_DIR_MASKS>^
  80.    #elseif
  81.            #DependsOn  INPUT  ^*FILES=<$FTPLIKE_DIRECTORY><?DirSlash><$FTPLIKE_DIR_MASKS>^
  82.    #endif
  83.  
  84.    ;--- Allow user to easily support frames etc -----------------------------
  85.    #ifndef FTPLIKE_LINK2DIR
  86.            #define FTPLIKE_LINK2DIR   <A HREF="{$URL}">
  87.    #endif
  88.    #ifndef FTPLIKE_LINK2FILE
  89.            #define FTPLIKE_LINK2FILE  <A HREF="{$URL}">   ;;Probably would not want to override this
  90.    #endif
  91.  
  92.    ;--- Prepare for generating HTML page names ------------------------------
  93.    #ifdef  FTPLIKE_FOLLOW_SUBDIRECTORIES
  94.            ;--- Prepare for generating html page names (unique names!) ------
  95.            #evaluate '' ^call GetIdPrepare 'FTPLIKE', 'Y'^
  96.  
  97.            ;--- Don't generate filename same as current "base" file! --------
  98.            #evaluate '' ^call SetId        'FTPLIKE', '',  EnsureFileHasCorrectCase(_filespec('W', _filespec('Name', '<?OutputFile>')))^
  99.    #endif
  100.  
  101.    ;--- Now work out the output directory -----------------------------------
  102.    #evaluate+  'FtpGenDir' ^_filespec('location', '<?OutputFile>')^
  103.  
  104.    ;--- Work out the full name of this header file --------------------------
  105.    #RexxVar  FtpLikeFile = '<?InputComponent>'
  106.  
  107.    ;--- Work out what user wants to call the "root" dir ---------------------
  108.    #ifndef FTPLIKE_DISPLAY_DIR
  109.            #define FTPLIKE_DISPLAY_DIR /
  110.    #endif
  111.  
  112.    ;--- Work out extension to use -------------------------------------------
  113.    #ifndef   FTPLIKE_HTML_EXTN
  114.              #define   FTPLIKE_HTML_EXTN   htm
  115.    #endif
  116.  
  117.    ;--- Define command file extension ---------------------------------------
  118.    #ifndef   FTPLIKE_CMD_FILE_DIR
  119.              #define   FTPLIKE_CMD_FILE_DIR  dirattr.$$$
  120.    #endif
  121.  
  122.    ;--- User want specific prefix for generated filenames -------------------
  123.    #ifndef   FTPLIKE_NEWHTML_PREFIX
  124.              #ifdef    FTPLIKE_USE_LONG_FILENAMES
  125.                        #define   FTPLIKE_NEWHTML_PREFIX     FtpLike_
  126.              #elseif
  127.                        #define   FTPLIKE_NEWHTML_PREFIX     ;;No prefix
  128.              #endif
  129.    #endif
  130.  
  131.  
  132.    ;--- Define Simple HEADERS & FOOTERS -------------------------------------
  133.    #ifndef FTPLIKE_HEADER
  134.            #define FTPLIKE_HEADER    <CENTER><H1>{$Title}</H1></CENTER>
  135.    #endif
  136.    #ifndef FTPLIKE_FOOTER
  137.            #define FTPLIKE_FOOTER          \
  138.                    <HR>                   %\
  139.                    <CENTER>               %\
  140.                    <FONT SIZE=-1>         %\
  141.                       <$FTPLIKE_DATETIME> %\
  142.                    </FONT>                %\
  143.                    </CENTER>              %\
  144.                    </BODY></HTML>
  145.    #endif
  146.  
  147.    ;--- Define how we create local graphics files! --------------------------
  148.    #DefineRexx 'REXX_MAKE_LOCAL_GRAPHIC'
  149.        ;--- Work out the graphic (put in same directory as HTML) ------------
  150.        LocalGifFile = EnsureFileHasCorrectCase(_filespec('location', '<?OutputFile>') || '{$ImgName}');
  151.  
  152.        ;--- Create the file -------------------------------------------------
  153.        CloseRc = stream(LocalGifFile, 'c', 'close');
  154.        DelRc   = _SysFileDelete(LocalGifFile);
  155.        if  stream(LocalGifFile, 'c', 'query exists') <> '' then
  156.            Error('Could not delete "' || LocalGifFile || '" (is it in use?), DeleteRc=' || DelRc);
  157.        WriteRc = charout(LocalGifFile, {$DataVar});
  158.        call DieIfIoErrorOccurred LocalGifFile;
  159.        CloseRc = stream(LocalGifFile, 'c', 'close');
  160.        call AddOutputFileToDependancyList(LocalGifFile);
  161.    #DefineRexx
  162.  
  163.    ;--- Define START OF HTML page -------------------------------------------
  164.    #ifndef FTPLIKE_HEAD_STYLE_TAGS
  165.            #define FTPLIKE_HEAD_STYLE_TAGS
  166.    #endif
  167.    #ifndef FTPLIKE_EXTRA_HEAD_TAGS
  168.            #define FTPLIKE_EXTRA_HEAD_TAGS
  169.    #endif
  170.    #ifndef FTPLIKE_BODY_LINK_COLOR
  171.            #define FTPLIKE_BODY_LINK_COLOR             ;;Just browser default
  172.    #endif
  173.    #ifndef FTPLIKE_BODY_ALINK_COLOR
  174.            #define FTPLIKE_BODY_ALINK_COLOR            ;;Just browser default
  175.    #endif
  176.    #ifndef FTPLIKE_BODY_VLINK_COLOR
  177.            #define FTPLIKE_BODY_VLINK_COLOR            ;;Just browser default
  178.    #endif
  179.    #ifndef FTPLIKE_BODY_ATTR_OTHER
  180.            #define FTPLIKE_BODY_ATTR_OTHER       ;;No other body attributes (by default)
  181.    #endif
  182.    #ifndef FTPLIKE_BODY_BG_IMG
  183.            ;--- Set up the default graphics filename ----------------------------
  184.            #define FTPLIKE_BODY_BG_IMG  ftp_wood.jpg
  185.  
  186.            ;--- Create the graphic file -------------------------------------
  187.            #DefineRexx ''
  188.                    ;--- Load the graphic data -----------------------------------
  189.                    Gd = ""
  190.                    Gd = Gd || "FFD8FFE000104A46494600010101012C012C0000FFDB004300140E0F120F0D14121012171514181E32211E1C1C1E3D2C2E243249404C4B47404645505A736250"x
  191.                    Gd = Gd || "556D5645466488656D777B8182814E608D978C7D96737E817CFFDB0043011517171E1A1E3B21213B7C5346537C7C7C7C7C7C7C7C7C7C7C7C7C7C7C7C7C7C7C7C"x
  192.                    Gd = Gd || "7C7C7C7C7C7C7C7C7C7C7C7C7C7C7C7C7C7C7C7C7C7C7C7C7C7C7C7C7C7CFFC0001108007D008203012200021101031101FFC4001F0000010501010101010100"x
  193.                    Gd = Gd || "000000000000000102030405060708090A0BFFC400B5100002010303020403050504040000017D01020300041105122131410613516107227114328191A10823"x
  194.                    Gd = Gd || "42B1C11552D1F02433627282090A161718191A25262728292A3435363738393A434445464748494A535455565758595A636465666768696A737475767778797A"x
  195.                    Gd = Gd || "838485868788898A92939495969798999AA2A3A4A5A6A7A8A9AAB2B3B4B5B6B7B8B9BAC2C3C4C5C6C7C8C9CAD2D3D4D5D6D7D8D9DAE1E2E3E4E5E6E7E8E9EAF1"x
  196.                    Gd = Gd || "F2F3F4F5F6F7F8F9FAFFC4001F0100030101010101010101010000000000000102030405060708090A0BFFC400B5110002010204040304070504040001027700"x
  197.                    Gd = Gd || "0102031104052131061241510761711322328108144291A1B1C109233352F0156272D10A162434E125F11718191A262728292A35363738393A43444546474849"x
  198.                    Gd = Gd || "4A535455565758595A636465666768696A737475767778797A82838485868788898A92939495969798999AA2A3A4A5A6A7A8A9AAB2B3B4B5B6B7B8B9BAC2C3C4"x
  199.                    Gd = Gd || "C5C6C7C8C9CAD2D3D4D5D6D7D8D9DAE2E3E4E5E6E7E8E9EAF2F3F4F5F6F7F8F9FAFFDA000C03010002110311003F00EA8F4C7F5EB480FEA7EB4B9EC3A7F3A68F"x
  200.                    Gd = Gd || "7F5AE0351CDC727B52F3EF487EEF5C669060FB669801F638A43EDC7D29DCF6CF1FAD338E9FE714810BF4FE5463818A5C7AD07FCE680100E7BE6971C50073C504"x
  201.                    Gd = Gd || "F5FCF14007E148DD3EB476CFA518E4FAD31863F1FC697B67AD07B633F5EB40E3F950210FA75A3B6073487D0F6A76290C701900EE34B8FF0068D33E5EE133EF8A"x
  202.                    Gd = Gd || "3E5F48FF004A0403AE33EC7DE91863AD3BA50DC138ED400646382452745C1E3DA9474A3D47AF230698010327EB4831F97A53BAE7B9A4F50734009D08F6F4340E"x
  203.                    Gd = Gd || "C38FF3FE7FCE2827BFE3474C8A4020E7FF00D7413F5A0E718A39FCE8181E31D6957A0E79FEB4DFBC78FC7E94FEB9CD00267B83450738EFF8D1F4CFF85310DEA4"x
  204.                    Gd = Gd || "7A7FFAA9FD8E7EB4D1CF27DC9A7679F7A40C307FCB1A307FCB1A0EDCF3B3F1349F2FFD33FCE90C53C1EB430E08EBC51D7A0CD29E991F81A6489D4648E3DFB50F"x
  205.                    Gd = Gd || "91CF51DF8A0633C7AD29C103A7F8D3010E3F3EBCFE947BF1F87142E718EFD2823BFAF7A0043D7918F5E293B1ED4BDE8EDD3AFEB4860172471F95230F6A51CE3B"x
  206.                    Gd = Gd || "D008C924738A004C055009007E59A77A1073E8453422F5DA334E38C7414C06FE1DBFCFF9F7A4EA694F0A739F53DA954638E4FAFBD2180181F4A39CE3D297E872"x
  207.                    Gd = Gd || "7B51D0E71C0E9DA98878E9C1A5A41D052D22461191D73F5A39F7A3B6463F3A147FF5B0298C6F43D3BFBD3CE3B914C2006FCB38A78C91CF51C74A0191FDD39EDD"x
  208.                    Gd = Gd || "3AF4A7679E4FE348DF4F5F6A4C1C7078F7A07B8E3FCFD6A3273D2948C9E703D69DDF8C7A74A43D86FCDD31EBFE45380C703F0A003B7DC7B52F7A04C17A0EF41E"x
  209.                    Gd = Gd || "9D7DFF00CFF9ED40FD683EC4714C4358608ED4F1DBFC79A8C0CB0C71E840A793C11F9E290D81FF0023AE682319F5EBE941CE79E3FCFF009FCA83E94C0367B2FE"x
  210.                    Gd = Gd || "546CF65FFBE694370393F91A5DDEE7F2353A86A275C0FC8D03AFBD03393CFE9411F974E954211B239EF4AA4607B7F2A186571F5A4539C13400118FE5D2900C73"x
  211.                    Gd = Gd || "8C1F5C53B041CD2631EDF87F4A003A11F5FCE9A79CE7AE314FE9DA8208CF2690C68C60FA03F952FD051DCFB52FB77F4A60341E7F1F5A33C5073CFF005A46CF41"x
  212.                    Gd = Gd || "F9FA5200519FC79A5CFF0017E39A518CF5F7CD37AB0F5C5002AF5E47B6334BDF3E9EF4743D4F1EB40EDC7E06800D9ECBF88A367B2FE54F1D075A5FC695857630"x
  213.                    Gd = Gd || "003AF4E94374F7A0F078CFE1C9FF003D68E0FA63DAA8051C83C77E94DC9F5FC69C324679C1A69E09A005C0E38181CF1474F63475A07BFB50007D874A3DF1F4CD"x
  214.                    Gd = Gd || "1D31914631F5FA50027AF1D3D697BD3475FE5467A1A0620C64E3F0F5A1467E9D0507201FD29CBD7DF1F4CD200246723BFEB40C807D282704907FFAF48A06D03B"x
  215.                    Gd = Gd || "FF002A6029EB81D7A7AFF9FF00F5D28E87D29BF5FF003EB4BCE3DFA5020CBF6E9DBFCE68CBFA7F9FCEA418C0EB47E7482E46C78FC7D69C3B8F7F5A693D726947"x
  216.                    Gd = Gd || "D3F034C017AFE3C50C7A11FCE819CF1CD0F90339C1F5A00076E3DA93A67B63F4A383DBAFE3FE7AD1E94006724F4E7D6941E9D79FD69BD31EA28EE7BE281D83FC"x
  217.                    Gd = Gd || "2918F3C9E68E849CFBE69ADB8F4E948685CF3D07FF005AA45E9C77A880F9BF0A90741C1E298981E7F13CD0D9200F5A69EA31D852FF001631FF00D7A0050781F4"x
  218.                    Gd = Gd || "A3F8BA7E14038EFF00FD7A17393400F1D38E94BCD203C0E697F1A4491FAFD7F2A518C7F8534F6F7FF1A72F3CFBFF005A362843C1CF7EF4ADCAF18FAD27F101EF"x
  219.                    Gd = Gd || "8FD2947271DF9E6988693EBE9EB413DCF7F6EB4A07031DCE29806E3C719FF3FD690C70A43D474FA9A53D33C7209A461EE7B918FAD031A0F3C1E0528E9F8D07E5"x
  220.                    Gd = Gd || "623D3FFD74F29819A0189DF9EB4BED8CF3DE82B861838EDC0A43C283DBD3F0CD31013D49FF0023349D339C7B8A31918F4FF1C500FC99F63400EEC7FC2917BFD7"x
  221.                    Gd = Gd || "B76A1B8C8C0E067FCFE748BE9EFF00E3FE1400EE7FBADF9FFF005E8E7FBADF9FFF005E955015079E47AD2EC1EFF9D166173FFFD9"x
  222.  
  223.                    <$REXX_MAKE_LOCAL_GRAPHIC DATAVAR="GD" IMGNAME='<$FTPLIKE_BODY_BG_IMG>'>
  224.            #DefineRexx
  225.  
  226.            ;--- If user did not supply background color, use matching one ---
  227.            #ifndef FTPLIKE_BODY_BG_COLOR
  228.                    #define FTPLIKE_BODY_BG_COLOR #FFFFC6
  229.            #endif
  230.    #endif
  231.    #ifndef FTPLIKE_BODY_BG_COLOR
  232.            #define FTPLIKE_BODY_BG_COLOR         ;;Browser default background color
  233.    #endif
  234.    #ifndef FTPLIKE_BODY_TAG
  235.            ;--- Combine components to give overall body tag -----------------
  236.            #define FTPLIKE_BODY_TAG                                      \
  237.                    <BODY                                                -\
  238.                        #if ["<$FTPLIKE_BODY_BG_IMG>" <> '']             -\
  239.                            <?Space>BACKGROUND="<$FTPLIKE_BODY_BG_IMG>"  -\
  240.                        #endif                                           -\
  241.                        #if ["<$FTPLIKE_BODY_BG_COLOR>" <> '']           -\
  242.                            <?Space>BGCOLOR="<$FTPLIKE_BODY_BG_COLOR>"   -\
  243.                        #endif                                           -\
  244.                        #if ["<$FTPLIKE_BODY_LINK_COLOR>" <> '']         -\
  245.                            <?Space>LINK="<$FTPLIKE_BODY_LINK_COLOR>"    -\
  246.                        #endif                                           -\
  247.                        #if ["<$FTPLIKE_BODY_ALINK_COLOR>" <> '']        -\
  248.                            <?Space>ALINK="<$FTPLIKE_BODY_ALINK_COLOR>"  -\
  249.                        #endif                                           -\
  250.                        #if ["<$FTPLIKE_BODY_VLINK_COLOR>" <> '']        -\
  251.                            <?Space>VLINK="<$FTPLIKE_BODY_VLINK_COLOR>"  -\
  252.                        #endif                                           -\
  253.                        <$FTPLIKE_BODY_ATTR_OTHER  $$SPCPLUS>            -\
  254.                    >
  255.    #endif
  256.    #ifndef FTPLIKE_START_HTML_PAGE
  257.            #define FTPLIKE_START_HTML_PAGE                           \
  258.                    <!-- Real Directory "<$FTPLIKE_DIRECTORY>" -->   %\
  259.                    <HTML>                                           %\
  260.                    <HEAD>                                           %\
  261.                       <META NAME="GENERATOR" CONTENT="FTPLIKE.IH <$VERSION_FTPLIKE_IH> macros for PPWIZARD <?Version>, free tool by <?PpwizardAuthor> (<?PpwizardHomePage>)"> %\
  262.                       <TITLE><$FTPLIKE_DISPLAY_DIR></TITLE>         %\
  263.                       <$FTPLIKE_EXTRA_HEAD_TAGS>                    -\
  264.                       <$FTPLIKE_HEAD_STYLE_TAGS>                    -\
  265.                    </HEAD>                                          %\
  266.                    <$FTPLIKE_BODY_TAG>                              %\
  267.                    <$FTPLIKE_HEADER Title=^<$FTPLIKE_DISPLAY_DIR>^> %\
  268.                    <?NewLine>
  269.    #endif
  270.  
  271.    ;--- Define some stubs (you can add comments like "no directories found" etc) ---
  272.    #ifndef FTPLIKE_START_PAGE_AFTER_TITLE
  273.            #define FTPLIKE_START_PAGE_AFTER_TITLE           \
  274.                    <$FTPLIKE_HANDLE_DIRKEY_DIRTEXT>
  275.    #endif
  276.    #ifndef FTPLIKE_BETWEEN_DIRS_AND_FILES
  277.            #define FTPLIKE_BETWEEN_DIRS_AND_FILES
  278.    #endif
  279.    #ifndef FTPLIKE_END_PAGE_ABOVE_FOOTER
  280.            #define FTPLIKE_END_PAGE_ABOVE_FOOTER
  281.    #endif
  282.  
  283.    ;--- Define START OF files -----------------------------------------------
  284.    #ifndef FTPLIKE_BEFORE_ALL_FILES
  285.            #define FTPLIKE_BEFORE_ALL_FILES                 \
  286.                    <CENTER>                                %\
  287.                    <TABLE BORDER=5 CELLPADDING=10>
  288.    #endif
  289.    #ifndef FTPLIKE_BEFORE_ALL_DIRS
  290.            #define FTPLIKE_BEFORE_ALL_DIRS                       \
  291.                    <CENTER>                                     %\
  292.                    <TABLE BORDER=0 CELLSPACING=5 CELLPADDING=0>
  293.    #endif
  294.  
  295.    ;--- Parent directory handling -------------------------------------------
  296.    #ifndef FTPLIKE_GENERATE_DOT_DOT
  297. ;**      CommentBlock  /* (Saturday 05/02/2000, 18:17:34, by Dennis_Bareis) */
  298. ;**+--------------------------------------------------------------------------
  299. ;**|           #define FTPLIKE_GENERATE_DOT_DOT                   \
  300. ;**|                   <TR><TD><A HREF="{$URL}">..</A></TD></TR>
  301. ;**+--------------------------------------------------------------------------
  302. ;**                    /* (Saturday 05/02/2000, 18:17:34, by Dennis_Bareis) */
  303.  
  304.    #define FTPLIKE_GENERATE_DOT_DOT                           \
  305.            <TR>                                              -\
  306.                <TD>                                          -\
  307.                    <A HREF="{$URL}">                         -\
  308.                       <$FTPLIKE_MINI_DOT_DOT_IMG_TAG>        -\
  309.                    </A>                                      -\
  310.                </TD>                                         -\
  311.                <TD><A HREF="{$URL}">..</A></TD>              -\
  312.                <TD><A HREF="{$URL}">back to parent</A></TD>  -\
  313.            </TR>
  314.  
  315.  
  316.  
  317.    #endif
  318.  
  319.    ;--- How to convert shoty part of "FtpFile" to a "descriptive" version ---
  320.    #ifndef FTPLIKE_GET_SHORT_DESC
  321.        #if ['<?OpSys>' = 'OS/2']
  322.            ;--- This is OS/2 (may have better "name") -----------------------
  323.            #evaluate   ""  "call RxFuncAdd  'SysGetEA', 'RexxUtil', 'SysGetEA'"
  324.            #DefineRexx 'FTPLIKE_GET_SHORT_DESC'
  325.                ;--- Long name is stored in OS/2 Extended Attributes ------------
  326.                FtpShortD = '';
  327.                if  SysGetEA(FtpFile, ".LONGNAME", "FtpShortD") <> 0 then
  328.                    FtpShortD = '';
  329.                else
  330.                    FtpShortD = substr(FtpShortD, 5);    ;;Drop EA Type info
  331.                if  FtpShortD = '' then                  ;;Play safe!
  332.                    FtpShortD = FtpShortR;               ;;Use what we have!
  333.                else
  334.                    FtpShortD = ReplaceString(FtpShortD, '0D0A'x, '<BR>');
  335.            #DefineRexx
  336.        #else
  337.            ;--- Not OS/2 (can't do anything) ------------------------------------
  338.            #define FTPLIKE_GET_SHORT_DESC  FtpShortD = FtpShortR
  339.        #endif
  340.    #endif
  341.  
  342.    ;--- Determine how we create a valid rexx variable name from a "key" -----
  343.    #DefineRexx 'C2X'
  344.        #ifndef FTPLIKE_DONT_USE_C2X
  345.            ;--- Use c2x() (doubles key size, max variable length=250 under OS/2's rexx) ---
  346.            {$ResultVar} = c2x({$KeyVar});
  347.        #elseif
  348.            ;--- Use a slower routine that doesn't expand as much! -----------
  349.            ValidRexxChars = xrange('A', 'Z') || xrange('a', 'z') || xrange('0', '9') || '!_';   ;;Don't include '?' as used for code below!
  350.            Stuff          = {$KeyVar};
  351.            InvPos         = verify(Stuff, ValidRexxChars);
  352.            do  while InvPos <> 0
  353.                ;--- We have found an invalid character ----------------------
  354.                Stuff = left(Stuff, InvPos-1) || '?' || c2x(substr(Stuff, InvPos, 1)) || substr(Stuff, InvPos+1);
  355.  
  356.                ;--- Look for next invalid character -------------------------
  357.                InvPos = verify(Stuff, ValidRexxChars,, InvPos+3);
  358.            end;
  359.  
  360.            ;--- Set result --------------------------------------------------
  361.            {$ResultVar} = Stuff;
  362.        #endif
  363.    #DefineRexx
  364.  
  365.  
  366.    ;--- Gain access to "special" directory informtion -----------------------
  367.    #DefineRexx  FTPLIKE_POINT2_EXTRA_DIR_INFO
  368.        ;--- Get access to any info for this directory ---------------
  369.        #if ['<?OpSys>' = 'UNIX']
  370.            FtpDirCode = {$DIRECTORY};              ;;Unix is case sensitive
  371.        #else
  372.            FtpDirCode = translate({$DIRECTORY});   ;;Make upper case
  373.        #endif
  374.        FtpDirCode = FtpDirCode || '<?DirSlash>'; ;;Need code to have ending '\';
  375.        <$c2x ResultVar="KeyCode" KeyVar="FtpDirCode">
  376.        FtpKey     = 'FtpDir2Slot.!' || KeyCode;
  377.        if  RexxVarDefined(FtpKey) then
  378.            DirStore = _valueG(FtpKey);
  379.        else
  380.            DirStore = '';
  381.    #DefineRexx
  382.  
  383.    ;--- Point to the base directories Info ----------------------------------
  384.    #evaluate ^^ ~<$FTPLIKE_POINT2_EXTRA_DIR_INFO DIRECTORY=^'<$FTPLIKE_DIRECTORY $$SQx2>'^>~
  385.  
  386.    ;--- How to handle a directory's name ------------------------------------
  387.    #ifndef FTPLIKE_GENERATE_HTML_FOR_DIR_TREE
  388.            #DefineRexx  FTPLIKE_GET_DIR_HTMLNAME     ;;User can "name" a directory's html
  389.                ;--- Get access to any info for this directory ---------------
  390.                <$FTPLIKE_POINT2_EXTRA_DIR_INFO DIRECTORY="FtpDir">
  391.  
  392.                ;--- Now see if alias specified for this directory -----------
  393.                FtpKey = DirStore || 'ALIAS';
  394.                if  RexxVarDefined(FtpKey) & RealDirTree = 'Y' then
  395.                    FtpDirId = '<$FTPLIKE_NEWHTML_PREFIX>' || _valueG(FtpKey);     ;;Alias is basis for filename
  396.                else
  397.                do
  398.                    ;--- No alias. Just base on directory name ---------------
  399.                    #ifndef FTPLIKE_USE_LONG_FILENAMES
  400.                        FtpDirId = GetId('FTPLIKE', 'MAXCHARS', '<$FTPLIKE_NEWHTML_PREFIX>' || FtpShortD);
  401.                    #elseif
  402.                        #if ['<$FTPLIKE_USE_LONG_FILENAMES>' = '']
  403.                            FtpDirId = GetId('FTPLIKE', '2_',       '<$FTPLIKE_NEWHTML_PREFIX><$FTPLIKE_DISPLAY_DIR $$SQx2>/' || FtpShortD);
  404.                        #elseif
  405.                            FtpDirId = GetId('FTPLIKE', 'MAXCHARS', '<$FTPLIKE_NEWHTML_PREFIX><$FTPLIKE_DISPLAY_DIR $$SQx2>/' || FtpShortD,, '<$FTPLIKE_USE_LONG_FILENAMES>');
  406.                        #endif
  407.                    #endif
  408.                end;
  409.  
  410.                ;--- Make sure case is OK ------------------------------------
  411.                FtpDirId = EnsureFileHasCorrectCase(FtpDirId);
  412.  
  413.                ;--- Need as ppwizard variable -------------------------------
  414.                call MacroSet "FtpDirId", FtpDirId, 'Y';
  415.            #DefineRexx
  416.            #DefineRexx  FTPLIKE_UPDATE_DEFAULT_DIR_INFO   ;;Default info saved, can now modify for this dir tree!
  417.                ;--- User supply any directory info? -------------------------
  418.                if  DirStore <> '' then
  419.                do
  420.                    ;--- User supply background for this directory TREE? -----
  421.                    FtpKey = DirStore || 'BGIMAGE';
  422.                    if  RexxVarDefined(FtpKey) then
  423.                        call MacroSet "FTPLIKE_BODY_BG_IMG", _valueG(FtpKey), 'Y';
  424.                    FtpKey = DirStore || 'BGCOLOR';
  425.                    if  RexxVarDefined(FtpKey) then
  426.                        call MacroSet "FTPLIKE_BODY_BG_COLOR", _valueG(FtpKey), 'Y';
  427.  
  428.                    ;--- New mini icon for folder/directory display ----------
  429.                    FtpKey = DirStore || 'DIRICON';
  430.                    if  RexxVarDefined(FtpKey) then
  431.                        call MacroSet "FTPLIKE_MINI_DIR_IMG_TAG", _valueG(FtpKey), 'Y';
  432.  
  433.                    ;--- User supply other BODY tag info? --------------------
  434.                    FtpKey = DirStore || 'LINKCOLOR';
  435.                    if  RexxVarDefined(FtpKey) then
  436.                        call MacroSet "FTPLIKE_BODY_LINK_COLOR",  _valueG(FtpKey), 'Y';
  437.                    FtpKey = DirStore || 'ALINKCOLOR';
  438.                    if  RexxVarDefined(FtpKey) then
  439.                        call MacroSet "FTPLIKE_BODY_ALINK_COLOR", _valueG(FtpKey), 'Y';
  440.                    FtpKey = DirStore || 'VLINKCOLOR';
  441.                    if  RexxVarDefined(FtpKey) then
  442.                        call MacroSet "FTPLIKE_BODY_VLINK_COLOR", _valueG(FtpKey), 'Y';
  443.                    FtpKey = DirStore || 'BODYOTHER';
  444.                    if  RexxVarDefined(FtpKey) then
  445.                        call MacroSet "FTPLIKE_BODY_ATTR_OTHER",  _valueG(FtpKey), 'Y';
  446.                end;
  447.            #DefineRexx
  448.            #define FTPLIKE_GENERATE_HTML_FOR_DIR_TREE                       \
  449.                    ;--- Want to know what parent is --------               -\
  450.                    #if <?OutputLevel> = FtpStartLevel                      -\
  451.                        #define+ ParentHtml ""       ;;None!                -\
  452.                    #endif                                                  -\
  453.                    <$MacroPush Macro='ParentHtml'>  ;;Save Parent          -\
  454.                    #evaluate+   ^ParentHtml^ ^ToLowerCase(_filespec('name', '<?OutputFile>'))^ -\
  455.                                                                            -\
  456.                    ;--- Start HTML page for new dir ---                    -\
  457.                    #output "<$FtpDirId>.<$FTPLIKE_HTML_EXTN>"              -\
  458.                       ;--- "PUSH" some values ---                          -\
  459.                       <$MacroPush Macro='InDirTable'>                      -\
  460.                       <$MacroPush Macro='FTPLIKE_DIRECTORY'>               -\
  461.                       <$MacroPush Macro='FTPLIKE_DIRECTORY_WEB'>           -\
  462.                       <$MacroPush Macro='FTPLIKE_DISPLAY_DIR'>             -\
  463.                       <$MacroPush Macro='FtpDirId'>                        -\
  464.                       #RexxVar    PUSH  FtpShortR FtpShortD FtpDir         -\
  465.                                                                            -\
  466.                       ;--- Create HTML contents ---                        -\
  467.                       #option    PUSH DefineMacroReplace=ON                -\
  468.                       #define+   FTPLIKE_DIRECTORY              <??FtpDir> -\
  469.                       #evaluate+ FTPLIKE_DISPLAY_DIR            ^ReplaceString('<$FTPLIKE_DISPLAY_DIR $$SQx2>/' || FtpShortD, '//', '/')^ -\
  470.                       #define+   FTPLIKE_DIRECTORY_WEB          <$FTPLIKE_DIRECTORY_WEB>/<??FtpShortR>                                    -\
  471.                       #option    POP                                       -\
  472.                       #include   "FTPLIKE.ih"                              -\
  473.                                                                            -\
  474.                       ;--- "POP"  some values ---                          -\
  475.                       #RexxVar   POP  FtpShortR FtpShortD FtpDir           -\
  476.                       <$MacroPop Macro='FtpDirId'>                         -\
  477.                       <$MacroPop Macro='FTPLIKE_DISPLAY_DIR'>              -\
  478.                       <$MacroPop Macro='FTPLIKE_DIRECTORY_WEB'>            -\
  479.                       <$MacroPop Macro='FTPLIKE_DIRECTORY'>                -\
  480.                       <$MacroPop Macro='InDirTable'>                       -\
  481.                    #output                                                 -\
  482.                    <$MacroPop    Macro='ParentHtml'>  ;;Restore Parent
  483.    #endif
  484.  
  485.    ;--- Code related to mini icon in front of folders -----------------------
  486.    #ifndef FTPLIKE_MINI_DIR_IMG_TAG
  487.        ;--- Need to define the HTML IMG TAG ---------------------------------
  488.        #define FTPLIKE_MINI_DIR_IMG_TAG  <IMG SRC="mini_dir.gif" ALIGN="MIDDLE" ALT="*" TITLE="" BORDER=0 WIDTH=14 HEIGHT=11 VSPACE=3>
  489.  
  490.        ;--- Now create the Graphic (needed for the above html) --------------
  491.        #DefineRexx ''
  492.                ;--- Load the graphic data -----------------------------------
  493.                Gd =       "4749463839610E000B00810000FFFFFF000000C0C0C0FFFF0021F90401000000002C000000000E000B000002"x
  494.                Gd = Gd || "23048268BB31F0466026D93B1DDC71AB0E4248187EDC2969A437AD1122C4F21C67185600003B"x
  495.  
  496.                <$REXX_MAKE_LOCAL_GRAPHIC DATAVAR="GD" IMGNAME='mini_dir.gif'>
  497.        #DefineRexx
  498.    #endif
  499.    #ifndef FTPLIKE_MINI_DOT_DOT_IMG_TAG
  500.        #option PUSH DefineMacroReplace=ON
  501.        #define FTPLIKE_MINI_DOT_DOT_IMG_TAG <$FTPLIKE_MINI_DIR_IMG_TAG>
  502.        #option POP
  503.    #endif
  504.    #define FTPLIKE_MINI_DIR_LINK                                           \
  505.            <TD VALIGN="TOP">                                              -\
  506.                <$FTPLIKE_LINK2DIR Url="<$FtpDirId>.<$FTPLIKE_HTML_EXTN>"> -\
  507.                <$FTPLIKE_MINI_DIR_IMG_TAG>                                -\
  508.                </A>                                                       -\
  509.            </TD>
  510.  
  511.    ;--- How to handle (display) directory details ---------------------------
  512.    #ifndef FTPLIKE_TEXT_FILE
  513.            #define FTPLIKE_TEXT_FILE   file
  514.    #endif
  515.    #ifndef FTPLIKE_TEXT_FILES
  516.            #define FTPLIKE_TEXT_FILES  files
  517.    #endif
  518.    #ifndef FTPLIKE_TEXT_DIR
  519.            #define FTPLIKE_TEXT_DIR    dir
  520.    #endif
  521.    #ifndef FTPLIKE_TEXT_DIRS
  522.            #define FTPLIKE_TEXT_DIRS   dirs
  523.    #endif
  524.    #ifndef FTPLIKE_DIR_HANDLER
  525.            #define FTPLIKE_DIR_HANDLER                                             \
  526.                    <TR><$FTPLIKE_MINI_DIR_LINK>                                   -\
  527.                    <TD VALIGN=TOP>                                                -\
  528.                        ;--- Link to HTML "DIRECTORY" page we will create ---      -\
  529.                        <$FTPLIKE_LINK2DIR Url="<$FtpDirId>.<$FTPLIKE_HTML_EXTN>"> -\
  530.                        <??FtpShortD>   ;;Just output short name                   -\
  531.                        </A>                                                       -\
  532.                    </TD>                                                          -\
  533.                    <TD  VALIGN=TOP>                                               -\
  534.                        ;--- How summary of folder contents -----------------      -\
  535.                        <??FtpSubdirTotalFileCnt><?Space>                          -\
  536.                        #if [FtpSubdirTotalFileCnt = 1]           ;;(s)            -\
  537.                            <$FTPLIKE_TEXT_FILE>                                   -\
  538.                        #elseif                                                    -\
  539.                            <$FTPLIKE_TEXT_FILES>                                  -\
  540.                        #endif                                                     -\
  541.                        #if FtpSubdirTotalDirCnt <> 0                              -\
  542.                            <?Space>and <??FtpSubdirTotalDirCnt><?Space>           -\
  543.                            #if [FtpSubdirTotalDirCnt = 1]        ;;(s)            -\
  544.                                <$FTPLIKE_TEXT_DIR>                                -\
  545.                            #elseif                                                -\
  546.                                <$FTPLIKE_TEXT_DIRS>                               -\
  547.                            #endif                                                 -\
  548.                        #endif                                                     -\
  549.                    </TD>                                                          -\
  550.                    </TR>
  551.  
  552.                #endif
  553.  
  554.  
  555.    ;--- How to handle a file's name -----------------------------------------
  556.    #ifndef FTPLIKE_FILE_LEFT_SIDE_DISPLAY
  557.            #define FTPLIKE_FILE_LEFT_SIDE_DISPLAY                         \
  558.                    <TR>                            ;;Start New File row  %\
  559.                    <TD ALIGN=RIGHT VALIGN="TOP">   ;;Start filename cell %\
  560.                        <$FTPLIKE_LINK2FILE Url="<??eURL>">               -\
  561.                           <??FtpShortD>            ;;Normally shortname  -\
  562.                        </A>                                              %\
  563.                    </TD>                           ;;End cell
  564.    #endif
  565.    #ifndef FTPLIKE_FILE_HANDLER
  566.            #define FTPLIKE_FILE_HANDLER                                     \
  567.                    #evaluate '' ^FtpShortR = _filespec('name', FtpFile); <$FTPLIKE_GET_SHORT_DESC>^             -\
  568.                    #evaluate '' ^eURL = UrlEncode('<$FTPLIKE_DIRECTORY_WEB $$SQx2>/' || FtpShortR, 'TO%', ' ')^ -\
  569.                    <$FTPLIKE_FILE_LEFT_SIDE_DISPLAY>
  570.    #endif
  571.  
  572.    ;--- How to handle a file's details --------------------------------------
  573.    #ifndef FTPLIKE_SHOW_FILE_TIME
  574.            #define FTPLIKE_SHOW_FILE_TIME                    \
  575.                    <??FtpDay> <??FtpMon> <??FtpYear>         \
  576.                    <??FtpHour>:<??FtpMinute>:<??FtpSecond>
  577.    #endif
  578.    #ifndef FTPLIKE_ADD_FILE_SIZE_AFTER_TIME
  579.            #define FTPLIKE_ADD_FILE_SIZE_AFTER_TIME  , <??FtpSize> bytes
  580.    #endif
  581.    #ifndef FTPLIKE_FILE_DETAILS_HANDLER
  582.            #define FTPLIKE_FILE_DETAILS_HANDLER                                                       \
  583.                    #evaluate '' ^<$FTPLIKE_FILE_ATTRIBUTE_HANDLER_REXX>;<$FTPLIKE_GET_FILE_COMMENT>^ -\
  584.                    <TD ALIGN=LEFT>     ;;Start file details cell           %\
  585.                        <$FTPLIKE_SHOW_FILE_TIME>                           -\
  586.                        <$FTPLIKE_ADD_FILE_SIZE_AFTER_TIME>                 %\
  587.                        <$FTPLIKE_ADD_FILE_COMMENT>                         -\
  588.                    </TD>               ;;End cell                          %\
  589.                    </TR>               ;;End this File row
  590.    #endif
  591.  
  592.  
  593.    ;--- Define END OF files -------------------------------------------------
  594.    #ifndef FTPLIKE_AFTER_ALL_FILES
  595.            #define FTPLIKE_AFTER_ALL_FILES  </TABLE></CENTER>
  596.    #endif
  597.    #ifndef FTPLIKE_AFTER_ALL_DIRS
  598.            #define FTPLIKE_AFTER_ALL_DIRS   </TABLE></CENTER><P>
  599.    #endif
  600.  
  601.    ;--- Define ATTRIBUTE Handler (date, time, size etc) ---------------------
  602.    #ifndef FTPLIKE_FILE_ATTRIBUTE_HANDLER_REXX
  603.            #define FTPLIKE_FILE_ATTRIBUTE_HANDLER_REXX                     \
  604.                    FtpTimeStamp = GetFileTimeStamp(FtpFile);              -\
  605.                    FtpSize      = stream(FtpFile, 'c', 'query size');     -\
  606.                    FtpSize      = AddCommasToDecimalNumber(FtpSize);      -\
  607.                    parse var FtpTimeStamp FtpYear +4 FtpMonth +2 FtpDay +2 FtpHour +2 FtpMinute +2 FtpSecond;      -\
  608.                    FtpMon       = substr('JAN FEB MAR APR MAY JUN JUL AUG SEP OCT NOV DEC', ((FtpMonth-1)*4)+1, 3);
  609.    #endif
  610.  
  611.  
  612.    ;--- Process this directory? (no filter by default) ----------------------
  613.    #ifndef FTPLIKE_DO_THIS_DIR
  614.            #define FTPLIKE_DO_THIS_DIR       ;;Generate for all directories
  615.    #endif
  616.  
  617.    ;--- Process this file? (by default no ".diz" files!) --------------------
  618.    #ifndef FTPLIKE_DO_THIS_FILE
  619.            #DefineRexx FTPLIKE_DO_THIS_FILE_REXX
  620.                    ;--- Check Extension -------------------------------------
  621.                    DotPos = lastpos('.', FtpFile);
  622.                    if  DotPos <> 0 then
  623.                    do
  624.                        ;--- Have an extension, extract it ---
  625.                        FtpFileExtn = translate(substr(FtpFile, DotPos+1));
  626.  
  627.                        ;--- See if "special" extn -----------
  628.                        if  FtpFileExtn = "DIZ"  then
  629.                            FtpDoThisFile = 'N';    ;;Don't want in listing!
  630.                    end;
  631.  
  632.                    ;--- Check if special file -------------------------------
  633.                    ThisFile = translate(_filespec('name', FtpFile));
  634.                    if  ThisFile = translate("<$FTPLIKE_CMD_FILE_DIR>") then
  635.                        FtpDoThisFile = 'N';    ;;Don't want in listing!
  636.  
  637.            #DefineRexx
  638.            #define FTPLIKE_DO_THIS_FILE                                \
  639.                    #evaluate '' ^<$FTPLIKE_DO_THIS_FILE_REXX>^
  640.    #endif
  641.  
  642.    ;--- Define "DIZ" handler ------------------------------------------------
  643.    #ifndef FTPLIKE_GET_FILE_COMMENT
  644.            #DefineRexx FTPLIKE_GET_FILE_COMMENT
  645.                    FtpDizFile     = stream(FtpFile || '.diz', 'c', 'query exists');
  646.                    if  FtpDizFile = '' then;
  647.                    do;
  648.                        ;--- Try changing extension to ".diz" ---
  649.                        FtpPos = lastpos('.', FtpFile);
  650.                        if  FtpPos <> 0 then;
  651.                            FtpDizFile = stream(left(FtpFile,FtpPos) || 'DIZ', 'c', 'query exists');
  652.                    end;
  653.                    if  FtpDizFile = '' then;
  654.                        FtpComment = '';
  655.                    else;
  656.                    do;
  657.                        ;--- Have a comment file! ---------------
  658.                        call AddInputFileToDependancyList(FtpDizFile);
  659.                        FtpComment  = charin(FtpDizFile, 1, 99999);
  660.                        call DieIfIoErrorOccurred FtpDizFile;
  661.                        CloseRc = stream(FtpDizFile, 'c', 'close');
  662.                        <$FTPLIKE_DIZ_TRANSLATION_REXX>
  663.                        FtpComment = {$Prefix=^''^} || FtpComment || {$Suffix=^''^};
  664.                    end;
  665.            #DefineRexx
  666.    #endif
  667.    #ifndef FTPLIKE_ADD_FILE_COMMENT
  668.            #define FTPLIKE_ADD_FILE_COMMENT    \
  669.                    #if [FtpComment <> '']     -\
  670.                        <HR>                   -\
  671.                    #endif                     -\
  672.                    <??FtpComment>
  673.    #endif
  674.    #ifndef FTPLIKE_HANDLE_DIRKEY_DIRTEXT
  675.            #DefineRexx REXX_FTPLIKE_HANDLE_DIRKEY_DIRTEXT
  676.                ;--- User specify Text key? ----------------------------------
  677.                FtpKey   = DirStore || 'DIRTEXT';
  678.                if  RexxVarDefined(FtpKey) then
  679.                    call ProcessNext _valueG(FtpKey);
  680.            #DefineRexx
  681.            #define FTPLIKE_HANDLE_DIRKEY_DIRTEXT                        \
  682.                    #evaluate ^^ ^<$REXX_FTPLIKE_HANDLE_DIRKEY_DIRTEXT>^
  683.    #endif
  684.  
  685.    ;--- Define "DIZ" translations -------------------------------------------
  686.    #ifndef FTPLIKE_DIZ_TRANSLATION_REXX
  687.            #define FTPLIKE_DIZ_TRANSLATION_REXX                                 \
  688.                    FtpComment = ReplaceString(FtpComment, '1A'x,       '');  ;;EOF char
  689.    ;;;;;;          FtpComment = ReplaceString(FtpComment, '0D0A0D0A'x, '0D0A'x || '<P>');
  690.    #endif
  691.  
  692.  
  693.    ;--- Define how directories are SORTED (just rexx) -----------------------------
  694.    #ifndef FTPLIKE_DIRECTORY_SORT_REXX
  695.            #DefineRexx 'FTPLIKE_DIRECTORY_SORT_REXX'
  696.                #OneLine
  697.                <$GenRexx2Sort
  698.                        COUNT=^{$ArrayName}.0^
  699.                    GREATER=^SrtGreater = {$ArrayName}.SrtIndex1.!SortKey > {$ArrayName}.SrtIndex2.!SortKey^
  700.                        SWAP=^
  701.                                SrtTemp = {$ArrayName}.SrtIndex1;
  702.                                {$ArrayName}.SrtIndex1 = {$ArrayName}.SrtIndex2;
  703.                                {$ArrayName}.SrtIndex2 = SrtTemp;
  704.  
  705.                                SrtTemp = {$ArrayName}.SrtIndex1.!Description;
  706.                                {$ArrayName}.SrtIndex1.!Description = {$ArrayName}.SrtIndex2.!Description;
  707.                                {$ArrayName}.SrtIndex2.!Description = SrtTemp;
  708.  
  709.                                SrtTemp = {$ArrayName}.SrtIndex1.!FtpShortR;
  710.                                {$ArrayName}.SrtIndex1.!FtpShortR = {$ArrayName}.SrtIndex2.!FtpShortR;
  711.                                {$ArrayName}.SrtIndex2.!FtpShortR = SrtTemp;
  712.  
  713.                                SrtTemp = {$ArrayName}.SrtIndex1.!RealDirTree;
  714.                                {$ArrayName}.SrtIndex1.!RealDirTree = {$ArrayName}.SrtIndex2.!RealDirTree;
  715.                                {$ArrayName}.SrtIndex2.!RealDirTree = SrtTemp;
  716.  
  717.                                SrtTemp = {$ArrayName}.SrtIndex1.!SortKey;
  718.                                {$ArrayName}.SrtIndex1.!SortKey = {$ArrayName}.SrtIndex2.!SortKey;
  719.                                {$ArrayName}.SrtIndex2.!SortKey = SrtTemp;
  720.                            ^
  721.                >
  722.                #OneLineEnd
  723.            #DefineRexx
  724.    #endif
  725.  
  726.    ;--- Define how files are SORTED -----------------------------------------
  727.    #ifndef FTPLIKE_FILE_SORT_REXX
  728.            #DefineRexx 'FTPLIKE_FILE_SORT_REXX'
  729.                call SortArray '{$ArrayName}'
  730.            #DefineRexx
  731.    #endif
  732.  
  733.    ;--- Load all special definition files -----------------------------------
  734.    #DefineRexx ''
  735.        ;--- Get list of alias files -----------------------------------------
  736.        FtpAlias.0 = 0;
  737.        call _SysFileTree '<$FTPLIKE_DIRECTORY $$SQx2><?DirSlash><$FTPLIKE_CMD_FILE_DIR>', 'FtpAlias', 'FOS';
  738.        call Debug 'Found ' || FtpAlias.0 || ' files matching "<$FTPLIKE_CMD_FILE_DIR>"'
  739.  
  740.        ;--- Work through list making alias -> directory mapping -------------
  741.        LongKey = 'N';
  742.        call DebugIndent 1;
  743.        do  Index = 1 to FtpAlias.0
  744.            ;--- Name of this file? Give it an "storage slot" ----------------
  745.            #if ['<?OpSys>' = 'UNIX']
  746.                FtpCmdFile.1 = FtpAlias.Index;              ;;Unix is case sensitive
  747.            #else
  748.                FtpCmdFile.1 = translate(FtpAlias.Index);   ;;Make upper case
  749.            #endif
  750.            StoreUnder = 'dirattr' || Index || '.!';
  751.            call Debug 'Processing: "' || FtpCmdFile.1 || '"'
  752.  
  753.            ;--- Map directory to "slot" (so we can retrieve info later) -----
  754.            FtpCmdFileDir = _filespec('location', FtpCmdFile.1);
  755.            <$c2x ResultVar="KeyCode" KeyVar="FtpCmdFileDir">
  756.            call _valueS "FtpDir2Slot.!" || KeyCode, StoreUnder;
  757.  
  758.            ;--- Load all fields from file -----------------------------------
  759.            call AddInputFileToDependancyList(FtpCmdFile.1);
  760.            FileIndex = 1;
  761.            LongKey   = 'N';
  762.            FtpCmdFileL.FileIndex = 0;
  763.            CloseRc = stream(FtpCmdFile.FileIndex, 'c', 'close');
  764.            call DebugIndent 1;
  765.            FtpBuffer = '';
  766.            NlChar    = d2c(10);
  767.            InLine    = ';' || ';';
  768.            do  forever
  769.                ;--- Read the next line (Anything in buffer?) ----------------
  770.                if  FtpBuffer <> '' then
  771.                do
  772.                    ;--- Get line from buffer --------------------------------
  773.                    #option PUSH AllowPack=OFF
  774.                    parse var FtpBuffer CmdLine (NlChar) FtpBuffer;
  775.                    #option POP
  776.                    ShowL = '!';
  777.                    ShowR = '!';
  778.                end;
  779.                else
  780.                do
  781.                    ;--- At EOF? -------------------------------------------------
  782.                    if  lines(FtpCmdFile.FileIndex) = 0 then
  783.                    do
  784.                        ;--- At EOF ----------------------------------------------
  785.                        CloseRc = stream(FtpCmdFile.FileIndex, 'c', 'close');
  786.                        if  FileIndex = 1 then
  787.                            leave;                     ;;At EOF on main file
  788.                        else
  789.                        do
  790.                            FileIndex = FileIndex - 1; ;;At EOF of included file
  791.                            call DebugIndent -1;
  792.                        end;
  793.                    end;
  794.  
  795.                    ;--- Read the line from the file -------------------------
  796.                    FtpCmdFileL.FileIndex = FtpCmdFileL.FileIndex + 1;
  797.                    CmdLine = strip(ReplaceString(linein(FtpCmdFile.FileIndex), d2c(9), ' '));
  798.                    ShowL = '[';
  799.                    ShowR = ']';
  800.                end;
  801.                call Debug ShowL || FtpCmdFileL.FileIndex || ShowR || ': ' || CmdLine;
  802.  
  803.                ;--- Is the line a comment? ----------------------------------
  804.                if  CmdLine = '' | left(CmdLine, 1) = ';' then
  805.                    iterate;
  806.  
  807.                ;--- Does the line have an inline comment? -------------------
  808.                LineComPos = lastpos(InLine, CmdLine);
  809.                if  LineComPos <> 0 then
  810.                do
  811.                    ;--- Have an inline comment ------------------------------
  812.                    CmdLine = strip(left(CmdLine, LineComPos-1));
  813.                end;
  814.  
  815.                ;--- Handle any macros the line might contain ----------------
  816.                NowCount = ReplaceCount;
  817.                CmdLine = ReplaceMacros(CmdLine);
  818.  
  819.                ;--- Any Changes made? ---------------------------------------
  820.                if  NowCount <> ReplaceCount then
  821.                do
  822.                    ;--- Add to buffer (in front) ----------------------------
  823.                    if  FtpBuffer = '' then
  824.                        FtpBuffer = CmdLine;
  825.                    else
  826.                        FtpBuffer = CmdLine || NlChar || FtpBuffer;
  827.  
  828.                    ;--- Thats all for now -----------------------------------
  829.                    iterate;
  830.                end;
  831.  
  832.                ;--- See if #include command ---------------------------------
  833.                if  translate(word(CmdLine, 1)) = "#INCLUDE" then
  834.                do
  835.                    ;--- Including new file ----------------------------------
  836.                    call DebugIndent 1;
  837.                    Rest = subword(CmdLine, 2);
  838.                    if  length(Rest) < 3 | left(Rest, 1) <> '"' | right(Rest, 1) <> '"' then
  839.                        CryAndDie('Incorrectly nested #include command in "' || FtpCmdFile.FileIndex || '"', 'The command was "' || CmdLine || '"');
  840.                    FileIndex = FileIndex + 1;
  841.                    FtpCmdFile.FileIndex = substr(Rest, 2, length(Rest)-2);
  842.                    CloseRc = stream(FtpCmdFile.FileIndex, 'c', 'close');
  843.                    iterate;
  844.                end;
  845.  
  846.                ;--- Are we "collecting" a mult line key? --------------------
  847.                if  LongKey = 'N' then
  848.                do
  849.                    ;--- Not collecting yet, is this the start? --------------
  850.                    if  left(CmdLine, 1) = '>' then
  851.                    do
  852.                        ;--- Start of collection -----------------------------
  853.                        parse value strip(substr(CmdLine,2)) with ValueVar RexxExpression;
  854.                        ValueVar = translate(ValueVar);
  855.                        if  RexxExpression = '' then
  856.                            ValueSep = d2c(0);
  857.                        else
  858.                            interpret 'ValueSep = ' || RexxExpression;
  859.                        ItsValue = '';
  860.                        EndsWith = '<' || ValueVar;
  861.                        LongKey  = 'Y';
  862.                        iterate;
  863.                    end;
  864.  
  865.                    ;--- Get value into rexx variable ------------------------
  866.                    parse var CmdLine ValueVar'='ItsValue;
  867.                    ValueVar = translate(strip(ValueVar));
  868.                    ItsValue = strip(ItsValue);
  869.  
  870.                    ;--- Alias variable is a special case --------------------
  871.                    if  ValueVar = "ALIAS" then
  872.                    do
  873.                        ;--- Create Alias to directory "link" ----------------
  874.                        TheDir = _filespec('location', FtpCmdFile.FileIndex);
  875.                        if  right(TheDir, 1) = '<?DirSlash>' then
  876.                            TheDir = left(TheDir, length(TheDir)-1);
  877.                        <$c2x ResultVar="KeyCode" KeyVar="ItsValue">
  878.                        call _valueS "FtpAlias2Dir.!" || KeyCode, TheDir;
  879.                    end;
  880.                end;
  881.                else
  882.                do
  883.                    ;--- End of the block? -----------------------------------
  884.                    if  translate(CmdLine) = EndsWith then
  885.                        LongKey = 'N';
  886.                    else
  887.                    do
  888.                        ;--- Not yet finished --------------------------------
  889.                        if  ItsValue == '' then
  890.                            ItsValue = CmdLine;
  891.                        else
  892.                            ItsValue = ItsValue || ValueSep || CmdLine;
  893.                        iterate;
  894.                    end;
  895.                end;
  896.  
  897.                ;--- Save away for later (very quick access) -----------------
  898.                call _valueS StoreUnder || ValueVar, ItsValue;
  899.            end;
  900.            call DebugIndent -1;
  901.  
  902.            ;--- Finished processing the $$$ file, do some valiadtion --------
  903.            if  LongKey  = 'Y' then
  904.                CryAndDie('The multline key of "' || ValueVar || '"' in "' || FtpCmdFile.1 || '"' was not completed');
  905.        end;
  906.        call DebugIndent -1;
  907.        FtpAlias2Dir.0 = FtpAlias.0;
  908.    #DefineRexx
  909.    #ifndef  FTPLIKE_USER_DIR_ATTRIB_PUSH_CHANGE
  910.             #define FTPLIKE_USER_DIR_ATTRIB_PUSH_CHANGE   ;;Allow user to override for own directory attributes
  911.    #endif
  912.    #ifndef  FTPLIKE_USER_DIR_ATTRIB_POP
  913.             #define FTPLIKE_USER_DIR_ATTRIB_POP           ;;Allow user to override for own directory attributes
  914.    #endif
  915.  
  916.    ;--- Make sure not done again (when a directory being processed etc) -----
  917.    #define _FTPLIKE_INITIALIZED
  918. #endif
  919.  
  920. ;--- Don't need to read following comments! ---------------------------------
  921. #EOF
  922.  
  923.  
  924. ;----------------------------------------------------------------------------
  925. ;
  926. ;                    This header contains all initialization code and
  927. ;                    has been seperated so that it need not be included
  928. ;                    for every folder! These  comments have been placed
  929. ;                    at the end of the file so they don't have to be
  930. ;                    read at all.
  931. ;
  932. ;                    This allows you to create FTP like pages without
  933. ;                    having to do a lot of work.  Simply add the file
  934. ;                    to a directory will get it onto the correct HTML
  935. ;                    page.
  936. ;
  937. ;                    It would be wise to generate pages into their own
  938. ;                    directory on the off chance that this header file
  939. ;                    picks a name for a directory's file which matches
  940. ;                    one of yours!
  941. ;
  942. ;                    Note that most of the code below is tricky only
  943. ;                    because I made it generic (ie very configurable),
  944. ;                    a specific implementation would be much smaller
  945. ;                    and much much easier to write as well!
  946. ;
  947. ;                    The whole look and feel of the generated data may
  948. ;                    be modified.
  949. ;
  950. ;                    It would be simple to have your normal look and feel
  951. ;                    items such as headers, footers backgrounds etc
  952. ;                    integrated into the generated output.
  953. ;
  954. ;                    Description file support (.diz) is available for files,
  955. ;                    directories have an alternative mechanism.
  956. ;                    Note that the file can (and probably should) contain
  957. ;                    normal HTML formatting tags - by default anyway.
  958. ;                    If you have a file called "stuff.zip" this header
  959. ;                    will look for "stuff.zip.diz" and "stuff.diz".
  960. ;
  961. ;                    You should not modify the value of any definition
  962. ;                    that begins with an "_", you can modify virtually
  963. ;                    anything else.
  964. ;
  965. ;                    Note that dependancy checking does not make sense
  966. ;                    in this type of situation as files can appear simply
  967. ;                    by matching the wildcard. For this reason I do not
  968. ;                    bother with using the "#dependsOn INPUT" command for
  969. ;                    each file I process.
  970. ;
  971. ;
  972. ;                    NOT COMPLETE
  973. ;                    ~~~~~~~~~~~~
  974. ;                    This header has been hacked around a bit and could
  975. ;                    be simplified/improved, I will probably never do this
  976. ;                    because of a lack of time and the fact that it works!
  977. ;
  978. ;
  979. ;                    SUPPORTED OPERATING SYSTEMS
  980. ;                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~
  981. ;                    It is intended that all operating systems that PPWIZARD
  982. ;                    supports can also use this header, if you find that
  983. ;                    it does not work then please send me the output when
  984. ;                    you have used the "/debug" command line switch. Please
  985. ;                    also include a directory listing of the directory(s) you
  986. ;                    are processing.
  987. ;
  988. ;
  989. ;                    EXAMPLE - LINUX
  990. ;                    ~~~~~~~~~~~~~~~
  991. ;                    #define   FTPLIKE_FOLLOW_SUBDIRECTORIES
  992. ;                    #define   FTPLIKE_USE_LONG_FILENAMES
  993. ;                    #define   FTPLIKE_DIRECTORY           /home/dennis/
  994. ;                    #define   FTPLIKE_DIRECTORY_WEB       http://ftp
  995. ;                    #include  "ftplike.ih"
  996. ;
  997. ;
  998. ;                    EXAMPLE - OS/2, WINDOWS
  999. ;                    ~~~~~~~~~~~~~~~~~~~~~~~
  1000. ;                    #define   FTPLIKE_FOLLOW_SUBDIRECTORIES
  1001. ;                    #define   FTPLIKE_USE_LONG_FILENAMES   ;;Remove this definition for 8.3 names
  1002. ;                    #define   FTPLIKE_DIRECTORY            C:\TMP\ASM_MAC
  1003. ;                    #define   FTPLIKE_DIRECTORY_WEB        file:///C|TMP/ASM_MAC ;;Local testing
  1004. ;                    #include  "FTPLIKE.IH"
  1005. ;
  1006. ;
  1007. ;                    HELP WANTED
  1008. ;                    ~~~~~~~~~~~
  1009. ;                    I use "find" under linux, is there a expression that
  1010. ;                    I can pass to "-name" to display all files/directories?
  1011. ;
  1012. ;
  1013. ;
  1014. ;                    SOME PPWIZARD VARIABLES EXPLAINED
  1015. ;                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1016. ;                      FTPLIKE_CMD_FILE_DIR      (default "dirattr.$$$")
  1017. ;                          Defines the name of a control file that contains
  1018. ;                          extra information about the directory containing
  1019. ;                          it. Leading and trailing whitespace, Blank lines
  1020. ;                          and lines starting with ';' are all ignored.
  1021. ;
  1022. ;                          As usual inline comments start with ';;' and
  1023. ;                          macros are replaced.
  1024. ;
  1025. ;                          To generate multiple lines each must be seperated
  1026. ;                          by "dc2(10)", you can not use "%\" line
  1027. ;                          continuation or "<?NewLine>" or similar
  1028. ;                          definitions.  As an example:
  1029. ;
  1030. ;                             #evaluate "Eol"  "d2c(10)"
  1031. ;                             #define   LookAndFeelForOs2                  \
  1032. ;                                       BgImage = image/os2warp.jpg<$Eol> -\
  1033. ;                                       BgColor = #E0E0E0
  1034. ;
  1035. ;
  1036. ;                          This file allows you to set a key to a value,
  1037. ;                          it allows any key to be used so as to support
  1038. ;                          ones that you might wish to create and use.
  1039. ;
  1040. ;                          There are 2 types of "assignment", for a short
  1041. ;                          value that can fit on one line the following
  1042. ;                          format can be used:
  1043. ;
  1044. ;                                 Key = Value
  1045. ;
  1046. ;                          Where you need to specify longer values the
  1047. ;                          following format can be used:
  1048. ;
  1049. ;                                 >Key [Expression]
  1050. ;                                   Value Line 1
  1051. ;                                   Value Line 2
  1052. ;                                 <Key
  1053. ;
  1054. ;                          The "Expression" is a rexx expression which
  1055. ;                          evaluates to a result that is used to
  1056. ;                          separate lines, the default expression is
  1057. ;                          "d2c(0)".
  1058. ;
  1059. ;                          Standard keys are:
  1060. ;
  1061. ;                            * ALIAS
  1062. ;                              This allows you to "name" the directory.
  1063. ;                              This will refer to the directory even if
  1064. ;                              the directory is renamed or moved!
  1065. ;
  1066. ;                              The alias is also combined with the macro
  1067. ;                              "FTPLIKE_NEWHTML_PREFIX" to name the html
  1068. ;                              for safe access by external html code.
  1069. ;
  1070. ;                            * ADDDIRS
  1071. ;                              specify one or more directory names seperated
  1072. ;                              by d2c(0).
  1073. ;
  1074. ;                              Sometimes you will find a directory tree
  1075. ;                              really falls under 2 or more categories,
  1076. ;                              rather than make copies you can point to
  1077. ;                              directory trees that should be included.
  1078. ;
  1079. ;                              If a directory name starts with '@' then
  1080. ;                              what follows is a directory alias.
  1081. ;
  1082. ;                              Each of these items can be preceeded by
  1083. ;                              "|description|" to use the supplied
  1084. ;                              description rather than the directories
  1085. ;                              shortname or EA name.
  1086. ;
  1087. ;                            * DIRTEXT
  1088. ;                              Specify one or more lines of html which
  1089. ;                              describes the current category. This is
  1090. ;                              displayed at the start of the generated
  1091. ;                              page.
  1092. ;
  1093. ;                            * BGCOLOR
  1094. ;                              The color for the background of the
  1095. ;                              directory tree (for body tag), for example:
  1096. ;
  1097. ;                                  BgColor = #0000FF
  1098. ;                                  BgColor = RED
  1099. ;
  1100. ;                            * BGIMAGE
  1101. ;                              The image to use for the background of the
  1102. ;                              directory tree (for body tag).
  1103. ;
  1104. ;                            * DIRICON
  1105. ;                              Overrides the default (FTPLIKE_MINI_DIR_IMG_TAG)
  1106. ;                              image for directory min icons, example:
  1107. ;
  1108. ;                                  DirIcon = <IMG SRC="graphics/url_dir.gif" WIDTH=10 HEIGHT=10 BORDER=0>
  1109. ;
  1110. ;                            * LINKCOLOR
  1111. ;                              The link color use for the directory tree
  1112. ;                              (for body tag), example:
  1113. ;
  1114. ;                                  LINKCOLOR = #3333FF
  1115. ;
  1116. ;                            * ALINKCOLOR
  1117. ;                              The active link color
  1118. ;
  1119. ;                            * VLINKCOLOR
  1120. ;                              The visited link color
  1121. ;
  1122. ;                            * BODYOTHER
  1123. ;                              Any other body related tags not specified by other
  1124. ;                              options for the directory tree, example:
  1125. ;
  1126. ;                                  BODYOTHER = LEFTMARGIN=5 TOPMARGIN=5 MARGINWIDTH=5 MARGINHEIGHT=5
  1127. ;
  1128. ;                    SOME REXX VARIABLES EXPLAINED
  1129. ;                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1130. ;                      FtpShortR   : Current file/dir without drive/path
  1131. ;                      FtpShortD   : Descriptive version of "FtpShortR"
  1132. ;
  1133. ;----------------------------------------------------------------------------
  1134.