diff options
author | Jaakko Keränen <jaakko.keranen@iki.fi> | 2021-05-21 13:16:26 +0300 |
---|---|---|
committer | Jaakko Keränen <jaakko.keranen@iki.fi> | 2021-05-21 13:16:26 +0300 |
commit | cb5e83ed31f009ea24cdca038a6c49390451cb34 (patch) | |
tree | 7076a089174920ead5b030985872a09738edb0fe /src/gmutil.c | |
parent | d7d3ce9e44dd96a40b3ec3740b777f0bd35a103e (diff) |
Added -u,--url-or-search command line option
Opening an URL or making a search query from the command line.
IssueID #232
Diffstat (limited to 'src/gmutil.c')
-rw-r--r-- | src/gmutil.c | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/src/gmutil.c b/src/gmutil.c index 2c9ba4eb..3ca93901 100644 --- a/src/gmutil.c +++ b/src/gmutil.c | |||
@@ -262,7 +262,20 @@ void urlEncodePath_String(iString *d) { | |||
262 | delete_String(encoded); | 262 | delete_String(encoded); |
263 | } | 263 | } |
264 | 264 | ||
265 | static iBool isSupportedUrlScheme_Rangecc_(iRangecc scheme) { | 265 | iBool isKnownScheme_Rangecc(iRangecc scheme) { |
266 | if (isKnownUrlScheme_Rangecc(scheme)) { | ||
267 | return iTrue; | ||
268 | } | ||
269 | static const char *uriSchemes[] = { "about", "data" }; | ||
270 | iForIndices(i, uriSchemes) { | ||
271 | if (equalCase_Rangecc(scheme, uriSchemes[i])) { | ||
272 | return iTrue; | ||
273 | } | ||
274 | } | ||
275 | return iFalse; | ||
276 | } | ||
277 | |||
278 | iBool isKnownUrlScheme_Rangecc(iRangecc scheme) { | ||
266 | static const char *schemes[] = { "gemini", "gopher", "finger", "http", "https", "file" }; | 279 | static const char *schemes[] = { "gemini", "gopher", "finger", "http", "https", "file" }; |
267 | iForIndices(i, schemes) { | 280 | iForIndices(i, schemes) { |
268 | if (equalCase_Rangecc(scheme, schemes[i])) { | 281 | if (equalCase_Rangecc(scheme, schemes[i])) { |
@@ -277,7 +290,7 @@ const iString *absoluteUrl_String(const iString *d, const iString *urlMaybeRelat | |||
277 | iUrl rel; | 290 | iUrl rel; |
278 | init_Url(&orig, d); | 291 | init_Url(&orig, d); |
279 | init_Url(&rel, urlMaybeRelative); | 292 | init_Url(&rel, urlMaybeRelative); |
280 | if (!isEmpty_Range(&rel.scheme) && !isSupportedUrlScheme_Rangecc_(rel.scheme) && | 293 | if (!isEmpty_Range(&rel.scheme) && !isKnownUrlScheme_Rangecc(rel.scheme) && |
281 | isEmpty_Range(&rel.host)) { | 294 | isEmpty_Range(&rel.host)) { |
282 | /* Probably not an URL, so we can't make this absolute. */ | 295 | /* Probably not an URL, so we can't make this absolute. */ |
283 | return urlMaybeRelative; | 296 | return urlMaybeRelative; |