Created
April 5, 2015 16:33
Revisions
-
mike-burns created this gist
Apr 5, 2015 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,47 @@ /* * gcc -g `pkg-config gtk+-3.0 --libs --cflags` main.c -o main */ #include <err.h> #include <stddef.h> #include <stdlib.h> #include <gtk/gtk.h> extern int errno; __dead static void usage(); int main(int argc, char *argv[]) { GAppInfo *app_info; GFile *file; GError *error; if (argc < 2) usage(); file = g_file_new_for_uri(argv[1]); error = NULL; app_info = g_file_query_default_handler(file, NULL, &error); g_object_unref(file); if (app_info == NULL) errx(1, "could not get app info from URI scheme: %s", error->message); printf("exec: '%s'\n", g_app_info_get_commandline(app_info)); g_object_unref(app_info); return 0; } static void usage() { fprintf(stderr, "usage: ./main file-uri\n"); exit(64); }