@DATABASE ADos.guide

@COPYRIGHT (C) 2002 by J.T. Steichen

@REM $VER: AmigaTalk:Help/ADos.guide 1.9 (27-Dec-2001) by J.T. Steichen

@REM Generated with RoboDoc v3.0j (May 24 1999)
@REM RoboDoc is copyright 1994-1997 by Maverick Software Development

@INDEX "Main"
@TOC   "Main"

@NODE "Main" "AmigaTalk to AmigaDOS Help:"

   The AmigaTalk interface to the AmigaDOS functions has been 
   divided up into four classifications:
   
   SAFE           - Incorrect parameters will not cause major
                    problems.  

   UNSAFE         - Ensure that parameters & methods that are
                    marked UNSAFE are checked for correct
                    return values.

   DANGEROUS      - The Methods that use DANGEROUS AmigaDOS
                    functions could cause loss of data or
                    could freeze the Operating System!

   VERY DANGEROUS - The Methods that use VERY DANGEROUS 
                    AmigaDOS functions could cause a major
                    loss of data (example:  the Format
                    function), or could lock up your PC!
@{FG SHINE}
   WARNING:  Know what you're doing when using the AmigaTalk-to-
             AmigaDOS interface (If you destroy your HardDisk
             contents, you were warned)! @{FG TEXT}

   Each Method is first described by the AmigaDOS documentation 
   for the underlying AmigaDOS function, then by the @{B}AmigaTalk@{UB}
   Method description.  Hopefully, this will force you to read
   what each function does to the Operating System of your Amiga
   first, before trying to do something potentially destructive 
   to your Amiga-PC.

   None of the Methods here will present a Requester re: your
   sanity (unless the underlying AmigaDOS function does so),
   so you will have @{B}no feedback@{UB} about what your @{B}AmigaTalk@{UB}
   program is doing, unless you create your own sub-classes
   that hold your hand better.  My intent was to implement
   the functionality of AmigaDOS as closely as possible, so
   if you do not like something about these classes, either
   re-write AmigaDOS or create your own (more bullet-proof)
   @{B}AmigaTalk@{UB} classes!
   
  @{FG SHINE}@{B}Check them out:@{UB}@{FG TEXT}

   @{" SAFE           Methods " LINK "SafeFunctions"}    
   @{" UNSAFE         Methods " LINK "UnSafeFunctions"}    
   @{" DANGEROUS      Methods " LINK "DangerousFunctions"}    
   @{" VERY DANGEROUS Methods " LINK "VeryDangerousFunctions"} - Here be Dragons!!
@ENDNODE

@NODE "SafeFunctions" "SAFE AmigaDOS Methods:"

   The functions listed here & used by @{B}AmigaTalk@{UB} have been deemed
   the least harmful of the AmigaDOS functions.  This is based
   on my judgement only, but here is how I arrived at this:
   The functions determined to be safe are mainly for gathering
   information from AmigaDOS.  Those that actually change things
   are easily corrected by the User (for example:  If you use
   @{I}setComment: commentString onFile: fileName@{UI} & you used the
   wrong commentString, you can always re-do the Method with the
   correct comment, or correct it using a file utility, such as
   DirOpus or DiskMaster II).  Where it made sense to do so,
   the arguments the User supplies these functions/Methods are
   also checked for valid ranges or values, so even if you pass
   in a NULL pointer, @{B}AmigaTalk@{UB} should short-circuit your 
   attempt to kill your system (I hope!).
   
@{JCENTER} @{FG SHINE}  
SAFE AmigaDOS Functions/AmigaTalk Methods: @{FG TEXT}
@{"waitForChar       " Link "waitForChar"}
@{"vPrintf           " Link "vPrintf"}
@{"vFPrintf          " Link "vFPrintf"}
@{"unGetC            " Link "unGetC"}
@{"strToLong         " Link "strToLong"}
@{"strToDate         " Link "strToDate"}
@{"splitName         " Link "splitName"}
@{"setProtection     " Link "setProtection"}
@{"setPrompt         " Link "setPrompt"}
@{"setIoErr          " Link "setIoErr"}
@{"setFileDate       " Link "setFileDate"}
@{"setComment        " Link "setComment"}
@{"sameLock          " Link "sameLock"}
@{"sameDevice        " Link "sameDevice"}
@{"readLink          " Link "readLink"}
@{"readItem          " Link "readItem"}
@{"readArgs          " Link "readArgs"}
@{"readFile          " Link "readFile"}
@{"putStr            " Link "putStr"}
@{"printFault        " Link "printFault"}
@{"pathPart          " Link "pathPart"}
@{"parentOfFH        " Link "parentOfFH"}
@{"parentDir         " Link "parentDir"}
@{"maxCli            " Link "maxCli"}
@{"matchNext         " Link "matchNext"}
@{"matchFirst        " Link "matchFirst"}
@{"matchEnd          " Link "matchEnd"}
@{"isInteractive     " Link "isInteractive"}
@{"isFileSystem      " Link "isFileSystem"}
@{"ioErr             " Link "ioErr"}
@{"getVar            " Link "getVar"}
@{"getPrompt         " Link "getPrompt"}
@{"getProgramName    " Link "getProgramName"}
@{"getProgramDir     " Link "getProgramDir"}
@{"getFileSysTask    " Link "getFileSysTask"}
@{"getDeviceProc     " Link "getDeviceProc"}
@{"getCurrentDirName " Link "getCurrentDirName"}
@{"getConsoleTask    " Link "getConsoleTask"}
@{"getArgStr         " Link "getArgStr"}
@{"fPutS             " Link "fPutS"}
@{"fPutC             " Link "fPutC"}
@{"findVar           " Link "findVar"}
@{"findCliProc       " Link "findCliProc"}
@{"fGetS             " Link "fGetS"}
@{"fGetC             " Link "fGetC"}
@{"fault             " Link "fault"}
@{"endNotify         " Link "endNotify"}
@{"delay             " Link "delay"}
@{"dateToStr         " Link "dateToStr"}
@{"currentDir        " Link "currentDir"}
@{"compareDates      " Link "compareDates"}
@{"cliPointer        " Link "cliPointer"}
@{"addSegment        " Link "addSegment"}
@{"addBuffers        " Link "addBuffers"}
@{"abortPacket       " Link "AbortPacket"}
@{JLEFT}
@ENDNODE

@NODE "UnSafeFunctions" "UNSAFE AmigaDOS Methods:"

   It's advisable that the User of these AmigaTalk Methods
   check their work before usage.

   This classification is based on my judgement only, but here 
   is how I arrived at this:  The functions determined to be 
   @{B}Unsafe@{UB} can change file Locks, traverse a directory,
   or change something (such as an Assignment) that might not
   be easily found or corrected.
   
   Where it made sense to do so, the arguments the User supplies these 
   functions/Methods are also checked for valid ranges or 
   values, so even if you pass in a NULL pointer, @{B}AmigaTalk@{UB} 
   should short-circuit your attempt to kill your system (I hope!).

@{JCENTER}   
@{"writeChars        " Link "writeChars"}
@{"vPrintf           " Link "vPrintf"}
@{"vFWritef          " Link "vFWritef"}
@{"unLockRecords     " Link "unLockRecords"}
@{"unLockRecord      " Link "unLockRecord"}
@{"unLockDosList     " Link "unLockDosList"}
@{"unLock            " Link "unLock"}
@{"startNotify       " Link "startNotify"}
@{"setVar            " Link "setVar"}
@{"setProgramName    " Link "setProgramName"}
@{"setProgramDir     " Link "setProgramDir"}
@{"setOwner          " Link "setOwner"}
@{"setMode           " Link "setMode"}
@{"setCurrentDirName " Link "setCurrentDirName"}
@{"rename            " Link "rename"}
@{"relabel           " Link "relabel"}
@{"parsePatternNoCase" Link "parsePatternNoCase"}
@{"parsePattern      " Link "parsePattern"}
@{"output            " Link "output"}
@{"openFromLock      " Link "openFromLock"}
@{"openFile          " Link "openFile"}
@{"nextDosEntry      " Link "nextDosEntry"}
@{"nameFromLock      " Link "nameFromLock"}
@{"nameFromFH        " Link "nameFromFH"}
@{"matchPatternNoCase" Link "matchPatternNoCase"}
@{"matchPattern      " Link "matchPattern"}
@{"makeLink          " Link "makeLink"}
@{"makeDosEntry      " Link "makeDosEntry"}
@{"lockRecords       " Link "lockRecords"}
@{"lockRecord        " Link "lockRecord"}
@{"lockDosList       " Link "lockDosList"}
@{"lock              " Link "lock"}
@{"ioErr             " Link "ioErr"}
@{"input             " Link "input"}
@{"infoDisk          " Link "infoDisk"}
@{"fRead             " Link "fRead"}
@{"flushFH           " Link "flushFH"}
@{"findSegment       " Link "findSegment"}
@{"findDosEntry      " Link "findDosEntry"}
@{"findArg           " Link "findArg"}
@{"filePart          " Link "filePart"}
@{"exNext            " Link "exNext"}
@{"execute           " Link "execute"}
@{"examineFH         " Link "examineFH"}
@{"examine           " Link "examine"}
@{"exAllEnd          " Link "exAllEnd"}
@{"exAll             " Link "exAll"}
@{"dupLockFromFH     " Link "dupLockFromFH"}
@{"dupLock           " Link "dupLock"}
@{"dateStamp         " Link "dateStamp"}
@{"closeFile         " Link "closeFile"}
@{"checkSignal       " Link "checkSignal"}
@{"changeMode        " Link "changeMode"}
@{"assignPath        " Link "assignPath"}
@{"assignLock        " Link "assignLock"}
@{"assignLate        " Link "assignLate"}
@{"assignAdd         " Link "assignAdd"}
@{"addPart           " Link "addPart"}
@{JLEFT}
@ENDNODE

@NODE "DangerousFunctions" "DANGEROUS AmigaDOS Methods:"
@{FG SHINE}
   WARNING:  Improper usage of these Methods will (at the bare
             minimum), result in the Operating System hanging
             up, which could result in loss of data.  This is
             the least of what could happen!  Turn back now! @{FG TEXT}
@{JCENTER}
@{"writeFile         " Link "writeFile"}
@{"setVBuf           " Link "setVBuf"}
@{"setFileSize       " Link "setFileSize"}
@{"setArgStr         " Link "setArgStr"}
@{"selectOutput      " Link "selectOutput"}
@{"selectInput       " Link "selectInput"}
@{"seekFile          " Link "seekFile"}
@{"runCommand        " Link "runCommand"}
@{"replyPkt          " Link "replyPkt"}
@{"inhibit           " Link "inhibit"}
@{"fWrite            " Link "fWrite"}
@{"freeDosObject     " Link "freeDosObject"}
@{"freeDosEntry      " Link "freeDosEntry"}
@{"freeDeviceProc    " Link "freeDeviceProc"}
@{"freeArgs          " Link "freeArgs"}
@{"exitProgram       " Link "exitProgram"} -- Avoid like the plague!
@{"deviceProc        " Link "deviceProc"}
@{"deleteVar         " Link "deleteVar"}
@{"createNewProc     " Link "createNewProc"}
@{"cliInitRun        " Link "cliInitRun"}
@{"cliInitNewcli     " Link "cliInitNewcli"}
@{"attemptLockDosList" Link "attemptLockDosList"}
@{"allocDosObject    " Link "allocDosObject"}
@{"addDosEntry       " Link "addDosEntry"}
@{JLEFT}
@ENDNODE

@NODE "VeryDangerousFunctions" "VERY DANGEROUS AmigaDOS Methods:"
@{FG SHINE}
   WARNING:  Improper usage of these Methods will (at the bare
             minimum), result in the Operating System hanging
             up, which could result in loss of data.  This is
             the least of what could happen!  Turn back now! @{FG TEXT}
@{JCENTER}
@{"waitPkt           " Link "waitPkt"}
@{"unLoadSeg         " Link "unLoadSeg"}
@{"systemTagList     " Link "systemTagList"}
@{"setFileSysTask    " Link "setFileSysTask"}
@{"setConsoleTask    " Link "setConsoleTask"}
@{"sendPkt           " Link "sendPkt"}
@{"remSegment        " Link "remSegment"}
@{"remDosEntry       " Link "remDosEntry"}
@{"remAssignList     " Link "remAssignList"}
@{"newLoadSeg        " Link "newLoadSeg"}
@{"loadSeg           " Link "loadSeg"}
@{"internalUnLoadSeg " Link "internalUnLoadSeg"}
@{"internalLoadSeg   " Link "internalLoadSeg"}
@{"format            " Link "format"} -- Are you out of your tree??
@{"doPacket          " Link "doPacket"}
@{"deleteFile        " Link "deleteFile"}
@{"addSegment        " Link "addSegment"}
@{JLEFT}
@ENDNODE

@NODE "writeChars" "writeChars (UNSAFE):"
   @{B}NAME@{UB}
      WriteChars -- Writes bytes to the the default output (buffered)

   @{B}SYNOPSIS@{UB}
      LONG count = WriteChars( char *buf, LONG buflen );


   @{B}FUNCTION@{UB}
   @{B}@{FG SHINE}  This routine writes a number of bytes to the default output.  The
     length is returned.  This routine is buffered. @{FG TEXT}@{UB}

   @{B}INPUTS@{UB}
     buf    - buffer of characters to write
     buflen - number of characters to write


   @{B}RESULT@{UB}
     count - Number of bytes written.  -1 (EOF) indicates an error

   @{B}SEE ALSO@{UB}
     FPuts, FPutC, FWrite, PutStr
   @{B}
   AmigaTalk interface: @{UB}
     @{FG SHINE}
     writeChars: aBuffer ofSize: length @{FG TEXT}
        @{B}WARNING:  Make sure that @{I}aBuffer@{UI} is a String of @{I}length@{UI} bytes!@{UB}

@ENDNODE

@NODE "writeFile" "writeFile (DANGEROUS):"
   @{B}NAME@{UB}
      Write -- Write bytes of data to a file

   @{B}SYNOPSIS@{UB}
      LONG returnedLength =  Write( BPTR file, void *buffer, LONG length );


   @{B}FUNCTION@{UB}
   @{B}@{FG SHINE}   Write writes bytes of data to the opened file 'file'. 'length'
    indicates the length of data to be transferred; 'buffer' is a
    pointer to the buffer. The value returned is the length of
    information actually written. So, when 'length' is greater than
    zero, the value of 'length' is the number of characters written.
    Errors are indicated by a value of -1.

    Note: this is an unbuffered routine (the request is passed directly
    to the filesystem.)  Buffered I/O is more efficient for small
    reads and writes; see FPutC. @{FG TEXT}@{UB}

   @{B}INPUTS@{UB}
     file   - BCPL pointer to a file handle
     buffer - pointer to the buffer
     length - integer


   @{B}RESULT@{UB}
     returnedLength - integer


   @{B}SEE ALSO@{UB}
    Read, Seek, Open, Close, FPutC

@ENDNODE

@NODE "waitPkt" "waitPkt"
@{FG SHINE}waitPkt@{FG TEXT}

@{B}NAME@{UB}
@{B}    WaitPkt -- Waits for a packet to arrive at your pr_MsgPort (V36)

@{UB}
@{B}SYNOPSIS@{UB}
    struct DosPacket *packet = WaitPkt( void );


@{B}FUNCTION@{UB}
@{B}@{FG SHINE}    Waits for a packet to arrive at your pr_MsgPort.  If anyone has
    installed a packet wait function in pr_PktWait, it will be called.
    The message will be automatically GetMsg()ed so that it is no longer
    on the port.  It assumes the message is a dos packet.  It is NOT
    guaranteed to clear the signal for the port.

@{FG TEXT}@{UB}
@{B}RESULT@{UB}
    packet - the packet that arrived at the port (from ln_Name of message).


@{B}SEE ALSO@{UB}
    SendPkt, DoPkt, AbortPkt

@ENDNODE

@NODE "waitForChar" "waitForChar"
@{FG SHINE}waitForChar@{FG TEXT}

@{B}NAME@{UB}
@{B}    WaitForChar -- Determine if chars arrive within a time limit

@{UB}
@{B}SYNOPSIS@{UB}
    BOOL status = WaitForChar( BPTR file, LONG timeout );


@{B}FUNCTION@{UB}
@{B}@{FG SHINE}    If a character is available to be read from 'file' within the
    time (in microseconds) indicated by 'timeout', WaitForChar()
    returns -1 (TRUE). If a character is available, you can use Read()
    to read it.  Note that WaitForChar() is only valid when the I/O
    stream is connected to a virtual terminal device. If a character is
    not available within 'timeout', a 0 (FALSE) is returned.

@{FG TEXT}@{UB}
@{B}BUGS@{UB}
@{FG SHINE}    Due to a bug in the timer.device in V1.2/V1.3, specifying a timeout
    of zero for WaitForChar() can cause the unreliable timer & floppy
    disk operation.

@{FG TEXT}
@{B}INPUTS@{UB}
    file - BCPL pointer to a file handle
    timeout - integer


@{B}SEE ALSO@{UB}
    Read, FGetC

@ENDNODE

@NODE "vPrintf" "vPrintf"
@{FG SHINE}vPrintf@{FG TEXT}

@{B}NAME@{UB}
@{B}    VPrintf -- format and print string (buffered) (V36)

@{UB}
@{B}SYNOPSIS@{UB}
    LONG count = VPrintf( char *fmt, LONG *argv );


@{B}FUNCTION@{UB}
@{B}@{FG SHINE}    Writes the formatted string and values to Output().  This routine is 
    assumed to handle all internal buffering so that the formatting string
    and resultant formatted values can be arbitrarily long.  Any secondary
    error code is returned in IoErr().  This routine is buffered.

    Note: RawDoFmt assumes 16 bit ints, so you will usually need 'l's in
    your formats (ex: %ld versus %d).

@{FG TEXT}@{UB}
@{B}INPUTS@{UB}
    fmt   - exec.library RawDoFmt() style formatting string
    argv  - Pointer to array of formatting values
   

@{B}RESULT@{UB}
    count - Number of bytes written or -1 (EOF) for an error


@{B}BUGS@{UB}
@{FG SHINE}    The prototype for Printf() currently forces you to cast the first
    varargs parameter to LONG due to a deficiency in the program
    that generates fds, prototypes, and amiga.lib stubs.

@{FG TEXT}
@{B}SEE ALSO@{UB}
    VFPrintf, VFWritef, RawDoFmt, FPutC

@ENDNODE

@NODE "vFWritef" "vFWritef"
@{FG SHINE}vFWritef@{FG TEXT}

@{B}NAME@{UB}
@{B}    VFWritef - write a BCPL formatted string to a file (buffered) (V36)

@{UB}
@{B}SYNOPSIS@{UB}
    LONG count = VFWritef( BPTR fh, char *fmt, LONG *argv );


@{B}FUNCTION@{UB}
@{B}@{FG SHINE}    Writes the formatted string and values to the specified file.  This
    routine is assumed to handle all internal buffering so that the
    formatting string and resultant formatted values can be arbitrarily
    long.  The formats are in BCPL form.  This routine is buffered.

    Supported formats are:  (Note x is in base 36!)
      %S  - string (CSTR)
      %Tx - writes a left-justified string in a field at least
            x bytes long.
      %C  - writes a single character
      %Ox - writes a number in octal, maximum x characters wide
      %Xx - writes a number in hex, maximum x characters wide
      %Ix - writes a number in decimal, maximum x characters wide
      %N  - writes a number in decimal, any length
      %Ux - writes an unsigned number, maximum x characters wide
      %$  - ignore parameter

    Note: 'x' above is actually the character value - '0'.

@{FG TEXT}@{UB}
@{B}INPUTS@{UB}
    fh    - filehandle to write to
    fmt   - BCPL style formatting string
    argv  - Pointer to array of formatting values


@{B}RESULT@{UB}
    count - Number of bytes written or -1 for error


@{B}BUGS@{UB}
@{FG SHINE}    As of V37, VFWritef() does NOT return a valid return value.  In
    order to reduce possible errors, the prototypes supplied for the
    system as of V37 have it typed as VOID.

@{FG TEXT}
@{B}SEE ALSO@{UB}
    VFPrintf, VFPrintf, FPutC

@ENDNODE

@NODE "vFPrintf" "vFPrintf"
@{FG SHINE}vFPrintf@{FG TEXT}

@{B}NAME@{UB}
@{B}    VFPrintf -- format and print a string to a file (buffered) (V36)

@{UB}
@{B}SYNOPSIS@{UB}
    LONG count = VFPrintf( BPTR fh, char *fmt, LONG *argv )


@{B}FUNCTION@{UB}
@{B}@{FG SHINE}    Writes the formatted string and values to the given file.  This
    routine is assumed to handle all internal buffering so that the
    formatting string and resultant formatted values can be arbitrarily
    long.  Any secondary error code is returned in IoErr().  This routine
    is buffered.

@{FG TEXT}@{UB}
@{B}INPUTS@{UB}
    fh    - Filehandle to write to
    fmt   - RawDoFmt() style formatting string
    argv  - Pointer to array of formatting values


@{B}RESULT@{UB}
    count - Number of bytes written or -1 (EOF) for an error


@{B}BUGS@{UB}
@{FG SHINE}    The prototype for FPrintf() currently forces you to cast the first
    varargs parameter to LONG due to a deficiency in the program
    that generates fds, prototypes, and amiga.lib stubs.

@{FG TEXT}
@{B}SEE ALSO@{UB}
    VPrintf, VFWritef, RawDoFmt, FPutC

@ENDNODE

@NODE "unLockRecords" "unLockRecords"
@{FG SHINE}unLockRecords@{FG TEXT}

@{B}NAME@{UB}
@{B}    UnLockRecords -- Unlock a list of records (V36)

@{UB}
@{B}SYNOPSIS@{UB}
    BOOL success = UnLockRecords( struct RecordLock *record_array );


@{B}FUNCTION@{UB}
@{B}@{FG SHINE}    This releases an array of record locks obtained using LockRecords.
    You should NOT modify the record_array while you have the records
    locked.  Every LockRecords() call must be balanced with an
    UnLockRecords() call.

@{FG TEXT}@{UB}
@{B}INPUTS@{UB}
    record_array - List of records to be unlocked


@{B}BUGS@{UB}
@{FG SHINE}    See LockRecord

@{FG TEXT}
@{B}SEE ALSO@{UB}
    LockRecords, LockRecord, UnLockRecord

@ENDNODE

@NODE "unLockRecord" "unLockRecord"
@{FG SHINE}unLockRecord@{FG TEXT}

@{B}NAME@{UB}
@{B}    UnLockRecord -- Unlock a record (V36)

@{UB}
@{B}SYNOPSIS@{UB}
    BOOL success = UnLockRecord( BPTR fh, ULONG offset, ULONG length )


@{B}FUNCTION@{UB}
@{B}@{FG SHINE}    This releases the specified lock on a file.  Note that you must use
    the same filehandle you used to lock the record, and offset and length
    must be the same values used to lock it.  Every LockRecord() call must
    be balanced with an UnLockRecord() call.

@{FG TEXT}@{UB}
@{B}INPUTS@{UB}
    fh      - File handle of locked file
    offset  - Record start position
    length  - Length of record in bytes


@{B}BUGS@{UB}
@{FG SHINE}    See LockRecord

@{FG TEXT}
@{B}SEE ALSO@{UB}
    LockRecords(), LockRecord, UnLockRecords

@ENDNODE

@NODE "unLockDosList" "unLockDosList"
@{FG SHINE}unLockDosList()@{FG TEXT}

@{B}NAME@{UB}
@{B}    UnLockDosList -- Unlocks the Dos List (V36)

@{UB}
@{B}SYNOPSIS@{UB}
    void UnLockDosList( ULONG flags );


@{B}FUNCTION@{UB}
@{B}@{FG SHINE}    Unlocks the access on the Dos Device List.  You MUST pass the same
    flags you used to lock the list.

@{FG TEXT}@{UB}
@{B}INPUTS@{UB}
    flags - MUST be the same flags passed to (Attempt)LockDosList()


@{B}SEE ALSO@{UB}
    AttemptLockDosList, LockDosList, Permit

@ENDNODE

@NODE "unLock" "unLock"
@{FG SHINE}unLock@{FG TEXT}

@{B}NAME@{UB}
@{B}    UnLock -- Unlock a directory or file

@{UB}
@{B}SYNOPSIS@{UB}
    void UnLock( BPTR lock )


@{B}FUNCTION@{UB}
@{B}@{FG SHINE}    The filing system lock (obtained from Lock, DupLock, or
    CreateDir) is removed and deallocated.

@{FG TEXT}@{UB}
@{B}INPUTS@{UB}
    lock - BCPL pointer to a lock


@{B}NOTES@{UB}
@{B}@{FG SHINE}    passing zero to UnLock() is harmless

@{FG TEXT}@{UB}
@{B}SEE ALSO@{UB}
    Lock, DupLock, ParentOfFH, DupLockFromFH

@ENDNODE

@NODE "unLoadSeg" "unLoadSeg"
@{FG SHINE}unLoadSeg@{FG TEXT}

@{B}NAME@{UB}
@{B}    UnLoadSeg -- Unload a seglist previously loaded by LoadSeg

@{UB}
@{B}SYNOPSIS@{UB}
    void UnLoadSeg( BPTR seglist );


@{B}FUNCTION@{UB}
@{B}@{FG SHINE}    Unload a seglist loaded by LoadSeg.  'seglist' may be zero.
    Overlaid segments will have all needed cleanup done, including
    closing files.

@{FG TEXT}@{UB}
@{B}INPUTS@{UB}
    seglist - BCPL pointer to a segment identifier

@{B}SEE ALSO@{UB}
    LoadSeg, InternalLoadSeg, InternalUnLoadSeg

@ENDNODE

@NODE "unGetC" "unGetC"
@{FG SHINE}unGetC@{FG TEXT}

@{B}NAME@{UB}
@{B}    UnGetC -- Makes a char available for reading again. (buffered) (V36)

@{UB}
@{B}SYNOPSIS@{UB}
    LONG value = UnGetC( BPTR fh, LONG character )


@{B}FUNCTION@{UB}
@{B}@{FG SHINE}    Pushes the character specified back into the input buffer.  Every
    time you use a buffered read routine, you can always push back 1
    character.  You may be able to push back more, though it is not
    recommended, since there is no guarantee on how many can be
    pushed back at a given moment.

    Passing -1 for the character will cause the last character read to
    be pushed back.  If the last character read was an EOF, the next
    character read will be an EOF.
 
    Note: UnGetC can be used to make sure that a filehandle is set up
    as a read filehandle.  This is only of importance if you are writing
    a shell, and must manipulate the filehandle's buffer.

@{FG TEXT}@{UB}
@{B}INPUTS@{UB}
    fh     - filehandle to use for buffered I/O
    character - character to push back or -1


@{B}RESULT@{UB}
    value - character pushed back, or FALSE if the character cannot
            be pushed back.


