- printf("Main options are:\n");
- for(i=0;i<2;i++) {
- first = 1;
- for(po = options; po->name != NULL; po++) {
- char buf[64];
- expert = (po->flags & OPT_EXPERT) != 0;
- if (expert == i) {
- if (expert && first) {
- printf("\nAdvanced options are:\n");
- first = 0;
- }
- strcpy(buf, po->name);
- if (po->flags & HAS_ARG) {
- strcat(buf, " ");
- strcat(buf, po->argname);
- }
- printf("-%-17s %s\n", buf, po->help);
+ first = 1;
+ for(po = options; po->name != NULL; po++) {
+ char buf[64];
+ if ((po->flags & mask) == value) {
+ if (first) {
+ printf("%s", msg);
+ first = 0;
+ }
+ pstrcpy(buf, sizeof(buf), po->name);
+ if (po->flags & HAS_ARG) {
+ pstrcat(buf, sizeof(buf), " ");
+ pstrcat(buf, sizeof(buf), po->argname);