int puts(const char *s) { dbg_printf("Calling %s\n", __FUNCTION__); char c; if (s == NULL) // 089C s = "<NULL>"; // 085C, 0880 while ((c = *(s++)) != '\0') fdputc(c, STDOUT); return 0; }
void fdprintsdn(int fd, SCALED sdn) { register char *dec = "9999.999", *z; if (sdn.val <= 0) return; (void)fdprintf (fd, "%s", NB(print_prefix)); /* * Let's try to be a bit clever in dealing with decimal * numbers. If the number is an integer, don't print * a decimal point. If it isn't an integer, strip trailing * zeros from the fraction part, and don't print more * than the thousandths place. */ if (-1000. < sdn.val && sdn.val < 10000.) { /* * Printing 0 will give us 0.000. */ sprintf (dec, "%.3f", sdn.val); /* * Skip zeroes from the end until we hit * '.' or not-0. If we hit '.', clobber it; * if we hit not-0, it has to be in fraction * part, so leave it. */ z = dec + strlen(dec) - 1; while (*z == '0' && *z != '.') z--; if (*z == '.') *z = '\0'; else *++z = '\0'; (void)fdprintf(fd, "%s", dec); } else (void)fdprintf(fd, "%.3f", sdn.val); if (sdn.sc == 'i' || sdn.sc == 'c') fdputc(sdn.sc, fd); (void)fdprintf(fd, "%s%s", NB(print_suffix), NB(print_newline)); return; }
int putchar(int c) { dbg_printf("Calling %s\n", __FUNCTION__); return fdputc(c, STDOUT); }
char *fdgets(char *s, int fd) { dbg_printf("Calling %s\n", __FUNCTION__); char *end = s + 125; char *curS = s; for (;;) { char c = (char)fdgetc(fd); switch (c) { case '\026': // sync // 0808 c = (char)fdgetc(fd); if (curS < end) { *(curS++) = c; if (sceKernelDebugEcho() != 0) fdputc(c, (fd != STDIN ? fd : STDOUT)); } else if (sceKernelDebugEcho() != 0) fdputc('\a', (fd != STDIN ? fd : STDOUT)); break; case '\177': // DEL case '\b': // 0790 // 0794 if (s >= curS) break; curS--; if (sceKernelDebugEcho() != 0) { int realFd = (fd != STDIN ? fd : STDOUT); fdputc('\b', realFd); fdputc(' ' , realFd); fdputc('\b', realFd); } break; case -1: // 0740 if (s == curS) { *curS = '\0'; return NULL; } case '\n': case '\r': // 0748 if (sceKernelDebugEcho() != 0) fdputc('\n', (fd != STDIN ? fd : STDOUT)); *curS = '\0'; return s; case '\t': c = ' '; default: // 06DC if ((look_ctype_table(c) & 0x97) != 0 && curS < end) { *(curS++) = c; if (sceKernelDebugEcho() != 0) fdputc(c, (fd != STDIN ? fd : STDOUT)); } else if (sceKernelDebugEcho() != 0) fdputc('\a', (fd != STDIN ? fd : STDOUT)); break; } } }