@{B}BUGS@{UB}
@{FG SHINE}    In V36, UnGetC(fh,-1) after an EOF would not cause the next character
    read to be an EOF.  This was fixed for V37.

@{FG TEXT}
@{B}SEE ALSO@{UB}
    FGetC, FPutC, Flush

@ENDNODE

@NODE "systemTagList" "systemTagList"
@{FG SHINE}systemTagList@{FG TEXT}

@{B}NAME@{UB}
@{B}    SystemTagList -- Have a shell execute a command line (V36)

@{UB}
@{B}SYNOPSIS@{UB}
    LONG error = SystemTagList( char *command, struct TagItem *tags );


@{B}FUNCTION@{UB}
@{B}@{FG SHINE}    Similar to Execute(), but does not read commands from the input
    filehandle.  Spawns a Shell process to execute the command, and
    returns the returncode the command produced, or -1 if the command
    could not be run for any reason.  The input and output filehandles
    will not be closed by System, you must close them (if needed) after
    System returns, if you specified them via SYS_Input or SYS_Output.
 
    By default the new process will use your current Input() and Output()
    filehandles.  Normal Shell command-line parsing will be done
    including redirection on 'command'.  The current directory and path
    will be inherited from your process.  Your path will be used to find
    the command (if no path is specified).
 
    Note that you may NOT pass the same filehandle for both SYS_Input
    and SYS_Output.  If you want input and output to both be to the same
    CON: window, pass a SYS_Input of a filehandle on the CON: window,
    and pass a SYS_Output of NULL.  The shell will automatically set
    the default Output() stream to the window you passed via SYS_Input,
    by opening "*" on that handler.
 
    If used with the SYS_Asynch flag, it WILL close both it's input and
    output filehandles after running the command (even if these were
    your Input() and Output()!)
 
    Normally uses the boot (ROM) shell, but other shells can be specified
    via SYS_UserShell and SYS_CustomShell.  Normally, you should send
    things written by the user to the UserShell.  The UserShell defaults
    to the same shell as the boot shell.
 
    The tags are passed through to CreateNewProc() (tags that conflict
    with SystemTagList() will be filtered out).  This allows setting
    things like priority, etc for the new process.  The tags that are
    currently filtered out are:
 
       NP_Seglist
       NP_FreeSeglist
       NP_Entry
       NP_Input
       NP_Output
       NP_CloseInput
       NP_CloseOutput
       NP_HomeDir
       NP_Cli

@{FG TEXT}@{UB}
@{B}INPUTS@{UB}
    command - Program and arguments
    tags    - see <dos/dostags.h>.  Note that both SystemTagList()-
              specific tags and tags from CreateNewProc() may be passed.


@{B}RESULT@{UB}
    error - 0 for success, result from command, or -1.  Note that on
            error, the caller is responsible for any filehandles or other
    things passed in via tags.  -1 will only be returned if
    dos could not create the new shell.  If the command is not
    found the shell will return an error value, normally
    RETURN_ERROR.


@{B}SEE ALSO@{UB}
    Execute, CreateNewProc, <dos/dostags.h>, Input, Output

@ENDNODE

@NODE "strToLong" "strToLong"

@{FG SHINE}strToLong@{FG TEXT}

@{B}NAME@{UB}
@{B}    strToLong -- string to long value (decimal)

@{UB}
@{B}SYNOPSIS@{UB}
    LONG value = strToLong: aString


@{B}FUNCTION@{UB}
@{B}@{FG SHINE}    Converts decimal string into LONG value.
    Skips over leading spaces & tabs.  If
    no decimal digits are found (after skipping leading spaces & tabs),
    StrToLong returns -1 for characters converted, and puts 0 into value.

@{FG TEXT}@{UB}
@{B}INPUTS@{UB}
    string - Input string.

@{B}RESULT@{UB}
    result - the value the string was converted to.
@ENDNODE

@NODE "strToDate" "strToDate"
@{FG SHINE}strToDate@{FG TEXT}

@{B}NAME@{UB}
@{B}    StrToDate -- Converts a string to a DateStamp (V36)

@{UB}
@{B}SYNOPSIS@{UB}
    BOOL success = StrToDate( struct DateTime *datetime );


@{B}FUNCTION@{UB}
@{B}@{FG SHINE}    Converts a human readable ASCII string into an AmigaDOS
    DateStamp.

@{FG TEXT}@{UB}
@{B}INPUTS@{UB}
    DateTime - a pointer to an initialized DateTime structure.

    The DateTime structure should   be initialized as follows:
 
    dat_Stamp  - ignored on input.
 
    dat_Format - a format   byte which specifies the format   of the
       dat_StrDat.  This can   be any of the following   (note:
       If value used   is something other than   those below,
       the default of FORMAT_DOS is used):
 
       FORMAT_DOS:     AmigaDOS format (dd-mmm-yy).
 
       FORMAT_INT:     International   format (yy-mmm-dd).
 
       FORMAT_USA:     American format (mm-dd-yy).
 
       FORMAT_CDN:     Canadian format (dd-mm-yy).
 
       FORMAT_DEF:     default format for locale.
 
    dat_Flags - a flags byte.  The only flag which affects this
         function is:
 
       DTF_SUBST:   ignored by this function
       DTF_FUTURE:     If set, indicates that strings such
               as (stored in   dat_StrDate) "Monday"
               refer   to "next" monday. Otherwise,
               if clear, strings like "Monday"
               refer   to "last" monday.
 
    dat_StrDay - ignored bythis function.
 
    dat_StrDate -   pointer   to valid string   representing the date.
         This can be a   "DTF_SUBST" style string such as
         "Today" "Tomorrow" "Monday", or it may be a string
         as specified by the dat_Format byte.   This will be
         converted to the ds_Days portion of the DateStamp.
         If this pointer is NULL, DateStamp->ds_Days will not
         be affected.
 
    dat_StrTime -   Pointer   to a buffer which contains the time in
         the ASCII format hh:mm:ss.  This will   be converted
         to the ds_Minutes and   ds_Ticks portions of the
         DateStamp.  If this pointer is NULL, ds_Minutes and
         ds_Ticks will   be unchanged.
 

@{B}RESULT@{UB}
    success   - a zero return indicates that a conversion could
    not be performed. A non-zero return indicates that the
    DateTime.dat_Stamp variable contains the converted
    values.


@{B}SEE ALSO@{UB}
    DateStamp, DateToStr, <dos/datetime.h>

@ENDNODE

@NODE "startNotify" "startNotify"
@{FG SHINE}startNotify@{FG TEXT}

@{B}NAME@{UB}
@{B}    StartNotify -- Starts notification on a file or directory (V36)

@{UB}
@{B}SYNOPSIS@{UB}
    BOOL success = StartNotify( struct NotifyRequest *nr );


@{B}FUNCTION@{UB}
@{B}@{FG SHINE}    Posts a notification request.  Do not modify the notify structure while
    it is active.  You will be notified when the file or directory changes.
    For files, you will be notified after the file is closed.  Not all
    filesystems will support this: applications should NOT require it.  In
    particular, most network filesystems won't support it.

@{FG TEXT}@{UB}
@{B}INPUTS@{UB}
    notifystructure - A filled-in NotifyRequest structure


@{B}BUGS@{UB}
@{FG SHINE}    The V36 floppy/HD filesystem doesn't actually send notifications.  The
    V36 ram handler (ram:) does.  This has been fixed for V37.

@{FG TEXT}
@{B}SEE ALSO@{UB}
    EndNotify, <dos/notify.h>

@ENDNODE

@NODE "splitName" "splitName"
@{FG SHINE}splitName@{FG TEXT}

@{B}NAME@{UB}
@{B}    SplitName -- splits out a component of a pathname into a buffer (V36)

@{UB}
@{B}SYNOPSIS@{UB}
    WORD newpos = SplitName( char *name, UBYTE separator,
                             char *buf, WORD oldpos, LONG size );


@{B}FUNCTION@{UB}
@{B}@{FG SHINE}    This routine splits out the next piece of a name from a given file
    name.  Each piece is copied into the buffer, truncating at size-1
    characters.  The new position is then returned so that it may be
    passed in to the next call to splitname.  If the separator is not
    found within 'size' characters, then size-1 characters plus a null will
    be put into the buffer, and the position of the next separator will
    be returned.
 
    If a a separator cannot be found, -1 is returned (but the characters
    from the old position to the end of the string are copied into the
    buffer, up to a maximum of size-1 characters).  Both strings are
    null-terminated.
 
    This function is mainly intended to support handlers.
 
@{FG TEXT}@{UB}
@{B}INPUTS@{UB}
    name      - Filename being parsed.
    separator - Separator charactor to split by.
    buf       - Buffer to hold separated name.
    oldpos    - Current position in the file.
    size      - Size of buf in bytes (including null termination).


@{B}RESULT@{UB}
    newpos    - New position for next call to splitname.  -1 for last one.


@{B}BUGS@{UB}
@{FG SHINE}    In V36 and V37, path portions greater than or equal to 'size' caused
    the last character of the portion to be lost when followed by a
    separator.  Fixed for V39 dos.  For V36 and V37, the suggested work-
    around is to call SplitName() with a buffer one larger than normal
    (for example, 32 bytes), and then set buf[size-2] to '0' (for example,
    buf[30] = '\\0';).

@{FG TEXT}
@{B}SEE ALSO@{UB}
    FilePart, PathPart, AddPart

@ENDNODE

@NODE "setVBuf" "setVBuf"
@{FG SHINE}setVBuf@{FG TEXT}

@{B}NAME@{UB}
@{B}    SetVBuf -- set buffering modes and size (V39)

@{UB}
@{B}SYNOPSIS@{UB}
    LONG error = SetVBuf( BPTR fh, char *buff, LONG type, LONG size );


@{B}FUNCTION@{UB}
@{B}@{FG SHINE}    Changes the buffering modes and buffer size for a filehandle.
    With buff == NULL, the current buffer will be deallocated and a
    new one of (approximately) size will be allocated.  If buffer is
    non-NULL, it will be used for buffering and must be at least
    max(size,208) bytes long, and MUST be longword aligned.  If size
    is -1, then only the buffering mode will be changed.
 
    Note that a user-supplied buffer will not be freed if it is later
    replaced by another SetVBuf() call, nor will it be freed if the
    filehandle is closed.
 
    Has no effect on the buffersize of filehandles that were not created
    by AllocDosObject().

@{FG TEXT}@{UB}
@{B}INPUTS@{UB}
    fh   - Filehandle
    buff - buffer pointer for buffered I/O or NULL.  MUST be LONG-aligned!
    type - buffering mode (see <dos/stdio.h>)
    size - size of buffer for buffered I/O (sizes less than 208 bytes
           will be rounded up to 208), or -1.


@{B}RESULT@{UB}
    error - 0 if successful.  NOTE: opposite of most dos functions!
       NOTE: fails if someone has replaced the buffer without
       using SetVBuf() - RunCommand() does this.  Remember to
       check error before freeing user-supplied buffers!
 

@{B}BUGS@{UB}
@{FG SHINE}    Not implemented until after V39.  From V36 up to V39, always
    returned 0.

@{FG TEXT}
@{B}SEE ALSO@{UB}
    FputC, FGetC, UnGetC, Flush, FRead, FWrite, FGets,
    FPuts, AllocDosObject

@ENDNODE
@NODE "setVar" "setVar"
@{FG SHINE}setVar@{FG TEXT}

@{B}NAME@{UB}
@{B}    SetVar -- Sets a local or environment variable (V36)

@{UB}
@{B}SYNOPSIS@{UB}
    BOOL success = SetVar( char *name, char *buffer,
                           LONG size, ULONG flags ); 


@{B}FUNCTION@{UB}
@{B}@{FG SHINE}    Sets a local or environment variable.  It is advised to only use
    ASCII strings inside variables, but not required.

@{FG TEXT}@{UB}
@{B}INPUTS@{UB}
    name   - pointer to an variable name.  Note variable names follow
             filesystem syntax and semantics.
    buffer - a user allocated area which contains a string that is the
             value to be associated with this variable.
    size   - length of the buffer region in bytes.  -1 means buffer
             contains a null-terminated string.
    flags  - combination of type of var to set (low 8 bits), and
             flags to control the behavior of this routine.
             Currently defined flags include:

      GVF_LOCAL_ONLY  - set a local (to your process) variable.
      GVF_GLOBAL_ONLY - set a global environment variable.

      The default is to set a local environment variable.


@{B}RESULT@{UB}
    success - If non-zero, the variable was sucessfully set, FALSE
             indicates failure.


@{B}BUGS@{UB}
@{FG SHINE}    LV_VAR is the only type that can be global

@{FG TEXT}
@{B}SEE ALSO@{UB}
    GetVar, DeleteVar, FindVar, <dos/var.h>

@ENDNODE

@NODE "setProtection" "setProtection"
@{FG SHINE}setProtection@{FG TEXT}

@{B}NAME@{UB}
@{B}    SetProtection -- Set protection for a file or directory

@{UB}
@{B}SYNOPSIS@{UB}
    BOOL success = SetProtection( char *name, LONG mask );


@{B}FUNCTION@{UB}
@{B}@{FG SHINE}    SetProtection() sets the protection attributes on a file or
    directory.  See <dos/dos.h> for a listing of protection bits.

    Before V36, the ROM filesystem didn't respect the Read and Write
    bits.  In V36 or later and in the FFS, the Read and Write
    bits are respected.
 
    The archive bit should be cleared by the filesystem whenever the file
    is changed.  Backup utilities will generally set the bit after
    backing up each file.
 
    The V36 Shell looks at the execute bit, and will refuse to execute
    a file if it is set.
 
    Other bits will be defined in the <dos/dos.h> include files.  Rather
    than referring to bits by number you should use the definitions in
    <dos/dos.h>.

@{FG TEXT}@{UB}
@{B}INPUTS@{UB}
    name - pointer to a null-terminated string
    mask - the protection mask required


@{B}SEE ALSO@{UB}
    SetComment, Examine, ExNext, <dos/dos.h>

@ENDNODE

@NODE "setPrompt" "setPrompt"
@{FG SHINE}setPrompt@{FG TEXT}

@{B}NAME@{UB}
@{B}    SetPrompt -- Sets the CLI/shell prompt for the current process (V36)

@{UB}
@{B}SYNOPSIS@{UB}
    BOOL success = SetPrompt( char *name );


@{B}FUNCTION@{UB}
@{B}@{FG SHINE}    Sets the text for the prompt in the cli structure.  If the prompt is 
    too long to fit, a failure is returned, and the old value is left
    intact.  It is advised that you inform the user of this condition.
    This routine is safe to call even if there is no CLI structure.

@{FG TEXT}@{UB}
@{B}INPUTS@{UB}
    name - Name of prompt to be set.


@{B}BUGS@{UB}
@{FG SHINE}    This clips to a fixed (1.3 compatible) size.

@{FG TEXT}
@{B}SEE ALSO@{UB}
    GetPrompt

@ENDNODE

@NODE "setProgramName" "setProgramName"
@{FG SHINE}setProgramName@{FG TEXT}

@{B}NAME@{UB}
@{B}    SetProgramName -- Sets the name of the program being run (V36)

@{UB}
@{B}SYNOPSIS@{UB}
    BOOL success = SetProgramName( char *name )


@{B}FUNCTION@{UB}
@{B}@{FG SHINE}    Sets the name for the program in the cli structure.  If the name is 
    too long to fit, a failure is returned, and the old value is left
    intact.  It is advised that you inform the user if possible of this
    condition, and/or set the program name to an empty string.
    This routine is safe to call even if there is no CLI structure.

@{FG TEXT}@{UB}
@{B}INPUTS@{UB}
    name    - Name of program to use.


@{B}BUGS@{UB}
@{FG SHINE}    This clips to a fixed (1.3 compatible) size.

@{FG TEXT}
@{B}SEE ALSO@{UB}
    GetProgramName

@ENDNODE

@NODE "setProgramDir" "setProgramDir"
@{FG SHINE}setProgramDir@{FG TEXT}

@{B}NAME@{UB}
@{B}    SetProgramDir -- Sets the directory returned by GetProgramDir (V36)

@{UB}
@{B}SYNOPSIS@{UB}
    BPTR oldlock = SetProgramDir( BPTR lock );


@{B}FUNCTION@{UB}
@{B}@{FG SHINE}    Sets a shared lock on the directory the program was loaded from.
    This can be used for a program to find data files, etc, that are
    stored with the program, or to find the program file itself.  NULL
    is a valid input.  This can be accessed via GetProgramDir() or
    by using paths relative to PROGDIR:.

@{FG TEXT}@{UB}
@{B}INPUTS@{UB}
    lock - A lock on the directory the current program was loaded from


@{B}RESULT@{UB}
    oldlock - The previous ProgramDir.


@{B}SEE ALSO@{UB}
    GetProgramDir, Open

@ENDNODE

@NODE "setOwner" "setOwner"
@{FG SHINE}setOwner@{FG TEXT}

@{B}NAME@{UB}
@{B}    SetOwner -- Set owner information for a file or directory (V39)

@{UB}
@{B}SYNOPSIS@{UB}
    BOOL success = SetOwner( char *name, LONG owner_info );


@{B}FUNCTION@{UB}
@{B}@{FG SHINE}    SetOwner() sets the owner information for the file or directory.
    This value is a 32-bit value that is normally split into 16 bits
    of owner user id (bits 31-16), and 16 bits of owner group id (bits
    15-0).  However, other than returning them as shown by Examine()/
    ExNext()/ExAll(), the filesystem take no interest in the values.
    These are primarily for use by networking software (clients and
    hosts), in conjunction with the FIBF_OTR_xxx and FIBF_GRP_xxx
    protection bits.
 
    This entrypoint did not exist in V36, so you must open at least V37
    dos.library to use it.  V37 dos.library will return FALSE to this
    call.

@{FG TEXT}@{UB}
@{B}INPUTS@{UB}
    name      - pointer to a null-terminated string
    owner_info - owner uid (31:16) and group id (15:0)


@{B}SEE ALSO@{UB}
    SetProtect, Examine, ExNext, ExAll, <dos/dos.h>

@ENDNODE

@NODE "setMode" "setMode"
@{FG SHINE}setMode@{FG TEXT}

@{B}NAME@{UB}
@{B}    SetMode - Set the current behavior of a handler (V36)

@{UB}
@{B}SYNOPSIS@{UB}
    BOOL success = SetMode( BPTR fh, LONG mode );


@{B}FUNCTION@{UB}
@{B}@{FG SHINE}    SetMode sends an ACTION_SCREEN_MODE packet to the handler in
    question, normally for changing a CON: handler to raw mode or
    vice-versa.  For CON:, use 1 to go to RAW: mode, 0 for CON: mode.

@{FG TEXT}@{UB}
@{B}INPUTS@{UB}
    fh   - filehandle
    mode - The new mode you want

@ENDNODE

@NODE "setIoErr" "setIoErr"
@{FG SHINE}setIoErr@{FG TEXT}

@{B}NAME@{UB}
@{B}    SetIoErr -- Sets the value returned by IoErr (V36)

@{UB}
@{B}SYNOPSIS@{UB}
    LONG oldcode = SetIoErr( LONG code );


@{B}FUNCTION@{UB}
@{B}@{FG SHINE}    This routine sets up the secondary result (pr_Result2) return code 
    (returned by the IoErr function).

@{FG TEXT}@{UB}
@{B}INPUTS@{UB}
    code - Code to be returned by a call to IoErr.


@{B}RESULT@{UB}
    oldcode - The previous error code.


@{B}SEE ALSO@{UB}
    IoErr, Fault, PrintFault

@ENDNODE

@NODE "setFileSysTask" "setFileSysTask"
@{FG SHINE}setFileSysTask@{FG TEXT}

@{B}NAME@{UB}
@{B}    SetFileSysTask -- Sets the default filesystem for the process (V36)

@{UB}
@{B}SYNOPSIS@{UB}
    struct MsgPort *oldport = SetFileSysTask( struct MsgPort *port );


@{B}FUNCTION@{UB}
@{B}@{FG SHINE}    Sets the default filesystem task's port (pr_FileSystemTask) for the
    current process.

@{FG TEXT}@{UB}
@{B}INPUTS@{UB}
    port - The pr_MsgPort of the default filesystem for the process


@{B}RESULT@{UB}
    oldport - The previous FileSysTask value


@{B}SEE ALSO@{UB}
    GetFileSysTask, Open

@ENDNODE

@NODE "setFileSize" "setFileSize"
@{FG SHINE}setFileSize@{FG TEXT}

@{B}NAME@{UB}
@{B}    SetFileSize -- Sets the size of a file (V36)

@{UB}
@{B}SYNOPSIS@{UB}
    LOMNG newsize = SetFileSize( BPTR fh, LONG offset, LONG mode );


@{B}FUNCTION@{UB}
@{B}@{FG SHINE}    Changes the file size, truncating or extending as needed.  Not all
    handlers may support this; be careful and check the return code.  If
    the file is extended, no values should be assumed for the new bytes.
    If the new position would be before the filehandle's current position
    in the file, the filehandle will end with a position at the
    end-of-file.  If there are other filehandles open onto the file, the
    new size will not leave any filehandle pointing past the end-of-file.
    You can check for this by looking at the new size (which would be
    different than what you requested).
 
    The seek position should not be changed unless the file is made
    smaller than the current seek position.  However, see BUGS.
 
    Do NOT count on any specific values to be in any extended area.

@{FG TEXT}@{UB}
@{B}INPUTS@{UB}
    fh     - File to be truncated/extended.
    offset - Offset from position determined by mode.
    mode   - One of OFFSET_BEGINNING, OFFSET_CURRENT, or OFFSET_END.


@{B}RESULT@{UB}
    newsize - position of new end-of-file or -1 for error.


@{B}BUGS@{UB}
@{FG SHINE}    The RAM: filesystem and the normal Amiga filesystem act differently
    in where the file position is left after SetFileSize().  RAM: leaves
    you at the new end of the file (incorrectly), while the Amiga ROM
    filesystem leaves the seek position alone, unless the new position
    is less than the current position, in which case you're left at the
    new EOF.
 
    The best workaround is to not make any assumptions about the seek
    position after SetFileSize().   

@{FG TEXT}
@{B}SEE ALSO@{UB}
    Seek

@ENDNODE

@NODE "setFileDate" "setFileDate"
@{FG SHINE}setFileDate@{FG TEXT}

@{B}NAME@{UB}
@{B}    SetFileDate -- Sets the modification date for a file or dir (V36)

@{UB}
@{B}SYNOPSIS@{UB}
    BOOL success = SetFileDate( char *name, struct DateStamp *date );


@{B}FUNCTION@{UB}
@{B}@{FG SHINE}    Sets the file date for a file or directory.  Note that for the Old
    File System and the Fast File System, the date of the root directory
    cannot be set.  Other filesystems may not support setting the date
    for all files/directories.

@{FG TEXT}@{UB}
@{B}INPUTS@{UB}
    name - Name of object
    date - New modification date


@{B}SEE ALSO@{UB}
    DateStamp, Examine, ExNext, ExAll

@ENDNODE

@NODE "setCurrentDirName" "setCurrentDirName"
@{FG SHINE}setCurrentDirName@{FG TEXT}

@{B}NAME@{UB}
@{B}    SetCurrentDirName -- Sets the directory name for the process (V36)

@{UB}
@{B}SYNOPSIS@{UB}
    BOOL success = SetCurrentDirName( char *name );


@{B}FUNCTION@{UB}
@{B}@{FG SHINE}    Sets the name for the current dir in the cli structure.  If the name
    is too long to fit, a failure is returned, and the old value is left
    intact.  It is advised that you inform the user of this condition.
    This routine is safe to call even if there is no CLI structure.

@{FG TEXT}@{UB}
@{B}INPUTS@{UB}
    name    - Name of directory to be set.


@{B}BUGS@{UB}
@{FG SHINE}    This clips to a fixed (1.3 compatible) size.

@{FG TEXT}
@{B}SEE ALSO@{UB}
    GetCurrentDirName

@ENDNODE

@NODE "setConsoleTask" "setConsoleTask"
@{FG SHINE}setConsoleTask@{FG TEXT}

@{B}NAME@{UB}
@{B}    SetConsoleTask -- Sets the default console for the process (V36)

@{UB}
@{B}SYNOPSIS@{UB}
    struct MsgPort *oldport = SetConsoleTask( struct MsgPort *port );


@{B}FUNCTION@{UB}
@{B}@{FG SHINE}    Sets the default console task's port (pr_ConsoleTask) for the
    current process.

@{FG TEXT}@{UB}
@{B}INPUTS@{UB}
    port - The pr_MsgPort of the default console handler for the process


@{B}RESULT@{UB}
    oldport - The previous ConsoleTask value.


@{B}SEE ALSO@{UB}
    GetConsoleTask, Open

@ENDNODE

@NODE "setComment" "setComment"
@{FG SHINE}setComment@{FG TEXT}

@{B}NAME@{UB}
@{B}    SetComment -- Change a files' comment string

@{UB}
@{B}SYNOPSIS@{UB}
    BOOL success = SetComment( char *name, char *comment );


@{B}FUNCTION@{UB}
@{B}@{FG SHINE}    SetComment() sets a comment on a file or directory. The comment is
    a pointer to a null-terminated string of up to 80 characters in the
    current ROM filesystem (and RAM:).  Note that not all filesystems
    will support comments (for example, NFS usually will not), or the
    size of comment supported may vary.

@{FG TEXT}@{UB}
@{B}INPUTS@{UB}
    name    - pointer to a null-terminated string
    comment - pointer to a null-terminated string


@{B}SEE ALSO@{UB}
    Examine, ExNext, SetProtection

@ENDNODE

@NODE "setArgStr" "setArgStr"
@{FG SHINE}setArgStr@{FG TEXT}

@{B}NAME@{UB}
@{B}    SetArgStr -- Sets the arguments for the current process (V36)

@{UB}
@{B}SYNOPSIS@{UB}
    BOOL success = SetArgStr( char *ptr )


@{B}FUNCTION@{UB}
@{B}@{FG SHINE}    Sets the arguments for the current program.  The ptr MUST be reset
    to it's original value before process exit.  So save the original 
    ptr BEFORE calling this funcion!

@{FG TEXT}@{UB}
@{B}INPUTS@{UB}
    ptr - pointer to new argument string.


@{B}RESULT@{UB}
    success (DOSTRUE) or failure (FALSE).


@{B}SEE ALSO@{UB}
    GetArgStr, RunCommand

@ENDNODE

@NODE "sendPkt" "sendPkt"
@{FG SHINE}sendPkt@{FG TEXT}

@{B}NAME@{UB}
@{B}    SendPkt -- Sends a packet to a handler (V36)

@{UB}
@{B}SYNOPSIS@{UB}
    void SendPkt( struct DosPacket *packet, 
                  struct MsgPort   *port,
                  struct MsgPort   *replyport );


@{B}FUNCTION@{UB}
@{B}@{FG SHINE}    Sends a packet to a handler and does not wait.  All fields in the
    packet must be initialized before calling this routine.  The packet
    will be returned to replyport.  If you wish to use this with
    WaitPkt(), use the address of your pr_MsgPort for replyport.

