[PATCH] fdisk.c: major whitespace/style cleanup

Vladimir N. Oleynik dzo at simtreas.ru
Fri Feb 24 17:12:02 UTC 2006


Rob,

>>I'd like to work on making fdisk.c smaller and saner.
>>But it needs a style cleanup first.

Why first?

If your path contains not only whitespace correction, require in
addition to inform:

-  sync ();
-  sleep (4);
+       sync();
+       sleep(4); /* What? */

Ask mainstream maintainer. For me best if
sync(); sleep(1); sync();
but +1 sysclall.

-static int     sun_other_endian;
-static int     scsi_disk;
-static int     floppy;
+static int sun_other_endian;
+static int scsi_disk;
+static int floppy;

For me, previous more beautiful.

-       if (sunlabel->magic != SUN_LABEL_MAGIC &&
-           sunlabel->magic != SUN_LABEL_MAGIC_SWAPPED) {
+       if (sunlabel->magic != SUN_LABEL_MAGIC
+        && sunlabel->magic != SUN_LABEL_MAGIC_SWAPPED) {

Too.

+                                       if (fgets(buffer2,2048,pfd)) {
+                                               q = strstr(buffer2,"Vendor: ");
+                                               if (q) {
+                                                       q += 8;
+                                                       vendor = q;
+                                                       q = strstr(q," ");
+                                                       *q++ = 0;   /* truncate 
vendor nam
e */
+                                                       q = strstr(q,"Model: ");
+                                                       if (q) {
+                                                               *q = 0;
+                                                               q += 7;
+                                                               model = q;
+                                                               q = strstr(q," 
Rev: ");
+                                                               if (q) {
+                                                                       *q = 0;
+                                                                       for (i = 
0; i < SI
ZE(sun_drives); i++) {


Ohh. Its UGLY now!


>>One obvious bug spotted. Infinite loop:
>>
>>edit_int(int def, char *mesg)
>>{
>>    do {
>>        fputs(mesg, stdout);
>>        printf(" (%d): ", def);
>>        if (!read_line())
>>            return def;
>>    }
>>    while (!isdigit(*line_ptr));    /* FIXME: ?!! */
>>    return atoi(line_ptr);
>>}

Why Infinite loop? read_line rewrote line_ptr

> Which is confusing.  (The pretty printing hiccuped?)
> 
> Oh well, it built...
> 
> Applied.

Can remove in general to me fdisk from the busybox?
Also do that want. I of my work did not give the under this GPL licenses.
I asked to not touch my utilities.

Ohh. Rob. After reception of a maintainer you became completely deranged. :((


--w
vodz




More information about the busybox mailing list