]> git.pond.sub.org Git - empserver/blobdiff - src/lib/gen/vsprintf.c
Indented with src/scripts/indent-emp.
[empserver] / src / lib / gen / vsprintf.c
index 858579feaca400985b21d888eab8892d295d8780..b7f7a0fd44b757b849c82d55a16cd8d3a5d5347d 100644 (file)
@@ -45,7 +45,7 @@
 #include "misc.h"
 #include "gen.h"
 
-#ifdef OSK             /* os9/68k can take advantage of both */
+#ifdef OSK                     /* os9/68k can take advantage of both */
 #define LONGINT
 #define INTSPRINTF
 #endif
@@ -72,7 +72,8 @@ typedef void *pointer;
 
 typedef int *intp;
 
-int vsprintf(dest, format, args)
+int
+vsprintf(dest, format, args)
 s_char *dest;
 register s_char *format;
 va_list args;
@@ -86,96 +87,98 @@ va_list args;
 #endif
 
     tempfmt[0] = '%';
-    while(c = *format++) {
-       if(c=='%') {
+    while (c = *format++) {
+       if (c == '%') {
            tp = &tempfmt[1];
 #ifndef LONGINT
            longflag = 0;
 #endif
-continue_format:
-           switch(c = *format++) {
-               case 's':
-                   *tp++ = c;
-                   *tp = '\0';
-                   dp += Sprintf(dp, tempfmt, va_arg(args, s_char *));
-                   break;
-               case 'u':
-               case 'x':
-               case 'o':
-               case 'X':
+         continue_format:
+           switch (c = *format++) {
+           case 's':
+               *tp++ = c;
+               *tp = '\0';
+               dp += Sprintf(dp, tempfmt, va_arg(args, s_char *));
+               break;
+           case 'u':
+           case 'x':
+           case 'o':
+           case 'X':
 #ifdef UNSIGNEDSPECIAL
-                   *tp++ = c;
-                   *tp = '\0';
+               *tp++ = c;
+               *tp = '\0';
 #ifndef LONGINT
-                   if(longflag)
-                       dp += Sprintf(dp, tempfmt, va_arg(args, unsigned long));
-                   else
+               if (longflag)
+                   dp +=
+                       Sprintf(dp, tempfmt, va_arg(args, unsigned long));
+               else
 #endif
-                       dp += Sprintf(dp, tempfmt, va_arg(args, unsigned));
-                   break;
+                   dp += Sprintf(dp, tempfmt, va_arg(args, unsigned));
+               break;
 #endif
-               case 'd':
-               case 'c':
-               case 'i':
-                   *tp++ = c;
-                   *tp = '\0';
+           case 'd':
+           case 'c':
+           case 'i':
+               *tp++ = c;
+               *tp = '\0';
 #ifndef LONGINT
-                   if(longflag)
-                       dp += Sprintf(dp, tempfmt, va_arg(args, long));
-                   else
+               if (longflag)
+                   dp += Sprintf(dp, tempfmt, va_arg(args, long));
+               else
 #endif
-                       dp += Sprintf(dp, tempfmt, va_arg(args, int));
-                   break;
-               case 'f':
-               case 'e':
-               case 'E':
-               case 'g':
-               case 'G':
-                   *tp++ = c;
-                   *tp = '\0';
-                   dp += Sprintf(dp, tempfmt, va_arg(args, double));
-                   break;
-               case 'p':
-                   *tp++ = c;
-                   *tp = '\0';
-                   dp += Sprintf(dp, tempfmt, va_arg(args, pointer));
-                   break;
-               case '-':
-               case '+':
-               case '0':
-               case '1':
-               case '2':
-               case '3':
-               case '4':
-               case '5':
-               case '6':
-               case '7':
-               case '8':
-               case '9':
-               case '.':
-               case ' ':
-               case '#':
-               case 'h':
-                   *tp++ = c;
-                   goto continue_format;
-               case 'l':
+                   dp += Sprintf(dp, tempfmt, va_arg(args, int));
+               break;
+           case 'f':
+           case 'e':
+           case 'E':
+           case 'g':
+           case 'G':
+               *tp++ = c;
+               *tp = '\0';
+               dp += Sprintf(dp, tempfmt, va_arg(args, double));
+               break;
+           case 'p':
+               *tp++ = c;
+               *tp = '\0';
+               dp += Sprintf(dp, tempfmt, va_arg(args, pointer));
+               break;
+           case '-':
+           case '+':
+           case '0':
+           case '1':
+           case '2':
+           case '3':
+           case '4':
+           case '5':
+           case '6':
+           case '7':
+           case '8':
+           case '9':
+           case '.':
+           case ' ':
+           case '#':
+           case 'h':
+               *tp++ = c;
+               goto continue_format;
+           case 'l':
 #ifndef LONGINT
-                   longflag = 1;
-                   *tp++ = c;
+               longflag = 1;
+               *tp++ = c;
 #endif
-                   goto continue_format;
-               case '*':
-                   tp += Sprintf(tp, "%d", va_arg(args, int));
-                   goto continue_format;
-               case 'n':
-                   *va_arg(args, intp) = dp - dest;
-                   break;
-               case '%':
-               default:
-                   *dp++ = c;
-                   break;
+               goto continue_format;
+           case '*':
+               tp += Sprintf(tp, "%d", va_arg(args, int));
+               goto continue_format;
+           case 'n':
+               *va_arg(args, intp) = dp - dest;
+               break;
+           case '%':
+           default:
+               *dp++ = c;
+               break;
            }
-       } else *dp++ = c;
+       } else
+           *dp++ = c;
     }
     *dp = '\0';
     return dp - dest;