void serverStatus() /* Send status message to server and print result. */ { int sd = netMustConnect(host, port); FILE *f; netSendString(sd, "status"); f = netFileFromSocket(sd); copyOpenFile(f, stdout); }
static FILE *chimeraxBegin(char *outName) /* open chimerax file and write XML and python function definitions */ { FILE *xfh = mustOpen(outName, "w"); fputs(chimeraxHead, xfh); FILE *pxf = mustOpen(chimeraxPythonFile, "r"); copyOpenFile(pxf, xfh); carefulClose(&pxf); return xfh; }
static void blatzClient(char *input, char *output) /* Send query message and dna to server and print result. */ { struct dnaLoad *dl = dnaLoadOpen(input); struct dnaSeq *seq; FILE *f = mustOpen(output, "w"); static struct optionSpec options[] = { BZP_CLIENT_OPTIONS }; int i; while ((seq = dnaLoadNext(dl)) != NULL) { /* Connect */ int sd = netMustConnect(host, port); FILE *sf = NULL; /* Send query command. */ netSendString(sd, "query"); /* Send options. */ for (i=0; i<ArraySize(options); ++i) sendOption(sd, options[i].name); /* Send sequence. */ if (optionExists("rna") || optionExists("unmask")) toUpperN(seq->dna, seq->size); else { if (seqIsLower(seq)) warn("Sequence %s is all lower case, and thus ignored. Use -unmask " "flag to unmask lower case sequence.", seq->name); } netSendString(sd, "seq"); netSendString(sd, seq->name); netSendHugeString(sd, seq->dna); verbose(1, "%s\n", seq->name); dnaSeqFree(&seq); /* Get and save response. */ sf = netFileFromSocket(sd); copyOpenFile(sf, f); carefulClose(&sf); /* Close connection */ close(sd); } dnaLoadClose(&dl); carefulClose(&f); }