Home Page The Club Computers News Links Glossary EYAWTK
Before Amiga Background ICS OCS ECS AGA ??? PPC
U-Boot SLB Linux Amiga OS Dual Boot Motherboards Peripherals Other
Initialisation Installation OS4 Updates About OS4 File Systems Networking Printing Other
Introduction File System Workbench Preferences Commands Error Msgs Miscellaneous

AmigaOS 4.0 - About OS4 - Commands

ASSIGN AmigaDOS
Purpose: To control assignment of logical device names to file system directories.
Format: ASSIGN [<name>:] [{<target>}] [FROM <from>] [TO <to>] [LIST] [EXISTS] [DISMOUNT] [DEFER] [PATH] [ADD] [REMOVE] [VOLS] [DIRS] [DEVICES] [NOREQ]
Template: NAME, TARGET/M, FROM/K, TO/K, LIST/S, EXISTS/S, DISMOUNT/S, DEFER/S, PATH/S, ADD/S, REMOVE/S, VOLS/S, DIRS/S, DEVICES/S, NOREQ/S
Path: C:ASSIGN
ASSIGN allows directories to be referenced via short, convenient logical device names rather than use their usual names or complete paths. The ASSIGN command can create assignments, remove assignments, and list some or all current assignments, but ASSIGN is not used for and does not show so-called "pseudo-assigns" which are new to OS4.

If the <name> and {<target>} arguments are given, ASSIGN will assign the given name to the specified target. Each time the assigned logical device name is referred to, AmigaDOS will access the specified target(s). If the <name> given is already assigned to a directory, the new directory will replace the previous directory. (Always be sure to include a colon after the <name> argument.)

If only the <name> argument is given, any existing ASSIGN of a target to that logical device will be cancelled.

You can assign several logical device names to the same directory by using multiple ASSIGN statements. Alternatively you can tell the ASSIGN command to read a list of specifications from a file using the FROM <from> argument. In that file, there must be one assignment specification per line; lines beginning with the ';' character are ignored. The file could look like this:

FONTS: MyFonts:Fontdir
LIBS: SYS:Libs BigAssem:Libs PDAssem:Libs
WorkDisk: DF0: DEFER
C: DF0:C PATH
As you can see, it is possible to set up deferred and path assignments and assignment lists, too.

To complement the FROM argument there is the TO <to> argument which will store the current list of assignments in a file, suitable for use with the FROM argument.

You can assign one logical device name to several targets by specifying each file or directory after the <name> argument or by using several ASSIGN commands with the ADD option. When the ADD option is specified, any existing directory assigned to <name> is not cancelled. Instead, the newly specified directory is added to the ASSIGN list, and the system will search for both directories when <name> is encountered. If the original directory is not available, ASSIGN will be satisfied with the newly added directory.

To delete a name from the ASSIGN list, use specify the <name> followed by the the REMOVE option. It must be noted that this technique cannot be used to cancel an ASSIGN; instead yo must specify only the <name> argument as discussed above.

PLEASE NOTE: A long-standing error within ASSIGN which permitted the REMOVE argument without the target argument, i.e. ASSIGN name: REMOVE, was corrected in Update #4. Statements using that syntax are no longer valid syntax and will fail; they must be changed to ASSIGN name: instead. This was commonly used in installation scripts and could affect other scripts which previously worked.

New to Update#4 are the FROM=<from> and TO=<to> arguments, but we don't really understand how they work at this time so rather than give you bad advice we'd rather wait until we are fully conversant with their workings.

If no arguments are given with ASSIGN, or if the the LIST keyword is used, a list of all current assignments will be displayed. If the VOLS, DIRS, or DEVICES switch is specified, ASSIGN will limit the display to volumes, directories, or devices, respectively.

When the EXISTS keyword is given along with a logical device name, AmigaDOS will search the ASSIGN list for that name and display the volume and directory assigned to that device. If the device name is not found, the condition flag is set to 5 (WARN). This is commonly used in scripts.

