util-linux/partx/delpart.c

28 lines
402 B
C
Raw Normal View History

2006-12-06 17:25:39 -06:00
#include <stdio.h>
#include <stdlib.h>
#include <fcntl.h>
#include "partx.h"
2006-12-06 17:25:39 -06:00
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) {
2006-12-06 17:25:39 -06:00
perror("BLKPG");
exit(1);
}
return 0;
}