comparison sidinfo.c @ 330:c8f52ea74803

More help cosmetics.
author Matti Hamalainen <ccr@tnsp.org>
date Sun, 12 Jan 2020 22:41:17 +0200
parents 14a91c998d96
children f8a133d0b703
comparison
equal deleted inserted replaced
329:14a91c998d96 330:c8f52ea74803
139 static const int optListN = sizeof(optList) / sizeof(optList[0]); 139 static const int optListN = sizeof(optList) / sizeof(optList[0]);
140 140
141 141
142 void argShowHelp(void) 142 void argShowHelp(void)
143 { 143 {
144 int index, len; 144 int index, width;
145 145
146 th_print_banner(stdout, th_prog_name, "[options] <sid file|path> [file|path #2 ..]"); 146 th_print_banner(stdout, th_prog_name, "[options] <sid file|path> [file|path #2 ..]");
147 th_args_help(stdout, optList, optListN, 0, 80 - 2); 147 th_args_help(stdout, optList, optListN, 0, 80 - 2);
148 148
149 printf( 149 printf(
150 "\n" 150 "\n"
151 "Available fields:\n"); 151 "Available fields:\n");
152 152
153 for (len = index = 0; index < noptPSOptions; index++) 153 for (width = index = 0; index < noptPSOptions; index++)
154 { 154 {
155 const PSFOption *opt = &optPSOptions[index]; 155 const PSFOption *opt = &optPSOptions[index];
156 len += strlen(opt->name) + 2; 156 int len = strlen(opt->name) + 2;
157 if (len >= 80 - 2) 157 width += len;
158 if (width >= 80 - 2)
158 { 159 {
159 printf("\n"); 160 printf("\n");
160 len = 0; 161 width = len;
161 } 162 }
162 printf("%s%s", opt->name, (index < noptPSOptions - 1) ? ", " : "\n\n"); 163 printf("%s%s",
164 opt->name,
165 (index < noptPSOptions - 1) ? ", " : "\n");
163 } 166 }
164 167
165 printf( 168 printf(
169 "\n"
166 "Example: %s -x -p -f hash,copyright somesidfile.sid\n" 170 "Example: %s -x -p -f hash,copyright somesidfile.sid\n"
167 "\n" 171 "\n"
168 "Format strings for '-F' option are composed of @fields@ that get\n" 172 "Format strings for '-F' option are composed of @fields@ that get expanded\n"
169 "expanded to their value. Also, escape sequences \\r, \\n and \\t\n" 173 "to their value. Also, escape sequences \\r, \\n and \\t can be used:\n"
170 "can be used: -F \"hash=@hash@\\ncopy=@copyright@\\n\"\n" 174 " -F \"hash=@hash@\\ncopy=@copyright@\\n\"\n"
171 "\n" 175 "\n"
172 "The -F fields can be further formatted via printf-style specifiers:\n" 176 "The -F fields can be further formatted via printf-style specifiers:\n"
173 "-F \"@copyright:'%%-30s'@\"\n" 177 " -F \"@copyright:'%%-30s'@\"\n"
174 "\n" 178 "\n"
175 "NOTE: One line output (-l <field separator>) also sets escape characters\n" 179 "NOTE: One line output (-l <field separator>) also sets escape characters\n"
176 "(option -e <chars>), if escape characters have NOT been separately set.\n" 180 "(option -e <chars>), if escape characters have NOT been separately set.\n"
177 "\n" 181 "\n"
178 "TIP: When specifying HVSC paths, it is preferable to use -H/--hvsc option,\n" 182 "TIP: When specifying HVSC paths, it is preferable to use -H/--hvsc option,\n"