changeset 159:8e9b6c00756f

added cfgparser fixes to mplayerHQ.c
author szabii
date Mon, 19 Mar 2001 13:23:11 +0000
parents 05e9c8083922
children 5f0c50a9e347
files mplayerHQ.c
diffstat 1 files changed, 13 insertions(+), 14 deletions(-) [+]
line wrap: on
line diff
--- a/mplayerHQ.c	Mon Mar 19 13:12:48 2001 +0000
+++ b/mplayerHQ.c	Mon Mar 19 13:23:11 2001 +0000
@@ -37,6 +37,7 @@
 #include "config.h"
 
 #include "cfgparser.h"
+#include "cfg-mplayer-def.h"
 
 #include "libvo/video_out.h"
 
@@ -317,16 +318,6 @@
   exit_player(NULL);
 }
 
-void usage(void){
-  printf("%s",help_text);
-  exit(0);
-}
-
-void missing_param(char *s){
-  printf("Missing parameter: %s\n", s);
-  exit(1);
-}
-
 int divx_quality=0;
 
 int main(int argc,char* argv[], char *envp[]){
@@ -380,6 +371,8 @@
 int force_ni=0;
 char *homedir;
 char conffile[100];
+char confdir[100];
+int conffile_fd;
 #include "cfg-mplayer.h"
 
   printf("%s",banner_text);
@@ -389,7 +382,13 @@
 if ((homedir = getenv("HOME")) == NULL) {
   printf("Can't find HOME dir\n");
 } else {
-  snprintf(conffile, 100, "%s/.mplayerrc", homedir);
+  snprintf(confdir, 100, "%s/.mplayer", homedir);
+  mkdir(confdir, 0777);
+  snprintf(conffile, 100, "%s/config", confdir);
+  if ((conffile_fd = open(conffile, O_CREAT | O_EXCL | O_WRONLY, 0644)) != -1) {
+    write(conffile_fd, default_config, strlen(default_config));
+    close(conffile_fd);
+  }
   if (parse_config_file(conf, conffile) < 0)
     exit(1);
 }
@@ -432,9 +431,9 @@
 
 if(!filename){
   if(vcd_track) filename="/dev/cdrom"; 
-  else
-  //filename="MI2-Trailer.avi";
-  usage();
+  else {
+    printf("%s",help_text); exit(0);
+  }
 }