2 REM $NetBSD: MountUFS,v 1.3 2002/02/11 19:02:37 reinoud Exp $
4 REM Copyright (c) 1997 Mark Brinicombe
5 REM All rights reserved
7 REM Redistribution and use in source and binary forms, with or without
8 REM modification, are permitted provided that the following conditions
10 REM 1. Redistributions of source code must retain the above copyright
11 REM notice, this list of conditions and the following disclaimer.
12 REM 2. Redistributions in binary form must reproduce the above copyright
13 REM notice, this list of conditions and the following disclaimer in the
14 REM documentation and/or other materials provided with the distribution.
15 REM 3. All advertising materials mentioning features or use of this software
16 REM must display the following acknowledgement:
17 REM This product includes software developed by Mark Brinicombe.
18 REM 4. The name of the company nor the name of the author may be used to
19 REM endorse or promote products derived from this software without specific
20 REM prior written permission.
22 REM THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
23 REM IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
24 REM OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
25 REM IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
26 REM INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
27 REM BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
28 REM OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
29 REM ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
30 REM OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
31 REM THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
34 REM Created : 26/01/97
35 REM Last updated : 26/01/97
37 REM Decodes filesystem and device arguments and mounts the correct
38 REM FFS partition with unixfs
42 SYS "OS_GetEnv" TO env$
44 REM Skipprogram path etc.
45 IF (INSTR(env$, "-quit")) THEN
46 I% = INSTR(env$, """")
47 I% = INSTR(env$, """", I% + 1)
50 UNTIL MID$(env$, I%, 1) <> " "
54 REM Extract the first argument as the filesystem
56 filesys$ = FNupper(LEFT$(env$, I% - 1))
58 REM Skip to the next argument
61 UNTIL MID$(env$, I%, 1) <> " "
64 REM The drive is the next argument
68 part$ = "a" : REM partition a
70 drive$ = LEFT$(env$, I% - 1)
71 REM Skip to the next argument
74 UNTIL MID$(env$, I%, 1) <> " "
80 part% = ASC(FNupper(part$))-ASC("A")
83 REM Lookup the SWI Number for the DiscOp SWI
84 swi$ = filesys$ + "_DiscOp"
85 SYS "OS_SWINumberFromString",, swi$ TO swi%
87 REM Assemble the unixfs_mount argument
88 REM Assumes the filesystem is on the a partition
89 swi% = swi% AND NOT(&3F)
90 swi% += drive% * 8 + part%
92 REM Mount the filesystem
93 OSCLI("<BtNetBSD$Dir>.native.unixfs_res")
94 OSCLI("unixfs_mount " + STR$~(swi%))
97 REM Convert a string to upper case
100 FOR A% = 1 TO LEN(A$)
101 R$ = R$ + CHR$(ASC(MID$(A$, A%, 1)) AND &DF)