comparison rvinterf/tmsh/usercmd.c @ 267:4c6bee98e002

fc-tmsh: support quoted strings for set-pcm-string
author Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
date Thu, 06 Feb 2014 01:40:02 +0000
parents 0c938d8b5ba3
children 1ee80bcb0fd0
comparison
equal deleted inserted replaced
266:cb833ff54d88 267:4c6bee98e002
96 break; 96 break;
97 if (ap - argv - 1 >= tp->maxargs) { 97 if (ap - argv - 1 >= tp->maxargs) {
98 printf("error: too many arguments\n"); 98 printf("error: too many arguments\n");
99 return; 99 return;
100 } 100 }
101 *ap++ = cp; 101 if (*cp == '"') {
102 while (*cp && !isspace(*cp)) 102 *ap++ = ++cp;
103 cp++; 103 while (*cp && *cp != '"')
104 if (*cp) 104 cp++;
105 if (*cp != '"') {
106 printf("error: unterminated quoted string\n");
107 return;
108 }
105 *cp++ = '\0'; 109 *cp++ = '\0';
110 } else {
111 *ap++ = cp;
112 while (*cp && !isspace(*cp))
113 cp++;
114 if (*cp)
115 *cp++ = '\0';
116 }
106 } 117 }
107 if (ap - argv - 1 < tp->minargs) { 118 if (ap - argv - 1 < tp->minargs) {
108 printf("error: too few arguments\n"); 119 printf("error: too few arguments\n");
109 return; 120 return;
110 } 121 }