Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
dimkr committed Apr 15, 2023
1 parent 17cf713 commit 6cfe468
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 6 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ additional documentation and more details are available in `man gplaces`. type `
| File | Blank | Comment | Code |
| --------- | ------ | ------ | ---- |
| gplaces.c | 270 | 63 | 1229 |
| gopher.c | 36 | 19 | 95 |
| gopher.c | 36 | 19 | 91 |
| spartan.c | 21 | 16 | 60 |
| gophers.c | 12 | 16 | 25 |
| tcp.c | 11 | 16 | 18 |
6 changes: 1 addition & 5 deletions gopher.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,7 @@ typedef struct Socket {

/*============================================================================*/
static int build_selector_url(Selector *sel, const char type, const char *host, const char *port, const char *path) {
static char buffer[1024];
if ((sel->cu = curl_url()) == NULL) return 0;
snprintf(buffer, sizeof(buffer), "/%c%s", type, path);
if (curl_url_set(sel->cu, CURLUPART_SCHEME, gopher.scheme, 0) != CURLUE_OK || curl_url_set(sel->cu, CURLUPART_HOST, host, 0) != CURLUE_OK || curl_url_set(sel->cu, CURLUPART_PORT, port, 0) != CURLUE_OK || curl_url_set(sel->cu, CURLUPART_PATH, buffer, 0) != CURLUE_OK || curl_url_get(sel->cu, CURLUPART_SCHEME, &sel->scheme, 0) != CURLUE_OK || curl_url_get(sel->cu, CURLUPART_HOST, &sel->host, 0) != CURLUE_OK || curl_url_get(sel->cu, CURLUPART_PORT, &sel->port, 0) != CURLUE_OK || curl_url_get(sel->cu, CURLUPART_PATH, &sel->path, 0) != CURLUE_OK || !idn_convert(sel) || curl_url_get(sel->cu, CURLUPART_URL, &sel->url, 0) != CURLUE_OK) return 0;
sel->rawurl = str_copy(sel->url);
if (asprintf(&sel->rawurl, "%s://%s:%s/%c%s", gopher.scheme, host, port, type, path) < 0) { sel->rawurl = NULL; return 0; }
sel->proto = &gopher;
return 1;
}
Expand Down

0 comments on commit 6cfe468

Please sign in to comment.