@{FG TEXT}@{UB}
@{B}INPUTS@{UB}
    packet    - packet to send, must be initialized and have a message.
    port      - pr_MsgPort of handler process to send to.
    replyport - MsgPort for the packet to come back to.


@{B}NOTES@{UB}
@{B}@{FG SHINE}    Callable from a task.

@{FG TEXT}@{UB}
@{B}SEE ALSO@{UB}
    DoPkt, WaitPkt, AllocDosObject, FreeDosObject, AbortPkt

@ENDNODE

@NODE "selectOutput" "selectOutput"
@{FG SHINE}selectOutput@{FG TEXT}

@{B}NAME@{UB}
@{B}    SelectOutput -- Select a filehandle as the default output channel (V36)

@{UB}
@{B}SYNOPSIS@{UB}
    BPTR old_fh = SelectOutput( BPTR fh )


@{B}FUNCTION@{UB}
@{B}@{FG SHINE}    Set the current output as the default output for the process.
    This changes the value returned by Output().  old_fh should
    be closed or saved as needed.

@{FG TEXT}@{UB}
@{B}INPUTS@{UB}
    fh     - Newly desired output handle


@{B}RESULT@{UB}
    old_fh - Previous current output


@{B}SEE ALSO@{UB}
    Output, SelectInput, Input

@ENDNODE

@NODE "selectInput" "selectInput"
@{FG SHINE}selectInput@{FG TEXT}

@{B}NAME@{UB}
@{B}    SelectInput -- Select a filehandle as the default input channel (V36)

@{UB}
@{B}SYNOPSIS@{UB}
    BPTR old_fh = SelectInput( BPTR fh );


@{B}FUNCTION@{UB}
@{B}@{FG SHINE}    Set the current input as the default input for the process.
    This changes the value returned by Input().  old_fh should
    be closed or saved as needed.

@{FG TEXT}@{UB}
@{B}INPUTS@{UB}
    fh     - Newly default input handle


@{B}RESULT@{UB}
    old_fh - Previous default input filehandle


@{B}SEE ALSO@{UB}
    Input, SelectOutput, Output

@ENDNODE

@NODE "seekFile" "seekFile"
@{FG SHINE}seekFile@{FG TEXT}

@{B}NAME@{UB}
@{B}    Seek -- Set the current position for reading and writing

@{UB}
@{B}SYNOPSIS@{UB}
    LONG oldPosition = Seek( BPTR file, LONG position, LONG mode );


@{B}FUNCTION@{UB}
@{B}@{FG SHINE}    Seek sets the read/write cursor for the file 'file' to the
    position 'position'. This position is used by both Read() and
    Write() as a place to start reading or writing. The result is the
    current absolute position in the file, or -1 if an error occurs, in
    which case IoErr() can be used to find more information. 'mode' can
    be OFFSET_BEGINNING, OFFSET_CURRENT or OFFSET_END. It is used to
    specify the relative start position. For example, 20 from current
    is a position 20 bytes forward from current, -20 is 20 bytes back
    from current.
 
    So that to find out where you are, seek zero from current. The end
    of the file is a Seek() positioned by zero from end. You cannot
    Seek() beyond the end of a file.

@{FG TEXT}@{UB}
@{B}INPUTS@{UB}
    file - BCPL pointer to a file handle
    position - integer
    mode - integer


@{B}RESULT@{UB}
    oldPosition - integer


@{B}BUGS@{UB}
@{FG SHINE}    The V36 and V37 ROM filesystem (and V36/V37 l:fastfilesystem)
    returns the current position instead of -1 on an error.  It sets
    IoErr() to 0 on success, and an error code on an error.  This bug
    was fixed in the V39 filesystem.

@{FG TEXT}
@{B}SEE ALSO@{UB}
    Read, Write, SetFileSize

@ENDNODE

@NODE "sameLock" "sameLock"
@{FG SHINE}sameLock@{FG TEXT}

@{B}NAME@{UB}
@{B}    SameLock -- returns whether two locks are on the same object (V36)

@{UB}
@{B}SYNOPSIS@{UB}
    LONG value = SameLock( BPTR lock1, BPTR lock2 );


@{B}FUNCTION@{UB}
@{B}@{FG SHINE}    Compares two locks.  Returns LOCK_SAME if they are on the same object,
    LOCK_SAME_VOLUME if on different objects on the same volume, and
    LOCK_DIFFERENT if they are on different volumes.  Always compare
    for equality or non-equality with the results, in case new return
    values are added.

@{FG TEXT}@{UB}
@{B}INPUTS@{UB}
    lock1 - 1st lock for comparison
    lock2 - 2nd lock for comparison


@{B}RESULT@{UB}
    value -   LOCK_SAME, LOCK_SAME_VOLUME, or LOCK_DIFFERENT


@{B}BUGS@{UB}
@{FG SHINE}    Should do more extensive checks for NULL against a real lock, checking
    to see if the real lock is a lock on the root of the boot volume.

    In V36, it would return LOCK_SAME_VOLUME for different volumes on the
    same handler.  Also, LOCK_SAME_VOLUME was LOCK_SAME_HANDLER (now
    an obsolete define, see <dos/dos.h>).

@{FG TEXT}
@{B}SEE ALSO@{UB}
    <dos/dos.h>

@ENDNODE

@NODE "sameDevice" "sameDevice"
@{FG SHINE}sameDevice@{FG TEXT}

@{B}NAME@{UB}
@{B}    SameDevice -- Are two locks on the same partition of 
                  the device? (V37)

@{UB}
@{B}SYNOPSIS@{UB}
    BOOL same = SameDevice( BPTR lock1, BPTR lock2 );


@{B}FUNCTION@{UB}
@{B}@{FG SHINE}    SameDevice returns whether two locks refer to partitions that
    are on the same physical device (if it can figure it out).  This
    may be useful in writing copy routines to take advantage of
    asynchronous multi-device copies.

    Entry existed in V36 and always returned 0.

@{FG TEXT}@{UB}
@{B}INPUTS@{UB}
    lock1,lock2 - locks


@{B}RESULT@{UB}
    whether they're on the same device as far as Dos can determine.

@ENDNODE

@NODE "runCommand" "runCommand"
@{FG SHINE}runCommand@{FG TEXT}

@{B}NAME@{UB}
@{B}    RunCommand -- Runs a program using the current process (V36)

@{UB}
@{B}SYNOPSIS@{UB}
    LONG rc = RunCommand( BPTR seglist, ULONG stacksize,
                          char *argptr, ULONG argsize );


@{B}FUNCTION@{UB}
@{B}@{FG SHINE}    Runs a command on your process/cli.  Seglist may be any language,
    including BCPL programs.  Stacksize is in bytes.  argptr is a null-
    terminated string, argsize is its length.  Returns the returncode the
    program exited with in d0. Returns -1 if the stack couldn't be
    allocated.
 
    NOTE: the argument string MUST be terminated with a newline to work
    properly with ReadArgs() and other argument parsers.
 
    RunCommand also takes care of setting up the current input filehandle
    in such a way that ReadArgs() can be used in the program, and restores
    the state of the buffering before returning.  It also sets the value
    returned by GetArgStr(), and restores it before returning.  NOTE:
    the setting of the argument string in the filehandle was added in V37.
 
    It's usually appropriate to set the command name (via
    SetProgramName()) before calling RunCommand().  RunCommand() sets
    the value returned by GetArgStr() while the command is running.
 
@{FG TEXT}@{UB}
@{B}INPUTS@{UB}
    seglist   - Seglist of command to run.
    stacksize - Number of bytes to allocate for stack space
    argptr    - Pointer to argument command string.
    argsize   - Number of bytes in argument command.


@{B}RESULT@{UB}
    rc        - Return code from executed command. -1 indicates failure 


@{B}SEE ALSO@{UB}
    CreateNewProc, SystemTagList, Execute, GetArgStr,
    SetProgramName, ReadArgs

@ENDNODE

@NODE "replyPkt" "replyPkt"
@{FG SHINE}replyPkt@{FG TEXT}

@{B}NAME@{UB}
@{B}    ReplyPkt -- replies a packet to the person who sent it to you (V36)

@{UB}
@{B}SYNOPSIS@{UB}
    void ReplyPkt( struct DosPacket *packet, LONG result1, LONG result2 );


@{B}FUNCTION@{UB}
@{B}@{FG SHINE}    This returns a packet to the process which sent it to you.  In
    addition, puts your pr_MsgPort address in dp_Port, so using ReplyPkt()
    again will send the message to you.  (This is used in "ping-ponging"
    packets between two processes).  It uses result 1 & 2 to set the
    dp_Res1 and dp_Res2 fields of the packet.

@{FG TEXT}@{UB}
@{B}INPUTS@{UB}
    packet  - packet to reply, assumed to set up correctly.
    result1 - first result
    result2 - secondary result


@{B}SEE ALSO@{UB}
    DoPkt, SendPkt, WaitPkt, IoErr

@ENDNODE

@NODE "rename" "rename"
@{FG SHINE}rename@{FG TEXT}

@{B}NAME@{UB}
@{B}    Rename -- Rename a directory or file

@{UB}
@{B}SYNOPSIS@{UB}
    BOOL success = Rename( char *oldName, char *newName );


@{B}FUNCTION@{UB}
@{B}@{FG SHINE}    Rename() attempts to rename the file or directory specified as
    'oldName' with the name 'newName'. If the file or directory
    'newName' exists, Rename() fails and returns an error. Both
    'oldName' and the 'newName' can contain a directory specification.
    In this case, the file will be moved from one directory to another.
 
    Note: it is impossible to Rename() a file from one volume to
    another.

@{FG TEXT}@{UB}
@{B}INPUTS@{UB}
    oldName - pointer to a null-terminated string
    newName - pointer to a null-terminated string


@{B}SEE ALSO@{UB}
    Relabel

@ENDNODE

@NODE "remSegment" "remSegment"
@{FG SHINE}remSegment@{FG TEXT}

@{B}NAME@{UB}
@{B}    RemSegment - Removes a resident segment from the resident list (V36)

@{UB}
@{B}SYNOPSIS@{UB}
    BOOL success = RemSegment( struct Segment *segment );


@{B}FUNCTION@{UB}
@{B}@{FG SHINE}    Removes a resident segment from the Dos resident segment list,
    unloads it, and does any other cleanup required.  Will only succeed
    if the seg_UC (usecount) is 0.

@{FG TEXT}@{UB}
@{B}INPUTS@{UB}
    segment - the segment to be removed


@{B}SEE ALSO@{UB}
    FindSegment, AddSegment

@ENDNODE

@NODE "remDosEntry" "remDosEntry"
@{FG SHINE}remDosEntry@{FG TEXT}

@{B}NAME@{UB}
@{B}    RemDosEntry -- Removes a Dos List entry from it's list (V36)

@{UB}
@{B}SYNOPSIS@{UB}
    BOOL success = RemDosEntry( struct DosList *dlist );


@{B}FUNCTION@{UB}
@{B}@{FG SHINE}    This removes an entry from the Dos Device list.  The memory associated
    with the entry is NOT freed.  NOTE: you must have locked the Dos List
    with the appropriate flags before calling this routine.  Handler
    writers should see the AddDosEntry() caveats about locking and use
    a similar workaround to avoid deadlocks.

@{FG TEXT}@{UB}
@{B}INPUTS@{UB}
    dlist   - Device list entry to be removed.


@{B}SEE ALSO@{UB}
    AddDosEntry, FindDosEntry, NextDosEntry, LockDosList,
    MakeDosEntry, FreeDosEntry

@ENDNODE

@NODE "remAssignList" "remAssignList"
@{FG SHINE}remAssignList@{FG TEXT}

@{B}NAME@{UB}
@{B}    RemAssignList -- Remove an entry from a multi-dir assign (V36)

@{UB}
@{B}SYNOPSIS@{UB}
    BOOL success = RemAssignList( char *name, BPTR lock );


@{B}FUNCTION@{UB}
@{B}@{FG SHINE}    Removes an entry from a multi-directory assign.  The entry removed is
    the first one for which SameLock with 'lock' returns that they are on
    the same object.  The lock for the entry in the list is unlocked (not
    the entry passed in).

@{FG TEXT}@{UB}
@{B}INPUTS@{UB}
    name - Name of device to remove lock from (without trailing ':')
    lock - Lock associated with the object to remove from the list


@{B}BUGS@{UB}
@{FG SHINE}    In V36 through V39.23 dos, it would fail to remove the first lock
    in the assign.  Fixed in V39.24 dos (after the V39.106 kickstart).

@{FG TEXT}
@{B}SEE ALSO@{UB}
    Lock, AssignLock, AssignPath, AssignLate, DupLock,
    AssignAdd, UnLock

@ENDNODE

@NODE "relabel" "relabel"
@{FG SHINE}relabel@{FG TEXT}

@{B}NAME@{UB}
@{B}    Relabel -- Change the volume name of a volume (V36)

@{UB}
@{B}SYNOPSIS@{UB}
    BOOL success = Relabel( char *volumename, char *name )


@{B}FUNCTION@{UB}
@{B}@{FG SHINE}    Changes the volumename of a volume, if supported by the filesystem.

@{FG TEXT}@{UB}
@{B}INPUTS@{UB}
    volumename - Full name of device to rename (with ':')
    newname    - New name to apply to device (without ':')

@ENDNODE

@NODE "readLink" "readLink"
@{FG SHINE}readLink@{FG TEXT}

@{B}NAME@{UB}
@{B}    ReadLink -- Reads the path for a soft filesystem link (V36)

@{UB}
@{B}SYNOPSIS@{UB}
    BOOL success = ReadLink( struct MsgPort *port, BPTR lock,
                             char *path, char *buffer, 
                             ULONG size );


@{B}FUNCTION@{UB}
@{B}@{FG SHINE}    ReadLink() takes a lock/name pair (usually from a failed attempt
    to use them to access an object with packets), and asks the
    filesystem to find the softlink and fill buffer with the modified
    path string.  You then start the resolution process again by
    calling GetDeviceProc() with the new string from ReadLink().
 
    Soft-links are resolved at access time by a combination of the
    filesystem (by returning ERROR_IS_SOFT_LINK to dos), and by
    Dos (using ReadLink() to resolve any links that are hit).

@{FG TEXT}@{UB}
@{B}INPUTS@{UB}
    port - msgport of the filesystem
    lock - lock this path is relative to on the filesystem
    path - path that caused the ERROR_IS_SOFT_LINK
    buffer - pointer to buffer for new path from handler.
    size - size of buffer.


@{B}BUGS@{UB}
@{FG SHINE}    In V36, soft-links didn't work in the ROM filesystem.  This was
    fixed for V37.

@{FG TEXT}
@{B}SEE ALSO@{UB}
    MakeLink, Open, Lock, GetDeviceProc

@ENDNODE

@NODE "readItem" "readItem"
@{FG SHINE}readItem@{FG TEXT}

@{B}NAME@{UB}
@{B}    ReadItem - reads a single argument/name from command line (V36)

@{UB}
@{B}SYNOPSIS@{UB}
    LONG value = ReadItem( char *buffer, LONG maxchars, 
                           struct CSource *input );


@{B}FUNCTION@{UB}
@{B}@{FG SHINE}    Reads a "word" from either Input() (buffered), or via CSource, if it
    is non-NULL (see <dos/rdargs.h> for more information).  Handles
    quoting and some '*' substitutions (*e and *n) inside quotes (only).
    See dos/dos.h for a listing of values returned by ReadItem()
    (ITEM_XXXX).  A "word" is delimited by whitespace, quotes, '=', or
    an EOF.

    ReadItem always unreads the last thing read (UnGetC(fh,-1)) so the
    caller can find out what the terminator was.

@{FG TEXT}@{UB}
@{B}INPUTS@{UB}
    buffer   - buffer to store word in.
    maxchars - size of the buffer
    input    - CSource input or NULL (uses FGetC(Input()))


@{B}RESULT@{UB}
    value - See <dos/dos.h> for return values.


@{B}BUGS@{UB}
@{FG SHINE}    Doesn't actually unread the terminator.

@{FG TEXT}
@{B}SEE ALSO@{UB}
    ReadArgs, FindArg, UnGetC, FGetC, Input, <dos/dos.h>,
    <dos/rdargs.h>, FreeArgs

@ENDNODE

@NODE "readArgs" "readArgs"
@{FG SHINE}readArgs@{FG TEXT}

@{B}NAME@{UB}
@{B}    ReadArgs - Parse the command line input (V36)

@{UB}
@{B}SYNOPSIS@{UB}
    struct RDArgs *result = ReadArgs( char          *template, 
                                      LONG          *array,
                                      struct RDArgs *rdargs
                                    );


@{B}FUNCTION@{UB}
@{B}@{FG SHINE}    Parses and argument string according to a template.  Normally gets
    the arguments by reading buffered IO from Input(), but also can be
    made to parse a string.  MUST be matched by a call to FreeArgs().
 
    ReadArgs() parses the commandline according to a template that is
    passed to it.  This specifies the different command-line options and
    their types.  A template consists of a list of options.  Options are
    named in "full" names where possible (for example, "Quick" instead of
    "Q").  Abbreviations can also be specified by using "abbrev=option"
    (for example, "Q=Quick").
 
    Options in the template are separated by commas.  To get the results
    of ReadArgs(), you examine the array of longwords you passed to it
    (one entry per option in the template).  This array should be cleared
    (or initialized to your default values) before passing to ReadArgs().
    Exactly what is put in a given entry by ReadArgs() depends on the type
    of option.  The default is a string (a sequence of non-whitespace
    characters, or delimited by quotes, which will be stripped by
    ReadArgs()), in which case the entry will be a pointer.
 
    Options can be followed by modifiers, which specify things such as
    the type of the option.  Modifiers are specified by following the
    option with a '/' and a single character modifier.  Multiple modifiers
    can be specified by using multiple '/'s.  Valid modifiers are:
 
    /S - Switch.  This is considered a boolean variable, and will be
         set if the option name appears in the command-line.  The entry
         is the boolean (0 for not set, non-zero for set).
 
    /K - Keyword.  This means that the option will not be filled unless
         the keyword appears.  For example if the template is "Name/K",
         then unless "Name=<string>" or "Name <string>" appears in the
         command line, Name will not be filled.
 
    /N - Number.  This parameter is considered a decimal number, and will
         be converted by ReadArgs.  If an invalid number is specified,
         an error will be returned.  The entry will be a pointer to the
         longword number (this is how you know if a number was specified).
 
    /T - Toggle.  This is similar to a switch, but when specified causes
         the boolean value to "toggle".  Similar to /S.
 
    /A - Required.  This keyword must be given a value during command-line
         processing, or an error is returned.
 
    /F - Rest of line.  If this is specified, the entire rest of the line
         is taken as the parameter for the option, even if other option
         keywords appear in it.
 
    /M - Multiple strings.  This means the argument will take any number
         of strings, returning them as an array of strings.  Any arguments
         not considered to be part of another option will be added to this
         option.  Only one /M should be specified in a template.  Example:
         for a template "Dir/M,All/S" the command-line "foo bar all qwe"
         will set the boolean "all", and return an array consisting of
         "foo", "bar", and "qwe".  The entry in the array will be a pointer
         to an array of string pointers, the last of which will be NULL.
 
         There is an interaction between /M parameters and /A parameters.
         If there are unfilled /A parameters after parsing, it will grab
         strings from the end of a previous /M parameter list to fill the
         /A's.  This is used for things like Copy ("From/A/M,To/A").
 
    ReadArgs() returns a struct RDArgs if it succeeds.  This serves as an
    "anchor" to allow FreeArgs() to free the associated memory.  You can
    also pass in a struct RDArgs to control the operation of ReadArgs()
    (normally you pass NULL for the parameter, and ReadArgs() allocates
    one for you).  This allows providing different sources for the
    arguments, providing your own string buffer space for temporary
    storage, and extended help text.  See <dos/rdargs.h> for more
    information on this.  Note: if you pass in a struct RDArgs, you must
    still call FreeArgs() to release storage that gets attached to it,
    but you are responsible for freeing the RDArgs yourself.
 
    If you pass in a RDArgs structure, you MUST reset (clear or set)
    RDA_Buffer for each new call to RDArgs.  The exact behavior if you
    don't do this varies from release to release and case to case; don't
    count on the behavior!
 
    See BUGS regarding passing in strings.
    
@{FG TEXT}@{UB}
@{B}INPUTS@{UB}
    template - formatting string
    array    - array of longwords for results, 1 per template entry
    rdargs   - optional rdargs structure for options.  AllocDosObject
               should be used for allocating them if you pass one in.


@{B}RESULT@{UB}
    result   - a struct RDArgs or NULL for failure.


@{B}BUGS@{UB}
@{FG SHINE}    In V36, there were a couple of minor bugs with certain argument
    combinations (/M/N returned strings, /T didn't work, and /K and
    /F interacted).  Also, a template with a /K before any non-switch
    parameter will require the argument name to be given in order for
    line to be accepted (i.e. "parm/K,xyzzy/A" would require
    "xyzzy=xxxxx" in order to work - "xxxxx" would not work).  If you
    need to avoid this for V36, put /K parameters after all non-switch
    parameters.  These problems should be fixed for V37.
 
    Currently (V37 and before) it requires any strings passed in to have
    newlines at the end of the string.  This may or may not be fixed in
    the future.

@{FG TEXT}
@{B}SEE ALSO@{UB}
    FindArg, ReadItem, FreeArgs, AllocDosObject

@ENDNODE

@NODE "readFile" "readFile"
@{FG SHINE}readFile@{FG TEXT}

@{B}NAME@{UB}
@{B}    Read -- Read bytes of data from a file

@{UB}
@{B}SYNOPSIS@{UB}
    LONG actualLength = Read( BPTR file, char *buffer, LONG length );


@{B}FUNCTION@{UB}
@{B}@{FG SHINE}    Data can be copied using a combination of Read() and Write().
    Read() reads bytes of information from an opened file (represented
    here by the argument 'file') into the buffer given. The argument
    'length' is the length of the buffer given.
 
    The value returned is the length of the information actually read.
    So, when 'actualLength' is greater than zero, the value of
    'actualLength' is the the number of characters read. Usually Read
    will try to fill up your buffer before returning. A value of zero
    means that end-of-file has been reached. Errors are indicated by a
    value of -1.
 
    Note: this is an unbuffered routine (the request is passed directly
    to the filesystem.)  Buffered I/O is more efficient for small
    reads and writes; see FGetC().

@{FG TEXT}@{UB}
@{B}INPUTS@{UB}
    file   - BCPL pointer to a file handle
    buffer - pointer to buffer
    length - integer


@{B}RESULT@{UB}
    actualLength - integer


@{B}SEE ALSO@{UB}
    Open, Close, Write, Seek, FGetC

@ENDNODE

@NODE "putStr" "putStr"
@{FG SHINE}putStr@{FG TEXT}

@{B}NAME@{UB}
@{B}    PutStr -- Writes a string the the default output (buffered) (V36)

@{UB}
@{B}SYNOPSIS@{UB}
    LONG error = PutStr( char *str );


@{B}FUNCTION@{UB}
@{B}@{FG SHINE}    This routine writes an unformatted string to the default output.  No 
    newline is appended to the string and any error is returned.  This
    routine is buffered.

@{FG TEXT}@{UB}
@{B}INPUTS@{UB}
    str   - Null-terminated string to be written to default output


@{B}RESULT@{UB}
    error - 0 for success, -1 for any error.  NOTE: this is opposite
            most Dos function returns!


@{B}SEE ALSO@{UB}
    FPuts, FPutC, FWrite, WriteChars

@ENDNODE

@NODE "printFault" "printFault"
@{FG SHINE}printFault@{FG TEXT}

@{B}NAME@{UB}
@{B}    PrintFault -- Returns the text associated with a DOS error code (V36)

@{UB}
@{B}SYNOPSIS@{UB}
    BOOL success = PrintFault( LONG code, char *header );


@{B}FUNCTION@{UB}
@{B}@{FG SHINE}    This routine obtains the error message text for the given error code.
    This is similar to the Fault() function, except that the output is
    written to the default output channel with buffered output.
    The value returned by IoErr() is set to the code passed in.

@{FG TEXT}@{UB}
@{B}INPUTS@{UB}
    code   - Error code
    header - header to output before error text


@{B}SEE ALSO@{UB}
    IoErr, Fault, SetIoErr, Output, FPuts

@ENDNODE

@NODE "pathPart" "pathPart"
@{FG SHINE}pathPart@{FG TEXT}

@{B}NAME@{UB}
@{B}    PathPart -- Returns a pointer to the end of the next-to-last (V36)
                component of a path.

@{UB}
@{B}SYNOPSIS@{UB}
    char *fileptr = PathPart( char *path );


@{B}FUNCTION@{UB}
@{B}@{FG SHINE}    This function returns a pointer to the character after the next-to-last
    component of a path specification, which will normally be the directory
    name.  If there is only one component, it returns a pointer to the
    beginning of the string.  The only real difference between this and
    FilePart() is the handling of '/'.

@{FG TEXT}@{UB}
@{B}INPUTS@{UB}
    path - pointer to an path string.  May be relative to the current
           directory or the current disk.


@{B}RESULT@{UB}
    fileptr - pointer to the end of the next-to-last component of the path.


@{B}EXAMPLE@{UB}
    PathPart("xxx:yyy/zzz/qqq") would return a pointer to the last '/'.
    PathPart("xxx:yyy") would return a pointer to the first 'y').


@{B}SEE ALSO@{UB}
    FilePart, AddPart

@ENDNODE

@NODE "parsePatternNoCase" "parsePatternNoCase"
@{FG SHINE}parsePatternNoCase@{FG TEXT}

@{B}NAME@{UB}
@{B}    ParsePatternNoCase -- Create a tokenized string for
                          MatchPatternNoCase (V37)

@{UB}
@{B}SYNOPSIS@{UB}
    LONG IsWild = ParsePatternNoCase( char *Source, char *Dest, LONG DestLength );


@{B}FUNCTION@{UB}
@{B}@{FG SHINE}    Tokenizes a pattern, for use by MatchPatternNoCase().  Also indicates
    if there are any wildcards in the pattern (i.e. whether it might match
    more than one item).  Note that Dest must be at least 2 times as
    large as Source plus 2 bytes.

    For a description of the wildcards, see ParsePattern().

@{FG TEXT}@{UB}
@{B}INPUTS@{UB}
    source     - unparsed wildcard string to search for.
    dest       - output string, gets tokenized version of input.
    DestLength - length available in destination (should be at least as
                 twice as large as source + 2 bytes).


@{B}RESULT@{UB}
    IsWild - 1 means there were wildcards in the pattern,
             0 means there were no wildcards in the pattern,
            -1 means there was a buffer overflow or other error


@{B}BUGS@{UB}
@{FG SHINE}    In V37 this call didn't always set IoErr() to something useful on an
    error.  Fixed in V39.
    In V37, it didn't properly convert character-classes ([x-y]) to
    upper case.  Workaround: convert the input pattern to upper case
    using ToUpper() from utility.library before calling
    ParsePatternNoCase().  Fixed in V39 dos.

