2013-03-08 00:00:21 +00:00
|
|
|
#include <sys/statvfs.h>
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
|
|
|
|
int main(int argc, char ** argv) {
|
|
|
|
struct statvfs stat;
|
|
|
|
if (argc != 2) {
|
|
|
|
fprintf(stderr, "Usage: %s PATH", argv[0]);
|
|
|
|
exit(2);
|
|
|
|
}
|
2013-03-26 16:35:28 +00:00
|
|
|
if (statvfs(argv[1], &stat) != 0) {
|
2013-03-08 00:00:21 +00:00
|
|
|
perror("statvfs");
|
|
|
|
exit(3);
|
|
|
|
}
|
|
|
|
if (stat.f_flag & ST_RDONLY)
|
|
|
|
exit(0);
|
|
|
|
else
|
|
|
|
exit(1);
|
|
|
|
}
|
|
|
|
|