$(LIBSYS)(sys_signalrm.o) \
$(LIBSYS)(sys_flagalrm.o) \
$(LIBSYS)(sys_syncalrm.o) \
+ $(LIBSYS)(sys_physzero.o) \
$(LIBSYS)(taskcall.o) \
$(LIBSYS): $(OBJECTS)
$(LIBSYS)(sys_syncalrm.o): sys_syncalrm.c
$(CC1) sys_syncalrm.c
+$(LIBSYS)(sys_physzero.o): sys_physcp.c
+ $(CC1) sys_physzero.c
+
$(LIBSYS)(taskcall.o): taskcall.c
$(CC1) taskcall.c
/* Printf() uses kputc() to print characters. */
void kputc(int c);
+#define count_kputc(c) do { charcount++; kputc(c); } while(0)
+
int printf(const char *fmt, ...)
#endif
{
- int c;
+ int c, charcount = 0;
enum { LEFT, RIGHT } adjust;
enum { LONG, INT } intsize;
int fill;
while ((c= *fmt++) != 0) {
if (c != '%') {
/* Ordinary character. */
- kputc(c);
+ count_kputc(c);
continue;
}
string_print:
width -= len;
if (i < 0) width--;
- if (fill == '0' && i < 0) kputc('-');
+ if (fill == '0' && i < 0) count_kputc('-');
if (adjust == RIGHT) {
- while (width > 0) { kputc(fill); width--; }
+ while (width > 0) { count_kputc(fill); width--; }
}
- if (fill == ' ' && i < 0) kputc('-');
- while (len > 0) { kputc((unsigned char) *p++); len--; }
- while (width > 0) { kputc(fill); width--; }
+ if (fill == ' ' && i < 0) count_kputc('-');
+ while (len > 0) { count_kputc((unsigned char) *p++); len--; }
+ while (width > 0) { count_kputc(fill); width--; }
break;
/* Unrecognized format key, echo it back. */
default:
- kputc('%');
- kputc(c);
+ count_kputc('%');
+ count_kputc(c);
}
}
/* Mark the end with a null (should be something else, like -1). */
kputc(0);
va_end(argp);
- return 0;
+ return charcount;
}
/*
--- /dev/null
+#include "syslib.h"
+
+PUBLIC int sys_physzero(phys_bytes base, phys_bytes bytes)
+{
+/* Zero a block of data. */
+
+ message mess;
+
+ if (bytes == 0L) return(OK);
+
+ mess.PZ_MEM_PTR = (char *) base;
+ mess.PZ_COUNT = bytes;
+
+ return(_taskcall(SYSTASK, SYS_PHYSZERO, &mess));
+}
+