blob: 296dd4289f19bb1216c8d905df3046996f180420 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
#include <unistd.h>
#include <stdlib.h>
#include <sys/mount.h>
#include <string.h>
#include <stdio.h>
#include <errno.h>
int main(int argc, char *argv[]) {
if (argc != 4) {
fprintf(stderr, "usag: %s <source> <target> <filesystem type>\n", argv[0]);
return EXIT_FAILURE;
}
const char *source = argv[1];
const char *target = argv[2];
const char *fstype = argv[3];
if (mount(source, target, fstype, 0, NULL) == -1) {
fprintf(stderr, "mount failed: %s\n", strerror(errno));
return EXIT_FAILURE;
}
printf("Mounted %s on %s with type %s\n", source, target, fstype);
return EXIT_SUCCESS;
}
|