|
|
|
@ -5,14 +5,19 @@
|
|
|
|
|
#include <ulib.h>
|
|
|
|
|
#include <unistd.h>
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
fputch(char c, int *cnt, int fd) {
|
|
|
|
|
write(fd, &c, sizeof(char));
|
|
|
|
|
(*cnt) ++;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* *
|
|
|
|
|
* cputch - writes a single character @c to stdout, and it will
|
|
|
|
|
* increace the value of counter pointed by @cnt.
|
|
|
|
|
* */
|
|
|
|
|
static void
|
|
|
|
|
cputch(int c, int *cnt) {
|
|
|
|
|
sys_putc(c);
|
|
|
|
|
(*cnt) ++;
|
|
|
|
|
fputch(c, cnt, 1);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* *
|
|
|
|
@ -63,13 +68,6 @@ cputs(const char *str) {
|
|
|
|
|
return cnt;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
fputch(char c, int *cnt, int fd) {
|
|
|
|
|
write(fd, &c, sizeof(char));
|
|
|
|
|
(*cnt) ++;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int
|
|
|
|
|
vfprintf(int fd, const char *fmt, va_list ap) {
|
|
|
|
|
int cnt = 0;
|
|
|
|
|