@{FG TEXT}
@{B}SEE ALSO@{UB}
    ParsePattern, MatchPatternNoCase, MatchFirst, MatchNext,
    utility.library/ToUpper

@ENDNODE

@NODE "parsePattern" "parsePattern"
@{FG SHINE}parsePattern@{FG TEXT}

@{B}NAME@{UB}
@{B}    ParsePattern -- Create a tokenized string for MatchPattern (V36)

@{UB}
@{B}SYNOPSIS@{UB}
    LONG IsWild = ParsePattern( char *Source, char *Dest, LONG DestLength );


@{B}FUNCTION@{UB}
@{B}@{FG SHINE}    Tokenizes a pattern, for use by MatchPattern().  Also indicates if
    there are any wildcards in the pattern (i.e. whether it might match
    more than one item).  Note that Dest must be at least 2 times as
    large as Source plus bytes to be (almost) 100% certain of no
    buffer overflow.  This is because each input character can currently
    expand to 2 tokens (with one exception that can expand to 3, but
    only once per string).  Note: this implementation may change in
    the future, so you should handle error returns in all cases, but
    the size above should still be a reasonable upper bound for a buffer
    allocation.
 
    The patterns are fairly extensive, and approximate some of the ability
    of Unix/grep "regular expression" patterns.  Here are the available
    tokens:

    ?   Matches a single character.
    #   Matches the following expression 0 or more times.
    (ab|cd)   Matches any one of the items seperated by '|'.
    ~   Negates the following expression.  It matches all strings
       that do not match the expression (aka ~(foo) matches all
       strings that are not exactly "foo").
    [abc]   Character class: matches any of the characters in the class.
    [~bc]   Character class: matches any of the characters not in the
       class.
    a-z   Character range (only within character classes). 
    %   Matches 0 characters always (useful in "(foo|bar|%)").
    *   Synonym for "#?", not available by default in 2.0.  Available
       as an option that can be turned on.
 
    "Expression" in the above table means either a single character
    (ex: "#?"), or an alternation (ex: "#(ab|cd|ef)"), or a character
    class (ex: "#[a-zA-Z]").

@{FG TEXT}@{UB}
@{B}INPUTS@{UB}
    source     - unparsed wildcard string to search for.
    dest       - output string, gets tokenized version of input.
    DestLength - length available in destination (should be at least as
                 twice as large as source + 2 bytes).


@{B}RESULT@{UB}
    IsWild - 1 means there were wildcards in the pattern,
             0 means there were no wildcards in the pattern,
            -1 means there was a buffer overflow or other error


@{B}BUGS@{UB}
@{FG SHINE}    In V37 this call didn't always set IoErr() to something useful on an
    error.  Fixed in V39.
 
@{FG TEXT}
@{B}SEE ALSO@{UB}
    ParsePatternNoCase, MatchPattern, MatchFirst, MatchNext

@ENDNODE

@NODE "parentOfFH" "parentOfFH"
@{FG SHINE}parentOfFH@{FG TEXT}

@{B}NAME@{UB}
@{B}    ParentOfFH -- returns a lock on the parent directory of a file (V36)

@{UB}
@{B}SYNOPSIS@{UB}
    BPTR lock = ParentOfFH( BPTR fh );


@{B}FUNCTION@{UB}
@{B}@{FG SHINE}    Returns a shared lock on the parent directory of the filehandle.

@{FG TEXT}@{UB}
@{B}INPUTS@{UB}
    fh   - Filehandle you want the parent of.


@{B}RESULT@{UB}
    lock - Lock on parent directory of the filehandle or NULL for failure.


@{B}SEE ALSO@{UB}
    Parent, Lock, UnLock DupLockFromFH

@ENDNODE

@NODE "parentDir" "parentDir"
@{FG SHINE}parentDir@{FG TEXT}

@{B}NAME@{UB}
@{B}    ParentDir -- Obtain the parent of a directory or file

@{UB}
@{B}SYNOPSIS@{UB}
    BPTR newlock = ParentDir( BPTR lock )


@{B}FUNCTION@{UB}
@{B}@{FG SHINE}    The argument 'lock' is associated with a given file or directory.
    ParentDir() returns 'newlock' which is associated the parent
    directory of 'lock'.

    Taking the ParentDir() of the root of the current filing system
    returns a NULL (0) lock.  Note this 0 lock represents the root of
    file system that you booted from (which is, in effect, the parent
    of all other file system roots.)

@{FG TEXT}@{UB}
@{B}INPUTS@{UB}
    lock - BCPL pointer to a lock


@{B}RESULT@{UB}
    newlock - BCPL pointer to a lock


@{B}SEE ALSO@{UB}
    Lock, DupLock, UnLock, ParentOfFH, DupLockFromFH

@ENDNODE

@NODE "output" "output"
@{FG SHINE}output@{FG TEXT}

@{B}NAME@{UB}
@{B}    Output -- Identify the programs' initial output file handle

@{UB}
@{B}SYNOPSIS@{UB}
    BPTR file = Output( void );


@{B}FUNCTION@{UB}
@{B}@{FG SHINE}    Output() is used to identify the initial output stream allocated
    when the program was initiated.  Never close the filehandle returned
    by Output().

@{FG TEXT}@{UB}
@{B}RESULT@{UB}
    file - BCPL pointer to a file handle


@{B}SEE ALSO@{UB}
    Input

@ENDNODE

@NODE "openFromLock" "openFromLock"
@{FG SHINE}openFromLock@{FG TEXT}

@{B}NAME@{UB}
@{B}    OpenFromLock -- Opens a file you have a lock on (V36)

@{UB}
@{B}SYNOPSIS@{UB}
    BPTR fh = OpenFromLock( BPTR lock )


@{B}FUNCTION@{UB}
@{B}@{FG SHINE}    Given a lock, this routine performs an open on that lock.  If the open
    succeeds, the lock is (effectively) relinquished, and should not be
    UnLock()ed or used.  If the open fails, the lock is still usable.
    The lock associated with the file internally is of the same access
    mode as the lock you gave up - shared is similar to MODE_OLDFILE,
    exclusive is similar to MODE_NEWFILE.

@{FG TEXT}@{UB}
@{B}INPUTS@{UB}
    lock - Lock on object to be opened.


@{B}RESULT@{UB}
    fh   - Newly opened file handle or NULL for failure


@{B}BUGS@{UB}
@{FG SHINE}    In the original V36 autodocs, this was shown (incorrectly) as
    taking a Mode parameter as well.  The prototypes and pragmas were
    also wrong.

@{FG TEXT}
@{B}SEE ALSO@{UB}
    Open, Close, Lock, UnLock

@ENDNODE

@NODE "openFile" "openFile"
@{FG SHINE}openFile@{FG TEXT}

@{B}NAME@{UB}
@{B}    Open -- Open a file for input or output

@{UB}
@{B}SYNOPSIS@{UB}
    BPTR file = Open( char *name, LONG accessMode );


@{B}FUNCTION@{UB}
@{B}@{FG SHINE}    The named file is opened and a file handle returned.  If the
    accessMode is MODE_OLDFILE, an existing file is opened for reading
    or writing. If the value is MODE_NEWFILE, a new file is created for
    writing. MODE_READWRITE opens a file with an shared lock, but
    creates it if it didn't exist.  Open types are documented in the
    <dos/dos.h> or <libraries/dos.h> include file.

    The 'name' can be a filename (optionally prefaced by a device
    name), a simple device such as NIL:, a window specification such as
    CON: or RAW: followed by window parameters, or "*", representing the
    current window.  Note that as of V36, "*" is obsolete, and CONSOLE:
    should be used instead.
 
    If the file cannot be opened for any reason, the value returned
    will be zero, and a secondary error code will be available by
    calling the routine IoErr().

@{FG TEXT}@{UB}
@{B}INPUTS@{UB}
    name      - pointer to a null-terminated string
    accessMode - integer


@{B}RESULT@{UB}
    file - BCPL pointer to a file handle


@{B}SEE ALSO@{UB}
    Close, ChangeMode, NameFromFH, ParentOfFH, ExamineFH

@ENDNODE

@NODE "nextDosEntry" "nextDosEntry"
@{FG SHINE}nextDosEntry@{FG TEXT}

@{B}NAME@{UB}
@{B}    NextDosEntry -- Get the next Dos List entry (V36)

@{UB}
@{B}SYNOPSIS@{UB}
    struct DosList *newdlist = NextDosEntry( struct DosList *dlist,
                                             ULONG           flags
                                           );
 

@{B}FUNCTION@{UB}
@{B}@{FG SHINE}    Find the next Dos List entry of the right type.  You MUST have locked
    the types you're looking for.  Returns NULL if there are no more of
    that type in the list.

@{FG TEXT}@{UB}
@{B}INPUTS@{UB}
    dlist    - The current device entry.
    flags    - What type of entries to look for.


@{B}RESULT@{UB}
    newdlist - The next device entry of the right type or NULL.


@{B}SEE ALSO@{UB}
    AddDosEntry, RemDosEntry, FindDosEntry, LockDosList,
    MakeDosEntry, FreeDosEntry

@ENDNODE

@NODE "newLoadSeg" "newLoadSeg"
@{FG SHINE}newLoadSeg@{FG TEXT}

@{B}NAME@{UB}
@{B}    NewLoadSeg -- Improved version of LoadSeg for stacksizes (V36)

@{UB}
@{B}SYNOPSIS@{UB}
    BPTR seglist = NewLoadSeg( char *file, struct TagItem *tags );


@{B}FUNCTION@{UB}
@{B}@{FG SHINE}    Does a LoadSeg on a file, and takes additional actions based on the
    tags supplied.

    Clears unused portions of Code and Data hunks (as well as BSS hunks).
    (This also applies to InternalLoadSeg() and LoadSeg()).

    NOTE to overlay users: NewLoadSeg() does NOT return seglist in
    both D0 and D1, as LoadSeg does.  The current ovs.asm uses LoadSeg(),
    and assumes returns are in D1.  We will support this for LoadSeg()
    ONLY.

@{FG TEXT}@{UB}
@{B}INPUTS@{UB}
    file - Filename of file to load
    tags - pointer to tagitem array


@{B}RESULT@{UB}
    seglist - Seglist loaded, or NULL


@{B}BUGS@{UB}
@{FG SHINE}    No tags are currently defined.

@{FG TEXT}
@{B}SEE ALSO@{UB}
    LoadSeg, UnLoadSeg, InternalLoadSeg, InternalUnLoadSeg

@ENDNODE

@NODE "nameFromLock" "nameFromLock"
@{FG SHINE}nameFromLock@{FG TEXT}

@{B}NAME@{UB}
@{B}    NameFromLock -- Returns the name of a locked object (V36)

@{UB}
@{B}SYNOPSIS@{UB}
    BOOL success = NameFromLock( BPTR lock, char *buffer, LONG length );


@{B}FUNCTION@{UB}
@{B}@{FG SHINE}    Returns a fully qualified path for the lock.  This routine is
    guaranteed not to write more than len characters into the buffer.  The
    name will be null-terminated.  NOTE: if the volume is not mounted,
    the system will request it (unless of course you set pr_WindowPtr to
    -1).  If the volume is not mounted or inserted, it will return an
    error.  If the lock passed in is NULL, "SYS:" will be returned. If
    the buffer is too short, an error will be returned, and IoErr() will
    return ERROR_LINE_TOO_LONG.

@{FG TEXT}@{UB}
@{B}INPUTS@{UB}
    lock   - Lock of object to be examined.
    buffer - Buffer to store name.
    len    - Length of buffer.


@{B}BUGS@{UB}
@{FG SHINE}    Should return the name of the boot volume instead of SYS: for a NULL
    lock.

@{FG TEXT}
@{B}SEE ALSO@{UB}
    NameFromFH, Lock

@ENDNODE

@NODE "nameFromFH" "nameFromFH"
@{FG SHINE}nameFromFH@{FG TEXT}

@{B}NAME@{UB}
@{B}    NameFromFH -- Get the name of an open filehandle (V36)

@{UB}
@{B}SYNOPSIS@{UB}
    BOOL success = NameFromFH( BPTR fh, char *buffer, LONG length );


@{B}FUNCTION@{UB}
@{B}@{FG SHINE}    Returns a fully qualified path for the filehandle.  This routine is
    guaranteed not to write more than len characters into the buffer.  The
    name will be null-terminated.  See NameFromLock() for more information.
 
    Note: Older filesystems that don't support ExamineFH() will cause
    NameFromFH() to fail with ERROR_ACTION_NOT_SUPPORTED.

@{FG TEXT}@{UB}
@{B}INPUTS@{UB}
    fh     - Lock of object to be examined.
    buffer - Buffer to store name.
    len    - Length of buffer.


@{B}SEE ALSO@{UB}
    NameFromLock, ExamineFH

@ENDNODE

@NODE "maxCli" "maxCli"
@{FG SHINE}maxCli@{FG TEXT}

@{B}NAME@{UB}
@{B}    MaxCli -- returns the highest CLI process number possibly in use (V36)

@{UB}
@{B}SYNOPSIS@{UB}
    LONG number = MaxCli( void );


@{B}FUNCTION@{UB}
@{B}@{FG SHINE}    Returns the highest CLI number that may be in use.  CLI numbers are
    reused, and are usually as small as possible.  To find all CLIs, scan
    using FindCliProc() from 1 to MaxCLI().  The number returned by
    MaxCli() may change as processes are created and destroyed.

@{FG TEXT}@{UB}
@{B}RESULT@{UB}
    number - The highest CLI number that _may_ be in use.


@{B}SEE ALSO@{UB}
    FindCliProc, Cli

@ENDNODE

@NODE "matchPatternNoCase" "matchPatternNoCase"
@{FG SHINE}matchPatternNoCase@{FG TEXT}

@{B}NAME@{UB}
@{B}    MatchPatternNoCase --  Checks for a pattern match with a string (V37)

@{UB}
@{B}SYNOPSIS@{UB}
    BOOL match = MatchPatternNoCase( char *pat, char *str );


@{B}FUNCTION@{UB}
@{B}@{FG SHINE}    Checks for a pattern match with a string.  The pattern must be a
    tokenized string output by ParsePatternNoCase().  This routine is
    case-insensitive.

    NOTE: this routine is highly recursive.  You must have at least
    1500 free bytes of stack to call this (it will cut off it's
    recursion before going any deeper than that and return failure).
    That's _currently_ enough for about 100 levels deep of #, (, ~, etc.

@{FG TEXT}@{UB}
@{B}INPUTS@{UB}
    pat - Special pattern string to match as returned by ParsePatternNoCase()
    str - String to match against given pattern


@{B}RESULT@{UB}
    match - success or failure of pattern match.  On failure,
       IoErr() will return 0 or ERROR_TOO_MANY_LEVELS (starting
       with V37 - before that there was no stack checking).


@{B}BUGS@{UB}
@{FG SHINE}    See ParsePatternNoCase.

@{FG TEXT}
@{B}SEE ALSO@{UB}
    ParsePatternNoCase, MatchPattern, MatchFirst, MatchNext

@ENDNODE

@NODE "matchPattern" "matchPattern"
@{FG SHINE}matchPattern@{FG TEXT}

@{B}NAME@{UB}
@{B}    MatchPattern --  Checks for a pattern match with a string (V36)

@{UB}
@{B}SYNOPSIS@{UB}
    BOOL match = MatchPattern( char *pat, char *str );


@{B}FUNCTION@{UB}
@{B}@{FG SHINE}    Checks for a pattern match with a string.  The pattern must be a
    tokenized string output by ParsePattern().  This routine is
    case-sensitive.

    NOTE: this routine is highly recursive.  You must have at least
    1500 free bytes of stack to call this (it will cut off it's
    recursion before going any deeper than that and return failure).
    That's _currently_ enough for about 100 levels deep of #, (, ~, etc.

@{FG TEXT}@{UB}
@{B}INPUTS@{UB}
    pat - Special pattern string to match as returned by ParsePattern()
    str - String to match against given pattern


@{B}RESULT@{UB}
    match - success or failure of pattern match.  On failure,
       IoErr() will return 0 or ERROR_TOO_MANY_LEVELS (starting
       with V37 - before that there was no stack checking).


@{B}SEE ALSO@{UB}
    ParsePattern, MatchPatternNoCase, MatchFirst, MatchNext

@ENDNODE

@NODE "matchNext" "matchNext"
@{FG SHINE}matchNext@{FG TEXT}

@{B}NAME@{UB}
@{B}    MatchNext - Finds the next file or directory that matches pattern (V36)

@{UB}
@{B}SYNOPSIS@{UB}
    LONG error = MatchNext( struct AnchorPath *ap );


@{B}FUNCTION@{UB}
@{B}@{FG SHINE}    Locates the next file or directory that matches a given pattern.
    See <dos/dosasl.h> for more information.  Various bits in the flags
    allow the application to control the operation of MatchNext().

    See MatchFirst() for other notes.

@{FG TEXT}@{UB}
@{B}INPUTS@{UB}
    AnchorPath - Place holder for search.  MUST be longword aligned!


@{B}RESULT@{UB}
    error - 0 for success or error code.  (Opposite of most Dos calls)


@{B}BUGS@{UB}
@{FG SHINE}    See MatchFirst.

@{FG TEXT}
@{B}SEE ALSO@{UB}
    MatchFirst, ParsePattern, Examine, CurrentDir, Examine,
    MatchEnd, ExNext, <dos/dosasl.h>

@ENDNODE

@NODE "matchFirst" "matchFirst"
@{FG SHINE}matchFirst@{FG TEXT}

@{B}NAME@{UB}
@{B}    MatchFirst -- Finds file that matches pattern (V36)

@{UB}
@{B}SYNOPSIS@{UB}
    LONG error = MatchFirst( char *pat, struct AnchorPath *ap );


@{B}FUNCTION@{UB}
@{B}@{FG SHINE}    Locates the first file or directory that matches a given pattern.
    MatchFirst() is passed your pattern (you do not pass it through
    ParsePattern() - MatchFirst() does that for you), and the control
    structure.  MatchFirst() normally initializes your AnchorPath
    structure for you, and returns the first file that matched your
    pattern, or an error.  Note that MatchFirst()/MatchNext() are unusual
    for Dos in that they return 0 for success, or the error code (see
    <dos/dos.h>), instead of the application getting the error code
    from IoErr().
 
    When looking at the result of MatchFirst()/MatchNext(), the ap_Info
    field of your AnchorPath has the results of an Examine() of the object.
    You normally get the name of the object from fib_FileName, and the
    directory it's in from ap_Current->an_Lock.  To access this object,
    normally you would temporarily CurrentDir() to the lock, do an action
    to the file/dir, and then CurrentDir() back to your original directory.
    This makes certain you affect the right object even when two volumes
    of the same name are in the system.  You can use ap_Buf (with
    ap_Strlen) to get a name to report to the user.
 
    To initialize the AnchorPath structure (particularily when reusing
    it), set ap_BreakBits to the signal bits (CDEF) that you want to take
    a break on, or NULL, if you don't want to convenience the user.
    ap_Flags should be set to any flags you need or all 0's otherwise.
    ap_FoundBreak should be cleared if you'll be using breaks.
 
    If you want to have the FULL PATH NAME of the files you found,
    allocate a buffer at the END of this structure, and put the size of
    it into ap_Strlen.  If you don't want the full path name, make sure
    you set ap_Strlen to zero.  In this case, the name of the file, and
    stats are available in the ap_Info, as per usual.
 
    Then call MatchFirst() and then afterwards, MatchNext() with this
    structure.  You should check the return value each time (see below)
    and take the appropriate action, ultimately calling MatchEnd() when
    there are no more files or you are done.  You can tell when you are
    done by checking for the normal AmigaDOS return code
    ERROR_NO_MORE_ENTRIES.
 
    Note: patterns with trailing slashes may cause MatchFirst()/MatchNext()
    to return with an ap_Current->an_Lock on the object, and a filename
    of the empty string ("").

    See ParsePattern() for more information on the patterns.

@{FG TEXT}@{UB}
@{B}INPUTS@{UB}
    pat        - Pattern to search for
    AnchorPath - Place holder for search.  MUST be longword aligned!


@{B}RESULT@{UB}
    error - 0 for success or error code.  (Opposite of most Dos calls!)


@{B}BUGS@{UB}
@{FG SHINE}    In V36, there were a number of bugs with MatchFirst()/MatchNext().
    One was that if you entered a directory with a name like "df0:l"
    using DODIR, it would re-lock the full string "df0:l", which can
    cause problems if the disk has changed.  It also had problems
    with patterns such as #?/abc/def - the ap_Current->an_Lock would
    not be on the directory def is found in.  ap_Buf would be correct,
    however.  It had similar problems with patterns with trailing
    slashes.  These have been fixed for V37 and later.
 
    A bug that has not been fixed for V37 concerns a pattern of a
    single directory name (such as "l").  If you enter such a directory
    via DODIR, it re-locks l relative to the current directory.  Thus
    you must not change the current directory before calling MatchNext()
    with DODIR in that situation.  If you aren't using DODIR to enter
    directories you can ignore this.  This may be fixed in some upcoming
    release.
 
@{FG TEXT}
@{B}SEE ALSO@{UB}
    MatchNext, ParsePattern, Examine, CurrentDir, Examine,
    MatchEnd, ExNext, <dos/dosasl.h>

@ENDNODE

@NODE "matchEnd" "matchEnd"
@{FG SHINE}matchEnd@{FG TEXT}

@{B}NAME@{UB}
@{B}    MatchEnd -- Free storage allocated for MatchFirst()/MatchNext() (V36)

@{UB}
@{B}SYNOPSIS@{UB}
    void MatchEnd( struct AnchorPath *ap );


@{B}FUNCTION@{UB}
@{B}@{FG SHINE}    Return all storage associated with a given search.

@{FG TEXT}@{UB}
@{B}INPUTS@{UB}
    AnchorPath - Anchor used for MatchFirst()/MatchNext()
                 MUST be longword aligned!


@{B}SEE ALSO@{UB}
    MatchFirst, ParsePattern, Examine, CurrentDir, Examine,
    MatchNext, ExNext, <dos/dosasl.h>

@ENDNODE

@NODE "makeLink" "makeLink"
@{FG SHINE}makeLink@{FG TEXT}

@{B}NAME@{UB}
@{B}    MakeLink -- Creates a filesystem link (V36)

@{UB}
@{B}SYNOPSIS@{UB}
    BOOL success = MakeLink( char *name, LONG dest, LONG soft );


@{B}FUNCTION@{UB}
@{B}@{FG SHINE}    Create a filesystem link from 'name' to dest.  For "soft-links",
    dest is a pointer to a null-terminated path string.  For "hard-
    links", dest is a lock (BPTR).  'soft' is FALSE for hard-links,
    non-zero otherwise.

    Soft-links are resolved at access time by a combination of the
    filesystem (by returning ERROR_IS_SOFT_LINK to dos), and by
    Dos (using ReadLink() to resolve any links that are hit).
 
    Hard-links are resolved by the filesystem in question.  A series
    of hard-links to a file are all equivalent to the file itself.
    If one of the links (or the original entry for the file) is 
    deleted, the data remains until there are no links left.

@{FG TEXT}@{UB}
@{B}INPUTS@{UB}
    name - Name of the link to create
    dest - CPTR to path string, or BPTR lock
    soft - FALSE for hard-links, non-zero for soft-links


@{B}BUGS@{UB}
@{FG SHINE}    In V36, soft-links didn't work in the ROM filesystem.  This was
    fixed for V37.

@{FG TEXT}
@{B}SEE ALSO@{UB}
    ReadLink, Open, Lock

@ENDNODE

@NODE "makeDosEntry" "makeDosEntry"
@{FG SHINE}makeDosEntry@{FG TEXT}

@{B}NAME@{UB}
@{B}    MakeDosEntry -- Creates a DosList structure (V36)

@{UB}
@{B}SYNOPSIS@{UB}
    struct DosList *newdlist = MakeDosEntry( char *name, LONG type );


@{B}FUNCTION@{UB}
@{B}@{FG SHINE}    Create a DosList structure, including allocating a name and correctly
    null-terminating the BSTR.  It also sets the dol_Type field, and sets
    all other fields to 0.  This routine should be eliminated and replaced
    by a value passed to AllocDosObject()!

@{FG TEXT}@{UB}
@{B}INPUTS@{UB}
    name - name for the device/volume/assign node.
    type - type of node.


@{B}RESULT@{UB}
    newdlist - The new device entry or NULL.


@{B}SEE ALSO@{UB}
    AddDosEntry, RemDosEntry, FindDosEntry, LockDosList,
    NextDosEntry, FreeDosEntry

@ENDNODE

@NODE "lockRecords" "lockRecords"
@{FG SHINE}lockRecords@{FG TEXT}

@{B}NAME@{UB}
@{B}    LockRecords -- Lock a series of records (V36)

@{UB}
@{B}SYNOPSIS@{UB}
    BOOL success = LockRecords( struct RecordLock *record_array,
                                ULONG timeout );


@{B}FUNCTION@{UB}
@{B}@{FG SHINE}    This locks several records within a file for exclusive access.
    Timeout is how long to wait in ticks for the records to be available.
    The wait is applied to each attempt to lock each record in the list.
    It is recommended that you always lock a set of records in the same
    order to reduce possibilities of deadlock.
 
    The array of RecordLock structures is terminated by an entry with
    rec_FH of NULL.

@{FG TEXT}@{UB}
@{B}INPUTS@{UB}
    record_array - List of records to be locked
    timeout      - Timeout interval.  0 is legal


@{B}RESULT@{UB}
    success      - Success or failure


@{B}BUGS@{UB}
@{FG SHINE}    See LockRecord

@{FG TEXT}
@{B}SEE ALSO@{UB}
    LockRecord, UnLockRecord, UnLockRecords

@ENDNODE

@NODE "lockRecord" "lockRecord"
@{FG SHINE}lockRecord@{FG TEXT}

@{B}NAME@{UB}
@{B}    LockRecord -- Locks a portion of a file (V36)

@{UB}
@{B}SYNOPSIS@{UB}
    BOOL success = LockRecord( BPTR fh, ULONG offset, ULONG length,
                               ULONG mode, ULONG timeout
                             );


@{B}FUNCTION@{UB}
@{B}@{FG SHINE}    This locks a portion of a file for exclusive access.  Timeout is how
    long to wait in ticks (1/50 sec) for the record to be available.

    Valid modes are:
      REC_EXCLUSIVE
      REC_EXCLUSIVE_IMMED
      REC_SHARED
      REC_SHARED_IMMED
    For the IMMED modes, the timeout is ignored.

    Record locks are tied to the filehandle used to create them.  The
    same filehandle can get any number of exclusive locks on the same
    record, for example.  These are cooperative locks, they only
    affect other people calling LockRecord().

@{FG TEXT}@{UB}
@{B}INPUTS@{UB}
    fh      - File handle for which to lock the record
    offset  - Record start position
    length  - Length of record in bytes
    mode    - Type of lock requester
    timeout - Timeout interval in ticks.  0 is legal.


