~callum/gmsfn

11ea99f42c80a56898dccb1cfbb930e5f85bf1c4 — Callum Brown 1 year, 3 months ago 52d6b56
Parse response and print out links
1 files changed, 0 insertions(+), 34 deletions(-)

M src/gemlogger.c
M src/gemlogger.c => src/gemlogger.c +0 -34
@@ 111,20 111,6 @@ int main() {
				// No url, ignore
				continue;
			}

			// Check url scheme is not gopher, http, etc.
			char *scheme;
			CURLUcode uc = curl_url_get(url, CURLUPART_SCHEME, &scheme, 0);
			if (uc != CURLUE_OK) {
				fprintf(out, "uc not ok");
				continue;
			}
			if (strcmp(scheme, "gemini") != 0) {
				fprintf(out, "not gemini");
			}
			if (tok.link.text == NULL) {
				fprintf(out, "text is null\n");
			}
			fprintf(out, "link text: %s\n", tok.link.text);
			fprintf(out, "link url: %s\n", tok.link.url);
			fprintf(out, "\n");


@@ 132,26 118,6 @@ int main() {
	}
	gemini_token_finish(&tok);

	/*
	char buf[BUFSIZ];
	for (int n = 1; n > 0;) {
		n = BIO_read(resp.bio, buf, BUFSIZ);
		if (n == -1) {
			fprintf(stderr, "Error: read\n");
			return 1;
		}
		ssize_t w = 0;
		while (w < (ssize_t)n) {
			ssize_t x = fwrite(&buf[w], 1, n - w, stdout);
			if (ferror(stdout)) {
				fprintf(stderr, "Error: write: %s\n",
					strerror(errno));
				return 1;
			}
			w += x;
		}
	}*/

next:
	gemini_response_finish(&resp);
	return ret;