+ free(event);
+ }
+}
+
+int main(int argc, char *argv[]) {
+ char *username;
+ char *image_path = NULL;
+ int ret;
+ struct pam_conv conv = {conv_callback, NULL};
+ int curs_choice = CURS_NONE;
+ int o;
+ int optind = 0;
+ struct option longopts[] = {
+ {"version", no_argument, NULL, 'v'},
+ {"nofork", no_argument, NULL, 'n'},
+ {"beep", no_argument, NULL, 'b'},
+ {"dpms", no_argument, NULL, 'd'},
+ {"color", required_argument, NULL, 'c'},
+ {"pointer", required_argument, NULL , 'p'},
+ {"debug", no_argument, NULL, 0},
+ {"help", no_argument, NULL, 'h'},
+ {"no-unlock-indicator", no_argument, NULL, 'u'},
+ {"image", required_argument, NULL, 'i'},
+ {"tiling", no_argument, NULL, 't'},
+ {NULL, no_argument, NULL, 0}
+ };
+
+ if ((username = getenv("USER")) == NULL)
+ errx(1, "USER environment variable not set, please set it.\n");
+
+ while ((o = getopt_long(argc, argv, "hvnbdc:p:ui:t", longopts, &optind)) != -1) {
+ switch (o) {
+ case 'v':
+ errx(EXIT_SUCCESS, "version " VERSION " © 2010-2012 Michael Stapelberg");
+ case 'n':
+ dont_fork = true;
+ break;
+ case 'b':
+ beep = true;
+ break;
+ case 'd':
+ dpms = true;
+ break;
+ case 'c': {
+ char *arg = optarg;
+
+ /* Skip # if present */
+ if (arg[0] == '#')
+ arg++;
+
+ if (strlen(arg) != 6 || sscanf(arg, "%06[0-9a-fA-F]", color) != 1)
+ errx(1, "color is invalid, it must be given in 3-byte hexadecimal format: rrggbb\n");
+
+ break;