@{B}BUGS@{UB}
@{FG SHINE}    In 2.0 through 2.02 (V36), LockRecord() only worked in the ramdisk.
    Attempting to lock records on the disk filesystem causes a crash.
    This was fixed for V37.

@{FG TEXT}
@{B}SEE ALSO@{UB}
    LockRecords, UnLockRecord, UnLockRecords

@ENDNODE

@NODE "lockDosList" "lockDosList"
@{FG SHINE}lockDosList@{FG TEXT}

@{B}NAME@{UB}
@{B}    LockDosList -- Locks the specified Dos Lists for use (V36)

@{UB}
@{B}SYNOPSIS@{UB}
    struct DosList *dlist = LockDosList( ULONG flags );


@{B}FUNCTION@{UB}
@{B}@{FG SHINE}    Locks the dos device list in preparation to walk the list.
    If the list is 'busy' then this routine will not return until it is 
    available.  This routine "nests": you can call it multiple times, and
    then must unlock it the same number of times.  The dlist
    returned is NOT a valid entry: it is a special value.  Note that
    for 1.3 compatibility, it also does a Forbid() - this will probably
    be removed at some future time.  The 1.3 Forbid() locking of this
    list had some race conditions.  The pointer returned by this is NOT
    an actual DosList pointer - you should use on of the other DosEntry
    calls to get actual pointers to DosList structures (such as
    NextDosEntry()), passing the value returned by LockDosList()
    as the dlist value.
 
    Note for handler writers: you should never call this function with
    LDF_WRITE, since it can deadlock you (if someone has it read-locked
    and they're trying to send you a packet).  Use AttemptLockDosList()
    instead, and effectively busy-wait with delays for the list to be
    available.  The other option is that you can spawn a process to
    add the entry safely.
 
    As an example, here's how you can search for all volumes of a specific
    name and do something with them:

    2.0 way:

      dl = LockDosList(LDF_VOLUMES|LDF_READ);
      while (dl = FindDosEntry(dl,name,LDF_VOLUMES))
      {
         Add to list of volumes to process or break out of
         the while loop.
         (You could try using it here, but I advise
         against it for compatability reasons if you
         are planning on continuing to examine the list.)
      }
      
      process list of volumes saved above, or current entry if
      you're only interested in the first one of that name.

      UnLockDosList(LDF_VOLUMES|LDF_READ);
              \\* must not use dl after this! *\\

    1.3/2.0 way:

      if (version >= 36)
         dl = LockDosList(LDF_VOLUMES|LDF_READ);
      else {
         Forbid();
         // tricky! note dol_Next is at offset 0!
         dl = &(...->di_DeviceList);
      }

      while (version >= 36 ?
            dl = FindDosEntry(dl,name,LDF_VOLUMES) :
                 dl = yourfindentry(dl,name,DLT_VOLUME))
      {
         Add to list of volumes to process, or break out of
         the while loop.
         Do NOT lock foo1/foo2 here if you will continue
         to examine the list - it breaks the forbid
         and the list may change on you.
      }
      
      process list of volumes saved above, or current entry if
      you're only interested in the first one of that name.

      if (version >= 36)
         UnLockDosList(LDF_VOLUMES|LDF_READ);
      else
         Permit();
      \\* must not use dl after this! *\\
      ...

      struct DosList *
      yourfindentry (struct DosList *dl, STRPTRname, type)
      {
      \\* tricky - depends on dol_Next being at offset 0,
         and the initial ptr being a ptr to di_DeviceList! *\\
         while (dl = dl->dol_Next)
         {
             if (dl->dol_Type == type &&
            stricmp(name,BADDR(dl->dol_Name)+1) == 0)
             {
            break;
             }
         }
         return dl;
      }

@{FG TEXT}@{UB}
@{B}INPUTS@{UB}
    flags - Flags stating which types of nodes you want to lock.


@{B}RESULT@{UB}
    dlist - Pointer to the head of the list.  NOT a valid node!


@{B}SEE ALSO@{UB}
    AttemptLockDosList, UnLockDosList, Forbid, NextDosEntry

@ENDNODE

@NODE "lock" "lock"
@{FG SHINE}lock@{FG TEXT}

@{B}NAME@{UB}
@{B}    Lock -- Lock a directory or file

@{UB}
@{B}SYNOPSIS@{UB}
    BPTR lock  = Lock( char *name, LONG accessMode );


@{B}FUNCTION@{UB}
@{B}@{FG SHINE}    A filing system lock on the file or directory 'name' is returned if
    possible.

    If the accessMode is ACCESS_READ, the lock is a shared read lock;
    if the accessMode is ACCESS_WRITE then it is an exclusive write
    lock.  Do not use random values for mode.
 
    If Lock() fails (that is, if it cannot obtain a filing system lock
    on the file or directory) it returns a zero.
 
    Tricky assumptions about the internal format of a lock are unwise,
    as are any attempts to use the fl_Link or fl_Access fields.

@{FG TEXT}@{UB}
@{B}INPUTS@{UB}
    name      - pointer to a null-terminated string
    accessMode - integer


@{B}RESULT@{UB}
    lock - BCPL pointer to a lock


@{B}SEE ALSO@{UB}
    UnLock, DupLock, ChangeMode, NameFromLock, DupLockFromFH

@ENDNODE

@NODE "loadSeg" "loadSeg"
@{FG SHINE}loadSeg@{FG TEXT}

@{B}NAME@{UB}
@{B}    LoadSeg -- Scatterload a loadable file into memory

@{UB}
@{B}SYNOPSIS@{UB}
    BPTR seglist = LoadSeg( char *name )


@{B}FUNCTION@{UB}
@{B}@{FG SHINE}    The file 'name' should be a load module produced by the linker.
    LoadSeg() scatterloads the CODE, DATA and BSS segments into memory,
    chaining together the segments with BPTR's on their first words.
    The end of the chain is indicated by a zero.  There can be any number
    of segments in a file.  All necessary re-location is handled by
    LoadSeg().
 
    In the event of an error any blocks loaded will be unloaded and a
    NULL result returned.
 
    If the module is correctly loaded then the output will be a pointer
    at the beginning of the list of blocks. Loaded code is unloaded via
    a call to UnLoadSeg().
 
@{FG TEXT}@{UB}
@{B}INPUTS@{UB}
    name - pointer to a null-terminated string


@{B}RESULT@{UB}
    seglist - BCPL pointer to a seglist


@{B}SEE ALSO@{UB}
    UnLoadSeg, InternalLoadSeg, InternalUnLoadSeg, CreateProc,
    CreateNewProc, NewLoadSeg.

@ENDNODE

@NODE "isInteractive" "isInteractive"
@{FG SHINE}isInteractive@{FG TEXT}

@{B}NAME@{UB}
@{B}    IsInteractive -- Discover whether a file is "interactive"

@{UB}
@{B}SYNOPSIS@{UB}
    BOOL status = IsInteractive( BPTR file )


@{B}FUNCTION@{UB}
@{B}@{FG SHINE}    The return value 'status' indicates whether the file associated
    with the file handle 'file' is connected to a virtual terminal.

@{FG TEXT}@{UB}
@{B}INPUTS@{UB}
    file - BCPL pointer to a file handle

@ENDNODE

@NODE "isFileSystem" "isFileSystem"
@{FG SHINE}isFileSystem@{FG TEXT}

@{B}NAME@{UB}
@{B}    IsFileSystem -- returns whether a Dos handler is a filesystem (V36)

@{UB}
@{B}SYNOPSIS@{UB}
    BOOL result = IsFileSystem( char *name )


@{B}FUNCTION@{UB}
@{B}@{FG SHINE}    Returns whether the device is a filesystem or not.  A filesystem
    supports seperate files storing information.  It may also support
    sub-directories, but is not required to.  If the filesystem doesn't
    support this new packet, IsFileSystem() will use Lock(":",...) as
    an indicator.

@{FG TEXT}@{UB}
@{B}INPUTS@{UB}
    name   - Name of device in question, with trailing ':'.


@{B}RESULT@{UB}
    result - Flag to indicate if device is a file system


@{B}SEE ALSO@{UB}
    Lock

@ENDNODE

@NODE "ioErr" "ioErr"
@{FG SHINE}ioErr@{FG TEXT}

@{B}NAME@{UB}
@{B}    IoErr -- Return extra information from the system

@{UB}
@{B}SYNOPSIS@{UB}
    LONG error = IoErr( void );


@{B}FUNCTION@{UB}
@{B}@{FG SHINE}    Most I/O routines return zero to indicate an error. When this 
    happens (or whatever the defined error return for the routine)
    this routine may be called to determine more information. It is
    also used in some routines to pass back a secondary result.

    Note: there is no guarantee as to the value returned from IoErr()
    after a successful operation, unless specified by the routine.

@{FG TEXT}@{UB}
@{B}RESULT@{UB}
    error - integer


@{B}SEE ALSO@{UB}
    Fault, PrintFault, SetIoErr

@ENDNODE

@NODE "internalUnLoadSeg" "internalUnLoadSeg"
@{FG SHINE}internalUnLoadSeg@{FG TEXT}

@{B}NAME@{UB}
@{B}    InternalUnLoadSeg -- Unloads a seglist loaded with InternalLoadSeg() (V36)

@{UB}
@{B}SYNOPSIS@{UB}
    BOOL success = InternalUnLoadSeg( BPTR seglist,
                                      void (*FreeFunc)( char *, ULONG )
                                    );


@{B}FUNCTION@{UB}
@{B}@{FG SHINE}    Unloads a seglist using freefunc to free segments.  Freefunc is called
    as for InternalLoadSeg.  NOTE: will call Close() for overlaid
    seglists.

@{FG TEXT}@{UB}
@{B}INPUTS@{UB}
    seglist  - Seglist to be unloaded
    FreeFunc - Function called to free memory
 

@{B}RESULT@{UB}
    success - returns whether everything went OK (since this may close
         files).  Also returns FALSE if seglist was NULL.


@{B}BUGS@{UB}
@{FG SHINE}    Really should use tags

@{FG TEXT}
@{B}SEE ALSO@{UB}
    LoadSeg, UnLoadSeg, InternalLoadSeg, NewUnLoadSeg, Close

@ENDNODE

@NODE "internalLoadSeg" "internalLoadSeg"
@{FG SHINE}internalLoadSeg@{FG TEXT}

@{B}NAME@{UB}
@{B}    InternalLoadSeg -- Low-level load routine (V36)

@{UB}
@{B}SYNOPSIS@{UB}
    BPTR seglist = InternalLoadSeg( BPTR  fh,
                                    BPTR  table,
                                    LONG *functionarray,
                                    LONG *stack
                                  );


@{B}FUNCTION@{UB}
@{B}@{FG SHINE}    Loads from fh.  Table is used when loading an overlay, otherwise
    should be NULL.  Functionarray is a pointer to an array of functions.
    Note that the current Seek position after loading may be at any point
    after the last hunk loaded.  The filehandle will not be closed.  If a
    stacksize is encoded in the file, the size will be stuffed in the
    LONG pointed to by stack.  This LONG should be initialized to your
    default value: InternalLoadSeg() will not change it if no stacksize
    is found. Clears unused portions of Code and Data hunks (as well as
    BSS hunks).  (This also applies to LoadSeg() and NewLoadSeg()).
 
    If the file being loaded is an overlaid file, this will return
    -(seglist).  All other results will be positive.
 
    NOTE to overlay users: InternalLoadSeg() does NOT return seglist in
    both D0 and D1, as LoadSeg does.  The current ovs.asm uses LoadSeg(),
    and assumes returns are in D1.  We will support this for LoadSeg()
    ONLY.

@{FG TEXT}@{UB}
@{B}INPUTS@{UB}
    fh         - Filehandle to load from.
    table         - When loading an overlay, otherwise ignored.
    functionarray - Array of function to be used for read, alloc, and free.
       FuncTable[0] ->  Actual = ReadFunc(readhandle,buffer,length),DOSBase
                   D0                D1         D2     D3      A6
       FuncTable[1] ->  Memory = AllocFunc(size,flags), Execbase
                   D0                 D0   D1      a6
       FuncTable[2] ->  FreeFunc(memory,size), Execbase
                            A1     D0     A6
    stack         - Pointer to storage (ULONG) for stacksize.


@{B}RESULT@{UB}
    seglist         - Seglist loaded or NULL.  NOT returned in D1!


@{B}BUGS@{UB}
@{FG SHINE}    Really should use tags.

@{FG TEXT}
@{B}SEE ALSO@{UB}
    LoadSeg, UnLoadSeg, NewLoadSeg, InternalUnLoadSeg

@ENDNODE

@NODE "input" "input"
@{FG SHINE}input@{FG TEXT}

@{B}NAME@{UB}
@{B}    Input -- Identify the program's initial input file handle

@{UB}
@{B}SYNOPSIS@{UB}
    BPTR file = Input( void )


@{B}FUNCTION@{UB}
@{B}@{FG SHINE}    Input() is used to identify the initial input stream allocated when
    the program was initiated.  Never close the filehandle returned by
    Input!

@{FG TEXT}@{UB}
@{B}RESULT@{UB}
    file - BCPL pointer to a file handle


@{B}SEE ALSO@{UB}
    Output, SelectInput

@ENDNODE

@NODE "inhibit" "inhibit"
@{FG SHINE}inhibit@{FG TEXT}

@{B}NAME@{UB}
@{B}    Inhibit -- Inhibits access to a filesystem (V36)

@{UB}
@{B}SYNOPSIS@{UB}
    BOOL success = Inhibit( char *filesystem, LONG flag );


@{B}FUNCTION@{UB}
@{B}@{FG SHINE}    Sends an ACTION_INHIBIT packet to the indicated handler.  This stops
    all activity by the handler until uninhibited.  When uninhibited,
    anything may have happened to the disk in the drive, or there may no
    longer be one.

@{FG TEXT}@{UB}
@{B}INPUTS@{UB}
    filesystem - Name of device to inhibit (with ':')
    flag       - New status.  DOSTRUE = inhibited,
                                FALSE = uninhibited

@ENDNODE

@NODE "infoDisk" "infoDisk"
@{FG SHINE}infoDisk@{FG TEXT}

@{B}NAME@{UB}
@{B}    Info -- Returns information about the disk

@{UB}
@{B}SYNOPSIS@{UB}
    BOOL success = Info( BPTR lock, struct InfoData *parmBlock );


@{B}FUNCTION@{UB}
@{B}@{FG SHINE}    Info() can be used to find information about any disk in use.
    'lock' refers to the disk, or any file on the disk. The parameter
    block is returned with information about the size of the disk,
    number of free blocks and any soft errors.

@{FG TEXT}@{UB}
@{B}INPUTS@{UB}
    lock      - BCPL pointer to a lock
    parmBlock - pointer to an InfoData structure (longword aligned)

 SPECIAL NOTE:
    Note that InfoData structure must be longword aligned.

@ENDNODE

@NODE "getVar" "getVar"
@{FG SHINE}getVar@{FG TEXT}

@{B}NAME@{UB}
@{B}    GetVar -- Returns the value of a local or global variable (V36)

@{UB}
@{B}SYNOPSIS@{UB}
    LONG len = GetVar( char *name, char *buffer, LONG size, LONG flags ); 


@{B}FUNCTION@{UB}
@{B}@{FG SHINE}    Gets the value of a local or environment variable.  It is advised to
    only use ASCII strings inside variables, but not required.  This stops
    putting characters into the destination when a \\n is hit, unless
    GVF_BINARY_VAR is specified.  (The \\n is not stored in the buffer.)

@{FG TEXT}@{UB}
@{B}INPUTS@{UB}
    name   - pointer to a variable name.
    buffer - a user allocated area which will be used to store
        the value associated with the variable.
    size   - length of the buffer region in bytes.
    flags  - combination of type of var to get value of (low 8 bits), and
        flags to control the behavior of this routine.  Currently
        defined flags include:

         GVF_GLOBAL_ONLY - tries to get a global env variable.
         GVF_LOCAL_ONLY  - tries to get a local variable.
         GVF_BINARY_VAR  - don't stop at \\n
         GVF_DONT_NULL_TERM - no null termination (only valid
                 for binary variables). (V37)

       The default is to try to get a local variable first, then
       to try to get a global environment variable.


@{B}RESULT@{UB}
    len -   Size of environment variable.  -1 indicates that the
            variable was not defined (if IoErr() returns
      ERROR_OBJECT_NOT_FOUND - it returns ERROR_BAD_NUMBER if
      you specify a size of 0).  If the value would overflow
      the user buffer, the buffer is truncated.  The buffer
      returned is null-terminated (even if GVF_BINARY_VAR is
      used, unless GVF_DONT_NULL_TERM is in effect).  If it
      succeeds, len is the number of characters put in the buffer
      (not including null termination), and IoErr() will return the
      the size of the variable (regardless of buffer size).


@{B}BUGS@{UB}
@{FG SHINE}    LV_VAR is the only type that can be global.
    Under V36, we documented (and it returned) the size of the variable,
    not the number of characters transferred.  For V37 this was changed
    to the number of characters put in the buffer, and the total size
    of the variable is put in IoErr().
    GVF_DONT_NULL_TERM only works for local variables under V37.  For
    V39, it also works for globals.

@{FG TEXT}
@{B}SEE ALSO@{UB}
    SetVar, DeleteVar, FindVar, <dos/var.h>

@ENDNODE

@NODE "getPrompt" "getPrompt"
@{FG SHINE}getPrompt@{FG TEXT}

@{B}NAME@{UB}
@{B}    GetPrompt -- Returns the prompt for the current process (V36)

@{UB}
@{B}SYNOPSIS@{UB}
    BOOL success = GetPrompt( char *buf, LONG len );


@{B}FUNCTION@{UB}
@{B}@{FG SHINE}    Extracts the prompt string from the CLI structure and puts it 
    into the buffer.  If the buffer is too small, the string is truncated 
    appropriately and a failure code returned.  If no CLI structure is 
    present, a null string is returned in the buffer, and failure from
    the call (with IoErr() == ERROR_OBJECT_WRONG_TYPE);

@{FG TEXT}@{UB}
@{B}INPUTS@{UB}
    buf     - Buffer to hold extracted prompt
    len     - Number of bytes of space in buffer


@{B}SEE ALSO@{UB}
    SetPrompt

@ENDNODE

@NODE "getProgramName" "getProgramName"
@{FG SHINE}getProgramName@{FG TEXT}

@{B}NAME@{UB}
@{B}    GetProgramName -- Returns the current program name (V36)

@{UB}
@{B}SYNOPSIS@{UB}
    BOOL success = GetProgramName( char *buf, LONG len )


@{B}FUNCTION@{UB}
@{B}@{FG SHINE}    Extracts the program name from the CLI structure and puts it 
    into the buffer.  If the buffer is too small, the name is truncated.
    If no CLI structure is present, a null string is returned in the
    buffer, and failure from the call (with IoErr() ==
    ERROR_OBJECT_WRONG_TYPE);

@{FG TEXT}@{UB}
@{B}INPUTS@{UB}
    buf     - Buffer to hold extracted name
    len     - Number of bytes of space in buffer


@{B}SEE ALSO@{UB}
    SetProgramName

@ENDNODE

@NODE "getProgramDir" "getProgramDir"
@{FG SHINE}getProgramDir@{FG TEXT}

@{B}NAME@{UB}
@{B}    GetProgramDir -- Returns a lock on the directory the program was loaded
                     from (V36)

@{UB}
@{B}SYNOPSIS@{UB}
    BPTR lock = GetProgramDir( void )


@{B}FUNCTION@{UB}
@{B}@{FG SHINE}    Returns a shared lock on the directory the program was loaded from.
    This can be used for a program to find data files, etc, that are stored
    with the program, or to find the program file itself.  NULL returns are
    valid, and may occur, for example, when running a program from the
    resident list.  You should NOT unlock the lock.

@{FG TEXT}@{UB}
@{B}RESULT@{UB}
    lock - A lock on the directory the current program was loaded from,
           or NULL if loaded from resident list, etc.


@{B}BUGS@{UB}
@{FG SHINE}    Should return a lock for things loaded via resident.  Perhaps should
    return currentdir if NULL.

@{FG TEXT}
@{B}SEE ALSO@{UB}
    SetProgramDir, Open

@ENDNODE

@NODE "getFileSysTask" "getFileSysTask"
@{FG SHINE}getFileSysTask@{FG TEXT}

@{B}NAME@{UB}
@{B}    GetFileSysTask -- Returns the default filesystem for the process (V36)

@{UB}
@{B}SYNOPSIS@{UB}
    struct MsgPort *port = GetFileSysTask( void )


@{B}FUNCTION@{UB}
@{B}@{FG SHINE}    Returns the default filesystem task's port (pr_FileSystemTask) for the
    current process.

@{FG TEXT}@{UB}
@{B}RESULT@{UB}
    port - The pr_MsgPort of the filesystem, or NULL.


@{B}SEE ALSO@{UB}
    SetFileSysTask, Open

@ENDNODE

@NODE "getDeviceProc" "getDeviceProc"
@{FG SHINE}getDeviceProc@{FG TEXT}

@{B}NAME@{UB}
@{B}    GetDeviceProc -- Finds a handler to send a message to (V36)

@{UB}
@{B}SYNOPSIS@{UB}
    struct DevProc *devproc = GetDeviceProc( char *name, struct DevProc *devproc );


@{B}FUNCTION@{UB}
@{B}@{FG SHINE}    Finds the handler/filesystem to send packets regarding 'name' to.
    This may involve getting temporary locks.  It returns a structure
    that includes a lock and msgport to send to to attempt your operation.
    It also includes information on how to handle multiple-directory
    assigns (by passing the DevProc back to GetDeviceProc() until it
    returns NULL).

    The initial call to GetDeviceProc() should pass NULL for devproc.  If
    after using the returned DevProc, you get an ERROR_OBJECT_NOT_FOUND,
    and (devproc->dvp_Flags & DVPF_ASSIGN) is true, you should call
    GetDeviceProc() again, passing it the devproc structure.  It will
    either return a modified devproc structure, or NULL (with
    ERROR_NO_MORE_ENTRIES in IoErr()).  Continue until it returns NULL.

    This call also increments the counter that locks a handler/fs into
    memory.  After calling FreeDeviceProc(), do not use the port or lock
    again!

@{FG TEXT}@{UB}
@{B}INPUTS@{UB}
    name    - name of the object you wish to access.  This can be a
         relative path ("foo/bar"), relative to the current volume
         (":foo/bar"), or relative to a device/volume/assign
         ("foo:bar").
    devproc - A value returned by GetDeviceProc() before, or NULL


@{B}RESULT@{UB}
    devproc - a pointer to a DevProc structure or NULL


@{B}BUGS@{UB}
@{FG SHINE}    Counter not currently active in 2.0.
    In 2.0 and 2.01, you HAD to check DVPF_ASSIGN before calling it again.
    This was fixed for the 2.02 release of V36.

@{FG TEXT}
@{B}SEE ALSO@{UB}
    FreeDeviceProc, DeviceProc, AssignLock, AssignLate,
    AssignPath

@ENDNODE

@NODE "getCurrentDirName" "getCurrentDirName"
@{FG SHINE}getCurrentDirName@{FG TEXT}

@{B}NAME@{UB}
@{B}    GetCurrentDirName -- returns the current directory name (V36)

@{UB}
@{B}SYNOPSIS@{UB}
    BOOL success = GetCurrentDirName( char *buf, LONG len );


@{B}FUNCTION@{UB}
@{B}@{FG SHINE}    Extracts the current directory name from the CLI structure and puts it 
    into the buffer.  If the buffer is too small, the name is truncated 
    appropriately and a failure code returned.  If no CLI structure is 
    present, a null string is returned in the buffer, and failure from
    the call (with IoErr() == ERROR_OBJECT_WRONG_TYPE);

@{FG TEXT}@{UB}
@{B}INPUTS@{UB}
    buf     - Buffer to hold extracted name
    len     - Number of bytes of space in buffer


@{B}RESULT@{UB}
    success - Success/failure indicator


@{B}BUGS@{UB}
@{FG SHINE}    In V36, this routine didn't handle 0-length buffers correctly.

@{FG TEXT}
@{B}SEE ALSO@{UB}
    SetCurrentDirName

@ENDNODE

@NODE "getConsoleTask" "getConsoleTask"
@{FG SHINE}getConsoleTask@{FG TEXT}

@{B}NAME@{UB}
@{B}    GetConsoleTask -- Returns the default console for the process (V36)

@{UB}
@{B}SYNOPSIS@{UB}
    struct MsgPort *port = GetConsoleTask( void );


@{B}FUNCTION@{UB}
@{B}@{FG SHINE}    Returns the default console task's port (pr_ConsoleTask) for the
    current process.

@{FG TEXT}@{UB}
@{B}RESULT@{UB}
    port - The pr_MsgPort of the console handler, or NULL.


@{B}SEE ALSO@{UB}
    SetConsoleTask, Open

@ENDNODE

@NODE "getArgStr" "getArgStr"
@{FG SHINE}getArgStr@{FG TEXT}

@{B}NAME@{UB}
@{B}    GetArgStr -- Returns the arguments for the process (V36)

@{UB}
@{B}SYNOPSIS@{UB}
    char *ptr = GetArgStr( void );


@{B}FUNCTION@{UB}
@{B}@{FG SHINE}    Returns a pointer to the (null-terminated) arguments for the program
    (process).  This is the same string passed in a0 on startup from CLI.

@{FG TEXT}@{UB}
@{B}RESULT@{UB}
    ptr - pointer to arguments


@{B}SEE ALSO@{UB}
    SetArgStr, RunCommand

@ENDNODE

@NODE "fWrite" "fWrite"
@{FG SHINE}fWrite@{FG TEXT}

@{B}NAME@{UB}
@{B}    FWrite -- Writes a number of blocks to an output (buffered) (V36)

@{UB}
@{B}SYNOPSIS@{UB}
    LONG count = FWrite( BPTR fh, char *buf, ULONG blocklen, ULONG blocks )


@{B}FUNCTION@{UB}
@{B}@{FG SHINE}    Attempts to write a number of blocks, each blocklen long, from the
    specified buffer to the output stream.  May return less than the
    number of blocks requested, if there is some error such as a full
    disk or r/w error.  This call is buffered.

@{FG TEXT}@{UB}
@{B}INPUTS@{UB}
    fh    - filehandle to use for buffered I/O
    buf      - Area to write bytes from.
    blocklen - number of bytes per block.  Must be > 0.
    blocks    - number of blocks to write.  Must be > 0.


@{B}RESULT@{UB}
    count - Number of _blocks_ written.  On an error, the number of
            blocks actually written is returned.


@{B}BUGS@{UB}
@{FG SHINE}    Doesn't clear IoErr() before starting.  If you want to find out
    about errors, use SetIoErr( 0 ) before calling.

@{FG TEXT}
@{B}SEE ALSO@{UB}
    FPutC(), FRead, FPuts

@ENDNODE

@NODE "freeDosObject" "freeDosObject"
@{FG SHINE}freeDosObject@{FG TEXT}

@{B}NAME@{UB}
@{B}    FreeDosObject -- Frees an object allocated by AllocDosObject() (V36)

@{UB}
@{B}SYNOPSIS@{UB}
    void FreeDosObject( ULONG type, void *ptr );


@{B}FUNCTION@{UB}
@{B}@{FG SHINE}    Frees an object allocated by AllocDosObject().  Do NOT call for
    objects allocated in any other way.

@{FG TEXT}@{UB}
@{B}INPUTS@{UB}
    type - type passed to AllocDosObject()
    ptr  - ptr returned by AllocDosObject()


@{B}BUGS@{UB}
@{FG SHINE}    Before V39, DOS_CLI objects will only have the struct
    CommandLineInterface freed, not the strings it points to.  This
    is fixed in V39 dos.  Before V39, you can workaround this bug by
    using FreeVec() on cli_SetName, cli_CommandFile, cli_CommandName,
    and cli_Prompt, and then setting them all to NULL.  In V39 or
    above, do NOT use the workaround.

@{FG TEXT}
@{B}SEE ALSO@{UB}
    AllocDosObject, FreeVec, <dos/dos.h>

@ENDNODE

@NODE "freeDosEntry" "freeDosEntry"
@{FG SHINE}freeDosEntry@{FG TEXT}

@{B}NAME@{UB}
@{B}    FreeDosEntry -- Frees an entry created by MakeDosEntry (V36)

@{UB}
@{B}SYNOPSIS@{UB}
    void FreeDosEntry( struct DosList *dlist );


@{B}FUNCTION@{UB}
@{B}@{FG SHINE}    Frees an entry created by MakeDosEntry().  This routine should be
    eliminated and replaced by a value passed to FreeDosObject()!

@{FG TEXT}@{UB}
@{B}INPUTS@{UB}
    dlist - DosList to free.


@{B}SEE ALSO@{UB}
    AddDosEntry, RemDosEntry, FindDosEntry, LockDosList,
    NextDosEntry, MakeDosEntry

@ENDNODE

@NODE "freeDeviceProc" "freeDeviceProc"
@{FG SHINE}freeDeviceProc@{FG TEXT}

@{B}NAME@{UB}
@{B}    FreeDeviceProc -- Releases port returned by GetDeviceProc() (V36)

@{UB}
@{B}SYNOPSIS@{UB}
    void FreeDeviceProc( struct DevProc *devproc );


@{B}FUNCTION@{UB}
@{B}@{FG SHINE}    Frees up the structure created by GetDeviceProc(), and any associated
    temporary locks.

    Decrements the counter incremented by GetDeviceProc().  The counter
    is in an extension to the 1.3 process structure.  After calling
    FreeDeviceProc(), do not use the port or lock again!  It is safe to
    call FreeDeviceProc(NULL).

@{FG TEXT}@{UB}
@{B}INPUTS@{UB}
    devproc - A value returned by GetDeviceProc()


@{B}BUGS@{UB}
@{FG SHINE}    Counter not currently active in 2.0.

@{FG TEXT}
@{B}SEE ALSO@{UB}
    GetDeviceProc, DeviceProc, AssignLock, AssignLate,
    AssignPath

@ENDNODE

@NODE "freeArgs" "freeArgs"
@{FG SHINE}freeArgs@{FG TEXT}

@{B}NAME@{UB}
@{B}    FreeArgs - Free allocated memory after ReadArgs() (V36)

@{UB}
@{B}SYNOPSIS@{UB}
    void FreeArgs( struct RDArgs *rdargs );


@{B}FUNCTION@{UB}
@{B}@{FG SHINE}    Frees memory allocated to return arguments in from ReadArgs().  If
    ReadArgs allocated the RDArgs structure it will be freed.  If NULL
    is passed in this function does nothing.

@{FG TEXT}@{UB}
@{B}INPUTS@{UB}
    rdargs - structure returned from ReadArgs() or NULL.


@{B}SEE ALSO@{UB}
    ReadArgs, ReadItem, FindArg

@ENDNODE

@NODE "fRead" "fRead"
@{FG SHINE}fRead@{FG TEXT}

@{B}NAME@{UB}
@{B}    FRead -- Reads a number of blocks from an input (buffered) (V36)

@{UB}
@{B}SYNOPSIS@{UB}
    LONG count = FRead( BPTR fh, char *buf, ULONG blocklen,
                        ULONG blocks );


@{B}FUNCTION@{UB}
@{B}@{FG SHINE}    Attempts to read a number of blocks, each blocklen long, into the
    specified buffer from the input stream.  May return less than
    the number of blocks requested, either due to EOF or read errors.
    This call is buffered.

@{FG TEXT}@{UB}
@{B}INPUTS@{UB}
    fh    - filehandle to use for buffered I/O
    buf      - Area to read bytes into.
    blocklen - number of bytes per block.  Must be > 0.
    blocks    - number of blocks to read.  Must be > 0.


@{B}RESULT@{UB}
    count - Number of _blocks_ read, or 0 for EOF.  On an error,
            the number of blocks actually read is returned.


@{B}BUGS@{UB}
@{FG SHINE}    Doesn't clear IoErr() before starting.  If you want to find out
    about errors, use SetIoErr( 0 ) before calling.

@{FG TEXT}
@{B}SEE ALSO@{UB}
    FGetC, FWrite, FGets

@ENDNODE

@NODE "fPutS" "fPutS"
@{FG SHINE}fPutS@{FG TEXT}

@{B}NAME@{UB}
@{B}    FPuts -- Writes a string the the specified output (buffered) (V36)

@{UB}
@{B}SYNOPSIS@{UB}
    LONG error = FPuts( BPTR fh, char *str );


@{B}FUNCTION@{UB}
@{B}@{FG SHINE}    This routine writes an unformatted string to the filehandle.  No 
    newline is appended to the string.  This routine is buffered.

@{FG TEXT}@{UB}
@{B}INPUTS@{UB}
    fh    - filehandle to use for buffered I/O
    str   - Null-terminated string to be written to default output


@{B}RESULT@{UB}
    error - 0 normally, otherwise -1.  Note that this is opposite of
            most other Dos functions, which return success.


@{B}SEE ALSO@{UB}
    FGets, FPutC, FWrite, PutStr

@ENDNODE

@NODE "fPutC" "fPutC"
@{FG SHINE}fPutC@{FG TEXT}

@{B}NAME@{UB}
@{B}    FPutC -- Write a character to the specified output (buffered) (V36)

@{UB}
@{B}SYNOPSIS@{UB}
    LONG char = FPutC( BPTR fh, LONG chr );


@{B}FUNCTION@{UB}
@{B}@{FG SHINE}    Writes a single character to the output stream.  This call is
    buffered.  Use Flush() between buffered and unbuffered I/O on a
    filehandle.  Interactive filehandles are flushed automatically
    on a newline, return, '\\0', or line feed.

@{FG TEXT}@{UB}
@{B}INPUTS@{UB}
    fh   - filehandle to use for buffered I/O
    char - character to write


@{B}RESULT@{UB}
    char - either the character written, or EOF for an error.


@{B}BUGS@{UB}
@{FG SHINE}    Older autodocs indicated that you should pass a UBYTE.  The
    correct usage is to pass a LONG in the range 0-255.

@{FG TEXT}
@{B}SEE ALSO@{UB}
    FGetC, UnGetC, Flush

@ENDNODE

@NODE "format" "format"
@{FG SHINE}format@{FG TEXT}

@{B}NAME@{UB}
@{B}    Format -- Causes a filesystem to initialize itself (V36)

@{UB}
@{B}SYNOPSIS@{UB}
    BOOL success = Format( char *filesystem, char *volumename,
                           ULONG dostype );


@{B}FUNCTION@{UB}
@{B}@{FG SHINE}    Interface for initializing new media on a device.  This causes the
    filesystem to write out an empty disk structure to the media, which
    should then be ready for use.  This assumes the media has been low-
    level formatted and verified already.

    The filesystem should be inhibited before calling Format() to make
    sure you don't get an ERROR_OBJECT_IN_USE.

@{FG TEXT}@{UB}
@{B}INPUTS@{UB}
    filesystem - Name of device to be formatted.  ':' must be supplied.
    volumename - Name for volume (if supported).  No ':'.
    dostype    - Type of format, if filesystem supports multiple types.


@{B}BUGS@{UB}
@{FG SHINE}    Existed, but was non-functional in V36 dos.  (The volumename wasn't
    converted to a BSTR.)  Workaround: require V37, or under V36
    convert volumename to a BPTR to a BSTR before calling Format().
    Note: a number of printed packet docs for ACTION_FORMAT are wrong
    as to the arguments.
@{FG TEXT}
@ENDNODE

@NODE "flushFH" "flushFH"
@{FG SHINE}flushFH@{FG TEXT}

@{B}NAME@{UB}
@{B}    Flush -- Flushes buffers for a buffered filehandle (V36)

@{UB}
@{B}SYNOPSIS@{UB}
    LONG success = Flush( BPTR fh );


@{B}FUNCTION@{UB}
@{B}@{FG SHINE}    Flushes any pending buffered writes to the filehandle.  All buffered
    writes will also be flushed on Close().  If the filehandle was being
    used for input, it drops the buffer, and tries to Seek() back to the
    last read position  (so subsequent reads or writes will occur at the
    expected position in the file).

@{FG TEXT}@{UB}
@{B}INPUTS@{UB}
    fh   - Filehandle to flush.


@{B}BUGS@{UB}
@{FG SHINE}    Before V37 release, Flush() returned a random value.  As of V37,
    it always returns success (this will be fixed in some future
    release).

    The V36 and V37 releases didn't properly flush filehandles which
    have never had a buffered IO done on them.  This commonly occurs
    on redirection of input of a command, or when opening a file for
    input and then calling CreateNewProc() with NP_Arguments, or when
    using a new filehandle with SelectInput() and then calling
    RunCommand().  This is fixed in V39.  A workaround would be to
    do FGetC(), then UnGetC(), then Flush().

@{FG TEXT}
@{B}SEE ALSO@{UB}
    FputC, FGetC, UnGetC, Seek, Close, CreateNewProc,
    SelectInput, RunCommand

@ENDNODE

@NODE "findVar" "findVar"
@{FG SHINE}findVar@{FG TEXT}

@{B}NAME@{UB}
@{B}    FindVar -- Finds a local variable (V36)

@{UB}
@{B}SYNOPSIS@{UB}
    struct LocalVar *var = FindVar( char *name, ULONG type ); 


@{B}FUNCTION@{UB}
@{B}@{FG SHINE}    Finds a local variable structure.

@{FG TEXT}@{UB}
@{B}INPUTS@{UB}
    name - pointer to an variable name.  Note variable names follow
           filesystem syntax and semantics.

    type - type of variable to be found (see <dos/var.h>)
 

@{B}RESULT@{UB}
 
    var  - pointer to a LocalVar structure or NULL


@{B}SEE ALSO@{UB}
    GetVar, SetVar, DeleteVar, <dos/var.h>

@ENDNODE

@NODE "findSegment" "findSegment"
@{FG SHINE}findSegment@{FG TEXT}

@{B}NAME@{UB}
@{B}    FindSegment - Finds a segment on the resident list (V36)

@{UB}
@{B}SYNOPSIS@{UB}
    struct Segment *s = FindSegment( char *name, 
                                     struct Segment *start, 
                                     LONG system );


@{B}FUNCTION@{UB}
@{B}@{FG SHINE}    Finds a segment on the Dos resident list by name and type, starting
    at the segment AFTER 'start', or at the beginning if start is NULL.
    If system is zero, it will only return nodes with a seg_UC of 0
    or more.  It does NOT increment the seg_UC, and it does NOT do any
    locking of the list.  You must Forbid() lock the list to use this
    call.

    To use an entry you have found, you must: if the seg_UC is 0 or more,
    increment it, and decrement it (under Forbid()!) when you're done
    the the seglist.

    The other values for seg_UC are:
       -1   - system module, such as a filesystem or shell
       -2   - resident shell command
       -999 - disabled internal command, ignore
    Negative values should never be modified.  All other negative
    values between 0 and -32767 are reserved to AmigaDos and should not
    be used.

@{FG TEXT}@{UB}
@{B}INPUTS@{UB}
    name   - name of segment to find
    start  - segment to start the search after
    system - true for system segment, false for normal segments


@{B}RESULT@{UB}
    segment - the segment found or NULL


@{B}SEE ALSO@{UB}
    AddSegment, RemSegment, Forbid

@ENDNODE

@NODE "findDosEntry" "findDosEntry"
@{FG SHINE}findDosEntry@{FG TEXT}

@{B}NAME@{UB}
@{B}    FindDosEntry -- Finds a specific Dos List entry (V36)

@{UB}
@{B}SYNOPSIS@{UB}
    struct DosList *newdlist = FindDosEntry( struct DosList *dlist,
                                             char *name, ULONG flags );


@{B}FUNCTION@{UB}
@{B}@{FG SHINE}    Locates an entry on the device list.  Starts with the entry dlist.
    NOTE: must be called with the device list locked, no references may be
    made to dlist after unlocking.

@{FG TEXT}@{UB}
@{B}INPUTS@{UB}
    dlist    - The device entry to start with.
    name     - Name of device entry (without ':') to locate.
    flags    - Search control flags.  Use the flags you passed to
          LockDosList, or a subset of them.  LDF_READ/LDF_WRITE are
          not required for this call.


@{B}RESULT@{UB}
    newdlist - The device entry or NULL


@{B}SEE ALSO@{UB}
    AddDosEntry, RemDosEntry, NextDosEntry, LockDosList,
    MakeDosEntry, FreeDosEntry

@ENDNODE

@NODE "findCliProc" "findCliProc"
@{FG SHINE}findCliProc@{FG TEXT}

@{B}NAME@{UB}
@{B}    FindCliProc -- returns a pointer to the requested CLI process (V36)

@{UB}
@{B}SYNOPSIS@{UB}
    struct Process *proc = FindCliProc( ULONG num );


@{B}FUNCTION@{UB}
@{B}@{FG SHINE}    This routine returns a pointer to the CLI process associated with the 
    given CLI number.  If the process isn't an active CLI process, NULL is
    returned.  NOTE: should normally be called inside a Forbid(), if you
    must use this function at all.

@{FG TEXT}@{UB}
@{B}INPUTS@{UB}
    num  - Task number of CLI process (range 1-N)


@{B}RESULT@{UB}
    proc - Pointer to given CLI process


@{B}SEE ALSO@{UB}
    Cli, Forbid, MaxCli

@ENDNODE

@NODE "findArg" "findArg"
@{FG SHINE}findArg@{FG TEXT}

@{B}NAME@{UB}
@{B}    FindArg - find a keyword in a template (V36)

@{UB}
@{B}SYNOPSIS@{UB}
    LONG index = FindArg( char *template, char *keyword );


@{B}FUNCTION@{UB}
@{B}@{FG SHINE}    Returns the argument number of the keyword, or -1 if it is not a
    keyword for the template.  Abbreviations are handled.

@{FG TEXT}@{UB}
@{B}INPUTS@{UB}
    keyword  - keyword to search for in template
    template - template string to search


@{B}RESULT@{UB}
    index - number of entry in template, or -1 if not found


@{B}BUGS@{UB}
@{FG SHINE}    In earlier published versions of the autodoc, keyword and template
    were backwards.

@{FG TEXT}
@{B}SEE ALSO@{UB}
    ReadArgs, ReadItem, FreeArgs

@ENDNODE

@NODE "filePart" "filePart"
@{FG SHINE}filePart@{FG TEXT}

@{B}NAME@{UB}
@{B}    FilePart -- Returns the last component of a path (V36)

@{UB}
@{B}SYNOPSIS@{UB}
    char *fileptr = FilePart( char *path );


@{B}FUNCTION@{UB}
@{B}@{FG SHINE}    This function returns a pointer to the last component of a string path
    specification, which will normally be the file name.  If there is only
    one component, it returns a pointer to the beginning of the string.

@{FG TEXT}@{UB}
@{B}INPUTS@{UB}
    path - pointer to an path string.  May be relative to the current
           directory or the current disk.


@{B}RESULT@{UB}
    fileptr - pointer to the last component of the path.


@{B}EXAMPLE@{UB}
    FilePart("xxx:yyy/qqq") would return a pointer to the first 'q'.
    FilePart("xxx:yyy") would return a pointer to the first 'y').


