+ static const struct option long_options[] = {
+ { "help", no_argument, 0, 'h' },
+ { "database", required_argument, 0, 'd' },
+ { 0, 0, 0, 0 }
+ };
+
+ for (;;) {
+ int option_index = 0;
+ int c = getopt_long(argc, argv, "d:h:", long_options, &option_index);
+ if (c == -1) {
+ break;
+ }
+ switch (c) {
+ case 'd':
+ dbpath = strdup(optarg);
+ break;
+ case 'h':
+ usage();
+ exit(0);
+ }
+ }
+
+ if (optind == argc) {
+ fprintf(stderr, "slocate: no pattern to search for specified\n");
+ exit(0);
+ }
+ do_search_file(argv[optind], dbpath);