Normally, when the {dir} argument is given, AmigaDOS immediately looks for that directory. If the ASSIGN commands are part of the Startup-sequence, the directories need to be present on a mounted disk during the boot procedure. If an assigned directory cannot be found, a requester appears asking for the volume containing that directory. However, two options, DEFER and PATH, will wait until the directory is actually needed before searching for it.

The DEFER option creates a "late-binding" ASSIGN. This ASSIGN only takes effect when the assigned object is first referenced, rather than when the assignment is made. This eliminates the need to insert disks during the boot procedure that contain the directories that are assigned during the Startup-sequence. When the DEFER option is used, the disk containing the assigned directory is not needed until the object is actually called upon. The assignment remains in force until explicitly changed.

For example, if you ASSIGN FONTS: to DF0:Fonts with the DEFER option, the system will associate FONTS: with whatever disk is in DF0: at the time FONTS: is called. If you have a different disk disk in DF0: at the time the FONTS: directory is needed, the system will associate FONTS: with that particular disk. If you remove that disk and insert another containing a FONTS: directory, the system will specifically request the other disk the next time FONTS: is needed.

It is not necessary for the assigned name to retain the name of the directory nor is it necessary for it to be uppercase. For example, both CLIPS and Clips can be assigned to the Ram Disk:Clipboards directory.

The PATH option creates a "non-binding" ASSIGN. A non-binding ASSIGN acts like a DEFERred ASSIGN except that it is re-evaluated each time the assigned name is referenced. This prevents the system from expecting a particular volume in order to use a particular directory (such as the situation described in the example above). For example, if you ASSIGN FONTS: to DF0:Fonts with the PATH option, any disk in DF0: will be searched when FONTS: is referenced. As long as the disk contains a FONTS: directory, it will satisfy the ASSIGN. You cannot assign multiple directories with the PATH option.

The DISMOUNT option disconnects a volume or device from the list of mounted devices. It does not free up resources; it merely removes the name from the list. There is no way to cancel a DISMOUNT without rebooting. DISMOUNT is primarily for use during software development. Careless use of the option may cause a software failure.

Example 1:

3.OS4:> ASSIGN FONTS: MyFonts:Fontdir
assigns the FONTS: directory to Fontdir on MyFonts:.

Example 2:

3.OS4:> ASSIGN
Volumes:
OS4 [Mounted]
OS4Work [Mounted]
RAM Disk [Mounted]

Directories:
AWEB_APL
C

CLASSES
CLIPS
DEVS
ENVARC
FONTS
GCC
HELP

KEYMAPS
L
LIB
LIBS


LOCALE

MUI
PRINTERS
REXX
S
SDK
SYS
T
USR
vbcc
vbccos4
vincludeos4


vlibos4

 


+







+




+
+

+











+
+

+
 
OS4:Utilities/Aweb/AWebPPC
OS4:C
OS4:SDK/vbcc/bin
OS4:Classes
RAM Disk:Clipboards
OS4:Devs
OS4:Prefs/Env-Archive
OS4:Fonts
OS4:SDK/gcc
OS4:Locale/Help
OS4:MUI/Docs
OS4:Devs/Keymaps
OS4:L
OS4:SDK/gcc/lib
OS4:Libs
OS4:Classes
OS4:MUI/Libs
OS4:Locale
OS4:MUI/Locale
OS4:MUI/Locale
OS4:Devs/Printers
OS4:S/Arexx
OS4:S
OS4:SDK
OS4:
RAM Disk:T
OS4:SDK/gcc
OS4:SDK/vbcc
OS4:SDK/vbcc/targets/ppc-amigaos
OS4:SDK/vbcc/targets/ppc-amigaos/include
OS4:SDK/Include/include_h
OS4:SDK/Local/include
OS4:SDK/vbcc/targets/ppc-amigaos/lib
OS4:SDK/Local/lib
 
Devices:
BU0 CD0 CON DH0 DH1
ENV RAM RAW TCP USB0
shows a list of all current assignments.

