Subject: Re: My new fdisk(8) program.
To: slick <plan_b@videotron.ca>
From: David Laight <david@l8s.co.uk>
List: tech-toolchain
Date: 02/04/2004 21:40:47
On Sun, Feb 01, 2004 at 10:12:13PM -0500, slick wrote:
> 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).
Nope, you need to read the man page (and probably the source) of NetBSD's
fdisk program. In particular it has support for updating the 'bootselect'
parameters and for editing the extended partition chain.
I don't remember spotting anything that checks for overlapping partitions,
nor any help in making partitions be adjacent or aligning on cylinder
boundaries (reputedly required by some bios).
> - 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*".
Where did it need /bin/sh?
> - is 10 times smaller.
> - in pure C.
So are most things these days.
OTOH the code you've given is badly laid out, and completely unreadable.
> - has no struct.
Explain why that is an advantage - given the proliferation of 'magic'
numbers that are otherwise required.
>
> 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.
Oh and all your error messages are partially written to stderr and partially
to stdout.
> I accept any (good and/or bad) feedback if its constructive.
marks, 1 out 10 for effort.
David
--
David Laight: david@l8s.co.uk