~julienxx/castor9

2be78fb328da9e2e6714d73c9b0c90e6751aaa80 — Julien Blanchard 3 years ago 877421a
Handle inputs
2 files changed, 26 insertions(+), 9 deletions(-)

M README.md
M castor.c
M README.md => README.md +0 -1
@@ 21,6 21,5 @@ Use the adress bar and right-mouse click to navigate.

## To Do:

- input type
- TOFU
- client certificates

M castor.c => castor.c +26 -8
@@ 41,6 41,7 @@ struct Hist

int request(Url *u);
void gemini_get(Url *u);
void gemini_put(Response *r);
void texthit(Panel *p, int b, Rtext *t);
void message(char *s, ...);



@@ 75,13 76,14 @@ char *menu3[] = {


char* 
replace_char(char* str, char find, char replace){
    char *current_pos = strchr(str,find);
    while(current_pos){
        *current_pos = replace;
        current_pos = strchr(current_pos,find);
    }
    return str;
replace_char(char* str, char find, char replace)
{
	char *current_pos = strchr(str,find);
	while(current_pos){
		*current_pos = replace;
		current_pos = strchr(current_pos,find);
	}
	return str;
}

char*


@@ 389,7 391,7 @@ gemini_get(Url *url)

	switch(r->status){
	case 10:
		message("Input! %s", r->meta);
		gemini_put(r);
		break;
	case 11:
		message("Sensitive input! %s", r->meta);


@@ 478,6 480,22 @@ gemini_get(Url *url)
}

void
gemini_put(Response *r)
{
	char buf[1024];
	char *url;
	strncpy(buf, "", sizeof(buf)-1);
	if(eenter(r->meta, buf, sizeof(buf), mouse) <= 0){
		message("Castor9");
		return;
	}
	
	url = smprint("%s?%s", r->url->raw, buf);
	message("Castor9");
	gemini_get(urlparse(nil, url));
}

void
search(void)
{
	static char last[256];