|
DataMuseum.dkPresents historical artifacts from the history of: DKUUG/EUUG Conference tapes |
This is an automatic "excavation" of a thematic subset of
See our Wiki for more about DKUUG/EUUG Conference tapes Excavated with: AutoArchaeologist - Free & Open Source Software. |
top - metrics - downloadIndex: T g
Length: 1008 (0x3f0) Types: TextFile Names: »getcom.c«
└─⟦b20c6495f⟧ Bits:30007238 EUUGD18: Wien-båndet, efterår 1987 └─⟦this⟧ »EUUGD18/General/Battlestar/getcom.c«
#ifndef lint static char sccsid[] = "@(#)getcom.c 1.1 11/18/84"; #endif #include <stdio.h> #include <ctype.h> char * getcom(buf, size, prompt, error) char *buf; int size; char *prompt, *error; { for (;;) { fputs(prompt, stdout); if (fgets(buf, size, stdin) == 0) exit(1); while (isspace(*buf)) buf++; if (*buf) break; if (error) puts(error); } return (buf); } char * getword(buf1, buf2, flag) char *buf1, *buf2; { /* shifts to UPPERCASE if flag > 0, lowercase if */ /* flag < 0, and leaves it unchanged if flag = 0 */ while (isspace(*buf1)) buf1++; if (*buf1 != ',') { if (!*buf1) { *buf2 = 0; return (0); } while (*buf1 && !isspace(*buf1) && *buf1 != ',') *buf2++ = shift(*buf1++, flag); } else *buf2++ = *buf1++; *buf2 = 0; while (isspace(*buf1)) buf1++; return (*buf1 ? buf1 : 0); } shift(c, flg) char c; int flg; { if (flg < 0) return isupper(c) ? tolower(c) : c; if (flg > 0) return islower(c) ? toupper(c) : c; return c; }