| dos
Index
void AbortPkt(
struct MsgPort * port,
struct DosPacket * pkt );
LONG AddBuffers(
CONST_STRPTR devicename,
LONG numbuffers );
Add or remove cache memory from a filesystem.
devicename -- NUL terminated dos device name.
numbuffers -- Number of buffers to add. May be negative.
!= 0 on success (IoErr() gives the actual number of buffers),
0 else (IoErr() gives the error code).
LONG AddDosEntry(
struct DosList * dlist );
Adds a given dos list entry to the dos list. Automatically
locks the list for writing. There may be not more than one device
or assign node of the same name. There are no restrictions on
volume nodes.
dlist - pointer to dos list entry.
!= 0 if all went well, 0 otherwise.
Since anybody who wants to use a device or volume node in the
dos list has to lock the list, filesystems may be called with
the dos list locked. So if you want to add a dos list entry
out of a filesystem don't just wait on the lock but serve all
incoming requests until the dos list is free instead.
BOOL AddPart(
STRPTR dirname,
CONST_STRPTR filename,
ULONG size );
AddPart() will add a file, directory or other path name to a
directory path. It will take into account any pre-existing
separator characters (':','/').
If filename is a fully qualified path, then it will replace
the current value of dirname.
dirname - the path to add the new path to
filename - the path you wish added
size - The size of the dirname buffer (must NOT be 0)
Non-zero if everything succeeded, FALSE if the buffer would have
overflowed.
If the buffer would have overflowed, then dirname will not have
been changed.
UBYTE buffer[80];
buffer[0]='\0';
AddPart(buffer, "Work:", 80);
AddPart(buffer, "Programming/Include/exec", 80);
FPuts(Output(), buffer);
--> Work:Programming/Include/exec
AddPart(buffer, "/graphics", 80);
FPuts(Output(), buffer);
--> Work:Programming/Include/graphics
AddPart(buffer, "gfxmacros.h", 80);
FPuts(Output(), buffer);
--> Work:Programming/Include/graphics/gfxmacros.h
BOOL AddSegment(
CONST_STRPTR name,
BPTR seg,
LONG type );
Adds a program segment to the system resident list. You can later
use these segments to run programs.
The name field should refer to a NULL terminated strings, which
will be copied. The type field determines the type of resident
program. Normal programs should have type >= 0, system segments
should have type == CMD_SYSTEM.
Note that all other values of type are reserved.
name - Name of the segment. This is used by FindSegment().
seg - Segment to add.
type - What type of segment (initial use count).
Segment will have been added to the DOS resident list.
!= 0 success
== 0 failure
Uses Forbid() based locking.
FindSegment(), RemSegment()
APTR AllocDosObject(
ULONG type,
const struct TagItem * tags );
Creates a new dos object of a given type. This memory has to be
freed with FreeDosObject().
type - Object type.
tags - Pointer to taglist array with additional information. See
<dos/dostags.h> for a list of all supported tags.
Pointer to new object or NULL, to indicate an error.
BOOL AssignAdd(
CONST_STRPTR name,
BPTR lock );
Create a multi-directory assign, or adds to it if it already was one.
Do not use or free the lock after calling this function - it becomes
the assign and will be freed by the system when the assign is removed.
name - NULL terminated name of the assign.
lock - Lock on the assigned directory.
!= 0 success, 0 on failure. IoErr() gives additional information
in that case. The lock is not freed on failure.
This will only work with an assign created with AssignLock() or
a resolved AssignLate() assign.
Lock(), AssignLock(), AssignPath(), AssignLate(), DupLock(),
RemAssignList()
BOOL AssignLate(
CONST_STRPTR name,
CONST_STRPTR path );
Create an assign for the given name, which will be resolved upon the
first reference to it. If this succeeds (i.e. the path exists and
can be locked) it will be turned into an AssignLock() type assign.
This way you can create assigns to unmounted volumes which will only
be requested when accessed.
name -- NULL terminated name of the assign.
path -- NULL terminated path to be resolved on the first reference.
!= 0 success, 0 on failure. IoErr() gives additional information
in that case.
Lock(), AssignAdd(), AssignPath(), AssignLock()
BOOL AssignLock(
CONST_STRPTR name,
BPTR lock );
Create an assign from a given name to a lock. Replaces any older
assignments from that name, 0 cancels the assign completely. Do not
use or free the lock after calling this function - it becomes
the assign and will be freed by the system if the assign is removed.
name -- NUL terminated name of the assign.
lock -- Lock to assigned directory.
!= 0 success, 0 on failure. IoErr() gives additional information
in that case. The lock is not freed on failure.
BOOL AssignPath(
CONST_STRPTR name,
CONST_STRPTR path );
Create an assign for the given name, which will be resolved upon
each reference to it. There will be no permanent lock kept on the
specified path. This way you can create assigns to unmounted volumes
which will only be requested when accessed. Also, using AssignPath()
to assign C: to df0:c would make references go to to df0:c even if
you change the disk.
name -- NULL terminated name of the assign.
path -- NULL terminated path to be resolved on each reference.
!= 0 in case of success, 0 on failure. IoErr() gives additional
information in that case.
AssignAdd(), AssignLock(), AssignLate(), Open()
struct DosList * AttemptLockDosList(
ULONG flags );
Tries to get a lock on some of the dos lists. If all went
well a handle is returned that can be used for FindDosEntry().
Don't try to busy wait until the lock can be granted - use
LockDosList() instead.
flags -- what lists to lock
Handle to the dos list or NULL. This is not a direct pointer
to the first list element but to a pseudo element instead.
BOOL ChangeMode(
ULONG type,
BPTR object,
ULONG newmode );
Try to change the mode used by a lock or filehandle.
type - CHANGE_FH or CHANGE_LOCK.
object - Filehandle or lock.
newmode - New mode (see <dos/dos.h>).
!= 0 if all went well, otherwise 0. IoErr() gives additional
information in the latter case.
Since filehandles and locks are identical under AROS the type
argument is ignored.
LONG CheckSignal(
LONG mask );
Checks the current task to see if any of the signals specified in
the mask have been set. The mask of all signals which were set is
returned. The signals specified in the mask will be cleared.
mask - The signal mask to check.
The mask of all signals which were set.
struct CommandLineInterface * Cli();
Returns a pointer to the CLI structure of the current process.
Pointer to CLI structure.
Do not use this function to test if the process was started from
the shell. Check pr_CLI instead.
IPTR CliInitNewcli(
struct DosPacket * dp );
Set up a process to be a shell using a startup packet.
packet -- startup arguments passed as a packet
This function is obsolete as AROS don't use packets. There is no need
for this function as functionality is added in other places to deal
with things taken care of by this function. Furthermore, the Amiga
startup packet interface was a pile of crap.
IPTR CliInitRun(
struct DosPacket * dp );
Set up a process to be a shell.
dp -- startup arguments specified as a packet
This function is obsolete for the same reasons as CliInitNewCli()
and should not be used.
Close a filehandle opened with Open(). If the file was used
with buffered I/O the final write may fail and thus Close()
return an error. The file is closed in any case.
0 if there was an error. != 0 on success.
This function is identical to UnLock().
LONG CompareDates(
const struct DateStamp * date1,
const struct DateStamp * date2 );
date1, date2 - The two dates to compare.
< 0 if date1 is later than date2, == 0 if they are equal or > 0
if date2 is later than date1.
This is NOT the same ordering as strcmp() !
BPTR CreateDir(
CONST_STRPTR name );
Creates a new directory under the given name. If all went well, an
exclusive lock on the new diretory is returned.
name -- NUL terminated name.
Exclusive lock to the new directory or 0 if it couldn't be created.
IoErr() gives additional information in that case.
struct Process * CreateNewProc(
struct TagItem * tags );
Create a new process using the tagitem array.
tags - information on the new process.
Pointer to the new process or NULL on error.
struct MsgPort * CreateProc(
CONST_STRPTR name,
LONG pri,
BPTR segList,
LONG stackSize );
CreateProc() will create a new process (a process is a superset
of an exec Task), with the name 'name' and the priority 'pri'.
You should pass a segList as returned by LoadSeg() (or similar)
in the 'segList' parameter, and specify the stack size in
'stackSize'.
You should really use CreateNewProc() rather than this function
as it is much more flexible.
name -- Name of the new process.
pri -- Starting priority.
segList -- BCPL pointer to a seglist.
stackSize -- The size of the initial process stack.
Pointer to the pr_MsgPort in the Process structure. Will
return NULL on failure.
This will not free the seglist when the process finishes.
This does not return a pointer to the Process structure, but
rather the MsgPort structure contained within it. You can
get the real Process structure by:
struct Process *pr;
struct MsgPort *mp;
mp = CreateProc(...);
pr = (struct Process *)((struct Task *)mp - 1);
// Shouldn't use mp after this point
CreateNewProc(), LoadSeg(), UnLoadSeg()
BPTR CurrentDir(
BPTR lock );
Sets a new directory as the current directory. Returns the old one.
0 is valid in both cases and represents the boot filesystem.
lock - Lock for the new current directory.
struct DateStamp * DateStamp(
struct DateStamp * date );
Fills the structure with the current time. Time is measured from
Jan 1, 1978.
date - The structure to fill.
date->ds_Days is filled with the days from Jan 1, 1978.
date->ds_Minute is filled with the number of minutes elapsed in the
day. date->ds_Tick is the number of ticks elapsed in the current
minute. A tick happens 50 times a second. DateStamp() ensures that
the day and minute are consistent. All three elements are zero if
the date is unset.
The original function could only return even multiples of 50 ticks.
BOOL DateToStr(
struct DateTime * datetime );
DateToStr converts an AmigaDOS DateStamp to a human
readable ASCII string as requested by your settings in the
DateTime structure.
DateTime - a pointer to an initialized DateTime structure. The
DateTime structure should be initialized as follows:
dat_Stamp: The datestamp to convert to ascii
dat_Format: How to convert the datestamp into
dat_StrDate. Can be any of the following:
FORMAT_DOS: AmigaDOS format (dd-mmm-yy). This
is the default if you specify something other
than any entry in this list.
FORMAT_INT: International format (yy-mmm-dd).
FORMAT_USA: American format (mm-dd-yy).
FORMAT_CDN: Canadian format (dd-mm-yy).
FORMAT_DEF default format for locale.
dat_Flags: Modifies dat_Format. The only flag
used by this function is DTF_SUBST. If set, then
a string like "Today" or "Monday" is generated
instead of the normal format if possible.
dat_StrDay: Pointer to a buffer to receive the day of
the week string. (Monday, Tuesday, etc.). If null,
this string will not be generated.
dat_StrDate: Pointer to a buffer to receive the date
string, in the format requested by dat_Format,
subject to possible modifications by DTF_SUBST. If
null, this string will not be generated.
dat_StrTime: Pointer to a buffer to receive the time
of day string. If NULL, this will not be generated.
A zero return indicates that the DateStamp was invalid, and could
not be converted. Non-zero indicates that the call succeeded.
void Delay(
ULONG timeout );
Waits for at least the time specified as timeout.
timeout - the minimum time to wait in ticks (1/50 seconds)
BOOL DeleteFile(
CONST_STRPTR name );
Tries to delete a file or directory by a given name.
May fail if the file is in use or protected from deletion.
name - NUL terminated name.
!= 0 if the file is gone, 0 if is still there.
IoErr() gives additional information in that case.
LONG DeleteVar(
CONST_STRPTR name,
ULONG flags );
Deletes a local or environment variable.
The default is to delete a local variable if one was found,
or to delete a global environmental variable otherwise.
A global environmental variable will only be deleted for the
type LV_VAR.
name - the name of the variable to delete. Note that variable
names follow the same syntax and semantics as filesystem
names.
flags - A combination of the type of variable (low 8 bits), and
flags to control the behaviour of this routine.
Currently defined flags:
GVF_LOCAL_ONLY - delete a local variable.
GVF_GLOBAL_ONLY - delete a global environmental variable.
If non-zero, the variable was deleted successfully,
DOSFALSE otherwise.
When the GVF_SAVE_VAR flag is set, and only one of the global
variable pair could be deleted (either the in memory or on disk
variable), DOSFALSE will be returned.
struct MsgPort * DeviceProc(
CONST_STRPTR name );
DeviceProc() is an obsolete function that returns the Process
responsible for a DOS device. It has been updated to return a
new filesystem device.
DeviceProc() will fail if you ask for the Process of a device
created with AssignPath() as there is no process to return.
If the device requested is an assign, the IoErr() will contain
the Lock to the directory (the function will return the device
on which the lock is set).
name - The name of the DOS device, without the ':'.
Either a pointer to the Device structure, or NULL.
You should really use GetDeviceProc() as this function caters
for all possible device types.
Does not support late- and non-bound assigns, or multiple
path assigns very well.
GetDeviceProc(), FreeDeviceProc().
LONG DisplayError(
CONST_STRPTR formatStr,
ULONG flags,
APTR args );
Displays an error message to and gets response from a user.
formatStr -- printf-style formatted string
flags -- arguments to EasyRequestArgs()
args -- arguments to 'formatStr'
This is a PRIVATE dos function.
LONG DoPkt(
struct MsgPort * port,
LONG action,
LONG arg1,
LONG arg2,
LONG arg3,
LONG arg4,
LONG arg5 );
Send a dos packet to a filesystem and wait for the action to complete.
Callable from a task.
This function should NOT be used; it's only here for AmigaOS compatibility.
BPTR DupLock(
BPTR lock );
Clone a lock on a file or directory. This will only work on shared
locks.
The new lock or NULL in case of an error. IoErr() will give additional
information in that case.
This function is identical to DupLockFromFH().
void EndNotify(
struct NotifyRequest * notify );
End a notification (quit notifying for a request previously sent with
StartNotify()).
notify -- NotifyRequest used with StartNotify()
Returns the current error stream or 0 if there is no current
input stream.
This function is AROS specific
BOOL ErrorReport(
LONG code,
LONG type,
IPTR arg1,
struct MsgPort * device );
code -- The error to put up the requester for
type -- Type of request
REPORT_LOCK -- arg1 is a lock (BPTR).
REPORT_FH -- arg1 is a filehandle (BPTR).
REPORT_VOLUME -- arg1 is a volumenode (C pointer).
REPORT_INSERT -- arg1 is the string for the volumename
arg1 -- Argument according to type (see above)
device -- Optional handler task address (obsolete!)
Locks and filehandles are the same in AROS so there is redundancy in
the parameters. Furthermore, the 'device' argument is not cared about
as AROS doesn't build filesystems with handlers.
BOOL ExAll(
BPTR lock,
struct ExAllData * buffer,
LONG size,
LONG data,
struct ExAllControl * control );
Examine an entire directory.
lock -- lock on the directory to be examined
buffer -- buffer for the data that is returned (must be aligned)
which is filled with (partial) ExAllData structures
An indicator of if ExAll() is done. If FALSE is returned, either ExAll()
has completed in which case IoErr() is ERROR_NO_MORE_ENTRIES or an
error occurred. If a non-zero value is returned ExAll() must be called
again until it returns FALSE.
size -- size of 'buffer' in bytes
type -- type of the data to be returned
control -- a control structure allocated by AllocDosObject()
The following information is essential information on the ExAllData
structure:
ead_type :
Examine(), ExNext(), MatchPatternNoCase(), ParsePatternNoCase(),
AllocDosObject(), ExAllEnd()
void ExAllEnd(
BPTR lock,
struct ExAllData * buffer,
LONG size,
LONG data,
struct ExAllControl * control );
Stop an ExAll() operation before returning ERROR_NO_MORE_ENTRIES.
The inputs should correspond to the inputs for the ExAll() function.
lock -- lock on the directory that is being examined
buffer -- buffer for data returned
size -- size of 'buffer' in bytes
type -- type of data to be returned
control -- control data structure
The control data structure must have been allocated with AllocDosObject().
ExAll(), AllocDosObject()
BOOL ExNext(
BPTR lock,
struct FileInfoBlock * fileInfoBlock );
Examine the next entry in a directory.
lock -- lock on the direcory the contents of which to examine
fib -- a FileInfoBlock previously initialized by Examine()
(or used before with ExNext())
success -- a boolean telling whether the operation was successful
or not. A failure occurs also if there is no "next" entry in
the directory. Then IoErr() equals ERROR_NO_MORE_ENTRIES.
To examine a directory, do the following:
1. Pass a lock on the directory and a FileInfoBlock (allocated by
AllocDosObject()) to Examine().
2. Pass the same parameters to ExNext().
3. Do something with the FileInfoBlock returned.
4. Call ExNext() repeatedly until it returns FALSE and use the
information you are provided. When ExNext returns FALSE, check IoErr()
to make sure that there was no real failure (ERROR_NO_MORE_ENTRIES).
If scanning a filesystem tree recursively, you'll need to allocated a
new FilInfoBlock for each directory level.
At the moment it is necessary that the lock passed to this
function is a directory(!!) that has previously been
assigned (i.e. assign env: env).
Examine(), IoErr(), AllocDosObject(), ExAll()
BOOL Examine(
BPTR lock,
struct FileInfoBlock * fib );
Fill in a FileInfoBlock structure concerning a file or directory
associated with a particular lock.
lock -- lock to examine
fib -- FileInfoBlock where the result of the examination is stored
A boolean telling whether the operation was successful or not.
FileInfoBlocks should be allocated with AllocDosObject(). You may make
a copy of the FileInfoBlock but, however, this copy may NOT be passed
to ExNext()!
Lock(), UnLock(), ExNext(), AllocDosObject(), ExAll(), <dos/dos.h>
LONG Execute(
CONST_STRPTR string,
BPTR input,
BPTR output );
Execute a CLI command specified in 'string'. This string may contain
features you may use on the shell commandline like redirection using >,
< or >>. Execute() doesn't return until the command(s) that should be
executed are finished.
If 'input' is not NULL, more commands will be read from this stream
until end of file is reached. 'output' will be used as the output stream
of the commands (if output is not redirected). If 'output' is NULL the
current window is used for output -- note that programs run from the
Workbench doesn't normally have a current window.
string -- pointer to a NULL-terminated string with commands
(may be NULL)
input -- stream to use as input (may be NULL)
output -- stream to use as output (may be NULL)
Boolean telling whether Execute() could find and start the specified
command(s). (This is NOT the return code of the command(s).)
void Exit(
LONG returnCode );
Obsolete function, the purpose of which was to exit from a BCPL program.
This function is obsolete and doens't do anything. Therefore, do not
call it!
Get a character from a buffered file. Buffered I/O is more efficient
for small amounts of data but less for big chunks. You have to
use Flush() between buffered and non-buffered I/O or you'll
clutter your I/O stream.
The character read or EOF if the file ended or an error happened.
IoErr() gives additional information in that case.
STRPTR FGets(
BPTR fh,
STRPTR buf,
ULONG buflen );
Read until NEWLINE (\n), EOF is encountered or buflen-1
characters have been read. If a NEWLINE is read, it will
be the last character in the buffer. The buffer will always
be \0-terminated.
fh - Read buffered from this filehandle
buf - Put read chars in this buffer
buflen - The size of the buffer
buf or NULL if the first thing read is EOF.
LONG FPutC(
BPTR file,
LONG character );
file - Filehandle to write to.
character - Character to write.
The character written or EOF in case of an error.
IoErr() gives additional information in that case.
LONG FPuts(
BPTR file,
CONST_STRPTR string );
This routine writes an unformatted string to the filehandle. No
newline is appended to the string. This routine is buffered.
file - Filehandle to write to.
string - String to write.
0 if all went well or EOF in case of an error.
IoErr() gives additional information in that case.
LONG FRead(
BPTR fh,
APTR block,
ULONG blocklen,
ULONG number );
Read a number of blocks from a file.
fh - Read from this file
block - The data is put here
blocklen - This is the size of a single block
number - The number of blocks
The number of blocks read from the file or 0 on EOF.
This function may return less than the requested number of blocks
IoErr() gives additional information in case of an error.
Open(), FWrite(), FPutc(), Close()
LONG FWrite(
BPTR fh,
CONST_APTR block,
ULONG blocklen,
ULONG numblocks );
Write a number of blocks to a file.
fh - Write to this file
block - The data begins here
blocklen - number of bytes per block. Must be > 0.
numblocks - number of blocks to write. Must be > 0.
The number of blocks written to the file or EOF on error. IoErr()
gives additional information in case of an error.
Open(), FRead(), FPutc(), Close()
BOOL Fault(
LONG code,
CONST_STRPTR header,
STRPTR buffer,
LONG len );
Fault will obtain the error message string for the given error
code. First the header string is copied to the buffer, followed
by a ":" (colon), then the NULL terminated string for the error
message into the buffer.
By convention, error messages are ALWAYS less than 80 (plus 1 for
NULL termination), and ideally less than 60 characters.
If the error code is not know, then the string "Unknown error"
followed by the error number will be added to the string.
code - The error code.
header - The string to prepend to the buffer before the error
text. This may be NULL in which case nothing is prepended.
buffer - The destination buffer.
len - Length of the buffer.
Number of characters placed in the buffer, may be 0.
STRPTR FilePart(
CONST_STRPTR path );
Get a pointer to the last component of a path, which is normally the
filename.
path - pointer AmigaDOS path string
May be relative to the current directory or the current disk.
A pointer to the first char of the filename!
FilePart("xxx:yyy/zzz/qqq") returns a pointer to the first 'q'.
FilePart("xxx:yyy") returns a pointer to the first 'y'.
FilePart("yyy") returns a pointer to the first 'y'.
LONG FindArg(
CONST_STRPTR template,
CONST_STRPTR keyword );
struct Process * FindCliProc(
ULONG num );
Find a CLI process by its task number. The number must be greater
than 0.
num - The task number of the CLI to find.
Pointer to the process if found, NULL otherwise.
The process calling this function doesn't need to do any locking.
struct DosList * FindDosEntry(
struct DosList * dlist,
CONST_STRPTR name,
ULONG flags );
Looks for the next dos list entry with the right name. The list
must be locked for this. There may be not more than one device
or assign node of the same name. There are no restrictions on
volume nodes.
dlist - the value given by LockDosList() or the last call to
FindDosEntry().
name - logical device name without colon. Case insensitive.
flags - the same flags as given to LockDosList() or a subset
of them.
Pointer to dos list entry found or NULL if the are no more entries.
struct Segment * FindSegment(
CONST_STRPTR name,
struct Segment * seg,
BOOL system );
Search for a resident segment by name and type. FindSegment() will
return the first segment that exactly matches the name and type.
You can continue searching by specifying the last returned segment
as the seg argument.
name - Name of the segment to search for.
seg - Start search from this point.
system - Search for a system segment.
Will return the segment structure if a match is found, otherwise
will return NULL.
FindSegment() does no locking of the segment list. You should
lock yourself. FindSegment() also does not increment the value
of the seg_UC field. If the value of seg_UC > 0, you MUST
perform user counting in order to prevent the segment from being
unloaded.
AddSegment(), RemSegment()
struct LocalVar * FindVar(
CONST_STRPTR name,
ULONG type );
Finds a local variable structure.
name -- the name of the variable you wish to find. Note that
variable names follow the same syntax and semantics
as filesystem names.
type -- The type of variable to be found (see <dos/var.h>).
Actually, only the lower 8 bits of "type" are used
by FindVar().
A pointer to the LocalVar structure for that variable if it was
found. If the variable wasn't found, or was of the wrong type,
NULL will be returned.
DeleteVar(), GetVar(), SetVar()
Flushes any pending writes on the file. If the file was used
for input and there is still some data to read it tries to
seek back to the expected position.
!= 0 on success, 0 on error. IoErr() gives additional information
in that case.
BOOL Format(
CONST_STRPTR devicename,
CONST_STRPTR volumename,
ULONG dostype );
Initialise a filesystem for use by the system. This instructs
a filesystem to write out the data that it uses to describe the
device.
The device should already have been formatted.
devicename - Name of the device to format.
volumename - The name you wish the volume to be called.
dostype - The DOS type you wish on the disk.
!= 0 if the format was successful, 0 otherwise.
void FreeArgs(
struct RDArgs * args );
FreeArgs() will clean up after a call to ReadArgs(). If the
RDArgs structure was allocated by the system in a call to
ReadArgs(), then it will be freed. If however, you allocated
the RDArgs structure with AllocDosObject(), then you will
have to free it yourself with FreeDosObject().
args - The data used by ReadArgs(). May be NULL,
in which case, FreeArgs() does nothing.
Some memory will have been returned to the system.
void FreeDeviceProc(
struct DevProc * dp );
FreeDeviceProc() will clean up after a call to GetDeviceProc().
dp - DevProc structure as returned by GetDeviceProc().
Some memory and other resources returned to the system.
void FreeDosEntry(
struct DosList * dlist );
Free a dos list entry created with MakeDosEntry().
dlist -- pointer to dos list entry. May be NULL.
void FreeDosObject(
ULONG type,
APTR ptr );
Frees an object allocated with AllocDosObject.
type - object type. The same parameter as given to AllocDosObject().
ptr - Pointer to object.
Returns a pointer to the argument string passed to the current
process at startup.
Pointer to argument string.
struct MsgPort * GetConsoleTask();
Return the console handler for the current Process. The return
type depends upon whether AROS is running binary compatible.
The address of the console handler, or NULL if none is set.
You will only get NULL from this call if you call it on a Task,
or when the Process is not attached to a console.
BOOL GetCurrentDirName(
STRPTR buf,
LONG len );
Copies the name of the current directory from the CLI structure
into the buffer. If the buffer is too small the name is truncated,
and a failure is returned. If the current process doesn't have
a CLI structure, a 0 length string is put into the buffer and a
failure is returned.
buf - Buffer for the name.
len - Size of the buffer in bytes.
!=0 on success, 0 on failure. IoErr() gives additional information
in that case.
struct DevProc * GetDeviceProc(
CONST_STRPTR name,
struct DevProc * dp );
GetDeviceProc() will search for the filesystem handler which
you should send a command to for a specific path.
By calling GetDeviceProc() multiple times, the caller will
be able to handle multi-assign paths.
The first call to GetDeviceProc() should have the |dp| parameter
as NULL.
name - Name of the object to find.
dp - Previous result of GetDeviceProc() or NULL.
A pointer to a DevProc structure containing the information
required to send a command to a filesystem.
Currently doesn't return dvp_DevNode for locks which are
relative to "PROGDIR:", ":", or the current directory.
struct MsgPort * GetFileSysTask();
Return the default filesystem handler for this process.
The default filesystem handler for this process.
This function will return the shared lock on the directory that
the current process was loaded from. You can use this to help
you find data files which were supplied with your program.
A NULL return is possible, which means that you may be running
from the Resident list.
You should NOT under any circumstance UnLock() this lock.
A shared lock on the directory the program was started from.
BOOL GetProgramName(
STRPTR buf,
LONG len );
Copies the name of the current program from the CLI structure
into the buffer. If the buffer is too small the name is truncated,
and a failure is returned. If the current process doesn't have
a CLI structure, a 0 length string is put into the buffer and a
failure is returned.
buf - Buffer for the name.
len - Size of the buffer in bytes.
!=0 on success, 0 on failure. IoErr() gives additional information
in that case.
BOOL GetPrompt(
STRPTR buf,
LONG len );
Copies the prompt from the CLI structure into the buffer. If the
buffer is too small the name is truncated, and a failure is returned.
If the current process doesn't have a CLI structure, a 0 length string
is put into the buffer and a failure is returned.
buf - Buffer for the prompt.
len - Size of the buffer in bytes.
!=0 on success, 0 on failure. IoErr() gives additional information
in that case.
LONG GetVar(
CONST_STRPTR name,
STRPTR buffer,
LONG size,
LONG flags );
This function will return the value of a local or environmental
variable in the supplied buffer.
It is advised to only use ASCII characters with a variable, but
this is not required.
If GVF_BINARY_VAR is not specified, this function will stop putting
characters into the destination buffer when a '\n' is hit, or the
end of the buffer is reached. Otherwise it will complete fill the
buffer.
name - the name of the variable you want.
buffer - Space to store the returned variable.
size - Length of the buffer in bytes.
flags - A combination of the type of variable to get (lower
8 bits) and flags that control the value of this
function. Current flags are:
GVF_GLOBAL_ONLY - only tries to get a global variable.
GVF_LOCAL_ONLY - only tries to get a local variable.
GVF_BINARY_VAR - do not stop at a '\n' character.
GVF_DONT_NULL_TERM - no NULL termination. This only
applies to GVF_BINARY_VAR.
Will return the number of characters put in the buffer, or -1
if the variable is not defined. The '\n' character if it exists
will not be placed in the buffer.
If the value would overflow the user buffer, then the number of
characters copied into the buffer will be returned and the buffer
truncated.The buffer will be NULL terminated unless
GVF_DONT_NULL_TERM is set.
IoErr() will contain either:
ERROR_OBJECT_NOT_FOUND
if the variable is not defined.
ERROR_BAD_NUMBER
if the size of the buffer is 0.
the total length of the variable
otherwise.
LV_VAR is the only type that can be global.
DeleteVar(), FindVar(), SetVar()
BOOL Info(
BPTR lock,
struct InfoData * parameterBlock );
Get information about a volume in the system.
lock -- a lock on any file on the volume for which information
should be supplied
parameterBlock -- pointer to an InfoData structure
Boolean indicating success or failure. If TRUE (success) the
'parameterBlock' is filled with information on the volume.
LONG Inhibit(
CONST_STRPTR name,
LONG onoff );
Stop a filesystem from being used.
name -- Name of the device to inhibit (including a ':')
onoff -- Specify whether to inhinit (DOSTRUE) or uninhibit (DOSFALSE)
the device
A boolean telling whether the action was carried out.
After uninhibiting a device anything might have happened like the disk
in the drive was removed.
Returns the current input stream or 0 if there is no current
input stream.
BPTR InternalLoadSeg(
BPTR fh,
BPTR table,
LONG_FUNC functionarray,
LONG * stack );
Loads from fh.
Functionarray is a pointer to an array of functions. See below.
This function really only tries to load the different file
formats aos, elf and aout.
fh : Filehandle to load from
table : ignored
functionarray : array of functions to be used for read, alloc and free
FuncTable[0] -> bytes = ReadFunc(readhandle, buffer, length), DOSBase
D0 D1 A0 D0 A6
FuncTable[1] -> Memory = AllocFunc(size,flags), ExecBase
D0 D0 D1 A6
FuncTable[2] -> FreeFunc(memory, size), ExecBase
A1 D0 A6
stack : pointer to storage (ULONG) for stacksize.
(currently ignored)
seglist - pointer to loaded Seglist or NULL in case of failure.
Use of table and stack are not implemented, yet!
BOOL InternalUnLoadSeg(
BPTR seglist,
VOID_FUNC freefunc );
Get the dos error code for the current process.
BOOL IsFileSystem(
CONST_STRPTR devicename );
Query the device whether it is a filesystem.
devicename - Name of the device to query.
TRUE if the device is a filesystem, FALSE otherwise.
DF0:, HD0:, ... are filesystems.
CON:, PIPE:, AUX:, ... are not
In AmigaOS if devicename contains no ":" then result
is always TRUE. Also volume and assign names return
TRUE.
BOOL IsInteractive(
BPTR file );
Check if file is bound to an interactive device such as a console
or shell window.
!= 0 if the file is interactive, 0 if it is not.
BPTR LoadSeg(
CONST_STRPTR name );
Loads an executable file into memory. Each hunk of the loadfile
is loaded into its own memory section and a handle on all of them
is returned. The segments can be freed with UnLoadSeg().
name - NUL terminated name of the file.
Handle to the loaded executable or NULL if the load failed.
IoErr() gives additional information in that case.
This function is built on top of InternalLoadSeg()
BPTR Lock(
CONST_STRPTR name,
LONG accessMode );
Gets a lock on a file or directory. There may be more than one
shared lock on a file but only one if it is an exclusive one.
Locked files or directories may not be deleted.
name - NUL terminated name of the file or directory.
accessMode - One of SHARED_LOCK
EXCLUSIVE_LOCK
Handle to the file or directory or 0 if the object couldn't be locked.
IoErr() gives additional information in that case.
The lock structure returned by this function is different
from that of AmigaOS (in fact it is identical to a filehandle).
Do not try to read any internal fields.
struct DosList * LockDosList(
ULONG flags );
Waits until the desired dos lists are free then gets a lock on them.
A handle is returned that can be used for FindDosEntry().
Calls to this function nest, i.e. you must call UnLockDosList()
as often as you called LockDosList(). Always lock all lists
at once - do not try to get a lock on one of them then on another.
flags - what lists to lock
Handle to the dos list. This is not a direct pointer
to the first list element but to a pseudo element instead.
BOOL LockRecord(
BPTR fh,
ULONG offset,
ULONG length,
ULONG mode,
ULONG timeout );
Lock a portion of a file for exclusive access. A timeout may be specified
which is the maximum amount of time to wait for the record to be available.
fh -- file handle for the file to lock a record of
offset -- starting position of the lock
length -- length of the record in bytes
mode -- lock type
timeout -- timeout interval measured in ticks (may be 0)
Success/failure indicator.
Record locks are cooperative, meaning that they only affect other calls
to LockRecord().
LockRecords(), UnLockRecord()
BOOL LockRecords(
struct RecordLock * recArray,
ULONG timeout );
Lock several records at the same time. The timeout specified is applied
to each lock to attempt. The array of RecordLock:s is terminated with
an entry where rec_FH is equal to NULL.
recArray -- array of records to lock
timeout -- maximum number of ticks to wait for a lock to be ready
Success/failure indication. In case of a success, all the record locks
are locked. In case of failure, no record locks are locked.
A set of records should always be locked in the same order so as to
reduce possiblities of deadlock.
struct DosList * MakeDosEntry(
CONST_STRPTR name,
LONG type );
Create an entry for the dos list. Depending on the type this may
be a device, a volume or an assign node.
name -- pointer to name
type -- type of list entry to create
The new device entry, or NULL if it couldn't be created.
AddDosEntry(), RemDosEntry(), FindDosEntry(), LockDosList(),
NextDosEntry(), FreeDosEntry()
LONG MakeLink(
CONST_STRPTR name,
APTR dest,
LONG soft );
MakeLink() will create a link between two files or directories.
A link is a filesystem object that refers to another file.
A soft link refers to another file by name, and is resolved by
the filesystem and the caller. Soft links are not restricted to
the same volume. The |dest| argument is a NUL terminated pathname
to the pre-existing object. Soft links can be used on directories.
A hard link refers to another file by the location on a disk, and
is resolved by the filesystem. Hard links are restricted to files
on the same volume. The |dest| argument is a lock on another file.
name - The name of the link to create
dest - If 'soft' is TRUE this must be a filename, if it is FALSE a BPTR
pointing to the file to be hard-linked must be provided
soft - TRUE, if a soft-link is to be created, FALSE for an hard-link
boolean - DOSTRUE or DOSFALSE. On error, IoErr() will contain more
information.
Soft links were not working in the ROM filesystem before version
37.
void MatchEnd(
struct AnchorPath * AP );
Free the memory that was allocated by calls to MatchFirst() and
MatchNext()
AP - pointer to Anchor Path structure which had been passed to
MatchFirst() before.
Allocated memory is returned and filelocks are freed.
LONG MatchFirst(
CONST_STRPTR pat,
struct AnchorPath * AP );
Searches for the first file or directory that matches a given pattern.
MatchFirst() initializes the AnchorPath structure for you but you
must initilize the following fields: ap_Flags, ap_Strlen, ap_BreakBits
and ap_FoundBreak. The first call to MatchFirst() also passes you
the first matching file which you can examine in ap_Info and the directory
the files is in in ap_Current->an_Lock. After the first call to
MatchFirst(), call MatchNext().
The search begins wherever the current directory is set to. See
CurrentDir();
For more info on patterns see ParsePattern().
pat - pattern to search for
AP - pointer to (initilized) AnchorPath structure
0 = success
other = DOS error code
MatchNext(), MatchEnd(), ParsePattern(), Examine(), CurrentDir()
<dos/dosasl.h>
LONG MatchNext(
struct AnchorPath * AP );
Find next file or directory that matches a given pattern.
See <dos/dosasl.h> for more docs and how to control MatchNext().
AP - pointer to Anchor Path structure which had been passed to
MatchFirst() before.
MatchFirst() MatchEnd() CurrentDir() Examine() ExNext()
ParsePattern() <dos/dosasl.h>
BOOL MatchPattern(
CONST_STRPTR pat,
CONST_STRPTR str );
Check if a string matches a pattern. The pattern must be a pattern as
output by ParsePattern(). Note that this routine is case sensitive.
pat -- Pattern string (as returned by ParsePattern())
str -- The string to match against the pattern 'pat'
Boolean telling whether the string matched the pattern.
ParsePattern(), MatchPatternNoCase(), MatchFirst(), MatchNext()
BOOL MatchPatternNoCase(
CONST_STRPTR pat,
CONST_STRPTR str );
Similar to MatchPattern(), only case insensitive (see there for
more information). For use with ParsePatternNoCase().
pat -- Pattern as returned by ParsePatternNoCase()
str -- String to match against the pattern 'pat'
Boolean telling whether the match was successful or not.
MatchPattern(), ParsePatternNoCase().
Returns the highest Cli number currently in use. Since processes
may be added and removed at any time the returned value may already
be wrong.
Maximum Cli number (_not_ the number of Clis).
BOOL NameFromLock(
BPTR lock,
STRPTR buffer,
LONG length );
Get the full path name associated with a lock to a file or
directory into a user supplied buffer.
lock - Lock to file or directory.
buffer - Buffer to fill. Contains a NUL terminated string if
all went well.
length - Size of the buffer in bytes.
!=0 if all went well, 0 in case of an error. IoErr() will
give additional information in that case.
BPTR NewLoadSeg(
CONST_STRPTR file,
struct TagItem * tags );
Loads an executable file into memory via LoadSeg() and takes
additional actions based upon the supplied tags.
file - NULL terminated name of the file
tags - pointer to the tagitems
Handle to the loaded executable or 0 if the load failed.
IoErr() gives additional information in that case.
As there are no tags currently defined, all this function does is
call LoadSeg()
|