%%s 0/0/0 %%d D 1.1 27-Mar-82 14:58:21 v1.1 1 0 %%c Version 1.1 is the Spring 1982 Distribution of the LBL/Hughes release %%c of the Software Tools Virtual Operating System software and documentation. %%T %%I 1 #-h- chmod.r 1368 asc 25-mar-82 08:11:07 v1.1 (sw-tools v1.1) #-h- main 1295 asc 25-mar-82 08:10:53 v1.1 (sw-tools v1.1) ### ChMod Change the mode (protection codes) of a file. DRIVER(main) character argbuf(FILENAMESIZE) filedes fd filedes open # function(s) integer i, junk, mode, scale, val integer chmod, getarg, index # function(s) string usage "? Usage: chmod sys own grp wld file..." call query(usage) if( getarg( 4, argbuf, FILENAMESIZE) == EOF ) call error(usage) mode = 0 scale = 1 for( i = 1 ; i <= 4 ; i = i + 1 ) { junk = getarg( i, argbuf, FILENAMESIZE) call fold(argbuf) val = 0 if( index( argbuf, 'a') > 0 ) # Allow ALL access val = val + 15 else if( index( argbuf, 'n') == 0 ) { if( index( argbuf, 'r') > 0 ) # Allow READ access val = val + 1 if( index( argbuf, 'w') > 0 ) # Allow WRITE access val = val + 2 if( index( argbuf, 'e') > 0 ) # Allow EXECUTE access val = val + 4 if( index( argbuf, 'd') > 0 ) # Allow DELETE access val = val + 8 } mode = mode + scale * val scale = scale * 16 } for( ; getarg( i, argbuf, FILENAMESIZE) != EOF ; i = i + 1 ) { fd = open( argbuf, READ) if( fd == ERR ) call cant(argbuf) call close(fd) if( chmod( argbuf, mode) != OK ) { call putlin( "? Can't change protection of file ``", ERROUT) call putlin(argbuf, ERROUT) call remark("''") } } DRETURN end #-h- chmod.fmt 935 asc 25-mar-82 08:11:09 v1.1 (sw-tools v1.1) .so ~bin/manhdr .hd Chmod (1) 30-Oct-81 change mode (protection codes) of file .sy chmod system owner group world file... .ds Chmod allows you to change the protection bits on one or more files. The protection fields for system, owner, group and world are specified by groups of the following characters: .sp .in +8 .ti -2 a allow all access .sp .ti -2 r allow read access .sp .ti -2 w allow write access .sp .ti -2 e allow execute access .sp .ti -2 d allow delete access .sp .ti -2 n allow no access .in -8 .sp Each of the four fields must be present and in the proper order. .ex chmod re rwed re re prog1.exe prog2.exe .sp chmod a a r r text.fmt .sp chmod n rwed n n secret.txt .fl none .sa The UNIX command "chmod". .di ? Can't change protection of file ``filename''. .au Dave Martin (Hughes Aircraft) .bu If you deny yourself write access to a file you own you will have to resort to the DCL "set protection" command to regain it. %%E 1