PPWIZARD Manual
[Bottom][Contents][Search][Prev]: PPWIZARD Extensions[Next]: HTMLPRE.IH - Converts Example Code to HTML

FTPLIKE.IH - Make "FTP" Like Listings

This header file will scan the specified directory (and optionally its subdirectories) and by default produce a FTP like set of html pages.

It is very simple for you to modify any part of the look and feel, so for example it would be simple to add your own headers, footers, backgrounds and display all information in whatever format or font you wish.

This header could also be used to automatically process photo directories producing thumbnails (with extra software) etc automatically.

Example - Creating Directory Listing

The following code is all that is required to generate a complete HTML page of all files in a single directory. Note that file descriptions are read out of ".DIZ" files if available (the DIZ files themselves are not displayed).

    ;--- Complete code to generate a HTML page for the directory "C:\TMP" ---
    #define   FTPLIKE_DIRECTORY             C:\TMP
    #define   FTPLIKE_DIRECTORY_WEB         file:///C|TMP  ;;Note: for web "downloads/tmp" might normally be more appropriate
    #define   FTPLIKE_FOLLOW_SUBDIRECTORIES
    #define   FTPLIKE_USE_LONG_FILENAMES                   ;;When generating web pages for subdirectories (default is 8.3)
    #define   FTPLIKE_HTML_EXTN             html           ;;When generating web pages for subdirectories (".htm" is default)
    #include  "FTPLIKE.IH"

Creating HTML pages from Windows URL Shortcuts or OS/2 URL Objects

