aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/afm-launch.c22
-rw-r--r--src/wgtpkg-info.c2
-rw-r--r--src/wgtpkg-zip.c3
3 files changed, 13 insertions, 14 deletions
diff --git a/src/afm-launch.c b/src/afm-launch.c
index 937366d..1f9907d 100644
--- a/src/afm-launch.c
+++ b/src/afm-launch.c
@@ -107,25 +107,26 @@ static char **instantiate_arguments(const char **args, struct afm_launch_desc *d
{
const char **iter, *p, *v;
char *data, **result, port[20], width[20], height[20], mini[3], c;
- int n, s, x;
+ int n, s;
/* init */
mini[0] = '%';
mini[2] = 0;
/* loop that either compute the size and build the result */
- n = s = x = 0;
+ data = NULL;
+ n = s = 0;
for (;;) {
iter = args;
n = 0;
while (*iter) {
p = *iter++;
- if (x)
+ if (data)
result[n] = data;
n++;
while((c = *p++) != 0) {
if (c != '%') {
- if (x)
+ if (data)
*data++ = c;
else
s++;
@@ -133,7 +134,7 @@ static char **instantiate_arguments(const char **args, struct afm_launch_desc *d
c = *p++;
switch (c) {
case 'I': v = FWK_ICON_DIR; break;
- case 'P': if(!x) sprintf(port, "%d", params->port); v = port; break;
+ case 'P': if(!data) sprintf(port, "%d", params->port); v = port; break;
case 'S': v = params->secret; break;
case 'D': v = params->datadir; break;
case 'r': v = desc->path; break;
@@ -144,23 +145,23 @@ static char **instantiate_arguments(const char **args, struct afm_launch_desc *d
case 'm': v = desc->type; break;
case 'n': v = desc->name; break;
case 'p': v = "" /*desc->plugins*/; break;
- case 'W': if(!x) sprintf(width, "%d", desc->width); v = width; break;
- case 'H': if(!x) sprintf(height, "%d", desc->height); v = height; break;
+ case 'W': if(!data) sprintf(width, "%d", desc->width); v = width; break;
+ case 'H': if(!data) sprintf(height, "%d", desc->height); v = height; break;
case '%': c = 0;
default: mini[1] = c; v = mini; break;
}
- if (x)
+ if (data)
data = stpcpy(data, v);
else
s += strlen(v);
}
}
- if (x)
+ if (data)
*data++ = 0;
else
s++;
}
- if (x) {
+ if (data) {
result[n] = NULL;
return result;
}
@@ -171,7 +172,6 @@ static char **instantiate_arguments(const char **args, struct afm_launch_desc *d
return NULL;
}
data = (char*)(&result[n + 1]);
- x = 1;
}
}
diff --git a/src/wgtpkg-info.c b/src/wgtpkg-info.c
index 67d4596..b2855b6 100644
--- a/src/wgtpkg-info.c
+++ b/src/wgtpkg-info.c
@@ -16,8 +16,6 @@
limitations under the License.
*/
-#define _BSD_SOURCE /* see readdir */
-
#include <stdlib.h>
#include <stdio.h>
#include <dirent.h>
diff --git a/src/wgtpkg-zip.c b/src/wgtpkg-zip.c
index 8168fe7..4b87a41 100644
--- a/src/wgtpkg-zip.c
+++ b/src/wgtpkg-zip.c
@@ -16,7 +16,7 @@
limitations under the License.
*/
-#define _BSD_SOURCE /* see readdir */
+#define _DEFAULT_SOURCE
#include <limits.h>
#include <sys/types.h>
@@ -353,6 +353,7 @@ int zwrite(const char *zipfile)
#else
#include <sys/wait.h>
+#include <stdlib.h>
extern char **environ;