- // Compress the filenames into blocks.
- vector<string> filename_blocks;
- string uncompressed_filenames;
- int num_files_this_block = 0;
-
- string dst;
-
- for (string &filename : files) {
- uncompressed_filenames += filename;
- filename.clear();
- if (++num_files_this_block == block_size) {
- filename_blocks.push_back(zstd_compress(uncompressed_filenames));
- uncompressed_filenames.clear();
- num_files_this_block = 0;
- } else {
- uncompressed_filenames.push_back('\0');
+int main(int argc, char **argv)
+{
+ static const struct option long_options[] = {
+ { "block-size", required_argument, 0, 'b' },
+ { "plaintext", no_argument, 0, 'p' },
+ { "require-visibility", required_argument, 0, 'l' },
+ { "help", no_argument, 0, 'h' },
+ { "version", no_argument, 0, 'V' },
+ { "debug", no_argument, 0, 'D' }, // Not documented.
+ { 0, 0, 0, 0 }
+ };
+
+ int block_size = 32;
+ bool plaintext = false;
+ bool check_visibility = true;
+
+ setlocale(LC_ALL, "");
+ for (;;) {
+ int option_index = 0;
+ int c = getopt_long(argc, argv, "b:hpl:VD", long_options, &option_index);
+ if (c == -1) {
+ break;
+ }
+ switch (c) {
+ case 'b':
+ block_size = atoi(optarg);
+ break;
+ case 'p':
+ plaintext = true;
+ break;
+ case 'l':
+ if (!parse_bool(optarg, &check_visibility) != 0) {
+ fprintf(stderr, "plocate-build: invalid value `%s' for --%s\n",
+ optarg, "require-visibility");
+ exit(EXIT_FAILURE);
+ }
+ break;
+ case 'h':
+ usage();
+ exit(0);
+ case 'V':
+ version();
+ exit(0);
+ case 'D':
+ use_debug = true;
+ break;
+ default:
+ exit(1);