Beispiel #1
0
void PrintInt(int val) {
	if (!val) {
		sys_putc('0');
		return;
	}
	if (val < 0) {
		sys_putc('-');
		val = -val;
	}
	static char buf[20];
	char *ptr = buf + 19;
	while (val) {
      int div = __divu10(val),
		  mod = val - __mulu10(div);
	  *(-- ptr) = mod + '0';
	  val = div;
	}
	PrintString(ptr);
}
Beispiel #2
0
/* *
 * 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) ++;
}
Beispiel #3
0
void PrintString(const char *str) {
	while (*str)
		sys_putc(*(str ++));
}