Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 01 Feb 2004 21:34:36 -0500
From:      slick <plan_b@videotron.ca>
To:        Hackers <hackers@freebsd.org>
Subject:   My new fdisk(8) program.
Message-ID:  <HCELJGGAFOJADLJLFKLJIEDGCAAA.plan_b@videotron.ca>

next in thread | raw e-mail | index | archive | help
This is a multi-part message in MIME format.

--Boundary_(ID_8DlZ6CXinoSLze4A2l+YXg)
Content-type: text/plain; charset=iso-8859-1
Content-transfer-encoding: 7BIT

Hi,
	I decided to write a new fdisk(8) program for unix. The main goal was to be
able to do all the MBR manipulation from the command line, to be portable
across all unix platform using libc, to work alone, to be as small and
simple as possible and to be easy to maintain and extend.

	I did it.

	Program:
		- do anything the exiting fdisk(8) do and even more(also more to come).
		- compiles, run and work on any sane unix platform with standard libc.
		- has no need for anything else than "/bin/sh" and "/usr/lib/libc*".
		- is 10 times smaller.
		- in pure C.
		- has no struct.

	I tested it, but you know I might have forget some details or even do
things better.

	Please review the code, the structure, the functionality and the error
possibility.

	I accept any (good and/or bad) feedback if its constructive.

	Thanks for taking the time to do so and if you don't thanks anyway...

	Slick
	Plan B
	Plan_b@videotron.ca

--Boundary_(ID_8DlZ6CXinoSLze4A2l+YXg)
Content-type: application/octet-stream; name=fdisk.c
Content-transfer-encoding: quoted-printable
Content-disposition: attachment; filename=fdisk.c

/*=0A=
 *=0A=
 * Copyright (c) 2004 Plan B =0A=
 * All Rights Reserved.=0A=
 *=0A=
 * Permission to use, copy, modify and distribute this software and its=0A=
 * documentation is hereby granted, provided that both the copyright=0A=
 * notice and this permission notice appear in all copies of the=0A=
 * software, derivative works or modified versions, and any portions=0A=
 * thereof, and that both notices appear in supporting documentation.=0A=
 *=0A=
 * Plan B ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"=0A=
 * CONDITION. PLAN B DISCLAIMS ANY LIABILITY OF ANY KIND FOR=0A=
 * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.=0A=
 *=0A=
 * PLAN B requests users of this software to return to=0A=
 *=0A=
 *   Slick=0A=
 *   Plan B=0A=
 *   Montreal, Quebec=0A=
 *   plan_b@videotron.ca=0A=
 *=0A=
 */=0A=
