/////////////////////////////////////////////////////////////////////////// // // US_CPrint() - Prints a string centered in the current window. // Newlines are supported. // /////////////////////////////////////////////////////////////////////////// void US_CPrint(const char *sorg) { char c; char *se; char *sstart = strdup(sorg); char *s = sstart; while (*s) { se = s; while ((c = *se)!=0 && (c != '\n')) se++; *se = '\0'; US_CPrintLine(s); s = se; if (c) { *se = c; s++; } } free(sstart); }
/////////////////////////////////////////////////////////////////////////// // // US_CPrint() - Prints a string in the current window. Newlines are // supported. // /////////////////////////////////////////////////////////////////////////// void US_CPrint(char *str) { /* Functions like to pass a string constant */ char c, *se, *s, *sz = strdup(str); s = sz; while (*s) { se = s; while ((c = *se) && (c != '\n')) se++; *se = '\0'; US_CPrintLine(s); s = se; if (c) { *se = c; s++; } } free(sz); }
void US_CPrint(const char *str) { char lastChar; char *strInLine, *strLineStart; char buf[256]; if (strlen(str) > sizeof(buf)/sizeof(char)) { Quit("US_CPrint() - String too long"); } strcpy(buf, str); strLineStart = buf; while (*strLineStart) { strInLine = strLineStart; while (*strInLine) { if (*strInLine == '\n') break; strInLine++; } lastChar = *strInLine; *strInLine = '\0'; US_CPrintLine(strLineStart); strLineStart = strInLine; if (lastChar) { *strInLine = lastChar; strLineStart++; } } }
/* ==================== = = DisplayDepartment = ==================== */ void DisplayDepartment(id0_char_t *text) { id0_short_t temp; // bufferofs = 0; PrintY = 5; WindowX = 17; WindowW = 168; VW_Bar(WindowX,PrintY+1,WindowW,7,0); temp = fontcolor; fontcolor = 10; US_CPrintLine (text, NULL); fontcolor = temp; }
/////////////////////////////////////////////////////////////////////////// // // US_CPrint() - Prints a string in the current window. Newlines are // supported. // /////////////////////////////////////////////////////////////////////////// void US_CPrint(char far *s) { char c,far *se; while (*s) { se = s; while ((c = *se) && (c != '\n')) se++; *se = '\0'; US_CPrintLine(s); s = se; if (c) { *se = c; s++; } } }
// The old, non-const version of US_CPrint void US_CPrint(char *str) { char lastChar; char *strInLine; while (*str) { strInLine = str; while (*strInLine) { if (*strInLine == '\n') break; strInLine++; } lastChar = *strInLine; *strInLine = '\0'; // Hence, str is not const US_CPrintLine(str); str = strInLine; if (lastChar) { *strInLine = lastChar; // Again not const str++; } } }