@{B}SEE ALSO@{UB}
    PathPart, AddPart

@ENDNODE

@NODE "fGetS" "fGetS"
@{FG SHINE}fGetS@{FG TEXT}

@{B}NAME@{UB}
@{B}    FGets -- Reads a line from the specified input (buffered) (V36)

@{UB}
@{B}SYNOPSIS@{UB}
    char *buffer = FGets( BPTR fh, char *buf, ULONG len );


@{B}FUNCTION@{UB}
@{B}@{FG SHINE}    This routine reads in a single line from the specified input stopping
    at a NEWLINE character or EOF.  In either event, UP TO the number of
    len specified bytes minus 1 will be copied into the buffer.  Hence if
    a length of 50 is passed and the input line is longer than 49 bytes,
    it will return 49 characters.  It returns the buffer pointer normally,
    or NULL if EOF is the first thing read.

    If terminated by a newline, the newline WILL be the last character in
    the buffer.  This is a buffered read routine.  The string read in IS
    null-terminated.

@{FG TEXT}@{UB}
@{B}INPUTS@{UB}
    fh  - filehandle to use for buffered I/O
    buf - Area to read bytes into.
    len - Number of bytes to read, must be > 0.


@{B}RESULT@{UB}
    buffer - Pointer to buffer passed in, or NULL for immediate EOF or for
       an error.  If NULL is returnd for an EOF, IoErr() will return
       0.


@{B}BUGS@{UB}
@{FG SHINE}    In V36 and V37, it copies one more byte than it should if it doesn't
    hit an EOF or newline.  In the example above, it would copy 50 bytes
    and put a null in the 51st.  This is fixed in dos V39.  Workaround
    for V36/V37: pass in buffersize-1.

@{FG TEXT}
@{B}SEE ALSO@{UB}
    FRead, FPuts, FGetC

@ENDNODE

@NODE "fGetC" "fGetC"
@{FG SHINE}fGetC@{FG TEXT}

@{B}NAME@{UB}
@{B}    FGetC -- Read a character from the specified input (buffered) (V36)

@{UB}
@{B}SYNOPSIS@{UB}
    LONG char = FGetC( BPTR fh );


@{B}FUNCTION@{UB}
@{B}@{FG SHINE}    Reads the next character from the input stream.  A -1 is
    returned when EOF or an error is encountered.  This call is buffered.
    Use Flush() between buffered and unbuffered I/O on a filehandle.

@{FG TEXT}@{UB}
@{B}INPUTS@{UB}
    fh - filehandle to use for buffered I/O


@{B}RESULT@{UB}
    char - character read (0-255) or -1


@{B}BUGS@{UB}
@{FG SHINE}    In V36, after an EOF was read, EOF would always be returned from
    FGetC() from then on.  Starting in V37, it tries to read from the
    handler again each time (unless UnGetC(fh,-1) was called).

@{FG TEXT}
@{B}SEE ALSO@{UB}
    FPutC, UnGetC, Flush

@ENDNODE

@NODE "fault" "fault"
@{FG SHINE}fault@{FG TEXT}

@{B}NAME@{UB}
@{B}    Fault -- Returns the text associated with a DOS error code (V36)

@{UB}
@{B}SYNOPSIS@{UB}
    LONG len = Fault( LONG code, char *header, char *buffer, LONG len );


@{B}FUNCTION@{UB}
@{B}@{FG SHINE}    This routine obtains the error message text for the given error code.
    The header is prepended to the text of the error message, followed
    by a colon.  Puts a null-terminated string for the error message into
    the buffer.  By convention, error messages should be no longer than 80
    characters (+1 for termination), and preferably no more than 60.
    The value returned by IoErr() is set to the code passed in.  If there
    is no message for the error code, the message will be "Error code
    <number>\\n".

    The number of characters put into the buffer is returned, which will
    be 0 if the code passed in was 0.

@{FG TEXT}@{UB}
@{B}INPUTS@{UB}
    code   - Error code
    header - header to output before error text
    buffer - Buffer to receive error message.
    len    - Length of the buffer.


@{B}RESULT@{UB}
    len    - number of characters put into buffer (may be 0)


@{B}SEE ALSO@{UB}
    IoErr, SetIoErr, PrintFault


@{B}BUGS@{UB}
@{FG SHINE}    In older documentation, the return was shown as BOOL success.
    This was incorrect, it has always returned the length.
@{FG TEXT}
@ENDNODE

@NODE "exNext" "exNext"
@{FG SHINE}exNext@{FG TEXT}

@{B}NAME@{UB}
@{B}    ExNext -- Examine the next entry in a directory

@{UB}
@{B}SYNOPSIS@{UB}
    BOOL success = ExNext( BPTR lock, struct FileInfoBlock *fib );


@{B}FUNCTION@{UB}
@{B}@{FG SHINE}    This routine is passed a directory lock and a FileInfoBlock that
    have been initialized by a previous call to Examine(), or updated
    by a previous call to ExNext().  ExNext() gives a return code of zero
    on failure.  The most common cause of failure is reaching the end
    of the list of files in the owning directory.  In this case, IoErr
    will return ERROR_NO_MORE_ENTRIES and a good exit is appropriate.

    So, follow these steps to examine a directory:
    1) Pass a Lock and a FileInfoBlock to Examine().  The lock must
       be on the directory you wish to examine.
    2) Pass ExNext() the same lock and FileInfoBlock.
    3) Do something with the information returned in the FileInfoBlock.
       Note that the fib_DirEntryType field is positive for directories,
       negative for files.
    4) Keep calling ExNext() until it returns FALSE.  Check IoErr()
       to ensure that the reason for failure was ERROR_NO_MORE_ENTRIES.

    Note: if you wish to recursively scan the file tree and you find
    another directory while ExNext()ing you must Lock that directory and
    Examine() it using a new FileInfoBlock.  Use of the same
    FileInfoBlock to enter a directory would lose important state
    information such that it will be impossible to continue scanning
    the parent directory.  While it is permissible to UnLock() and Lock()
    the parent directory between ExNext() calls, this is NOT recommended.
    Important state information is associated with the parent lock, so
    if it is freed between ExNext() calls this information has to be
    rebuilt on each new ExNext() call, and will significantly slow down
    directory scanning.

    It is NOT legal to Examine() a file, and then to ExNext() from that
    FileInfoBlock.   You may make a local copy of the FileInfoBlock, as
    long as it is never passed back to the operating system.

@{FG TEXT}@{UB}
@{B}INPUTS@{UB}
    lock - BCPL pointer to a lock originally used for the Examine() call
    infoBlock - pointer to a FileInfoBlock used on the previous Examine()
           or ExNext() call.

 SPECIAL NOTE
    FileInfoBlock must be longword-aligned.  AllocDosObject() will
    allocate them correctly for you.


@{B}SEE ALSO@{UB}
    Examine, Lock, UnLock, IoErr, ExamineFH, 
    AllocDosObject, ExAll

@ENDNODE

@NODE "exitProgram" "exitProgram"
@{FG SHINE}exitProgram@{FG TEXT}

@{B}NAME@{UB}
@{B}    Exit -- Exit from a program

@{UB}
@{B}SYNOPSIS@{UB}
    void Exit( LONG returnCode );


@{B}FUNCTION@{UB}
@{B}@{FG SHINE}    Exit() is currently for use with programs written as if they
    were BCPL programs.  This function is not normally useful for
    other purposes.

    In general, therefore, please DO NOT CALL THIS FUNCTION!

    In order to exit, C programs should use the C language exit()
    function (note the lower case letter "e").  Assembly programs should
    place a return code in D0, and execute an RTS instruction with
    their original stack ptr.

 IMPLEMENTATION
    The action of Exit() depends on whether the program which called it
    is running as a command under a CLI or not. If the program is
    running under the CLI the command finishes and control reverts to
    the CLI. In this case, returnCode is interpreted as the return code
    from the program.

    If the program is running as a distinct process, Exit() deletes the
    process and release the space associated with the stack, segment
    list and process structure.

@{FG TEXT}@{UB}
@{B}INPUTS@{UB}
    returnCode - integer


@{B}SEE ALSO@{UB}
    CreateProc, CreateNewProc

@ENDNODE

@NODE "execute" "execute"
@{FG SHINE}execute@{FG TEXT}

@{B}NAME@{UB}
@{B}    Execute -- Execute a CLI command

@{UB}
@{B}SYNOPSIS@{UB}
    BOOL success = Execute( char *commandString, BPTR input, BPTR output );


@{B}FUNCTION@{UB}
@{B}@{FG SHINE}    This function attempts to execute the string commandString as a
    Shell command and arguments. The string can contain any valid input
    that you could type directly in a Shell, including input and output
    redirection using < and >.  Note that Execute() doesn't return until
    the command(s) in commandstring have returned.

    The input file handle will normally be zero, and in this case
    Execute() will perform whatever was requested in the commandString
    and then return. If the input file handle is nonzero then after the
    (possibly empty) commandString is performed subsequent input is read
    from the specified input file handle until end of that file is
    reached.

    In most cases the output file handle must be provided, and is used
    by the Shell commands as their output stream unless output
    redirection was specified. If the output file handle is set to zero
    then the current window, normally specified as *, is used. Note
    that programs running under the Workbench do not normally have a
    current window.

    Execute() may also be used to create a new interactive Shell process
    just like those created with the NewShell command. In order to do
    this you would call Execute() with an empty commandString, and pass
    a file handle relating to a new window as the input file handle.
    The output file handle would be set to zero. The Shell will read
    commands from the new window, and will use the same window for
    output. This new Shell window can only be terminated by using the
    EndCLI command.

    Under V37, if an input filehandle is passed, and it's either
    interactive or a NIL: filehandle, the pr_ConsoleTask of the new
    process will be set to that filehandle's process (the same applies
    to SystemTagList()).

    For this command to work the program Run must be present in C: in
    versions before V36 (except that in 1.3.2 and any later 1.3 versions,
    the system first checks the resident list for Run).

@{FG TEXT}@{UB}
@{B}INPUTS@{UB}
    commandString - pointer to a null-terminated string
    input         - BCPL pointer to a file handle
    output         - BCPL pointer to a file handle


@{B}RESULT@{UB}
    success - BOOLEAN indicating whether Execute was successful
              in finding and starting the specified program.  
              Note this is NOT the return code of the command(s).

@{B}SEE ALSO@{UB}
    SystemTagList, NewShell, EndCLI, Run

@ENDNODE

@NODE "examineFH" "examineFH"
@{FG SHINE}examineFH@{FG TEXT}

@{B}NAME@{UB}
@{B}    ExamineFH -- Gets information on an open file (V36)

@{UB}
@{B}SYNOPSIS@{UB}
    BOOL success = ExamineFH( BPTR fh, struct FileInfoBlock *fib );


