Add a default URL in testurl
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41
diff --git a/test/testurl.c b/test/testurl.c
index 4b5a4ed..390976e 100644
--- a/test/testurl.c
+++ b/test/testurl.c
@@ -11,6 +11,16 @@
*/
#include "SDL.h"
+static void tryOpenURL(const char *url)
+{
+ SDL_Log("Opening '%s' ...", url);
+ if (SDL_OpenURL(url) == 0) {
+ SDL_Log(" success!");
+ } else {
+ SDL_Log(" failed! %s", SDL_GetError());
+ }
+}
+
int main(int argc, char **argv)
{
int i;
@@ -19,14 +29,12 @@ int main(int argc, char **argv)
return 1;
}
- for (i = 1; i < argc; i++) {
- const char *url = argv[i];
- SDL_Log("Opening '%s' ...", url);
- if (SDL_OpenURL(url) == 0) {
- SDL_Log(" success!");
- } else {
- SDL_Log(" failed! %s", SDL_GetError());
+ if (argc > 1) {
+ for (i = 1; i < argc; i++) {
+ tryOpenURL(argv[i]);
}
+ } else {
+ tryOpenURL("https://libsdl.org/");
}
SDL_Quit();