/* Map iana names to OpenSSL names so users can provide IANA names as well as OpenSSL cipher names */ static char *mapCipherNames(char *ciphers) { WebsBuf buf; CipherMap *cp; char *cipher, *next, *str; if (!ciphers || *ciphers == 0) { return 0; } bufCreate(&buf, 0, 0); ciphers = sclone(ciphers); for (next = ciphers; (cipher = stok(next, ":, \t", &next)) != 0; ) { for (cp = cipherMap; cp->name; cp++) { if (smatch(cp->name, cipher)) { bufPut(&buf, "%s:", cp->ossName); break; } } if (cp->name == 0) { bufPut(&buf, "%s:", cipher); } } wfree(ciphers); str = sclone(bufStart(&buf)); bufFree(&buf); return str; }
local String inclGetLine(FILE *file) { int c; String s; bufStart(inclBuffer); while ((c = osGetc(file)) != EOF) { bufAdd1(inclBuffer, c); if (c == '\n') break; } bufAdd1(inclBuffer, char0); s = bufChars(inclBuffer); if (c == EOF && *s == 0) return 0; return s; }
/* Evalute all lines in the edit box "id" b/ween "fromLine" and "toLine" */ local void wglEvalLines(int editBox, int fromLine, int toLine) { int i; LPSTR lineStr; Buffer evalBuf = bufNew(); for (i = fromLine; i < toLine; i++) { lineStr = pfcGetLine(editBox, i); if (lineStr[0] == NULL) continue; /* Skip blank lines */ bufPuts(evalBuf, lineStr); bufPutc(evalBuf, '\n'); } bufPutc(evalBuf, EOF); bufStart(evalBuf); osSetStdinBuffer(evalBuf); compGLoopEval(osStdin, osStdout, finfo); wglShowOutput(editBox); bufFree(evalBuf); }