Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/i386/stand/lib/crt add prototypes



details:   https://anonhg.NetBSD.org/src/rev/248ea4c4e941
branches:  trunk
changeset: 471887:248ea4c4e941
user:      drochner <drochner%NetBSD.org@localhost>
date:      Wed Apr 14 10:57:59 1999 +0000

description:
add prototypes
being here, format ala KNF

diffstat:

 sys/arch/i386/stand/lib/crt/bootsect/bootsectmain.c |   55 ++++----
 sys/arch/i386/stand/lib/crt/dos/doscommain.c        |  129 ++++++++++---------
 2 files changed, 96 insertions(+), 88 deletions(-)

diffs (241 lines):

diff -r a40c19e9e722 -r 248ea4c4e941 sys/arch/i386/stand/lib/crt/bootsect/bootsectmain.c
--- a/sys/arch/i386/stand/lib/crt/bootsect/bootsectmain.c       Wed Apr 14 10:28:23 1999 +0000
+++ b/sys/arch/i386/stand/lib/crt/bootsect/bootsectmain.c       Wed Apr 14 10:57:59 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: bootsectmain.c,v 1.2 1999/03/08 00:09:25 fvdl Exp $    */
+/*     $NetBSD: bootsectmain.c,v 1.3 1999/04/14 10:57:59 drochner Exp $        */
 
 /*
  * Copyright (c) 1996
@@ -45,45 +45,48 @@
 #include "bbinfo.h"
 
 int boot_biosdev; /* exported */
+void bootsectmain __P((int));
 
 extern struct fraglist fraglist;
 extern char edata[], end[];
 
 extern void main __P((void));
 
-void bootsectmain(biosdev)
-int biosdev;
+void
+bootsectmain(biosdev)
+       int biosdev;
 {
-  struct biosdisk_ll d;
-  int i;
-  char *buf;
+       struct biosdisk_ll d;
+       int i;
+       char *buf;
 
-  /*
-   * load sectors from bootdev
-   */
-  d.dev = biosdev;
-  set_geometry(&d, NULL);
+       /*
+        * load sectors from bootdev
+        */
+       d.dev = biosdev;
+       set_geometry(&d, NULL);
 
 
-  buf = (char*)(PRIM_LOADSZ * BIOSDISK_SECSIZE);
+       buf = (char*)(PRIM_LOADSZ * BIOSDISK_SECSIZE);
 
-  for(i = 0; i < fraglist.numentries; i++) {
-    int dblk, num;
+       for (i = 0; i < fraglist.numentries; i++) {
+               int dblk, num;
 
-    dblk = fraglist.entries[i].offset;
-    num = fraglist.entries[i].num;
+               dblk = fraglist.entries[i].offset;
+               num = fraglist.entries[i].num;
 
-    if(readsects(&d, dblk, num, buf, 1))
-      return; /* halts in start_bootsect.S */
+               if (readsects(&d, dblk, num, buf, 1))
+                       return; /* halts in start_bootsect.S */
 
-    buf += num * BIOSDISK_SECSIZE;
-  }
+               buf += num * BIOSDISK_SECSIZE;
+       }
 
-  /* clear BSS */
-  buf = edata;
-  while(buf < end) *buf++ = 0;
+       /* clear BSS */
+       buf = edata;
+       while(buf < end)
+               *buf++ = 0;
 
-  /* call main() */
-  boot_biosdev = biosdev;
-  main();
+       /* call main() */
+       boot_biosdev = biosdev;
+       main();
 }
diff -r a40c19e9e722 -r 248ea4c4e941 sys/arch/i386/stand/lib/crt/dos/doscommain.c
--- a/sys/arch/i386/stand/lib/crt/dos/doscommain.c      Wed Apr 14 10:28:23 1999 +0000
+++ b/sys/arch/i386/stand/lib/crt/dos/doscommain.c      Wed Apr 14 10:57:59 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: doscommain.c,v 1.1.1.1 1997/03/14 02:40:34 perry Exp $ */
+/*     $NetBSD: doscommain.c,v 1.2 1999/04/14 10:58:00 drochner Exp $  */
 
 /*
  * Copyright (c) 1996
@@ -39,82 +39,87 @@
 /* The Program Segment Prefix */
 
 static struct psp{
-  char mist1[0x2c];
-  short envseg;
-  char mist2[0x80-2-0x2c];
-  char cmdlen;
-  char cmd[127];
+       char mist1[0x2c];
+       short envseg;
+       char mist2[0x80-2-0x2c];
+       char cmdlen;
+       char cmd[127];
 } *PSP = (struct psp*)0;
 
 static char* argv[64]; /* theor max */
 