=0A=
#include <unistd.h>=0A=
#include <stdio.h>=0A=
#include <fcntl.h>=0A=
#include <stdlib.h>=0A=
#include <limits.h>=0A=
#include <strings.h>=0A=
#include <sys/stat.h>=0A=
#include <sys/types.h>=0A=
#include <sys/errno.h>=0A=
=0A=
int in;				/* Source File Descriptor */=0A=
int out;			/* Destination File Descriptor */=0A=
int pte;			/* Partition Table Entry Offset */=0A=
int byte_tx;			/* Bytes Transfered */=0A=
int part_dec;			/* Partition Table Entry Decimal Value */=0A=
int type_dec;			/* Partition Type Decimal Value */=0A=
const int pt_size =3D 66;		/* Partition Table Size in Bytes */=0A=
const int bc_size =3D 446;	/* Boot Code Size in Bytes */=0A=
const int sector_size =3D 512;	/* Sector Size in Bytes */=0A=
unsigned char buffer_in[512];	/* Source Buffer */=0A=
unsigned char buffer_out[512];	/* Destination Buffer */=0A=
=0A=
int getopt_argc(int argc, char **argv);=0A=
int bc_copy(char **argv);=0A=
int pt_copy(char **argv);=0A=
int bc_print(char **argv);=0A=
int pt_print(char **argv);=0A=
int p_activate(char **argv);=0A=
int p_type(char **argv);=0A=
int ptbe_edit(char **argv);=0A=
int ptle_edit(char **argv);=0A=
int pt_sign(char **argv);=0A=
void pt_list();=0A=
void usage();=0A=
=0A=
main(int argc, char **argv) {=0A=
  int c =3D 0;=0A=
  int flag =3D 1;=0A=
  if (argc =3D=3D 1) { flag =3D 0; }=0A=
  for (c =3D 0; c !=3D argc; c++) {=0A=
    if ((flag =3D=3D -1) || (flag =3D=3D 0)) { break; }=0A=
    if (argv[c][0] =3D=3D '-') {=0A=
      flag =3D -1;=0A=
      if ((argv[c][1] =3D=3D 'a') && (getopt_argc(argc - c, &argv[c]) =
=3D=3D 3)) {=0A=
        p_activate(&argv[c + 1]); flag =3D 1; }=0A=
      if ((argv[c][1] =3D=3D 'c') && (getopt_argc(argc - c, &argv[c]) =
=3D=3D 3)) {=0A=
        bc_copy(&argv[c + 1]); flag =3D 1; }=0A=
      if ((argv[c][1] =3D=3D 'C') && (getopt_argc(argc - c, &argv[c]) =
=3D=3D 3)) {=0A=
        pt_copy(&argv[c + 1]); flag =3D 1; }=0A=
      if ((argv[c][1] =3D=3D 'e') && (getopt_argc(argc - c, &argv[c]) =
=3D=3D 9)) {=0A=
        ptbe_edit(&argv[c + 1]); flag =3D 1; }=0A=
      if ((argv[c][1] =3D=3D 'E') && (getopt_argc(argc - c, &argv[c]) =
=3D=3D 5)) {=0A=
        ptle_edit(&argv[c + 1]); flag =3D 1; }=0A=
      if ((argv[c][1] =3D=3D 'h') && (getopt_argc(argc - c, &argv[c]) =
=3D=3D 1)) {=0A=
        usage(); flag =3D 1; }=0A=
      if ((argv[c][1] =3D=3D 'l') && (getopt_argc(argc - c, &argv[c]) =
=3D=3D 1)) {=0A=
        pt_list(); flag =3D 1; }=0A=
      if ((argv[c][1] =3D=3D 'p') && (getopt_argc(argc - c, &argv[c]) =
=3D=3D 2)) {=0A=
        bc_print(&argv[c + 1]); flag =3D 1; }=0A=
      if ((argv[c][1] =3D=3D 'P') && (getopt_argc(argc - c, &argv[c]) =
=3D=3D 2)) {=0A=
        pt_print(&argv[c + 1]); flag =3D 1;}=0A=
      if ((argv[c][1] =3D=3D 'S') && (getopt_argc(argc - c, &argv[c]) =
=3D=3D 2)) {=0A=
        pt_sign(&argv[c + 1]); flag =3D 1; } =0A=
      if ((argv[c][1] =3D=3D 't') && (getopt_argc(argc - c, &argv[c]) =
=3D=3D 4)) {=0A=
        p_type(&argv[c + 1]); flag =3D 1; }=0A=
      if  (argv[c][1] =3D=3D 'u') {=0A=
        usage(); flag =3D 1; }=0A=
    }=0A=
  }=0A=
  if ((flag =3D=3D -1) || (flag =3D=3D 0)) { usage(); }=0A=
  exit (flag);=0A=
}=0A=
=0A=
int getopt_argc(int argc, char **argv) {=0A=
=0A=
  int c =3D 1;=0A=
  int opt_argc =3D argc;=0A=
=0A=
  while (opt_argc !=3D 1) {=0A=
    if (argv[c][0] =3D=3D '-') { break; }=0A=
    else { opt_argc--; c++; }=0A=
  }=0A=
  return (c);=0A=
}=0A=
=0A=
int p_activate(char **argv) {=0A=
=0A=
  int c;=0A=
=0A=
  part_dec =3D strtoul(argv[1], NULL, 10);=0A=
  if (part_dec =3D=3D -1) {=0A=
    perror("\nPartition Number"); printf("\n"); exit (-1); }=0A=
  if ((part_dec < 1) || (part_dec > 4)) {=0A=
    printf("\nPartition Range: 1-4\n\n"); exit (-1); }=0A=
=0A=
  in =3D open(argv[0], O_RDWR);=0A=
  if (in =3D=3D -1) {=0A=
    perror("\nOpen Source"); printf("\n"); exit (-1); }=0A=
=0A=
  byte_tx =3D read(in, buffer_in, sector_size);=0A=
  if (byte_tx !=3D sector_size) {=0A=
    perror("\nRead Source Sector"); printf("\n"); exit (-1); }=0A=
=0A=
  for (c =3D 0; c < 4; c++) { pte =3D bc_size + 16 * c; buffer_in[pte] =
=3D 00; }=0A=
=0A=
  pte =3D bc_size + 16 * (part_dec - 1);=0A=
  buffer_in[pte] =3D 128;=0A=
=0A=
  byte_tx =3D pwrite(in, buffer_in, sector_size, 0);=0A=
  if (byte_tx !=3D sector_size) {=0A=
    perror("\nWrite Source Sector"); printf("\n"); exit (-1); }=0A=
=0A=
  printf("\nPartition %d of %s has been activated.\n\n", part_dec, =
argv[0]);=0A=
}=0A=
=0A=
int bc_copy(char **argv) {=0A=
=0A=
  in =3D open(argv[0], O_RDONLY);=0A=
  if (in =3D=3D -1) { perror("\nOpen Source"); printf("\n"); exit (-1); }=0A=
=0A=
  byte_tx =3D read(in, buffer_in, sector_size);=0A=
  if (byte_tx !=3D sector_size) {=0A=
    perror("\nRead Source Sector"); printf("\n"); exit (-1); }=0A=
=0A=
  out =3D open(argv[1], O_RDWR|O_CREAT, S_IRUSR|S_IWUSR);=0A=
  if (out =3D=3D -1) { perror("\nOpen Destination"); printf("\n"); exit =
(-1); }=0A=
=0A=
  byte_tx =3D read(out, buffer_out, sector_size);=0A=
  if (byte_tx =3D=3D -1) {=0A=
    perror("\nRead Destination Sector"); printf("\n"); exit (-1); }=0A=
=0A=
  bcopy(buffer_in, buffer_out, bc_size);=0A=
=0A=
  byte_tx =3D pwrite(out, buffer_out, sector_size, 0);=0A=
  if (byte_tx !=3D sector_size) {=0A=
    perror("\nWrite Destination Sector"); printf("\n"); exit (-1); }=0A=
=0A=
  printf("\nBoot Code has been transfered from %s to %s\n\n", argv[0], =
argv[1]);=0A=
}=0A=
=0A=
int pt_copy(char **argv) {=0A=
=0A=
  in =3D open(argv[0], O_RDONLY);=0A=
  if (in =3D=3D -1) {=0A=
    perror("\nOpen Source"); printf("\n"); exit (-1); }=0A=
=0A=
  byte_tx =3D read(in, buffer_in, sector_size);=0A=
  if (byte_tx !=3D sector_size) {=0A=
    perror("\nRead Source Sector"); printf("\n"); exit (-1); }=0A=
=0A=
  out =3D open(argv[1], O_RDWR|O_CREAT, S_IRUSR|S_IWUSR);=0A=
  if (out =3D=3D -1) {=0A=
    perror("\nOpen Destination"); printf("\n"); exit (-1); }=0A=
=0A=
  byte_tx =3D read(out, buffer_out, sector_size);=0A=
  if (byte_tx =3D=3D -1) {=0A=
    perror("\nRead Destination Sector"); printf("\n"); exit (-1); }=0A=
=0A=
  bcopy(buffer_in + bc_size, buffer_out + bc_size, pt_size);=0A=
=0A=
  byte_tx =3D pwrite(out, buffer_out, sector_size, 0);=0A=
  if (byte_tx !=3D sector_size) {=0A=
    perror("\nWrite Destination Sector"); printf("\n"); exit (-1); }=0A=
=0A=
  printf("\nPartition Table has been transfered from %s to %s\n\n",=0A=
                                                          argv[0], =
argv[1]);=0A=
}=0A=
=0A=
int ptbe_edit(char **argv) {=0A=
=0A=
  int bc_dec;           /* Beginning Cylinder Decimal Value */=0A=
  int bh_dec;           /* Beginning Head     Decimal Value */=0A=
  int bs_dec;           /* Beginning Sector   Decimal Value */=0A=
  int ec_dec;           /* Ending    Cylinder Decimal Value */=0A=
  int eh_dec;           /* Ending    Head     Decimal Value */=0A=
  int es_dec;           /* Ending    Sector   Decimal Value */=0A=
=0A=
  part_dec =3D strtoul(argv[1], NULL, 10);=0A=
  if (part_dec =3D=3D -1) { perror("\nPartition Number"); printf("\n"); =
exit (-1); }=0A=
  if ((part_dec < 1) || (part_dec > 4)) {=0A=
    printf("\nPartition Range: 1-4\n\n"); exit (-1); }=0A=
  =0A=
  bc_dec =3D strtoul(argv[2], NULL, 10);=0A=
  if (bc_dec =3D=3D -1) { perror("\nPartition Number"); printf("\n"); =
exit (-1); }=0A=
  ec_dec =3D strtoul(argv[5], NULL, 10);=0A=
  if (bh_dec =3D=3D -1) { perror("\nPartition Number"); printf("\n"); =
exit (-1); }=0A=
  if ((bc_dec > 1024) || (ec_dec > 1024)) {=0A=
    printf("\nMaximum Cylinder Value: 1024\n\n"); exit (-1); }=0A=
=0A=
  bh_dec =3D strtoul(argv[3], NULL, 10);=0A=
  if (bc_dec =3D=3D -1) { perror("\nPartition Number"); printf("\n"); =
exit (-1); }=0A=
  eh_dec =3D strtoul(argv[6], NULL, 10);=0A=
  if (eh_dec =3D=3D -1) { perror("\nPartition Number"); printf("\n"); =
exit (-1); }=0A=
  if ((bh_dec > 255) || (eh_dec > 255)) {=0A=
    printf("\nMaximum Head Value: 255\n\n"); exit (-1); }=0A=
 =0A=
  bs_dec =3D strtoul(argv[4], NULL, 10);=0A=
  if (bs_dec =3D=3D -1) { perror("\nPartition Number"); printf("\n"); =
exit (-1); }=0A=
  es_dec =3D strtoul(argv[7], NULL, 10);=0A=
  if (es_dec =3D=3D -1) { perror("\nPartition Number"); printf("\n"); =
exit (-1); }=0A=
  if ((bs_dec > 63) || (es_dec > 63)) {=0A=
    printf("\nMaximum Sector Value: 63\n\n"); exit (-1); }=0A=
=0A=
  in =3D open(argv[0], O_RDWR);=0A=
  if (in =3D=3D -1) { perror("\nOpen Source"); printf("\n"); exit (-1); }=0A=
=0A=
  byte_tx =3D read(in, buffer_in, sector_size);=0A=
  if (byte_tx !=3D sector_size) {=0A=
    perror("\nRead Source Sector"); printf("\n"); exit (-1); }=0A=
=0A=
  pte =3D bc_size + 16 * (part_dec -1);=0A=
  buffer_in[pte + 1] =3D bh_dec;=0A=
  buffer_in[pte + 2] =3D bs_dec + ((bc_dec & 768) >> 2);=0A=
  buffer_in[pte + 3] =3D bc_dec & 255;=0A=
  buffer_in[pte + 5] =3D eh_dec;=0A=
  buffer_in[pte + 6] =3D es_dec + ((ec_dec & 768) >> 2);=0A=
  buffer_in[pte + 7] =3D ec_dec & 255;=0A=
=0A=
  byte_tx =3D pwrite(in, buffer_in, sector_size, 0);=0A=
  if (byte_tx !=3D sector_size) {=0A=
    perror("\nWrite Source Sector"); printf("\n"); exit (-1); }=0A=
=0A=
  printf("\nPartition %d of %s CHS parameters have been changed to:\n\n"=0A=
       "       Beginning:\n"=0A=
       "               Cylinder: %d\n"=0A=
       "               Head:     %d\n"=0A=
       "               Sector:   %d\n"=0A=
       "       Ending:\n"=0A=
       "               Cylinder: %d\n"=0A=
       "               Head:     %d\n"=0A=
       "               Sector:   %d\n\n",=0A=
       part_dec, argv[0], bc_dec, bh_dec, bs_dec, ec_dec, eh_dec, =
es_dec);=0A=
}=0A=
=0A=
int ptle_edit(char **argv) {=0A=
=0A=
  int slba_dec;         /* Starting LBA Sector Decimal Value */=0A=
  int lbas_dec;         /* LBA Size in Sectors Decimal Value */=0A=
=0A=
  part_dec =3D strtoul(argv[1], NULL, 10);=0A=
  if (part_dec =3D=3D -1) { perror("\nPartition Number"); printf("\n"); =
exit (-1); }=0A=
  if ((part_dec < 1) || (part_dec > 4)) {=0A=
    printf("\nPartition Range: 1-4\n\n"); exit (-1); }=0A=
=0A=
  slba_dec =3D strtoul(argv[2], NULL, 10);=0A=
  if (slba_dec =3D=3D -1) { perror("\nStarting LBA"); printf("\n"); exit =
(-1); }=0A=
  if (slba_dec > 2000000000) {=0A=
    printf("\nMaximum Starting LBA Value: 2000000000\n\n"); exit (-1); }=0A=
 =0A=
  lbas_dec =3D strtoul(argv[3], NULL, 10);=0A=
  if (lbas_dec =3D=3D -1) { perror("\nLBA Size"); printf("\n"); exit =
(-1); }=0A=
  if (lbas_dec > 2000000000) {=0A=
    printf("\nMaximum LBA Size value: 2000000000\n\n"); exit (-1); }=0A=
=0A=
  in =3D open(argv[0], O_RDWR);=0A=
  if (in =3D=3D -1) { perror("\nOpen Source"); printf("\n"); exit (-1); }=0A=
=0A=
  byte_tx =3D read(in, buffer_in, sector_size);=0A=
  if (byte_tx !=3D sector_size) {=0A=
    perror("\nRead Source Sector"); printf("\n"); exit (-1); }=0A=
=0A=
  pte =3D bc_size + 16 * (part_dec - 1);=0A=
  buffer_in[pte +  8] =3D  slba_dec & 255;=0A=
  buffer_in[pte +  9] =3D (slba_dec & 65280) >> 8;=0A=
  buffer_in[pte + 10] =3D (slba_dec & 16711680) >> 16;=0A=
  buffer_in[pte + 11] =3D  slba_dec >> 24;=0A=
  buffer_in[pte + 12] =3D  lbas_dec & 255;=0A=
  buffer_in[pte + 13] =3D (lbas_dec & 65280) >> 8;=0A=
  buffer_in[pte + 14] =3D (lbas_dec & 16711680) >> 16;=0A=
  buffer_in[pte + 15] =3D  lbas_dec >> 24;=0A=
=0A=
  byte_tx =3D pwrite(in, buffer_in, sector_size, 0);=0A=
  if (byte_tx !=3D sector_size) {=0A=
    perror("\nWrite Source Sector"); printf("\n"); exit (-1); }=0A=
=0A=
  printf("\nPartition %d of %s LBA parameters have been changed to:\n\n"=0A=
       "       Starting LBA: %d\n"=0A=
       "       LBA Size:     %d\n\n",=0A=
       part_dec, argv[0], slba_dec, lbas_dec);=0A=
}=0A=
=0A=
int bc_print(char **argv) {=0A=
=0A=
  int c;=0A=
  int bc;=0A=
=0A=
  in =3D open(argv[0], O_RDONLY);=0A=
  if (in =3D=3D -1) { perror("\nOpen Source"); printf("\n"); exit (-1); }=0A=
=0A=
  byte_tx =3D read(in, buffer_in, sector_size);=0A=
  if (byte_tx !=3D sector_size) {=0A=
    perror("\nRead Source Sector"); printf("\n"); exit (-1); }=0A=
=0A=
  for (c =3D 0; c < bc_size; c++) {=0A=
    if (bc =3D=3D 16) { bc =3D 0; printf("\n"); }=0A=
    printf("%02x", buffer_in[c]); bc++; }=0A=
=0A=
  printf("\n%s Boot Code has been printed\n\n", argv[0]);=0A=
}=0A=
=0A=
int pt_print(char **argv) {=0A=
=0A=
  int c;=0A=
=0A=
  in =3D open(argv[0], O_RDONLY);=0A=
  if (in =3D=3D -1) { perror("\nOpen Source"); printf("\n"); exit (-1); }=0A=
=0A=
  byte_tx =3D read(in, buffer_in, sector_size);=0A=
  if (byte_tx !=3D sector_size) {=0A=
    perror("\nRead Source Sector"); printf("\n"); exit (-1); }=0A=
=0A=
  printf("\n");=0A=
  for (c =3D 0; c!=3D 4; c++) {=0A=
=0A=
    pte =3D bc_size + 16 * c;=0A=
=0A=
    printf("Partition %2d is active %02x, type %02x,"=0A=
      " LBA start %d and LBA size %d\n",=0A=
      c + 1,=0A=
      buffer_in[pte],=0A=
      buffer_in[pte + 4],=0A=
      buffer_in[pte + 8] + (buffer_in[pte + 9] * 256)=0A=
        + (buffer_in[pte + 10] * 65536)=0A=
        + (buffer_in[pte + 11] * 16777216),=0A=
      buffer_in[pte + 12] + (buffer_in[pte + 13] * 256)=0A=
        + (buffer_in[pte + 14] * 65536)=0A=
        + (buffer_in[pte + 15] * 16777216));=0A=
=0A=
    printf("        Beginning: %4d cylinder, %3d head, %2d sector\n",=0A=
      ((buffer_in[pte + 2] & 0xc0) << 2) + buffer_in[pte + 3],=0A=
        buffer_in[pte + 1], (buffer_in[pte + 2] & 0x3f));=0A=
=0A=
    printf("        Ending:    %4d cylinder, %3d head, %2d sector\n\n",=0A=
      ((buffer_in[pte + 6] & 0xc0) << 2) + buffer_in[pte + 7],=0A=
        buffer_in[pte + 5], (buffer_in[pte + 6] & 0x3f));=0A=
  }=0A=
}=0A=
=0A=
int p_type(char **argv) {=0A=
=0A=
  part_dec =3D strtoul(argv[1], NULL, 10);=0A=
  if (part_dec =3D=3D -1) { perror("\nPartition Number"); printf("\n"); =
exit (-1); }=0A=
  if ((part_dec < 1) || (part_dec > 4)) {=0A=
    printf("\nPartition Range: 1-4\n\n"); exit (-1); }=0A=
=0A=
  type_dec =3D strtoul(argv[2], NULL, 10);=0A=
  if (type_dec =3D=3D -1) { perror("\nPartition Type"); printf("\n"); =
exit (-1); }=0A=
  if (type_dec > 255) {=0A=
    printf("\nWrong Partition Type.\n\n"); pt_list(); exit (-1); }=0A=
=0A=
  in =3D open(argv[0], O_RDWR);=0A=
  if (in =3D=3D -1) { perror("\nOpen Source"); printf("\n"); exit (-1); }=0A=
=0A=
  byte_tx =3D read(in, buffer_in, sector_size);=0A=
  if (byte_tx !=3D sector_size) {=0A=
    perror("\nRead Source Sector"); printf("\n"); exit (-1); }=0A=
=0A=
  pte =3D bc_size + 16 * (part_dec - 1);=0A=
  buffer_in[pte + 4] =3D type_dec;=0A=
=0A=
  byte_tx =3D pwrite(in, buffer_in, sector_size, 0);=0A=
  if (byte_tx !=3D sector_size) {=0A=
    perror("\nWrite Source Sector"); printf("\n"); exit (-1); }=0A=
=0A=
  printf("\nPartition %d of %s type has been changed to: %d.\n\n",=0A=
    part_dec, argv[0], type_dec);=0A=
}=0A=
=0A=
int pt_sign(char **argv) {=0A=
=0A=
  in =3D open(argv[0], O_RDWR);=0A=
  if (in =3D=3D -1) { perror("\nOpen Source"); printf("\n"); exit (-1); }=0A=
=0A=
  byte_tx =3D read(in, buffer_in, sector_size);=0A=
  if (byte_tx !=3D sector_size) {=0A=
    perror("\nRead Source Sector"); printf("\n"); exit (-1); }=0A=
=0A=
  buffer_in[510] =3D 85;=0A=
  buffer_in[511] =3D 170;=0A=
=0A=
  byte_tx =3D pwrite(in, buffer_in, sector_size, 0);=0A=
  if (byte_tx !=3D sector_size) {=0A=
    perror("\nWrite Source Sector"); printf("\n"); exit (-1); }=0A=
=0A=
  printf("\nPartition %d of %s has been signed.\n\n", part_dec, argv[0]);=0A=
}=0A=
=0A=
void pt_list() {=0A=
  printf("\n"=0A=
    "00 Empty\n"=0A=
    "01 12-bit FAT primary partition\n"=0A=
    "04 16-bit FAT primary partition\n"=0A=
    "05 Extended partition\n"=0A=
    "06 BIGDOS FAT primary partition\n"=0A=
    "07 NTFS primary partition\n"=0A=
    "63 Unix System V (SCO, ISC Unix, UnixWare, Mach, GNU Hurd)\n"=0A=
    "64 Novell Netware 286, 2.xx\n"=0A=
    "65 Novell Netware 386, 3.xx or 4.xx\n"=0A=
    "69 Novell Netware 5+, Novell Netware NSS Partition\n"=0A=
    "82 Linux swap\n"=0A=
    "83 Linux native partition\n"=0A=
    "84 Hibernation partition\n"=0A=
    "85 Linux extended partition\n"=0A=
    "86 NTFS volume set\n"=0A=
    "87 NTFS volume set\n"=0A=
    "8b FAT32 volume\n"=0A=
    "8c FAT32 volume using BIOS extended INT 13h\n"=0A=
    "a0 Laptop hibernation partition\n"=0A=
    "a5 NetBSD, FreeBSD, 386BSD\n"=0A=
    "a6 OpenBSD\n"=0A=
    "a9 NetBSD\n"=0A=
    "eb BeOS\n"=0A=
    "fb VMWare File System partition\n"=0A=
    "fc VMWare Swap partition\n"=0A=
    "\n");=0A=
}=0A=
=0A=
void usage() {=0A=
  printf("\n"=0A=
    "fdisk - Partition Manager\n"=0A=
    "\n"=0A=
    "SYNOPSYS\n"=0A=
    "     fdisk [-a:c:C:e:E:hlp:P:t:]"=0A=
    " [source] [destination] [partition] [type]"=0A=
    " [CHS start, CHS end] [LBA start, LBA size]\n"=0A=
    "\n"=0A=
    "        -a        Activate [partition] on [source].\n"=0A=
    "        -c        "=0A=
    "Copy Boot Code from [source] to [destination].\n"=0A=
    "        -C        "=0A=
    "Copy Partition Table from [source] to [destination].\n"=0A=
    "        -e        "=0A=
    "Edit [partition] CHS parameters on [source].\n"=0A=
    "        -E        "=0A=
    "Edit [partition] LBA parameters on [source].\n"=0A=
    "        -h        Print help.\n"=0A=
    "        -l        Print Partition Type list.\n"=0A=
    "        -p        Print Boot Code from [source].\n"=0A=
    "        -P        Print Partition Table from [source].\n"=0A=
    "        -S        Sign the Partition Table.\n"=0A=
    "        -t        Change [partition] [type] on [source].\n"=0A=
    "        -u        Print help.\n"=0A=
    "\n");=0A=
}=0A=

--Boundary_(ID_8DlZ6CXinoSLze4A2l+YXg)--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?HCELJGGAFOJADLJLFKLJIEDGCAAA.plan_b>