ex53.pp 688 B

123456789101112131415161718192021222324252627
  1. Program Example53;
  2. { Program to demonstrate the S_ISLNK function. }
  3. Uses linux;
  4. Var Info : Stat;
  5. begin
  6. if LStat (paramstr(1),info) then
  7. begin
  8. if S_ISLNK(info.mode) then
  9. Writeln ('File is a link');
  10. if S_ISREG(info.mode) then
  11. Writeln ('File is a regular file');
  12. if S_ISDIR(info.mode) then
  13. Writeln ('File is a directory');
  14. if S_ISCHR(info.mode) then
  15. Writeln ('File is a character device file');
  16. if S_ISBLK(info.mode) then
  17. Writeln ('File is a block device file');
  18. if S_ISFIFO(info.mode) then
  19. Writeln ('File is a named pipe (FIFO)');
  20. if S_ISSOCK(info.mode) then
  21. Writeln ('File is a socket');
  22. end;
  23. end.