summaryrefslogtreecommitdiff
path: root/partx/delpart.c
blob: 940cfd7db1673dba64175b53e83f4042bed9f483 (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
26
27
#include <stdio.h>
#include <stdlib.h>
#include <fcntl.h>

#include "partx.h"

int
main(int argc, char **argv){
	int fd;

	if (argc != 3) {
		fprintf(stderr,
			"usage: %s diskdevice partitionnr\n",
			argv[0]);
		exit(1);
	}
	if ((fd = open(argv[1], O_RDONLY)) < 0) {
		perror(argv[1]);
		exit(1);
	}

	if (partx_del_partition(fd, atoi(argv[2])) == -1) {
		perror("BLKPG");
		exit(1);
	}
	return 0;
}