78 lines
2.3 KiB
Brainfuck
Executable File
78 lines
2.3 KiB
Brainfuck
Executable File
*******************************************************************************
|
|
*
|
|
* New System Admin - This routine will take a string, and decide if it is
|
|
* valid as a permissions string, and will parse it into a numeric
|
|
* value such as 777.
|
|
*
|
|
* Module %M% Version %I% Date %H%
|
|
*
|
|
* (c) Copyright 1998 Ardent Software Inc. - All Rights Reserved
|
|
* This is unpublished proprietary source code of Ardent Software Inc.
|
|
* The copyright notice above does not evidence any actual or intended
|
|
* publication of such source code.
|
|
*
|
|
*******************************************************************************
|
|
*
|
|
* Maintenence log - insert most recent change descriptions at top
|
|
*
|
|
* Date.... GTAR# WHO Description.........................................
|
|
* 10/14/98 23801 SAP Change copyrights.
|
|
* 11/05/90 7393 DPB Routine first created and admin'd.
|
|
*******************************************************************************
|
|
|
|
SUBROUTINE PARSE.PERM.B(permstr, rtnvalue)
|
|
EQU DEFAULT TO 1
|
|
BEGIN CASE
|
|
|
|
CASE permstr = "" OR permstr = -1
|
|
rtnvalue = -1
|
|
|
|
CASE (NUM(permstr) = 1 AND LEN(permstr) = 3)
|
|
IF permstr[1,1] < 8 and permstr[2,1] < 8 and permstr[3,1] < 8 THEN
|
|
rtnvalue = permstr
|
|
END
|
|
ELSE
|
|
rtnvalue = -1
|
|
END
|
|
|
|
|
|
CASE DEFAULT
|
|
IF LEN(permstr) = 9 THEN
|
|
ok = 1
|
|
perms = 0
|
|
permstr = UPCASE(permstr)
|
|
FOR I = 1 to 9
|
|
t = 1
|
|
for J = 0 to (3 - int((I-1)/3)) -2
|
|
t = t * 10
|
|
next j
|
|
BEGIN CASE
|
|
|
|
CASE ((permstr[I,1] = 'R' OR permstr[I,1] ='-') AND (MOD(I,3) = 1))
|
|
IF permstr[I,1] = 'R' THEN perms += 4*t
|
|
CASE ((permstr[I,1] = 'W' OR permstr[I,1] ='-') AND (MOD(I,3) = 2))
|
|
IF permstr[I,1] = 'W' THEN perms += 2*t
|
|
CASE ((permstr[I,1] = 'X' OR permstr[I,1] ='-') AND (MOD(I,3) = 0))
|
|
IF permstr[I,1] = 'X' THEN perms += 1*t
|
|
|
|
CASE DEFAULT
|
|
ok = 0
|
|
END CASE
|
|
NEXT I
|
|
|
|
IF ok = 1 THEN
|
|
rtnvalue = perms
|
|
END
|
|
ELSE
|
|
rtnvalue = -1
|
|
END
|
|
END
|
|
ELSE
|
|
rtnvalue = -1
|
|
END
|
|
END CASE
|
|
RETURN
|
|
|
|
END
|
|
|