1
0
mirror of https://github.com/rkd77/elinks.git synced 2024-06-25 01:05:37 +00:00
elinks/src/protocol/test/uri-test.c
2022-11-21 19:09:50 +01:00

61 lines
919 B
C

#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <stdio.h>
#include <stdlib.h>
#include "elinks.h"
int
get_https_by_default(void)
{
return 0;
}
const char *
get_default_protocol(void)
{
return "file://";
}
char *
gettext(const char *text)
{
return (char *)text;
}
int
os_default_charset(void)
{
return -1;
}
int current_charset;
#include "protocol/uri.h"
#include "util/string.h"
/* fake tty get function, needed for charsets.c */
int
get_ctl_handle()
{
return -1;
}
int
main(int argc, char **argv)
{
/* FIXME: As more protocol tests are added this could start
* taking arguments like --normalize-uri=<arg> etc. */
if (argc == 2) {
fprintf(stdout, "%s\n", normalize_uri(NULL, argv[1]));
} else if (argc == 3) {
struct uri *translated = get_translated_uri(argv[1], argv[2]);
if (translated == NULL)
return EXIT_FAILURE;
fprintf(stdout, "%s\n", struri(translated));
}
return 0;
}