Mercurial > hg > dmlib
comparison tools/packed.c @ 2408:60e119262c67
Option index re-ordering cleanup work.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Mon, 13 Jan 2020 21:21:25 +0200 |
parents | b7cd5dd0b82e |
children | bc05bcfc4598 |
comparison
equal
deleted
inserted
replaced
2407:c5a32812dd97 | 2408:60e119262c67 |
---|---|
51 static const int cmdListN = sizeof(cmdList) / sizeof(cmdList[0]); | 51 static const int cmdListN = sizeof(cmdList) / sizeof(cmdList[0]); |
52 | 52 |
53 | 53 |
54 static const DMOptArg optList[] = | 54 static const DMOptArg optList[] = |
55 { | 55 { |
56 { 0, '?', "help", "Show this help", OPT_NONE }, | 56 { 0, '?', "help" , "Show this help", OPT_NONE }, |
57 { 1, 'n', "nocompress", "No compression / decompression", OPT_NONE }, | 57 { 2, 'v', "verbose" , "Be more verbose", OPT_NONE }, |
58 { 2, 'C', "level", "Set zlib compression level 1-9", OPT_ARGREQ }, | 58 |
59 { 3, 'v', "verbose", "Increase verbosity", OPT_NONE }, | 59 { 3, 'n', "nocompress" , "No compression / decompression", OPT_NONE }, |
60 { 4, 'f', "resflags", "Set default resource flags (-f 0xff)", OPT_ARGREQ }, | 60 { 4, 'C', "level" , "Set zlib compression level 1-9", OPT_ARGREQ }, |
61 { 5, 'x', "exclude", "Exclude name/glob pattern", OPT_ARGREQ }, | 61 { 5, 'f', "resflags" , "Set default resource flags (-f 0xff)", OPT_ARGREQ }, |
62 { 6, 'x', "exclude" , "Exclude name/glob pattern", OPT_ARGREQ }, | |
62 }; | 63 }; |
63 | 64 |
64 static const int optListN = sizeof(optList) / sizeof(optList[0]); | 65 static const int optListN = sizeof(optList) / sizeof(optList[0]); |
65 | 66 |
66 | 67 |
100 case 0: | 101 case 0: |
101 argShowHelp(); | 102 argShowHelp(); |
102 exit(0); | 103 exit(0); |
103 break; | 104 break; |
104 | 105 |
105 case 1: | 106 case 2: |
107 dmVerbosity++; | |
108 break; | |
109 | |
110 case 3: | |
106 optDoCompress = FALSE; | 111 optDoCompress = FALSE; |
107 break; | 112 break; |
108 | 113 |
109 case 2: | 114 case 4: |
110 optCompressLevel = atoi(optArg); | 115 optCompressLevel = atoi(optArg); |
111 if (optCompressLevel < 1 || optCompressLevel > 9) | 116 if (optCompressLevel < 1 || optCompressLevel > 9) |
112 { | 117 { |
113 dmErrorMsg("Invalid compression level argument '%s', must be 1 .. 9.\n", optArg); | 118 dmErrorMsg("Invalid compression level argument '%s', must be 1 .. 9.\n", optArg); |
114 return FALSE; | 119 return FALSE; |
115 } | 120 } |
116 break; | 121 break; |
117 | 122 |
118 case 3: | 123 case 5: |
119 dmVerbosity++; | |
120 break; | |
121 | |
122 case 4: | |
123 { | 124 { |
124 unsigned int tmpUI; | 125 unsigned int tmpUI; |
125 if (!dmGetIntVal(optArg, &tmpUI, NULL)) | 126 if (!dmGetIntVal(optArg, &tmpUI, NULL)) |
126 { | 127 { |
127 dmErrorMsg("Invalid flags value '%s'.\n", optArg); | 128 dmErrorMsg("Invalid flags value '%s'.\n", optArg); |
129 } | 130 } |
130 optDefResFlags = tmpUI; | 131 optDefResFlags = tmpUI; |
131 } | 132 } |
132 break; | 133 break; |
133 | 134 |
134 case 5: | 135 case 6: |
135 if (nexcFilenames < SET_MAX_FILES) | 136 if (nexcFilenames < SET_MAX_FILES) |
136 { | 137 { |
137 excFilenames[nexcFilenames++] = optArg; | 138 excFilenames[nexcFilenames++] = optArg; |
138 } | 139 } |
139 else | 140 else |
646 { | 647 { |
647 int res = 0; | 648 int res = 0; |
648 DMPackFile *pack = NULL; | 649 DMPackFile *pack = NULL; |
649 | 650 |
650 // Parse arguments | 651 // Parse arguments |
651 dmInitProg("packed", "Pack File Editor", "0.7", NULL, NULL); | 652 dmInitProg("packed", "TNSP Pack File Editor", "0.7", NULL, NULL); |
652 dmVerbosity = 0; | 653 dmVerbosity = 0; |
653 | 654 |
654 if (!dmArgsProcess(argc, argv, optList, optListN, | 655 if (!dmArgsProcess(argc, argv, optList, optListN, |
655 argHandleOpt, argHandleNonOpt, OPTH_BAILOUT)) | 656 argHandleOpt, argHandleNonOpt, OPTH_BAILOUT)) |
656 exit(1); | 657 exit(1); |