#include #include /* I use this to avoid fetching (and potentially bouncing) mail if my home directory is full. */ int main(int argc, char **argv) { struct statfs s; if (argc < 3) { fprintf(stderr, "usage: unlessfull device command ...\n"); return 20; } if (statfs(argv[1], &s) < 0) { perror("statfs failed"); return 20; } if (s.f_bavail < 1) { fprintf(stderr, "device full\n"); return 0; } execvp(argv[2], &argv[2]); perror("execvp failed"); return 20; }