summaryrefslogtreecommitdiff
path: root/sample
diff options
context:
space:
mode:
Diffstat (limited to 'sample')
-rw-r--r--sample/Makefile2
-rw-r--r--sample/atou.c1
-rw-r--r--sample/c32echo.c2
-rw-r--r--sample/c32entry.S8
-rw-r--r--sample/comecho.asm9
-rw-r--r--sample/conio.c4
-rw-r--r--sample/fd.c5
-rw-r--r--sample/filetest.c6
-rw-r--r--sample/hello.c2
-rw-r--r--sample/hello2.c4
-rw-r--r--sample/mdiskchk.c8
-rw-r--r--sample/printf.c45
-rw-r--r--sample/skipatou.c2
13 files changed, 45 insertions, 53 deletions
diff --git a/sample/Makefile b/sample/Makefile
index 8bf7d880..d7c40fad 100644
--- a/sample/Makefile
+++ b/sample/Makefile
@@ -1,6 +1,6 @@
#ident "$Id$"
## -----------------------------------------------------------------------
-##
+##
## Copyright 2001-2004 H. Peter Anvin - All Rights Reserved
##
## This program is free software; you can redistribute it and/or modify
diff --git a/sample/atou.c b/sample/atou.c
index 36585990..84475b68 100644
--- a/sample/atou.c
+++ b/sample/atou.c
@@ -11,4 +11,3 @@ unsigned int atou(const char *s)
i = i*10 + (*s++ - '0');
return i;
}
-
diff --git a/sample/c32echo.c b/sample/c32echo.c
index 6edb51a3..06d5c8f8 100644
--- a/sample/c32echo.c
+++ b/sample/c32echo.c
@@ -1,6 +1,6 @@
#ident "$Id$"
/* ----------------------------------------------------------------------- *
- *
+ *
* Copyright 2002 H. Peter Anvin - All Rights Reserved
*
* This program is free software; you can redistribute it and/or modify
diff --git a/sample/c32entry.S b/sample/c32entry.S
index 55a7d116..3917168f 100644
--- a/sample/c32entry.S
+++ b/sample/c32entry.S
@@ -1,6 +1,6 @@
#ident "$Id$"
# -----------------------------------------------------------------------
-#
+#
# Copyright 2003 H. Peter Anvin - All Rights Reserved
#
# Permission is hereby granted, free of charge, to any person
@@ -11,10 +11,10 @@
# sell copies of the Software, and to permit persons to whom
# the Software is furnished to do so, subject to the following
# conditions:
-#
+#
# The above copyright notice and this permission notice shall
# be included in all copies or substantial portions of the Software.
-#
+#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
# OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
@@ -28,7 +28,7 @@
# COM32 start up code - must be linked first in the binary
-
+
.section ".text","ax"
.globl _start
_start:
diff --git a/sample/comecho.asm b/sample/comecho.asm
index 3cdf601a..7125686a 100644
--- a/sample/comecho.asm
+++ b/sample/comecho.asm
@@ -13,7 +13,7 @@ _start:
mov dl,"<"
mov ah,02h
int 21h
-
+
.writechar:
lodsb
mov dl,al
@@ -27,9 +27,6 @@ _start:
; Exit with near return, INT 20h, or INT 21h AX=4C00h
ret
-
-
+
+
end_str db ">", 0Dh, 0Ah, "$"
-
-
- \ No newline at end of file
diff --git a/sample/conio.c b/sample/conio.c
index f6f5c058..ba3b7000 100644
--- a/sample/conio.c
+++ b/sample/conio.c
@@ -1,6 +1,6 @@
#ident "$Id$"
/* ----------------------------------------------------------------------- *
- *
+ *
* Copyright 2001-2003 H. Peter Anvin - All Rights Reserved
*
* This program is free software; you can redistribute it and/or modify
@@ -38,7 +38,7 @@ int putchar(int ch)
/* \n -> \r\n */
putchar('\r');
}
-
+
regs.eax.b[1] = 0x02;
regs.edx.b[0] = ch;
__com32.cs_intcall(0x21, &regs, NULL);
diff --git a/sample/fd.c b/sample/fd.c
index 71d8d315..519885cc 100644
--- a/sample/fd.c
+++ b/sample/fd.c
@@ -1,6 +1,6 @@
#ident "$Id$"
/* ----------------------------------------------------------------------- *
- *
+ *
* Copyright 2003 H. Peter Anvin - All Rights Reserved
*
* This program is free software; you can redistribute it and/or modify
@@ -58,6 +58,3 @@ int __start(void)
/* If we get here, badness happened */
return 255;
}
-
-
-
diff --git a/sample/filetest.c b/sample/filetest.c
index ca1d0a63..18b08361 100644
--- a/sample/filetest.c
+++ b/sample/filetest.c
@@ -34,7 +34,7 @@ int __start(void)
unsigned int ax,cx,si,t;
com32sys_t inreg,outreg;
char *p;
-
+
/* Test null system call */
inreg.eflags.l = 0xffffffff;
inreg.eax.l = 0x11110000;
@@ -63,7 +63,7 @@ int __start(void)
__com32.cs_intcall(0x22, &inreg, &outreg);
printregs(&outreg);
printf("----\n");
-
+
si = outreg.esi.w[0]; /* File handle */
cx = outreg.ecx.w[0]; /* Block size */
ax = outreg.eax.l; /* File length */
@@ -71,7 +71,7 @@ int __start(void)
while ( si ) {
/* We can only read 64K per call */
t = ( ax > 65536 ) ? 65536/cx : (ax+cx-1)/cx;
-
+
memset(&inreg, 0, sizeof inreg);
inreg.esi.w[0] = si;
inreg.ecx.w[0] = t; /* Block count */
diff --git a/sample/hello.c b/sample/hello.c
index d0842f78..b94c62f1 100644
--- a/sample/hello.c
+++ b/sample/hello.c
@@ -1,6 +1,6 @@
#ident "$Id$"
/* ----------------------------------------------------------------------- *
- *
+ *
* Copyright 2002 H. Peter Anvin - All Rights Reserved
*
* This program is free software; you can redistribute it and/or modify
diff --git a/sample/hello2.c b/sample/hello2.c
index c2a7bcb2..ca94ef07 100644
--- a/sample/hello2.c
+++ b/sample/hello2.c
@@ -1,6 +1,6 @@
#ident "$Id$"
/* ----------------------------------------------------------------------- *
- *
+ *
* Copyright 2002 H. Peter Anvin - All Rights Reserved
*
* This program is free software; you can redistribute it and/or modify
@@ -49,7 +49,7 @@ static void writemsg(const char *msg)
inreg.ebx.w[0] = OFFS(__com32.cs_bounce);
inreg.es = SEG(__com32.cs_bounce);
__com32.cs_intcall(0x22, &inreg, NULL);
-};
+};
int __start(void)
{
diff --git a/sample/mdiskchk.c b/sample/mdiskchk.c
index 0b4990fb..d13b8fb4 100644
--- a/sample/mdiskchk.c
+++ b/sample/mdiskchk.c
@@ -1,5 +1,5 @@
/* -*- c -*- ------------------------------------------------------------- *
- *
+ *
* Copyright 2003-2004 H. Peter Anvin - All Rights Reserved
*
* This program is free software; you can redistribute it and/or modify
@@ -72,7 +72,7 @@ struct memdiskinfo * query_memdisk(int drive)
mov _es, es ;
mov _di, di ;
}
-
+
if ( _eax >> 16 != 0x4d21 ||
_ecx >> 16 != 0x4d45 ||
_edx >> 16 != 0x4944 ||
@@ -92,7 +92,7 @@ struct memdiskinfo * query_memdisk(int drive)
mm.cylinders = ((_ecx >> 8) & 0xff) + ((_ecx & 0xc0) << 2) + 1;
mm.heads = ((_edx >> 8) & 0xff) + 1;
mm.sectors = (_ecx & 0x3f);
-
+
return &mm;
}
@@ -142,6 +142,6 @@ int main(int argc, char *argv[])
found++;
}
}
-
+
return found;
}
diff --git a/sample/printf.c b/sample/printf.c
index eb16301e..23aa1446 100644
--- a/sample/printf.c
+++ b/sample/printf.c
@@ -54,7 +54,7 @@ static char * number(char * str, long num, int base, int size, int precision
char c,sign,tmp[66];
const char *digits="0123456789abcdefghijklmnopqrstuvwxyz";
int i;
-
+
if (type & LARGE)
digits = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";
if (type & LEFT)
@@ -125,20 +125,20 @@ int vsprintf(char *buf, const char *fmt, va_list args)
int i, base;
char * str;
const char *s;
-
+
int flags; /* flags to number() */
-
+
int field_width; /* width of output field */
int precision; /* min. # of digits for integers; max
number of chars for from string */
int qualifier; /* 'h', 'l', or 'L' for integer fields */
-
+
for (str=buf ; *fmt ; ++fmt) {
if (*fmt != '%') {
*str++ = *fmt;
continue;
}
-
+
/* process flags */
flags = 0;
repeat:
@@ -150,7 +150,7 @@ int vsprintf(char *buf, const char *fmt, va_list args)
case '#': flags |= SPECIAL; goto repeat;
case '0': flags |= ZEROPAD; goto repeat;
}
-
+
/* get field width */
field_width = -1;
if (isdigit(*fmt))
@@ -164,11 +164,11 @@ int vsprintf(char *buf, const char *fmt, va_list args)
flags |= LEFT;
}
}
-
+
/* get the precision */
precision = -1;
if (*fmt == '.') {
- ++fmt;
+ ++fmt;
if (isdigit(*fmt))
precision = skip_atou(&fmt);
else if (*fmt == '*') {
@@ -179,17 +179,17 @@ int vsprintf(char *buf, const char *fmt, va_list args)
if (precision < 0)
precision = 0;
}
-
+
/* get the conversion qualifier */
qualifier = -1;
if (*fmt == 'h' || *fmt == 'l' || *fmt == 'L') {
qualifier = *fmt;
++fmt;
}
-
+
/* default base */
base = 10;
-
+
switch (*fmt) {
case 'c':
if (!(flags & LEFT))
@@ -199,11 +199,11 @@ int vsprintf(char *buf, const char *fmt, va_list args)
while (--field_width > 0)
*str++ = ' ';
continue;
-
+
case 's':
s = va_arg(args, char *);
len = strnlen(s, precision);
-
+
if (!(flags & LEFT))
while (len < field_width--)
*str++ = ' ';
@@ -212,7 +212,7 @@ int vsprintf(char *buf, const char *fmt, va_list args)
while (len < field_width--)
*str++ = ' ';
continue;
-
+
case 'p':
if (field_width == -1) {
field_width = 2*sizeof(void *);
@@ -222,8 +222,8 @@ int vsprintf(char *buf, const char *fmt, va_list args)
(unsigned long) va_arg(args, void *), 16,
field_width, precision, flags);
continue;
-
-
+
+
case 'n':
if (qualifier == 'l') {
long * ip = va_arg(args, long *);
@@ -233,28 +233,28 @@ int vsprintf(char *buf, const char *fmt, va_list args)
*ip = (str - buf);
}
continue;
-
+
case '%':
*str++ = '%';
continue;
-
+
/* integer number formats - set up the flags and "break" */
case 'o':
base = 8;
break;
-
+
case 'X':
flags |= LARGE;
case 'x':
base = 16;
break;
-
+
case 'd':
case 'i':
flags |= SIGN;
case 'u':
break;
-
+
default:
*str++ = '%';
if (*fmt)
@@ -283,7 +283,7 @@ int sprintf(char * buf, const char *fmt, ...)
{
va_list args;
int i;
-
+
va_start(args, fmt);
i=vsprintf(buf,fmt,args);
va_end(args);
@@ -304,4 +304,3 @@ int printf(const char *fmt, ...)
return printed;
}
-
diff --git a/sample/skipatou.c b/sample/skipatou.c
index 98881539..1641a131 100644
--- a/sample/skipatou.c
+++ b/sample/skipatou.c
@@ -7,7 +7,7 @@ isdigit(int ch)
unsigned int skip_atou(const char **s)
{
int i=0;
-
+
while (isdigit(**s))
i = i*10 + *((*s)++) - '0';
return i;