makedir.c 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
  2. /* This Source Code Form is subject to the terms of the Mozilla Public
  3. * License, v. 2.0. If a copy of the MPL was not distributed with this
  4. * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
  5. /*
  6. * This test calls PR_MakeDir to create a bunch of directories
  7. * with various mode bits.
  8. */
  9. #include "prio.h"
  10. #include <stdio.h>
  11. #include <stdlib.h>
  12. int main(int argc, char **argv)
  13. {
  14. if (PR_MakeDir("tdir0400", 0400) == PR_FAILURE) {
  15. fprintf(stderr, "PR_MakeDir failed\n");
  16. exit(1);
  17. }
  18. if (PR_MakeDir("tdir0200", 0200) == PR_FAILURE) {
  19. fprintf(stderr, "PR_MakeDir failed\n");
  20. exit(1);
  21. }
  22. if (PR_MakeDir("tdir0100", 0100) == PR_FAILURE) {
  23. fprintf(stderr, "PR_MakeDir failed\n");
  24. exit(1);
  25. }
  26. if (PR_MakeDir("tdir0500", 0500) == PR_FAILURE) {
  27. fprintf(stderr, "PR_MakeDir failed\n");
  28. exit(1);
  29. }
  30. if (PR_MakeDir("tdir0600", 0600) == PR_FAILURE) {
  31. fprintf(stderr, "PR_MakeDir failed\n");
  32. exit(1);
  33. }
  34. if (PR_MakeDir("tdir0300", 0300) == PR_FAILURE) {
  35. fprintf(stderr, "PR_MakeDir failed\n");
  36. exit(1);
  37. }
  38. if (PR_MakeDir("tdir0700", 0700) == PR_FAILURE) {
  39. fprintf(stderr, "PR_MakeDir failed\n");
  40. exit(1);
  41. }
  42. if (PR_MakeDir("tdir0640", 0640) == PR_FAILURE) {
  43. fprintf(stderr, "PR_MakeDir failed\n");
  44. exit(1);
  45. }
  46. if (PR_MakeDir("tdir0660", 0660) == PR_FAILURE) {
  47. fprintf(stderr, "PR_MakeDir failed\n");
  48. exit(1);
  49. }
  50. if (PR_MakeDir("tdir0644", 0644) == PR_FAILURE) {
  51. fprintf(stderr, "PR_MakeDir failed\n");
  52. exit(1);
  53. }
  54. if (PR_MakeDir("tdir0664", 0664) == PR_FAILURE) {
  55. fprintf(stderr, "PR_MakeDir failed\n");
  56. exit(1);
  57. }
  58. if (PR_MakeDir("tdir0666", 0666) == PR_FAILURE) {
  59. fprintf(stderr, "PR_MakeDir failed\n");
  60. exit(1);
  61. }
  62. return 0;
  63. }