src/util/main.c
changeset 34 a387bc77ad52
parent 26 72fd5ba8d8c1
child 52 148a120ea7d5
equal deleted inserted replaced
33:0ed40e11b0e8 34:a387bc77ad52
    17     { "force-update",   false,  NULL,   'U' },
    17     { "force-update",   false,  NULL,   'U' },
    18     { "width",          true,   NULL,   'W' },
    18     { "width",          true,   NULL,   'W' },
    19     { "height",         true,   NULL,   'H' },
    19     { "height",         true,   NULL,   'H' },
    20     { "x",              true,   NULL,   'x' },
    20     { "x",              true,   NULL,   'x' },
    21     { "y",              true,   NULL,   'y' },
    21     { "y",              true,   NULL,   'y' },
       
    22     { "zoom",           true,   NULL,   'z' },
    22     { "threads",        true,   NULL,   'j' },
    23     { "threads",        true,   NULL,   'j' },
    23     { 0,                0,      0,      0   }
    24     { 0,                0,      0,      0   }
    24 };
    25 };
    25 
    26 
    26 /**
    27 /**
    39         "\t-U, --force-update   unconditionally update image caches\n"
    40         "\t-U, --force-update   unconditionally update image caches\n"
    40         "\t-W, --width          set tile width\n"
    41         "\t-W, --width          set tile width\n"
    41         "\t-H, --height         set tile height\n"
    42         "\t-H, --height         set tile height\n"
    42         "\t-x, --x              set tile x offset\n"
    43         "\t-x, --x              set tile x offset\n"
    43         "\t-y, --y              set tile z offset\n"
    44         "\t-y, --y              set tile z offset\n"
       
    45         "\t-z, --zoom           set zoom factor (<0)\n"
    44         "\t-j, --threads        number of threads\n"
    46         "\t-j, --threads        number of threads\n"
    45     );
    47     );
    46 }
    48 }
    47 
    49 
    48 int main (int argc, char **argv)
    50 int main (int argc, char **argv)
    49 {
    51 {
    50     int opt;
    52     int opt;
    51     bool force_update = false;
    53     bool force_update = false;
    52     struct pt_tile_info ti = {0, 0, 0, 0};
    54     struct pt_tile_info ti = {0, 0, 0, 0, 0};
    53     int threads = 2;
    55     int threads = 2;
    54     int tmp, err;
    56     int tmp, err;
    55     
    57     
    56     // parse arguments
    58     // parse arguments
    57     while ((opt = getopt_long(argc, argv, "hqvDUW:H:x:y:j:", options, NULL)) != -1) {
    59     while ((opt = getopt_long(argc, argv, "hqvDUW:H:x:y:z:j:", options, NULL)) != -1) {
    58         switch (opt) {
    60         switch (opt) {
    59             case 'h':
    61             case 'h':
    60                 // display help
    62                 // display help
    61                 help(argv[0]);
    63                 help(argv[0]);
    62                 
    64                 
    90             case 'x':
    92             case 'x':
    91                 ti.x = strtol(optarg, NULL, 0); break;
    93                 ti.x = strtol(optarg, NULL, 0); break;
    92 
    94 
    93             case 'y':
    95             case 'y':
    94                 ti.y = strtol(optarg, NULL, 0); break;
    96                 ti.y = strtol(optarg, NULL, 0); break;
       
    97 
       
    98             case 'z':
       
    99                 ti.zoom = strtol(optarg, NULL, 0); break;
    95 
   100 
    96             case 'j':
   101             case 'j':
    97                 if ((tmp = strtol(optarg, NULL, 0)) < 1)
   102                 if ((tmp = strtol(optarg, NULL, 0)) < 1)
    98                     FATAL("Invalid value for -j/--threads");
   103                     FATAL("Invalid value for -j/--threads");
    99 
   104