aboutsummaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorKenny Levinsen <kl@kl.wtf>2020-08-01 02:47:45 +0200
committerKenny Levinsen <kl@kl.wtf>2020-08-01 16:53:44 +0200
commit509e64a3412985c85f9f58bd2b53434f056cf4c0 (patch)
tree1558aa772eafacbc0a04142a4c28ca7a92ed49e6 /examples
parent2462284dc5675623083b9c8b67a3cd5bf1d6f878 (diff)
simpletest: Take file to open as argument
Diffstat (limited to 'examples')
-rw-r--r--examples/simpletest/main.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/examples/simpletest/main.c b/examples/simpletest/main.c
index cd2e243..a702e4f 100644
--- a/examples/simpletest/main.c
+++ b/examples/simpletest/main.c
@@ -21,8 +21,11 @@ static void handle_disable(struct libseat *backend, void *data) {
}
int main(int argc, char *argv[]) {
- (void)argc;
- (void)argv;
+ if (argc < 2) {
+ fprintf(stderr, "Specify name of file to open as argument\n");
+ return -1;
+ }
+ char *file = argv[1];
int active = 0;
struct libseat_seat_listener listener = {
@@ -44,9 +47,9 @@ int main(int argc, char *argv[]) {
fprintf(stderr, "active!\n");
int fd, device;
- device = libseat_open_device(backend, "/dev/dri/card0", &fd);
+ device = libseat_open_device(backend, file, &fd);
fprintf(stderr, "libseat_open_device(backend: %p, path: %s, fd: %p) = %d\n",
- (void *)backend, "/dev/dri/card0", (void *)&fd, device);
+ (void *)backend, file, (void *)&fd, device);
if (device == -1) {
fprintf(stderr, "libseat_open_device() failed: %s\n", strerror(errno));
libseat_close_seat(backend);