SDL
1/*
2Copyright (C) 1997-2024 Sam Lantinga <slouken@libsdl.org>
3
4This software is provided 'as-is', without any express or implied
5warranty. In no event will the authors be held liable for any damages
6arising from the use of this software.
7
8Permission is granted to anyone to use this software for any purpose,
9including commercial applications, and to alter it and redistribute it
10freely.
11*/
12#include <SDL3/SDL.h>13#include <SDL3/SDL_main.h>14
15static void tryOpenURL(const char *url)16{
17SDL_Log("Opening '%s' ...", url);18if (SDL_OpenURL(url) == 0) {19SDL_Log(" success!");20} else {21SDL_Log(" failed! %s", SDL_GetError());22}23}
24
25int main(int argc, char **argv)26{
27int i;28if (SDL_Init(SDL_INIT_VIDEO) < 0) {29SDL_Log("SDL_Init failed: %s\n", SDL_GetError());30return 1;31}32
33if (argc > 1) {34for (i = 1; i < argc; i++) {35tryOpenURL(argv[i]);36}37} else {38tryOpenURL("https://libsdl.org/");39}40
41SDL_Quit();42return 0;43}
44