add netbsd nl(1)
[rofl0r-hardcore-utils.git] / swapon.c
blob00e71c2e7280b3eef6f1aef36e5a0b8328a4368d
1 /* released under the public domain, as the content is too trivial to even claim a copyright */
3 #include <stdlib.h>
4 #include <stdio.h>
5 #ifdef USE_LIBULZ
6 #include <ulz/stdio-repl.h>
7 #endif
9 __attribute__((noreturn))
10 void usage(void) {
11 printf("usage: swapon path-to-blockdevice\n");
12 exit(1);
15 extern int swapon(const char *path, int swapflags);
17 int main(int argc, char** argv) {
18 int ret;
19 if (argc != 2) usage();
20 if((ret = swapon(argv[1], 0)) == -1) perror("swapon");
21 return ret != 0;