summaryrefslogtreecommitdiff
path: root/net/xbms/files/patch-server
blob: de7887e661273e675fc998df811ebaabc799f956 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
--- server.c.orig	Sun Feb 23 13:12:06 2003
+++ server.c	Fri Jan 20 16:45:29 2006
@@ -38,6 +38,7 @@
 #include <netinet/in.h>
 #include <netinet/tcp.h>
 #include <sys/wait.h>
+#include <limits.h>
 #include <stdio.h>
 #include <string.h>
 #include <stdarg.h>
@@ -55,7 +56,7 @@
 
 #define VERSION "0.30.6-dev"
 
-#define CONFIG "/etc/xbms.conf"
+#define CONFIG "@@PREFIX@@/etc/xbms.conf"
 #define PIDFILE "/var/run/xbms.pid"
 #define C_SERVER_PORT 1400
 #define MAX_MSG_LENGTH 4096
@@ -465,9 +466,10 @@
       if (main_config->debug_lvl >= 1) d_log("OPEN\n");
       
       /* Get the argument after comma */
-      ptr = strtok(line,",");
-      ptr = strtok(NULL,",");
-      
+      ptr = strstr(line,",");
+//      ptr = strtok(NULL,",");
+      if (ptr!=NULL) {
+		  ptr++;
       fileName = (char *)malloc(strlen(ptr)+1);
   //    targetfileName = (char *)malloc(strlen(TARGET_PATH)+strlen(ptr)+2);
       
@@ -508,7 +510,8 @@
 	    }
 	}
       else d_log("Illegal string in filename: %s\n", fileName); 
-    }
+	  } else d_log("Illegal filename: %s\n", fileName);
+	}
 
   /***************************** READ A PART OF A FILE ****************/
   if (strcmp(cmd,"READ") == 0)
@@ -632,13 +635,14 @@
   /* mp3 playlists work from now on                          */
   if (strcmp(cmd,"*CAT") == 0) {
 	  if (main_config->debug_lvl >= 5) 
-			d_log("CurDirectory: %s\n",main_config->current_path);
+			d_log("CurDirectory: %s\n",main_config->root_dir);
 
       /* Get the character after the comma, if any */
-      ptr = strtok(line,",");
-      if ((ptr = strtok(NULL,",")))	{
+      ptr = strstr(line,",");
+      if (ptr!=NULL)	{
 		  /* Check the command */
-		if (!strcmp(ptr,"BACK")) {
+		  ptr++;
+		  if (!strcmp(ptr,"BACK")) {
 			  /* We can't go back if the current path is empty ! */
 			if (main_config->current_path!=NULL && main_config->current_path[0] != 0) {
 				  fileName = (char *)malloc(strlen(main_config->current_path)+1);
@@ -654,7 +658,7 @@
 			  if (main_config->current_path!=NULL) free(main_config->current_path);
 			  main_config->current_path=strdup(ptr);
 		  }
-	  }
+	  } else {main_config->current_path=NULL;}
 
 	  if (main_config->debug_lvl >= 5) 
 		  d_log("targetpath: %s - curpath: %s - ptr: %s\n",TARGET_PATH,main_config->current_path,ptr);