Advertisement
Guest User

Untitled

a guest
May 27th, 2015
221
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.50 KB | None | 0 0
  1. #include <sys/stat.h>
  2. #include <stdio.h>
  3. #include <stdlib.h>
  4. #include <cerrno>
  5. int main(int argc, char *argv[])
  6. {
  7. if(argc != 3)
  8. {
  9. printf("Malo parametrov!\n");
  10. exit(1);
  11. }
  12. if(argv[1][0] != '0')
  13. {
  14. printf("Oct please!\n");
  15. exit(1);
  16. }
  17. char * pEnd;
  18. int mode = strtol(argv[1],&pEnd,8);
  19. if(mode>4095)
  20. {
  21. printf("Prava plohie!\n");
  22. exit(1);
  23. }
  24. chmod(argv[2], mode);
  25. //extern int errno;
  26. if(errno == 2)
  27. {
  28. printf("File is not exist\n");
  29. exit(1);
  30. }
  31. return 0;
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement