summaryrefslogtreecommitdiff
path: root/cmdutils.c
diff options
context:
space:
mode:
authorFabrice Bellard <fabrice@bellard.org>2003-08-24 15:29:48 +0000
committerFabrice Bellard <fabrice@bellard.org>2003-08-24 15:29:48 +0000
commit02d504a7d3f0546374cc02ecff45390a0d4faa6b (patch)
tree2828dfbc4e4779424e5d105b981fdc23a707375e /cmdutils.c
parent18bff7520e2fb844411b1d206d519ed695f63d2d (diff)
more sections in help - copyright fixes
Originally committed as revision 2143 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'cmdutils.c')
-rw-r--r--cmdutils.c41
1 files changed, 17 insertions, 24 deletions
diff --git a/cmdutils.c b/cmdutils.c
index 2131605b16..e47807e49f 100644
--- a/cmdutils.c
+++ b/cmdutils.c
@@ -16,38 +16,31 @@
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-
+#define HAVE_AV_CONFIG_H
#include "common.h"
#include "avformat.h"
#include "cmdutils.h"
-void show_help_options(const OptionDef *options)
+void show_help_options(const OptionDef *options, const char *msg, int mask, int value)
{
const OptionDef *po;
- int i, expert, first;
+ int first;
- 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;
+ }
+ strcpy(buf, po->name);
+ if (po->flags & HAS_ARG) {
+ strcat(buf, " ");
+ strcat(buf, po->argname);
}
+ printf("-%-17s %s\n", buf, po->help);
}
}
}
@@ -84,7 +77,7 @@ void parse_options(int argc, char **argv, const OptionDef *options)
}
if (po->flags & OPT_STRING) {
char *str;
- str = strdup(arg);
+ str = av_strdup(arg);
*po->u.str_arg = str;
} else if (po->flags & OPT_BOOL) {
*po->u.int_arg = 1;