summaryrefslogtreecommitdiffstats
path: root/cfgparser.h
diff options
context:
space:
mode:
authorszabii <szabii@b3059339-0415-0410-9bf9-f77b7e298cf2>2001-03-18 23:32:31 +0000
committerszabii <szabii@b3059339-0415-0410-9bf9-f77b7e298cf2>2001-03-18 23:32:31 +0000
commit5f4b4b943680997d5909931e63e65dea38458427 (patch)
tree52a7b2c6d3210eb7403ecad1ebbea89aa7836813 /cfgparser.h
parent91ba148e8f7f10041e3150f73ddf34de2475f725 (diff)
downloadmpv-5f4b4b943680997d5909931e63e65dea38458427.tar.bz2
mpv-5f4b4b943680997d5909931e63e65dea38458427.tar.xz
new command line/config file parser
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@148 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'cfgparser.h')
-rw-r--r--cfgparser.h38
1 files changed, 38 insertions, 0 deletions
diff --git a/cfgparser.h b/cfgparser.h
new file mode 100644
index 0000000000..ce6462eef6
--- /dev/null
+++ b/cfgparser.h
@@ -0,0 +1,38 @@
+/*
+ * command line and config file parser
+ */
+
+#ifndef __CONFIG_H
+#define __CONFIG_H
+
+#define CONF_TYPE_FLAG 0
+#define CONF_TYPE_INT 1
+#define CONF_TYPE_FLOAT 2
+#define CONF_TYPE_STRING 3
+
+#define CONF_CHK_MIN 1<<0
+#define CONF_CHK_MAX 1<<1
+
+struct config {
+ char *name;
+ void *p;
+ unsigned int type :2;
+ unsigned int flags:2;
+ float min,max;
+};
+
+/* parse_config_file returns:
+ * -1 on error (can't malloc, invalid option...)
+ * 0 if can't open configfile
+ * 1 on success
+ */
+int parse_config_file(struct config *conf, char *conffile);
+
+/* parse_command_line reutrns:
+ * -1 on error (invalid option...)
+ * 0 if there was no filename on command line
+ * 1 if it found a filename
+ */
+int parse_command_line(struct config *conf, int argc, char **argv, char **envp, char **filename);
+
+#endif /* __CONFIG_H */