diff mplayer.c @ 151:9708d4b2765b

cfgparser fix
author szabii
date Mon, 19 Mar 2001 02:29:37 +0000
parents 2f3e01a1fd87
children 8e55121885b2
line wrap: on
line diff
--- a/mplayer.c	Mon Mar 19 01:49:44 2001 +0000
+++ b/mplayer.c	Mon Mar 19 02:29:37 2001 +0000
@@ -36,6 +36,7 @@
 
 #include "cfgparser.h"
 #include "cfg-mplayer-func.h"
+#include "cfg-mplayer-def.h"
 
 #include "libvo/video_out.h"
 
@@ -374,6 +375,8 @@
 int force_ni=0;
 char *homedir;
 char conffile[100];
+char confdir[100];
+int conffile_fd;
 #include "cfg-mplayer.h"
 
   printf("%s",banner_text);
@@ -383,7 +386,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);
 }