Contents | Prev | Next

4.2.34 oth_x

Description

oth_x can be AND'd (see and operator (bitwise)) with the filemode retrieved by the built-in procedure getfilemode to determine whether users not belonging to the same group as the owner of a file or directory has permission to execute the file or search the directory.

Example

For example the simple program below asks for a filename and then displays the file permissions for users who not belong to the same group as the owner of the file.

   program OtherUsersPermissions(input, output);
   var
      s : filename;
      mode : integer;
      isdir : boolean;
   begin
      write('Enter filename:');
      readln(s);
      s := fexpand(s);
      getfilemode(s, mode);
      isdir := (mode and dir_bit) <> 0;
      write('Other permissions :');
      if (mode and oth_r) <> 0 then
         write(' Read');
      if (mode and oth_w) <> 0 then
         write(' Write');
      if (mode and oth_x) <> 0 then
         if isdir then
            write(' Search')
         else
            write(' Execute');
      writeln;
   end.

Portability

Operating Systems: All
Standard Pascal: No

Contents | Prev | Next