File: is_dir_c.c

package info (click to toggle)
libslow5lib 0.7.0%2Bdfsg-3
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 25,092 kB
  • sloc: ansic: 11,825; python: 1,179; sh: 547; makefile: 91; cpp: 40
file content (19 lines) | stat: -rw-r--r-- 363 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <stdlib.h>

int main(int argc, char **argv) {
    char *f_name = argv[1];

    struct stat f_stat;
    if (stat(f_name, &f_stat) == -1) {
        return EXIT_FAILURE;
    }

    if (S_ISDIR(f_stat.st_mode)) {
        return EXIT_SUCCESS; 
    } else {
        return EXIT_FAILURE;
    }
}