/* Writes C to the video display and serial port. */ int putchar (int c) { acquire_console (); putchar_have_lock (c); release_console (); return c; }
/* Writes the N characters in BUFFER to the console. */ void putbuf (const char *buffer, size_t n) { acquire_console (); while (n-- > 0) putchar_have_lock (*buffer++); release_console (); }
/* Writes string S to the console, followed by a new-line character. */ int puts (const char *s) { acquire_console (); while (*s != '\0') putchar_have_lock (*s++); putchar_have_lock ('\n'); release_console (); return 0; }
/* The standard vprintf() function, which is like printf() but uses a va_list. Writes its output to both vga display and serial port. */ int vprintf (const char *format, va_list args) { int char_cnt = 0; acquire_console (); __vprintf (format, args, vprintf_helper, &char_cnt); release_console (); return char_cnt; }
void abort_message(const char *format, ...) { va_list vargs; char emessage[1024]; if (dpsTimer || nomessageflag) { closeFiles(); close_error(1); /* 1 arg means fail/abort */ exit(1); } va_start(vargs, format); vfprintf(stdout,format,vargs); va_end(vargs); if ( *(format+(strlen(format)-1)) != '\n') fprintf(stdout,"\n"); if (!erroropen) { if (P_getstring(GLOBAL, "userdir", errorpath, 1, MAXPATHL) >= 0) { strcat(errorpath,"/psg.error"); if ( (errorfile=fopen(errorpath,"w+")) ) erroropen = 1; } } if (erroropen) { va_start(vargs, format); vfprintf(errorfile,format,vargs); va_end(vargs); fprintf(errorfile,"P.S.G. Aborted....\n"); fprintf(stdout,"P.S.G. Aborted....\n"); } va_start(vargs, format); vsprintf(emessage,format,vargs); va_end(vargs); closeFiles(); if (newacq) { while (emessage[strlen(emessage)-1] == '\n') emessage[strlen(emessage)-1] = '\0'; vnmremsg(emessage); if (!acqiflag && !dps_flag) release_console(); } close_error(1); /* 1 arg means fail/abort */ exit(1); }
void psg_abort(int error) { closeFiles(); if (dpsTimer) { close_error(1); /* 1 arg means failure/abort */ exit(1); } text_error("P.S.G. Aborted."); if (newacq) { if (!acqiflag && !dps_flag) release_console(); } close_error(1); /* 1 arg means failure/abort */ exit(error); }