Home | History | Annotate | Line # | Download | only in native
      1  1.1  jdolecek REM >Mountufs
      2  1.1  jdolecek REM $NetBSD: MountUFS,v 1.1.1.1 2002/05/09 20:03:59 jdolecek Exp $
      3  1.1  jdolecek REM
      4  1.1  jdolecek REM Copyright (c) 1997 Mark Brinicombe
      5  1.1  jdolecek REM All rights reserved
      6  1.1  jdolecek REM
      7  1.1  jdolecek REM Redistribution and use in source and binary forms, with or without
      8  1.1  jdolecek REM modification, are permitted provided that the following conditions
      9  1.1  jdolecek REM are met:
     10  1.1  jdolecek REM 1. Redistributions of source code must retain the above copyright
     11  1.1  jdolecek REM    notice, this list of conditions and the following disclaimer.
     12  1.1  jdolecek REM 2. Redistributions in binary form must reproduce the above copyright
     13  1.1  jdolecek REM    notice, this list of conditions and the following disclaimer in the
     14  1.1  jdolecek REM    documentation and/or other materials provided with the distribution.
     15  1.1  jdolecek REM 3. All advertising materials mentioning features or use of this software
     16  1.1  jdolecek REM    must display the following acknowledgement:
     17  1.1  jdolecek REM        This product includes software developed by Mark Brinicombe.
     18  1.1  jdolecek REM 4. The name of the company nor the name of the author may be used to
     19  1.1  jdolecek REM    endorse or promote products derived from this software without specific
     20  1.1  jdolecek REM    prior written permission.
     21  1.1  jdolecek REM
     22  1.1  jdolecek REM THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
     23  1.1  jdolecek REM IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
     24  1.1  jdolecek REM OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
     25  1.1  jdolecek REM IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
     26  1.1  jdolecek REM INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
     27  1.1  jdolecek REM BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
     28  1.1  jdolecek REM OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
     29  1.1  jdolecek REM ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
     30  1.1  jdolecek REM OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
     31  1.1  jdolecek REM THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
     32  1.1  jdolecek REM DAMAGE.
     33  1.1  jdolecek REM
     34  1.1  jdolecek REM Created      : 26/01/97
     35  1.1  jdolecek REM Last updated : 26/01/97
     36  1.1  jdolecek REM
     37  1.1  jdolecek REM Decodes filesystem and device arguments and mounts the correct
     38  1.1  jdolecek REM FFS partition with unixfs
     39  1.1  jdolecek REM
     40  1.1  jdolecek 
     41  1.1  jdolecek REM Get environment
     42  1.1  jdolecek SYS "OS_GetEnv" TO env$
     43  1.1  jdolecek 
     44  1.1  jdolecek REM Skipprogram path etc.
     45  1.1  jdolecek IF (INSTR(env$, "-quit")) THEN
     46  1.1  jdolecek   I% = INSTR(env$, """")
     47  1.1  jdolecek   I% = INSTR(env$, """", I% + 1)
     48  1.1  jdolecek   REPEAT
     49  1.1  jdolecek     I% += 1
     50  1.1  jdolecek   UNTIL MID$(env$, I%, 1) <> " "
     51  1.1  jdolecek   env$ = MID$(env$, I%)
     52  1.1  jdolecek ENDIF
     53  1.1  jdolecek 
     54  1.1  jdolecek REM Extract the first argument as the filesystem
     55  1.1  jdolecek I% = INSTR(env$, " ")
     56  1.1  jdolecek filesys$ = FNupper(LEFT$(env$, I% - 1))
     57  1.1  jdolecek 
     58  1.1  jdolecek REM Skip to the next argument
     59  1.1  jdolecek REPEAT
     60  1.1  jdolecek   I% += 1
     61  1.1  jdolecek UNTIL MID$(env$, I%, 1) <> " "
     62  1.1  jdolecek env$ = MID$(env$, I%)
     63  1.1  jdolecek 
     64  1.1  jdolecek REM The drive is the next argument
     65  1.1  jdolecek I% = INSTR(env$, " ")
     66  1.1  jdolecek IF (I% = 0) THEN
     67  1.1  jdolecek   drive$ = env$
     68  1.1  jdolecek   part$  = "a"    : REM partition a
     69  1.1  jdolecek ELSE
     70  1.1  jdolecek   drive$ = LEFT$(env$, I% - 1)
     71  1.1  jdolecek   REM Skip to the next argument
     72  1.1  jdolecek   REPEAT
     73  1.1  jdolecek     I% += 1
     74  1.1  jdolecek   UNTIL MID$(env$, I%, 1) <> " "
     75  1.1  jdolecek   env$  = MID$(env$, I%)
     76  1.1  jdolecek   part$ = env$
     77  1.1  jdolecek ENDIF
     78  1.1  jdolecek 
     79  1.1  jdolecek drive% = VAL(drive$)
     80  1.1  jdolecek part%  = ASC(FNupper(part$))-ASC("A")
     81  1.1  jdolecek unit%  = drive% - 4
     82  1.1  jdolecek 
     83  1.1  jdolecek REM Lookup the SWI Number for the DiscOp SWI
     84  1.1  jdolecek swi$ = filesys$ + "_DiscOp"
     85  1.1  jdolecek SYS "OS_SWINumberFromString",, swi$ TO swi%
     86  1.1  jdolecek 
     87  1.1  jdolecek REM Assemble the unixfs_mount argument
     88  1.1  jdolecek REM Assumes the filesystem is on the a partition
     89  1.1  jdolecek swi% = swi% AND NOT(&3F)
     90  1.1  jdolecek swi% += drive% * 8 + part%
     91  1.1  jdolecek 
     92  1.1  jdolecek REM Mount the filesystem
     93  1.1  jdolecek OSCLI("<BtNetBSD$Dir>.native.unixfs_res")
     94  1.1  jdolecek OSCLI("unixfs_mount " + STR$~(swi%))
     95  1.1  jdolecek END
     96  1.1  jdolecek 
     97  1.1  jdolecek REM Convert a string to upper case
     98  1.1  jdolecek DEF FNupper(A$)
     99  1.1  jdolecek R$ = ""
    100  1.1  jdolecek FOR A% = 1 TO LEN(A$)
    101  1.1  jdolecek   R$ = R$ + CHR$(ASC(MID$(A$, A%, 1)) AND &DF)
    102  1.1  jdolecek NEXT
    103  1.1  jdolecek 
    104  1.1  jdolecek = R$
    105