2013-08-09 14:42:49 +00:00
|
|
|
/* See LICENSE file for copyright and license details. */
|
|
|
|
#include <sys/swap.h>
|
|
|
|
#include <errno.h>
|
|
|
|
#include <stdio.h>
|
2013-10-07 18:11:40 +00:00
|
|
|
#include <stdlib.h>
|
2013-08-09 14:42:49 +00:00
|
|
|
#include <string.h>
|
|
|
|
#include "util.h"
|
|
|
|
|
|
|
|
static void
|
|
|
|
usage(void)
|
|
|
|
{
|
2013-08-14 13:32:22 +00:00
|
|
|
eprintf("usage: %s device\n", argv0);
|
2013-08-09 14:42:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
int
|
|
|
|
main(int argc, char *argv[])
|
|
|
|
{
|
|
|
|
int i;
|
2013-10-07 18:11:40 +00:00
|
|
|
int ret = EXIT_SUCCESS;
|
2013-08-09 14:42:49 +00:00
|
|
|
|
|
|
|
ARGBEGIN {
|
|
|
|
default:
|
|
|
|
usage();
|
|
|
|
} ARGEND;
|
|
|
|
|
|
|
|
if (argc < 1)
|
|
|
|
usage();
|
|
|
|
|
|
|
|
for (i = 0; i < argc; i++) {
|
|
|
|
ret = swapoff(argv[i]);
|
|
|
|
if (ret < 0) {
|
|
|
|
fprintf(stderr, "swapoff %s: %s\n",
|
|
|
|
argv[i], strerror(errno));
|
2013-10-07 18:11:40 +00:00
|
|
|
ret = EXIT_FAILURE;
|
2013-08-09 14:42:49 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
return ret;
|
|
|
|
}
|