@{B}FUNCTION@{UB}
@{B}@{FG SHINE}    Examines a filehandle and returns information about the file in the
    FileInfoBlock.  There are no guarantees as to whether the fib_Size
    field will reflect any changes made to the file size it was opened,
    though filesystems should attempt to provide up-to-date information
    for it.

@{FG TEXT}@{UB}
@{B}INPUTS@{UB}
    fh  - Filehandle you wish to examine
    fib - FileInfoBlock, must be longword aligned.


@{B}SEE ALSO@{UB}
    Examine, ExNext, ExAll, Open, AllocDosObject

@ENDNODE

@NODE "examine" "examine"
@{FG SHINE}examine@{FG TEXT}

@{B}NAME@{UB}
@{B}    Examine -- Examine a directory or file associated with a lock

@{UB}
@{B}SYNOPSIS@{UB}
    BOOL success = Examine( BPTR lock, struct FileInfoBlock *fib );


@{B}FUNCTION@{UB}
@{B}@{FG SHINE}    Examine() fills in information in the FileInfoBlock concerning the
    file or directory associated with the lock. This information
    includes the name, size, creation date and whether it is a file or
    directory.  FileInfoBlock must be longword aligned.  Examine() gives
    a return code of zero if it fails.

    You may make a local copy of the FileInfoBlock, as long as it is
    never passed to ExNext().

@{FG TEXT}@{UB}
@{B}INPUTS@{UB}
    lock     - BCPL pointer to a lock
    infoBlock - pointer to a FileInfoBlock (MUST be longword aligned)


@{B}RESULT@{UB}
    success - boolean

 SPECIAL NOTE
    FileInfoBlock must be longword-aligned.  AllocDosObject() will
    allocate them correctly for you.


@{B}SEE ALSO@{UB}
    Lock, UnLock, ExNext, ExamineFH, <dos/dos.h>,
    AllocDosObject, ExAll

@ENDNODE

@NODE "exAllEnd" "exAllEnd"
@{FG SHINE}exAllEnd@{FG TEXT}

@{B}NAME@{UB}
@{B}    ExAllEnd -- Stop an ExAll (V39)

@{UB}
@{B}SYNOPSIS@{UB}
    ExAllEnd( BPTR lock, char *buffer, LONG size, 
              LONG type, struct ExAllControl *control );


@{B}FUNCTION@{UB}
@{B}@{FG SHINE}    Stops an ExAll() on a directory before it hits NO_MORE_ENTRIES.
    The full set of arguments that had been passed to ExAll() must be
    passed to ExAllEnd(), so it can handle filesystems that can't abort
    an ExAll() directly.

@{FG TEXT}@{UB}
@{B}INPUTS@{UB}
    lock    - Lock on directory to be examined.
    buffer  - Buffer for data returned (MUST be at least word-aligned,
              preferably long-word aligned).
    size    - Size in bytes of 'buffer'.
    type    - Type of data to be returned.
    control - Control data structure (see notes above).  MUST have been
              allocated by AllocDosObject!


@{B}SEE ALSO@{UB}
    ExAll, AllocDosObject

@ENDNODE

@NODE "exAll" "exAll"
@{FG SHINE}exAll@{FG TEXT}

@{B}NAME@{UB}
@{B}    ExAll -- Examine an entire directory (V36)

@{UB}
@{B}SYNOPSIS@{UB}
    BOOL continue = ExAll( BPTR lock, char *buffer, 
                           LONG size, LONG type, 
                           struct ExAllControl *control );


@{B}FUNCTION@{UB}
@{B}@{FG SHINE}    Examines an entire directory.  

    Lock must be on a directory.  Size is the size of the buffer supplied.
    The buffer will be filled with (partial) ExAllData structures, as
    specified by the type field.

    Type is a value from those shown below that determines which information is
    to be stored in the buffer.  Each higher value adds a new thing to the list
    as described in the table below:-

      ED_NAME      FileName
      ED_TYPE      Type
      ED_SIZE      Size in bytes
      ED_PROTECTION   Protection bits
      ED_DATE      3 longwords of date
      ED_COMMENT   Comment (will be NULL if no comment)
            Note: the V37 ROM/disk filesystem returns this
            incorrectly as a BSTR.  See BUGS for a workaround.
      ED_OWNER   owner user-id and group-id (if supported)  (V39)

    Thus, ED_NAME gives only filenames, and ED_OWNER gives everything.

    NOTE: V37 dos.library, when doing ExAll() emulation, and RAM: filesystem
    will return an error if passed ED_OWNER.  If you get ERROR_BAD_NUMBER,
    retry with ED_COMMENT to get everything but owner info.  All filesystems
    supporting ExAll() must support through ED_COMMENT, and must check Type
    and return ERROR_BAD_NUMBER if they don't support the type.

    The V37 ROM/disk filesystem doesn't fill in the comment field correctly
    if you specify ED_OWNER.  See BUGS for a workaround if you need to use
    ED_OWNER.

    The ead_Next entry gives a pointer to the next entry in the buffer.  The
    last entry will have NULL in ead_Next.

    The control structure is required so that FFS can keep track if more than
    one call to ExAll is required.  This happens when there are more names in
    a directory than will fit into the buffer.  The format of the control
    structure is as follows:-

    NOTE: the control structure MUST be allocated by AllocDosObject!!!

    Entries:  This field tells the calling application how many entries are
          in the buffer after calling ExAll.  Note: make sure your code
          handles the 0 entries case, including 0 entries with continue
          non-zero.

    LastKey:  This field ABSOLUTELY MUST be initialised to 0 before calling
          ExAll for the first time.  Any other value will cause nasty
          things to happen.  If ExAll returns non-zero, then this field
          should not be touched before making the second and subsequent
          calls to ExAll.  Whenever ExAll returns non-zero, there are more
          calls required before all names have been received.

          As soon as a FALSE return is received then ExAll has completed
          (if IoErr() returns ERROR_NO_MORE_ENTRIES - otherwise it returns
          the error that occured, similar to ExNext.)

    MatchString
          If this field is NULL then all filenames will be returned.  If
          this field is non-null then it is interpreted as a pointer to
          a string that is used to pattern match all file names before
          accepting them and putting them into the buffer.  The default
          AmigaDOS caseless pattern match routine is used.  This string
          MUST have been parsed by ParsePatternNoCase()!

    MatchFunc: 
          Contains a pointer to a hook for a routine to decide if the entry
          will be included in the returned list of entries.  The entry is
          filled out first, and then passed to the hook.  If no MatchFunc is
          to be called then this entry should be NULL.  The hook is
          called with the following parameters (as is standard for hooks):
   
          BOOL = MatchFunc( hookptr, data, typeptr )
               a0   a1   a2
          (a0 = ptr to hook, a1 = ptr to filled in ExAllData, a2 = ptr
           to longword of type).

          MatchFunc should return FALSE if the entry is not to be
          accepted, otherwise return TRUE.

      Note that Dos will emulate ExAll() using Examine() and ExNext()
      if the handler in question doesn't support the ExAll() packet.

@{FG TEXT}@{UB}
@{B}INPUTS@{UB}
    lock    - Lock on directory to be examined.
    buffer  - Buffer for data returned (MUST be at least word-aligned,
              preferably long-word aligned).
    size    - Size in bytes of 'buffer'.
    type    - Type of data to be returned.
    control - Control data structure (see notes above).  MUST have been
         allocated by AllocDosObject!


@{B}RESULT@{UB}
    continue - Whether or not ExAll is done.  If FALSE is returned, either
       ExAll has completed (IoErr() == ERROR_NO_MORE_ENTRIES), or
       an error occurred (check IoErr()).  If non-zero is returned,
       you MUST call ExAll again until it returns FALSE.


@{B}EXAMPLE@{UB}

   eac = AllocDosObject(DOS_EXALLCONTROL,NULL);
   if (!eac) ...
   ...
   eac->eac_LastKey = 0;
   do {
       more = ExAll(lock, EAData, sizeof(EAData), ED_FOO, eac);
       if ((!more) && (IoErr() != ERROR_NO_MORE_ENTRIES)) {
           \\* ExAll failed abnormally *\\
           break;
       }
       if (eac->eac_Entries == 0) {
           \\* ExAll failed normally with no entries *\\
           continue;                   \\* ("more" is *usually* zero) *\\
       }
       ead = (struct ExAllData *) EAData;
       do {
           \\* use ead here *\\
           ...
           \\* get next ead *\\
           ead = ead->ed_Next;
       } while (ead);

   } while (more);
   ...
   FreeDosObject(DOS_EXALLCONTROL,eac);


@{B}BUGS@{UB}
@{FG SHINE}    In V36, there were problems with ExAll (particularily with
    eac_MatchString, and ed_Next with the ramdisk and the emulation
    of it in Dos for handlers that do not support the packet.  It is
    advised you only use this under V37 and later.

    The V37 ROM/disk filesystem incorrectly returned comments as BSTR's
    (length plus characters) instead of CSTR's (null-terminated).  See
    the next bug for a way to determine if the filesystem is a V37
    ROM/disk filesystem.  Fixed in V39.

    The V37 ROM/disk filesystem incorrectly handled values greater than
    ED_COMMENT.  Because of this, ExAll() information is trashed if
    ED_OWNER is passed to it.  Fixed in V39.  To work around this, use
    the following code to identify if a filesystem is a V37 ROM/disk
    filesystem:

 // return TRUE if this is a V37 ROM filesystem, which doesn't (really)
 // support ED_OWNER safely

 BOOL CheckV37(BPTR lock)
 {
    struct FileLock *l = BADDR(lock);
    struct Resident *resident;
    struct DosList *dl;
    BOOL result = FALSE;
 
    dl = LockDosList(LDF_READ|LDF_DEVICES);
 
    // if the lock has a volume and no device, we won't find it,
   // so we know it's not a V37 ROM/disk filesystem
    do {
        dl = NextDosEntry(dl,LDF_READ|LDF_DEVICES);
        if (dl && (dl->dol_Task == l->fl_Task))
        {
       // found the filesystem - test isn't actually required,
      // but we know the filesystem we're looking for will always
      // have a startup msg.  If we needed to examine the message,
      // we would need a _bunch_ of checks to make sure it's not
      // either a small value (like port-handler uses) or a BSTR.
       if (dl->dol_misc.dol_handler.dol_Startup)
       {
          // try to make sure it's the ROM fs or l:FastFileSystem
          if (resident =
              FindRomTag(dl->dol_misc.dol_handler.dol_SegList))
          {
             if (resident->rt_Version < 39 &&
                 (strncmp(resident->rt_IdString,"fs 37.",
                     strlen("fs 37.")) == 0 ||
                  strncmp(resident->rt_Name,"ffs 37.",
                     strlen("ffs 37.")) == 0))
             {
                result = TRUE;
             }
          }
       }
       break;
        }
    } while (dl);

    UnLockDosList(LDF_READ|LDF_DEVICES);
 
    return result;
 }
 

@{FG TEXT}
@{B}SEE ALSO@{UB}
    Examine, ExNext, ExamineFH, MatchPatternNoCase,
    ParsePatternNoCase, AllocDosObject, ExAllEnd

@ENDNODE

@NODE "errReport" "ErrorReport:"
@{FG SHINE}()@{FG TEXT}

@{B}NAME@{UB}
@{B}    ErrorReport -- Displays a Retry/Cancel requester for an error (V36)

@{UB}
@{B}SYNOPSIS@{UB}
    BOOL status = ErrorReport( LONG code, LONG type, 
                               ULONG arg1, struct MsgPort *device );


@{B}FUNCTION@{UB}
@{B}@{FG SHINE}    Based on the request type, this routine formats the appropriate
    requester to be displayed.  If the code is not understood, it returns
    DOS_TRUE immediately.  Returns DOS_TRUE if the user selects CANCEL or
    if the attempt to put up the requester fails, or if the process
    pr_WindowPtr is -1.  Returns FALSE if the user selects Retry.  The
    routine will retry on DISKINSERTED for appropriate error codes.
    These return values are the opposite of what AutoRequest returns.

    Note: this routine sets IoErr() to code before returning.

@{FG TEXT}@{UB}
@{B}INPUTS@{UB}
    code   - Error code to put a requester up for.
       Current valid error codes are:
       ERROR_DISK_NOT_VALIDATED
       ERROR_DISK_WRITE_PROTECTED
       ERROR_DISK_FULL
       ERROR_DEVICE_NOT_MOUNTED
       ERROR_NOT_A_DOS_DISK
       ERROR_NO_DISK
       ABORT_DISK_ERROR   // read/write error
       ABORT_BUSY      // you MUST replace...

    type   - Request type:
          REPORT_LOCK   - arg1 is a lock (BPTR).
          REPORT_FH     - arg1 is a filehandle (BPTR).
          REPORT_VOLUME - arg1 is a volumenode (C pointer).
          REPORT_INSERT - arg1 is the string for the volumename

                (will be split on a ':').
                With ERROR_DEVICE_NOT_MOUNTED puts
                up the "Please insert..." requester.

    arg1   - variable parameter (see type)
    device - (Optional) Address of handler task for which report is to be 
                 made.  Only required for REPORT_LOCK, and only if arg1==NULL.


@{B}RESULT@{UB}
    status - Cancel/Retry indicator (0 means Retry)


@{B}SEE ALSO@{UB}
    Fault, IoErr

@ENDNODE

@NODE "endNotify" "endNotify"
@{FG SHINE}endNotify@{FG TEXT}

@{B}NAME@{UB}
@{B}    EndNotify -- Ends a notification request (V36)

@{UB}
@{B}SYNOPSIS@{UB}
    void EndNotify( struct NotifyRequest *notifystructure );


@{B}FUNCTION@{UB}
@{B}@{FG SHINE}    Removes a notification request.  Safe to call even if StartNotify()
    failed.  For NRF_SEND_MESSAGE, it searches your port for any messages
    about the object in question and removes and replies them before
    returning.

@{FG TEXT}@{UB}
@{B}INPUTS@{UB}
    notifystructure - a structure passed to StartNotify()


@{B}SEE ALSO@{UB}
    StartNotify, <dos/notify.h>

@ENDNODE

@NODE "dupLockFromFH" "dupLockFromFH"
@{FG SHINE}dupLockFromFH@{FG TEXT}

@{B}NAME@{UB}
@{B}    DupLockFromFH -- Gets a lock on an open file (V36)

@{UB}
@{B}SYNOPSIS@{UB}
    BPTR lock = DupLockFromFH( BPTR fh );


@{B}FUNCTION@{UB}
@{B}@{FG SHINE}    Obtain a lock on the object associated with fh.  Only works if the
    file was opened using a non-exclusive mode.  Other restrictions may be
    placed on success by the filesystem.

@{FG TEXT}@{UB}
@{B}INPUTS@{UB}
    fh   - Opened file for which to obtain the lock


@{B}RESULT@{UB}
    lock - Obtained lock or NULL for failure


@{B}SEE ALSO@{UB}
    DupLock, Lock, UnLock

@ENDNODE

@NODE "dupLock" "dupLock"
@{FG SHINE}dupLock@{FG TEXT}

@{B}NAME@{UB}
@{B}    DupLock -- Duplicate a lock

@{UB}
@{B}SYNOPSIS@{UB}
    BPTR lock = DupLock( BPTR lock );


@{B}FUNCTION@{UB}
@{B}@{FG SHINE}    DupLock() is passed a shared filing system lock.  This is the ONLY
    way to obtain a duplicate of a lock... simply copying is not
    allowed.

    Another lock to the same object is then returned.  It is not
    possible to create a copy of a exclusive lock.

    A zero return indicates failure.

@{FG TEXT}@{UB}
@{B}INPUTS@{UB}
    lock - BCPL pointer to a lock


@{B}RESULT@{UB}
    newLock - BCPL pointer to a lock


@{B}SEE ALSO@{UB}
    Lock, UnLock, DupLockFromFH, ParentOfFH

@ENDNODE

@NODE "doPacket" "doPacket"
@{FG SHINE}doPacket@{FG TEXT}

@{B}NAME@{UB}
@{B}    DoPkt -- Send a dos packet and wait for reply (V36)

@{UB}
@{B}SYNOPSIS@{UB}
    LONG result1 = DoPkt( struct MsgPort *port, LONG action,
                          LONG arg1, LONG arg2, LONG arg3,
                          LONG arg4, LONG arg5 );


@{B}FUNCTION@{UB}
@{B}@{FG SHINE}    Sends a packet to a handler and waits for it to return.  Any secondary
    return will be available in D1 AND from IoErr().  DoPkt() will work
    even if the caller is an exec task and not a process; however it will
    be slower, and may fail for some additional reasons, such as being
    unable to allocate a signal.  DoPkt() uses your pr_MsgPort for the
    reply, and will call pr_PktWait.  (See BUGS regarding tasks, though).

    Only allows 5 arguments to be specified.  For more arguments (packets
    support a maximum of 7) create a packet and use SendPkt()/WaitPkt().

@{FG TEXT}@{UB}
@{B}INPUTS@{UB}
    port    - pr_MsgPort of the handler process to send to.
    action  - the action requested of the filesystem/handler
    arg1, arg2, arg3, arg4,arg5 - arguments, depend on the action, may not
          be required.


@{B}RESULT@{UB}
    result1 - the value returned in dp_Res1, or FALSE if there was some
         problem in sending the packet or recieving it.
    result2 - Available from IoErr() AND in register D1.


@{B}BUGS@{UB}
@{FG SHINE}    Using DoPkt() from tasks doesn't work in V36. Use AllocDosObject(),
    PutMsg(), and WaitPort()/GetMsg() for a workaround, or you can call
    CreateNewProc() to start a process to do Dos I/O for you.  In V37,
    DoPkt() will allocate, use, and free the MsgPort required.

@{FG TEXT}
@{B}NOTES@{UB}
@{B}@{FG SHINE}    Callable from a task (under V37 and above).

@{FG TEXT}@{UB}
@{B}SEE ALSO@{UB}
    AllocDosObject, FreeDosObject, SendPkt, WaitPkt,
    CreateNewProc, AbortPkt

@ENDNODE

@NODE "deviceProc" "deviceProc"
@{FG SHINE}deviceProc@{FG TEXT}

@{B}NAME@{UB}
@{B}    DeviceProc -- Return the process MsgPort of specific I/O handler

@{UB}
@{B}SYNOPSIS@{UB}
    struct MsgPort *process = DeviceProc( char *name );


@{B}FUNCTION@{UB}
@{B}@{FG SHINE}    DeviceProc() returns the process identifier of the process which
    handles the device associated with the specified name. If no
    process handler can be found then the result is zero. If the name
    refers to an assign then a directory lock is returned in IoErr().
    This lock should not be UnLock()ed or Examine()ed (if you wish to do
    so, DupLock() it first).

@{FG TEXT}@{UB}
@{B}BUGS@{UB}
@{FG SHINE}    In V36, if you try to DeviceProc() something relative to an assign
    made with AssignPath(), it will fail.  This is because there's no
    way to know when to unlock the lock.  If you're writing code for
    V36 or later, it is highly advised you use GetDeviceProc() instead,
    or make your code conditional on V36 to use GetDeviceProc()/
    FreeDeviceProc().

@{FG TEXT}
@{B}SEE ALSO@{UB}
    GetDeviceProc, FreeDeviceProc, DupLock, UnLock, Examine

@ENDNODE

@NODE "deleteVar" "deleteVar"
@{FG SHINE}deleteVar@{FG TEXT}

@{B}NAME@{UB}
@{B}    DeleteVar -- Deletes a local or environment variable (V36)

@{UB}
@{B}SYNOPSIS@{UB}
    BOOL success = DeleteVar( char *name, ULONG flags ); 


@{B}FUNCTION@{UB}
@{B}@{FG SHINE}    Deletes a local or environment variable.

@{FG TEXT}@{UB}
@{B}INPUTS@{UB}
    name   - pointer to an variable name.  Note variable names follow
        filesystem syntax and semantics.
    flags  - combination of type of var to delete (low 8 bits), and
        flags to control the behavior of this routine.  Currently
        defined flags include:

        GVF_LOCAL_ONLY  - delete a local (to your process) variable.
        GVF_GLOBAL_ONLY - delete a global environment variable.

        The default is to delete a local variable if found, otherwise
        a global environment variable if found (only for LV_VAR).


@{B}RESULT@{UB}
    success - If non-zero, the variable was sucessfully deleted, FALSE
         indicates failure.


@{B}BUGS@{UB}
@{FG SHINE}    LV_VAR is the only type that can be global

@{FG TEXT}
@{B}SEE ALSO@{UB}
    GetVar, SetVar, FindVar, DeleteFile, <dos/var.h>

@ENDNODE

@NODE "deleteFile" "deleteFile"
@{FG SHINE}deleteFile@{FG TEXT}

@{B}NAME@{UB}
@{B}    DeleteFile -- Delete a file or directory

@{UB}
@{B}SYNOPSIS@{UB}
    BOOL success = DeleteFile( char *name );


@{B}FUNCTION@{UB}
@{B}@{FG SHINE}    This attempts to delete the file or directory specified by 'name'.
    An error is returned if the deletion fails. Note that all the files
    within a directory must be deleted before the directory itself can
    be deleted.

@{FG TEXT}@{UB}
@{B}INPUTS@{UB}
    name - pointer to a null-terminated string

@ENDNODE

@NODE "delay" "delay"
@{FG SHINE}delay@{FG TEXT}

@{B}NAME@{UB}
@{B}    Delay -- Delay a process for a specified time

@{UB}
@{B}SYNOPSIS@{UB}
    void Delay( ULONG ticks );


@{B}FUNCTION@{UB}
@{B}@{FG SHINE}    The argument 'ticks' specifies how many ticks (50 per second) to
    wait before returning control.

@{FG TEXT}@{UB}
@{B}INPUTS@{UB}
    ticks - integer


@{B}BUGS@{UB}
@{FG SHINE}    Due to a bug in the timer.device in V1.2/V1.3, specifying a timeout
    of zero for Delay() can cause the unreliable timer & floppy disk
    operation.  This is fixed in V36 and later.
@{FG TEXT}
@ENDNODE

@NODE "dateToStr" "dateToStr"
@{FG SHINE}dateToStr@{FG TEXT}

@{B}NAME@{UB}
@{B}    DateToStr -- Converts a DateStamp to a string (V36)

@{UB}
@{B}SYNOPSIS@{UB}
    BOOL success = DateToStr( struct DateTime *datetime );


@{B}FUNCTION@{UB}
@{B}@{FG SHINE}    DateToStr converts an AmigaDOS DateStamp to a human
    readable ASCII string as requested by your settings in the
    DateTime structure.

@{FG TEXT}@{UB}
@{B}INPUTS@{UB}
    DateTime - a pointer to an initialized DateTime structure.

    The DateTime structure should be initialized as follows:

    dat_Stamp - a copy of the datestamp you wish to convert to
         ascii.

    dat_Format - a format byte which specifies the format of the
         dat_StrDate.  This can be any of the following
         (note: If value used is something other than those
         below, the default of   FORMAT_DOS is used):
   
         FORMAT_DOS:     AmigaDOS format (dd-mmm-yy).
   
         FORMAT_INT:     International   format (yy-mmm-dd).
   
         FORMAT_USA:     American format (mm-dd-yy).
   
         FORMAT_CDN:     Canadian format (dd-mm-yy).
   
         FORMAT_DEF:     default format for locale.

    dat_Flags - a   flags byte.  The only flag which affects this
         function is:

         DTF_SUBST:  If set, a string such as Today,
               Monday, etc., will be used instead
               of the dat_Format specification if
               possible.
         DTF_FUTURE:     Ignored by this function.

    dat_StrDay - pointer to a buffer to receive the day of the
         week string.   (Monday, Tuesday, etc.). If null, this
         string will not be generated.

    dat_StrDate -   pointer   to a buffer to receive the date
         string, in the format   requested by dat_Format,
         subject to possible modifications by DTF_SUBST.  If
         null,   this string will not be   generated.

    dat_StrTime - pointer to a buffer to receive the time of day
         string. If NULL, this will not be generated.


@{B}RESULT@{UB}
    success - a zero return indicates that the DateStamp was
         invalid, and could not be converted.  Non-zero
         indicates that the call succeeded.
   

@{B}SEE ALSO@{UB}
    DateStamp, StrtoDate, <dos/datetime.h>

@ENDNODE

@NODE "dateStamp" "dateStamp"
@{FG SHINE}dateStamp@{FG TEXT}

@{B}NAME@{UB}
@{B}    DateStamp -- Obtain the date and time in internal format

@{UB}
@{B}SYNOPSIS@{UB}
    struct DateStamp *ds = DateStamp( struct DateStamp *ds );


@{B}FUNCTION@{UB}
@{B}@{FG SHINE}    DateStamp takes a structure of three longwords that is set to the
    current time.  The first element in the vector is a count of the
    number of days.  The second element is the number of minutes elapsed
    in the day.  The third is the number of ticks elapsed in the current
    minute.  A tick happens 50 times a second.  DateStamp() ensures that
    the day and minute are consistent.  All three elements are zero if
    the date is unset. DateStamp() currently only returns even
    multiples of 50 ticks.  Therefore the time you get is always an even
    number of ticks.

    Time is measured from Jan 1, 1978.

@{FG TEXT}@{UB}
@{B}INPUTS@{UB}
    ds - pointer a struct DateStamp


@{B}RESULT@{UB}
    The array is filled as described and returned (for pre-V36 
    compabability).


@{B}SEE ALSO@{UB}
    DateToStr, StrToDate, SetFileDate, CompareDates

@ENDNODE

@NODE "currentDir" "currentDir"
@{FG SHINE}currentDir@{FG TEXT}

@{B}NAME@{UB}
@{B}    CurrentDir -- Make a directory lock the current directory

@{UB}
@{B}SYNOPSIS@{UB}
    BPTR oldLock = CurrentDir( BPTR lock );


@{B}FUNCTION@{UB}
@{B}@{FG SHINE}    CurrentDir() causes a directory associated with a lock to be made
    the current directory.   The old current directory lock is returned.

    A value of zero is a valid result here, this 0 lock represents the
    root of file system that you booted from.

    Any call that has to Open() or Lock() files (etc) requires that
    the current directory be a valid lock or 0.

@{FG TEXT}@{UB}
@{B}INPUTS@{UB}
    lock - BCPL pointer to a lock


@{B}RESULT@{UB}
    oldLock - BCPL pointer to a lock


@{B}SEE ALSO@{UB}
    Lock, UnLock, Open, DupLock

@ENDNODE

@NODE "createProc" "CreateProc"
@{FG SHINE}@{FG TEXT}

@{B}NAME@{UB}
@{B}    CreateProc -- Create a new process

@{UB}
@{B}SYNOPSIS@{UB}
    struct MsgPort *process = CreateProc( char *name,
                                          LONG  pri,
                                          BPTR  seglist,
                                          LONG  stackSize )


@{B}FUNCTION@{UB}
@{B}@{FG SHINE}    CreateProc() creates a new AmigaDOS process of name 'name'.  AmigaDOS
    processes are a superset of exec tasks.

    A seglist, as returned by LoadSeg(), is passed as 'seglist'.
    This represents a section of code which is to be run as a new
    process. The code is entered at the first hunk in the segment list,
    which should contain suitable initialization code or a jump to
    such.  A process control structure is allocated from memory and
    initialized.  If you wish to fake a seglist (that will never
    have DOS UnLoadSeg() called on it), use this code:

           DS.L    0   ;Align to longword
           DC.L    16   ;Segment "length" (faked)
           DC.L    0   ;Pointer to next segment
           ...start of code...

    The size of the root stack upon activation is passed as
    'stackSize'.  'pri' specifies the required priority of the new
    process.  The result will be the process msgport address of the new
    process, or zero if the routine failed.  The argument 'name'
    specifies the new process name.  A zero return code indicates
    error.

    The seglist passed to CreateProc() is not freed when it exits; it
    is up to the parent process to free it, or for the code to unload
    itself.

    Under V36 and later, you probably should use CreateNewProc() instead.

@{FG TEXT}@{UB}
@{B}INPUTS@{UB}
    name      - pointer to a null-terminated string
    pri       - signed long (range -128 to +127)
    seglist   - BCPL pointer to a seglist
    stackSize - integer (must be a multiple of 4 bytes)


@{B}RESULT@{UB}
    process   - pointer to new process msgport


@{B}SEE ALSO@{UB}
    CreateNewProc, LoadSeg, UnLoadSeg

@ENDNODE

@NODE "createNewProc" "createNewProc"
@{FG SHINE}createNewProc@{FG TEXT}

@{B}NAME@{UB}
@{B}    CreateNewProc -- Create a new process (V36)

@{UB}
@{B}SYNOPSIS@{UB}
    struct Process *process = CreateNewProc( struct TagItem *tags );


@{B}FUNCTION@{UB}
@{B}@{FG SHINE}    This creates a new process according to the tags passed in.  See
    dos/dostags.h for the tags.

    You must specify one of NP_Seglist or NP_Entry.  NP_Seglist takes a
    seglist (as returned by LoadSeg()).  NP_Entry takes a function
    pointer for the routine to call.

    There are many options, as you can see by examining dos/dostags.h.
    The defaults are for a non-CLI process, with copies of your
    CurrentDir, HomeDir (used for PROGDIR:), priority, consoletask,
    windowptr, and variables.  The input and output filehandles default
    to opens of NIL:, stack to 4000, and others as shown in dostags.h.
    This is a fairly reasonable default setting for creating threads,
    though you may wish to modify it (for example, to give a descriptive
    name to the process.)

    CreateNewProc() is callable from a task, though any actions that
    require doing Dos I/O (DupLock() of currentdir, for example) will not
    occur.

    NOTE: if you call CreateNewProc() with both NP_Arguments, you must
    not specify an NP_Input of NULL.  When NP_Arguments is specified, it
    needs to modify the input filehandle to make ReadArgs() work properly.
   
@{FG TEXT}@{UB}
@{B}INPUTS@{UB}
    tags - a pointer to a TagItem array.


@{B}RESULT@{UB}
    process - The created process, or NULL.  Note that if it returns
         NULL, you must free any items that were passed in via
         tags, such as if you passed in a new current directory
         with NP_CurrentDir.


@{B}BUGS@{UB}
@{FG SHINE}    In V36, NP_Arguments was broken in a number of ways, and probably
    should be avoided (instead you should start a small piece of your
    own code, which calls RunCommand() to run the actual code you wish
    to run).  In V37, NP_Arguments works, though see the note above.

@{FG TEXT}
@{B}SEE ALSO@{UB}
    LoadSeg, CreateProc, ReadArgs, RunCommand, <dos/dostags.h>

@ENDNODE

@NODE "createDir" "CreateDir"
@{FG SHINE}@{FG TEXT}

@{B}NAME@{UB}
@{B}    CreateDir -- Create a new directory

@{UB}
@{B}SYNOPSIS@{UB}
    BPTR lock = CreateDir( char *name )


@{B}FUNCTION@{UB}
@{B}@{FG SHINE}    CreateDir creates a new directory with the specified name. An error
    is returned if it fails.  Directories can only be created on
    devices which support them, e.g. disks.  CreateDir returns an
    exclusive lock on the new directory if it succeeds.

@{FG TEXT}@{UB}
@{B}INPUTS@{UB}
    name - pointer to a null-terminated string


@{B}RESULT@{UB}
    lock - BCPL pointer to a lock or NULL for failure.


@{B}SEE ALSO@{UB}
    Lock, UnLock

@ENDNODE

@NODE "compareDates" "compareDates"
@{FG SHINE}compareDates@{FG TEXT}

@{B}NAME@{UB}
@{B}    CompareDates -- Compares two datestamps (V36)

@{UB}
@{B}SYNOPSIS@{UB}
    LONG result = CompareDates( struct DateStamp *date1,
                                struct DateStamp *date2 );


@{B}FUNCTION@{UB}
@{B}@{FG SHINE}    Compares two times for relative magnitide.  <0 is returned if date1 is
    later than date2, 0 if they are equal, or >0 if date2 is later than
    date1.  NOTE: this is NOT the same ordering as strcmp!

@{FG TEXT}@{UB}
@{B}INPUTS@{UB}
    date1, date2 - DateStamps to compare


@{B}RESULT@{UB}
    result -  <0, 0, or >0 based on comparison of two date stamps


@{B}SEE ALSO@{UB}
    DateStamp, DateToStr, StrToDate

@ENDNODE

@NODE "closeFile" "closeFile"
@{FG SHINE}closeFile@{FG TEXT}

@{B}NAME@{UB}
@{B}    Close -- Close an open file

@{UB}
@{B}SYNOPSIS@{UB}
    BOOL success = Close( BPTR file );


@{B}FUNCTION@{UB}
@{B}@{FG SHINE}    The file specified by the file handle is closed. You must close all
    files you explicitly opened, but you must not close inherited file
    handles that are passed to you (each filehandle must be closed once
    and ONLY once).  If Close() fails, the file handle is still
    deallocated and should not be used.

@{FG TEXT}@{UB}
@{B}INPUTS@{UB}
    file - BCPL pointer to a file handle


@{B}RESULT@{UB}
    success - returns if Close() succeeded.  Note that it might fail
         depending on buffering and whatever IO must be done to
         close a file being written to.  NOTE: this return value
         did not exist before V36! 


@{B}SEE ALSO@{UB}
    Open, OpenFromLock

@ENDNODE

@NODE "cliInitRun" "cliInitRun"
@{FG SHINE}cliInitRun@{FG TEXT}

@{B}NAME@{UB}
@{B}    CliInitRun -- Set up a process to be a shell from initial packet

@{UB}
@{B}SYNOPSIS@{UB}
    LONG flags = CliInitRun( struct DosPacket *packet );


@{B}FUNCTION@{UB}
@{B}@{FG SHINE}    This function initializes a process and CLI structure for a new
    shell, from parameters in an initial packet passed by the system
    (Run, System(), Execute()).  The format of the data in the packet
    is purposely not defined.  The setup includes all the normal fields
    in the structures that are required for proper operation (current
    directory, paths, input streams, etc).

    It returns a set of flags containing information about what type
    of shell invocation this is.

    Definitions for the values of fn:
       Bit 31     Set to indicate flags are valid
       Bit  3     Set to indicate asynch system call
       Bit  2     Set if this is a System() call
       Bit  1     Set if user provided input stream
       Bit  0     Set if RUN provided output stream

    If Bit 31 is 0, then you must check IoErr() to determine if an error
    occurred.  If IoErr() returns a pointer to your process, there has
    been an error, and you should clean up and exit.  The packet will
    have already been returned by CliInitNewcli().  If it isn't a pointer
    to your process and Bit 31 is 0, you should wait before replying
    the packet until after you've loaded the first command (or when you
    exit).  This helps avoid disk "gronking" with the Run command.
    (Note: this is different from what you do for CliInitNewcli().)

    If Bit 31 is 1, then if Bit 3 is one, ReplyPkt() the packet
    immediately (Asynch System()), otherwise wait until your shell exits
    (Sync System(), Execute()).
    (Note: this is different from what you do for CliInitNewcli().)
   
    This function is very similar to CliInitNewcli().

