Package: osdsh / 0.7.0-10.2

08-strn-comments-fix.dpatch Patch series | download
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
From: Roman Yepishev <roman.yepishev@gmail.com>
Subject: Fixes single-line strn() and comment handling and 


--- a/src/osdsh/controlsh.c
+++ b/src/osdsh/controlsh.c
@@ -103,20 +103,23 @@
 	i++;
     }
     arg_first[a] = '\0';
-    i++;
     a = 0;
 
-    while((c=arguments[i])!='\n'&&c!='\0'&&c!=')') {
-	if (c=='\\') {
-	    i++;
-	    arg_secound[a] = arguments[i];
+    if (arguments[i]==',') {
+    	i++;
+	while((c=arguments[i])!='\n'&&c!='\0'&&c!=')') {
+	   if (c=='\\') {
+		i++;
+		arg_secound[a] = arguments[i];
+	   }
+	   else {
+		arg_secound[a] = c;
+	   }
+	   a++;
+	   i++;
 	}
-        else {
-	    arg_secound[a] = c;
-	}
-	a++;
-	i++;
     }
+
     arg_secound[a] = '\0';
 
     /* done with the arguments */
@@ -220,7 +223,7 @@
 		/*Read the bufer and check that it's not a comment*/
 		while(fgets(readbuf, BUFSIZ, fp)) {
 
-		    if (readbuf[c]=='#') continue;
+		    if (readbuf[0]=='#') continue;
 
 		    /*ignore spaces*/
 		    for (i=0; i<BUFSIZ&&((c=readbuf[i])==' '||c=='\t'); i++);