tldm-universe/Ardent/UV/APP.PROGS/SETDIR.B

66 lines
1.8 KiB
Plaintext
Raw Normal View History

2024-09-09 21:51:08 +00:00
*******************************************************************************
*
* New System Admin - given an owner, group, permissions, or any possible
* permutation of the three, this routine will set the ownership
* group ownership, or permissions on particular file or
* directory.
*
* 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 SETDIR.B(owner, group, perms, dir, result)
CALL *ISUSER.B(0,invar)
IF invar = 0 THEN
STOP "You must be super-user TO run this routine."
END
IF dir = "" THEN
result = -1
END
ELSE
IF owner # "" THEN
GOSUB chown
END
IF group # "" THEN
GOSUB grp
END
IF perms # "" THEN
GOSUB chmod
END
END
RETURN
chown:
command = "SH -c 'cd ":dir:" ; find . -exec chown ":owner:" {} \;'"
EXECUTE command
RETURN
grp:
command = "SH -c 'cd ":dir:" ; find . -exec chgrp ":group:" {} \;'"
EXECUTE command
RETURN
chmod:
command = "SH -c 'cd ":dir:" ; find . -exec chmod ":perms:" {} \;'"
EXECUTE command
RETURN
END