- while (1) {
- enum { GETOPT_VAL_RESCAN = 256 };
- static const struct option long_options[] = {
- { "rescan", no_argument, NULL, GETOPT_VAL_RESCAN },
- { NULL, 0, NULL, 0 }
- };
- int c = getopt_long(argc, argv, "", long_options, NULL);
-
- if (c < 0)
- break;
- switch (c) {
- case GETOPT_VAL_RESCAN:
- rescan = 1;
- break;
- default:
- /* Usage printed by the caller */
- return -1;
+ if (assign) {
+ while (1) {
+ enum { GETOPT_VAL_RESCAN = 256, GETOPT_VAL_NO_RESCAN };
+ static const struct option long_options[] = {
+ { "rescan", no_argument, NULL,
+ GETOPT_VAL_RESCAN },
+ { "no-rescan", no_argument, NULL,
+ GETOPT_VAL_NO_RESCAN },
+ { NULL, 0, NULL, 0 }
+ };
+ int c = getopt_long(argc, argv, "", long_options, NULL);
+
+ if (c < 0)
+ break;
+ switch (c) {
+ case GETOPT_VAL_RESCAN:
+ rescan = 1;
+ break;
+ case GETOPT_VAL_NO_RESCAN:
+ rescan = 0;
+ break;
+ default:
+ /* Usage printed by the caller */
+ return -1;
+ }