@{FG TEXT}@{UB}
@{B}INPUTS@{UB}
    packet - the initial packet sent to your process MsgPort


@{B}RESULT@{UB}
    fn - flags or a pointer


@{B}SEE ALSO@{UB}
    CliInitNewcli(), ReplyPkt, WaitPkt, System, Execute, IoErr

@ENDNODE

@NODE "cliInitNewcli" "cliInitNewcli"
@{FG SHINE}cliInitNewcli@{FG TEXT}

@{B}NAME@{UB}
@{B}    CliInitNewcli -- Set up a process to be a shell from initial packet

@{UB}
@{B}SYNOPSIS@{UB}
    LONG flags = CliInitNewcli( struct DosPacket *packet );


@{B}FUNCTION@{UB}
@{B}@{FG SHINE}    This function initializes a process and CLI structure for a new
    shell, from parameters in an initial packet passed by the system
    (NewShell or NewCLI, etc).  The format of the data in the packet
    is purposely not defined.  The setup includes all the normal fields
    in the structures that are required for proper operation (current
    directory, paths, input streams, etc).

    It returns a set of flags containing information about what type
    of shell invocation this is.

    Definitions for the values of fn:
       Bit 31     Set to indicate flags are valid
       Bit  3     Set to indicate asynch system call
       Bit  2     Set if this is a System() call
       Bit  1     Set if user provided input stream
       Bit  0     Set if RUN provided output stream

    If Bit 31 is 0, then you must check IoErr() to determine if an error
    occurred.  If IoErr() returns a pointer to your process, there has
    been an error, and you should clean up and exit.  The packet will
    have already been returned by CliInitNewcli().  If it isn't a pointer
    to your process and Bit 31 is 0, reply the packet immediately.
    (Note: this is different from what you do for CliInitRun().)

    This function is very similar to CliInitRun().

@{FG TEXT}@{UB}
@{B}INPUTS@{UB}
    packet - the initial packet sent to your process MsgPort


@{B}RESULT@{UB}
    fn - flags or a pointer


@{B}SEE ALSO@{UB}
    CliInitRun(), ReplyPkt, WaitPkt, IoErr

@ENDNODE

@NODE "cliPointer" "cliPointer"
@{FG SHINE}cliPointer@{FG TEXT}

@{B}NAME@{UB}
@{B}    Cli -- Returns a pointer to the CLI structure of the process (V36)

@{UB}
@{B}SYNOPSIS@{UB}
    struct CommandLineInterface *cli_ptr = Cli( void );


@{B}FUNCTION@{UB}
@{B}@{FG SHINE}    Returns a pointer to the CLI structure of the current process, or NULL
    if the process has no CLI structure.

@{FG TEXT}@{UB}
@{B}RESULT@{UB}
    cli_ptr - pointer to the CLI structure, or NULL.

@ENDNODE

@NODE "checkSignal" "checkSignal"
@{FG SHINE}checkSignal@{FG TEXT}

@{B}NAME@{UB}
@{B}    CheckSignal -- Checks for break signals (V36)

@{UB}
@{B}SYNOPSIS@{UB}
    ULONG signals = CheckSignal( ULONG mask );


@{B}FUNCTION@{UB}
@{B}@{FG SHINE}    This function checks to see if any signals specified in the mask have
    been set and if so, returns them.  Otherwise it returns FALSE.
    All signals specified in mask will be cleared.

@{FG TEXT}@{UB}
@{B}INPUTS@{UB}
    mask    - Signals to check for.


@{B}RESULT@{UB}
    signals - Signals specified in mask that were set.

@ENDNODE

@NODE "changeMode" "changeMode"
@{FG SHINE}changeMode@{FG TEXT}

@{B}NAME@{UB}
@{B}    ChangeMode - Change the current mode of a lock or filehandle (V36)

@{UB}
@{B}SYNOPSIS@{UB}
    BOOL success = ChangeMode( ULONG type, BPTR object, ULONG newmode );


@{B}FUNCTION@{UB}
@{B}@{FG SHINE}    This allows you to attempt to change the mode in use by a lock or
    filehandle.  For example, you could attempt to turn a shared lock
    into an exclusive lock.  The handler may well reject this request.
    Warning: if you use the wrong type for the object, the system may
    crash.

@{FG TEXT}@{UB}
@{B}INPUTS@{UB}
    type    - Either CHANGE_FH or CHANGE_LOCK
    object  - A lock or filehandle
    newmode - The new mode you want


@{B}BUGS@{UB}
@{FG SHINE}    Did not work in 2.02 or before (V36).  Works in V37.  In the
    earlier versions, it can crash the machine.

@{FG TEXT}
@{B}SEE ALSO@{UB}
    Lock, Open

@ENDNODE

@NODE "attemptLockDosList" "attemptLockDosList"
@{FG SHINE}attemptLockDosList@{FG TEXT}

@{B}NAME@{UB}
@{B}    AttemptLockDosList -- Attempt to lock the Dos Lists for use (V36)

@{UB}
@{B}SYNOPSIS@{UB}
    struct DosList *dlist = AttemptLockDosList( ULONG flags );


@{B}FUNCTION@{UB}
@{B}@{FG SHINE}    Locks the dos device list in preparation to walk the list.  If the
    list is 'busy' then this routine will return NULL.  See LockDosList()
    for more information.

@{FG TEXT}@{UB}
@{B}INPUTS@{UB}
    flags - Flags stating which types of nodes you want to lock.


@{B}RESULT@{UB}
    dlist - Pointer to the beginning of the list or NULL.  Not a valid
       node!


@{B}BUGS@{UB}
@{FG SHINE}    In V36 through V39.23 dos, this would return NULL or 0x00000001 for
    failure.  Fixed in V39.24 dos (after kickstart 39.106).

@{FG TEXT}
@{B}SEE ALSO@{UB}
    LockDosList, UnLockDosList, Forbid, NextDosEntry

@ENDNODE

@NODE "assignPath" "assignPath"
@{FG SHINE}assignPath@{FG TEXT}

@{B}NAME@{UB}
@{B}    AssignPath -- Creates an assignment to a specified path (V36)

@{UB}
@{B}SYNOPSIS@{UB}
    BOOL success = AssignPath( char *name, char *path );


@{B}FUNCTION@{UB}
@{B}@{FG SHINE}    Sets up a assignment that is expanded upon EACH reference to the name.
    This is implemented through a new device list type (DLT_ASSIGNPATH, or
    some such).  The path (a string) would be attached to the node.  When
    the name is referenced (Open("FOO:xyzzy"...), the string will be used
    to determine where to do the open.  No permanent lock will be part of
    it.  For example, you could AssignPath() c2: to df2:c, and references
    to c2: would go to df2:c, even if you change disks.

    The other major advantage is assigning things to unmounted volumes,
    which will be requested upon access (useful in startup sequences).

@{FG TEXT}@{UB}
@{B}INPUTS@{UB}
    name - Name of device to be assigned (without trailing ':')
    path - Name of late assignment to be resolved at each reference


@{B}RESULT@{UB}
    success - Success/failure indicator of the operation


@{B}SEE ALSO@{UB}
    AssignAdd, AssignLock, AssignLate, Open

@ENDNODE

@NODE "assignLock" "assignLock"
@{FG SHINE}assignLock@{FG TEXT}

@{B}NAME@{UB}
@{B}    AssignLock -- Creates an assignment to a locked object (V36)

@{UB}
@{B}SYNOPSIS@{UB}
    BOOL success = AssignLock( char *name, BPTR lock );


@{B}FUNCTION@{UB}
@{B}@{FG SHINE}    Sets up an assign of a name to a given lock.  Passing NULL for a lock 
    cancels any outstanding assign to that name.  If an assign entry of
    that name is already on the list, this routine replaces that entry.  If
    an entry is on the list that conflicts with the new assign, then a
    failure code is returned.

    NOTE: you should not use the lock in any way after making this call
    successfully.  It becomes the assign, and will be unlocked by the
    system when the assign is removed.  If you need to keep the lock,
    pass a lock from DupLock() to AssignLock().

@{FG TEXT}@{UB}
@{B}INPUTS@{UB}
    name - Name of device to assign lock to (without trailing ':')
    lock - Lock associated with the assigned name


@{B}RESULT@{UB}
    success - Success/failure indicator.  On failure, the lock is not
         unlocked.


@{B}SEE ALSO@{UB}
    Lock, AssignAdd, AssignPath, AssignLate, DupLock,
    RemAssignList

@ENDNODE

@NODE "assignLate" "assignLate"
@{FG SHINE}assignLate@{FG TEXT}

@{B}NAME@{UB}
@{B}    AssignLate -- Creates an assignment to a specified path later (V36)

@{UB}
@{B}SYNOPSIS@{UB}
    BOOL success = AssignLate( char *name, char *path );


@{B}FUNCTION@{UB}
@{B}@{FG SHINE}    Sets up a assignment that is expanded upon the FIRST reference to the
    name.  The path (a string) would be attached to the node.  When
    the name is referenced (Open("FOO:xyzzy"...), the string will be used
    to determine where to set the assign to, and if the directory can be
    locked, the assign will act from that point on as if it had been
    created by AssignLock().

    A major advantage is assigning things to unmounted volumes, which
    will be requested upon access (useful in startup sequences).

@{FG TEXT}@{UB}
@{B}INPUTS@{UB}
    name - Name of device to be assigned (without trailing ':')
    path - Name of late assignment to be resolved on the first reference.


@{B}RESULT@{UB}
    success - Success/failure indicator of the operation


@{B}SEE ALSO@{UB}
    Lock, AssignAdd, AssignPath, AssignLock,

@ENDNODE

@NODE "assignAdd" "assignAdd"
@{FG SHINE}assignAdd@{FG TEXT}

@{B}NAME@{UB}
@{B}    AssignAdd -- Adds a lock to an assign for multi-directory assigns (V36)

@{UB}
@{B}SYNOPSIS@{UB}
    BOOL success = AssignAdd( char *name, BPTR lock );


@{B}FUNCTION@{UB}
@{B}@{FG SHINE}    Adds a lock to an assign, making or adding to a multi-directory
    assign.  Note that this only will succeed on an assign created with
    AssignLock(), or an assign created with AssignLate() which has been
    resolved (converted into a AssignLock()-assign).

    NOTE: you should not use the lock in any way after making this call
    successfully.  It becomes the part of the assign, and will be unlocked
    by the system when the assign is removed.  If you need to keep the
    lock, pass a lock from DupLock() to AssignLock().

@{FG TEXT}@{UB}
@{B}INPUTS@{UB}
    name - Name of device to assign lock to (without trailing ':')
    lock - Lock associated with the assigned name


@{B}RESULT@{UB}
    success - Success/failure indicator.  On failure, 
              the lock is not unlocked.


@{B}SEE ALSO@{UB}
    Lock, AssignLock, AssignPath, AssignLate, DupLock,
    RemAssignList

@ENDNODE

@NODE "allocDosObject" "allocDosObject"
@{FG SHINE}allocDosObject@{FG TEXT}

@{B}NAME@{UB}
@{B}    AllocDosObject -- Creates a dos object (V36)

@{UB}
@{B}SYNOPSIS@{UB}
    void *ptr = AllocDosObject( ULONG type, struct TagItem *tags );


@{B}FUNCTION@{UB}
@{B}@{FG SHINE}    Create one of several dos objects, initializes it, and returns it
    to you.  Note the DOS_STDPKT returns a pointer to the sp_Pkt of the
    structure.

    This function may be called by a task for all types and tags defined
    in the V37 includes (DOS_FILEHANDLE through DOS_RDARGS and ADO_FH_Mode
    through ADO_PromptLen, respectively).  Any future types or tags
    will be documented as to whether a task may use them.

@{FG TEXT}@{UB}
@{B}INPUTS@{UB}
    type - type of object requested
    tags - pointer to taglist with additional information


@{B}RESULT@{UB}
    packet - pointer to the object or NULL


@{B}BUGS@{UB}
@{FG SHINE}    Before V39, DOS_CLI should be used with care since FreeDosObject()
    can't free it.

@{FG TEXT}
@{B}SEE ALSO@{UB}
    FreeDosObject, <dos/dostags.h>, <dos/dos.h>

@ENDNODE

@NODE "addSegment" "addSegment"
@{FG SHINE}addSegment@{FG TEXT}

@{B}NAME@{UB}
@{B}    AddSegment - Adds a resident segment to the resident list (V36)

@{UB}
@{B}SYNOPSIS@{UB}
    BOOL success = AddSegment( char *name, BPTR seglist, LONG type )


@{B}FUNCTION@{UB}
@{B}@{FG SHINE}    Adds a segment to the Dos resident list, with the specified Seglist
    and type (stored in seg_UC - normally 0).  NOTE: currently unused
    types may cause it to interpret other registers (d4-?) as additional
    parameters in the future.

    Do NOT build Segment structures yourself!

@{FG TEXT}@{UB}
@{B}INPUTS@{UB}
    name    - name for the segment
    seglist - Dos seglist of code for segment
    type    - initial usecount, normally 0


@{B}RESULT@{UB}
    success - success or failure


@{B}SEE ALSO@{UB}
    FindSegment, RemSegment, LoadSeg

@ENDNODE

@NODE "addPart" "addPart"
@{FG SHINE}addPart@{FG TEXT}

@{B}NAME@{UB}
@{B}    AddPart -- Appends a file/dir to the end of a path (V36)

@{UB}
@{B}SYNOPSIS@{UB}
    BOOL success = AddPart( char *dirname, char *filename, ULONG size )


@{B}FUNCTION@{UB}
@{B}@{FG SHINE}    This function adds a file, directory, or subpath name to a directory
    path name taking into account any required separator characters.  If
    filename is a fully-qualified path it will totally replace the current
    value of dirname.
   
@{FG TEXT}@{UB}
@{B}INPUTS@{UB}
    dirname  - the path to add a file/directory name to.
    filename - the filename or directory name to add.  May be a relative
          pathname from the current directory (example: foo/bar).
          Can deal with leading '/'(s), indicating one directory up
          per '/', or with a ':', indicating it's relative to the
          root of the appropriate volume.
    size     - size in bytes of the space allocated for dirname.  Must
          not be 0.


@{B}RESULT@{UB}
    success - non-zero for ok, FALSE if the buffer would have overflowed.
         If an overflow would have occured, dirname will not be
         changed.


@{B}BUGS@{UB}
@{FG SHINE}    Doesn't check if a subpath is legal (i.e. doesn't check for ':'s) and
    doesn't handle leading '/'s in 2.0 through 2.02 (V36).  V37 fixes
    this, allowing filename to be any path, including absolute.

@{FG TEXT}
@{B}SEE ALSO@{UB}
    FilePart, PathPart

@ENDNODE

@NODE "addDosEntry" "addDosEntry"
@{FG SHINE}addDosEntry@{FG TEXT}

@{B}NAME@{UB}
@{B}    AddDosEntry -- Add a Dos List entry to the lists (V36)

@{UB}
@{B}SYNOPSIS@{UB}
    LONG success = AddDosEntry( struct DosList *dlist );


@{B}FUNCTION@{UB}
@{B}@{FG SHINE}    Adds a device, volume or assign to the dos devicelist.  Can fail if it 
    conflicts with an existing entry (such as another assign to the same
    name or another device of the same name).  Volume nodes with different
    dates and the same name CAN be added, or with names that conflict with
    devices or assigns.  Note: the dos list does NOT have to be locked to
    call this.  Do not access dlist after adding unless you have locked the
    Dos Device list.

    An additional note concerning calling this from within a handler:
    in order to avoid deadlocks, your handler must either be multi-
    threaded, or it must attempt to lock the list before calling this
    function.  The code would look something like this:

    if (AttemptLockDosList( LDF_xxx | LDF_WRITE ))
       {
       rc = AddDosEntry( ... );
       UnLockDosList( LDF_xxx | LDF_WRITE );
       }

    If AttemptLockDosList() fails (i.e. it's locked already), check for
    messages at your filesystem port (don't wait!) and try the
    AttemptLockDosList() again.

@{FG TEXT}@{UB}
@{B}INPUTS@{UB}
    dlist   - Device list entry to be added.


@{B}RESULT@{UB}
    success - Success/Failure indicator


@{B}SEE ALSO@{UB}
    RemDosEntry, FindDosEntry, NextDosEntry, LockDosList,
    MakeDosEntry, FreeDosEntry, AttemptLockDosList

@ENDNODE

@NODE "addBuffers" "addBuffers"
@{FG SHINE}addBuffers@{FG TEXT}

@{B}NAME@{UB}
@{B}    AddBuffers -- Changes the number of buffers for a filesystem (V36)

@{UB}
@{B}SYNOPSIS@{UB}
    BOOL success = AddBuffers( char *filesystem, LONG number );


@{B}FUNCTION@{UB}
@{B}@{FG SHINE}    Adds buffers to a filesystem.  If it succeeds, the number of current
    buffers is returned in IoErr().  Note that "number" may be negative.
    The amount of memory used per buffer, and any limits on the number of
    buffers, are dependant on the filesystem in question.
    If the call succeeds, the number of buffers in use on the filesystem
    will be returned by IoErr().

@{FG TEXT}@{UB}
@{B}INPUTS@{UB}
    filesystem - Name of device to add buffers to (with ':').
    number     - Number of buffers to add.  May be negative.


@{B}RESULT@{UB}
    success    - Success or failure of command.


@{B}BUGS@{UB}
@{FG SHINE}    The V36 ROM filesystem (FFS/OFS) doesn't return the right number of
    buffers unless preceded by an AddBuffers(fs,-1) (in-use buffers aren't
    counted).  This is fixed in V37.

    The V37 and before ROM filesystem doesn't return success, it returns
    the number of buffers.  The best way to test for this is to consider
    0 (FALSE) failure, -1 (DOSTRUE) to mean that IoErr() will have the
    number of buffers, and any other positive value to be the number of
    buffers.  It may be fixed in some future ROM revision.

@{FG TEXT}
@{B}SEE ALSO@{UB}
    IoErr

@ENDNODE

@NODE "AbortPacket" "AbortPacket"
@{FG SHINE}AbortPacket@{FG TEXT}

@{B}NAME@{UB}
@{B}    AbortPkt -- Aborts an asynchronous packet, if possible. (V36)

@{UB}
@{B}FUNCTION@{UB}
@{B}@{FG SHINE}    This attempts to abort a packet sent earlier with SendPkt to a
    handler.  There is no guarantee that any given handler will allow
    a packet to be aborted, or if it is aborted whether function
    requested completed first or completely.  After calling AbortPkt(),
    you must wait for the packet to return before reusing it or
    deallocating it.

@{FG TEXT}@{UB}
@{B}INPUTS@{UB}
    port - port the packet was sent to
    pkt  - the packet you wish aborted


@{B}BUGS@{UB}
@{FG SHINE}    As of V37, this function does nothing.

@{FG TEXT}
@{B}SEE ALSO@{UB}
    SendPkt, DoPkt, WaitPkt

@ENDNODE