-static int whitespace(c)
-char c;
+static int whitespace __P((char));
+
+static int
+whitespace(c)
+       char c;
 {
-  if((c == '\0') || (c == ' ') || (c == '\t')
-     || (c == '\r') || (c == '\n'))
-    return(1);
-  return(0);
+       if ((c == '\0') || (c == ' ') || (c == '\t')
+           || (c == '\r') || (c == '\n'))
+               return (1);
+       return (0);
 }
 
-enum state{skipping, doing_arg, doing_long_arg};
+enum state {skipping, doing_arg, doing_long_arg};
 
 /* build argv/argc, start real main() */
-
+int doscommain __P((void));
 extern int main __P((int, char**));
 
-int doscommain(){
-  int argc, i;
-  enum state s;
+int
+doscommain()
+{
+       int argc, i;
+       enum state s;
 
-  argv[0] = "???"; /* we don't know */
-  argc = 1;
-  s = skipping;
+       argv[0] = "???"; /* we don't know */
+       argc = 1;
+       s = skipping;
 
-  for(i = 0; i < PSP->cmdlen; i++){
+       for (i = 0; i < PSP->cmdlen; i++){
 
-    if(whitespace(PSP->cmd[i])) {
-      if(s == doing_arg) {
-       /* end of argument word */
-       PSP->cmd[i] = '\0';
-       s = skipping;
-      }
-      continue;
-    }
+               if (whitespace(PSP->cmd[i])) {
+                       if (s == doing_arg) {
+                               /* end of argument word */
+                               PSP->cmd[i] = '\0';
+                               s = skipping;
+                       }
+                       continue;
+               }
 
-    if(PSP->cmd[i] == '"') {
-      /* start or end long arg
-       (end only if next char is whitespace)
-       XXX but '" ' cannot be in argument
-       */
-      switch(s) {
-       case skipping:
-         /* next char begins new argument word */
-         argv[argc++] = &PSP->cmd[i + 1];
-         s = doing_long_arg;
-         break;
-       case doing_long_arg:
-         if(whitespace(PSP->cmd[i + 1])) {
-           PSP->cmd[i] = '\0';
-           s = skipping;
-         }
-       case doing_arg:
-         /* ignore in the middle of arguments */
-       default:
-      }
-      continue;
-    }
+               if (PSP->cmd[i] == '"') {
+                       /* start or end long arg
+                        * (end only if next char is whitespace)
+                        *  XXX but '" ' cannot be in argument
+                        */
+                       switch (s) {
+                       case skipping:
+                               /* next char begins new argument word */
+                               argv[argc++] = &PSP->cmd[i + 1];
+                               s = doing_long_arg;
+                               break;
+                       case doing_long_arg:
+                               if (whitespace(PSP->cmd[i + 1])) {
+                                       PSP->cmd[i] = '\0';
+                                       s = skipping;
+                               }
+                       case doing_arg:
+                               /* ignore in the middle of arguments */
+                       default:
+                       }
+                       continue;
+               }
 
-    /* all other characters */
-    if(s == skipping) {
-      /* begin new argument word */
-      argv[argc++] = &PSP->cmd[i];
-      s = doing_arg;
-    }
-  }
-  if(s != skipping)
-    PSP->cmd[i] = '\0'; /* to be sure */
+               /* all other characters */
+               if (s == skipping) {
+                       /* begin new argument word */
+                       argv[argc++] = &PSP->cmd[i];
+                       s = doing_arg;
+               }
+       }
+       if (s != skipping)
+               PSP->cmd[i] = '\0'; /* to be sure */
 
-  /* start real main() */
-  return(main(argc, argv));
+       /* start real main() */
+       return (main(argc, argv));
 }



Home | Main Index | Thread Index | Old Index