Example 3:

3.OS4:> ASSIGN FONTS: EXISTS
FONTS: MyFonts:Fontdir
is an inquiry into the assignment of FONTS:. AmigaDOS responds by showing that FONTS: is assigned to the Fontdir on MyFonts:.

Example 4:

3.OS4:> ASSIGN LIBS: SYS:Libs BigAssem:Libs PDAssem:Libs
is a multiple-directory assignment that creates a search path containing 3 Libs directories. These directories will be searched in sequence each time LIBS: is invoked.

Example 5:

3.OS4:> ASSIGN DEVS:
deletes the DEVS: assignment from the system.

Example 6:

3.OS4:> ASSIGN WorkDisk: DF0: DEFER
3.OS4:> ASSIGN WorkDisk: EXISTS
WorkDisk <DF0:>
sets up a lat-binding assignement of the logical device WorkDisk:. The disk does not have to be inserted in DF0: until the first time you refer to the name WorkDisk:. Notice tha ASSIGN shows DF0: enclosed in angle brackets to indicate that it is DEFERred. After the first reference to WorkDisk:, the volume name of the disk that was in DF0: at the time will replace <DF0:>.

Example 7:

3.OS4:> ASSIGN C: DF0:C PATH
3.OS4:> ASSIGN C: EXISTS
C [DF0:C]
will reference the C directory of whatever disk is in DF0: at the time a command is searched for. Notice that ASSIGN shows DF0:C in square brackets to indicate that it is a non-binding ASSIGN.

Example 8:

3.OS4:> ASSIGN LIBS: ZCad:Libs ADD
adds ZCad:Libs to the list of directories assigned as LIBS:.

Example 9:

3.OS4:> ASSIGN LIBS: ZCad:Libs REMOVE
removes ZCad:Libs from the list of directories assigned as LIBS:.

Pseudo-assigns with OS4
Psuedo-assigns or "pseudo dos devices" are not actually assigns as such. You can't create or delete them like assigns, neither are they "mounted" like a DOS device. All you need to know is that they are not REAL objects per se, but instead act as an abstraction or an alias to a lock on a real object, and they provide a fixed naming method of reference to something that can have different names.

They are used internally by programs and are resolved by the function GetDeviceProcFlags() directly, so as to provide a relative path from a given reference object lock. All of the string argument functions of dos.library like Lock(), Open(), DeleteFile(), CreateDir() etc... call GetDeviceProcFlags() internally, so these references will always be automatically resolved for you, when calling these types of dos.library functions. For reference:

"PROGDIR:" is relative to the lock held in process->pr_HomeDir
"CURRDIR:" is relative to the lock held in process->pr_CurrentDir
When you start a program from Workbench, the current directory "CURRDIR:" is set to zero , only "PROGDIR:" will be valid. The workbench does not propagate any current directory to the started program at all.

When you start a program from a Shell, both are valid, but both do not necessarily point to the same place. For example,

The shell prompt says "Workbench:system/"
You type the command; "calculator"
It happens to be in sys:tools/
So, calculator will be found and started, as it happens to be in the global search path. PROGDIR: will be a lock to the "sys:tools" directory
But CURRDIR: will have a lock to "sys:system" as that is where the shells current dir was when you started the program.
In a shell command, a pair of double quotes ("") can be used to denote the current directory, but this frequently causes confusion, for example: 3.OS4:> COPY "" RAM: ALL
will copy the contents of the current directory to RAM:. It is much easier to understand: 3.OS4:> COPY CurrDir: RAM: ALL
Both commands achieve exactly the same result.


Return to Commands Selection

Disclaimer: Amiga Auckland have prepared the above information for the use of its members based on our experiences and as such is subject to revision at any time. Amiga Auckland cannot guarantee any of the information and cannot be held accountable for any issues that may result from using it.


Copyright 2006 Amiga Auckland Inc. All rights reserved.
Revised: December 24, 2006.