I keep all my WPS URL objects off a main URL folder, I then create HTML pages from this so I can effectively access my URL objects from anywhere via the internet (pages at http://www.labyrinth.net.au/~dbareis/bookmark.htm). Different categories can have their own look and feel!

The code highly customises the main FTPLIKE functionality and so makes a very good example of what you can do.

FTPLIKE.IH

This shows the contents of the main header file (supplied with PPWIZARD) that provides the generic "FTP like" support:

;----------------------------------------------------------------------------
;     MODULE NAME:   FTPLIKE.IH
;
;         $Author:   Dennis_Bareis  $
;       $Revision:   1.14  $
;           $Date:   06 Apr 2000 18:39:40  $
;        $Logfile:   E:/DB/PVCS.IT/OS2/PPWIZARD/FTPLIKE.IHV  $
;
;     DESCRIPTION:   Please see End of the "FTPLIKEI.IH" file for
;                    details.
;----------------------------------------------------------------------------

;--- First time through? ----------------------------------------------------
#ifndef _FTPLIKE_INITIALIZED
        #define  FTPLIKE_CALLED_CORRECTLY
        #include "FTPLIKEI.IH"              ;;Perform initialization
#endif

;--- Simple processing message ----------------------------------------------
#evaluate '' ^ShortOutName = _filespec('Name', '<?OutputFile>')^
#info ^Generating <??ShortOutName> <= <$FTPLIKE_DIRECTORY>^


;--- Initialization for this FTP page ---------------------------------------
#RexxVar FtpDirCnt  = 0          ;;Number of directories on this html page
#RexxVar FtpFileCnt = 0          ;;Number of files       on this html page


;--- Generate start of HTML -------------------------------------------------
#if    <?OutputLevel> <> FtpStartLevel | defined('FTPLIKE_NO_HEADER_FOOTER_ON_1ST_PAGE') = 'N'
       <$FTPLIKE_START_HTML_PAGE>
#endif
<$FTPLIKE_START_PAGE_AFTER_TITLE>

;--- Process directories? (need to be careful as we include ourself) --------
#ifdef  FTPLIKE_FOLLOW_SUBDIRECTORIES
         ;--- Want ".." (parent) link? --------------------------------------
         #if <?OutputLevel> = FtpStartLevel
             #define+ InDirTable  NO
         #elseif
             ;--- Start HTML table ------------------------------------------
             <$FTPLIKE_BEFORE_ALL_DIRS>
             #define+ InDirTable  YES

             ;--- Generate ".." ---------------------------------------------
             <$FTPLIKE_GENERATE_DOT_DOT URL="<$ParentHtml>">

             ;--- Can now override "dot dot" if user wants ------------------
             <$FTPLIKE_LET_USER_OVERRIDE_DOT_DOT_IMAGE>
        #endif

        ;--- Get a directory list -------------------------------------------
        #DefineRexx ''
               ;--- Get list of directories ---------------------------------
               FtpArray<?OutputLevel>.0 = 0;
               call _SysFileTree '<$FTPLIKE_DIRECTORY $$SQx2><?DirSlash><$FTPLIKE_DIR_MASKS>', 'FtpArray<?OutputLevel>', 'DO';

               ;--- Set defaults for these "primary" directories ------------
               do  DirIndex = 1 to FtpArray<?OutputLevel>.0
                   ;--- This is not a virtual link --------------------------
                   FtpArray<?OutputLevel>.DirIndex.!RealDirTree = '';

                   ;--- No description --------------------------------------
                   FtpArray<?OutputLevel>.DirIndex.!Description = '';
               end;

               ;--- Add any linked directories -----------------------------
               FtpKey = DirStore || 'ADDDIRS';
               if  RexxVarDefined(FtpKey) then
               do
                   DirList = _valueG(FtpKey);
                   TheCnt  = FtpArray<?OutputLevel>.0;
                   do  while DirList <> ''
                       ;--- Get next dir ------------------------------------
                       parse var DirList NextDir '00'x DirList;
                       TheCnt = TheCnt + 1;

                       ;--- Override description (shortname/EA attrib)? -----
                       if  left(NextDir, 1) <> '|' then
                           DirDescription = '';        ;;No override
                       else
                       do
                           ;--- We want to override description -------------
                           EndPos = pos('|', NextDir, 2);
                           if  EndPos = 0 then
                               call Error 'The directory description not correctly specified', 'Directory = "' || NextDir || '"';
                           DirDescription = substr(NextDir, 2, EndPos-2);
                           NextDir        = substr(NextDir, EndPos+1);
                       end;
                       FtpArray<?OutputLevel>.TheCnt.!Description = DirDescription;

                       ;--- Is it an alias? ---------------------------------
                       if  left(NextDir,1) = '@' then
                       do
                           ;--- It is an alias, resolve it ------------------
                           NextDirKey = substr(NextDir, 2);
                           <$c2x ResultVar="KeyCode" KeyVar="NextDirKey">
                           FullVar = "FtpAlias2Dir.!" || KeyCode;
                           if  symbol(FullVar) <> 'VAR' then
                               error('Trying to link to undefined directory ALIAS of "' || NextDirKey || '"!');
                           NextDir = _valueG(FullVar);
                       end;

                       ;--- This is not a primary directory (its "virtual") ---
                       FtpArray<?OutputLevel>.TheCnt.!RealDirTree = 'N';

                       ;--- Add directory to list ---------------------------
                       FtpArray<?OutputLevel>.TheCnt = NextDir;
                   end;
                   FtpArray<?OutputLevel>.0 = TheCnt;
               end;

               ;--- Set up some stuff! --------------------------------------
               do  DirIndex = 1 to FtpArray<?OutputLevel>.0
                   ;--- Handle real shortname -------------------------------
                   FtpFile   =  FtpArray<?OutputLevel>.DirIndex;
                   FtpShortR = _filespec('name', FtpFile);
                   FtpArray<?OutputLevel>.DirIndex.!FtpShortR = FtpShortR;

                   ;--- Description already specified? If not work it out ---
                   if  FtpArray<?OutputLevel>.DirIndex.!Description <> '' then
                   do
                       ;--- Already have the information, just translate desc ---
                       <$FTPLIKE_DESCRIPTION_TRANSLATIONS>;
                   end;
                   else
                   do
                       ;--- No so either use shortname or EA value ----------
                       <$FTPLIKE_GET_SHORT_DESC>;
                       <$FTPLIKE_DESCRIPTION_TRANSLATIONS>;
                       FtpArray<?OutputLevel>.DirIndex.!Description = FtpShortD;
                   end;

                   ;--- Set up the sort key ---------------------------------
                   FtpArray<?OutputLevel>.DirIndex.!SortKey = translate(FtpArray<?OutputLevel>.DirIndex.!Description);
               end;

               ;--- Sort the directory list ---------------------------------
               if  FtpArray<?OutputLevel>.0 <> 0 then
               do
                   <$FTPLIKE_DIRECTORY_SORT_REXX ArrayName="FtpArray<?OutputLevel>">
               end;
        #DefineRexx

        ;--- Any directories to display? ------------------------------------
        #if  [FtpArray<?OutputLevel>.0 <> 0]
           ;--- Save pointer to current directories extra info! -------------
           #RexxVar PUSH  DirStore

           ;--- Process DIRECTORIES -----------------------------------------
           #RexxVar FtpIndex<?OutputLevel> = 1
           #{
               ;--- Finished? -----------------------------------------------
               #if [FtpIndex<?OutputLevel> > FtpArray<?OutputLevel>.0]
                   #break
               #endif

               ;--- Get Basic Directory information -------------------------
               #RexxVar PUSH  RealDirTree
               #RexxVar Override = FtpArray<?OutputLevel>.FtpIndex<?OutputLevel>.!RealDirTree
               #if [Override <> '']
                   #RexxVar RealDirTree = Override
               #endif
               #RexxVar FtpShortR   = FtpArray<?OutputLevel>.FtpIndex<?OutputLevel>.!FtpShortR
               #RexxVar FtpShortD   = FtpArray<?OutputLevel>.FtpIndex<?OutputLevel>.!Description
               #RexxVar FtpDir      = FtpArray<?OutputLevel>.FtpIndex<?OutputLevel>

               ;--- Generate the files --------------------------------------
               #RexxVar FtpDoThisDir = 'Y'
               <$FTPLIKE_DO_THIS_DIR>              ;;User want this dir to be seen?
               #if [FtpDoThisDir = 'Y']
                   ;--- User does want this dir to be seen ------------------
                   #RexxVar FtpDirCnt + 1
                   #if [FtpDirCnt = 1]
                       ;--- Start DIRECTORY output --------------------------
                       #if ['<$InDirTable>' = 'NO']
                           <$FTPLIKE_BEFORE_ALL_DIRS>
                           #define+ InDirTable  YES
                       #endif
                   #endif

                   ;--- Do stuff --------------------------------------------
                   #evaluate+  '' "<$FTPLIKE_GET_DIR_HTMLNAME>"

                   ;--- Override some directory defaults --------------------
                   <$MacroPush Macro='FTPLIKE_BODY_BG_IMG'>
                   <$MacroPush Macro='FTPLIKE_BODY_BG_COLOR'>
                   <$MacroPush Macro='FTPLIKE_BODY_LINK_COLOR'>
                   <$MacroPush Macro='FTPLIKE_BODY_ALINK_COLOR'>
                   <$MacroPush Macro='FTPLIKE_BODY_VLINK_COLOR'>
                   <$MacroPush Macro='FTPLIKE_BODY_ATTR_OTHER'>
                   <$MacroPush Macro='FTPLIKE_MINI_DIR_IMG_TAG'>
                   <$MacroPush Macro='FTPLIKE_MINI_DOT_DOT_IMG_TAG'>
                   <$FTPLIKE_USER_DIR_ATTRIB_PUSH_CHANGE>
                   #evaluate+  '' "<$FTPLIKE_UPDATE_DEFAULT_DIR_INFO>"

                   ;--- Save some variables ---------------------------------
                   #RexxVar PUSH  FtpDirCnt FtpFileCnt FtpTotalDirCnt FtpTotalFileCnt

                   ;--- Reset totals ----------------------------------------
                   #RexxVar FtpTotalDirCnt  = 0
                   #RexxVar FtpTotalFileCnt = 0

                   ;--- Process all subdirectories (generating HTML as we go)
                   <$FTPLIKE_GENERATE_HTML_FOR_DIR_TREE>

                   ;--- Remember subdirectory counts ------------------------
                   #RexxVar FtpSubdirTotalFileCnt = FtpTotalFileCnt
                   #RexxVar FtpSubdirTotalDirCnt  = FtpTotalDirCnt

                   ;--- Display directory details on this page --------------
                   <$FTPLIKE_DIR_HANDLER>

                   ;--- Restore other variables -----------------------------
                   #RexxVar POP  FtpDirCnt FtpFileCnt FtpTotalDirCnt FtpTotalFileCnt

                   ;--- Add to totals ---------------------------------------
                   #RexxVar FtpTotalFileCnt + FtpSubdirTotalFileCnt
                   #RexxVar FtpTotalDirCnt  + FtpSubdirTotalDirCnt

                   ;--- Restore some directory defaults ---------------------
                   <$FTPLIKE_USER_DIR_ATTRIB_POP>
                   <$MacroPop Macro='FTPLIKE_MINI_DOT_DOT_IMG_TAG'>
                   <$MacroPop Macro='FTPLIKE_MINI_DIR_IMG_TAG'>
                   <$MacroPop Macro='FTPLIKE_BODY_ATTR_OTHER'>
                   <$MacroPop Macro='FTPLIKE_BODY_VLINK_COLOR'>
                   <$MacroPop Macro='FTPLIKE_BODY_ALINK_COLOR'>
                   <$MacroPop Macro='FTPLIKE_BODY_LINK_COLOR'>
                   <$MacroPop Macro='FTPLIKE_BODY_BG_COLOR'>
                   <$MacroPop Macro='FTPLIKE_BODY_BG_IMG'>
               #endif

               ;--- Restore value -------------------------------------------
               #RexxVar POP  RealDirTree

               ;--- Prepare for next directory ------------------------------
               #RexxVar FtpIndex<?OutputLevel> + 1
           #}

           ;--- Save pointer to current directories extra info! -------------
           #RexxVar POP  DirStore
        #endif

        ;--- Generate end DIRECTORY stuff -----------------------------------
        #if ['<$InDirTable>' = 'YES']
            <$FTPLIKE_AFTER_ALL_DIRS>
            #define+ InDirTable  NO
        #endif

        ;--- Hook for displaying stuff --------------------------------------
        <$FTPLIKE_BETWEEN_DIRS_AND_FILES>
#endif

;--- Get sorted list of files -----------------------------------------------
#DefineRexx ''
   ;--- Get List of files ---------------------------------------------------
   FtpArray.0 = 0;
   call _SysFileTree '<$FTPLIKE_DIRECTORY $$SQx2><?DirSlash><$FTPLIKE_FILE_MASKS>', 'FtpArray', 'FO';

   ;--- Add any files we wish to add by alias -------------------------------
   FtpKey = DirStore || 'ADD';
   if  RexxVarDefined(FtpKey) then
   do
       FileList = _valueG(FtpKey);
       TheCnt   = FtpArray.0;
       do  while FileList <> ''
           ;--- Get next file alias -----------------------------------------
           parse var FileList FileAlias '00'x FileList;

           ;--- Now add the file to the array -------------------------------
           FileKey = 'FALIAS_.!_' || strip(FileAlias);
           if  symbol(FileKey) <> 'VAR' then
               error('The file alias of "' || FileAlias || '" is unknown!');
           TheCnt = TheCnt + 1;
           FtpArray.TheCnt = _valueG(FileKey);
       end;
       FtpArray.0 = TheCnt;
   end;

   ;--- Sort the list -------------------------------------------------------
   <$FTPLIKE_FILE_SORT_REXX ArrayName="FtpArray">
#DefineRexx

;--- Any files in this directory? -------------------------------------------
#if [FtpArray.0 <> 0]
   ;--- Process files -------------------------------------------------------
   #RexxVar FtpIndex = 1
   #{
       ;--- Finished? -------------------------------------------------------
       #if [FtpIndex > FtpArray.0]
           #break
       #endif

       ;--- Get Filename ----------------------------------------------------
       #RexxVar FtpFile = FtpArray.FtpIndex

       ;--- Generate the files ----------------------------------------------
       #RexxVar FtpDoThisFile = 'Y'
       <$FTPLIKE_DO_THIS_FILE>                 ;;User want this file to be seen?
       #if [FtpDoThisFile = 'Y']
           ;--- User does want this file to be seen -------------------------
           #RexxVar FtpFileCnt + 1
           #if [FtpFileCnt = 1]
               ;--- Start FILE output ---------------------------------------
               <$FTPLIKE_BEFORE_ALL_FILES>
           #endif

           ;--- Output details for this file --------------------------------
           <$FTPLIKE_FILE_HANDLER>
           <$FTPLIKE_FILE_DETAILS_HANDLER>
       #endif

       ;--- Prepare for next file -------------------------------------------
       #RexxVar FtpIndex + 1
   #}

   ;--- Generate end FILES stuff --------------------------------------------
   #if [FtpFileCnt <> 0]
       <$FTPLIKE_AFTER_ALL_FILES>
   #endif
#endif


;--- Generate END of HTML ---------------------------------------------------
<$FTPLIKE_END_PAGE_ABOVE_FOOTER>
#if    <?OutputLevel> <> FtpStartLevel | defined('FTPLIKE_NO_HEADER_FOOTER_ON_1ST_PAGE') = 'N'
       ;--- User has not set up their own alternative -----------------------
       <$FTPLIKE_FOOTER>               ;;Footer ends body and html
#endif

;--- Update totals ----------------------------------------------------------
#RexxVar FtpTotalFileCnt + FtpFileCnt
#RexxVar FtpTotalDirCnt  + FtpDirCnt

;--- Output summary ---------------------------------------------------------
#if    [<?OutputLevel> = FtpStartLevel]
       #ifndef   FTPLIKE_FOLLOW_SUBDIRECTORIES
           #info ^FTPLIKE processed <??FtpTotalFileCnt> file(s)^
       #elseif
           #info ^FTPLIKE processed <??FtpTotalFileCnt> file(s) in <??FtpTotalDirCnt> directories^
       #endif
#endif


FTPLIKEI.IH

This shows the contents of the header file that the above header includes to initialize things (it was put into its own header so that it is not processed for every directory):

;----------------------------------------------------------------------------
;     MODULE NAME:   FTPLIKEI.IH
;
;         $Author:   Dennis_Bareis  $
;       $Revision:   1.2  $
;           $Date:   06 Apr 2000 18:39:40  $
;        $Logfile:   E:/DB/PVCS.IT/OS2/PPWIZARD/FTPLIKEI.IHV  $
;
;     DESCRIPTION:   DO NOT INCLUDE THIS FILE YOURSELF!!!! USE FTPLIKE.IH!
;                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
;                    Further comments at the end of this file!
;
;----------------------------------------------------------------------------

;--- First time through? ----------------------------------------------------
#ifndef _FTPLIKE_INITIALIZED
   ;--- Try to ensure that header called correctly! -------------------------
   #ifndef FTPLIKE_CALLED_CORRECTLY
           #error ^Please include "FTPLIKE.IH" not "FTPLIKEI.IH"!^
   #endif

   ;--- Define the version number of this header file -----------------------
   #define+  VERSION_FTPLIKE_IH    00.291
   #require  00.240

   ;--- Check prerequisites -------------------------------------------------
   #ifndef FTPLIKE_DIRECTORY
           #error ^You must define the "FTPLIKE_DIRECTORY" value (local directory)!^
   #endif
   #ifndef FTPLIKE_DIRECTORY_WEB
           #error ^You must define the "FTPLIKE_DIRECTORY_WEB" value (web location)!^
   #endif

   ;--- Include macro push/pop support --------------------------------------
   #ifndef VERSION_PUSHPOPM_H
           #include "PushPopM.H"
   #endif

   ;--- Include Better Sort Header ------------------------------------------
   #ifndef VERSION_PPWSORT_H
           #include "PPWSORT.H"
   #endif

   ;--- Use same date time on all generated pages ---------------------------
   #ifndef FTPLIKE_DATETIME
           #evaluate FTPLIKE_DATETIME @date('WeekDay') || ' ' || date('Month') || ' ' || substr(date('Sorted'), 7, 2) || ' ' || left(date('Sorted'), 4) || ' at ' || time('Civil')@
   #endif

   ;--- Total numbers accross FTP pages -------------------------------------
   #RexxVar FtpTotalDirCnt  = 0          ;;Number of directories
   #RexxVar FtpTotalFileCnt = 0          ;;Number of files

   ;--- Remember the output level where it all began! -----------------------
   #Rexxvar FtpStartLevel = <?OutputLevel>

   ;--- We start processing "non virtual" directories -----------------------
   #RexxVar  RealDirTree = 'Y'

   ;--- Work out what filemasks users wants ---------------------------------
   #ifndef FTPLIKE_FILE_MASKS
           ;--- Default is to process all files -----------------------------
           #if ['<?OpSys>' = 'UNIX']
               #define FTPLIKE_FILE_MASKS
           #else
               #define FTPLIKE_FILE_MASKS *.*
           #endif
   #endif
   #ifndef FTPLIKE_DIR_MASKS
           ;--- Default is to process all directories -----------------------
           #if ['<?OpSys>' = 'UNIX']
               #define FTPLIKE_DIR_MASKS
           #else
               #define FTPLIKE_DIR_MASKS *.*
           #endif
   #endif

   ;--- Do best we can for input dependancies -------------------------------
   #ifdef  FTPLIKE_FOLLOW_SUBDIRECTORIES
           #DependsOn  INPUT  ^*FILES=+<$FTPLIKE_DIRECTORY><?DirSlash><$FTPLIKE_DIR_MASKS>^
   #elseif
           #DependsOn  INPUT  ^*FILES=<$FTPLIKE_DIRECTORY><?DirSlash><$FTPLIKE_DIR_MASKS>^
   #endif

   ;--- Allow user to easily support frames etc -----------------------------
   #define? FTPLIKE_LINK2DIR   <A HREF="{$URL}">
   #define? FTPLIKE_LINK2FILE  <A HREF="{$URL}">   ;;Probably would not want to override this

   ;--- Prepare for generating HTML page names ------------------------------
   #ifdef  FTPLIKE_FOLLOW_SUBDIRECTORIES
           ;--- Prepare for generating html page names (unique names!) ------
           #evaluate '' ^call GetIdPrepare 'FTPLIKE', 'Y'^

           ;--- Don't generate filename same as current "base" file! --------
           #evaluate '' ^call SetId        'FTPLIKE', '',  EnsureFileHasCorrectCase(_filespec('W', _filespec('Name', '<?OutputFile>')))^
   #endif

   ;--- Now work out the output directory -----------------------------------
   #evaluate+  'FtpGenDir' ^_filespec('location', '<?OutputFile>')^

   ;--- Work out the full name of this header file --------------------------
   #RexxVar  FtpLikeFile = '<?InputComponent>'

   ;--- Work out what user wants to call the "root" dir ---------------------
   #define? FTPLIKE_DISPLAY_DIR_TITLETAG   /
   #define? FTPLIKE_DISPLAY_DIR_CATEGORY_PREFIX  Category:<?Space>
   #define? FTPLIKE_DISPLAY_DIR_CATEGORY_SUFFIX
   #define? FTPLIKE_DISPLAY_DIR_CATEGORY_HOME_TEXT (ALL)
   #ifndef FTPLIKE_DISPLAY_DIR_CATEGORY
           ;--- Written to allow "bits" to be easily overriden by user ------
           #evaluate+   ^^ ^RootHtmlName = ToLowerCase(_filespec('name', '<?OutputFile>'))^
           #option push DefineMacroReplace="YES"
           #define FTPLIKE_DISPLAY_DIR_CATEGORY                     \
                   <$FTPLIKE_DISPLAY_DIR_CATEGORY_PREFIX>          -\
                   <A HREF="<??RootHtmlName>">                     -\
                       <$FTPLIKE_DISPLAY_DIR_CATEGORY_HOME_TEXT>   -\
                   </A>                                            -\
                   <$FTPLIKE_DISPLAY_DIR_CATEGORY_SUFFIX>
           #option pop
   #endif

   ;--- Work out extension to use -------------------------------------------
   #ifndef   FTPLIKE_HTML_EXTN
             #define   FTPLIKE_HTML_EXTN   htm
   #endif

   ;--- Define command file extension ---------------------------------------
   #ifndef   FTPLIKE_CMD_FILE_DIR
             #define   FTPLIKE_CMD_FILE_DIR  dirattr.$$$
   #endif

   ;--- User want specific prefix for generated filenames -------------------
   #ifndef   FTPLIKE_NEWHTML_PREFIX
             #ifdef    FTPLIKE_USE_LONG_FILENAMES
                       #define   FTPLIKE_NEWHTML_PREFIX     FtpLike_
             #elseif
                       #define   FTPLIKE_NEWHTML_PREFIX     ;;No prefix
             #endif
   #endif


   ;--- Define some "styles" used -------------------------------------------
   #ifndef FTPLIKE_HR_TAG_FOOTER
           #define FTPLIKE_HR_TAG_FOOTER  <HR NOSHADE SIZE="1">
   #endif
   #ifndef FTPLIKE_HR_TAG_COMMENT
           #define FTPLIKE_HR_TAG_COMMENT <HR NOSHADE color="#FF6633" SIZE="1">
   #endif
   #ifndef FTPLIKE_TABLE_FILE_ATTR
           #define FTPLIKE_TABLE_FILE_ATTR border="1" cellpadding="8" bordercolor="gray" cellspacing="0"
   #endif

   ;--- Define Simple HEADERS & FOOTERS -------------------------------------
   #ifndef FTPLIKE_HEADER
           #define FTPLIKE_HEADER    <CENTER><H1>{$Title}</H1></CENTER>
   #endif
   #ifndef FTPLIKE_FOOTER
           #define FTPLIKE_FOOTER            \
                   <$FTPLIKE_HR_TAG_FOOTER> %\
                   <CENTER>                 %\
                   <FONT SIZE=-1>           %\
                      <$FTPLIKE_DATETIME>   %\
                   </FONT>                  %\
                   </CENTER>                %\
                   </BODY></HTML>
   #endif

   ;--- Define how we create local graphics files! --------------------------
   #DefineRexx 'REXX_MAKE_LOCAL_GRAPHIC'
       ;--- Work out the graphic (put in same directory as HTML) ------------
       LocalGifFile = EnsureFileHasCorrectCase(_filespec('location', '<?OutputFile>') || '{$ImgName}');

       ;--- Create the file -------------------------------------------------
       CloseRc = stream(LocalGifFile, 'c', 'close');
       DelRc   = _SysFileDelete(LocalGifFile);
       if  stream(LocalGifFile, 'c', 'query exists') <> '' then
           Error('Could not delete "' || LocalGifFile || '" (is it in use?), DeleteRc=' || DelRc);
       WriteRc = charout(LocalGifFile, {$DataVar});
       call DieIfIoErrorOccurred LocalGifFile;
       CloseRc = stream(LocalGifFile, 'c', 'close');
       call AddOutputFileToDependancyList(LocalGifFile);
   #DefineRexx

   ;--- Define START OF HTML page -------------------------------------------
   #ifndef FTPLIKE_HEAD_STYLE_TAGS
           #define FTPLIKE_HEAD_STYLE_TAGS
   #endif
   #ifndef FTPLIKE_EXTRA_HEAD_TAGS
           #define FTPLIKE_EXTRA_HEAD_TAGS
   #endif
   #ifndef FTPLIKE_BODY_LINK_COLOR
           #define FTPLIKE_BODY_LINK_COLOR             ;;Just browser default
   #endif
   #ifndef FTPLIKE_BODY_ALINK_COLOR
           #define FTPLIKE_BODY_ALINK_COLOR            ;;Just browser default
   #endif
   #ifndef FTPLIKE_BODY_VLINK_COLOR
           #define FTPLIKE_BODY_VLINK_COLOR            ;;Just browser default
   #endif
   #ifndef FTPLIKE_BODY_ATTR_OTHER
           #define FTPLIKE_BODY_ATTR_OTHER       ;;No other body attributes (by default)
   #endif
   #ifndef FTPLIKE_BODY_BG_IMG
           ;--- Set up the default graphics filename ----------------------------
           #define FTPLIKE_BODY_BG_IMG  ftp_wood.jpg

           ;--- Create the graphic file -------------------------------------
           #DefineRexx ''
                   ;--- Load the graphic data -----------------------------------
                   Gd = ""
                   Gd = Gd || "FFD8FFE000104A46494600010101012C012C0000FFDB004300140E0F120F0D14121012171514181E32211E1C1C1E3D2C2E243249404C4B47404645505A736250"x
                   Gd = Gd || "556D5645466488656D777B8182814E608D978C7D96737E817CFFDB0043011517171E1A1E3B21213B7C5346537C7C7C7C7C7C7C7C7C7C7C7C7C7C7C7C7C7C7C7C"x
                   Gd = Gd || "7C7C7C7C7C7C7C7C7C7C7C7C7C7C7C7C7C7C7C7C7C7C7C7C7C7C7C7C7C7CFFC0001108007D008203012200021101031101FFC4001F0000010501010101010100"x
                   Gd = Gd || "000000000000000102030405060708090A0BFFC400B5100002010303020403050504040000017D01020300041105122131410613516107227114328191A10823"x
                   Gd = Gd || "42B1C11552D1F02433627282090A161718191A25262728292A3435363738393A434445464748494A535455565758595A636465666768696A737475767778797A"x
                   Gd = Gd || "838485868788898A92939495969798999AA2A3A4A5A6A7A8A9AAB2B3B4B5B6B7B8B9BAC2C3C4C5C6C7C8C9CAD2D3D4D5D6D7D8D9DAE1E2E3E4E5E6E7E8E9EAF1"x
                   Gd = Gd || "F2F3F4F5F6F7F8F9FAFFC4001F0100030101010101010101010000000000000102030405060708090A0BFFC400B5110002010204040304070504040001027700"x
                   Gd = Gd || "0102031104052131061241510761711322328108144291A1B1C109233352F0156272D10A162434E125F11718191A262728292A35363738393A43444546474849"x
                   Gd = Gd || "4A535455565758595A636465666768696A737475767778797A82838485868788898A92939495969798999AA2A3A4A5A6A7A8A9AAB2B3B4B5B6B7B8B9BAC2C3C4"x
                   Gd = Gd || "C5C6C7C8C9CAD2D3D4D5D6D7D8D9DAE2E3E4E5E6E7E8E9EAF2F3F4F5F6F7F8F9FAFFDA000C03010002110311003F00EA8F4C7F5EB480FEA7EB4B9EC3A7F3A68F"x
                   Gd = Gd || "7F5AE0351CDC727B52F3EF487EEF5C669060FB669801F638A43EDC7D29DCF6CF1FAD338E9FE714810BF4FE5463818A5C7AD07FCE680100E7BE6971C50073C504"x
                   Gd = Gd || "F5FCF14007E148DD3EB476CFA518E4FAD31863F1FC697B67AD07B633F5EB40E3F950210FA75A3B6073487D0F6A76290C701900EE34B8FF0068D33E5EE133EF8A"x
                   Gd = Gd || "3E5F48FF004A0403AE33EC7DE91863AD3BA50DC138ED400646382452745C1E3DA9474A3D47AF230698010327EB4831F97A53BAE7B9A4F50734009D08F6F4340E"x
                   Gd = Gd || "C38FF3FE7FCE2827BFE3474C8A4020E7FF00D7413F5A0E718A39FCE8181E31D6957A0E79FEB4DFBC78FC7E94FEB9CD00267B83450738EFF8D1F4CFF85310DEA4"x
                   Gd = Gd || "7A7FFAA9FD8E7EB4D1CF27DC9A7679F7A40C307FCB1A307FCB1A0EDCF3B3F1349F2FFD33FCE90C53C1EB430E08EBC51D7A0CD29E991F81A6489D4648E3DFB50F"x
                   Gd = Gd || "91CF51DF8A0633C7AD29C103A7F8D3010E3F3EBCFE947BF1F87142E718EFD2823BFAF7A0043D7918F5E293B1ED4BDE8EDD3AFEB4860172471F95230F6A51CE3B"x
                   Gd = Gd || "D008C924738A004C055009007E59A77A1073E8453422F5DA334E38C7414C06FE1DBFCFF9F7A4EA694F0A739F53DA954638E4FAFBD2180181F4A39CE3D297E872"x
                   Gd = Gd || "7B51D0E71C0E9DA98878E9C1A5A41D052D22461191D73F5A39F7A3B6463F3A147FF5B0298C6F43D3BFBD3CE3B914C2006FCB38A78C91CF51C74A0191FDD39EDD"x
                   Gd = Gd || "3AF4A7679E4FE348DF4F5F6A4C1C7078F7A07B8E3FCFD6A3273D2948C9E703D69DDF8C7A74A43D86FCDD31EBFE45380C703F0A003B7DC7B52F7A04C17A0EF41E"x
                   Gd = Gd || "9D7DFF00CFF9ED40FD683EC4714C4358608ED4F1DBFC79A8C0CB0C71E840A793C11F9E290D81FF0023AE682319F5EBE941CE79E3FCFF009FCA83E94C0367B2FE"x
                   Gd = Gd || "546CF65FFBE694370393F91A5DDEE7F2353A86A275C0FC8D03AFBD03393CFE9411F974E954211B239EF4AA4607B7F2A186571F5A4539C13400118FE5D2900C73"x
                   Gd = Gd || "8C1F5C53B041CD2631EDF87F4A003A11F5FCE9A79CE7AE314FE9DA8208CF2690C68C60FA03F952FD051DCFB52FB77F4A60341E7F1F5A33C5073CFF005A46CF41"x
                   Gd = Gd || "F9FA5200519FC79A5CFF0017E39A518CF5F7CD37AB0F5C5002AF5E47B6334BDF3E9EF4743D4F1EB40EDC7E06800D9ECBF88A367B2FE54F1D075A5FC695857630"x
                   Gd = Gd || "003AF4E94374F7A0F078CFE1C9FF003D68E0FA63DAA8051C83C77E94DC9F5FC69C324679C1A69E09A005C0E38181CF1474F63475A07BFB50007D874A3DF1F4CD"x
                   Gd = Gd || "1D31914631F5FA50027AF1D3D697BD3475FE5467A1A0620C64E3F0F5A1467E9D0507201FD29CBD7DF1F4CD200246723BFEB40C807D282704907FFAF48A06D03B"x
                   Gd = Gd || "FF002A6029EB81D7A7AFF9FF00F5D28E87D29BF5FF003EB4BCE3DFA5020CBF6E9DBFCE68CBFA7F9FCEA418C0EB47E7482E46C78FC7D69C3B8F7F5A693D726947"x
                   Gd = Gd || "D3F034C017AFE3C50C7A11FCE819CF1CD0F90339C1F5A00076E3DA93A67B63F4A383DBAFE3FE7AD1E94006724F4E7D6941E9D79FD69BD31EA28EE7BE281D83FC"x
                   Gd = Gd || "2918F3C9E68E849CFBE69ADB8F4E948685CF3D07FF005AA45E9C77A880F9BF0A90741C1E298981E7F13CD0D9200F5A69EA31D852FF001631FF00D7A0050781F4"x
                   Gd = Gd || "A3F8BA7E14038EFF00FD7A17393400F1D38E94BCD203C0E697F1A4491FAFD7F2A518C7F8534F6F7FF1A72F3CFBFF005A362843C1CF7EF4ADCAF18FAD27F101EF"x
                   Gd = Gd || "8FD2947271DF9E6988693EBE9EB413DCF7F6EB4A07031DCE29806E3C719FF3FD690C70A43D474FA9A53D33C7209A461EE7B918FAD031A0F3C1E0528E9F8D07E5"x
                   Gd = Gd || "623D3FFD74F29819A0189DF9EB4BED8CF3DE82B861838EDC0A43C283DBD3F0CD31013D49FF0023349D339C7B8A31918F4FF1C500FC99F63400EEC7FC2917BFD7"x
                   Gd = Gd || "B76A1B8C8C0E067FCFE748BE9EFF00E3FE1400EE7FBADF9FFF005E8E7FBADF9FFF005E955015079E47AD2EC1EFF9D166173FFFD9"x

                   <$REXX_MAKE_LOCAL_GRAPHIC DATAVAR="GD" IMGNAME='<$FTPLIKE_BODY_BG_IMG>'>
           #DefineRexx

           ;--- If user did not supply background color, use matching one ---
           #ifndef FTPLIKE_BODY_BG_COLOR
                   #define FTPLIKE_BODY_BG_COLOR #FFFFC6
           #endif
   #endif
   #ifndef FTPLIKE_BODY_BG_COLOR
           #define FTPLIKE_BODY_BG_COLOR         ;;Browser default background color
   #endif
   #ifndef FTPLIKE_BODY_TAG
           ;--- Combine components to give overall body tag -----------------
           #define FTPLIKE_BODY_TAG                                      \
                   <BODY                                                -\
                       #if ["<$FTPLIKE_BODY_BG_IMG>" <> '']             -\
                           <?Space>BACKGROUND="<$FTPLIKE_BODY_BG_IMG>"  -\
                       #endif                                           -\
                       #if ["<$FTPLIKE_BODY_BG_COLOR>" <> '']           -\
                           <?Space>BGCOLOR="<$FTPLIKE_BODY_BG_COLOR>"   -\
                       #endif                                           -\
                       #if ["<$FTPLIKE_BODY_LINK_COLOR>" <> '']         -\
                           <?Space>LINK="<$FTPLIKE_BODY_LINK_COLOR>"    -\
                       #endif                                           -\
                       #if ["<$FTPLIKE_BODY_ALINK_COLOR>" <> '']        -\
                           <?Space>ALINK="<$FTPLIKE_BODY_ALINK_COLOR>"  -\
                       #endif                                           -\
                       #if ["<$FTPLIKE_BODY_VLINK_COLOR>" <> '']        -\
                           <?Space>VLINK="<$FTPLIKE_BODY_VLINK_COLOR>"  -\
                       #endif                                           -\
                       <$FTPLIKE_BODY_ATTR_OTHER  $$SPCPLUS>            -\
                   >
   #endif
   #define? FTPLIKE_META_TAG_DESCRIPTION                              \
            <meta name="description" content="This page automatically generated by the free tools FTPLIKE.IH &amp; PPWIZARD from '<$FTPLIKE_DIRECTORY>'."><?Newline>
   #define? FTPLIKE_META_TAG_KEYWORDS
   #ifndef  FTPLIKE_START_HTML_PAGE
            #define FTPLIKE_START_HTML_PAGE                           \
                   <!-- Real Directory "<$FTPLIKE_DIRECTORY>" -->    %\
                   <HTML>                                            %\
                   <HEAD>                                            %\
                      <META NAME="GENERATOR" CONTENT="FTPLIKE.IH <$VERSION_FTPLIKE_IH> macros for PPWIZARD <?Version>, free tool by <?PpwizardAuthor> (<?PpwizardHomePage>)"> %\
                      <$FTPLIKE_META_TAG_DESCRIPTION>                -\
                      <$FTPLIKE_META_TAG_KEYWORDS>                   -\
                      <TITLE><$FTPLIKE_DISPLAY_DIR_TITLETAG></TITLE> %\
                      <$FTPLIKE_EXTRA_HEAD_TAGS>                     -\
                      <$FTPLIKE_HEAD_STYLE_TAGS>                     -\
                   </HEAD>                                           %\
                   <$FTPLIKE_BODY_TAG>                               %\
                   <$FTPLIKE_HEADER Title=^<$FTPLIKE_DISPLAY_DIR_CATEGORY_LT>^> %\
                   <?NewLine>
   #endif

   ;--- Define some stubs (you can add comments like "no directories found" etc) ---
   #ifndef FTPLIKE_START_PAGE_AFTER_TITLE
           #define FTPLIKE_START_PAGE_AFTER_TITLE           \
                   <$FTPLIKE_HANDLE_DIRKEY_DIRTEXT>
   #endif
   #ifndef FTPLIKE_BETWEEN_DIRS_AND_FILES
           #define FTPLIKE_BETWEEN_DIRS_AND_FILES
   #endif
   #ifndef FTPLIKE_END_PAGE_ABOVE_FOOTER
           #define FTPLIKE_END_PAGE_ABOVE_FOOTER
   #endif

   ;--- Define START OF files -----------------------------------------------
   #ifndef FTPLIKE_BEFORE_ALL_FILES
           #define FTPLIKE_BEFORE_ALL_FILES                 \
                   <CENTER>                                %\
                   <TABLE <$FTPLIKE_TABLE_FILE_ATTR>>
   #endif
   #ifndef FTPLIKE_BEFORE_ALL_DIRS
           #define FTPLIKE_BEFORE_ALL_DIRS                       \
                   <CENTER>                                     %\
                   <TABLE BORDER=0 CELLSPACING=5 CELLPADDING=0>
   #endif

   ;--- Parent directory handling -------------------------------------------
   #ifndef FTPLIKE_GENERATE_DOT_DOT
       #define FTPLIKE_GENERATE_DOT_DOT                           \
               <TR>                                              -\
                   <TD>                                          -\
                       <A HREF="{$URL}">                         -\
                       <$FTPLIKE_MINI_DOT_DOT_IMG_TAG>           -\
                       </A>                                      -\
                   </TD>                                         -\
                   <TD><A HREF="{$URL}">..</A></TD>              -\
                   <TD><A HREF="{$URL}">back to parent</A></TD>  -\
               </TR>
   #endif
   #ifndef  FTPLIKE_LET_USER_OVERRIDE_DOT_DOT_IMAGE
       #define FTPLIKE_LET_USER_OVERRIDE_DOT_DOT_IMAGE                         \
               #DefineRexx ''                                                 -\
                   ;--- New image for ".." display? ------------------------- -\
                   FtpKey = DirStore || 'DOTDOTICON';                         -\
                   if  RexxVarDefined(FtpKey) then;                           -\
                       call MacroSet "FTPLIKE_MINI_DOT_DOT_IMG_TAG", _valueG(FtpKey), 'Y'; -\
               #DefineRexx
   #endif

   ;--- How to convert shoty part of "FtpFile" to a "descriptive" version ---
   #ifndef FTPLIKE_GET_SHORT_DESC
       #if ['<?OpSys>' = 'OS/2']
           ;--- This is OS/2 (may have better "name") -----------------------
           #evaluate   ""  "call RxFuncAdd  'SysGetEA', 'RexxUtil', 'SysGetEA'"
           #DefineRexx 'FTPLIKE_GET_SHORT_DESC'
               ;--- Long name is stored in OS/2 Extended Attributes ---------
               FtpShortD = '';
               if  SysGetEA(FtpFile, ".LONGNAME", "FtpShortD") <> 0 then
                   FtpShortD = '';
               else
                   FtpShortD = substr(FtpShortD, 5);    ;;Drop EA Type info
               if  FtpShortD = '' then                  ;;Play safe!
                   FtpShortD = FtpShortR;               ;;Use what we have!
               else
                   FtpShortD = ReplaceString(FtpShortD, '0D0A'x, '<BR>');
           #DefineRexx
       #else
           ;--- Not OS/2 (can't do anything) --------------------------------
           #define FTPLIKE_GET_SHORT_DESC  FtpShortD = FtpShortR
       #endif
   #endif

   ;--- Determine how we create a valid rexx variable name from a "key" -----
   #DefineRexx 'C2X'
       #ifndef FTPLIKE_DONT_USE_C2X
           ;--- Use c2x() (doubles key size, max variable length=250 under OS/2's rexx) ---
           {$ResultVar} = c2x({$KeyVar});
       #elseif
           ;--- Use a slower routine that doesn't expand as much! -----------
           ValidRexxChars = xrange('A', 'Z') || xrange('a', 'z') || xrange('0', '9') || '!_';   ;;Don't include '?' as used for code below!
           Stuff          = {$KeyVar};
           InvPos         = verify(Stuff, ValidRexxChars);
           do  while InvPos <> 0
               ;--- We have found an invalid character ----------------------
               Stuff = left(Stuff, InvPos-1) || '?' || c2x(substr(Stuff, InvPos, 1)) || substr(Stuff, InvPos+1);

               ;--- Look for next invalid character -------------------------
               InvPos = verify(Stuff, ValidRexxChars,, InvPos+3);
           end;

           ;--- Set result --------------------------------------------------
           {$ResultVar} = Stuff;
       #endif
   #DefineRexx


   ;--- Gain access to "special" directory information ----------------------
   #DefineRexx  FTPLIKE_POINT2_EXTRA_DIR_INFO
       ;--- Get access to any info for this directory -----------------------
       #if ['<?OpSys>' = 'UNIX']
           FtpDirCode = {$DIRECTORY};              ;;Unix is case sensitive
       #else
           FtpDirCode = translate({$DIRECTORY});   ;;Make upper case
       #endif
       FtpDirCode = FtpDirCode || '<?DirSlash>'; ;;Need code to have ending '\';
       <$c2x ResultVar="KeyCode" KeyVar="FtpDirCode">
       FtpKey     = 'FtpDir2Slot.!' || KeyCode;
       if  RexxVarDefined(FtpKey) then
           DirStore = _valueG(FtpKey);
       else
           DirStore = '';
   #DefineRexx

   ;--- Point to the base directories Info ----------------------------------
   #evaluate ^^ ~<$FTPLIKE_POINT2_EXTRA_DIR_INFO DIRECTORY=^'<$FTPLIKE_DIRECTORY $$SQx2>'^>~

   ;--- How to handle a directory's name ------------------------------------
   #ifndef FTPLIKE_GENERATE_HTML_FOR_DIR_TREE
           #DefineRexx  FTPLIKE_GET_DIR_HTMLNAME     ;;User can "name" a directory's html
               ;--- Get access to any info for this directory ---------------
               <$FTPLIKE_POINT2_EXTRA_DIR_INFO DIRECTORY="FtpDir">

               ;--- Now see if alias specified for this directory -----------
               FtpKey = DirStore || 'ALIAS';
               if  RexxVarDefined(FtpKey) & RealDirTree = 'Y' then
                   FtpDirId = '<$FTPLIKE_NEWHTML_PREFIX>' || _valueG(FtpKey);     ;;Alias is basis for filename
               else
               do
                   ;--- No alias. Just base on directory name ---------------
                   #ifndef FTPLIKE_USE_LONG_FILENAMES
                       FtpDirId = GetId('FTPLIKE', 'MAXCHARS', '<$FTPLIKE_NEWHTML_PREFIX>' || FtpShortD);
                   #elseif
                       #if ['<$FTPLIKE_USE_LONG_FILENAMES>' = '']
                           FtpDirId = GetId('FTPLIKE', '2_',       '<$FTPLIKE_NEWHTML_PREFIX><$FTPLIKE_DISPLAY_DIR_TITLETAG $$SQx2>/' || FtpShortD);
                       #elseif
                           FtpDirId = GetId('FTPLIKE', 'MAXCHARS', '<$FTPLIKE_NEWHTML_PREFIX><$FTPLIKE_DISPLAY_DIR_TITLETAG $$SQx2>/' || FtpShortD,, '<$FTPLIKE_USE_LONG_FILENAMES>');
                       #endif
                   #endif
               end;

               ;--- Make sure case is OK ------------------------------------
               FtpDirId = EnsureFileHasCorrectCase(FtpDirId);

               ;--- Need as ppwizard variable -------------------------------
               call MacroSet "FtpDirId", FtpDirId, 'Y';
           #DefineRexx
           #DefineRexx  FTPLIKE_UPDATE_DEFAULT_DIR_INFO   ;;Default info saved, can now modify for this dir tree!
               ;--- User supply any directory info? -------------------------
               if  DirStore <> '' then
               do
                   ;--- User supply background for this directory TREE? -----
                   FtpKey = DirStore || 'BGIMAGE';
                   if  RexxVarDefined(FtpKey) then
                       call MacroSet "FTPLIKE_BODY_BG_IMG", _valueG(FtpKey), 'Y';
                   FtpKey = DirStore || 'BGCOLOR';
                   if  RexxVarDefined(FtpKey) then
                       call MacroSet "FTPLIKE_BODY_BG_COLOR", _valueG(FtpKey), 'Y';

                   ;--- New mini icon for folder/directory display ----------
                   FtpKey = DirStore || 'DIRICON';
                   if  RexxVarDefined(FtpKey) then
                       call MacroSet "FTPLIKE_MINI_DIR_IMG_TAG", _valueG(FtpKey), 'Y';

                   ;--- User supply other BODY tag info? --------------------
                   FtpKey = DirStore || 'LINKCOLOR';
                   if  RexxVarDefined(FtpKey) then
                       call MacroSet "FTPLIKE_BODY_LINK_COLOR",  _valueG(FtpKey), 'Y';
                   FtpKey = DirStore || 'ALINKCOLOR';
                   if  RexxVarDefined(FtpKey) then
                       call MacroSet "FTPLIKE_BODY_ALINK_COLOR", _valueG(FtpKey), 'Y';
                   FtpKey = DirStore || 'VLINKCOLOR';
                   if  RexxVarDefined(FtpKey) then
                       call MacroSet "FTPLIKE_BODY_VLINK_COLOR", _valueG(FtpKey), 'Y';
                   FtpKey = DirStore || 'BODYOTHER';
                   if  RexxVarDefined(FtpKey) then
                       call MacroSet "FTPLIKE_BODY_ATTR_OTHER",  _valueG(FtpKey), 'Y';
               end;
           #DefineRexx
           #define FTPLIKE_GENERATE_HTML_FOR_DIR_TREE                       \
                   ;--- Want to know what parent is --------               -\
                   #if <?OutputLevel> = FtpStartLevel                      -\
                       #define+ ParentHtml ""       ;;None!                -\
                   #endif                                                  -\
                   <$MacroPush Macro='ParentHtml'>  ;;Save Parent          -\
                   #evaluate+   ^ParentHtml^ ^ToLowerCase(_filespec('name', '<?OutputFile>'))^ -\
                                                                           -\
                   ;--- Start HTML page for new dir ---                    -\
                   #output "<$FtpDirId>.<$FTPLIKE_HTML_EXTN>"              -\
                      ;--- "PUSH" some values ---                          -\
                      <$MacroPush Macro='InDirTable'>                      -\
                      <$MacroPush Macro='FTPLIKE_DIRECTORY'>               -\
                      <$MacroPush Macro='FTPLIKE_DIRECTORY_WEB'>           -\
                      <$MacroPush Macro='FTPLIKE_DISPLAY_DIR_TITLETAG'>             -\
                      <$MacroPush Macro='FTPLIKE_DISPLAY_DIR_CATEGORY'>            -\
                      <$MacroPush Macro='FtpDirId'>                        -\
                      #RexxVar    PUSH  FtpShortR FtpShortD FtpDir         -\
                                                                           -\
                      ;--- Create HTML contents ---                        -\
                      #option    PUSH DefineMacroReplace=ON                -\
                      #define+   FTPLIKE_DIRECTORY              <??FtpDir> -\
                      #evaluate+ FTPLIKE_DISPLAY_DIR_TITLETAG            ^ReplaceString('<$FTPLIKE_DISPLAY_DIR_TITLETAG $$SQx2>/' || FtpShortD, '//', '/')^ -\
                      #evaluate+ FTPLIKE_DISPLAY_DIR_CATEGORY_LT         ^'<$FTPLIKE_DISPLAY_DIR_CATEGORY $$SQx2> => '                                            || FtpShortD^          -\
                      #evaluate+ FTPLIKE_DISPLAY_DIR_CATEGORY            ^'<$FTPLIKE_DISPLAY_DIR_CATEGORY $$SQx2> => <A HREF="<$FtpDirId>.<$FTPLIKE_HTML_EXTN>">' || FtpShortD || '<A>'^ -\
                      #define+   FTPLIKE_DIRECTORY_WEB          <$FTPLIKE_DIRECTORY_WEB>/<??FtpShortR>                                    -\
                      #option    POP                                       -\
                      #include   "FTPLIKE.ih"                              -\
                                                                           -\
                      ;--- "POP"  some values ---                          -\
                      #RexxVar   POP  FtpShortR FtpShortD FtpDir           -\
                      <$MacroPop Macro='FtpDirId'>                         -\
                      <$MacroPop Macro='FTPLIKE_DISPLAY_DIR_CATEGORY'>             -\
                      <$MacroPop Macro='FTPLIKE_DISPLAY_DIR_TITLETAG'>              -\
                      <$MacroPop Macro='FTPLIKE_DIRECTORY_WEB'>            -\
                      <$MacroPop Macro='FTPLIKE_DIRECTORY'>                -\
                      <$MacroPop Macro='InDirTable'>                       -\
                   #output                                                 -\
                   <$MacroPop    Macro='ParentHtml'>  ;;Restore Parent
   #endif

   ;--- Code related to mini icon in front of folders -----------------------
   #ifndef FTPLIKE_MINI_DIR_IMG_TAG
       ;--- Need to define the HTML IMG TAG ---------------------------------
       #define FTPLIKE_MINI_DIR_IMG_TAG  <IMG SRC="mini_dir.gif" ALIGN="MIDDLE" ALT="*" TITLE="" BORDER=0 WIDTH=14 HEIGHT=11 VSPACE=3>

       ;--- Now create the Graphic (needed for the above html) --------------
       #DefineRexx ''
               ;--- Load the graphic data -----------------------------------
               Gd =       "4749463839610E000B00810000FFFFFF000000C0C0C0FFFF0021F90401000000002C000000000E000B000002"x
               Gd = Gd || "23048268BB31F0466026D93B1DDC71AB0E4248187EDC2969A437AD1122C4F21C67185600003B"x

               <$REXX_MAKE_LOCAL_GRAPHIC DATAVAR="GD" IMGNAME='mini_dir.gif'>
       #DefineRexx
   #endif
   #ifndef FTPLIKE_MINI_DOT_DOT_IMG_TAG
       #option PUSH DefineMacroReplace=ON
       #define FTPLIKE_MINI_DOT_DOT_IMG_TAG <$FTPLIKE_MINI_DIR_IMG_TAG>
       #option POP
   #endif
   #define FTPLIKE_MINI_DIR_LINK                                           \
           <TD VALIGN="TOP">                                              -\
               <$FTPLIKE_LINK2DIR Url="<$FtpDirId>.<$FTPLIKE_HTML_EXTN>"> -\
               <$FTPLIKE_MINI_DIR_IMG_TAG>                                -\
               </A>                                                       -\
           </TD>

   ;--- How to handle (display) directory details ---------------------------
   #ifndef FTPLIKE_TEXT_FILE
           #define FTPLIKE_TEXT_FILE   file
   #endif
   #ifndef FTPLIKE_TEXT_FILES
           #define FTPLIKE_TEXT_FILES  files
   #endif
   #ifndef FTPLIKE_TEXT_DIR
           #define FTPLIKE_TEXT_DIR    dir
   #endif
   #ifndef FTPLIKE_TEXT_DIRS
           #define FTPLIKE_TEXT_DIRS   dirs
   #endif
   #ifndef FTPLIKE_DIR_HANDLER
           #define FTPLIKE_DIR_HANDLER                                             \
                   <TR><$FTPLIKE_MINI_DIR_LINK>                                   -\
                   <TD VALIGN=TOP>                                                -\
                       ;--- Link to HTML "DIRECTORY" page we will create ---      -\
                       <$FTPLIKE_LINK2DIR Url="<$FtpDirId>.<$FTPLIKE_HTML_EXTN>"> -\
                       <??FtpShortD>   ;;Just output short name                   -\
                       </A>                                                       -\
                   </TD>                                                          -\
                   <TD  VALIGN=TOP>                                               -\
                       ;--- How summary of folder contents -----------------      -\
                       <??FtpSubdirTotalFileCnt><?Space>                          -\
                       #if [FtpSubdirTotalFileCnt = 1]           ;;(s)            -\
                           <$FTPLIKE_TEXT_FILE>                                   -\
                       #elseif                                                    -\
                           <$FTPLIKE_TEXT_FILES>                                  -\
                       #endif                                                     -\
                       #if FtpSubdirTotalDirCnt <> 0                              -\
                           <?Space>and <??FtpSubdirTotalDirCnt><?Space>           -\
                           #if [FtpSubdirTotalDirCnt = 1]        ;;(s)            -\
                               <$FTPLIKE_TEXT_DIR>                                -\
                           #elseif                                                -\
                               <$FTPLIKE_TEXT_DIRS>                               -\
                           #endif                                                 -\
                       #endif                                                     -\
                   </TD>                                                          -\
                   </TR>

               #endif


   ;--- How to handle a file's name -----------------------------------------
   #ifndef FTPLIKE_FILE_LEFT_SIDE_DISPLAY
           #define FTPLIKE_FILE_LEFT_SIDE_DISPLAY                         \
                   <TR>                            ;;Start New File row  %\
                   <TD ALIGN=RIGHT VALIGN="TOP">   ;;Start filename cell %\
                       <$FTPLIKE_LINK2FILE Url="<??eURL>">               -\
                          <??FtpShortD>            ;;Normally shortname  -\
                       </A>                                              %\
                   </TD>                           ;;End cell
   #endif
   #ifndef FTPLIKE_DESCRIPTION_TRANSLATIONS
           #DefineRexx 'FTPLIKE_DESCRIPTION_TRANSLATIONS'
               if  pos('(', FtpShortD) <> 0 | pos(')', FtpShortD) <> 0 then
               do
                   ;--- ((amp)) = & etc -------------------------------------
                   FtpShortD = ReplaceString(FtpShortD, '((', '&');
                   FtpShortD = ReplaceString(FtpShortD, '))', ';');
               end;
           #DefineRexx
   #endif
   #ifndef FTPLIKE_WORK_OUT_SHORTNAME
       #DefineRexx 'FTPLIKE_WORK_OUT_SHORTNAME'
           ;--- Get the short name (remove path) ----------------------------
           FtpShortR = _filespec('name', FtpFile);

           ;--- If has alias prefix then remove it! -------------------------
           if  left(FtpShortR, 1) = '<$FTPLIKE_FILE_ALIAS_PREFIX>' then
           do
               ;--- Looks like it could have an alias -----------------------
               EndAlias = pos('<$FTPLIKE_FILE_ALIAS_PREFIX>', FtpShortR, 2);
               if  EndAlias > 2 then
               do
                   ;--- This entry does have an alias prefix so remove it! --
                   FtpShortR = substr(FtpShortR, EndAlias+1);
               end;
           end;
       #DefineRexx
   #endif
   #ifndef FTPLIKE_FILE_HANDLER
           #define FTPLIKE_FILE_HANDLER                                     \
                   #evaluate '' ^<$FTPLIKE_WORK_OUT_SHORTNAME>; <$FTPLIKE_GET_SHORT_DESC>; <$FTPLIKE_DESCRIPTION_TRANSLATIONS>^  -\
                   #evaluate '' ^eURL = UrlEncode('<$FTPLIKE_DIRECTORY_WEB $$SQx2>/' || FtpShortR, 'TO%', ' ')^                  -\
                   <$FTPLIKE_FILE_LEFT_SIDE_DISPLAY>
   #endif

   ;--- How to handle a file's details --------------------------------------
   #ifndef FTPLIKE_SHOW_FILE_TIME
           #define FTPLIKE_SHOW_FILE_TIME                    \
                   <??FtpDay> <??FtpMon> <??FtpYear>         \
                   <??FtpHour>:<??FtpMinute>:<??FtpSecond>
   #endif
   #ifndef FTPLIKE_ADD_FILE_SIZE_AFTER_TIME
           #define FTPLIKE_ADD_FILE_SIZE_AFTER_TIME  , <??FtpSize> bytes
   #endif
   #ifndef FTPLIKE_FILE_DETAILS_HANDLER
           #define FTPLIKE_FILE_DETAILS_HANDLER                                                       \
                   #evaluate '' ^<$FTPLIKE_FILE_ATTRIBUTE_HANDLER_REXX>;<$FTPLIKE_GET_FILE_COMMENT>^ -\
                   <TD ALIGN=LEFT>     ;;Start file details cell           %\
                       <$FTPLIKE_SHOW_FILE_TIME>                           -\
                       <$FTPLIKE_ADD_FILE_SIZE_AFTER_TIME>                 %\
                       <$FTPLIKE_ADD_FILE_COMMENT>                         -\
                   </TD>               ;;End cell                          %\
                   </TR>               ;;End this File row
   #endif


   ;--- Define END OF files -------------------------------------------------
   #ifndef FTPLIKE_AFTER_ALL_FILES
           #define FTPLIKE_AFTER_ALL_FILES  </TABLE></CENTER>
   #endif
   #ifndef FTPLIKE_AFTER_ALL_DIRS
           #define FTPLIKE_AFTER_ALL_DIRS   </TABLE></CENTER><P>
   #endif

   ;--- Define ATTRIBUTE Handler (date, time, size etc) ---------------------
   #define? FTPLIKE_MONTH_NAMES    January February March April May June July August September October November December
   #ifndef FTPLIKE_FILE_ATTRIBUTE_HANDLER_REXX
           #define FTPLIKE_FILE_ATTRIBUTE_HANDLER_REXX                     \
                   FtpTimeStamp = GetFileTimeStamp(FtpFile);              -\
                   FtpSize      = stream(FtpFile, 'c', 'query size');     -\
                   FtpSize      = AddCommasToDecimalNumber(FtpSize);      -\
                   parse var FtpTimeStamp FtpYear +4 FtpMonth +2 FtpDay +2 FtpHour +2 FtpMinute +2 FtpSecond;      -\
                   FtpMon       = word('<$FTPLIKE_MONTH_NAMES>', FtpMonth);
   #endif


   ;--- Process this directory? (no filter by default) ----------------------
   #ifndef FTPLIKE_DO_THIS_DIR
           #define FTPLIKE_DO_THIS_DIR       ;;Generate for all directories
   #endif

   ;--- Process this file? (by default no ".diz" files!) --------------------
   #ifndef FTPLIKE_DO_THIS_FILE
           #DefineRexx FTPLIKE_DO_THIS_FILE_REXX
                   ;--- Check Extension -------------------------------------
                   DotPos = lastpos('.', FtpFile);
                   if  DotPos <> 0 then
                   do
                       ;--- Have an extension, extract it ---
                       FtpFileExtn = translate(substr(FtpFile, DotPos+1));

                       ;--- See if "special" extn -----------
                       if  FtpFileExtn = "DIZ"  then
                           FtpDoThisFile = 'N';    ;;Don't want in listing!
                   end;

                   ;--- Check if special file -------------------------------
                   ThisFile = translate(_filespec('name', FtpFile));
                   if  ThisFile = translate("<$FTPLIKE_CMD_FILE_DIR>") then
                       FtpDoThisFile = 'N';    ;;Don't want in listing!

           #DefineRexx
           #define FTPLIKE_DO_THIS_FILE                                \
                   #evaluate '' ^<$FTPLIKE_DO_THIS_FILE_REXX>^
   #endif

   ;--- Define "DIZ" handler ------------------------------------------------
   #ifndef FTPLIKE_GET_FILE_COMMENT
           #DefineRexx FTPLIKE_GET_FILE_COMMENT
                   FtpDizFile     = stream(FtpFile || '.diz', 'c', 'query exists');
                   if  FtpDizFile = '' then;
                   do;
                       ;--- Try changing extension to ".diz" ---
                       FtpPos = lastpos('.', FtpFile);
                       if  FtpPos <> 0 then;
                           FtpDizFile = stream(left(FtpFile,FtpPos) || 'DIZ', 'c', 'query exists');
                   end;
                   if  FtpDizFile = '' then;
                       FtpComment = '';
                   else;
                   do;
                       ;--- Have a comment file! ---------------
                       call AddInputFileToDependancyList(FtpDizFile);
                       FtpComment  = charin(FtpDizFile, 1, 99999);
                       call DieIfIoErrorOccurred FtpDizFile;
                       CloseRc = stream(FtpDizFile, 'c', 'close');
                       <$FTPLIKE_DIZ_TRANSLATION_REXX>
                       FtpComment = {$Prefix=^''^} || FtpComment || {$Suffix=^''^};
                   end;
           #DefineRexx
   #endif
   #ifndef FTPLIKE_ADD_FILE_COMMENT
           #define FTPLIKE_ADD_FILE_COMMENT       \
                   #if [FtpComment <> '']        -\
                       <$FTPLIKE_HR_TAG_COMMENT> -\
                   #endif                        -\
                   <??FtpComment>
   #endif
   #ifndef FTPLIKE_HANDLE_DIRKEY_DIRTEXT
           #DefineRexx REXX_FTPLIKE_HANDLE_DIRKEY_DIRTEXT
               ;--- User specify Text key? ----------------------------------
               FtpKey   = DirStore || 'DIRTEXT';
               if  RexxVarDefined(FtpKey) then
                   call ProcessNext _valueG(FtpKey);
           #DefineRexx
           #define FTPLIKE_HANDLE_DIRKEY_DIRTEXT                        \
                   #evaluate ^^ ^<$REXX_FTPLIKE_HANDLE_DIRKEY_DIRTEXT>^
   #endif

   ;--- Define "DIZ" translations -------------------------------------------
   #ifndef FTPLIKE_DIZ_TRANSLATION_REXX
           #define FTPLIKE_DIZ_TRANSLATION_REXX                                 \
                   FtpComment = ReplaceString(FtpComment, '1A'x,       '');  ;;EOF char
   ;;;;;;          FtpComment = ReplaceString(FtpComment, '0D0A0D0A'x, '0D0A'x || '<P>');
   #endif


   ;--- Define how directories are SORTED (just rexx) -----------------------------
   #ifndef FTPLIKE_DIRECTORY_SORT_REXX
           #DefineRexx 'FTPLIKE_DIRECTORY_SORT_REXX'
               #OneLine
               <$GenRexx2Sort
                       COUNT=^{$ArrayName}.0^
                   GREATER=^SrtGreater = {$ArrayName}.SrtIndex1.!SortKey > {$ArrayName}.SrtIndex2.!SortKey^
                       SWAP=^
                               SrtTemp = {$ArrayName}.SrtIndex1;
                               {$ArrayName}.SrtIndex1 = {$ArrayName}.SrtIndex2;
                               {$ArrayName}.SrtIndex2 = SrtTemp;

                               SrtTemp = {$ArrayName}.SrtIndex1.!Description;
                               {$ArrayName}.SrtIndex1.!Description = {$ArrayName}.SrtIndex2.!Description;
                               {$ArrayName}.SrtIndex2.!Description = SrtTemp;

                               SrtTemp = {$ArrayName}.SrtIndex1.!FtpShortR;
                               {$ArrayName}.SrtIndex1.!FtpShortR = {$ArrayName}.SrtIndex2.!FtpShortR;
                               {$ArrayName}.SrtIndex2.!FtpShortR = SrtTemp;

                               SrtTemp = {$ArrayName}.SrtIndex1.!RealDirTree;
                               {$ArrayName}.SrtIndex1.!RealDirTree = {$ArrayName}.SrtIndex2.!RealDirTree;
                               {$ArrayName}.SrtIndex2.!RealDirTree = SrtTemp;

                               SrtTemp = {$ArrayName}.SrtIndex1.!SortKey;
                               {$ArrayName}.SrtIndex1.!SortKey = {$ArrayName}.SrtIndex2.!SortKey;
                               {$ArrayName}.SrtIndex2.!SortKey = SrtTemp;
                           ^
               >
               #OneLineEnd
           #DefineRexx
   #endif

   ;--- Define how files are SORTED -----------------------------------------
   #ifndef FTPLIKE_FILE_SORT_REXX
           #DefineRexx 'FTPLIKE_FILE_SORT_REXX'
               call SortArray '{$ArrayName}'
           #DefineRexx
   #endif

   ;--- Look for files with an alias (prefix is 1 only char long!) ----------
   #define? FTPLIKE_FILE_ALIAS_PREFIX  @       ;;By default a file named "@fred@the file" is called "the file" and has an alias "fred"
   #DefineRexx ''
       ;--- Search through whole tree ---------------------------------------
       AliasFiles.0 = 0;
       call _SysFileTree '<$FTPLIKE_DIRECTORY $$SQx2><?DirSlash><$FTPLIKE_FILE_ALIAS_PREFIX><$FTPLIKE_FILE_MASKS>', 'AliasFiles', 'FOS';

       ;--- Remember details ------------------------------------------------
       do  Index = 1 to AliasFiles.0
           ;--- A doubled up prefix is an ESCAPE sequence (user wants the char) ---
           TheFile  = _filespec('name', AliasFiles.Index);
           EndAlias = pos('<$FTPLIKE_FILE_ALIAS_PREFIX>', TheFile, 2);
           if  EndAlias = 0 | EndAlias = 2 then
               iterate;                ;;Either end of alias not found or ESCAPE sequence

           ;--- Remember the name of the file by it's alias -----------------
           FileAlias = substr(TheFile, 2, EndAlias-2);
           call _valueS 'FALIAS_.!_' || FileAlias, AliasFiles.Index;
       end;
   #DefineRexx

   ;--- Load all special definition files -----------------------------------
   #DefineRexx ''
       ;--- Get list of alias files -----------------------------------------
       FtpAlias.0 = 0;
       call _SysFileTree '<$FTPLIKE_DIRECTORY $$SQx2><?DirSlash><$FTPLIKE_CMD_FILE_DIR>', 'FtpAlias', 'FOS';
       call Debug 'Found ' || FtpAlias.0 || ' files matching "<$FTPLIKE_CMD_FILE_DIR>"'

       ;--- Work through list making alias -> directory mapping -------------
       LongKey = 'N';
       call DebugIndent 1;
       do  Index = 1 to FtpAlias.0
           ;--- Name of this file? Give it an "storage slot" ----------------
           #if ['<?OpSys>' = 'UNIX']
               FtpCmdFile.1 = FtpAlias.Index;              ;;Unix is case sensitive
           #else
               FtpCmdFile.1 = translate(FtpAlias.Index);   ;;Make upper case
           #endif
           StoreUnder = 'dirattr' || Index || '.!';
           call Debug 'Processing: "' || FtpCmdFile.1 || '"'

           ;--- Map directory to "slot" (so we can retrieve info later) -----
           FtpCmdFileDir = _filespec('location', FtpCmdFile.1);
           <$c2x ResultVar="KeyCode" KeyVar="FtpCmdFileDir">
           call _valueS "FtpDir2Slot.!" || KeyCode, StoreUnder;

           ;--- Load all fields from file -----------------------------------
           call AddInputFileToDependancyList(FtpCmdFile.1);
           FileIndex = 1;
           LongKey   = 'N';
           FtpCmdFileL.FileIndex = 0;
           CloseRc = stream(FtpCmdFile.FileIndex, 'c', 'close');
           call DebugIndent 1;
           FtpBuffer = '';
           NlChar    = d2c(10);
           InLine    = ';' || ';';
           do  forever
               ;--- Read the next line (Anything in buffer?) ----------------
               if  FtpBuffer <> '' then
               do
                   ;--- Get line from buffer --------------------------------
                   #option PUSH AllowPack=OFF
                   parse var FtpBuffer CmdLine (NlChar) FtpBuffer;
                   #option POP
                   ShowL = '!';
                   ShowR = '!';
               end;
               else
               do
                   ;--- At EOF? -------------------------------------------------
                   if  lines(FtpCmdFile.FileIndex) = 0 then
                   do
                       ;--- At EOF ----------------------------------------------
                       CloseRc = stream(FtpCmdFile.FileIndex, 'c', 'close');
                       if  FileIndex = 1 then
                           leave;                     ;;At EOF on main file
                       else
                       do
                           FileIndex = FileIndex - 1; ;;At EOF of included file
                           call DebugIndent -1;
                       end;
                   end;

                   ;--- Read the line from the file -------------------------
                   FtpCmdFileL.FileIndex = FtpCmdFileL.FileIndex + 1;
                   CmdLine = strip(ReplaceString(linein(FtpCmdFile.FileIndex), d2c(9), ' '));
                   ShowL = '[';
                   ShowR = ']';
               end;
               call Debug ShowL || FtpCmdFileL.FileIndex || ShowR || ': ' || CmdLine;

               ;--- Is the line a comment? ----------------------------------
               if  CmdLine = '' | left(CmdLine, 1) = ';' then
                   iterate;

               ;--- Does the line have an inline comment? -------------------
               LineComPos = lastpos(InLine, CmdLine);
               if  LineComPos <> 0 then
               do
                   ;--- Have an inline comment ------------------------------
                   CmdLine = strip(left(CmdLine, LineComPos-1));
               end;

               ;--- Handle any macros the line might contain ----------------
               NowCount = ReplaceCount;
               CmdLine = ReplaceMacros(CmdLine);

               ;--- Any Changes made? ---------------------------------------
               if  NowCount <> ReplaceCount then
               do
                   ;--- Add to buffer (in front) ----------------------------
                   if  FtpBuffer = '' then
                       FtpBuffer = CmdLine;
                   else
                       FtpBuffer = CmdLine || NlChar || FtpBuffer;

                   ;--- Thats all for now -----------------------------------
                   iterate;
               end;

               ;--- See if #include command ---------------------------------
               if  translate(word(CmdLine, 1)) = "#INCLUDE" then
               do
                   ;--- Including new file ----------------------------------
                   call DebugIndent 1;
                   Rest = subword(CmdLine, 2);
                   if  length(Rest) < 3 | left(Rest, 1) <> '"' | right(Rest, 1) <> '"' then
                       CryAndDie('Incorrectly nested #include command in "' || FtpCmdFile.FileIndex || '"', 'The command was "' || CmdLine || '"');
                   FileIndex = FileIndex + 1;
                   FtpCmdFile.FileIndex = substr(Rest, 2, length(Rest)-2);
                   CloseRc = stream(FtpCmdFile.FileIndex, 'c', 'close');
                   iterate;
               end;

               ;--- Are we "collecting" a mult line key? --------------------
               if  LongKey = 'N' then
               do
                   ;--- Not collecting yet, is this the start? --------------
                   if  left(CmdLine, 1) = '>' then
                   do
                       ;--- Start of collection -----------------------------
                       parse value strip(substr(CmdLine,2)) with ValueVar RexxExpression;
                       ValueVar = translate(ValueVar);
                       if  RexxExpression = '' then
                           ValueSep = d2c(0);
                       else
                           interpret 'ValueSep = ' || RexxExpression;
                       ItsValue = '';
                       EndsWith = '<' || ValueVar;
                       LongKey  = 'Y';
                       iterate;
                   end;

                   ;--- Get value into rexx variable ------------------------
                   parse var CmdLine ValueVar'='ItsValue;
                   ValueVar = translate(strip(ValueVar));
                   ItsValue = strip(ItsValue);

                   ;--- Alias variable is a special case --------------------
                   if  ValueVar = "ALIAS" then
                   do
                       ;--- Create Alias to directory "link" ----------------
                       TheDir = _filespec('location', FtpCmdFile.FileIndex);
                       if  right(TheDir, 1) = '<?DirSlash>' then
                           TheDir = left(TheDir, length(TheDir)-1);
                       <$c2x ResultVar="KeyCode" KeyVar="ItsValue">
                       call _valueS "FtpAlias2Dir.!" || KeyCode, TheDir;
                   end;
               end;
               else
               do
                   ;--- End of the block? -----------------------------------
                   if  translate(CmdLine) = EndsWith then
                       LongKey = 'N';
                   else
                   do
                       ;--- Not yet finished --------------------------------
                       if  ItsValue == '' then
                           ItsValue = CmdLine;
                       else
                           ItsValue = ItsValue || ValueSep || CmdLine;
                       iterate;
                   end;
               end;

               ;--- Save away for later (very quick access) -----------------
               call _valueS StoreUnder || ValueVar, ItsValue;
           end;
           call DebugIndent -1;

           ;--- Finished processing the $$$ file, do some valiadtion --------
           if  LongKey  = 'Y' then
               CryAndDie('The multline key of "' || ValueVar || '"' in "' || FtpCmdFile.1 || '"' was not completed');
       end;
       call DebugIndent -1;
       FtpAlias2Dir.0 = FtpAlias.0;
   #DefineRexx
   #ifndef  FTPLIKE_USER_DIR_ATTRIB_PUSH_CHANGE
            #define FTPLIKE_USER_DIR_ATTRIB_PUSH_CHANGE   ;;Allow user to override for own directory attributes
   #endif
   #ifndef  FTPLIKE_USER_DIR_ATTRIB_POP
            #define FTPLIKE_USER_DIR_ATTRIB_POP           ;;Allow user to override for own directory attributes
   #endif

   ;--- Make sure not done again (when a directory being processed etc) -----
   #define _FTPLIKE_INITIALIZED
#endif

;--- Don't need to read following comments! ---------------------------------
#EOF


;----------------------------------------------------------------------------
;
;                    This header contains all initialization code and
;                    has been seperated so that it need not be included
;                    for every folder! These  comments have been placed
;                    at the end of the file so they don't have to be
;                    read at all.
;
;                    This allows you to create FTP like pages without
;                    having to do a lot of work.  Simply add the file
;                    to a directory will get it onto the correct HTML
;                    page.
;
;                    It would be wise to generate pages into their own
;                    directory on the off chance that this header file
;                    picks a name for a directory's file which matches
;                    one of yours!
;
;                    Note that most of the code below is tricky only
;                    because I made it generic (ie very configurable),
;                    a specific implementation would be much smaller
;                    and much much easier to write as well!
;
;                    The whole look and feel of the generated data may
;                    be modified.
;
;                    It would be simple to have your normal look and feel
;                    items such as headers, footers backgrounds etc
;                    integrated into the generated output.
;
;                    Description file support (.diz) is available for files,
;                    directories have an alternative mechanism.
;                    Note that the file can (and probably should) contain
;                    normal HTML formatting tags - by default anyway.
;                    If you have a file called "stuff.zip" this header
;                    will look for "stuff.zip.diz" and "stuff.diz".
;
;                    You should not modify the value of any definition
;                    that begins with an "_", you can modify virtually
;                    anything else.
;
;                    Note that dependancy checking does not make sense
;                    in this type of situation as files can appear simply
;                    by matching the wildcard. For this reason I do not
;                    bother with using the "#dependsOn INPUT" command for
;                    each file I process.
;
;
;                    NOT COMPLETE
;                    ~~~~~~~~~~~~
;                    This header has been hacked around a bit and could
;                    be simplified/improved, I will probably never do this
;                    because of a lack of time and the fact that it works!
;
;
;                    SUPPORTED OPERATING SYSTEMS
;                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~
;                    It is intended that all operating systems that PPWIZARD
;                    supports can also use this header, if you find that
;                    it does not work then please send me the output when
;                    you have used the "/debug" command line switch. Please
;                    also include a directory listing of the directory(s) you
;                    are processing.
;
;
;                    EXAMPLE - LINUX
;                    ~~~~~~~~~~~~~~~
;                    #define   FTPLIKE_FOLLOW_SUBDIRECTORIES
;                    #define   FTPLIKE_USE_LONG_FILENAMES
;                    #define   FTPLIKE_DIRECTORY           /home/dennis/
;                    #define   FTPLIKE_DIRECTORY_WEB       http://ftp
;                    #include  "ftplike.ih"
;
;
;                    EXAMPLE - OS/2, WINDOWS
;                    ~~~~~~~~~~~~~~~~~~~~~~~
;                    #define   FTPLIKE_FOLLOW_SUBDIRECTORIES
;                    #define   FTPLIKE_USE_LONG_FILENAMES   ;;Remove this definition for 8.3 names
;                    #define   FTPLIKE_DIRECTORY            C:\TMP\ASM_MAC
;                    #define   FTPLIKE_DIRECTORY_WEB        file:///C|TMP/ASM_MAC ;;Local testing
;                    #include  "FTPLIKE.IH"
;
;
;                    HELP WANTED
;                    ~~~~~~~~~~~
;                    I use "find" under linux, is there a expression that
;                    I can pass to "-name" to display all files/directories?
;
;
;
;                    SOME PPWIZARD VARIABLES EXPLAINED
;                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
;                      FTPLIKE_CMD_FILE_DIR      (default "dirattr.$$$")
;                          Defines the name of a control file that contains
;                          extra information about the directory containing
;                          it. Leading and trailing whitespace, Blank lines
;                          and lines starting with ';' are all ignored.
;
;                          As usual inline comments start with ';;' and
;                          macros are replaced.
;
;                          To generate multiple lines each must be seperated
;                          by "dc2(10)", you can not use "%\" line
;                          continuation or "<?NewLine>" or similar
;                          definitions.  As an example:
;
;                             #evaluate "Eol"  "d2c(10)"
;                             #define   LookAndFeelForOs2                  \
;                                       BgImage = image/os2warp.jpg<$Eol> -\
;                                       BgColor = #E0E0E0
;
;
;                          This file allows you to set a key to a value,
;                          it allows any key to be used so as to support
;                          ones that you might wish to create and use.
;
;                          There are 2 types of "assignment", for a short
;                          value that can fit on one line the following
;                          format can be used:
;
;                                 Key = Value
;
;                          Where you need to specify longer values the
;                          following format can be used:
;
;                                 >Key [Expression]
;                                   Value Line 1
;                                   Value Line 2
;                                 <Key
;
;                          The "Expression" is a rexx expression which
;                          evaluates to a result that is used to
;                          separate lines, the default expression is
;                          "d2c(0)".
;
;                          Standard keys are:
;
;                            * ALIAS
;                              This allows you to "name" the directory.
;                              This will refer to the directory even if
;                              the directory is renamed or moved!
;
;                              The alias is also combined with the macro
;                              "FTPLIKE_NEWHTML_PREFIX" to name the html
;                              for safe access by external html code.
;
;                            * ADD
;                              specify one or more file aliases seperated
;                              by d2c(0).
;
;                              A file alias can be assigned by preceeding
;                              a file name with '@alias@' for example
;                              "@Fred@AZip.ZIP" assignes the "AZip.ZIP"
;                              the alias "Fred".
;
;                              This allows you to refer to individual files
;                              from more than one directory/category.
;
;                            * ADDDIRS
;                              specify one or more directory names seperated
;                              by d2c(0).
;
;                              Sometimes you will find a directory tree
;                              really falls under 2 or more categories,
;                              rather than make copies you can point to
;                              directory trees that should be included.
;
;                              If a directory name starts with '@' then
;                              what follows is a directory alias.
;
;                              Each of these items can be preceeded by
;                              "|description|" to use the supplied
;                              description rather than the directories
;                              shortname or EA name.
;
;                            * DIRTEXT
;                              Specify one or more lines of html which
;                              describes the current category. This is
;                              displayed at the start of the generated
;                              page.
;
;                            * BGCOLOR
;                              The color for the background of the
;                              directory tree (for body tag), for example:
;
;                                  BgColor = #0000FF
;                                  BgColor = RED
;
;                            * BGIMAGE
;                              The image to use for the background of the
;                              directory tree (for body tag).
;
;                            * DIRICON
;                              Overrides the default (FTPLIKE_MINI_DIR_IMG_TAG)
;                              image for directory min icons, example:
;
;                                  DirIcon = <IMG SRC="graphics/url_dir.gif" WIDTH=10 HEIGHT=10 BORDER=0>
;
;                            * DOTDOTICON
;                              Similar to "DIRICON" except for ".." (parent)
;                              directory. It does NOT change the icon for
;                              the directory in which it is specified.
;
;                            * LINKCOLOR
;                              The link color use for the directory tree
;                              (for body tag), example:
;
;                                  LINKCOLOR = #3333FF
;
;                            * ALINKCOLOR
;                              The active link color
;
;                            * VLINKCOLOR
;                              The visited link color
;
;                            * BODYOTHER
;                              Any other body related tags not specified by other
;                              options for the directory tree, example:
;
;                                  BODYOTHER = LEFTMARGIN=5 TOPMARGIN=5 MARGINWIDTH=5 MARGINHEIGHT=5
;
;                    SOME REXX VARIABLES EXPLAINED
;                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
;                      FtpShortR   : Current file/dir without drive/path
;                      FtpShortD   : Descriptive version of "FtpShortR"
;
;----------------------------------------------------------------------------


[Top][Contents][Search][Prev]: PPWIZARD Extensions[Next]: HTMLPRE.IH - Converts Example Code to HTML

PPWIZARD Manual
My whole website and this manual itself was developed using PPWIZARD (free preprocessor written by Dennis Bareis)
Tuesday January 02 2001 at 7:37am