home *** CD-ROM | disk | FTP | other *** search
/ Amiga Developer CD v1.2 / amidev_cd_12.iso / inc&ad2.0 / text_autodocs / dos.doc < prev    next >
Text File  |  1992-09-01  |  165KB  |  5,508 lines

  1. TABLE OF CONTENTS
  2.  
  3. dos.library/AbortPkt
  4. dos.library/AddBuffers
  5. dos.library/AddDosEntry
  6. dos.library/AddPart
  7. dos.library/AddSegment
  8. dos.library/AllocDosObject
  9. dos.library/AssignAdd
  10. dos.library/AssignLate
  11. dos.library/AssignLock
  12. dos.library/AssignPath
  13. dos.library/AttemptLockDosList
  14. dos.library/ChangeMode
  15. dos.library/CheckSignal
  16. dos.library/Cli
  17. dos.library/CliInitNewcli
  18. dos.library/CliInitRun
  19. dos.library/Close
  20. dos.library/CompareDates
  21. dos.library/CreateDir
  22. dos.library/CreateNewProc
  23. dos.library/CreateProc
  24. dos.library/CurrentDir
  25. dos.library/DateStamp
  26. dos.library/DateToStr
  27. dos.library/Delay
  28. dos.library/DeleteFile
  29. dos.library/DeleteVar
  30. dos.library/DeviceProc
  31. dos.library/DoPkt
  32. dos.library/DupLock
  33. dos.library/DupLockFromFH
  34. dos.library/EndNotify
  35. dos.library/ErrorReport
  36. dos.library/ExAll
  37. dos.library/Examine
  38. dos.library/ExamineFH
  39. dos.library/Execute
  40. dos.library/Exit
  41. dos.library/ExNext
  42. dos.library/Fault
  43. dos.library/FGetC
  44. dos.library/FGets
  45. dos.library/FilePart
  46. dos.library/FindArg
  47. dos.library/FindCliProc
  48. dos.library/FindDosEntry
  49. dos.library/FindSegment
  50. dos.library/FindVar
  51. dos.library/Flush
  52. dos.library/Format
  53. dos.library/FPutC
  54. dos.library/FPuts
  55. dos.library/FRead
  56. dos.library/FreeArgs
  57. dos.library/FreeDeviceProc
  58. dos.library/FreeDosEntry
  59. dos.library/FreeDosObject
  60. dos.library/FWrite
  61. dos.library/GetArgStr
  62. dos.library/GetConsoleTask
  63. dos.library/GetCurrentDirName
  64. dos.library/GetDeviceProc
  65. dos.library/GetFileSysTask
  66. dos.library/GetProgramDir
  67. dos.library/GetProgramName
  68. dos.library/GetPrompt
  69. dos.library/GetVar
  70. dos.library/Info
  71. dos.library/Inhibit
  72. dos.library/Input
  73. dos.library/InternalLoadSeg
  74. dos.library/InternalUnLoadSeg
  75. dos.library/IoErr
  76. dos.library/IsFileSystem
  77. dos.library/IsInteractive
  78. dos.library/LoadSeg
  79. dos.library/Lock
  80. dos.library/LockDosList
  81. dos.library/LockRecord
  82. dos.library/LockRecords
  83. dos.library/MakeDosEntry
  84. dos.library/MakeLink
  85. dos.library/MatchEnd
  86. dos.library/MatchFirst
  87. dos.library/MatchNext
  88. dos.library/MatchPattern
  89. dos.library/MatchPatternNoCase
  90. dos.library/MaxCli
  91. dos.library/NameFromFH
  92. dos.library/NameFromLock
  93. dos.library/NewLoadSeg
  94. dos.library/NextDosEntry
  95. dos.library/Open
  96. dos.library/OpenFromLock
  97. dos.library/Output
  98. dos.library/ParentDir
  99. dos.library/ParentOfFH
  100. dos.library/ParsePattern
  101. dos.library/ParsePatternNoCase
  102. dos.library/PathPart
  103. dos.library/PrintFault
  104. dos.library/PutStr
  105. dos.library/Read
  106. dos.library/ReadArgs
  107. dos.library/ReadItem
  108. dos.library/ReadLink
  109. dos.library/Relabel
  110. dos.library/RemAssignList
  111. dos.library/RemDosEntry
  112. dos.library/RemSegment
  113. dos.library/Rename
  114. dos.library/ReplyPkt
  115. dos.library/RunCommand
  116. dos.library/SameDevice
  117. dos.library/SameLock
  118. dos.library/Seek
  119. dos.library/SelectInput
  120. dos.library/SelectOutput
  121. dos.library/SendPkt
  122. dos.library/SetArgStr
  123. dos.library/SetComment
  124. dos.library/SetConsoleTask
  125. dos.library/SetCurrentDirName
  126. dos.library/SetFileDate
  127. dos.library/SetFileSize
  128. dos.library/SetFileSysTask
  129. dos.library/SetIoErr
  130. dos.library/SetMode
  131. dos.library/SetProgramDir
  132. dos.library/SetProgramName
  133. dos.library/SetPrompt
  134. dos.library/SetProtection
  135. dos.library/SetVar
  136. dos.library/SetVBuf
  137. dos.library/SplitName
  138. dos.library/StartNotify
  139. dos.library/StrToDate
  140. dos.library/StrToLong
  141. dos.library/SystemTagList
  142. dos.library/UnGetC
  143. dos.library/UnLoadSeg
  144. dos.library/UnLock
  145. dos.library/UnLockDosList
  146. dos.library/UnLockRecord
  147. dos.library/UnLockRecords
  148. dos.library/VFPrintf
  149. dos.library/VFWritef
  150. dos.library/VPrintf
  151. dos.library/WaitForChar
  152. dos.library/WaitPkt
  153. dos.library/Write
  154. dos.library/WriteChars
  155. dos.library/AbortPkt                                     dos.library/AbortPkt
  156.  
  157.    NAME
  158.     AbortPkt -- Aborts an asynchronous packet, if possible. (V36)
  159.  
  160.    SYNOPSIS
  161.     AbortPkt(port, pkt)
  162.           D1    D2
  163.  
  164.     void AbortPkt(struct MsgPort *, struct DosPacket *)
  165.  
  166.    FUNCTION
  167.     This attempts to abort a packet sent earlier with SendPkt to a
  168.     handler.  There is no guarantee that any given handler will allow
  169.     a packet to be aborted, or if it is aborted whether function
  170.     requested completed first or completely.  After calling AbortPkt(),
  171.     you must wait for the packet to return before reusing it or
  172.     deallocating it.
  173.  
  174.    INPUTS
  175.     port - port the packet was sent to
  176.     pkt  - the packet you wish aborted
  177.  
  178.    BUGS
  179.     As of V37, this function does nothing.
  180.  
  181.    SEE ALSO
  182.     SendPkt(), DoPkt(), WaitPkt()
  183.  
  184. dos.library/AddBuffers                                 dos.library/AddBuffers
  185.  
  186.    NAME
  187.     AddBuffers -- Changes the number of buffers for a filesystem (V36)
  188.  
  189.    SYNOPSIS
  190.     success = AddBuffers(filesystem, number)
  191.     D0               D1          D2
  192.  
  193.     BOOL AddBuffers(STRPTR, LONG)
  194.  
  195.    FUNCTION
  196.     Adds buffers to a filesystem.  If it succeeds, the number of current
  197.     buffers is returned in IoErr().  Note that "number" may be negative.
  198.     The amount of memory used per buffer, and any limits on the number of
  199.     buffers, are dependant on the filesystem in question.
  200.     If the call succeeds, the number of buffers in use on the filesystem
  201.     will be returned by IoErr().
  202.  
  203.    INPUTS
  204.     filesystem - Name of device to add buffers to (with ':').
  205.     number     - Number of buffers to add.  May be negative.
  206.  
  207.    RESULT
  208.     success    - Success or failure of command.
  209.  
  210.    BUGS
  211.     The V36 ROM filesystem (FFS/OFS) doesn't return the right number of
  212.     buffers unless preceded by an AddBuffers(fs,-1) (in-use buffers aren't
  213.     counted).  This is fixed in V37.
  214.  
  215.     The V37 and before ROM filesystem doesn't return success, it returns
  216.     the number of buffers.  The best way to test for this is to consider
  217.     0 (FALSE) failure, -1 (DOSTRUE) to mean that IoErr() will have the
  218.     number of buffers, and any other positive value to be the number of
  219.     buffers.  It may be fixed in some future ROM revision.
  220.  
  221.    SEE ALSO
  222.     IoErr()
  223.  
  224. dos.library/AddDosEntry                               dos.library/AddDosEntry
  225.  
  226.    NAME
  227.     AddDosEntry -- Add a Dos List entry to the lists (V36)
  228.  
  229.    SYNOPSIS
  230.     success = AddDosEntry(dlist)
  231.     D0                     D1
  232.  
  233.     LONG AddDosEntry(struct DosList *)
  234.  
  235.    FUNCTION
  236.     Adds a device, volume or assign to the dos devicelist.  Can fail if it 
  237.     conflicts with an existing entry (such as another assign to the same
  238.     name or another device of the same name).  Volume nodes with different
  239.     dates and the same name CAN be added, or with names that conflict with
  240.     devices or assigns.  Note: the dos list does NOT have to be locked to
  241.     call this.  Do not access dlist after adding unless you have locked the
  242.     Dos Device list.
  243.  
  244.     An additional note concerning calling this from within a handler:
  245.     in order to avoid deadlocks, your handler must either be multi-
  246.     threaded, or it must attempt to lock the list before calling this
  247.     function.  The code would look something like this:
  248.  
  249.     if (AttemptLockDosList(LDF_xxx|LDF_WRITE))
  250.     {
  251.         rc = AddDosEntry(...);
  252.         UnLockDosList(LDF_xxx|LDF_WRITE);
  253.     }
  254.  
  255.     If AttemptLockDosList() fails (i.e. it's locked already), check for
  256.     messages at your filesystem port (don't wait!) and try the
  257.     AttemptLockDosList() again.
  258.  
  259.    INPUTS
  260.     dlist   - Device list entry to be added.
  261.  
  262.    RESULT
  263.     success - Success/Failure indicator
  264.  
  265.    SEE ALSO
  266.     RemDosEntry(), FindDosEntry(), NextDosEntry(), LockDosList(),
  267.     MakeDosEntry(), FreeDosEntry(), AttemptLockDosList()
  268.  
  269. dos.library/AddPart                                       dos.library/AddPart
  270.  
  271.    NAME
  272.     AddPart -- Appends a file/dir to the end of a path (V36)
  273.  
  274.    SYNOPSIS
  275.     success = AddPart( dirname, filename, size )
  276.     D0                   D1        D2      D3
  277.  
  278.     BOOL AddPart( STRPTR, STRPTR, ULONG )
  279.  
  280.    FUNCTION
  281.     This function adds a file, directory, or subpath name to a directory
  282.     path name taking into account any required separator characters.  If
  283.     filename is a fully-qualified path it will totally replace the current
  284.     value of dirname.
  285.  
  286.    INPUTS
  287.     dirname  - the path to add a file/directory name to.
  288.     filename - the filename or directory name to add.  May be a relative
  289.            pathname from the current directory (example: foo/bar).
  290.            Can deal with leading '/'(s), indicating one directory up
  291.            per '/', or with a ':', indicating it's relative to the
  292.            root of the appropriate volume.
  293.     size     - size in bytes of the space allocated for dirname.  Must
  294.            not be 0.
  295.  
  296.    RESULT
  297.     success - non-zero for ok, FALSE if the buffer would have overflowed.
  298.           If an overflow would have occured, dirname will not be
  299.           changed.
  300.  
  301.    BUGS
  302.     Doesn't check if a subpath is legal (i.e. doesn't check for ':'s) and
  303.     doesn't handle leading '/'s in 2.0 through 2.02 (V36).  V37 fixes
  304.     this, allowing filename to be any path, including absolute.
  305.  
  306.    SEE ALSO
  307.     Filepart(), PathPart()
  308.  
  309. dos.library/AddSegment                                 dos.library/AddSegment
  310.  
  311.    NAME
  312.     AddSegment - Adds a resident segment to the resident list (V36)
  313.  
  314.    SYNOPSIS
  315.     success = AddSegment(name, seglist, type)
  316.     D0              D1     D2      D3
  317.  
  318.     BOOL AddSegment(STRPTR, BPTR, LONG)
  319.  
  320.    FUNCTION
  321.     Adds a segment to the Dos resident list, with the specified Seglist
  322.     and type (stored in seg_UC - normally 0).  NOTE: currently unused
  323.     types may cause it to interpret other registers (d4-?) as additional
  324.     parameters in the future.
  325.  
  326.     Do NOT build Segment structures yourself!
  327.  
  328.    INPUTS
  329.     name    - name for the segment
  330.     seglist - Dos seglist of code for segment
  331.     type    - initial usecount, normally 0
  332.  
  333.    RESULT
  334.     success - success or failure
  335.  
  336.    SEE ALSO
  337.     FindSegment(), RemSegment(), LoadSeg()
  338.  
  339. dos.library/AllocDosObject                         dos.library/AllocDosObject
  340.  
  341.    NAME
  342.     AllocDosObject -- Creates a dos object (V36)
  343.  
  344.    SYNOPSIS
  345.     ptr = AllocDosObject(type, tags)
  346.     D0                    D1    D2
  347.  
  348.     void *AllocDosObject(ULONG, struct TagItem *)
  349.  
  350.     ptr = AllocDosObjectTagList(type, tags)
  351.     D0                          D1    D2
  352.  
  353.     void *AllocDosObjectTagList(ULONG, struct TagItem *)
  354.  
  355.     ptr = AllocDosObjectTags(type, Tag1, ...)
  356.  
  357.     void *AllocDosObjectTags(ULONG, ULONG, ...)
  358.  
  359.    FUNCTION
  360.     Create one of several dos objects, initializes it, and returns it
  361.     to you.  Note the DOS_STDPKT returns a pointer to the sp_Pkt of the
  362.     structure.
  363.  
  364.    INPUTS
  365.     type - type of object requested
  366.     tags - pointer to taglist with additional information
  367.  
  368.    RESULT
  369.     packet - pointer to the object or NULL
  370.  
  371.    SEE ALSO
  372.     FreeDosObject(), <dos/dostags.h>, <dos/dos.h>
  373.  
  374. dos.library/AssignAdd                                   dos.library/AssignAdd
  375.  
  376.    NAME
  377.     AssignAdd -- Adds a lock to an assign for multi-directory assigns (V36)
  378.  
  379.    SYNOPSIS
  380.     success = AssignAdd(name,lock)
  381.     D0                   D1   D2
  382.  
  383.     BOOL AssignAdd(STRPTR,BPTR)
  384.  
  385.    FUNCTION
  386.     Adds a lock to an assign, making or adding to a multi-directory
  387.     assign.  Note that this only will succeed on an assign created with
  388.     AssignLock(), or an assign created with AssignLate() which has been
  389.     resolved (converted into a AssignLock()-assign).
  390.  
  391.     NOTE: you should not use the lock in any way after making this call
  392.     successfully.  It becomes the part of the assign, and will be unlocked
  393.     by the system when the assign is removed.  If you need to keep the
  394.     lock, pass a lock from DupLock() to AssignLock().
  395.  
  396.    INPUTS
  397.     name - Name of device to assign lock to (without trailing ':')
  398.     lock - Lock associated with the assigned name
  399.  
  400.    RESULT
  401.     success - Success/failure indicator.  On failure, the lock is not
  402.           unlocked.
  403.  
  404.    SEE ALSO
  405.     Lock(), AssignLock(), AssignPath(), AssignLate(), DupLock(),
  406.     RemAssignList()
  407.  
  408. dos.library/AssignLate                                 dos.library/AssignLate
  409.  
  410.    NAME
  411.     AssignLate -- Creates an assignment to a specified path later (V36)
  412.  
  413.    SYNOPSIS
  414.     success = AssignLate(name,path)
  415.     D0                    D1   D2
  416.  
  417.     BOOL AssignLate(STRPTR,STRPTR)
  418.  
  419.    FUNCTION
  420.     Sets up a assignment that is expanded upon the FIRST reference to the
  421.     name.  The path (a string) would be attached to the node.  When
  422.     the name is referenced (Open("FOO:xyzzy"...), the string will be used
  423.     to determine where to set the assign to, and if the directory can be
  424.     locked, the assign will act from that point on as if it had been
  425.     created by AssignLock().
  426.  
  427.     A major advantage is assigning things to unmounted volumes, which
  428.     will be requested upon access (useful in startup sequences).
  429.  
  430.    INPUTS
  431.     name - Name of device to be assigned (without trailing ':')
  432.     path - Name of late assignment to be resolved on the first reference.
  433.  
  434.    RESULT
  435.     success - Success/failure indicator of the operation
  436.  
  437.    SEE ALSO
  438.     Lock(), AssignAdd(), AssignPath(), AssignLock(),
  439.  
  440. dos.library/AssignLock                                 dos.library/AssignLock
  441.  
  442.    NAME
  443.     AssignLock -- Creates an assignment to a locked object (V36)
  444.  
  445.    SYNOPSIS
  446.     success = AssignLock(name,lock)
  447.     D0                    D1   D2
  448.  
  449.     BOOL AssignLock(STRPTR,BPTR)
  450.  
  451.    FUNCTION
  452.     Sets up an assign of a name to a given lock.  Passing NULL for a lock 
  453.     cancels any outstanding assign to that name.  If an assign entry of
  454.     that name is already on the list, this routine replaces that entry.  If
  455.     an entry is on the list that conflicts with the new assign, then a
  456.     failure code is returned.
  457.  
  458.     NOTE: you should not use the lock in any way after making this call
  459.     successfully.  It becomes the assign, and will be unlocked by the
  460.     system when the assign is removed.  If you need to keep the lock,
  461.     pass a lock from DupLock() to AssignLock().
  462.  
  463.    INPUTS
  464.     name - Name of device to assign lock to (without trailing ':')
  465.     lock - Lock associated with the assigned name
  466.  
  467.    RESULT
  468.     success - Success/failure indicator.  On failure, the lock is not
  469.           unlocked.
  470.  
  471.    SEE ALSO
  472.     Lock(), AssignAdd(), AssignPath(), AssignLate(), DupLock(),
  473.     RemAssignList()
  474.  
  475. dos.library/AssignPath                                 dos.library/AssignPath
  476.  
  477.    NAME
  478.     AssignPath -- Creates an assignment to a specified path (V36)
  479.  
  480.    SYNOPSIS
  481.     success = AssignPath(name,path)
  482.     D0                    D1   D2
  483.  
  484.     BOOL AssignPath(STRPTR,STRPTR)
  485.  
  486.    FUNCTION
  487.     Sets up a assignment that is expanded upon EACH reference to the name.
  488.     This is implemented through a new device list type (DLT_ASSIGNPATH, or
  489.     some such).  The path (a string) would be attached to the node.  When
  490.     the name is referenced (Open("FOO:xyzzy"...), the string will be used
  491.     to determine where to do the open.  No permanent lock will be part of
  492.     it.  For example, you could AssignPath() c2: to df2:c, and references
  493.     to c2: would go to df2:c, even if you change disks.
  494.  
  495.     The other major advantage is assigning things to unmounted volumes,
  496.     which will be requested upon access (useful in startup sequences).
  497.  
  498.    INPUTS
  499.     name - Name of device to be assigned (without trailing ':')
  500.     path - Name of late assignment to be resolved at each reference
  501.  
  502.    RESULT
  503.     success - Success/failure indicator of the operation
  504.  
  505.    SEE ALSO
  506.     AssignAdd(), AssignLock(), AssignLate(), Open()
  507.  
  508. dos.library/AttemptLockDosList                 dos.library/AttemptLockDosList
  509.  
  510.    NAME
  511.     AttemptLockDosList -- Attempt to lock the Dos Lists for use (V36)
  512.  
  513.    SYNOPSIS
  514.     dlist = AttemptLockDosList(flags)
  515.     D0                D1
  516.  
  517.     struct DosList *AttemptLockDosList(ULONG)
  518.  
  519.    FUNCTION
  520.     Locks the dos device list in preparation to walk the list.  If the
  521.     list is 'busy' then this routine will return NULL.  See LockDosList()
  522.     for more information.
  523.  
  524.    INPUTS
  525.     flags - Flags stating which types of nodes you want to lock.
  526.  
  527.    RESULT
  528.     dlist - Pointer to the beginning of the list or NULL.  Not a valid
  529.         node!
  530.  
  531.    SEE ALSO
  532.     LockDosList(), UnLockDosList(), Forbid(), NextDosEntry()
  533.  
  534. dos.library/ChangeMode                                 dos.library/ChangeMode
  535.  
  536.    NAME
  537.     ChangeMode - Change the current mode of a lock or filehandle (V36)
  538.  
  539.    SYNOPSIS
  540.     success = ChangeMode(type, object, newmode)
  541.     D0                    D1     D2      D3
  542.  
  543.     BOOL ChangeMode(ULONG, BPTR, ULONG)
  544.  
  545.    FUNCTION
  546.     This allows you to attempt to change the mode in use by a lock or
  547.     filehandle.  For example, you could attempt to turn a shared lock
  548.     into an exclusive lock.  The handler may well reject this request.
  549.     Warning: if you use the wrong type for the object, the system may
  550.     crash.
  551.  
  552.    INPUTS
  553.     type    - Either CHANGE_FH or CHANGE_LOCK
  554.     object  - A lock or filehandle
  555.     newmode - The new mode you want
  556.  
  557.    RESULT
  558.     success - Boolean
  559.  
  560.    BUGS
  561.     Did not work in 2.02 or before (V36).  Works in V37.  In the
  562.     earlier versions, it can crash the machine.
  563.  
  564.    SEE ALSO
  565.     Lock(), Open()
  566.  
  567. dos.library/CheckSignal                               dos.library/CheckSignal
  568.  
  569.    NAME
  570.     CheckSignal -- Checks for break signals (V36)
  571.  
  572.    SYNOPSIS
  573.     signals = CheckSignal(mask)
  574.     D0              D1
  575.  
  576.     ULONG CheckSignals(ULONG)
  577.  
  578.    FUNCTION
  579.     This function checks to see if any signals specified in the mask have
  580.     been set and if so, returns them.  Otherwise it returns FALSE.
  581.     All signals specified in mask will be cleared.
  582.  
  583.    INPUTS
  584.     mask    - Signals to check for.
  585.  
  586.    RESULT
  587.     signals - Signals specified in mask that were set.
  588.  
  589.    SEE ALSO
  590.  
  591. dos.library/Cli                                               dos.library/Cli
  592.  
  593.    NAME
  594.     Cli -- Returns a pointer to the CLI structure of the process (V36)
  595.  
  596.    SYNOPSIS
  597.     cli_ptr = Cli()
  598.     D0
  599.  
  600.     struct CommandLineInterface *Cli(void)
  601.  
  602.    FUNCTION
  603.     Returns a pointer to the CLI structure of the current process, or NULL
  604.     if the process has no CLI structure.
  605.  
  606.    RESULT
  607.     cli_ptr - pointer to the CLI structure, or NULL.
  608.  
  609.    SEE ALSO
  610.  
  611. dos.library/CliInitNewcli                           dos.library/CliInitNewcli
  612.  
  613.    NAME
  614.     CliInitNewcli -- Set up a process to be a shell from initial packet
  615.  
  616.    SYNOPSIS
  617.     flags = CliInitNewcli( packet )
  618.     D0                 A0
  619.  
  620.     LONG CliInitNewcli( struct DosPacket * )
  621.  
  622.    FUNCTION
  623.     This function initializes a process and CLI structure for a new
  624.     shell, from parameters in an initial packet passed by the system
  625.     (NewShell or NewCLI, etc).  The format of the data in the packet
  626.     is purposely not defined.  The setup includes all the normal fields
  627.     in the structures that are required for proper operation (current
  628.     directory, paths, input streams, etc).
  629.  
  630.     It returns a set of flags containing information about what type
  631.     of shell invocation this is.
  632.  
  633.     Definitions for the values of fn:
  634.         Bit 31     Set to indicate flags are valid
  635.         Bit  3     Set to indicate asynch system call
  636.         Bit  2     Set if this is a System() call
  637.         Bit  1     Set if user provided input stream
  638.         Bit  0     Set if RUN provided output stream
  639.  
  640.     If Bit 31 is 0, then you must check IoErr() to determine if an error
  641.     occurred.  If IoErr() returns a pointer to your process, there has
  642.     been an error, and you should clean up and exit.  The packet will
  643.     have already been returned by CliInitNewcli().  If it isn't a pointer
  644.     to your process and Bit 31 is 0, reply the packet immediately.
  645.     (Note: this is different from what you do for CliInitRun().)
  646.  
  647.     This function is very similar to CliInitRun().
  648.  
  649.    INPUTS
  650.     packet - the initial packet sent to your process MsgPort
  651.  
  652.    RESULT
  653.     fn - flags or a pointer
  654.  
  655.    SEE ALSO
  656.     CliInitRun(), ReplyPkt(), WaitPkt(), IoErr()
  657.  
  658. dos.library/CliInitRun                                 dos.library/CliInitRun
  659.  
  660.    NAME
  661.     CliInitRun -- Set up a process to be a shell from initial packet
  662.  
  663.    SYNOPSIS
  664.     flags = CliInitRun( packet )
  665.     D0              A0
  666.  
  667.     LONG CliInitRun( struct DosPacket * )
  668.  
  669.    FUNCTION
  670.     This function initializes a process and CLI structure for a new
  671.     shell, from parameters in an initial packet passed by the system
  672.     (Run, System(), Execute()).  The format of the data in the packet
  673.     is purposely not defined.  The setup includes all the normal fields
  674.     in the structures that are required for proper operation (current
  675.     directory, paths, input streams, etc).
  676.  
  677.     It returns a set of flags containing information about what type
  678.     of shell invocation this is.
  679.  
  680.     Definitions for the values of fn:
  681.         Bit 31     Set to indicate flags are valid
  682.         Bit  3     Set to indicate asynch system call
  683.         Bit  2     Set if this is a System() call
  684.         Bit  1     Set if user provided input stream
  685.         Bit  0     Set if RUN provided output stream
  686.  
  687.     If Bit 31 is 0, then you must check IoErr() to determine if an error
  688.     occurred.  If IoErr() returns a pointer to your process, there has
  689.     been an error, and you should clean up and exit.  The packet will
  690.     have already been returned by CliInitNewcli().  If it isn't a pointer
  691.     to your process and Bit 31 is 0, you should wait before replying
  692.     the packet until after you've loaded the first command (or when you
  693.     exit).  This helps avoid disk "gronking" with the Run command.
  694.     (Note: this is different from what you do for CliInitNewcli().)
  695.  
  696.     If Bit 31 is 1, then if Bit 3 is one, ReplyPkt() the packet
  697.     immediately (Asynch System()), otherwise wait until your shell exits
  698.     (Sync System(), Execute()).
  699.     (Note: this is different from what you do for CliInitNewcli().)
  700.     
  701.     This function is very similar to CliInitNewcli().
  702.  
  703.    INPUTS
  704.     packet - the initial packet sent to your process MsgPort
  705.  
  706.    RESULT
  707.     fn - flags or a pointer
  708.  
  709.    SEE ALSO
  710.     CliInitNewcli(), ReplyPkt(), WaitPkt(), System(), Execute(), IoErr()
  711.  
  712. dos.library/Close                                           dos.library/Close
  713.  
  714.     NAME
  715.     Close -- Close an open file
  716.  
  717.     SYNOPSIS
  718.     success = Close( file )
  719.        D0             D1
  720.  
  721.     BOOL Close(BPTR)
  722.  
  723.     FUNCTION
  724.     The file specified by the file handle is closed. You must close all
  725.     files you explicitly opened, but you must not close inherited file
  726.     handles that are passed to you (each filehandle must be closed once
  727.     and ONLY once).  If Close() fails, the file handle is still
  728.     deallocated and should not be used.
  729.  
  730.     INPUTS
  731.     file - BCPL pointer to a file handle
  732.  
  733.     RESULTS
  734.     success - returns if Close() succeeded.  Note that it might fail
  735.           depending on buffering and whatever IO must be done to
  736.           close a file being written to.  NOTE: this return value
  737.           did not exist before V36! 
  738.  
  739.     SEE ALSO
  740.     Open(), OpenFromLock()
  741.  
  742. dos.library/CompareDates                             dos.library/CompareDates
  743.  
  744.    NAME
  745.     CompareDates -- Compares two datestamps (V36)
  746.  
  747.    SYNOPSIS
  748.     result = CompareDates(date1,date2)
  749.     D0                     D1     D2
  750.  
  751.     LONG CompareDates(struct DateStamp *,struct DateStamp *)
  752.  
  753.    FUNCTION
  754.     Compares two times for relative magnitide.  <0 is returned if date1 is
  755.     later than date2, 0 if they are equal, or >0 if date2 is later than
  756.     date1.  NOTE: this is NOT the same ordering as strcmp!
  757.  
  758.    INPUTS
  759.     date1, date2 - DateStamps to compare
  760.  
  761.    RESULT
  762.     result -  <0, 0, or >0 based on comparison of two date stamps
  763.  
  764.    SEE ALSO
  765.     DateStamp(), DateToStr(), StrToDate()
  766.  
  767. dos.library/CreateDir                                   dos.library/CreateDir
  768.  
  769.     NAME
  770.     CreateDir -- Create a new directory
  771.  
  772.     SYNOPSIS
  773.     lock = CreateDir( name )
  774.     D0          D1
  775.  
  776.     BPTR CreateDir(STRPTR)
  777.  
  778.     FUNCTION
  779.     CreateDir creates a new directory with the specified name. An error
  780.     is returned if it fails.  Directories can only be created on
  781.     devices which support them, e.g. disks.  CreateDir returns an
  782.     exclusive lock on the new directory if it succeeds.
  783.  
  784.     INPUTS
  785.     name - pointer to a null-terminated string
  786.  
  787.     RESULTS
  788.     lock - BCPL pointer to a lock or NULL for failure.
  789.  
  790.     SEE ALSO
  791.     Lock(), UnLock()
  792.  
  793. dos.library/CreateNewProc                           dos.library/CreateNewProc
  794.  
  795.    NAME
  796.     CreateNewProc -- Create a new process (V36)
  797.  
  798.    SYNOPSIS
  799.     process = CreateNewProc(tags)
  800.     D0                       D1
  801.  
  802.     struct Process *CreateNewProc(struct TagItem *)
  803.  
  804.     process = CreateNewProcTagList(tags)
  805.     D0                           D1
  806.  
  807.     struct Process *CreateNewProcTagList(struct TagItem *)
  808.  
  809.     process = CreateNewProcTags(Tag1, ...)
  810.  
  811.     struct Process *CreateNewProcTags(ULONG, ...)
  812.  
  813.    FUNCTION
  814.     This creates a new process according to the tags passed in.  See
  815.     dos/dostags.h for the tags.
  816.  
  817.     You must specify one of NP_Seglist or NP_Entry.  NP_Seglist takes a
  818.     seglist (as returned by LoadSeg()).  NP_Entry takes a function
  819.     pointer for the routine to call.
  820.  
  821.     There are many options, as you can see by examining dos/dostags.h.
  822.     The defaults are for a non-CLI process, with copies of your
  823.     CurrentDir, HomeDir (used for PROGDIR:), priority, consoletask,
  824.     windowptr, and variables.  The input and output filehandles default
  825.     to opens of NIL:, stack to 4000, and others as shown in dostags.h.
  826.     This is a fairly reasonable default setting for creating threads,
  827.     though you may wish to modify it (for example, to give a descriptive
  828.     name to the process.)
  829.  
  830.     CreateNewProc() is callable from a task, though any actions that
  831.     require doing Dos I/O (DupLock() of currentdir, for example) will not
  832.     occur.
  833.  
  834.     NOTE: if you call CreateNewProc() with both NP_Arguments, you must
  835.     not specify an NP_Input of NULL.  When NP_Arguments is specified, it
  836.     needs to modify the input filehandle to make ReadArgs() work properly.
  837.  
  838.    INPUTS
  839.     tags - a pointer to a TagItem array.
  840.  
  841.    RESULT
  842.     process - The created process, or NULL.  Note that if it returns
  843.           NULL, you must free any items that were passed in via
  844.           tags, such as if you passed in a new current directory
  845.           with NP_CurrentDir.
  846.  
  847.    BUGS
  848.     In V36, NP_Arguments was broken in a number of ways, and probably
  849.     should be avoided (instead you should start a small piece of your
  850.     own code, which calls RunCommand() to run the actual code you wish
  851.     to run).  In V37, NP_Arguments works, though see the note above.
  852.  
  853.    SEE ALSO
  854.     LoadSeg(), CreateProc(), ReadArgs(), RunCommand(), <dos/dostags.h>
  855.  
  856. dos.library/CreateProc                                 dos.library/CreateProc
  857.  
  858.     NAME
  859.  
  860.     CreateProc -- Create a new process
  861.  
  862.     SYNOPSIS
  863.     process = CreateProc( name, pri, seglist, stackSize )
  864.     D0              D1    D2     D3      D4
  865.  
  866.     struct MsgPort *CreateProc(STRPTR, LONG, BPTR, LONG)
  867.  
  868.     FUNCTION
  869.     CreateProc() creates a new AmigaDOS process of name 'name'.  AmigaDOS
  870.     processes are a superset of exec tasks.
  871.  
  872.     A seglist, as returned by LoadSeg(), is passed as 'seglist'.
  873.     This represents a section of code which is to be run as a new
  874.     process. The code is entered at the first hunk in the segment list,
  875.     which should contain suitable initialization code or a jump to
  876.     such.  A process control structure is allocated from memory and
  877.     initialized.  If you wish to fake a seglist (that will never
  878.     have DOS UnLoadSeg() called on it), use this code:
  879.  
  880.             DS.L    0    ;Align to longword
  881.             DC.L    16    ;Segment "length" (faked)
  882.             DC.L    0    ;Pointer to next segment
  883.             ...start of code...
  884.  
  885.     The size of the root stack upon activation is passed as
  886.     'stackSize'.  'pri' specifies the required priority of the new
  887.     process.  The result will be the process msgport address of the new
  888.     process, or zero if the routine failed.  The argument 'name'
  889.     specifies the new process name.  A zero return code indicates
  890.     error.
  891.  
  892.     The seglist passed to CreateProc() is not freed when it exits; it
  893.     is up to the parent process to free it, or for the code to unload
  894.     itself.
  895.  
  896.     Under V36 and later, you probably should use CreateNewProc() instead.
  897.  
  898.     INPUTS
  899.     name      - pointer to a null-terminated string
  900.     pri       - signed long (range -128 to +127)
  901.     seglist   - BCPL pointer to a seglist
  902.     stackSize - integer (must be a multiple of 4 bytes)
  903.  
  904.     RESULTS
  905.     process   - pointer to new process msgport
  906.  
  907.     SEE ALSO
  908.     CreateNewProc(), LoadSeg(), UnLoadSeg()
  909.  
  910. dos.library/CurrentDir                                 dos.library/CurrentDir
  911.  
  912.     NAME
  913.     CurrentDir -- Make a directory lock the current directory
  914.  
  915.     SYNOPSIS
  916.     oldLock = CurrentDir( lock )
  917.     D0              D1
  918.  
  919.     BPTR CurrentDir(BPTR)
  920.  
  921.     FUNCTION
  922.     CurrentDir() causes a directory associated with a lock to be made
  923.     the current directory.    The old current directory lock is returned.
  924.  
  925.     A value of zero is a valid result here, this 0 lock represents the
  926.     root of file system that you booted from.
  927.  
  928.     Any call that has to Open() or Lock() files (etc) requires that
  929.     the current directory be a valid lock or 0.
  930.  
  931.     INPUTS
  932.     lock - BCPL pointer to a lock
  933.  
  934.     RESULTS
  935.     oldLock - BCPL pointer to a lock
  936.  
  937.     SEE ALSO
  938.     Lock(), UnLock(), Open(), DupLock()
  939.  
  940. dos.library/DateStamp                                   dos.library/DateStamp
  941.  
  942.     NAME
  943.     DateStamp -- Obtain the date and time in internal format
  944.  
  945.     SYNOPSIS
  946.     ds = DateStamp( ds );
  947.     D0        D1
  948.  
  949.     struct DateStamp *DateStamp(struct DateStamp *)
  950.  
  951.     FUNCTION
  952.     DateStamp() takes a structure of three longwords that is set to the
  953.     current time.  The first element in the vector is a count of the
  954.     number of days.  The second element is the number of minutes elapsed
  955.     in the day.  The third is the number of ticks elapsed in the current
  956.     minute.  A tick happens 50 times a second.  DateStamp() ensures that
  957.     the day and minute are consistent.  All three elements are zero if
  958.     the date is unset. DateStamp() currently only returns even
  959.     multiples of 50 ticks.  Therefore the time you get is always an even
  960.     number of ticks.
  961.  
  962.     Time is measured from Jan 1, 1978.
  963.  
  964.     INPUTS
  965.     ds - pointer a struct DateStamp
  966.  
  967.     RESULTS
  968.     The array is filled as described and returned (for pre-V36 
  969.     compabability).
  970.  
  971.     SEE ALSO
  972.     DateToStr(), StrToDate(), SetFileDate(), CompareDates()
  973.  
  974. dos.library/DateToStr                                   dos.library/DateToStr
  975.  
  976.    NAME
  977.     DateToStr -- Converts a DateStamp to a string (V36)
  978.  
  979.    SYNOPSIS
  980.     success = DateToStr( datetime )
  981.     D0                      D1
  982.  
  983.     BOOL DateToStr(struct DateTime *)
  984.  
  985.    FUNCTION
  986.     StamptoStr converts an AmigaDOS DateStamp to a human
  987.     readable ASCII string as requested by your settings in the
  988.     DateTime structure.
  989.  
  990.    INPUTS
  991.     DateTime - a pointer to an initialized DateTime structure.
  992.  
  993.     The DateTime structure should be initialized as follows:
  994.  
  995.     dat_Stamp - a copy of the datestamp you wish to convert to
  996.           ascii.
  997.  
  998.     dat_Format - a format    byte which specifies the format    of the
  999.           dat_StrDate.    This can be any    of the following
  1000.           (note: If value used is something other than those
  1001.           below, the default of    FORMAT_DOS is used):
  1002.  
  1003.           FORMAT_DOS:      AmigaDOS format (dd-mmm-yy).
  1004.  
  1005.           FORMAT_INT:      International    format (yy-mmm-dd).
  1006.  
  1007.           FORMAT_USA:      American format (mm-dd-yy).
  1008.  
  1009.           FORMAT_CDN:      Canadian format (dd-mm-yy).
  1010.  
  1011.           FORMAT_DEF:      default format for locale.
  1012.  
  1013.     dat_Flags - a    flags byte.  The only flag which affects this
  1014.           function is:
  1015.  
  1016.           DTF_SUBST:      If set, a string such    as Today,
  1017.                   Monday, etc.,    will be    used instead
  1018.                   of the dat_Format specification if
  1019.                   possible.
  1020.           DTF_FUTURE:      Ignored by this function.
  1021.  
  1022.     dat_StrDay - pointer to a buffer to receive the day of the
  1023.           week string.    (Monday, Tuesday, etc.). If null, this
  1024.           string will not be generated.
  1025.  
  1026.     dat_StrDate -    pointer    to a buffer to receive the date
  1027.           string, in the format    requested by dat_Format,
  1028.           subject to possible modifications by DTF_SUBST.  If
  1029.           null,    this string will not be    generated.
  1030.  
  1031.     dat_StrTime -    pointer    to a buffer to receive the time    of day
  1032.           string. If NULL, this    will not be generated.
  1033.  
  1034.    RESULT
  1035.     success    - a zero return indicates that the DateStamp was
  1036.           invalid, and could not be converted.    Non-zero
  1037.           indicates that the call succeeded.
  1038.  
  1039.    SEE ALSO
  1040.     DateStamp(), StrtoDate(), <dos/datetime.h>
  1041.  
  1042. dos.library/Delay                                           dos.library/Delay
  1043.  
  1044.     NAME
  1045.     Delay -- Delay a process for a specified time
  1046.  
  1047.     SYNOPSIS
  1048.     Delay( ticks )
  1049.            D1
  1050.  
  1051.     void Delay(ULONG)
  1052.  
  1053.     FUNCTION
  1054.     The argument 'ticks' specifies how many ticks (50 per second) to
  1055.     wait before returning control.
  1056.  
  1057.     INPUTS
  1058.     ticks - integer
  1059.  
  1060.     BUGS
  1061.     Due to a bug in the timer.device in V1.2/V1.3, specifying a timeout
  1062.     of zero for Delay() can cause the unreliable timer & floppy disk
  1063.     operation.  This is fixed in V36 and later.
  1064.  
  1065.     SEE ALSO
  1066.  
  1067. dos.library/DeleteFile                                 dos.library/DeleteFile
  1068.  
  1069.     NAME
  1070.     DeleteFile -- Delete a file or directory
  1071.  
  1072.     SYNOPSIS
  1073.     success = DeleteFile( name )
  1074.     D0              D1
  1075.  
  1076.     BOOL DeleteFile(STRPTR)
  1077.  
  1078.     FUNCTION
  1079.     This attempts to delete the file or directory specified by 'name'.
  1080.     An error is returned if the deletion fails. Note that all the files
  1081.     within a directory must be deleted before the directory itself can
  1082.     be deleted.
  1083.  
  1084.     INPUTS
  1085.     name - pointer to a null-terminated string
  1086.  
  1087.     RESULTS
  1088.     success - boolean
  1089.  
  1090.     SEE ALSO
  1091.  
  1092. dos.library/DeleteVar                                   dos.library/DeleteVar
  1093.  
  1094.    NAME
  1095.     DeleteVar -- Deletes a local or environment variable (V36)
  1096.  
  1097.    SYNOPSIS
  1098.     success = DeleteVar( name, flags ) 
  1099.     D0              D1    D2
  1100.  
  1101.     BOOL DeleteVar(STRPTR, ULONG ) 
  1102.  
  1103.    FUNCTION
  1104.     Deletes a local or environment variable.
  1105.  
  1106.    INPUTS
  1107.     name   - pointer to an variable name.  Note variable names follow
  1108.          filesystem syntax and semantics.
  1109.     flags  - combination of type of var to delete (low 8 bits), and
  1110.          flags to control the behavior of this routine.  Currently
  1111.          defined flags include:
  1112.  
  1113.          GVF_LOCAL_ONLY  - delete a local (to your process) variable.
  1114.          GVF_GLOBAL_ONLY - delete a global environment variable.
  1115.  
  1116.          The default is to delete a local variable if found, otherwise
  1117.          a global environment variable if found (only for LV_VAR).
  1118.  
  1119.    RESULT
  1120.     success - If non-zero, the variable was sucessfully deleted, FALSE
  1121.           indicates failure.
  1122.  
  1123.    BUGS
  1124.     LV_VAR is the only type that can be global
  1125.  
  1126.    SEE ALSO
  1127.     GetVar(), SetVar(), FindVar(), DeleteFile(), <dos/var.h>
  1128.  
  1129. dos.library/DeviceProc                                 dos.library/DeviceProc
  1130.  
  1131.     NAME
  1132.     DeviceProc -- Return the process MsgPort of specific I/O handler
  1133.  
  1134.     SYNOPSIS
  1135.     process = DeviceProc( name )
  1136.     D0              D1
  1137.  
  1138.     struct MsgPort *DeviceProc (STRPTR)
  1139.  
  1140.     FUNCTION
  1141.     DeviceProc() returns the process identifier of the process which
  1142.     handles the device associated with the specified name. If no
  1143.     process handler can be found then the result is zero. If the name
  1144.     refers to an assign then a directory lock is returned in IoErr().
  1145.     This lock should not be UnLock()ed or Examine()ed (if you wish to do
  1146.     so, DupLock() it first).
  1147.  
  1148.     BUGS
  1149.     In V36, if you try to DeviceProc() something relative to an assign
  1150.     made with AssignPath(), it will fail.  This is because there's no
  1151.     way to know when to unlock the lock.  If you're writing code for
  1152.     V36 or later, it is highly advised you use GetDeviceProc() instead,
  1153.     or make your code conditional on V36 to use GetDeviceProc()/
  1154.     FreeDeviceProc().
  1155.  
  1156.     SEE ALSO
  1157.     GetDeviceProc(), FreeDeviceProc(), DupLock(), UnLock(), Examine()
  1158.  
  1159. dos.library/DoPkt                                           dos.library/DoPkt
  1160.  
  1161.    NAME
  1162.     DoPkt -- Send a dos packet and wait for reply (V36)
  1163.  
  1164.    SYNOPSIS
  1165.     result1 = DoPkt(port,action,arg1,arg2,arg3,arg4,arg5)
  1166.     D0               D1    D2    D3   D4   D5   D6   D7
  1167.  
  1168.     LONG DoPkt(struct MsgPort *,LONG,LONG,LONG,LONG,LONG,LONG)
  1169.  
  1170.    FUNCTION
  1171.     Sends a packet to a handler and waits for it to return.  Any secondary
  1172.     return will be available in D1 AND from IoErr().  DoPkt() will work
  1173.     even if the caller is an exec task and not a process; however it will
  1174.     be slower, and may fail for some additional reasons, such as being
  1175.     unable to allocate a signal.  DoPkt() uses your pr_MsgPort for the
  1176.     reply, and will call pr_PktWait.  (See BUGS regarding tasks, though).
  1177.  
  1178.     Only allows 5 arguments to be specified.  For more arguments (packets
  1179.     support a maximum of 7) create a packet and use SendPkt()/WaitPkt().
  1180.  
  1181.    INPUTS
  1182.     port    - pr_MsgPort of the handler process to send to.
  1183.     action  - the action requested of the filesystem/handler
  1184.     arg1, arg2, arg3, arg4,arg5 - arguments, depend on the action, may not
  1185.            be required.
  1186.  
  1187.    RESULT
  1188.     result1 - the value returned in dp_Res1, or FALSE if there was some
  1189.           problem in sending the packet or recieving it.
  1190.     result2 - Available from IoErr() AND in register D1.
  1191.  
  1192.    BUGS
  1193.     Using DoPkt() from tasks doesn't work in V36. Use AllocDosObject(),
  1194.     PutMsg(), and WaitPort()/GetMsg() for a workaround, or you can call
  1195.     CreateNewProc() to start a process to do Dos I/O for you.  In V37,
  1196.     DoPkt() will allocate, use, and free the MsgPort required.
  1197.  
  1198.    NOTES
  1199.     Callable from a task (under V37 and above).
  1200.  
  1201.    SEE ALSO
  1202.     AllocDosObject(), FreeDosObject(), SendPkt(), WaitPkt(),
  1203.     CreateNewProc(), AbortPkt()
  1204.  
  1205. dos.library/DupLock                                       dos.library/DupLock
  1206.  
  1207.     NAME
  1208.     DupLock -- Duplicate a lock
  1209.  
  1210.     SYNOPSIS
  1211.     lock = DupLock( lock )
  1212.     D0        D1
  1213.  
  1214.     BPTR DupLock(BPTR)
  1215.  
  1216.     FUNCTION
  1217.     DupLock() is passed a shared filing system lock.  This is the ONLY
  1218.     way to obtain a duplicate of a lock... simply copying is not
  1219.     allowed.
  1220.  
  1221.     Another lock to the same object is then returned.  It is not
  1222.     possible to create a copy of a exclusive lock.
  1223.  
  1224.     A zero return indicates failure.
  1225.  
  1226.     INPUTS
  1227.     lock - BCPL pointer to a lock
  1228.  
  1229.     RESULTS
  1230.     newLock - BCPL pointer to a lock
  1231.  
  1232.     SEE ALSO
  1233.     Lock(), UnLock(), DupLockFromFH(), ParentOfFH()
  1234.  
  1235. dos.library/DupLockFromFH                           dos.library/DupLockFromFH
  1236.  
  1237.    NAME
  1238.     DupLockFromFH -- Gets a lock on an open file (V36)
  1239.  
  1240.    SYNOPSIS
  1241.     lock = DupLockFromFH(fh)
  1242.     D0                   D1
  1243.  
  1244.     BPTR DupLockFromFH(BPTR)
  1245.  
  1246.    FUNCTION
  1247.     Obtain a lock on the object associated with fh.  Only works if the
  1248.     file was opened using a non-exclusive mode.  Other restrictions may be
  1249.     placed on success by the filesystem.
  1250.  
  1251.    INPUTS
  1252.     fh   - Opened file for which to obtain the lock
  1253.  
  1254.    RESULT
  1255.     lock - Obtained lock or NULL for failure
  1256.  
  1257.    SEE ALSO
  1258.     DupLock(), Lock(), UnLock()
  1259.  
  1260. dos.library/EndNotify                                   dos.library/EndNotify
  1261.  
  1262.    NAME
  1263.     EndNotify -- Ends a notification request (V36)
  1264.  
  1265.    SYNOPSIS
  1266.     EndNotify(notifystructure)
  1267.             D1
  1268.  
  1269.     VOID EndNotify(struct NotifyRequest *)
  1270.  
  1271.    FUNCTION
  1272.     Removes a notification request.  Safe to call even if StartNotify()
  1273.     failed.  For NRF_SEND_MESSAGE, it searches your port for any messages
  1274.     about the object in question and removes and replies them before
  1275.     returning.
  1276.  
  1277.    INPUTS
  1278.     notifystructure - a structure passed to StartNotify()
  1279.  
  1280.    SEE ALSO
  1281.     StartNotify(), <dos/notify.h>
  1282.  
  1283. dos.library/ErrorReport                               dos.library/ErrorReport
  1284.  
  1285.    NAME
  1286.     ErrorReport -- Displays a Retry/Cancel requester for an error (V36)
  1287.  
  1288.    SYNOPSIS
  1289.     status = ErrorReport(code, type, arg1, device)
  1290.     D0                    D1    D2    D3     A0
  1291.  
  1292.     BOOL ErrorReport(LONG, LONG, ULONG, struct MsgPort *)
  1293.  
  1294.    FUNCTION
  1295.     Based on the request type, this routine formats the appropriate
  1296.     requester to be displayed.  If the code is not understood, it returns
  1297.     DOS_TRUE immediately.  Returns DOS_TRUE if the user selects CANCEL or
  1298.     if the attempt to put up the requester fails, or if the process
  1299.     pr_WindowPtr is -1.  Returns FALSE if the user selects Retry.  The
  1300.     routine will retry on DISKINSERTED for appropriate error codes.
  1301.     These return values are the opposite of what AutoRequest returns.
  1302.  
  1303.     Note: this routine sets IoErr() to code before returning.
  1304.  
  1305.    INPUTS
  1306.     code   - Error code to put a requester up for.
  1307.        Current valid error codes are:
  1308.         ERROR_DISK_NOT_VALIDATED
  1309.         ERROR_DISK_WRITE_PROTECTED
  1310.         ERROR_DISK_FULL
  1311.         ERROR_DEVICE_NOT_MOUNTED
  1312.         ERROR_NOT_A_DOS_DISK
  1313.         ERROR_NO_DISK
  1314.         ABORT_DISK_ERROR    /* read/write error */
  1315.         ABORT_BUSY        /* you MUST replace... */
  1316.     type   - Request type:
  1317.                        REPORT_LOCK   - arg1 is a lock (BPTR).
  1318.                        REPORT_FH     - arg1 is a filehandle (BPTR).
  1319.             REPORT_VOLUME - arg1 is a volumenode (C pointer).
  1320.             REPORT_INSERT - arg1 is the string for the volumename
  1321.                     (will be split on a ':').
  1322.                     With ERROR_DEVICE_NOT_MOUNTED puts
  1323.                     up the "Please insert..." requester.
  1324.     arg1   - variable parameter (see type)
  1325.     device - (Optional) Address of handler task for which report is to be 
  1326.                 made.  Only required for REPORT_LOCK, and only if arg1==NULL.
  1327.  
  1328.    RESULT
  1329.     status - Cancel/Retry indicator (0 means Retry)
  1330.  
  1331.    SEE ALSO
  1332.     Fault(), IoErr()
  1333.  
  1334. dos.library/ExAll                                           dos.library/ExAll
  1335.  
  1336.    NAME
  1337.     ExAll -- Examine an entire directory (V36)
  1338.  
  1339.    SYNOPSIS
  1340.     continue = ExAll(lock, buffer, size, type, control)
  1341.     D0               D1     D2     D3    D4     D5
  1342.  
  1343.     BOOL ExAll(BPTR,STRPTR,LONG,LONG,struct ExAllControl *)
  1344.  
  1345.    FUNCTION
  1346.     Examines an entire directory.  
  1347.  
  1348.  Lock must be on a directory.  Size is the size of the buffer supplied.
  1349.  The buffer will be filled with (partial) ExAllData structures, as
  1350.  specified by the type field.
  1351.  
  1352.  Type is a value from those shown below that determines which information is
  1353.  to be stored in the buffer.  Each higher value adds a new thing to the list
  1354.  as described in the table below:-
  1355.  
  1356.     ED_NAME        FileName
  1357.     ED_TYPE        Type
  1358.     ED_SIZE        Size in bytes
  1359.     ED_PROTECTION    Protection bits
  1360.     ED_DATE        3 longwords of date
  1361.     ED_COMMENT    Comment (will be NULL if no comment)
  1362.  
  1363.  Thus, ED_NAME gives only filenames, and ED_COMMENT gives everything.
  1364.  
  1365.  The ead_Next entry gives a pointer to the next entry in the buffer.  The
  1366.  last entry will have NULL in ead_Next.
  1367.  
  1368.  The control structure is required so that FFS can keep track if more than
  1369.  one call to ExAll is required.  This happens when there are more names in
  1370.  a directory than will fit into the buffer.  The format of the control
  1371.  structure is as follows:-
  1372.  
  1373.  NOTE: the control structure MUST be allocated by AllocDosObject!!!
  1374.  
  1375.  Entries:  This field tells the calling application how many entries are
  1376.         in the buffer after calling ExAll.  Note: make sure your code
  1377.         handles the 0 entries case, including 0 entries with continue
  1378.         non-zero.
  1379.  
  1380.  LastKey:  This field ABSOLUTELY MUST be initialised to 0 before calling
  1381.         ExAll for the first time.  Any other value will cause nasty
  1382.         things to happen.  If ExAll returns non-zero, then this field
  1383.         should not be touched before making the second and subsequent
  1384.         calls to ExAll.  Whenever ExAll returns non-zero, there are more
  1385.         calls required before all names have been received.
  1386.  
  1387.         As soon as a FALSE return is received then ExAll has completed
  1388.         (if IoErr() returns ERROR_NO_MORE_ENTRIES - otherwise it returns
  1389.         the error that occured, similar to ExNext.)
  1390.  
  1391.  MatchString
  1392.         If this field is NULL then all filenames will be returned.  If
  1393.         this field is non-null then it is interpreted as a pointer to
  1394.         a string that is used to pattern match all file names before
  1395.         accepting them and putting them into the buffer.  The default
  1396.         AmigaDOS caseless pattern match routine is used.  This string
  1397.         MUST have been parsed by ParsePatternNoCase()!
  1398.  
  1399.  MatchFunc: 
  1400.         Contains a pointer to a hook for a routine to decide if the entry
  1401.         will be included in the returned list of entries.  The entry is
  1402.         filled out first, and then passed to the hook.  If no MatchFunc is
  1403.         to be called then this entry should be NULL.  The hook is
  1404.         called with the following parameters (as is standard for hooks):
  1405.  
  1406.         BOOL = MatchFunc( hookptr, data, typeptr )
  1407.                 a0    a1    a2
  1408.         (a0 = ptr to hook, a1 = ptr to filled in ExAllData, a2 = ptr
  1409.          to longword of type).
  1410.  
  1411.         MatchFunc should return FALSE if the entry is not to be
  1412.         accepted, otherwise return TRUE.
  1413.  
  1414.     Note that Dos will emulate ExAll() using Examine() and ExNext()
  1415.     if the handler in question doesn't support the ExAll() packet.
  1416.  
  1417.    INPUTS
  1418.     lock    - Lock on directory to be examined.
  1419.     buffer  - Buffer for data returned (MUST be at least word-aligned,
  1420.           preferably long-word aligned).
  1421.     size    - Size in bytes of 'buffer'.
  1422.     type    - Type of data to be returned.
  1423.     control - Control data structure (see notes above).  MUST have been
  1424.           allocated by AllocDosObject!
  1425.  
  1426.    RESULT
  1427.     continue - Whether or not ExAll is done.  If FALSE is returned, either
  1428.            ExAll has completed (IoErr() == ERROR_NO_MORE_ENTRIES), or
  1429.            an error occurred (check IoErr()).  If non-zero is returned,
  1430.            you MUST call ExAll again until it returns FALSE.
  1431.  
  1432.    EXAMPLE
  1433.  
  1434.    eac = AllocDosObject(DOS_EXALLCONTROL,NULL);
  1435.    if (!eac) ...
  1436.    ...
  1437.    eac->eac_LastKey = 0;
  1438.    do {
  1439.        more = ExAll(lock, EAData, sizeof(EAData), ED_FOO, eac);
  1440.        if ((!more) && (IoErr() != ERROR_NO_MORE_ENTRIES)) {
  1441.            /* ExAll failed abnormally */
  1442.            break;
  1443.        }
  1444.        if (eac->eac_Entries == 0) {
  1445.            /* ExAll failed normally with no entries */
  1446.            continue;                   /* ("more" is *usually* zero) */
  1447.        }
  1448.        ead = (struct ExAllData *) EAData;
  1449.        do {
  1450.            /* use ead here */
  1451.            ...
  1452.            /* get next ead */
  1453.            ead = ead->ed_Next;
  1454.        } while (ead);
  1455.  
  1456.    } while (more);
  1457.    ...
  1458.    FreeDosObject(DOS_EXALLCONTROL,eac);
  1459.  
  1460.    BUGS
  1461.     In V36, there were problems with ExAll (particularily with
  1462.     eac_MatchString, and ed_Next with the ramdisk and the emulation
  1463.     of it in Dos for handlers that do not support the packet.  It is
  1464.     advised you only use this under V37 and later.
  1465.  
  1466.    SEE ALSO
  1467.     Examine(), ExNext(), ExamineFH(), MatchPatternNoCase(),
  1468.     ParsePatternNoCase(), AllocDosObject()
  1469.  
  1470. dos.library/Examine                                       dos.library/Examine
  1471.  
  1472.     NAME
  1473.     Examine -- Examine a directory or file associated with a lock
  1474.  
  1475.     SYNOPSIS
  1476.     success = Examine( lock, FileInfoBlock )
  1477.     D0            D1          D2
  1478.  
  1479.     BOOL Examine(BPTR,struct FileInfoBlock *)
  1480.  
  1481.     FUNCTION
  1482.     Examine() fills in information in the FileInfoBlock concerning the
  1483.     file or directory associated with the lock. This information
  1484.     includes the name, size, creation date and whether it is a file or
  1485.     directory.  FileInfoBlock must be longword aligned.  Examine() gives
  1486.     a return code of zero if it fails.
  1487.  
  1488.     You may make a local copy of the FileInfoBlock, as long as it is
  1489.     never passed to ExNext().
  1490.  
  1491.     INPUTS
  1492.     lock      - BCPL pointer to a lock
  1493.     infoBlock - pointer to a FileInfoBlock (MUST be longword aligned)
  1494.  
  1495.     RESULTS
  1496.     success - boolean
  1497.  
  1498.     SPECIAL NOTE
  1499.     FileInfoBlock must be longword-aligned.  AllocDosObject() will
  1500.     allocate them correctly for you.
  1501.  
  1502.     SEE ALSO
  1503.     Lock(), UnLock(), ExNext(), ExamineFH(), <dos/dos.h>, AllocDosObject(),
  1504.     ExAll()
  1505.  
  1506. dos.library/ExamineFH                                   dos.library/ExamineFH
  1507.  
  1508.    NAME
  1509.     ExamineFH -- Gets information on an open file (V36)
  1510.  
  1511.    SYNOPSIS
  1512.     success = ExamineFH(fh, fib)
  1513.     D0                  D1  D2
  1514.  
  1515.     BOOL ExamineFH(BPTR, struct FileInfoBlock *)
  1516.  
  1517.    FUNCTION
  1518.     Examines a filehandle and returns information about the file in the
  1519.     FileInfoBlock.  There are no guarantees as to whether the fib_Size
  1520.     field will reflect any changes made to the file size it was opened,
  1521.     though filesystems should attempt to provide up-to-date information
  1522.     for it.
  1523.  
  1524.    INPUTS
  1525.     fh  - Filehandle you wish to examine
  1526.     fib - FileInfoBlock, must be longword aligned.
  1527.  
  1528.    RESULT
  1529.     success - Success/failure indication
  1530.  
  1531.    SEE ALSO
  1532.     Examine(), ExNext(), ExAll(), Open(), AllocDosObject()
  1533.  
  1534. dos.library/Execute                                       dos.library/Execute
  1535.  
  1536.     NAME
  1537.     Execute -- Execute a CLI command
  1538.  
  1539.     SYNOPSIS
  1540.     success = Execute( commandString, input, output )
  1541.     D0           D1          D2     D3
  1542.  
  1543.     BOOL Execute(STRPTR, BPTR, BPTR)
  1544.  
  1545.     FUNCTION
  1546.     This function attempts to execute the string commandString as a
  1547.     Shell command and arguments. The string can contain any valid input
  1548.     that you could type directly in a Shell, including input and output
  1549.     redirection using < and >.  Note that Execute() doesn't return until
  1550.     the command(s) in commandstring have returned.
  1551.  
  1552.     The input file handle will normally be zero, and in this case
  1553.     Execute() will perform whatever was requested in the commandString
  1554.     and then return. If the input file handle is nonzero then after the
  1555.     (possibly empty) commandString is performed subsequent input is read
  1556.     from the specified input file handle until end of that file is
  1557.     reached.
  1558.  
  1559.     In most cases the output file handle must be provided, and is used
  1560.     by the Shell commands as their output stream unless output
  1561.     redirection was specified. If the output file handle is set to zero
  1562.     then the current window, normally specified as *, is used. Note
  1563.     that programs running under the Workbench do not normally have a
  1564.     current window.
  1565.  
  1566.     Execute() may also be used to create a new interactive Shell process
  1567.     just like those created with the NewShell command. In order to do
  1568.     this you would call Execute() with an empty commandString, and pass
  1569.     a file handle relating to a new window as the input file handle.
  1570.     The output file handle would be set to zero. The Shell will read
  1571.     commands from the new window, and will use the same window for
  1572.     output. This new Shell window can only be terminated by using the
  1573.     EndCLI command.
  1574.  
  1575.     Under V37, if an input filehandle is passed, and it's either
  1576.     interactive or a NIL: filehandle, the pr_ConsoleTask of the new
  1577.     process will be set to that filehandle's process (the same applies
  1578.     to SystemTagList()).
  1579.  
  1580.     For this command to work the program Run must be present in C: in
  1581.     versions before V36 (except that in 1.3.2 and any later 1.3 versions,
  1582.     the system first checks the resident list for Run).
  1583.  
  1584.     INPUTS
  1585.     commandString - pointer to a null-terminated string
  1586.     input          - BCPL pointer to a file handle
  1587.     output          - BCPL pointer to a file handle
  1588.  
  1589.     RESULTS
  1590.     success - BOOLEAN indicating whether Execute was successful
  1591.           in finding and starting the specified program.  Note this
  1592.           is NOT the return code of the command(s).
  1593.     SEE ALSO
  1594.     SystemTagList(), NewShell, EndCLI, Run
  1595.  
  1596. dos.library/Exit                                             dos.library/Exit
  1597.  
  1598.     NAME
  1599.     Exit -- Exit from a program
  1600.  
  1601.     SYNOPSIS
  1602.     Exit( returnCode )
  1603.           D1
  1604.  
  1605.     void Exit(LONG)
  1606.  
  1607.     FUNCTION
  1608.     Exit() is currently for use with programs written as if they
  1609.     were BCPL programs.  This function is not normally useful for
  1610.     other purposes.
  1611.  
  1612.     In general, therefore, please DO NOT CALL THIS FUNCTION!
  1613.  
  1614.     In order to exit, C programs should use the C language exit()
  1615.     function (note the lower case letter "e").  Assembly programs should
  1616.     place a return code in D0, and execute an RTS instruction with
  1617.     their original stack ptr.
  1618.  
  1619.     IMPLEMENTATION
  1620.     The action of Exit() depends on whether the program which called it
  1621.     is running as a command under a CLI or not. If the program is
  1622.     running under the CLI the command finishes and control reverts to
  1623.     the CLI. In this case, returnCode is interpreted as the return code
  1624.     from the program.
  1625.  
  1626.     If the program is running as a distinct process, Exit() deletes the
  1627.     process and release the space associated with the stack, segment
  1628.     list and process structure.
  1629.  
  1630.     INPUTS
  1631.     returnCode - integer
  1632.  
  1633.     SEE ALSO
  1634.     CreateProc(), CreateNewProc()
  1635.  
  1636. dos.library/ExNext                                         dos.library/ExNext
  1637.  
  1638.     NAME
  1639.     ExNext -- Examine the next entry in a directory
  1640.  
  1641.     SYNOPSIS
  1642.     success = ExNext( lock, FileInfoBlock )
  1643.     D0           D1         D2
  1644.  
  1645.     BOOL ExNext(BPTR, struct FileInfoBlock *)
  1646.  
  1647.     FUNCTION
  1648.     This routine is passed a directory lock and a FileInfoBlock that
  1649.     have been initialized by a previous call to Examine(), or updated
  1650.     by a previous call to ExNext().  ExNext() gives a return code of zero
  1651.     on failure.  The most common cause of failure is reaching the end
  1652.     of the list of files in the owning directory.  In this case, IoErr
  1653.     will return ERROR_NO_MORE_ENTRIES and a good exit is appropriate.
  1654.  
  1655.     So, follow these steps to examine a directory:
  1656.     1) Pass a Lock and a FileInfoBlock to Examine().  The lock must
  1657.        be on the directory you wish to examine.
  1658.     2) Pass ExNext() the same lock and FileInfoBlock.
  1659.     3) Do something with the information returned in the FileInfoBlock.
  1660.        Note that the fib_DirEntryType field is positive for directories,
  1661.        negative for files.
  1662.     4) Keep calling ExNext() until it returns FALSE.  Check IoErr()
  1663.        to ensure that the reason for failure was ERROR_NO_MORE_ENTRIES.
  1664.  
  1665.     Note: if you wish to recursively scan the file tree and you find
  1666.     another directory while ExNext()ing you must Lock that directory and
  1667.     Examine() it using a new FileInfoBlock.  Use of the same
  1668.     FileInfoBlock to enter a directory would lose important state
  1669.     information such that it will be impossible to continue scanning
  1670.     the parent directory.  While it is permissible to UnLock() and Lock()
  1671.     the parent directory between ExNext() calls, this is NOT recommended.
  1672.     Important state information is associated with the parent lock, so
  1673.     if it is freed between ExNext() calls this information has to be
  1674.     rebuilt on each new ExNext() call, and will significantly slow down
  1675.     directory scanning.
  1676.  
  1677.     It is NOT legal to Examine() a file, and then to ExNext() from that
  1678.     FileInfoBlock.    You may make a local copy of the FileInfoBlock, as
  1679.     long as it is never passed back to the operating system.
  1680.  
  1681.     INPUTS
  1682.     lock - BCPL pointer to a lock originally used for the Examine() call
  1683.     infoBlock - pointer to a FileInfoBlock used on the previous Examine()
  1684.             or ExNext() call.
  1685.  
  1686.     RESULTS
  1687.     success - boolean
  1688.  
  1689.     SPECIAL NOTE
  1690.     FileInfoBlock must be longword-aligned.  AllocDosObject() will
  1691.     allocate them correctly for you.
  1692.  
  1693.     SEE ALSO
  1694.     Examine(), Lock(), UnLock(), IoErr(), ExamineFH(), AllocDosObject(),
  1695.     ExAll()
  1696.  
  1697. dos.library/Fault                                           dos.library/Fault
  1698.  
  1699.    NAME
  1700.     Fault -- Returns the text associated with a DOS error code (V36)
  1701.  
  1702.    SYNOPSIS
  1703.     success = Fault(code, header, buffer, len)
  1704.     D0               D1     D2      D3    D4
  1705.  
  1706.     BOOL Fault(LONG, STRPTR, STRPTR, LONG)
  1707.  
  1708.    FUNCTION
  1709.     This routine obtains the error message text for the given error code.
  1710.     The header is prepended to the text of the error message, followed
  1711.     by a colon.  Puts a null-terminated string for the error message into
  1712.     the buffer.  By convention, error messages should be no longer than 80
  1713.     characters (+1 for termination), and preferably no more than 60.
  1714.     The value returned by IoErr() is set to the code passed in.  If there
  1715.     is no message for the error code, the message will be "Error code
  1716.     <number>\n".
  1717.  
  1718.    INPUTS
  1719.     code   - Error code
  1720.     header - header to output before error text
  1721.     buffer - Buffer to receive error message.
  1722.     len    - Length of the buffer.
  1723.  
  1724.    RESULT
  1725.     success - Success/failure code.
  1726.  
  1727.    SEE ALSO
  1728.     IoErr(), SetIoErr(), PrintFault()
  1729.  
  1730. dos.library/FGetC                                           dos.library/FGetC
  1731.  
  1732.    NAME
  1733.     FGetC -- Read a character from the specified input (buffered) (V36)
  1734.  
  1735.    SYNOPSIS
  1736.     char = FGetC(fh)
  1737.     D0         D1
  1738.  
  1739.     LONG FGetC(BPTR)
  1740.  
  1741.    FUNCTION
  1742.     Reads the next character from the input stream.  A -1 is
  1743.     returned when EOF or an error is encountered.  This call is buffered.
  1744.     Use Flush() between buffered and unbuffered I/O on a filehandle.
  1745.  
  1746.    INPUTS
  1747.     fh - filehandle to use for buffered I/O
  1748.  
  1749.    RESULT
  1750.     char - character read (0-255) or -1
  1751.  
  1752.    BUGS
  1753.     In V36, after an EOF was read, EOF would always be returned from
  1754.     FGetC() from then on.  Starting in V37, it tries to read from the
  1755.     handler again each time (unless UnGetC(fh,-1) was called).
  1756.  
  1757.    SEE ALSO
  1758.     FPutC(), UnGetC(), Flush()
  1759.  
  1760. dos.library/FGets                                           dos.library/FGets
  1761.  
  1762.    NAME
  1763.     FGets -- Reads a line from the specified input (buffered) (V36)
  1764.  
  1765.    SYNOPSIS
  1766.     buffer = FGets(fh, buf, len)
  1767.     D0             D1  D2   D3
  1768.  
  1769.     STRPTR FGets(BPTR, STRPTR, ULONG)
  1770.  
  1771.    FUNCTION
  1772.     This routine reads in a single line from the specified input stopping
  1773.     at a NEWLINE character or EOF.  In either event, UP TO the number of
  1774.     len specified bytes minus 1 will be copied into the buffer.  Hence if
  1775.     a length of 50 is passed and the input line is longer than 49 bytes,
  1776.     it will return 49 characters.  It returns the buffer pointer normally,
  1777.     or NULL if EOF is the first thing read.
  1778.  
  1779.     If terminated by a newline, the newline WILL be the last character in
  1780.     the buffer.  This is a buffered read routine.  The string read in IS
  1781.     null-terminated.
  1782.  
  1783.    INPUTS
  1784.     fh  - filehandle to use for buffered I/O
  1785.     buf - Area to read bytes into.
  1786.     len - Number of bytes to read, must be > 0.
  1787.  
  1788.    RESULT
  1789.     buffer - Pointer to buffer passed in, or NULL for immediate EOF or for
  1790.          an error.  If NULL is returnd for an EOF, IoErr() will return
  1791.          0.
  1792.  
  1793.    SEE ALSO
  1794.     FRead(), FPuts(), FGetC()
  1795.  
  1796. dos.library/FilePart                                     dos.library/FilePart
  1797.  
  1798.    NAME
  1799.     FilePart -- Returns the last component of a path (V36)
  1800.  
  1801.    SYNOPSIS
  1802.     fileptr = FilePart( path )
  1803.     D0             D1
  1804.  
  1805.     STRPTR FilePart( STRPTR )
  1806.  
  1807.    FUNCTION
  1808.     This function returns a pointer to the last component of a string path
  1809.     specification, which will normally be the file name.  If there is only
  1810.     one component, it returns a pointer to the beginning of the string.
  1811.  
  1812.    INPUTS
  1813.     path - pointer to an path string.  May be relative to the current
  1814.            directory or the current disk.
  1815.  
  1816.    RESULT
  1817.     fileptr - pointer to the last component of the path.
  1818.  
  1819.    EXAMPLE
  1820.     FilePart("xxx:yyy/zzz/qqq") would return a pointer to the first 'q'.
  1821.     FilePart("xxx:yyy") would return a pointer to the first 'y').
  1822.  
  1823.    SEE ALSO
  1824.     PathPart(), AddPart()
  1825.  
  1826. dos.library/FindArg                                       dos.library/FindArg
  1827.  
  1828.    NAME
  1829.     FindArg - find a keyword in a template (V36)
  1830.  
  1831.    SYNOPSIS
  1832.     index = FindArg(template, keyword)
  1833.     D0                D1        D2
  1834.  
  1835.     LONG FindArg(STRPTR, STRPTR)
  1836.  
  1837.    FUNCTION
  1838.     Returns the argument number of the keyword, or -1 if it is not a
  1839.     keyword for the template.  Abbreviations are handled.
  1840.  
  1841.    INPUTS
  1842.     keyword  - keyword to search for in template
  1843.     template - template string to search
  1844.  
  1845.    RESULT
  1846.     index - number of entry in template, or -1 if not found
  1847.  
  1848.    BUGS
  1849.     In earlier published versions of the autodoc, keyword and template
  1850.     were backwards.
  1851.  
  1852.    SEE ALSO
  1853.     ReadArgs(), ReadItem(), FreeArgs()
  1854.  
  1855. dos.library/FindCliProc                               dos.library/FindCliProc
  1856.  
  1857.    NAME
  1858.     FindCliProc -- returns a pointer to the requested CLI process (V36)
  1859.  
  1860.    SYNOPSIS
  1861.     proc = FindCliProc(num)
  1862.     D0             D1
  1863.  
  1864.     struct Process *FindCliProc(LONG)
  1865.  
  1866.    FUNCTION
  1867.     This routine returns a pointer to the CLI process associated with the 
  1868.     given CLI number.  If the process isn't an active CLI process, NULL is
  1869.     returned.  NOTE: should normally be called inside a Forbid(), if you
  1870.     must use this function at all.
  1871.  
  1872.    INPUTS
  1873.     num  - Task number of CLI process
  1874.  
  1875.    RESULT
  1876.     proc - Pointer to given CLI process
  1877.  
  1878.    SEE ALSO
  1879.     Cli(), Forbid(), MaxCli()
  1880.  
  1881. dos.library/FindDosEntry                             dos.library/FindDosEntry
  1882.  
  1883.    NAME
  1884.     FindDosEntry -- Finds a specific Dos List entry (V36)
  1885.  
  1886.    SYNOPSIS
  1887.     newdlist = FindDosEntry(dlist,name,flags)
  1888.     D0                       D1    D2   D3
  1889.  
  1890.     struct DosList *FindDosEntry(struct DosList *,STRPTR,ULONG)
  1891.  
  1892.    FUNCTION
  1893.     Locates an entry on the device list.  Starts with the entry dlist.
  1894.     NOTE: must be called with the device list locked, no references may be
  1895.     made to dlist after unlocking.
  1896.  
  1897.    INPUTS
  1898.     dlist    - The device entry to start with.
  1899.     name     - Name of device entry (without ':') to locate.
  1900.     flags    - Search control flags.  Use the flags you passed to
  1901.            LockDosList, or a subset of them.  LDF_READ/LDF_WRITE are
  1902.            not required for this call.
  1903.  
  1904.    RESULT
  1905.     newdlist - The device entry or NULL
  1906.  
  1907.    SEE ALSO
  1908.     AddDosEntry(), RemDosEntry(), NextDosEntry(), LockDosList(),
  1909.     MakeDosEntry(), FreeDosEntry()
  1910.  
  1911. dos.library/FindSegment                               dos.library/FindSegment
  1912.  
  1913.    NAME
  1914.     FindSegment - Finds a segment on the resident list (V36)
  1915.  
  1916.    SYNOPSIS
  1917.     segment = FindSegment(name, start, system)
  1918.     D0               D1     D2     D3
  1919.  
  1920.     struct Segment *FindSegment(STRPTR, struct Segment *, LONG)
  1921.  
  1922.    FUNCTION
  1923.     Finds a segment on the Dos resident list by name and type, starting
  1924.     at the segment AFTER 'start', or at the beginning if start is NULL.
  1925.     If system is zero, it will only return nodes with a seg_UC of 0
  1926.     or more.  It does NOT increment the seg_UC, and it does NOT do any
  1927.     locking of the list.  You must Forbid() lock the list to use this
  1928.     call.
  1929.  
  1930.     To use an entry you have found, you must: if the seg_UC is 0 or more,
  1931.     increment it, and decrement it (under Forbid()!) when you're done
  1932.     the the seglist.
  1933.  
  1934.     The other values for seg_UC are:
  1935.         -1   - system module, such as a filesystem or shell
  1936.         -2   - resident shell command
  1937.         -999 - disabled internal command, ignore
  1938.     Negative values should never be modified.  All other negative
  1939.     values between 0 and -32767 are reserved to AmigaDos and should not
  1940.     be used.
  1941.  
  1942.    INPUTS
  1943.     name   - name of segment to find
  1944.     start  - segment to start the search after
  1945.     system - true for system segment, false for normal segments
  1946.  
  1947.    RESULT
  1948.     segment - the segment found or NULL
  1949.  
  1950.    SEE ALSO
  1951.     AddSegment(), RemSegment(), Forbid()
  1952.  
  1953. dos.library/FindVar                                       dos.library/FindVar
  1954.  
  1955.    NAME
  1956.     FindVar -- Finds a local variable (V36)
  1957.  
  1958.    SYNOPSIS
  1959.     var = FindVar( name, type ) 
  1960.     D0        D1    D2
  1961.  
  1962.     struct LocalVar * FindVar(STRPTR, ULONG ) 
  1963.  
  1964.    FUNCTION
  1965.     Finds a local variable structure.
  1966.  
  1967.    INPUTS
  1968.     name - pointer to an variable name.  Note variable names follow
  1969.            filesystem syntax and semantics.
  1970.  
  1971.     type - type of variable to be found (see <dos/var.h>)
  1972.  
  1973.    RESULT
  1974.  
  1975.     var  - pointer to a LocalVar structure or NULL
  1976.  
  1977.    SEE ALSO
  1978.     GetVar(), SetVar(), DeleteVar(), <dos/var.h>
  1979.  
  1980. dos.library/Flush                                           dos.library/Flush
  1981.  
  1982.    NAME
  1983.     Flush -- Flushes buffers for a buffered filehandle (V36)
  1984.  
  1985.    SYNOPSIS
  1986.     success = Flush(fh)
  1987.     D0        D1
  1988.  
  1989.     LONG Flush(BPTR)
  1990.  
  1991.    FUNCTION
  1992.     Flushes any pending buffered writes to the filehandle.  All buffered
  1993.     writes will also be flushed on Close().  If the filehandle was being
  1994.     used for input, it drops the buffer, and tries to Seek() back to the
  1995.     last read position  (so subsequent reads or writes will occur at the
  1996.     expected position in the file).
  1997.  
  1998.    INPUTS
  1999.     fh    - Filehandle to flush.
  2000.  
  2001.    RESULT
  2002.     success - Success or failure.
  2003.  
  2004.    BUGS
  2005.     Before V37 release, Flush() returned a random value.  As of V37,
  2006.     it always returns success (this will be fixed in some future
  2007.     release).
  2008.  
  2009.    SEE ALSO
  2010.     FputC(), FGetC(), UnGetC(), Seek(), Close()
  2011.  
  2012. dos.library/Format                                         dos.library/Format
  2013.  
  2014.    NAME
  2015.     Format -- Causes a filesystem to initialize itself (V36)
  2016.  
  2017.    SYNOPSIS
  2018.     success = Format(filesystem, volumename, dostype)
  2019.     D0                   D1          D2         D3
  2020.  
  2021.     BOOL Format(STRPTR, STRPTR, ULONG)
  2022.  
  2023.    FUNCTION
  2024.     Interface for initializing new media on a device.  This causes the
  2025.     filesystem to write out an empty disk structure to the media, which
  2026.     should then be ready for use.  This assumes the media has been low-
  2027.     level formatted and verified already.
  2028.  
  2029.     The filesystem should be inhibited before calling Format() to make
  2030.     sure you don't get an ERROR_OBJECT_IN_USE.
  2031.  
  2032.    INPUTS
  2033.     filesystem - Name of device to be formatted.  ':' must be supplied.
  2034.     volumename - Name for volume (if supported).  No ':'.
  2035.     dostype    - Type of format, if filesystem supports multiple types.
  2036.  
  2037.    RESULT
  2038.     success - Success/failure indicator.
  2039.  
  2040.    BUGS
  2041.     Existed, but was non-functional in V36 dos.  (The volumename wasn't
  2042.     converted to a BSTR.)  Workaround: require V37, or under V36
  2043.     convert volumename to a BPTR to a BSTR before calling Format().
  2044.     Note: a number of printed packet docs for ACTION_FORMAT are wrong
  2045.     as to the arguments.
  2046.  
  2047.    SEE ALSO
  2048.  
  2049. dos.library/FPutC                                           dos.library/FPutC
  2050.  
  2051.    NAME
  2052.     FPutC -- Write a character to the specified output (buffered) (V36)
  2053.  
  2054.    SYNOPSIS
  2055.     char = FPutC(fh, char)
  2056.     D0           D1   D2
  2057.  
  2058.     LONG FPutC(BPTR, UBYTE)
  2059.  
  2060.    FUNCTION
  2061.     Writes a single character to the output stream.  This call is
  2062.     buffered.  Use Flush() between buffered and unbuffered I/O on a
  2063.     filehandle.  Interactive filehandles are flushed automatically
  2064.     on a newline, return, '\0', or line feed.
  2065.  
  2066.    INPUTS
  2067.     fh   - filehandle to use for buffered I/O
  2068.     char - character to write
  2069.  
  2070.    RESULT
  2071.     char - either the character written, or EOF for an error.
  2072.  
  2073.    SEE ALSO
  2074.     FGetC(), UnGetC(), Flush()
  2075.  
  2076. dos.library/FPuts                                           dos.library/FPuts
  2077.  
  2078.    NAME
  2079.     FPuts -- Writes a string the the specified output (buffered) (V36)
  2080.  
  2081.    SYNOPSIS
  2082.     error = FPuts(fh, str)
  2083.     D0            D1  D2
  2084.  
  2085.     LONG FPuts(BPTR, STRPTR)
  2086.  
  2087.    FUNCTION
  2088.     This routine writes an unformatted string to the filehandle.  No 
  2089.     newline is appended to the string and the length actually written is
  2090.     returned.  This routine is buffered.
  2091.  
  2092.    INPUTS
  2093.     fh    - filehandle to use for buffered I/O
  2094.     str   - Null-terminated string to be written to default output
  2095.  
  2096.    RESULT
  2097.     error - 0 normally, otherwise -1.  Note that this is opposite of
  2098.         most other Dos functions, which return success.
  2099.  
  2100.    SEE ALSO
  2101.     FGets(), FPutC(), FWrite(), PutStr()
  2102.  
  2103. dos.library/FRead                                           dos.library/FRead
  2104.  
  2105.    NAME
  2106.     FRead -- Reads a number of blocks from an input (buffered) (V36)
  2107.  
  2108.    SYNOPSIS
  2109.     count = FRead(fh, buf, blocklen, blocks)
  2110.     D0          D1  D2     D3        D4
  2111.  
  2112.     LONG FRead(BPTR, STRPTR, ULONG, ULONG)
  2113.  
  2114.    FUNCTION
  2115.     Attempts to read a number of blocks, each blocklen long, into the
  2116.     specified buffer from the input stream.  May return less than
  2117.     the number of blocks requested, either due to EOF or read errors.
  2118.     This call is buffered.
  2119.  
  2120.    INPUTS
  2121.     fh     - filehandle to use for buffered I/O
  2122.     buf      - Area to read bytes into.
  2123.     blocklen - number of bytes per block.  Must be > 0.
  2124.     blocks     - number of blocks to read.  Must be > 0.
  2125.  
  2126.    RESULT
  2127.     count - Number of _blocks_ read, or 0 for EOF.  On an error, the
  2128.         number of blocks actually read is returned.
  2129.  
  2130.    BUGS
  2131.     Doesn't clear IoErr() before starting.  If you want to find out
  2132.     about errors, use SetIoErr(0L) before calling.
  2133.  
  2134.    SEE ALSO
  2135.     FGetC(), FWrite(), FGets()
  2136.  
  2137. dos.library/FreeArgs                                     dos.library/FreeArgs
  2138.  
  2139.    NAME
  2140.     FreeArgs - Free allocated memory after ReadArgs() (V36)
  2141.  
  2142.    SYNOPSIS
  2143.     FreeArgs(rdargs)
  2144.                D1
  2145.  
  2146.     void FreeArgs(struct RDArgs *)
  2147.  
  2148.    FUNCTION
  2149.     Frees memory allocated to return arguments in from ReadArgs().  If
  2150.     ReadArgs allocated the RDArgs structure it will be freed.
  2151.  
  2152.    INPUTS
  2153.     rdargs - structure returned from ReadArgs()
  2154.  
  2155.    SEE ALSO
  2156.     ReadArgs(), ReadItem(), FindArg()
  2157.  
  2158. dos.library/FreeDeviceProc                         dos.library/FreeDeviceProc
  2159.  
  2160.    NAME
  2161.     FreeDeviceProc -- Releases port returned by GetDeviceProc() (V36)
  2162.  
  2163.    SYNOPSIS
  2164.     FreeDeviceProc(devproc)
  2165.              D1
  2166.  
  2167.     void FreeDeviceProc(struct DevProc *)
  2168.  
  2169.    FUNCTION
  2170.     Frees up the structure created by GetDeviceProc(), and any associated
  2171.     temporary locks.
  2172.  
  2173.     Decrements the counter incremented by GetDeviceProc().  The counter
  2174.     is in an extension to the 1.3 process structure.  After calling
  2175.     FreeDeviceProc(), do not use the port or lock again!  It is safe to
  2176.     call FreeDeviceProc(NULL).
  2177.  
  2178.    INPUTS
  2179.     devproc - A value returned by GetDeviceProc()
  2180.  
  2181.    BUGS
  2182.     Counter not currently active in 2.0.
  2183.  
  2184.    SEE ALSO
  2185.     GetDeviceProc(), DeviceProc(), AssignLock(), AssignLate(),
  2186.     AssignPath()
  2187.  
  2188. dos.library/FreeDosEntry                             dos.library/FreeDosEntry
  2189.  
  2190.    NAME
  2191.     FreeDosEntry -- Frees an entry created by MakeDosEntry (V36)
  2192.  
  2193.    SYNOPSIS
  2194.     FreeDosEntry(dlist)
  2195.                    D1
  2196.  
  2197.     void FreeDosEntry(struct DosList *)
  2198.  
  2199.    FUNCTION
  2200.     Frees an entry created by MakeDosEntry().  This routine should be
  2201.     eliminated and replaced by a value passed to FreeDosObject()!
  2202.  
  2203.    INPUTS
  2204.     dlist - DosList to free.
  2205.  
  2206.    SEE ALSO
  2207.     AddDosEntry(), RemDosEntry(), FindDosEntry(), LockDosList(),
  2208.     NextDosEntry(), MakeDosEntry()
  2209.  
  2210. dos.library/FreeDosObject                           dos.library/FreeDosObject
  2211.  
  2212.    NAME
  2213.     FreeDosObject -- Frees an object allocated by AllocDosObject() (V36)
  2214.  
  2215.    SYNOPSIS
  2216.     FreeDosObject(type, ptr)
  2217.                D1   D2
  2218.  
  2219.     void FreeDosObject(ULONG, void *)
  2220.  
  2221.    FUNCTION
  2222.     Frees an object allocated by AllocDosObject().  Do NOT call for
  2223.     objects allocated in any other way.
  2224.  
  2225.    INPUTS
  2226.     type - type passed to AllocDosObject()
  2227.     ptr  - ptr returned by AllocDosObject()
  2228.  
  2229.    SEE ALSO
  2230.     AllocDosObject(), <dos/dos.h>
  2231.  
  2232. dos.library/FWrite                                         dos.library/FWrite
  2233.  
  2234.    NAME
  2235.     FWrite -- Writes a number of blocks to an output (buffered) (V36)
  2236.  
  2237.    SYNOPSIS
  2238.     count = FWrite(fh, buf, blocklen, blocks)
  2239.     D0           D1  D2     D3        D4
  2240.  
  2241.     LONG FWrite(BPTR, STRPTR, ULONG, ULONG)
  2242.  
  2243.    FUNCTION
  2244.     Attempts to write a number of blocks, each blocklen long, from the
  2245.     specified buffer to the output stream.  May return less than the
  2246.     number of blocks requested, if there is some error such as a full
  2247.     disk or r/w error.  This call is buffered.
  2248.  
  2249.    INPUTS
  2250.     fh     - filehandle to use for buffered I/O
  2251.     buf      - Area to write bytes from.
  2252.     blocklen - number of bytes per block.  Must be > 0.
  2253.     blocks     - number of blocks to read.  Must be > 0.
  2254.  
  2255.    RESULT
  2256.     count - Number of _blocks_ written.  On an error, the number of
  2257.         blocks actually written is returned.
  2258.  
  2259.    BUGS
  2260.     Doesn't clear IoErr() before starting.  If you want to find out
  2261.     about errors, use SetIoErr(0L) before calling.
  2262.  
  2263.    SEE ALSO
  2264.     FPutC(), FRead(), FPuts()
  2265.  
  2266. dos.library/GetArgStr                                   dos.library/GetArgStr
  2267.  
  2268.    NAME
  2269.     GetArgStr -- Returns the arguments for the process (V36)
  2270.  
  2271.    SYNOPSIS
  2272.     ptr = GetArgStr()
  2273.     D0
  2274.  
  2275.     STRPTR GetArgStr(void)
  2276.  
  2277.    FUNCTION
  2278.     Returns a pointer to the (null-terminated) arguments for the program
  2279.     (process).  This is the same string passed in a0 on startup from CLI.
  2280.  
  2281.    RESULT
  2282.     ptr - pointer to arguments
  2283.  
  2284.    SEE ALSO
  2285.     SetArgStr(), RunCommand()
  2286.  
  2287. dos.library/GetConsoleTask                         dos.library/GetConsoleTask
  2288.  
  2289.    NAME
  2290.     GetConsoleTask -- Returns the default console for the process (V36)
  2291.  
  2292.    SYNOPSIS
  2293.     port = GetConsoleTask()
  2294.     D0
  2295.  
  2296.     struct MsgPort *GetConsoleTask(void)
  2297.  
  2298.    FUNCTION
  2299.     Returns the default console task's port (pr_ConsoleTask) for the
  2300.     current process.
  2301.  
  2302.    RESULT
  2303.     port - The pr_MsgPort of the console handler, or NULL.
  2304.  
  2305.    SEE ALSO
  2306.     SetConsoleTask(), Open()
  2307.  
  2308. dos.library/GetCurrentDirName                   dos.library/GetCurrentDirName
  2309.  
  2310.    NAME
  2311.     GetCurrentDirName -- returns the current directory name (V36)
  2312.  
  2313.    SYNOPSIS
  2314.     success = GetCurrentDirName(buf, len)
  2315.     D0                          D1   D2
  2316.  
  2317.     BOOL GetCurrentDirName(STRPTR, LONG)
  2318.  
  2319.    FUNCTION
  2320.     Extracts the current directory name from the CLI structure and puts it 
  2321.     into the buffer.  If the buffer is too small, the name is truncated 
  2322.     appropriately and a failure code returned.  If no CLI structure is 
  2323.     present, a null string is returned in the buffer, and failure from
  2324.     the call (with IoErr() == ERROR_OBJECT_WRONG_TYPE);
  2325.  
  2326.    INPUTS
  2327.     buf     - Buffer to hold extracted name
  2328.     len     - Number of bytes of space in buffer
  2329.  
  2330.    RESULT
  2331.     success - Success/failure indicator
  2332.  
  2333.    BUGS
  2334.     In V36, this routine didn't handle 0-length buffers correctly.
  2335.  
  2336.    SEE ALSO
  2337.     SetCurrentDirName()
  2338.  
  2339. dos.library/GetDeviceProc                           dos.library/GetDeviceProc
  2340.  
  2341.    NAME
  2342.     GetDeviceProc -- Finds a handler to send a message to (V36)
  2343.  
  2344.    SYNOPSIS
  2345.     devproc = GetDeviceProc(name, devproc)
  2346.       D0             D1     D2
  2347.  
  2348.     struct DevProc *GetDeviceProc(STRPTR, struct DevProc *)
  2349.  
  2350.    FUNCTION
  2351.     Finds the handler/filesystem to send packets regarding 'name' to.
  2352.     This may involve getting temporary locks.  It returns a structure
  2353.     that includes a lock and msgport to send to to attempt your operation.
  2354.     It also includes information on how to handle multiple-directory
  2355.     assigns (by passing the DevProc back to GetDeviceProc() until it
  2356.     returns NULL).
  2357.  
  2358.     The initial call to GetDeviceProc() should pass NULL for devproc.  If
  2359.     after using the returned DevProc, you get an ERROR_OBJECT_NOT_FOUND,
  2360.     and (devproc->dvp_Flags & DVPF_ASSIGN) is true, you should call
  2361.     GetDeviceProc() again, passing it the devproc structure.  It will
  2362.     either return a modified devproc structure, or NULL (with
  2363.     ERROR_NO_MORE_ENTRIES in IoErr()).  Continue until it returns NULL.
  2364.  
  2365.     This call also increments the counter that locks a handler/fs into
  2366.     memory.  After calling FreeDeviceProc(), do not use the port or lock
  2367.     again!
  2368.  
  2369.    INPUTS
  2370.     name    - name of the object you wish to access.  This can be a
  2371.           relative path ("foo/bar"), relative to the current volume
  2372.           (":foo/bar"), or relative to a device/volume/assign
  2373.           ("foo:bar").
  2374.     devproc - A value returned by GetDeviceProc() before, or NULL
  2375.  
  2376.    RESULT
  2377.     devproc - a pointer to a DevProc structure or NULL
  2378.  
  2379.    BUGS
  2380.     Counter not currently active in 2.0.
  2381.     In 2.0 and 2.01, you HAD to check DVPF_ASSIGN before calling it again.
  2382.     This was fixed for the 2.02 release of V36.
  2383.  
  2384.    SEE ALSO
  2385.     FreeDeviceProc(), DeviceProc(), AssignLock(), AssignLate(),
  2386.     AssignPath()
  2387.  
  2388. dos.library/GetFileSysTask                         dos.library/GetFileSysTask
  2389.  
  2390.    NAME
  2391.     GetFileSysTask -- Returns the default filesystem for the process (V36)
  2392.  
  2393.    SYNOPSIS
  2394.     port = GetFileSysTask()
  2395.     D0
  2396.  
  2397.     struct MsgPort *GetFileSysTask(void)
  2398.  
  2399.    FUNCTION
  2400.     Returns the default filesystem task's port (pr_FileSystemTask) for the
  2401.     current process.
  2402.  
  2403.    RESULT
  2404.     port - The pr_MsgPort of the filesystem, or NULL.
  2405.  
  2406.    SEE ALSO
  2407.     SetFileSysTask(), Open()
  2408.  
  2409. dos.library/GetProgramDir                           dos.library/GetProgramDir
  2410.  
  2411.    NAME
  2412.     GetProgramDir -- Returns a lock on the directory the program was loaded
  2413.              from (V36)
  2414.  
  2415.    SYNOPSIS
  2416.     lock = GetProgramDir()
  2417.     D0
  2418.  
  2419.     BPTR GetProgramDir(void)
  2420.  
  2421.    FUNCTION
  2422.     Returns a shared lock on the directory the program was loaded from.
  2423.     This can be used for a program to find data files, etc, that are stored
  2424.     with the program, or to find the program file itself.  NULL returns are
  2425.     valid, and may occur, for example, when running a program from the
  2426.     resident list.  You should NOT unlock the lock.
  2427.  
  2428.    RESULT
  2429.     lock - A lock on the directory the current program was loaded from,
  2430.            or NULL if loaded from resident list, etc.
  2431.  
  2432.    BUGS
  2433.     Should return a lock for things loaded via resident.  Perhaps should
  2434.     return currentdir if NULL.
  2435.  
  2436.    SEE ALSO
  2437.     SetProgramDir(), Open()
  2438.  
  2439. dos.library/GetProgramName                         dos.library/GetProgramName
  2440.  
  2441.    NAME
  2442.     GetProgramName -- Returns the current program name (V36)
  2443.  
  2444.    SYNOPSIS
  2445.     success = GetProgramName(buf, len)
  2446.     D0                       D1   D2
  2447.  
  2448.     BOOL GetProgramName(STRPTR, LONG)
  2449.  
  2450.    FUNCTION
  2451.     Extracts the program name from the CLI structure and puts it 
  2452.     into the buffer.  If the buffer is too small, the name is truncated 
  2453.     present, a null string is returned in the buffer, and failure from
  2454.     the call (with IoErr() == ERROR_OBJECT_WRONG_TYPE);
  2455.  
  2456.    INPUTS
  2457.     buf     - Buffer to hold extracted name
  2458.     len     - Number of bytes of space in buffer
  2459.  
  2460.    RESULT
  2461.     success - Success/failure indicator
  2462.  
  2463.    SEE ALSO
  2464.     SetProgramName()
  2465.  
  2466. dos.library/GetPrompt                                   dos.library/GetPrompt
  2467.  
  2468.    NAME
  2469.     GetPrompt -- Returns the prompt for the current process (V36)
  2470.  
  2471.    SYNOPSIS
  2472.     success = GetPrompt(buf, len)
  2473.     D0                  D1   D2
  2474.  
  2475.     BOOL GetPrompt(STRPTR, LONG)
  2476.  
  2477.    FUNCTION
  2478.     Extracts the prompt string from the CLI structure and puts it 
  2479.     into the buffer.  If the buffer is too small, the string is truncated 
  2480.     appropriately and a failure code returned.  If no CLI structure is 
  2481.     present, a null string is returned in the buffer, and failure from
  2482.     the call (with IoErr() == ERROR_OBJECT_WRONG_TYPE);
  2483.  
  2484.    INPUTS
  2485.     buf     - Buffer to hold extracted prompt
  2486.     len     - Number of bytes of space in buffer
  2487.  
  2488.    RESULT
  2489.     success - Success/failure indicator
  2490.  
  2491.    SEE ALSO
  2492.     SetPrompt()
  2493.  
  2494. dos.library/GetVar                                         dos.library/GetVar
  2495.  
  2496.    NAME
  2497.     GetVar -- Returns the value of a local or global variable (V36)
  2498.  
  2499.    SYNOPSIS
  2500.     len = GetVar( name, buffer, size, flags ) 
  2501.     D0           D1     D2     D3    D4
  2502.  
  2503.     LONG GetVar( STRPTR, STRPTR, LONG, ULONG ) 
  2504.  
  2505.    FUNCTION
  2506.     Gets the value of a local or environment variable.  It is advised to
  2507.      only use ASCII strings inside variables, but not required.  This stops
  2508.     putting characters into the destination when a \n is hit, unless
  2509.     GVF_BINARY_VAR is specified.  (The \n is not stored in the buffer.)
  2510.  
  2511.    INPUTS
  2512.     name   - pointer to a variable name.
  2513.     buffer - a user allocated area which will be used to store
  2514.          the value associated with the variable.
  2515.     size   - length of the buffer region in bytes.
  2516.     flags  - combination of type of var to get value of (low 8 bits), and
  2517.          flags to control the behavior of this routine.  Currently
  2518.          defined flags include:
  2519.  
  2520.             GVF_GLOBAL_ONLY - tries to get a global env variable.
  2521.             GVF_LOCAL_ONLY  - tries to get a local variable.
  2522.             GVF_BINARY_VAR  - don't stop at \n
  2523.  
  2524.          The default is to try to get a local variable first, then
  2525.          to try to get a global environment variable.
  2526.  
  2527.    RESULT
  2528.     len -   Size of environment variable.  -1 indicates that the
  2529.         variable was not defined (if IoErr() returns
  2530.         ERROR_OBJECT_NOT_FOUND - it returns ERROR_BAD_NUMBER if
  2531.         you specify a size of 0).  If the value would overflow
  2532.         the user buffer, the buffer is truncated.  The buffer
  2533.         returned is null-terminated (even if GVF_BINARY_VAR is
  2534.         used).  The number of characters put in the buffer (not
  2535.         including '\0') is returned, and IoErr() will return the
  2536.         the size of the variable.
  2537.  
  2538.    BUGS
  2539.     LV_VAR is the only type that can be global.
  2540.     Under V36, we documented (and it returned) the size of the variable,
  2541.     not the number of characters transferred.  For V37 this was changed
  2542.     to the number of characters put in the buffer, and the total size
  2543.     of the variable is put in IoErr().
  2544.  
  2545.    SEE ALSO
  2546.     SetVar(), DeleteVar(), FindVar(), <dos/var.h>
  2547.  
  2548. dos.library/Info                                             dos.library/Info
  2549.  
  2550.     NAME
  2551.     Info -- Returns information about the disk
  2552.  
  2553.     SYNOPSIS
  2554.     success = Info( lock, parameterBlock )
  2555.     D0        D1    D2
  2556.  
  2557.     BOOL Info(BPTR, struct InfoData *)
  2558.  
  2559.     FUNCTION
  2560.     Info() can be used to find information about any disk in use.
  2561.     'lock' refers to the disk, or any file on the disk. The parameter
  2562.     block is returned with information about the size of the disk,
  2563.     number of free blocks and any soft errors.
  2564.  
  2565.     INPUTS
  2566.     lock           - BCPL pointer to a lock
  2567.     parameterBlock - pointer to an InfoData structure
  2568.              (longword aligned)
  2569.  
  2570.     RESULTS
  2571.     success - boolean
  2572.  
  2573.     SPECIAL NOTE:
  2574.     Note that InfoData structure must be longword aligned.
  2575.  
  2576. dos.library/Inhibit                                       dos.library/Inhibit
  2577.  
  2578.    NAME
  2579.     Inhibit -- Inhibits access to a filesystem (V36)
  2580.  
  2581.    SYNOPSIS
  2582.     success = Inhibit(filesystem, flag)
  2583.     D0                    D1       D2
  2584.  
  2585.     BOOL Inhibit(STRPTR,LONG)
  2586.  
  2587.    FUNCTION
  2588.     Sends an ACTION_INHIBIT packet to the indicated handler.  This stops
  2589.     all activity by the handler until uninhibited.  When uninhibited,
  2590.     anything may have happened to the disk in the drive, or there may no
  2591.     longer be one.
  2592.  
  2593.    INPUTS
  2594.     filesystem - Name of device to inhibit (with ':')
  2595.     flag       - New status.  DOSTRUE = inhibited, FALSE = uninhibited
  2596.  
  2597.    RESULT
  2598.     success    - Success/failure indicator
  2599.  
  2600.    SEE ALSO
  2601.  
  2602. dos.library/Input                                           dos.library/Input
  2603.  
  2604.     NAME
  2605.     Input -- Identify the program's initial input file handle
  2606.  
  2607.     SYNOPSIS
  2608.     file = Input()
  2609.     D0
  2610.  
  2611.     BPTR Input(void)
  2612.  
  2613.     FUNCTION
  2614.     Input() is used to identify the initial input stream allocated when
  2615.     the program was initiated.  Never close the filehandle returned by
  2616.     Input!
  2617.  
  2618.     RESULTS
  2619.     file - BCPL pointer to a file handle
  2620.  
  2621.     SEE ALSO
  2622.     Output(), SelectInput()
  2623.  
  2624. dos.library/InternalLoadSeg                       dos.library/InternalLoadSeg
  2625.  
  2626.    NAME
  2627.     InternalLoadSeg -- Low-level load routine (V36)
  2628.  
  2629.    SYNOPSIS
  2630.     seglist = InternalLoadSeg(fh,table,functionarray,stack)
  2631.     D0              D0  A0        A1      A2
  2632.  
  2633.     BPTR InternalLoadSeg(BPTR,BPTR,LONG *,LONG *)
  2634.  
  2635.    FUNCTION
  2636.     Loads from fh.  Table is used when loading an overlay, otherwise
  2637.     should be NULL.  Functionarray is a pointer to an array of functions.
  2638.     Note that the current Seek position after loading may be at any point
  2639.     after the last hunk loaded.  The filehandle will not be closed.  If a
  2640.     stacksize is encoded in the file, the size will be stuffed in the
  2641.     LONG pointed to by stack.  This LONG should be initialized to your
  2642.     default value: InternalLoadSeg() will not change it if no stacksize
  2643.     is found. Clears unused portions of Code and Data hunks (as well as
  2644.     BSS hunks).  (This also applies to LoadSeg() and NewLoadSeg()).
  2645.  
  2646.     If the file being loaded is an overlaid file, this will return
  2647.     -(seglist).  All other results will be positive.
  2648.  
  2649.     NOTE to overlay users: InternalLoadSeg() does NOT return seglist in
  2650.     both D0 and D1, as LoadSeg does.  The current ovs.asm uses LoadSeg(),
  2651.     and assumes returns are in D1.  We will support this for LoadSeg()
  2652.     ONLY.
  2653.  
  2654.    INPUTS
  2655.     fh          - Filehandle to load from.
  2656.     table          - When loading an overlay, otherwise ignored.
  2657.     functionarray - Array of function to be used for read, alloc, and free.
  2658.        FuncTable[0] ->  Actual = ReadFunc(readhandle,buffer,length),DOSBase
  2659.                     D0                D1         A0     D0      A6
  2660.        FuncTable[1] ->  Memory = AllocFunc(size,flags), Execbase
  2661.                     D0                 D0   D1      a6
  2662.        FuncTable[2] ->  FreeFunc(memory,size), Execbase
  2663.                              A1     D0     a6
  2664.     stack         - Pointer to storage (ULONG) for stacksize.
  2665.  
  2666.    RESULT
  2667.     seglist          - Seglist loaded or NULL.  NOT returned in D1!
  2668.  
  2669.    BUGS
  2670.     Really should use tags.
  2671.  
  2672.    SEE ALSO
  2673.     LoadSeg(), UnLoadSeg(), NewLoadSeg(), InternalUnLoadSeg()
  2674.  
  2675. dos.library/InternalUnLoadSeg                   dos.library/InternalUnLoadSeg
  2676.  
  2677.    NAME
  2678.     InternalUnLoadSeg -- Unloads a seglist loaded with InternalLoadSeg() (V36)
  2679.  
  2680.    SYNOPSIS
  2681.     success = InternalUnLoadSeg(seglist,FreeFunc)
  2682.       D0                  D1       A1
  2683.  
  2684.     BOOL InternalUnLoadSeg(BPTR,void (*)(STRPTR,ULONG))
  2685.  
  2686.    FUNCTION
  2687.     Unloads a seglist using freefunc to free segments.  Freefunc is called
  2688.     as for InternalLoadSeg.  NOTE: will call Close() for overlaid
  2689.     seglists.
  2690.  
  2691.    INPUTS
  2692.     seglist  - Seglist to be unloaded
  2693.     FreeFunc - Function called to free memory
  2694.  
  2695.    RESULT
  2696.     success - returns whether everything went OK (since this may close
  2697.           files).  Also returns FALSE if seglist was NULL.
  2698.  
  2699.    BUGS
  2700.     Really should use tags
  2701.  
  2702.    SEE ALSO
  2703.     LoadSeg(), UnLoadSeg(), InternalLoadSeg(), NewUnLoadSeg(), Close()
  2704.  
  2705. dos.library/IoErr                                           dos.library/IoErr
  2706.  
  2707.     NAME
  2708.     IoErr -- Return extra information from the system
  2709.  
  2710.     SYNOPSIS
  2711.     error = IoErr()
  2712.       D0
  2713.  
  2714.     LONG IoErr(void)
  2715.  
  2716.     FUNCTION
  2717.     Most I/O routines return zero to indicate an error. When this 
  2718.     happens (or whatever the defined error return for the routine)
  2719.     this routine may be called to determine more information. It is
  2720.     also used in some routines to pass back a secondary result.
  2721.  
  2722.     Note: there is no guarantee as to the value returned from IoErr()
  2723.     after a successful operation, unless to specified by the routine.
  2724.  
  2725.     RESULTS
  2726.     error - integer
  2727.  
  2728.     SEE ALSO
  2729.     Fault(), PrintFault(), SetIoErr()
  2730.  
  2731. dos.library/IsFileSystem                             dos.library/IsFileSystem
  2732.  
  2733.    NAME
  2734.     IsFileSystem -- returns whether a Dos handler is a filesystem (V36)
  2735.  
  2736.    SYNOPSIS
  2737.     result = IsFileSystem(name)
  2738.     D0                     D1
  2739.  
  2740.     BOOL IsFileSystem(STRPTR)
  2741.  
  2742.    FUNCTION
  2743.     Returns whether the device is a filesystem or not.  A filesystem
  2744.     supports seperate files storing information.  It may also support
  2745.     sub-directories, but is not required to.  If the filesystem doesn't
  2746.     support this new packet, IsFileSystem() will use Lock(":",...) as
  2747.     an indicator.
  2748.  
  2749.    INPUTS
  2750.     name   - Name of device in question, with trailing ':'.
  2751.  
  2752.    RESULT
  2753.     result - Flag to indicate if device is a file system
  2754.  
  2755.    SEE ALSO
  2756.     Lock()
  2757.  
  2758. dos.library/IsInteractive                           dos.library/IsInteractive
  2759.  
  2760.     NAME
  2761.     IsInteractive -- Discover whether a file is "interactive"
  2762.  
  2763.     SYNOPSIS
  2764.     status = IsInteractive( file )
  2765.     D0            D1
  2766.  
  2767.     BOOL IsInteractive(BPTR)
  2768.  
  2769.     FUNCTION
  2770.     The return value 'status' indicates whether the file associated
  2771.     with the file handle 'file' is connected to a virtual terminal.
  2772.  
  2773.     INPUTS
  2774.     file - BCPL pointer to a file handle
  2775.  
  2776.     RESULTS
  2777.     status - boolean
  2778.  
  2779.     SEE ALSO
  2780.  
  2781. dos.library/LoadSeg                                       dos.library/LoadSeg
  2782.  
  2783.     NAME
  2784.     LoadSeg -- Scatterload a loadable file into memory
  2785.  
  2786.     SYNOPSIS
  2787.     seglist = LoadSeg( name )
  2788.     D0           D1
  2789.  
  2790.     BPTR LoadSeg(STRPTR)
  2791.  
  2792.     FUNCTION
  2793.     The file 'name' should be a load module produced by the linker.
  2794.     LoadSeg() scatterloads the CODE, DATA and BSS segments into memory,
  2795.     chaining together the segments with BPTR's on their first words.
  2796.     The end of the chain is indicated by a zero.  There can be any number
  2797.     of segments in a file.  All necessary relocation is handled by
  2798.     LoadSeg().
  2799.  
  2800.     In the event of an error any blocks loaded will be unloaded and a
  2801.     NULL result returned.
  2802.  
  2803.     If the module is correctly loaded then the output will be a pointer
  2804.     at the beginning of the list of blocks. Loaded code is unloaded via
  2805.     a call to UnLoadSeg().
  2806.  
  2807.     INPUTS
  2808.     name - pointer to a null-terminated string
  2809.  
  2810.     RESULTS
  2811.     seglist - BCPL pointer to a seglist
  2812.  
  2813.     SEE ALSO
  2814.     UnLoadSeg(), InternalLoadSeg(), InternalUnLoadSeg(), CreateProc(),
  2815.     CreateNewProc(), NewLoadSeg().
  2816.  
  2817. dos.library/Lock                                             dos.library/Lock
  2818.  
  2819.     NAME
  2820.     Lock -- Lock a directory or file
  2821.  
  2822.     SYNOPSIS
  2823.     lock  = Lock( name, accessMode )
  2824.     D0          D1    D2
  2825.  
  2826.     BPTR Lock(STRPTR, LONG)
  2827.  
  2828.     FUNCTION
  2829.     A filing system lock on the file or directory 'name' is returned if
  2830.     possible.
  2831.  
  2832.     If the accessMode is ACCESS_READ, the lock is a shared read lock;
  2833.     if the accessMode is ACCESS_WRITE then it is an exclusive write
  2834.     lock.  Do not use random values for mode.
  2835.  
  2836.     If Lock() fails (that is, if it cannot obtain a filing system lock
  2837.     on the file or directory) it returns a zero.
  2838.  
  2839.     Tricky assumptions about the internal format of a lock are unwise,
  2840.     as are any attempts to use the fl_Link or fl_Access fields.
  2841.  
  2842.     INPUTS
  2843.     name       - pointer to a null-terminated string
  2844.     accessMode - integer
  2845.  
  2846.     RESULTS
  2847.     lock - BCPL pointer to a lock
  2848.  
  2849.     SEE ALSO
  2850.     UnLock(), DupLock(), ChangeMode(), NameFromLock(), DupLockFromFH()
  2851.  
  2852. dos.library/LockDosList                               dos.library/LockDosList
  2853.  
  2854.    NAME
  2855.     LockDosList -- Locks the specified Dos Lists for use (V36)
  2856.  
  2857.    SYNOPSIS
  2858.     dlist = LockDosList(flags)
  2859.     D0             D1
  2860.  
  2861.     struct DosList *LockDosList(ULONG)
  2862.  
  2863.    FUNCTION
  2864.     Locks the dos device list in preparation to walk the list.
  2865.     If the list is 'busy' then this routine will not return until it is 
  2866.     available.  This routine "nests": you can call it multiple times, and
  2867.     then must unlock it the same number of times.  The dlist
  2868.     returned is NOT a valid entry: it is a special value.  Note that
  2869.     for 1.3 compatibility, it also does a Forbid() - this will probably
  2870.     be removed at some future time.  The 1.3 Forbid() locking of this
  2871.     list had some race conditions.  The pointer returned by this is NOT
  2872.     an actual DosList pointer - you should use on of the other DosEntry
  2873.     calls to get actual pointers to DosList structures (such as
  2874.     NextDosEntry()), passing the value returned by LockDosList()
  2875.     as the dlist value.
  2876.  
  2877.     Note for handler writers: you should never call this function with
  2878.     LDF_WRITE, since it can deadlock you (if someone has it read-locked
  2879.     and they're trying to send you a packet).  Use AttemptLockDosList()
  2880.     instead, and effectively busy-wait with delays for the list to be
  2881.     available.  The other option is that you can spawn a process to
  2882.     add the entry safely.
  2883.  
  2884.     As an example, here's how you can search for all volumes of a specific
  2885.     name and do something with them:
  2886.  
  2887.     2.0 way:
  2888.  
  2889.         dl = LockDosList(LDF_VOLUMES|LDF_READ);
  2890.         while (dl = FindDosEntry(dl,name,LDF_VOLUMES))
  2891.         {
  2892.             Add to list of volumes to process or break out of
  2893.             the while loop.
  2894.             (You could try using it here, but I advise
  2895.             against it for compatability reasons if you
  2896.             are planning on continuing to examine the list.)
  2897.         }
  2898.         
  2899.         process list of volumes saved above, or current entry if
  2900.         you're only interested in the first one of that name.
  2901.  
  2902.         UnLockDosList();  /* must not use dl after this! */
  2903.  
  2904.     1.3/2.0 way:
  2905.  
  2906.         if (version >= 36)
  2907.             dl = LockDosList(LDF_VOLUMES|LDF_READ);
  2908.         else {
  2909.             Forbid();
  2910.             /* tricky! note dol_Next is at offset 0! */
  2911.             dl = &(...->di_DeviceList);
  2912.         }
  2913.  
  2914.         while (version >= 36 ?
  2915.                 dl = FindDosEntry(dl,name,LDF_VOLUMES) :
  2916.                     dl = yourfindentry(dl,name,DLT_VOLUME))
  2917.         {
  2918.             Add to list of volumes to process, or break out of
  2919.             the while loop.
  2920.             Do NOT lock foo1/foo2 here if you will continue
  2921.             to examine the list - it breaks the forbid
  2922.             and the list may change on you.
  2923.         }
  2924.         
  2925.         process list of volumes saved above, or current entry if
  2926.         you're only interested in the first one of that name.
  2927.  
  2928.         if (version >= 36)
  2929.             UnLockDosList();
  2930.         else
  2931.             Permit();
  2932.         /* must not use dl after this! */
  2933.         ...
  2934.  
  2935.         struct DosList *
  2936.         yourfindentry (struct DosList *dl, STRPTRname, type)
  2937.         {
  2938.         /* tricky - depends on dol_Next being at offset 0,
  2939.            and the initial ptr being a ptr to di_DeviceList! */
  2940.             while (dl = dl->dol_Next)
  2941.             {
  2942.                 if (dl->dol_Type == type &&
  2943.                 stricmp(name,BADDR(dl->dol_Name)+1) == 0)
  2944.                 {
  2945.                 break;
  2946.                 }
  2947.             }
  2948.             return dl;
  2949.         }
  2950.  
  2951.    INPUTS
  2952.     flags - Flags stating which types of nodes you want to lock.
  2953.  
  2954.    RESULT
  2955.     dlist - Pointer to the head of the list.  NOT a valid node!
  2956.  
  2957.    SEE ALSO
  2958.     AttemptLockDosList(), UnLockDosList(), Forbid(), NextDosEntry()
  2959.  
  2960. dos.library/LockRecord                                 dos.library/LockRecord
  2961.  
  2962.    NAME
  2963.     LockRecord -- Locks a portion of a file (V36)
  2964.  
  2965.    SYNOPSIS
  2966.     success = LockRecord(fh,offset,length,mode,timeout)
  2967.     D0                   D1   D2     D3    D4    D5
  2968.  
  2969.     ULONG LockRecord(BPTR,ULONG,ULONG,ULONG,ULONG)
  2970.  
  2971.    FUNCTION
  2972.     This locks a portion of a file for exclusive access.  Timeout is how
  2973.     long to wait in ticks (1/50 sec) for the record to be available.
  2974.  
  2975.     Valid modes are:
  2976.         REC_EXCLUSIVE
  2977.         REC_EXCLUSIVE_IMMED
  2978.         REC_SHARED
  2979.         REC_SHARED_IMMED
  2980.     For the IMMED modes, the timeout is ignored.
  2981.  
  2982.     Record locks are tied to the filehandle used to create them.  The
  2983.     same filehandle can get any number of exclusive locks on the same
  2984.     record, for example.  These are cooperative locks, they only
  2985.     affect other people calling LockRecord().
  2986.  
  2987.    INPUTS
  2988.     fh      - File handle for which to lock the record
  2989.     offset  - Record start position
  2990.     length  - Length of record in bytes
  2991.     mode    - Type of lock requester
  2992.     timeout - Timeout interval in ticks.  0 is legal.
  2993.  
  2994.    RESULT
  2995.     success - Success or failure
  2996.  
  2997.    BUGS
  2998.     In 2.0 through 2.02 (V36), LockRecord() only worked in the ramdisk.
  2999.     Attempting to lock records on the disk filesystem causes a crash.
  3000.     This was fixed for V37.
  3001.  
  3002.    SEE ALSO
  3003.     LockRecords(), UnLockRecord(), UnLockRecords()
  3004.  
  3005. dos.library/LockRecords                               dos.library/LockRecords
  3006.  
  3007.    NAME
  3008.     LockRecords -- Lock a series of records (V36)
  3009.  
  3010.    SYNOPSIS
  3011.     success = LockRecords(record_array,timeout)
  3012.     D0                       D1           D2
  3013.  
  3014.     BOOL LockRecords(struct RecordLock *,ULONG)
  3015.  
  3016.    FUNCTION
  3017.     This locks several records within a file for exclusive access.
  3018.     Timeout is how long to wait in ticks for the records to be available.
  3019.     The wait is applied to each attempt to lock each record in the list.
  3020.     It is recommended that you always lock a set of records in the same
  3021.     order to reduce possibilities of deadlock.
  3022.  
  3023.     The array of RecordLock structures is terminated by an entry with
  3024.     rec_FH of NULL.
  3025.  
  3026.    INPUTS
  3027.     record_array - List of records to be locked
  3028.     timeout      - Timeout interval.  0 is legal
  3029.  
  3030.    RESULT
  3031.     success      - Success or failure
  3032.  
  3033.    BUGS
  3034.     See LockRecord()
  3035.  
  3036.    SEE ALSO
  3037.     LockRecord(), UnLockRecord(), UnLockRecords()
  3038.  
  3039. dos.library/MakeDosEntry                             dos.library/MakeDosEntry
  3040.  
  3041.    NAME
  3042.     MakeDosEntry -- Creates a DosList structure (V36)
  3043.  
  3044.    SYNOPSIS
  3045.     newdlist = MakeDosEntry(name, type)
  3046.     D0                       D1    D2
  3047.  
  3048.     struct DosList *MakeDosEntry(STRPTR, LONG)
  3049.  
  3050.    FUNCTION
  3051.     Create a DosList structure, including allocating a name and correctly
  3052.     null-terminating the BSTR.  It also sets the dol_Type field, and sets
  3053.     all other fields to 0.  This routine should be eliminated and replaced
  3054.     by a value passed to AllocDosObject()!
  3055.  
  3056.    INPUTS
  3057.     name - name for the device/volume/assign node.
  3058.     type - type of node.
  3059.  
  3060.    RESULT
  3061.     newdlist - The new device entry or NULL.
  3062.  
  3063.    SEE ALSO
  3064.     AddDosEntry(), RemDosEntry(), FindDosEntry(), LockDosList(),
  3065.     NextDosEntry(), FreeDosEntry()
  3066.  
  3067. dos.library/MakeLink                                     dos.library/MakeLink
  3068.  
  3069.    NAME
  3070.     MakeLink -- Creates a filesystem link (V36)
  3071.  
  3072.    SYNOPSIS
  3073.     success = MakeLink( name, dest, soft )
  3074.     D0             D1    D2    D3
  3075.  
  3076.     BOOL MakeLink( STRPTR, LONG, LONG )
  3077.  
  3078.    FUNCTION
  3079.     Create a filesystem link from 'name' to dest.  For "soft-links",
  3080.     dest is a pointer to a null-terminated path string.  For "hard-
  3081.     links", dest is a lock (BPTR).  'soft' is FALSE for hard-links,
  3082.     non-zero otherwise.
  3083.  
  3084.     Soft-links are resolved at access time by a combination of the
  3085.     filesystem (by returning ERROR_IS_SOFT_LINK to dos), and by
  3086.     Dos (using ReadLink() to resolve any links that are hit).
  3087.  
  3088.     Hard-links are resolved by the filesystem in question.  A series
  3089.     of hard-links to a file are all equivalent to the file itself.
  3090.     If one of the links (or the original entry for the file) is 
  3091.     deleted, the data remains until there are no links left.
  3092.  
  3093.    INPUTS
  3094.     name - Name of the link to create
  3095.     dest - CPTR to path string, or BPTR lock
  3096.     soft - FALSE for hard-links, non-zero for soft-links
  3097.  
  3098.    RESULT
  3099.     Success - boolean
  3100.  
  3101.    BUGS
  3102.     In V36, soft-links didn't work in the ROM filesystem.  This was
  3103.     fixed for V37.
  3104.  
  3105.    SEE ALSO
  3106.     ReadLink(), Open(), Lock()
  3107.  
  3108. dos.library/MatchEnd                                     dos.library/MatchEnd
  3109.  
  3110.    NAME
  3111.     MatchEnd -- Free storage allocated for MatchFirst()/MatchNext() (V36)
  3112.  
  3113.    SYNOPSIS
  3114.     MatchEnd(AnchorPath)
  3115.                  D1
  3116.  
  3117.     VOID MatchEnd(struct AnchorPath *)
  3118.  
  3119.    FUNCTION
  3120.     Return all storage associated with a given search.
  3121.  
  3122.    INPUTS
  3123.     AnchorPath - Anchor used for MatchFirst()/MatchNext()
  3124.              MUST be longword aligned!
  3125.  
  3126.    SEE ALSO
  3127.     MatchFirst(), ParsePattern(), Examine(), CurrentDir(), Examine(),
  3128.     MatchNext(), ExNext(), <dos/dosasl.h>
  3129.  
  3130. dos.library/MatchFirst                                 dos.library/MatchFirst
  3131.  
  3132.    NAME
  3133.     MatchFirst -- Finds file that matches pattern (V36)
  3134.  
  3135.    SYNOPSIS
  3136.     error = MatchFirst(pat, AnchorPath)
  3137.     D0                 D1       D2
  3138.  
  3139.     LONG MatchFirst(STRPTR, struct AnchorPath *)
  3140.  
  3141.    FUNCTION
  3142.     Locates the first file or directory that matches a given pattern.
  3143.     MatchFirst() is passed your pattern (you do not pass it through
  3144.     ParsePattern() - MatchFirst() does that for you), and the control
  3145.     structure.  MatchFirst() normally initializes your AnchorPath
  3146.     structure for you, and returns the first file that matched your
  3147.     pattern, or an error.  Note that MatchFirst()/MatchNext() are unusual
  3148.     for Dos in that they return 0 for success, or the error code (see
  3149.     <dos/dos.h>), instead of the application getting the error code
  3150.     from IoErr().
  3151.  
  3152.     When looking at the result of MatchFirst()/MatchNext(), the ap_Info
  3153.     field of your AnchorPath has the results of an Examine() of the object.
  3154.     You normally get the name of the object from fib_FileName, and the
  3155.     directory it's in from ap_Current->an_Lock.  To access this object,
  3156.     normally you would temporarily CurrentDir() to the lock, do an action
  3157.     to the file/dir, and then CurrentDir() back to your original directory.
  3158.     This makes certain you affect the right object even when two volumes
  3159.     of the same name are in the system.  You can use ap_Buf (with
  3160.     ap_Strlen) to get a name to report to the user.
  3161.  
  3162.     To initialize the AnchorPath structure (particularily when reusing
  3163.     it), set ap_BreakBits to the signal bits (CDEF) that you want to take
  3164.     a break on, or NULL, if you don't want to convenience the user.
  3165.     ap_Flags should be set to any flags you need or all 0's otherwise.
  3166.     ap_FoundBreak should be cleared if you'll be using breaks.
  3167.  
  3168.     If you want to have the FULL PATH NAME of the files you found,
  3169.     allocate a buffer at the END of this structure, and put the size of
  3170.     it into ap_Strlen.  If you don't want the full path name, make sure
  3171.     you set ap_Strlen to zero.  In this case, the name of the file, and
  3172.     stats are available in the ap_Info, as per usual.
  3173.  
  3174.     Then call MatchFirst() and then afterwards, MatchNext() with this
  3175.     structure.  You should check the return value each time (see below)
  3176.     and take the appropriate action, ultimately calling MatchEnd() when
  3177.     there are no more files or you are done.  You can tell when you are
  3178.     done by checking for the normal AmigaDOS return code
  3179.     ERROR_NO_MORE_ENTRIES.
  3180.  
  3181.     Note: patterns with trailing slashes may cause MatchFirst()/MatchNext()
  3182.     to return with an ap_Current->an_Lock on the object, and a filename
  3183.     of the empty string ("").
  3184.  
  3185.     See ParsePattern() for more information on the patterns.
  3186.  
  3187.    INPUTS
  3188.     pat        - Pattern to search for
  3189.     AnchorPath - Place holder for search.  MUST be longword aligned!
  3190.  
  3191.    RESULT
  3192.     error - 0 for success or error code.  (Opposite of most Dos calls!)
  3193.  
  3194.    BUGS
  3195.     In V36, there were a number of bugs with MatchFirst()/MatchNext().
  3196.     One was that if you entered a directory with a name like "df0:l"
  3197.     using DODIR, it would re-lock the full string "df0:l", which can
  3198.     cause problems if the disk has changed.  It also had problems
  3199.     with patterns such as #?/abc/def - the ap_Current->an_Lock would
  3200.     not be on the directory def is found in.  ap_Buf would be correct,
  3201.     however.  It had similar problems with patterns with trailing
  3202.     slashes.  These have been fixed for V37 and later.
  3203.  
  3204.     A bug that has not been fixed for V37 concerns a pattern of a
  3205.     single directory name (such as "l").  If you enter such a directory
  3206.     via DODIR, it re-locks l relative to the current directory.  Thus
  3207.     you must not change the current directory before calling MatchNext()
  3208.     with DODIR in that situation.  If you aren't using DODIR to enter
  3209.     directories you can ignore this.  This may be fixed in some upcoming
  3210.     release.
  3211.  
  3212.    SEE ALSO
  3213.     MatchNext(), ParsePattern(), Examine(), CurrentDir(), Examine(),
  3214.     MatchEnd(), ExNext(), <dos/dosasl.h>
  3215.  
  3216. dos.library/MatchNext                                   dos.library/MatchNext
  3217.  
  3218.    NAME
  3219.     MatchNext - Finds the next file or directory that matches pattern (V36)
  3220.  
  3221.    SYNOPSIS
  3222.     error = MatchNext(AnchorPath)
  3223.     D0                    D1
  3224.  
  3225.     LONG MatchNext(struct AnchorPath *)
  3226.  
  3227.    FUNCTION
  3228.     Locates the next file or directory that matches a given pattern.
  3229.     See <dos/dosasl.h> for more information.  Various bits in the flags
  3230.     allow the application to control the operation of MatchNext().
  3231.  
  3232.     See MatchFirst() for other notes.
  3233.  
  3234.    INPUTS
  3235.     AnchorPath - Place holder for search.  MUST be longword aligned!
  3236.  
  3237.    RESULT
  3238.     error - 0 for success or error code.  (Opposite of most Dos calls)
  3239.  
  3240.    BUGS
  3241.     See MatchFirst().
  3242.  
  3243.    SEE ALSO
  3244.     MatchFirst(), ParsePattern(), Examine(), CurrentDir(), Examine(),
  3245.     MatchEnd(), ExNext(), <dos/dosasl.h>
  3246.  
  3247. dos.library/MatchPattern                             dos.library/MatchPattern
  3248.  
  3249.    NAME
  3250.     MatchPattern --  Checks for a pattern match with a string (V36)
  3251.  
  3252.    SYNOPSIS
  3253.     match = MatchPattern(pat, str)
  3254.     D0                   D1   D2
  3255.  
  3256.     BOOL MatchPattern(STRPTR, STRPTR)
  3257.  
  3258.    FUNCTION
  3259.     Checks for a pattern match with a string.  The pattern must be a
  3260.     tokenized string output by ParsePattern().  This routine is
  3261.     case-sensitive.
  3262.  
  3263.     NOTE: this routine is highly recursive.  You must have at least
  3264.     1500 free bytes of stack to call this (it will cut off it's
  3265.     recursion before going any deeper than that and return failure).
  3266.     That's _currently_ enough for about 100 levels deep of #, (, ~, etc.
  3267.  
  3268.    INPUTS
  3269.     pat - Special pattern string to match as returned by ParsePattern()
  3270.     str - String to match against given pattern
  3271.  
  3272.    RESULT
  3273.     match - success or failure of pattern match.  On failure,
  3274.         IoErr() will return 0 or ERROR_TOO_MANY_LEVELS (starting
  3275.         with V37 - before that there was no stack checking).
  3276.  
  3277.    SEE ALSO
  3278.     ParsePattern(), MatchPatternNoCase(), MatchFirst(), MatchNext()
  3279.  
  3280. dos.library/MatchPatternNoCase                 dos.library/MatchPatternNoCase
  3281.  
  3282.    NAME
  3283.     MatchPatternNoCase --  Checks for a pattern match with a string (V37)
  3284.  
  3285.    SYNOPSIS
  3286.     match = MatchPatternNoCase(pat, str)
  3287.     D0                         D1   D2
  3288.  
  3289.     BOOL MatchPatternNoCase(STRPTR, STRPTR)
  3290.  
  3291.    FUNCTION
  3292.     Checks for a pattern match with a string.  The pattern must be a
  3293.     tokenized string output by ParsePatternNoCase().  This routine is
  3294.     case-insensitive.
  3295.  
  3296.     NOTE: this routine is highly recursive.  You must have at least
  3297.     1500 free bytes of stack to call this (it will cut off it's
  3298.     recursion before going any deeper than that and return failure).
  3299.     That's _currently_ enough for about 100 levels deep of #, (, ~, etc.
  3300.  
  3301.    INPUTS
  3302.     pat - Special pattern string to match as returned by ParsePatternNoCase()
  3303.     str - String to match against given pattern
  3304.  
  3305.    RESULT
  3306.     match - success or failure of pattern match.  On failure,
  3307.         IoErr() will return 0 or ERROR_TOO_MANY_LEVELS (starting
  3308.         with V37 - before that there was no stack checking).
  3309.  
  3310.    SEE ALSO
  3311.     ParsePatternNoCase(), MatchPattern(), MatchFirst(), MatchNext()
  3312.  
  3313. dos.library/MaxCli                                         dos.library/MaxCli
  3314.  
  3315.    NAME
  3316.     MaxCli -- returns the highest CLI process number possibly in use (V36)
  3317.  
  3318.    SYNOPSIS
  3319.     number = MaxCli()
  3320.     D0
  3321.  
  3322.     LONG MaxCli(void)
  3323.  
  3324.    FUNCTION
  3325.     Returns the highest CLI number that may be in use.  CLI numbers are
  3326.     reused, and are usually as small as possible.  To find all CLIs, scan
  3327.     using FindCliProc() from 1 to MaxCLI().  The number returned by
  3328.     MaxCli() may change as processes are created and destroyed.
  3329.  
  3330.    RESULT
  3331.     number - The highest CLI number that _may_ be in use.
  3332.  
  3333.    SEE ALSO
  3334.     FindCliProc(), Cli()
  3335.  
  3336. dos.library/NameFromFH                                 dos.library/NameFromFH
  3337.  
  3338.    NAME
  3339.     NameFromFH -- Get the name of an open filehandle (V36)
  3340.  
  3341.    SYNOPSIS
  3342.     success = NameFromFH(fh, buffer, len)
  3343.     D0                   D1    D2    D3
  3344.  
  3345.     BOOL NameFromFH(BPTR, STRPTR, LONG)
  3346.  
  3347.    FUNCTION
  3348.     Returns a fully qualified path for the filehandle.  This routine is
  3349.     guaranteed not to write more than len characters into the buffer.  The
  3350.     name will be null-terminated.  See NameFromLock() for more information.
  3351.  
  3352.    INPUTS
  3353.     fh     - Lock of object to be examined.
  3354.     buffer - Buffer to store name.
  3355.     len    - Length of buffer.
  3356.  
  3357.    RESULT
  3358.     success - Success/failure indicator.
  3359.  
  3360.    SEE ALSO
  3361.     NameFromLock()
  3362.  
  3363. dos.library/NameFromLock                             dos.library/NameFromLock
  3364.  
  3365.    NAME
  3366.     NameFromLock -- Returns the name of a locked object (V36)
  3367.  
  3368.    SYNOPSIS
  3369.     success = NameFromLock(lock, buffer, len)
  3370.     D0                      D1     D2    D3
  3371.  
  3372.     BOOL NameFromLock(BPTR, STRPTR, LONG)
  3373.  
  3374.    FUNCTION
  3375.     Returns a fully qualified path for the lock.  This routine is
  3376.     guaranteed not to write more than len characters into the buffer.  The
  3377.     name will be null-terminated.  NOTE: if the volume is not mounted,
  3378.     the system will request it (unless of course you set pr_WindowPtr to
  3379.     -1).  If the volume is not mounted or inserted, it will return an
  3380.     error.  If the lock passed in is NULL, "SYS:" will be returned. If
  3381.     the buffer is too short, an error will be returned, and IoErr() will
  3382.     return ERROR_LINE_TOO_LONG.
  3383.  
  3384.    INPUTS
  3385.     lock   - Lock of object to be examined.
  3386.     buffer - Buffer to store name.
  3387.     len    - Length of buffer.
  3388.  
  3389.    RESULT
  3390.     success - Success/failure indicator.
  3391.  
  3392.    BUGS
  3393.     Should return the name of the boot volume instead of SYS: for a NULL
  3394.     lock.
  3395.  
  3396.    SEE ALSO
  3397.     NameFromFH(), Lock()
  3398.  
  3399. dos.library/NewLoadSeg                                 dos.library/NewLoadSeg
  3400.  
  3401.    NAME
  3402.     NewLoadSeg -- Improved version of LoadSeg for stacksizes (V36)
  3403.  
  3404.    SYNOPSIS
  3405.     seglist = NewLoadSeg(file, tags)
  3406.     D0              D1    D2
  3407.  
  3408.     BPTR NewLoadSeg(STRPTR, struct TagItem *)
  3409.  
  3410.     seglist = NewLoadSegTagList(file, tags)
  3411.     D0                 D1    D2
  3412.  
  3413.     BPTR NewLoadSegTagList(STRPTR, struct TagItem *)
  3414.  
  3415.     seglist = NewLoadSegTags(file, ...)
  3416.  
  3417.     BPTR NewLoadSegTags(STRPTR, ...)
  3418.  
  3419.    FUNCTION
  3420.     Does a LoadSeg on a file, and takes additional actions based on the
  3421.     tags supplied.
  3422.  
  3423.     Clears unused portions of Code and Data hunks (as well as BSS hunks).
  3424.     (This also applies to InternalLoadSeg() and LoadSeg()).
  3425.  
  3426.     NOTE to overlay users: NewLoadSeg() does NOT return seglist in
  3427.     both D0 and D1, as LoadSeg does.  The current ovs.asm uses LoadSeg(),
  3428.     and assumes returns are in D1.  We will support this for LoadSeg()
  3429.     ONLY.
  3430.  
  3431.    INPUTS
  3432.     file - Filename of file to load
  3433.     tags - pointer to tagitem array
  3434.  
  3435.    RESULT
  3436.     seglist - Seglist loaded, or NULL
  3437.  
  3438.    BUGS
  3439.     No tags are currently defined.
  3440.  
  3441.    SEE ALSO
  3442.     LoadSeg(), UnLoadSeg(), InternalLoadSeg(), InternalUnLoadSeg()
  3443.  
  3444. dos.library/NextDosEntry                             dos.library/NextDosEntry
  3445.  
  3446.    NAME
  3447.     NextDosEntry -- Get the next Dos List entry (V36)
  3448.  
  3449.    SYNOPSIS
  3450.     newdlist = NextDosEntry(dlist,flags)
  3451.     D0                       D1    D2
  3452.  
  3453.     struct DosList *NextDosEntry(struct DosList *,ULONG)
  3454.  
  3455.    FUNCTION
  3456.     Find the next Dos List entry of the right type.  You MUST have locked
  3457.     the types you're looking for.  Returns NULL if there are no more of
  3458.     that type in the list.
  3459.  
  3460.    INPUTS
  3461.     dlist    - The current device entry.
  3462.     flags     - What type of entries to look for.
  3463.  
  3464.    RESULT
  3465.     newdlist - The next device entry of the right type or NULL.
  3466.  
  3467.    SEE ALSO
  3468.     AddDosEntry(), RemDosEntry(), FindDosEntry(), LockDosList(),
  3469.     MakeDosEntry(), FreeDosEntry()
  3470.  
  3471. dos.library/Open                                             dos.library/Open
  3472.  
  3473.     NAME
  3474.     Open -- Open a file for input or output
  3475.  
  3476.     SYNOPSIS
  3477.     file = Open( name, accessMode )
  3478.     D0         D1    D2
  3479.  
  3480.     BPTR Open(STRPTR, LONG)
  3481.  
  3482.     FUNCTION
  3483.     The named file is opened and a file handle returned.  If the
  3484.     accessMode is MODE_OLDFILE, an existing file is opened for reading
  3485.     or writing. If the value is MODE_NEWFILE, a new file is created for
  3486.     writing. MODE_READWRITE opens a file with an shared lock, but
  3487.     creates it if it didn't exist.  Open types are documented in the
  3488.     <dos/dos.h> or <libraries/dos.h> include file.
  3489.  
  3490.     The 'name' can be a filename (optionally prefaced by a device
  3491.     name), a simple device such as NIL:, a window specification such as
  3492.     CON: or RAW: followed by window parameters, or "*", representing the
  3493.     current window.  Note that as of V36, "*" is obsolete, and CONSOLE:
  3494.     should be used instead.
  3495.  
  3496.     If the file cannot be opened for any reason, the value returned
  3497.     will be zero, and a secondary error code will be available by
  3498.     calling the routine IoErr().
  3499.  
  3500.     INPUTS
  3501.     name       - pointer to a null-terminated string
  3502.     accessMode - integer
  3503.  
  3504.     RESULTS
  3505.     file - BCPL pointer to a file handle
  3506.  
  3507.     SEE ALSO
  3508.     Close(), ChangeMode(), NameFromFH(), ParentOfFH(), ExamineFH()
  3509.  
  3510. dos.library/OpenFromLock                             dos.library/OpenFromLock
  3511.  
  3512.    NAME
  3513.     OpenFromLock -- Opens a file you have a lock on (V36)
  3514.  
  3515.    SYNOPSIS
  3516.     fh = OpenFromLock(lock)
  3517.     D0                 D1
  3518.  
  3519.     BPTR OpenFromLock(BPTR)
  3520.  
  3521.    FUNCTION
  3522.     Given a lock, this routine performs an open on that lock.  If the open
  3523.     succeeds, the lock is (effectively) relinquished, and should not be
  3524.     UnLock()ed or used.  If the open fails, the lock is still usable.
  3525.     The lock associated with the file internally is of the same access
  3526.     mode as the lock you gave up - shared is similar to MODE_OLDFILE,
  3527.     exclusive is similar to MODE_NEWFILE.
  3528.  
  3529.    INPUTS
  3530.     lock - Lock on object to be opened.
  3531.  
  3532.    RESULT
  3533.     fh   - Newly opened file handle or NULL for failure
  3534.  
  3535.    BUGS
  3536.     In the original V36 autodocs, this was shown (incorrectly) as
  3537.     taking a Mode parameter as well.  The prototypes and pragmas were
  3538.     also wrong.
  3539.  
  3540.    SEE ALSO
  3541.     Open(), Close(), Lock(), UnLock()
  3542.  
  3543. dos.library/Output                                         dos.library/Output
  3544.  
  3545.     NAME
  3546.     Output -- Identify the programs' initial output file handle
  3547.  
  3548.     SYNOPSIS
  3549.     file = Output()
  3550.     D0
  3551.  
  3552.     BPTR Output(void)
  3553.  
  3554.     FUNCTION
  3555.     Output() is used to identify the initial output stream allocated
  3556.     when the program was initiated.  Never close the filehandle returned
  3557.     by Output().
  3558.  
  3559.     RESULTS
  3560.     file - BCPL pointer to a file handle
  3561.  
  3562.     SEE ALSO
  3563.     Input()
  3564.  
  3565. dos.library/ParentDir                                   dos.library/ParentDir
  3566.  
  3567.     NAME
  3568.     ParentDir -- Obtain the parent of a directory or file
  3569.  
  3570.     SYNOPSIS
  3571.     newlock = ParentDir( lock )
  3572.     D0             D1
  3573.  
  3574.     BPTR ParentDir(BPTR)
  3575.  
  3576.     FUNCTION
  3577.     The argument 'lock' is associated with a given file or directory.
  3578.     ParentDir() returns 'newlock' which is associated the parent
  3579.     directory of 'lock'.
  3580.  
  3581.     Taking the ParentDir() of the root of the current filing system
  3582.     returns a NULL (0) lock.  Note this 0 lock represents the root of
  3583.     file system that you booted from (which is, in effect, the parent
  3584.     of all other file system roots.)
  3585.  
  3586.     INPUTS
  3587.     lock - BCPL pointer to a lock
  3588.  
  3589.     RESULTS
  3590.     newlock - BCPL pointer to a lock
  3591.  
  3592.     SEE ALSO
  3593.     Lock(), DupLock(), UnLock(), ParentOfFH(), DupLockFromFH()
  3594.  
  3595. dos.library/ParentOfFH                                 dos.library/ParentOfFH
  3596.  
  3597.    NAME
  3598.     ParentOfFH -- returns a lock on the parent directory of a file (V36)
  3599.  
  3600.    SYNOPSIS
  3601.     lock = ParentOfFH(fh)
  3602.     D0               D1
  3603.  
  3604.     BPTR ParentOfFH(BPTR)
  3605.  
  3606.    FUNCTION
  3607.     Returns a shared lock on the parent directory of the filehandle.
  3608.  
  3609.    INPUTS
  3610.     fh   - Filehandle you want the parent of.
  3611.  
  3612.    RESULT
  3613.     lock - Lock on parent directory of the filehandle or NULL for failure.
  3614.  
  3615.    SEE ALSO
  3616.     Parent(), Lock(), UnLock() DupLockFromFH()
  3617.  
  3618. dos.library/ParsePattern                             dos.library/ParsePattern
  3619.  
  3620.    NAME
  3621.     ParsePattern -- Create a tokenized string for MatchPattern() (V36)
  3622.  
  3623.    SYNOPSIS
  3624.     IsWild = ParsePattern(Source, Dest, DestLength)
  3625.     d0                      D1     D2      D3
  3626.  
  3627.     LONG ParsePattern(STRPTR, STRPTR, LONG)
  3628.  
  3629.    FUNCTION
  3630.     Tokenizes a pattern, for use by MatchPattern().  Also indicates if
  3631.     there are any wildcards in the pattern (i.e. whether it might match
  3632.     more than one item).  Note that Dest must be at least 2 times as
  3633.     large as Source plus bytes to be (almost) 100% certain of no
  3634.     buffer overflow.  This is because each input character can currently
  3635.     expand to 2 tokens (with one exception that can expand to 3, but
  3636.     only once per string).  Note: this implementation may change in
  3637.     the future, so you should handle error returns in all cases, but
  3638.     the size above should still be a reasonable upper bound for a buffer
  3639.     allocation.
  3640.  
  3641.     The patterns are fairly extensive, and approximate some of the ability
  3642.     of Unix/grep "regular expression" patterns.  Here are the available
  3643.     tokens:
  3644.  
  3645.     ?    Matches a single character.
  3646.     #    Matches the following expression 0 or more times.
  3647.     (ab|cd)    Matches any one of the items seperated by '|'.
  3648.     ~    Negates the following expression.  It matches all strings
  3649.         that do not match the expression (aka ~(foo) matches all
  3650.         strings that are not exactly "foo").
  3651.     [abc]    Character class: matches any of the characters in the class.
  3652.     [~bc]    Character class: matches any of the characters not in the
  3653.         class.
  3654.     a-z    Character range (only within character classes). 
  3655.     %    Matches 0 characters always (useful in "(foo|bar|%)").
  3656.     *    Synonym for "#?", not available by default in 2.0.  Available
  3657.         as an option that can be turned on.
  3658.  
  3659.     "Expression" in the above table means either a single character
  3660.     (ex: "#?"), or an alternation (ex: "#(ab|cd|ef)"), or a character
  3661.     class (ex: "#[a-zA-Z]").
  3662.  
  3663.    INPUTS
  3664.     source     - unparsed wildcard string to search for.
  3665.        dest       - output string, gets tokenized version of input.
  3666.     DestLength - length available in destination (should be at least as
  3667.              twice as large as source + 2 bytes).
  3668.  
  3669.    RESULT
  3670.     IsWild - 1 means there were wildcards in the pattern,
  3671.          0 means there were no wildcards in the pattern,
  3672.         -1 means there was a buffer overflow or other error
  3673.  
  3674.    BUGS
  3675.     Should set IoErr() to something useful (not currently set) on an
  3676.     error.
  3677.  
  3678.    SEE ALSO
  3679.     ParsePatternNoCase(), MatchPattern(), MatchFirst(), MatchNext()
  3680.  
  3681. dos.library/ParsePatternNoCase                 dos.library/ParsePatternNoCase
  3682.  
  3683.    NAME
  3684.     ParsePatternNoCase -- Create a tokenized string for
  3685.                         MatchPatternNoCase() (V37)
  3686.  
  3687.    SYNOPSIS
  3688.     IsWild = ParsePatternNoCase(Source, Dest, DestLength)
  3689.     d0                            D1     D2      D3
  3690.  
  3691.     LONG ParsePatternNoCase(STRPTR, STRPTR, LONG)
  3692.  
  3693.    FUNCTION
  3694.     Tokenizes a pattern, for use by MatchPatternNoCase().  Also indicates
  3695.     if there are any wildcards in the pattern (i.e. whether it might match
  3696.     more than one item).  Note that Dest must be at least 2 times as
  3697.     large as Source plus 2 bytes.
  3698.  
  3699.     For a description of the wildcards, see ParsePattern().
  3700.  
  3701.    INPUTS
  3702.     source     - unparsed wildcard string to search for.
  3703.        dest       - output string, gets tokenized version of input.
  3704.     DestLength - length available in destination (should be at least as
  3705.              twice as large as source + 2 bytes).
  3706.  
  3707.    RESULT
  3708.     IsWild - 1 means there were wildcards in the pattern,
  3709.          0 means there were no wildcards in the pattern,
  3710.         -1 means there was a buffer overflow or other error
  3711.  
  3712.    BUGS
  3713.     Should set IoErr() to something useful (not currently set) on an
  3714.     error.
  3715.  
  3716.    SEE ALSO
  3717.     ParsePattern(), MatchPatternNoCase(), MatchFirst(), MatchNext()
  3718.  
  3719. dos.library/PathPart                                     dos.library/PathPart
  3720.  
  3721.    NAME
  3722.     PathPart -- Returns a pointer to the end of the next-to-last (V36)
  3723.             component of a path.
  3724.  
  3725.    SYNOPSIS
  3726.     fileptr = PathPart( path )
  3727.     D0             D1
  3728.  
  3729.     STRPTR PathPart( STRPTR )
  3730.  
  3731.    FUNCTION
  3732.     This function returns a pointer to the character after the next-to-last
  3733.     component of a path specification, which will normally be the directory
  3734.     name.  If there is only one component, it returns a pointer to the
  3735.     beginning of the string.  The only real difference between this and
  3736.     FilePart() is the handling of '/'.
  3737.  
  3738.    INPUTS
  3739.     path - pointer to an path string.  May be relative to the current
  3740.            directory or the current disk.
  3741.  
  3742.    RESULT
  3743.     fileptr - pointer to the end of the next-to-last component of the path.
  3744.  
  3745.    EXAMPLE
  3746.     PathPart("xxx:yyy/zzz/qqq") would return a pointer to the last '/'.
  3747.     PathPart("xxx:yyy") would return a pointer to the first 'y').
  3748.  
  3749.    SEE ALSO
  3750.     FilePart(), AddPart()
  3751.  
  3752. dos.library/PrintFault                                 dos.library/PrintFault
  3753.  
  3754.    NAME
  3755.     PrintFault -- Returns the text associated with a DOS error code (V36)
  3756.  
  3757.    SYNOPSIS
  3758.     success = PrintFault(code, header)
  3759.     D0                    D1     D2   
  3760.  
  3761.     BOOL PrintFault(LONG, STRPTR)
  3762.  
  3763.    FUNCTION
  3764.     This routine obtains the error message text for the given error code.
  3765.     This is similar to the Fault() function, except that the output is
  3766.     written to the default output channel with buffered output.
  3767.     The value returned by IoErr() is set to the code passed in.
  3768.  
  3769.    INPUTS
  3770.     code   - Error code
  3771.     header - header to output before error text
  3772.  
  3773.    RESULT
  3774.     success - Success/failure code.
  3775.  
  3776.    SEE ALSO
  3777.     IoErr(), Fault(), SetIoErr(), Output(), FPuts()
  3778.  
  3779. dos.library/PutStr                                         dos.library/PutStr
  3780.  
  3781.    NAME
  3782.     PutStr -- Writes a string the the default output (buffered) (V36)
  3783.  
  3784.    SYNOPSIS
  3785.     error = PutStr(str)
  3786.     D0             D1
  3787.  
  3788.     LONG PutStr(STRPTR)
  3789.  
  3790.    FUNCTION
  3791.     This routine writes an unformatted string to the default output.  No 
  3792.     newline is appended to the string and any error is returned.  This
  3793.     routine is buffered.
  3794.  
  3795.    INPUTS
  3796.     str   - Null-terminated string to be written to default output
  3797.  
  3798.    RESULT
  3799.     error - 0 for success, -1 for any error.  NOTE: this is opposite
  3800.         most Dos function returns!
  3801.  
  3802.    SEE ALSO
  3803.     FPuts(), FPutC(), FWrite(), WriteChars()
  3804.  
  3805. dos.library/Read                                             dos.library/Read
  3806.  
  3807.     NAME
  3808.     Read -- Read bytes of data from a file
  3809.  
  3810.     SYNOPSIS
  3811.     actualLength = Read( file, buffer, length )
  3812.     D0             D1    D2       D3
  3813.  
  3814.     LONG Read(BPTR, void *, LONG)
  3815.  
  3816.     FUNCTION
  3817.     Data can be copied using a combination of Read() and Write().
  3818.     Read() reads bytes of information from an opened file (represented
  3819.     here by the argument 'file') into the buffer given. The argument
  3820.     'length' is the length of the buffer given.
  3821.  
  3822.     The value returned is the length of the information actually read.
  3823.     So, when 'actualLength' is greater than zero, the value of
  3824.     'actualLength' is the the number of characters read. Usually Read
  3825.     will try to fill up your buffer before returning. A value of zero
  3826.     means that end-of-file has been reached. Errors are indicated by a
  3827.     value of -1.
  3828.  
  3829.     Note: this is an unbuffered routine (the request is passed directly
  3830.     to the filesystem.)  Buffered I/O is more efficient for small
  3831.     reads and writes; see FGetC().
  3832.  
  3833.     INPUTS
  3834.     file - BCPL pointer to a file handle
  3835.     buffer - pointer to buffer
  3836.     length - integer
  3837.  
  3838.     RESULTS
  3839.     actualLength - integer
  3840.  
  3841.     SEE ALSO
  3842.     Open(), Close(), Write(), Seek(), FGetC()
  3843.  
  3844. dos.library/ReadArgs                                     dos.library/ReadArgs
  3845.  
  3846.    NAME
  3847.     ReadArgs - Parse the command line input (V36)
  3848.  
  3849.    SYNOPSIS
  3850.     result = ReadArgs(template, array, rdargs)
  3851.     D0                   D1      D2      D3
  3852.  
  3853.     struct RDArgs * ReadArgs(STRPTR, LONG *, struct RDArgs *)
  3854.  
  3855.    FUNCTION
  3856.     Parses and argument string according to a template.  Normally gets
  3857.     the arguments by reading buffered IO from Input(), but also can be
  3858.     made to parse a string.  MUST be matched by a call to FreeArgs().
  3859.  
  3860.     ReadArgs() parses the commandline according to a template that is
  3861.     passed to it.  This specifies the different command-line options and
  3862.     their types.  A template consists of a list of options.  Options are
  3863.     named in "full" names where possible (for example, "Quick" instead of
  3864.     "Q").  Abbreviations can also be specified by using "abbrev=option"
  3865.     (for example, "Q=Quick").
  3866.  
  3867.     Options in the template are separated by commas.  To get the results
  3868.     of ReadArgs(), you examine the array of longwords you passed to it
  3869.     (one entry per option in the template).  This array should be cleared
  3870.     (or initialized to your default values) before passing to ReadArgs().
  3871.     Exactly what is put in a given entry by ReadArgs() depends on the type
  3872.     of option.  The default is a string (a sequence of non-whitespace
  3873.     characters, or delimited by quotes, which will be stripped by
  3874.     ReadArgs()), in which case the entry will be a pointer.
  3875.  
  3876.     Options can be followed by modifiers, which specify things such as
  3877.     the type of the option.  Modifiers are specified by following the
  3878.     option with a '/' and a single character modifier.  Multiple modifiers
  3879.     can be specified by using multiple '/'s.  Valid modifiers are:
  3880.  
  3881.     /S - Switch.  This is considered a boolean variable, and will be
  3882.          set if the option name appears in the command-line.  The entry
  3883.          is the boolean (0 for not set, non-zero for set).
  3884.  
  3885.     /K - Keyword.  This means that the option will not be filled unless
  3886.          the keyword appears.  For example if the template is "Name/K",
  3887.          then unless "Name=<string>" or "Name <string>" appears in the
  3888.          command line, Name will not be filled.
  3889.  
  3890.     /N - Number.  This parameter is considered a decimal number, and will
  3891.          be converted by ReadArgs.  If an invalid number is specified,
  3892.          an error will be returned.  The entry will be a pointer to the
  3893.          longword number (this is how you know if a number was specified).
  3894.  
  3895.     /T - Toggle.  This is similar to a switch, but when specified causes
  3896.          the boolean value to "toggle".  Similar to /S.
  3897.  
  3898.     /A - Required.  This keyword must be given a value during command-line
  3899.          processing, or an error is returned.
  3900.  
  3901.     /F - Rest of line.  If this is specified, the entire rest of the line
  3902.          is taken as the parameter for the option, even if other option
  3903.          keywords appear in it.
  3904.  
  3905.     /M - Multiple strings.  This means the argument will take any number
  3906.          of strings, returning them as an array of strings.  Any arguments
  3907.          not considered to be part of another option will be added to this
  3908.          option.  Only one /M should be specified in a template.  Example:
  3909.          for a template "Dir/M,All/S" the command-line "foo bar all qwe"
  3910.          will set the boolean "all", and return an array consisting of
  3911.          "foo", "bar", and "qwe".  The entry in the array will be a pointer
  3912.          to an array of string pointers, the last of which will be NULL.
  3913.  
  3914.          There is an interaction between /M parameters and /A parameters.
  3915.          If there are unfilled /A parameters after parsing, it will grab
  3916.          strings from the end of a previous /M parameter list to fill the
  3917.          /A's.  This is used for things like Copy ("From/A/M,To/A").
  3918.  
  3919.     ReadArgs() returns a struct RDArgs if it succeeds.  This serves as an
  3920.     "anchor" to allow FreeArgs() to free the associated memory.  You can
  3921.     also pass in a struct RDArgs to control the operation of ReadArgs()
  3922.     (normally you pass NULL for the parameter, and ReadArgs() allocates
  3923.     one for you).  This allows providing different sources for the
  3924.     arguments, providing your own string buffer space for temporary
  3925.     storage, and extended help text.  See <dos/rdargs.h> for more
  3926.     information on this.  Note: if you pass in a struct RDArgs, you must
  3927.     still call FreeArgs() to release storage that gets attached to it,
  3928.     but you are responsible for freeing the RDArgs yourself.
  3929.  
  3930.     See BUGS regarding passing in strings.
  3931.     
  3932.    INPUTS
  3933.     template - formatting string
  3934.     array    - array of longwords for results, 1 per template entry
  3935.     rdargs   - optional rdargs structure for options.  AllocDosObject
  3936.            should be used for allocating them if you pass one in.
  3937.  
  3938.    RESULT
  3939.     result   - a struct RDArgs or NULL for failure.
  3940.  
  3941.    BUGS
  3942.     In V36, there were a couple of minor bugs with certain argument
  3943.     combinations (/M/N returned strings, /T didn't work, and /K and
  3944.     /F interacted).  Also, a template with a /K before any non-switch
  3945.     parameter will require the argument name to be given in order for
  3946.     line to be accepted (i.e. "parm/K,xyzzy/A" would require
  3947.     "xyzzy=xxxxx" in order to work - "xxxxx" would not work).  If you
  3948.     need to avoid this for V36, put /K parameters after all non-switch
  3949.     parameters.  These problems should be fixed for V37.
  3950.  
  3951.     Currently (V37 and before) it requires any strings passed in to have
  3952.     newlines at the end of the string.  This may or may not be fixed in
  3953.     the future.
  3954.  
  3955.    SEE ALSO
  3956.     FindArg(), ReadItem(), FreeArgs(), AllocDosObject()
  3957.  
  3958. dos.library/ReadItem                                     dos.library/ReadItem
  3959.  
  3960.    NAME
  3961.     ReadItem - reads a single argument/name from command line (V36)
  3962.  
  3963.    SYNOPSIS
  3964.     value = ReadItem(buffer, maxchars, input)
  3965.     D0                D1        D2      D3
  3966.  
  3967.     LONG ReadItem(STRPTR, LONG, struct CSource *)
  3968.  
  3969.    FUNCTION
  3970.     Reads a "word" from either Input() (buffered), or via CSource, if it
  3971.     is non-NULL (see <dos/rdargs.h> for more information).  Handles
  3972.     quoting and some '*' substitutions (*e and *n) inside quotes (only).
  3973.     See dos/dos.h for a listing of values returned by ReadItem()
  3974.     (ITEM_XXXX).  A "word" is delimited by whitespace, quotes, or an EOF.
  3975.  
  3976.     ReadItem always unreads the last thing read (UnGetC(fh,-1)) so the
  3977.     caller can find out what the terminator was.
  3978.  
  3979.    INPUTS
  3980.     buffer   - buffer to store word in.
  3981.     maxchars - size of the buffer
  3982.     input    - CSource input or NULL (uses FGetC(Input()))
  3983.  
  3984.    RESULT
  3985.     value - See <dos/dos.h> for return values.
  3986.  
  3987.    SEE ALSO
  3988.     ReadArgs(), FindArg(), UnGetC(), FGetC(), Input(), <dos/dos.h>,
  3989.     <dos/rdargs.h>, FreeArgs()
  3990.  
  3991. dos.library/ReadLink                                     dos.library/ReadLink
  3992.  
  3993.    NAME
  3994.     ReadLink -- Reads the path for a soft filesystem link (V36)
  3995.  
  3996.    SYNOPSIS
  3997.     success = ReadLink( port, lock, path, buffer, size)
  3998.     D0             D1    D2    D3     D4     D5
  3999.  
  4000.     BOOL ReadLink( struct MsgPort *, BPTR, STRPTR, STRPTR, ULONG)
  4001.  
  4002.    FUNCTION
  4003.     ReadLink() takes a lock/name pair (usually from a failed attempt
  4004.     to use them to access an object with packets), and asks the
  4005.     filesystem to find the softlink and fill buffer with the modified
  4006.     path string.  You then start the resolution process again by
  4007.     calling GetDeviceProc() with the new string from ReadLink().
  4008.  
  4009.     Soft-links are resolved at access time by a combination of the
  4010.     filesystem (by returning ERROR_IS_SOFT_LINK to dos), and by
  4011.     Dos (using ReadLink() to resolve any links that are hit).
  4012.  
  4013.    INPUTS
  4014.     port - msgport of the filesystem
  4015.     lock - lock this path is relative to on the filesystem
  4016.     path - path that caused the ERROR_IS_SOFT_LINK
  4017.     buffer - pointer to buffer for new path from handler.
  4018.     size - size of buffer.
  4019.  
  4020.    RESULT
  4021.     Success - boolean
  4022.  
  4023.    BUGS
  4024.     In V36, soft-links didn't work in the ROM filesystem.  This was
  4025.     fixed for V37.
  4026.  
  4027.    SEE ALSO
  4028.     MakeLink(), Open(), Lock(), GetDeviceProc()
  4029.  
  4030. dos.library/Relabel                                       dos.library/Relabel
  4031.  
  4032.    NAME
  4033.     Relabel -- Change the volume name of a volume (V36)
  4034.  
  4035.    SYNOPSIS
  4036.     success = Relabel(volumename,name)
  4037.     D0                    D1      D2
  4038.  
  4039.     BOOL Relabel(STRPTR,STRPTR)
  4040.  
  4041.    FUNCTION
  4042.     Changes the volumename of a volume, if supported by the filesystem.
  4043.  
  4044.    INPUTS
  4045.     volumename - Full name of device to rename (with ':')
  4046.     newname    - New name to apply to device (without ':')
  4047.  
  4048.    RESULT
  4049.     success    - Success/failure indicator
  4050.  
  4051.    SEE ALSO
  4052.  
  4053. dos.library/RemAssignList                           dos.library/RemAssignList
  4054.  
  4055.    NAME
  4056.     RemAssignList -- Remove an entry from a multi-dir assign (V36)
  4057.  
  4058.    SYNOPSIS
  4059.     success = RemAssignList(name,lock)
  4060.     D0                       D1   D2
  4061.  
  4062.     BOOL RemAssignList(STRPTR,BPTR)
  4063.  
  4064.    FUNCTION
  4065.     Removes an entry from a multi-directory assign.  The entry removed is
  4066.     the first one for which SameLock with 'lock' returns that they are on
  4067.     the same object.  The lock for the entry in the list is unlocked (not
  4068.     the entry passed in).
  4069.  
  4070.    INPUTS
  4071.     name - Name of device to remove lock from (without trailing ':')
  4072.     lock - Lock associated with the object to remove from the list
  4073.  
  4074.    RESULT
  4075.     success - Success/failure indicator.
  4076.  
  4077.    SEE ALSO
  4078.     Lock(), AssignLock(), AssignPath(), AssignLate(), DupLock(),
  4079.     AssignAdd(), UnLock()
  4080.  
  4081. dos.library/RemDosEntry                               dos.library/RemDosEntry
  4082.  
  4083.    NAME
  4084.     RemDosEntry -- Removes a Dos List entry from it's list (V36)
  4085.  
  4086.    SYNOPSIS
  4087.     success = RemDosEntry(dlist)
  4088.     D0                     D1
  4089.  
  4090.     BOOL RemDosEntry(struct DosList *)
  4091.  
  4092.    FUNCTION
  4093.     This removes an entry from the Dos Device list.  The memory associated
  4094.     with the entry is NOT freed.  NOTE: you must have locked the Dos List
  4095.     with the appropriate flags before calling this routine.  Handler
  4096.     writers should see the AddDosEntry() caveats about locking and use
  4097.     a similar workaround to avoid deadlocks.
  4098.  
  4099.    INPUTS
  4100.     dlist   - Device list entry to be removed.
  4101.  
  4102.    RESULT
  4103.     success - Success/failure indicator
  4104.  
  4105.    SEE ALSO
  4106.     AddDosEntry(), FindDosEntry(), NextDosEntry(), LockDosList(),
  4107.     MakeDosEntry(), FreeDosEntry()
  4108.  
  4109. dos.library/RemSegment                                 dos.library/RemSegment
  4110.  
  4111.    NAME
  4112.     RemSegment - Removes a resident segment from the resident list (V36)
  4113.  
  4114.    SYNOPSIS
  4115.     success = RemSegment(segment)
  4116.     D0                D1
  4117.  
  4118.     BOOL RemSegment(struct Segment *)
  4119.  
  4120.    FUNCTION
  4121.     Removes a resident segment from the Dos resident segment list,
  4122.     unloads it, and does any other cleanup required.  Will only succeed
  4123.     if the seg_UC (usecount) is 0.
  4124.  
  4125.    INPUTS
  4126.     segment - the segment to be removed
  4127.  
  4128.    RESULT
  4129.     success - success or failure.
  4130.  
  4131.    SEE ALSO
  4132.     FindSegment(), AddSegment()
  4133.  
  4134. dos.library/Rename                                         dos.library/Rename
  4135.  
  4136.     NAME
  4137.     Rename -- Rename a directory or file
  4138.  
  4139.     SYNOPSIS
  4140.     success = Rename( oldName, newName )
  4141.     D0          D1       D2
  4142.  
  4143.     BOOL Rename(STRPTR, STRPTR)
  4144.  
  4145.     FUNCTION
  4146.     Rename() attempts to rename the file or directory specified as
  4147.     'oldName' with the name 'newName'. If the file or directory
  4148.     'newName' exists, Rename() fails and returns an error. Both
  4149.     'oldName' and the 'newName' can contain a directory specification.
  4150.     In this case, the file will be moved from one directory to another.
  4151.  
  4152.     Note: it is impossible to Rename() a file from one volume to
  4153.     another.
  4154.  
  4155.     INPUTS
  4156.     oldName - pointer to a null-terminated string
  4157.     newName - pointer to a null-terminated string
  4158.  
  4159.     RESULTS
  4160.     success - boolean
  4161.  
  4162.     SEE ALSO
  4163.     Relabel()
  4164.  
  4165. dos.library/ReplyPkt                                     dos.library/ReplyPkt
  4166.  
  4167.    NAME
  4168.     ReplyPkt -- replies a packet to the person who sent it to you (V36)
  4169.  
  4170.    SYNOPSIS
  4171.     ReplyPkt(packet, result1, result2)
  4172.            D1      D2       D3
  4173.  
  4174.     void ReplyPkt(struct DosPacket *, LONG, LONG)
  4175.  
  4176.    FUNCTION
  4177.     This returns a packet to the process which sent it to you.  In
  4178.     addition, puts your pr_MsgPort address in dp_Port, so using ReplyPkt()
  4179.     again will send the message to you.  (This is used in "ping-ponging"
  4180.     packets between two processes).  It uses result 1 & 2 to set the
  4181.     dp_Res1 and dp_Res2 fields of the packet.
  4182.  
  4183.    INPUTS
  4184.     packet  - packet to reply, assumed to set up correctly.
  4185.     result1 - first result
  4186.     result2 - secondary result
  4187.  
  4188.    SEE ALSO
  4189.     DoPkt(), SendPkt(), WaitPkt(), IoErr()
  4190.  
  4191. dos.library/RunCommand                                 dos.library/RunCommand
  4192.  
  4193.    NAME
  4194.     RunCommand -- Runs a program using the current process (V36)
  4195.  
  4196.    SYNOPSIS
  4197.     rc = RunCommand(seglist, stacksize, argptr, argsize)
  4198.     D0                D1         D2       D3      D4
  4199.  
  4200.     LONG RunCommand(BPTR, ULONG, STRPTR, ULONG)
  4201.  
  4202.    FUNCTION
  4203.     Runs a command on your process/cli.  Seglist may be any language,
  4204.     including BCPL programs.  Stacksize is in bytes.  argptr is a null-
  4205.     terminated string, argsize is its length.  Returns the returncode the
  4206.     program exited with in d0. Returns -1 if the stack couldn't be
  4207.     allocated.
  4208.  
  4209.     NOTE: the argument string MUST be terminated with a newline to work
  4210.     properly with ReadArgs() and other argument parsers.
  4211.  
  4212.     RunCommand also takes care of setting up the current input filehandle
  4213.     in such a way that ReadArgs() can be used in the program, and restores
  4214.     the state of the buffering before returning.  It also sets the value
  4215.     returned by GetArgStr(), and restores it before returning.  NOTE:
  4216.     the setting of the argument string in the filehandle was added in V37.
  4217.  
  4218.     It's usually appropriate to set the command name (via
  4219.     SetProgramName()) before calling RunCommand().  RunCommand() sets
  4220.     the value returned by GetArgStr() while the command is running.
  4221.  
  4222.    INPUTS
  4223.     seglist   - Seglist of command to run.
  4224.     stacksize - Number of bytes to allocate for stack space
  4225.     argptr    - Pointer to argument command string.
  4226.     argsize   - Number of bytes in argument command.
  4227.  
  4228.    RESULT
  4229.     rc        - Return code from executed command. -1 indicates failure 
  4230.  
  4231.    SEE ALSO
  4232.     CreateNewProc(), SystemTagList(), Execute(), GetArgStr(),
  4233.     SetProgramName(), ReadArgs()
  4234.  
  4235. dos.library/SameDevice                                 dos.library/SameDevice
  4236.  
  4237.    NAME
  4238.     SameDevice -- Are two locks are on partitions of the device? (V37)
  4239.  
  4240.    SYNOPSIS
  4241.     same = SameDevice(lock1, lock2)
  4242.     D0           D1     D2
  4243.  
  4244.     BOOL SameDevice( BPTR, BPTR )
  4245.  
  4246.    FUNCTION
  4247.     SameDevice() returns whether two locks refer to partitions that
  4248.     are on the same physical device (if it can figure it out).  This
  4249.     may be useful in writing copy routines to take advantage of
  4250.     asynchronous multi-device copies.
  4251.  
  4252.     Entry existed in V36 and always returned 0.
  4253.  
  4254.    INPUTS
  4255.     lock1,lock2 - locks
  4256.  
  4257.    RESULT
  4258.     same - whether they're on the same device as far as Dos can determine.
  4259.  
  4260. dos.library/SameLock                                     dos.library/SameLock
  4261.  
  4262.    NAME
  4263.     SameLock -- returns whether two locks are on the same object (V36)
  4264.  
  4265.    SYNOPSIS
  4266.     value = SameLock(lock1, lock2)
  4267.     D0          D1     D2
  4268.  
  4269.     LONG SameLock(BPTR, BPTR)
  4270.  
  4271.    FUNCTION
  4272.     Compares two locks.  Returns LOCK_SAME if they are on the same object,
  4273.     LOCK_SAME_VOLUME if on different objects on the same volume, and
  4274.     LOCK_DIFFERENT if they are on different volumes.  Always compare
  4275.     for equality or non-equality with the results, in case new return
  4276.     values are added.
  4277.  
  4278.    INPUTS
  4279.     lock1 - 1st lock for comparison
  4280.     lock2 - 2nd lock for comparison
  4281.  
  4282.    RESULT
  4283.     value -    LOCK_SAME, LOCK_SAME_VOLUME, or LOCK_DIFFERENT
  4284.  
  4285.    BUGS
  4286.     Should do more extensive checks for NULL against a real lock, checking
  4287.     to see if the real lock is a lock on the root of the boot volume.
  4288.  
  4289.     In V36, it would return LOCK_SAME_VOLUME for different volumes on the
  4290.     same handler.  Also, LOCK_SAME_VOLUME was LOCK_SAME_HANDLER (now
  4291.     an obsolete define, see <dos/dos.h>).
  4292.  
  4293.    SEE ALSO
  4294.     <dos/dos.h>
  4295.  
  4296. dos.library/Seek                                             dos.library/Seek
  4297.  
  4298.     NAME
  4299.     Seek -- Set the current position for reading and writing
  4300.  
  4301.     SYNOPSIS
  4302.     oldPosition = Seek( file, position, mode )
  4303.     D0            D1      D2        D3
  4304.  
  4305.     LONG Seek(BPTR, LONG, LONG)
  4306.  
  4307.     FUNCTION
  4308.     Seek() sets the read/write cursor for the file 'file' to the
  4309.     position 'position'. This position is used by both Read() and
  4310.     Write() as a place to start reading or writing. The result is the
  4311.     current absolute position in the file, or -1 if an error occurs, in
  4312.     which case IoErr() can be used to find more information. 'mode' can
  4313.     be OFFSET_BEGINNING, OFFSET_CURRENT or OFFSET_END. It is used to
  4314.     specify the relative start position. For example, 20 from current
  4315.     is a position 20 bytes forward from current, -20 is 20 bytes back
  4316.     from current.
  4317.  
  4318.     So that to find out where you are, seek zero from current. The end
  4319.     of the file is a Seek() positioned by zero from end. You cannot
  4320.     Seek() beyond the end of a file.
  4321.  
  4322.     INPUTS
  4323.     file - BCPL pointer to a file handle
  4324.     position - integer
  4325.     mode - integer
  4326.  
  4327.     RESULTS
  4328.     oldPosition - integer
  4329.  
  4330.     BUGS
  4331.     The V36 and V37 ROM filesystem (and V36/V37 l:fastfilesystem)
  4332.     returns the current position instead of -1 on an error.  It sets
  4333.     IoErr() to 0 on success, and an error code on an error.
  4334.  
  4335.     SEE ALSO
  4336.     Read(), Write(), SetFileSize()
  4337.  
  4338. dos.library/SelectInput                               dos.library/SelectInput
  4339.  
  4340.    NAME
  4341.     SelectInput -- Select a filehandle as the default input channel (V36)
  4342.  
  4343.    SYNOPSIS
  4344.     old_fh = SelectInput(fh)
  4345.     D0                   D1
  4346.  
  4347.     BPTR SelectInput(BPTR)
  4348.  
  4349.    FUNCTION
  4350.     Set the current input as the default input for the process.
  4351.     This changes the value returned by Input().  old_fh should
  4352.     be closed or saved as needed.
  4353.  
  4354.    INPUTS
  4355.     fh     - Newly default input handle
  4356.  
  4357.    RESULT
  4358.     old_fh - Previous default input filehandle
  4359.  
  4360.    SEE ALSO
  4361.     Input(), SelectOutput(), Output()
  4362.  
  4363. dos.library/SelectOutput                             dos.library/SelectOutput
  4364.  
  4365.    NAME
  4366.     SelectOutput -- Select a filehandle as the default input channel (V36)
  4367.  
  4368.    SYNOPSIS
  4369.     old_fh = SelectOutput(fh)
  4370.     D0                    D1
  4371.  
  4372.     BPTR SelectOutput(BPTR)
  4373.  
  4374.    FUNCTION
  4375.     Set the current output as the default output for the process.
  4376.     This changes the value returned by Output().  old_fh should
  4377.     be closed or saved as needed.
  4378.  
  4379.    INPUTS
  4380.     fh     - Newly desired output handle
  4381.  
  4382.    RESULT
  4383.     old_fh - Previous current output
  4384.  
  4385.    SEE ALSO
  4386.     Output(), SelectInput(), Input()
  4387.  
  4388. dos.library/SendPkt                                       dos.library/SendPkt
  4389.  
  4390.    NAME
  4391.     SendPkt -- Sends a packet to a handler (V36)
  4392.  
  4393.    SYNOPSIS
  4394.     SendPkt(packet, port, replyport)
  4395.          D1     D2    D3
  4396.  
  4397.     void SendPkt(struct DosPacket *,struct MsgPort *,struct MsgPort *)
  4398.  
  4399.    FUNCTION
  4400.     Sends a packet to a handler and does not wait.  All fields in the
  4401.     packet must be initialized before calling this routine.  The packet
  4402.     will be returned to replyport.  If you wish to use this with
  4403.     WaitPkt(), use the address or your pr_MsgPort for replyport.
  4404.  
  4405.    INPUTS
  4406.     packet - packet to send, must be initialized and have a message.
  4407.     port   - pr_MsgPort of handler process to send to.
  4408.     replyport - MsgPort for the packet to come back to.
  4409.  
  4410.    NOTES
  4411.     Callable from a task.
  4412.  
  4413.    SEE ALSO
  4414.     DoPkt(), WaitPkt(), AllocDosObject(), FreeDosObject(), AbortPkt()
  4415.  
  4416. dos.library/SetArgStr                                   dos.library/SetArgStr
  4417.  
  4418.    NAME
  4419.     SetArgStr -- Sets the arguments for the current process (V36)
  4420.  
  4421.    SYNOPSIS
  4422.     oldptr = SetArgStr(ptr)
  4423.     D0           D1
  4424.  
  4425.     STRPTR SetArgStr(STRPTR)
  4426.  
  4427.    FUNCTION
  4428.     Sets the arguments for the current program.  The ptr MUST be reset
  4429.     to it's original value before process exit.
  4430.  
  4431.    INPUTS
  4432.     ptr - pointer to new argument string.
  4433.  
  4434.    RESULT
  4435.     oldptr - the previous argument string
  4436.  
  4437.    SEE ALSO
  4438.     GetArgStr(), RunCommand()
  4439.  
  4440. dos.library/SetComment                                 dos.library/SetComment
  4441.  
  4442.     NAME
  4443.     SetComment -- Change a files' comment string
  4444.  
  4445.     SYNOPSIS
  4446.     success = SetComment( name, comment )
  4447.     D0              D1    D2
  4448.  
  4449.     BOOL SetComment(STRPTR, STRPTR)
  4450.  
  4451.     FUNCTION
  4452.     SetComment() sets a comment on a file or directory. The comment is
  4453.     a pointer to a null-terminated string of up to 80 characters in the
  4454.     current ROM filesystem (and RAM:).  Note that not all filesystems
  4455.     will support comments (for example, NFS usually will not), or the
  4456.     size of comment supported may vary.
  4457.  
  4458.     INPUTS
  4459.     name    - pointer to a null-terminated string
  4460.     comment - pointer to a null-terminated string
  4461.  
  4462.     RESULTS
  4463.     success - boolean
  4464.  
  4465.     SEE ALSO
  4466.     Examine(), ExNext(), SetProtection()
  4467.  
  4468. dos.library/SetConsoleTask                         dos.library/SetConsoleTask
  4469.  
  4470.    NAME
  4471.     SetConsoleTask -- Sets the default console for the process (V36)
  4472.  
  4473.    SYNOPSIS
  4474.     oldport = SetConsoleTask(port)
  4475.     D0              D1
  4476.  
  4477.     struct MsgPort *SetConsoleTask(struct MsgPort *)
  4478.  
  4479.    FUNCTION
  4480.     Sets the default console task's port (pr_ConsoleTask) for the
  4481.     current process.
  4482.  
  4483.    INPUTS
  4484.     port - The pr_MsgPort of the default console handler for the process
  4485.  
  4486.    RESULT
  4487.     oldport - The previous ConsoleTask value.
  4488.  
  4489.    SEE ALSO
  4490.     GetConsoleTask(), Open()
  4491.  
  4492. dos.library/SetCurrentDirName                   dos.library/SetCurrentDirName
  4493.  
  4494.    NAME
  4495.     SetCurrentDirName -- Sets the directory name for the process (V36)
  4496.  
  4497.    SYNOPSIS
  4498.     success = SetCurrentDirName(name)
  4499.     D0                        D1
  4500.  
  4501.     BOOL SetCurrentDirName(STRPTR)
  4502.  
  4503.    FUNCTION
  4504.     Sets the name for the current dir in the cli structure.  If the name
  4505.     is too long to fit, a failure is returned, and the old value is left
  4506.     intact.  It is advised that you inform the user of this condition.
  4507.     This routine is safe to call even if there is no CLI structure.
  4508.  
  4509.    INPUTS
  4510.     name    - Name of directory to be set.
  4511.  
  4512.    RESULT
  4513.     success - Success/failure indicator
  4514.  
  4515.    BUGS
  4516.     This clips to a fixed (1.3 compatible) size.
  4517.  
  4518.    SEE ALSO
  4519.     GetCurrentDirName()
  4520.  
  4521. dos.library/SetFileDate                               dos.library/SetFileDate
  4522.  
  4523.    NAME
  4524.     SetFileDate -- Sets the modification date for a file or dir (V36)
  4525.  
  4526.    SYNOPSIS
  4527.     success = SetFileDate(name, date)
  4528.     D0                     D1    D2
  4529.  
  4530.     BOOL SetFileDate(STRPTR, struct DateStamp *)
  4531.  
  4532.    FUNCTION
  4533.     Sets the file date for a file or directory.  Note that for the Old
  4534.     File System and the Fast File System, the date of the root directory
  4535.     cannot be set.  Other filesystems may not support setting the date
  4536.     for all files/directories.
  4537.  
  4538.    INPUTS
  4539.     name - Name of object
  4540.     date - New modification date
  4541.  
  4542.    RESULT
  4543.     success - Success/failure indication
  4544.  
  4545.    SEE ALSO
  4546.     DateStamp(), Examine(), ExNext(), ExAll()
  4547.  
  4548. dos.library/SetFileSize                               dos.library/SetFileSize
  4549.  
  4550.    NAME
  4551.     SetFileSize -- Sets the size of a file (V36)
  4552.  
  4553.    SYNOPSIS
  4554.     newsize = SetFileSize(fh, offset, mode)
  4555.     D0                    D1    D2     D3
  4556.  
  4557.     LONG SetFileSize(BPTR, LONG, LONG)
  4558.  
  4559.    FUNCTION
  4560.     Changes the file size, truncating or extending as needed.  Not all
  4561.     handlers may support this; be careful and check the return code.  If
  4562.     the file is extended, no values should be assumed for the new bytes.
  4563.     If the new position would be before the filehandle's current position
  4564.     in the file, the filehandle will end with a position at the
  4565.     end-of-file.  If there are other filehandles open onto the file, the
  4566.     new size will not leave any filehandle pointing past the end-of-file.
  4567.     You can check for this by looking at the new size.
  4568.  
  4569.     Do NOT count on any specific values to be in the extended area.
  4570.  
  4571.    INPUTS
  4572.     fh     - File to be truncated/extended.
  4573.     offset - Offset from position determined by mode.
  4574.     mode   - One of OFFSET_BEGINNING, OFFSET_CURRENT, or OFFSET_END.
  4575.  
  4576.    RESULT
  4577.     newsize - position of new end-of-file or -1 for error.
  4578.  
  4579.    SEE ALSO
  4580.     Seek()
  4581.  
  4582. dos.library/SetFileSysTask                         dos.library/SetFileSysTask
  4583.  
  4584.    NAME
  4585.     SetFileSysTask -- Sets the default filesystem for the process (V36)
  4586.  
  4587.    SYNOPSIS
  4588.     oldport = SetFileSysTask(port)
  4589.     D0              D1
  4590.  
  4591.     struct MsgPort *SetFileSysTask(struct MsgPort *)
  4592.  
  4593.    FUNCTION
  4594.     Sets the default filesystem task's port (pr_FileSystemTask) for the
  4595.     current process.
  4596.  
  4597.    INPUTS
  4598.     port - The pr_MsgPort of the default filesystem for the process
  4599.  
  4600.    RESULT
  4601.     oldport - The previous FileSysTask value
  4602.  
  4603.    SEE ALSO
  4604.     GetFileSysTask(), Open()
  4605.  
  4606. dos.library/SetIoErr                                     dos.library/SetIoErr
  4607.  
  4608.    NAME
  4609.     SetIoErr -- Sets the value returned by IoErr() (V36)
  4610.  
  4611.    SYNOPSIS
  4612.     oldcode = SetIoErr(code)
  4613.     D0            D1
  4614.  
  4615.     LONG SetIoErr(LONG);
  4616.  
  4617.    FUNCTION
  4618.     This routine sets up the secondary result (pr_Result2) return code 
  4619.     (returned by the IoErr() function).
  4620.  
  4621.    INPUTS
  4622.     code - Code to be returned by a call to IoErr.
  4623.  
  4624.    RESULT
  4625.     oldcode - The previous error code.
  4626.  
  4627.    SEE ALSO
  4628.     IoErr(), Fault(), PrintFault()
  4629.  
  4630. dos.library/SetMode                                       dos.library/SetMode
  4631.  
  4632.    NAME
  4633.     SetMode - Set the current behavior of a handler (V36)
  4634.  
  4635.    SYNOPSIS
  4636.     success = SetMode(fh, mode)
  4637.     D0                D1  D2
  4638.  
  4639.     BOOL SetMode(BPTR, LONG)
  4640.  
  4641.    FUNCTION
  4642.     SetMode() sends an ACTION_SCREEN_MODE packet to the handler in
  4643.     question, normally for changing a CON: handler to raw mode or
  4644.     vice-versa.  For CON:, use 1 to go to RAW: mode, 0 for CON: mode.
  4645.  
  4646.    INPUTS
  4647.     fh   - filehandle
  4648.     mode - The new mode you want
  4649.  
  4650.    RESULT
  4651.     success - Boolean
  4652.  
  4653.    SEE ALSO
  4654.  
  4655. dos.library/SetProgramDir                           dos.library/SetProgramDir
  4656.  
  4657.    NAME
  4658.     SetProgramDir -- Sets the directory returned by GetProgramDir (V36)
  4659.  
  4660.    SYNOPSIS
  4661.     oldlock = SetProgramDir(lock)
  4662.     D0                 D1
  4663.  
  4664.     BPTR SetProgramDir(BPTR)
  4665.  
  4666.    FUNCTION
  4667.     Sets a shared lock on the directory the program was loaded from.
  4668.     This can be used for a program to find data files, etc, that are
  4669.     stored with the program, or to find the program file itself.  NULL
  4670.     is a valid input.  This can be accessed via GetProgramDir() or
  4671.     by using paths relative to PROGDIR:.
  4672.  
  4673.    INPUTS
  4674.     lock - A lock on the directory the current program was loaded from
  4675.  
  4676.    RESULT
  4677.     oldlock - The previous ProgramDir.
  4678.  
  4679.    SEE ALSO
  4680.     GetProgramDir(), Open()
  4681.  
  4682. dos.library/SetProgramName                         dos.library/SetProgramName
  4683.  
  4684.    NAME
  4685.     SetProgramName -- Sets the name of the program being run (V36)
  4686.  
  4687.    SYNOPSIS
  4688.     success = SetProgramName(name)
  4689.     D0                        D1
  4690.  
  4691.     BOOL SetProgramName(STRPTR)
  4692.  
  4693.    FUNCTION
  4694.     Sets the name for the program in the cli structure.  If the name is 
  4695.     too long to fit, a failure is returned, and the old value is left
  4696.     intact.  It is advised that you inform the user if possible of this
  4697.     condition, and/or set the program name to an empty string.
  4698.     This routine is safe to call even if there is no CLI structure.
  4699.  
  4700.    INPUTS
  4701.     name    - Name of program to use.
  4702.  
  4703.    RESULT
  4704.     success - Success/failure indicator.
  4705.  
  4706.    BUGS
  4707.     This clips to a fixed (1.3 compatible) size.
  4708.  
  4709.    SEE ALSO
  4710.     GetProgramName()
  4711.  
  4712. dos.library/SetPrompt                                   dos.library/SetPrompt
  4713.  
  4714.    NAME
  4715.     SetPrompt -- Sets the CLI/shell prompt for the current process (V36)
  4716.  
  4717.    SYNOPSIS
  4718.     success = SetPrompt(name)
  4719.     D0                D1
  4720.  
  4721.     BOOL SetPrompt(STRPTR)
  4722.  
  4723.    FUNCTION
  4724.     Sets the text for the prompt in the cli structure.  If the prompt is 
  4725.     too long to fit, a failure is returned, and the old value is left
  4726.     intact.  It is advised that you inform the user of this condition.
  4727.     This routine is safe to call even if there is no CLI structure.
  4728.  
  4729.    INPUTS
  4730.     name    - Name of prompt to be set.
  4731.  
  4732.    RESULT
  4733.     success - Success/failure indicator.
  4734.  
  4735.    BUGS
  4736.     This clips to a fixed (1.3 compatible) size.
  4737.  
  4738.    SEE ALSO
  4739.     GetPrompt()
  4740.  
  4741. dos.library/SetProtection                           dos.library/SetProtection
  4742.  
  4743.     NAME
  4744.     SetProtection -- Set protection for a file or directory
  4745.  
  4746.     SYNOPSIS
  4747.     success = SetProtection( name, mask )
  4748.     D0             D1    D2:4
  4749.  
  4750.     BOOL SetProtection (STRPTR, LONG)
  4751.  
  4752.     FUNCTION
  4753.     SetProtection() sets the protection attributes on a file or
  4754.     directory. The lower bits of the mask are as follows:
  4755.  
  4756.     bit 4: 1 = file has not changed     0 = file has been changed
  4757.     bit 3: 1 = reads not allowed,        0 = reads allowed.
  4758.     bit 2: 1 = writes not allowed,        0 = writes allowed.
  4759.     bit 1: 1 = execution not allowed,    0 = execution allowed.
  4760.     bit 0: 1 = deletion not allowed,    0 = deletion allowed.
  4761.  
  4762.     Before V36, the ROM filesystem didn't respect the Read and Write
  4763.     bits.  In V36 or later and in the FFS, the Read and Write
  4764.     bits are respected.
  4765.  
  4766.     The archive bit should be cleared by the filesystem whenever the file
  4767.     is changed.  Backup utilities will generally set the bit after
  4768.     backing up each file.
  4769.  
  4770.     The V36 Shell looks at the execute bit, and will refuse to execute
  4771.     a file if it is set.
  4772.  
  4773.     Other bits will be defined in the <dos/dos.h> include files.  Rather
  4774.     than referring to bits by number you should use the definitions in
  4775.     <dos/dos.h>.
  4776.  
  4777.     INPUTS
  4778.     name - pointer to a null-terminated string
  4779.     mask - the protection mask required
  4780.  
  4781.     RESULTS
  4782.     success - boolean
  4783.  
  4784.     SEE ALSO
  4785.     SetComment(), Examine(), ExNext(), <dos/dos.h>
  4786.  
  4787. dos.library/SetVar                                         dos.library/SetVar
  4788.  
  4789.    NAME
  4790.     SetVar -- Sets a local or environment variable (V36)
  4791.  
  4792.    SYNOPSIS
  4793.     success = SetVar( name, buffer, size, flags ) 
  4794.     D0               D1     D2     D3    D4
  4795.  
  4796.     BOOL SetVar(STRPTR, STRPTR, LONG, ULONG ) 
  4797.  
  4798.    FUNCTION
  4799.     Sets a local or environment variable.  It is advised to only use
  4800.     ASCII strings inside variables, but not required.
  4801.  
  4802.    INPUTS
  4803.     name   - pointer to an variable name.  Note variable names follow
  4804.          filesystem syntax and semantics.
  4805.     buffer - a user allocated area which contains a string that is the
  4806.          value to be associated with this variable.
  4807.     size   - length of the buffer region in bytes.  -1 means buffer
  4808.          contains a null-terminated string.
  4809.     flags  - combination of type of var to set (low 8 bits), and
  4810.          flags to control the behavior of this routine.  Currently
  4811.          defined flags include:
  4812.  
  4813.         GVF_LOCAL_ONLY - set a local (to your process) variable.
  4814.         GVF_GLOBAL_ONLY - set a global environment variable.
  4815.  
  4816.         The default is to set a local environment variable.
  4817.  
  4818.    RESULT
  4819.     success - If non-zero, the variable was sucessfully set, FALSE
  4820.            indicates failure.
  4821.  
  4822.    BUGS
  4823.     LV_VAR is the only type that can be global
  4824.  
  4825.    SEE ALSO
  4826.     GetVar(), DeleteVar(), FindVar(), <dos/var.h>
  4827.  
  4828. dos.library/SetVBuf                                       dos.library/SetVBuf
  4829.  
  4830.    NAME
  4831.     SetVBuf -- set buffering modes and size (V36)
  4832.  
  4833.    SYNOPSIS
  4834.     error = SetVBuf(fh, buff, type, size)
  4835.     D0        D1   D2    D3    D4
  4836.  
  4837.     LONG SetVBuf(BPTR, STRPTR, LONG, LONG)
  4838.  
  4839.    FUNCTION
  4840.     Changes the buffering modes and buffer size for a filehandle.
  4841.     With buff == NULL, the current buffer will be deallocated and a
  4842.     new one of (approximately) size will be allocated.  If buffer is
  4843.     non-NULL, it will be used for buffering and must be at least
  4844.     max(size,208) bytes long.  If buff is NULL and size is -1,
  4845.     then only the buffering mode will be changed.
  4846.  
  4847.    INPUTS
  4848.     fh   - Filehandle
  4849.     buff - buffer pointer for buffered I/O
  4850.     type - buffering mode (see <dos/stdio.h>)
  4851.     size - size of buffer for buffered I/O (sizes less than 208 bytes
  4852.            will be ignored).
  4853.  
  4854.    RESULT
  4855.     error - 0 if successful.  NOTE: opposite of most dos functions!
  4856.  
  4857.    BUGS
  4858.     Not implemented yet, always returns 0.
  4859.  
  4860.    SEE ALSO
  4861.     FputC(), FGetC(), UnGetC(), Flush(), FRead(), FWrite(), FGets(),
  4862.     FPuts().
  4863.  
  4864. dos.library/SplitName                                   dos.library/SplitName
  4865.  
  4866.    NAME
  4867.     SplitName -- splits out a component of a pathname into a buffer (V36)
  4868.  
  4869.    SYNOPSIS
  4870.     newpos = SplitName(name, separator, buf, oldpos, size)
  4871.     D0                  D1      D2      D3     D4     D5
  4872.  
  4873.     WORD SplitName(STRPTR, UBYTE, STRPTR, WORD, LONG)
  4874.  
  4875.    FUNCTION
  4876.     This routine splits out the next piece of a name from a given file
  4877.     name.  Each piece is copied into the buffer, truncating at size-1
  4878.     characters.  The new position is then returned so that it may be
  4879.     passed in to the next call to splitname.  If the separator is not
  4880.     found within 'size' characters, then size-1 characters plus a null will
  4881.     be put into the buffer, and the position of the next separator will
  4882.     be returned.
  4883.  
  4884.     If a a separator cannot be found, -1 is returned (but the characters
  4885.     from the old position to the end of the string are copied into the
  4886.     buffer, up to a maximum of size-1 characters).  Both strings are
  4887.     null-terminated.
  4888.  
  4889.     This function is mainly intended to support handlers.
  4890.  
  4891.    INPUTS
  4892.     name      - Filename being parsed.
  4893.     separator - Separator charactor to split by.
  4894.     buf       - Buffer to hold separated name.
  4895.     oldpos    - Current position in the file.
  4896.     size       - Size of buf in bytes (including null termination);
  4897.  
  4898.    RESULT
  4899.     newpos    - New position for next call to splitname.  -1 for last one.
  4900.  
  4901.    SEE ALSO
  4902.     FilePart(), PathPart(), AddPart()
  4903.  
  4904. dos.library/StartNotify                               dos.library/StartNotify
  4905.  
  4906.    NAME
  4907.     StartNotify -- Starts notification on a file or directory (V36)
  4908.  
  4909.    SYNOPSIS
  4910.     success = StartNotify(notifystructure)
  4911.     D0                          D1
  4912.  
  4913.     BOOL StartNotify(struct NotifyRequest *)
  4914.  
  4915.    FUNCTION
  4916.     Posts a notification request.  Do not modify the notify structure while
  4917.     it is active.  You will be notified when the file or directory changes.
  4918.     For files, you will be notified after the file is closed.  Not all
  4919.     filesystems will support this: applications should NOT require it.  In
  4920.     particular, most network filesystems won't support it.
  4921.  
  4922.    INPUTS
  4923.     notifystructure - A filled-in NotifyRequest structure
  4924.  
  4925.    RESULT
  4926.     success - Success/failure of request
  4927.  
  4928.    BUGS
  4929.     The V36 floppy/HD filesystem doesn't actually send notifications.  The
  4930.     V36 ram handler (ram:) does.  This has been fixed for V37.
  4931.  
  4932.    SEE ALSO
  4933.     EndNotify(), <dos/notify.h>
  4934.  
  4935. dos.library/StrToDate                                   dos.library/StrToDate
  4936.  
  4937.    NAME
  4938.     StrToDate -- Converts a string to a DateStamp (V36)
  4939.  
  4940.    SYNOPSIS
  4941.     success = StrToDate( datetime )
  4942.     D0                      D1
  4943.  
  4944.     BOOL StrToDate( struct DateTime * )
  4945.  
  4946.    FUNCTION
  4947.     Converts a human readable ASCII string into an AmigaDOS
  4948.     DateStamp.
  4949.  
  4950.    INPUTS
  4951.     DateTime - a pointer to an initialized DateTime structure.
  4952.  
  4953.     The DateTime structure should    be initialized as follows:
  4954.  
  4955.     dat_Stamp  - ignored on input.
  4956.  
  4957.     dat_Format - a format    byte which specifies the format    of the
  4958.         dat_StrDat.  This can    be any of the following    (note:
  4959.         If value used    is something other than    those below,
  4960.         the default of FORMAT_DOS is used):
  4961.  
  4962.         FORMAT_DOS:      AmigaDOS format (dd-mmm-yy).
  4963.  
  4964.         FORMAT_INT:      International    format (yy-mmm-dd).
  4965.  
  4966.         FORMAT_USA:      American format (mm-dd-yy).
  4967.  
  4968.         FORMAT_CDN:      Canadian format (dd-mm-yy).
  4969.  
  4970.         FORMAT_DEF:      default format for locale.
  4971.  
  4972.     dat_Flags - a flags byte.  The only flag which affects this
  4973.           function is:
  4974.  
  4975.         DTF_SUBST:    ignored by this function
  4976.         DTF_FUTURE:      If set, indicates that strings such
  4977.                   as (stored in    dat_StrDate) "Monday"
  4978.                   refer    to "next" monday. Otherwise,
  4979.                   if clear, strings like "Monday"
  4980.                   refer    to "last" monday.
  4981.  
  4982.     dat_StrDay - ignored bythis function.
  4983.  
  4984.     dat_StrDate -    pointer    to valid string    representing the date.
  4985.           This can be a    "DTF_SUBST" style string such as
  4986.           "Today" "Tomorrow" "Monday", or it may be a string
  4987.           as specified by the dat_Format byte.    This will be
  4988.           converted to the ds_Days portion of the DateStamp.
  4989.           If this pointer is NULL, DateStamp->ds_Days will not
  4990.           be affected.
  4991.  
  4992.     dat_StrTime -    Pointer    to a buffer which contains the time in
  4993.           the ASCII format hh:mm:ss.  This will    be converted
  4994.           to the ds_Minutes and    ds_Ticks portions of the
  4995.           DateStamp.  If this pointer is NULL, ds_Minutes and
  4996.           ds_Ticks will    be unchanged.
  4997.  
  4998.    RESULT
  4999.     success    - a zero return indicates that a conversion could
  5000.         not be performed. A non-zero return indicates that the
  5001.         DateTime.dat_Stamp variable contains the converted
  5002.         values.
  5003.  
  5004.    SEE ALSO
  5005.     DateStamp(), DateToStr(), <dos/datetime.h>
  5006.  
  5007. dos.library/StrToLong                                   dos.library/StrToLong
  5008.  
  5009.    NAME
  5010.     StrToLong -- string to long value (decimal) (V36)
  5011.  
  5012.    SYNOPSIS
  5013.     characters = StrToLong(string,value)
  5014.     D0                       D1    D2
  5015.  
  5016.     LONG StrToLong(STRPTR, LONG *)
  5017.  
  5018.    FUNCTION
  5019.     Converts decimal string into LONG value.  Returns number of characters
  5020.     converted.  Skips over leading spaces & tabs (included in count).  If
  5021.     no decimal digits are found (after skipping leading spaces & tabs),
  5022.     StrToLong returns -1 for characters converted, and puts 0 into value.
  5023.  
  5024.    INPUTS
  5025.     string - Input string.
  5026.     value  - Pointer to long value.  Set to 0 if no digits are converted.
  5027.  
  5028.    RESULT
  5029.     result - Number of characters converted or -1.
  5030.  
  5031. dos.library/SystemTagList                           dos.library/SystemTagList
  5032.  
  5033.    NAME
  5034.     SystemTagList -- Have a shell execute a command line (V36)
  5035.  
  5036.    SYNOPSIS
  5037.     error = SystemTagList(command, tags)
  5038.     D0                D1      D2 
  5039.  
  5040.     LONG SystemTagList(STRPTR, struct TagItem *)
  5041.  
  5042.     error = System(command, tags)
  5043.     D0         D1      D2 
  5044.  
  5045.     LONG System(STRPTR, struct TagItem *)
  5046.  
  5047.     error = SystemTags(command, Tag1, ...)
  5048.  
  5049.     LONG SystemTags(STRPTR, ULONG, ...)
  5050.  
  5051.    FUNCTION
  5052.     Similar to Execute(), but does not read commands from the input
  5053.     filehandle.  Spawns a Shell process to execute the command, and
  5054.     returns the returncode the command produced, or -1 if the command
  5055.     could not be run for any reason.  The input and output filehandles
  5056.     will not be closed by System, you must close them (if needed) after
  5057.     System returns, if you specified them via SYS_INPUT or SYS_OUTPUT.
  5058.  
  5059.     By default the new process will use your current Input() and Output()
  5060.     filehandles.  Normal Shell command-line parsing will be done
  5061.     including redirection on 'command'.  The current directory and path
  5062.     will be inherited from your process.  Your path will be used to find
  5063.     the command (if no path is specified).
  5064.  
  5065.     If used with the SYS_Asynch flag, it WILL close both it's input and
  5066.     output filehandles after running the command (even if these were
  5067.     your Input() and Output()!)
  5068.  
  5069.     Normally uses the boot (ROM) shell, but other shells can be specified
  5070.     via SYS_UserShell and SYS_CustomShell.  Normally, you should send
  5071.     things written by the user to the UserShell.  The UserShell defaults
  5072.     to the same shell as the boot shell.
  5073.  
  5074.     The tags are passed through to CreateNewProc() (tags that conflict
  5075.     with SystemTagList() will be filtered out).  This allows setting
  5076.     things like priority, etc for the new process.
  5077.  
  5078.    INPUTS
  5079.     command - Program and arguments
  5080.     tags    - see <dos/dostags.h>.  Note that both SystemTagList()-
  5081.           specific tags and tags from CreateNewProc() may be passed.
  5082.  
  5083.    RESULT
  5084.     error    - 0 for success, result from command, or -1.  Note that on
  5085.           error, the caller is responsible for any filehandles or other
  5086.           things passed in via tags.
  5087.  
  5088.    SEE ALSO
  5089.     Execute(), CreateNewProc(), <dos/dostags.h>, Input(), Output()
  5090.  
  5091. dos.library/UnGetC                                         dos.library/UnGetC
  5092.  
  5093.    NAME
  5094.     UnGetC -- Makes a char available for reading again. (buffered) (V36)
  5095.  
  5096.    SYNOPSIS
  5097.     value = UnGetC(fh, character)
  5098.     D0           D1      D2
  5099.  
  5100.     LONG UnGetC(BPTR, LONG)
  5101.  
  5102.    FUNCTION
  5103.     Pushes the character specified back into the input buffer.  Every
  5104.     time you use a buffered read routine, you can always push back 1
  5105.     character.  You may be able to push back more, though it is not
  5106.     recommended, since there is no guarantee on how many can be
  5107.     pushed back at a given moment.
  5108.  
  5109.     Passing -1 for the character will cause the last character read to
  5110.     be pushed back.  If the last character read was an EOF, the next
  5111.     character read will be an EOF.
  5112.  
  5113.     Note: UnGetC can be used to make sure that a filehandle is set up
  5114.     as a read filehandle.  This is only of importance if you are writing
  5115.     a shell, and must manipulate the filehandle's buffer.
  5116.  
  5117.    INPUTS
  5118.     fh      - filehandle to use for buffered I/O
  5119.     character - character to push back or -1
  5120.  
  5121.    RESULT
  5122.     value     - character pushed back, or FALSE if the character cannot
  5123.             be pushed back.
  5124.  
  5125.    BUGS
  5126.     In V36, UnGetC(fh,-1) after an EOF would not cause the next character
  5127.     read to be an EOF.  This was fixed for V37.
  5128.  
  5129.    SEE ALSO
  5130.     FGetC(), FPutC(), Flush()
  5131.  
  5132. dos.library/UnLoadSeg                                   dos.library/UnLoadSeg
  5133.  
  5134.     NAME
  5135.     UnLoadSeg -- Unload a seglist previously loaded by LoadSeg()
  5136.  
  5137.     SYNOPSIS
  5138.     success = UnLoadSeg( seglist )
  5139.     D0               D1
  5140.  
  5141.     BOOL UnLoadSeg(BPTR)
  5142.  
  5143.     FUNCTION
  5144.     Unload a seglist loaded by LoadSeg().  'seglist' may be zero.
  5145.     Overlaid segments will have all needed cleanup done, including
  5146.     closing files.
  5147.  
  5148.     INPUTS
  5149.     seglist - BCPL pointer to a segment identifier
  5150.  
  5151.     RESULTS
  5152.     success - returns 0 if a NULL seglist was passed or if it failed
  5153.           to close an overlay file.  NOTE: this function returned
  5154.           a random value before V36!
  5155.  
  5156.     SEE ALSO
  5157.     LoadSeg(), InternalLoadSeg(), InternalUnLoadSeg()
  5158.  
  5159. dos.library/UnLock                                         dos.library/UnLock
  5160.  
  5161.     NAME
  5162.     UnLock -- Unlock a directory or file
  5163.  
  5164.     SYNOPSIS
  5165.     UnLock( lock )
  5166.         D1
  5167.  
  5168.     void UnLock(BPTR)
  5169.  
  5170.     FUNCTION
  5171.     The filing system lock (obtained from Lock(), DupLock(), or
  5172.     CreateDir()) is removed and deallocated.
  5173.  
  5174.     INPUTS
  5175.     lock - BCPL pointer to a lock
  5176.  
  5177.     NOTE
  5178.     passing zero to UnLock() is harmless
  5179.  
  5180.     SEE ALSO
  5181.     Lock(), DupLock(), ParentOfFH(), DupLockFromFH()
  5182.  
  5183. dos.library/UnLockDosList                           dos.library/UnLockDosList
  5184.  
  5185.    NAME
  5186.     UnLockDosList -- Unlocks the Dos List (V36)
  5187.  
  5188.    SYNOPSIS
  5189.     UnLockDosList(flags)
  5190.             D1
  5191.  
  5192.     void UnLockDosList(ULONG)
  5193.  
  5194.    FUNCTION
  5195.     Unlocks the access on the Dos Device List.  You MUST pass the same
  5196.     flags you used to lock the list.
  5197.  
  5198.    INPUTS
  5199.     flags - MUST be the same flags passed to (Attempt)LockDosList()
  5200.  
  5201.    SEE ALSO
  5202.     AttemptLockDosList(), LockDosList(), Permit()
  5203.  
  5204. dos.library/UnLockRecord                             dos.library/UnLockRecord
  5205.  
  5206.    NAME
  5207.     UnLockRecord -- Unlock a record (V36)
  5208.  
  5209.    SYNOPSIS
  5210.     success = UnLockRecord(fh,offset,length)
  5211.     D0               D1   D2     D3
  5212.  
  5213.     BOOL UnLockRecord(BPTR,ULONG,ULONG)
  5214.  
  5215.    FUNCTION
  5216.     This releases the specified lock on a file.  Note that you must use
  5217.     the same filehandle you used to lock the record, and offset and length
  5218.     must be the same values used to lock it.  Every LockRecord() call must
  5219.     be balanced with an UnLockRecord() call.
  5220.  
  5221.    INPUTS
  5222.     fh      - File handle of locked file
  5223.     offset  - Record start position
  5224.     length  - Length of record in bytes
  5225.  
  5226.    RESULT
  5227.     success - Success or failure.
  5228.  
  5229.    BUGS
  5230.     See LockRecord()
  5231.  
  5232.    SEE ALSO
  5233.     LockRecords(), LockRecord(), UnLockRecords()
  5234.  
  5235. dos.library/UnLockRecords                           dos.library/UnLockRecords
  5236.  
  5237.    NAME
  5238.     UnLockRecords -- Unlock a list of records (V36)
  5239.  
  5240.    SYNOPSIS
  5241.     success = UnLockRecords(record_array)
  5242.     D0                     D1
  5243.  
  5244.     BOOL UnLockRecords(struct RecordLock *)
  5245.  
  5246.    FUNCTION
  5247.     This releases an array of record locks obtained using LockRecords.
  5248.     You should NOT modify the record_array while you have the records
  5249.     locked.  Every LockRecords() call must be balanced with an
  5250.     UnLockRecords() call.
  5251.  
  5252.    INPUTS
  5253.     record_array - List of records to be unlocked
  5254.  
  5255.    RESULT
  5256.     success      - Success or failure.
  5257.  
  5258.    BUGS
  5259.     See LockRecord()
  5260.  
  5261.    SEE ALSO
  5262.     LockRecords(), LockRecord(), UnLockRecord()
  5263.  
  5264. dos.library/VFPrintf                                     dos.library/VFPrintf
  5265.  
  5266.    NAME
  5267.     VFPrintf -- format and print a string to a file (buffered) (V36)
  5268.  
  5269.    SYNOPSIS
  5270.     count = VFPrintf(fh, fmt, argv)
  5271.     D0               D1  D2    D3
  5272.  
  5273.     LONG VFPrintf(BPTR, STRPTR, LONG *)
  5274.  
  5275.     count = FPrintf(fh, fmt, ...)
  5276.  
  5277.     LONG FPrintf(BPTR, STRPTR, ...)
  5278.  
  5279.    FUNCTION
  5280.     Writes the formatted string and values to the given file.  This
  5281.     routine is assumed to handle all internal buffering so that the
  5282.     formatting string and resultant formatted values can be arbitrarily
  5283.     long.  Any secondary error code is returned in IoErr().  This routine
  5284.     is buffered.
  5285.  
  5286.    INPUTS
  5287.     fh    - Filehandle to write to
  5288.     fmt   - RawDoFmt() style formatting string
  5289.     argv  - Pointer to array of formatting values
  5290.  
  5291.    RESULT
  5292.     count - Number of bytes written or -1 (EOF) for an error
  5293.  
  5294.    BUGS
  5295.     The prototype for FPrintf() currently forces you to cast the first
  5296.     varargs parameter to LONG due to a deficiency in the program
  5297.     that generates fds, prototypes, and amiga.lib stubs.
  5298.  
  5299.    SEE ALSO
  5300.     VPrintf(), VFWritef(), RawDoFmt(), FPutC()
  5301.  
  5302. dos.library/VFWritef                                     dos.library/VFWritef
  5303.  
  5304.    NAME
  5305.     VFWritef - write a BCPL formatted string to a file (buffered) (V36)
  5306.  
  5307.    SYNOPSIS
  5308.     count = VFWritef(fh, fmt, argv)
  5309.     D0               D1  D2    D3
  5310.  
  5311.     LONG VFWritef(BPTR, STRPTR, LONG *)
  5312.  
  5313.     count = FWritef(fh, fmt, ...)
  5314.  
  5315.     LONG FWritef(BPTR, STRPTR, ...)
  5316.  
  5317.    FUNCTION
  5318.     Writes the formatted string and values to the default output.  This
  5319.     routine is assumed to handle all internal buffering so that the
  5320.     formatting string and resultant formatted values can be arbitrarily
  5321.     long.  The formats are in BCPL form.  This routine is buffered.
  5322.  
  5323.     Supported formats are:  (Note x is in base 36!)
  5324.         %S  - string (CSTR)
  5325.         %Tx - writes a left-justified string in a field at least
  5326.               x bytes long.
  5327.         %C  - writes a single character
  5328.         %Ox - writes a number in octal, maximum x characters wide
  5329.         %Xx - writes a number in hex, maximum x characters wide
  5330.         %Ix - writes a number in decimal, maximum x characters wide
  5331.         %N  - writes a number in decimal, any length
  5332.         %Ux - writes an unsigned number, maximum x characters wide
  5333.         %$  - ignore parameter
  5334.  
  5335.     Note: 'x' above is actually the character value - '0'.
  5336.  
  5337.    INPUTS
  5338.     fmt   - BCPL style formatting string
  5339.     argv  - Pointer to array of formatting values
  5340.  
  5341.    RESULT
  5342.     count - Number of bytes written or -1 for error
  5343.  
  5344.    BUGS
  5345.     As of V37, VFWritef() does NOT return a valid return value.  In
  5346.     order to reduce possible errors, the prototypes supplied for the
  5347.     system as of V37 have it typed as VOID.
  5348.  
  5349.    SEE ALSO
  5350.     VFPrintf(), VFPrintf(), FPutC()
  5351.  
  5352. dos.library/VPrintf                                       dos.library/VPrintf
  5353.  
  5354.    NAME
  5355.     VPrintf -- format and print string (buffered) (V36)
  5356.  
  5357.    SYNOPSIS
  5358.     count = VPrintf(fmt, argv)
  5359.       D0            D1   D2
  5360.  
  5361.     LONG VPrintf(STRPTR, LONG *)
  5362.  
  5363.     count = Printf(fmt, ...)
  5364.  
  5365.     LONG Printf(STRPTR, ...)
  5366.  
  5367.    FUNCTION
  5368.     Writes the formatted string and values to Output().  This routine is 
  5369.     assumed to handle all internal buffering so that the formatting string
  5370.     and resultant formatted values can be arbitrarily long.  Any secondary
  5371.     error code is returned in IoErr().  This routine is buffered.
  5372.  
  5373.     Note: RawDoFmt assumes 16 bit ints, so you will usually need 'l's in
  5374.     your formats (ex: %ld versus %d).
  5375.  
  5376.    INPUTS
  5377.     fmt   - exec.library RawDoFmt() style formatting string
  5378.     argv  - Pointer to array of formatting values
  5379.    
  5380.    RESULT
  5381.     count - Number of bytes written or -1 (EOF) for an error
  5382.  
  5383.    BUGS
  5384.     The prototype for Printf() currently forces you to cast the first
  5385.     varargs parameter to LONG due to a deficiency in the program
  5386.     that generates fds, prototypes, and amiga.lib stubs.
  5387.  
  5388.    SEE ALSO
  5389.     VFPrintf(), VFWritef(), RawDoFmt(), FPutC()
  5390.  
  5391. dos.library/WaitForChar                               dos.library/WaitForChar
  5392.  
  5393.     NAME
  5394.     WaitForChar -- Determine if chars arrive within a time limit
  5395.  
  5396.     SYNOPSIS
  5397.     status = WaitForChar( file, timeout )
  5398.     D0              D1    D2
  5399.  
  5400.     BOOL WaitForChar(BPTR, LONG)
  5401.  
  5402.     FUNCTION
  5403.     If a character is available to be read from 'file' within a the
  5404.     time (in microseconds) indicated by 'timeout', WaitForChar()
  5405.     returns -1 (TRUE). If a character is available, you can use Read()
  5406.     to read it.  Note that WaitForChar() is only valid when the I/O
  5407.     stream is connected to a virtual terminal device. If a character is
  5408.     not available within 'timeout', a 0 (FALSE) is returned.
  5409.  
  5410.     BUGS
  5411.     Due to a bug in the timer.device in V1.2/V1.3, specifying a timeout
  5412.     of zero for WaitForChar() can cause the unreliable timer & floppy
  5413.     disk operation.
  5414.  
  5415.     INPUTS
  5416.     file - BCPL pointer to a file handle
  5417.     timeout - integer
  5418.  
  5419.     RESULTS
  5420.     status - boolean
  5421.  
  5422.     SEE ALSO
  5423.     Read(), FGetC()
  5424.  
  5425. dos.library/WaitPkt                                       dos.library/WaitPkt
  5426.  
  5427.    NAME
  5428.     WaitPkt -- Waits for a packet to arrive at your pr_MsgPort (V36)
  5429.  
  5430.    SYNOPSIS
  5431.     packet = WaitPkt()
  5432.     D0
  5433.  
  5434.     struct DosPacket *WaitPkt(void);
  5435.  
  5436.    FUNCTION
  5437.     Waits for a packet to arrive at your pr_MsgPort.  If anyone has
  5438.     installed a packet wait function in pr_PktWait, it will be called.
  5439.     The message will be automatically GetMsg()ed so that it is no longer
  5440.     on the port.  It assumes the message is a dos packet.  It is NOT
  5441.     guaranteed to clear the signal for the port.
  5442.  
  5443.    RESULT
  5444.     packet - the packet that arrived at the port (from ln_Name of message).
  5445.  
  5446.    SEE ALSO
  5447.     SendPkt(), DoPkt(), AbortPkt()
  5448.  
  5449. dos.library/Write                                           dos.library/Write
  5450.  
  5451.     NAME
  5452.     Write -- Write bytes of data to a file
  5453.  
  5454.     SYNOPSIS
  5455.     returnedLength =  Write( file, buffer, length )
  5456.     D0             D1    D2      D3
  5457.  
  5458.     LONG Write (BPTR, void *, LONG)
  5459.  
  5460.     FUNCTION
  5461.     Write() writes bytes of data to the opened file 'file'. 'length'
  5462.     indicates the length of data to be transferred; 'buffer' is a
  5463.     pointer to the buffer. The value returned is the length of
  5464.     information actually written. So, when 'length' is greater than
  5465.     zero, the value of 'length' is the number of characters written.
  5466.     Errors are indicated by a value of -1.
  5467.  
  5468.     Note: this is an unbuffered routine (the request is passed directly
  5469.     to the filesystem.)  Buffered I/O is more efficient for small
  5470.     reads and writes; see FPutC().
  5471.  
  5472.     INPUTS
  5473.     file - BCPL pointer to a file handle
  5474.     buffer - pointer to the buffer
  5475.     length - integer
  5476.  
  5477.     RESULTS
  5478.     returnedLength - integer
  5479.  
  5480.     SEE ALSO
  5481.     Read(), Seek(), Open(), Close(), FPutC
  5482.  
  5483. dos.library/WriteChars                                 dos.library/WriteChars
  5484.  
  5485.    NAME
  5486.     WriteChars -- Writes bytes to the the default output (buffered) (V36)
  5487.  
  5488.    SYNOPSIS
  5489.     count = WriteChars(buf, buflen)
  5490.     D0                 D1
  5491.  
  5492.     LONG WriteChars(STRPTR, LONG)
  5493.  
  5494.    FUNCTION
  5495.     This routine writes a number of bytes to the default output.  The
  5496.     length is returned.  This routine is buffered.
  5497.  
  5498.    INPUTS
  5499.     buf    - buffer of characters to write
  5500.     buflen - number of characters to write
  5501.  
  5502.    RESULT
  5503.     count - Number of bytes written.  -1 (EOF) indicates an error
  5504.  
  5505.    SEE ALSO
  5506.     FPuts(), FPutC(), FWrite(), PutStr()
  5507.  
  5508.