Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

54 lines
853 B

  1. #include <nt.h>
  2. #include <ntrtl.h>
  3. #include <signal.h>
  4. #include <errno.h>
  5. #include <sys/wait.h>
  6. #include <unistd.h>
  7. #include <sys/stat.h>
  8. #include <fcntl.h>
  9. #include <stdio.h>
  10. #include "tsttmp.h" // defines DbgPrint as printf
  11. extern int errno;
  12. VOID mkdir0(char *);
  13. int
  14. __cdecl
  15. main(int argc, char *argv[])
  16. {
  17. if (argc != 2) {
  18. DbgPrint("Usage: 'tstmkdir dirname'\n");
  19. return 1;
  20. }
  21. mkdir0(argv[1]);
  22. return 1;
  23. }
  24. VOID
  25. mkdir0(char *f)
  26. {
  27. int rc;
  28. DbgPrint("mkdir0:++ %s\n",f);
  29. DbgPrint("creating directory %s\n", f);
  30. rc = mkdir(f,0);
  31. ASSERT(rc != -1);
  32. DbgPrint("attempting to recreate existing directory %s\n", f);
  33. rc = mkdir(f,0);
  34. ASSERT(rc == -1 && errno == EEXIST);
  35. DbgPrint("removing directory %s\n", f);
  36. rc = rmdir(f);
  37. ASSERT(rc != -1);
  38. DbgPrint("mkdir0:--\n");
  39. }