home *** CD-ROM | disk | FTP | other *** search
- /* access.c (emx+gcc) */
-
- #include <stdio.h>
- #include <stdlib.h>
- #include <string.h>
- #include <io.h>
-
- int main (int argc, char *argv[])
- {
- int i;
- char *s;
-
- for (i = 1; i < argc; ++i)
- {
- s = argv[i];
- if (access (s, 0) != 0)
- printf ("%s: %s\n", s, strerror (errno));
- else if (access (s, 6) == 0)
- printf ("%s is readable and writable\n", s);
- else if (access (s, 2) == 0)
- printf ("%s is writable\n", s);
- else if (access (s, 4) == 0)
- printf ("%s is readable\n", s);
- else
- printf ("%s exists but is not accessible\n", s);
- }
- return (0);
- }
-