toaruos/apps/yutani-query.c

43 lines
799 B
C
Raw Normal View History

2018-02-25 17:05:57 +03:00
#include <stdio.h>
2018-08-08 12:15:34 +03:00
#include <unistd.h>
2018-02-25 17:05:57 +03:00
2018-03-19 05:38:11 +03:00
#include <toaru/yutani.h>
2018-02-25 17:05:57 +03:00
yutani_t * yctx;
void show_usage(int argc, char * argv[]) {
printf(
"yutani-query - show misc. information about the display system\n"
"\n"
2018-08-08 05:46:10 +03:00
"usage: %s [-r?]\n"
2018-02-25 17:05:57 +03:00
"\n"
" -r \033[3mprint display resoluton\033[0m\n"
" -? \033[3mshow this help text\033[0m\n"
"\n", argv[0]);
}
int show_resolution(void) {
2018-04-25 08:03:29 +03:00
printf("%dx%d\n", (int)yctx->display_width, (int)yctx->display_height);
2018-02-25 17:05:57 +03:00
return 0;
}
int main(int argc, char * argv[]) {
yctx = yutani_init();
if (!yctx) {
printf("(not connected)\n");
return 1;
}
2018-08-08 05:46:10 +03:00
int opt;
while ((opt = getopt(argc, argv, "?r")) != -1) {
switch (opt) {
case 'r':
return show_resolution();
case '?':
show_usage(argc,argv);
return 0;
2018-02-25 17:05:57 +03:00
}
}
return 0;
}