+static int parse_args(int argc, char **argv)
+{
+ int i;
+
+ for(i=1; i<argc; i++) {
+ if(argv[i][0] == '-') {
+ if(strcmp(argv[i], "-uiscale") == 0) {
+ if(!argv[++i] || !(uiscale = atoi(argv[i]))) {
+ fprintf(stderr, "-uiscale should be followed by a positive number\n");
+ return -1;
+ }
+ } else if(strcmp(argv[i], "-help") == 0 || strcmp(argv[i], "-h") == 0) {
+ printf("Usage: %s [options]\n", argv[0]);
+ printf("Options:\n");
+ printf(" -uiscale <scale>: UI scale factor (default: 1)\n");
+ printf(" -h,-help: print usage and exit\n");
+ exit(0);
+ } else {
+ fprintf(stderr, "unknown option: %s\n", argv[i]);
+ return -1;
+ }
+ } else {
+ fprintf(stderr, "unexpected argument: %s\n", argv[i]);
+ return -1;
+ }
+ }
+ return 0;
+}
+
+/* --- ubertk callbacks --- */
+