.title ChMod ; ; Change the mode (protection codes) of a file. ; ; SYNOPSIS ; ; stat = chmod( name, mode) ; ; character name - zero byte terminated string with file name ; integer mode - desired mode (see RMS manual for format) ; ; integer stat - OK | ERR ; ; local definitions ; ok=0 ; software tools OK return err=-3 ; software tools ERR return name=4 ; ap offset to name of file mode=8 ; ; local data ; .psect st_chmod_data rel,con,gbl,noexe,wrt,rd,pic,noshr,usr,novec,long xpro: $xabpro mfab: $fab fna=buf,- fop=cif,- xab=xpro ; buf: .blkb 120 ; ; entry point ; .psect st_pure_code rel,con,lcl,exe,nowrt,rd,pic,shr,usr,novec,long .entry chmod ^m<> pushal buf pushl name(ap) calls #2,mklocl ; convert to DEC format name pushal buf calls #1,upper ; crunch it to upper case pushal buf calls #1,length ; calculate length of string movl r0,r1 ; move length to safe place $fab_store fab=mfab,fns=r1 ; store length of string $create fab=mfab ; open file blbc r0,error ; low bit clear indicates error mcomw @mode(ap),xab$w_pro+xpro ; set protection $close fab=mfab blbc r0,error ; low bit clear indicates error movl #ok,r0 ret error: movl #err,r0 ret .end