2 |
// |
// |
3 |
/**************************************************************************** |
/**************************************************************************** |
4 |
liblscp - LinuxSampler Control Protocol API |
liblscp - LinuxSampler Control Protocol API |
5 |
Copyright (C) 2004-2007, rncbc aka Rui Nuno Capela. All rights reserved. |
Copyright (C) 2004-2008, rncbc aka Rui Nuno Capela. All rights reserved. |
6 |
|
|
7 |
This library is free software; you can redistribute it and/or |
This library is free software; you can redistribute it and/or |
8 |
modify it under the terms of the GNU Lesser General Public |
modify it under the terms of the GNU Lesser General Public |
132 |
char *pszToken; |
char *pszToken; |
133 |
char *pch; |
char *pch; |
134 |
char *pszKey; |
char *pszKey; |
135 |
|
char *pszVal; |
136 |
|
|
137 |
// Lock this section up. |
// Lock this section up. |
138 |
lscp_mutex_lock(pClient->mutex); |
lscp_mutex_lock(pClient->mutex); |
142 |
pszResult = lscp_client_get_result(pClient); |
pszResult = lscp_client_get_result(pClient); |
143 |
pszToken = lscp_strtok((char *) pszResult, pszSeps, &(pch)); |
pszToken = lscp_strtok((char *) pszResult, pszSeps, &(pch)); |
144 |
while (pszToken) { |
while (pszToken) { |
145 |
if (strcasecmp(pszToken, "NAME") == 0) { |
pszKey = pszToken; |
146 |
pszToken = lscp_strtok(NULL, pszCrlf, &(pch)); |
pszToken = lscp_strtok(NULL, pszCrlf, &(pch)); |
147 |
if (pszToken) |
if (pszKey && pszToken) { |
148 |
lscp_unquote_dup(&(pDevicePortInfo->name), &pszToken); |
pszVal = lscp_unquote(&pszToken, 0); |
149 |
} |
lscp_plist_append(&(pDevicePortInfo->params), pszKey, pszVal); |
150 |
else { |
if (strcasecmp(pszKey, "NAME") == 0) { |
151 |
pszKey = pszToken; |
// Free desteny string, if already there. |
152 |
pszToken = lscp_strtok(NULL, pszCrlf, &(pch)); |
if (pDevicePortInfo->name) |
153 |
if (pszToken) |
free(pDevicePortInfo->name); |
154 |
lscp_plist_append(&(pDevicePortInfo->params), pszKey, lscp_unquote(&pszToken, 0)); |
pDevicePortInfo->name = NULL; |
155 |
|
if (pszVal) |
156 |
|
pDevicePortInfo->name = strdup(pszVal); |
157 |
|
} |
158 |
} |
} |
159 |
pszToken = lscp_strtok(NULL, pszSeps, &(pch)); |
pszToken = lscp_strtok(NULL, pszSeps, &(pch)); |
160 |
} |
} |