A
Army1987
What's wrong with this code?
#define DEBUG 1
#include <string.h>
#if DEBUG
#include <stdio.h>
#endif
#include <stdlib.h>
#define MAX_LEN 32767
int main(int argc, char **argv)
{
char line[MAX_LEN] = "gcc -ansi -pedantic -Wall -Wextra -O3";
size_t len = strlen(line);
while (++argv && len < MAX_LEN) {
strncat(line, " ", MAX_LEN - len - 1);
len++;
strncat(line, *argv, MAX_LEN - len - 1);
len += strlen(*argv);
}
#if DEBUG
puts(line);
return 0;
#endif
return system(line);
}
#define DEBUG 1
#include <string.h>
#if DEBUG
#include <stdio.h>
#endif
#include <stdlib.h>
#define MAX_LEN 32767
int main(int argc, char **argv)
{
char line[MAX_LEN] = "gcc -ansi -pedantic -Wall -Wextra -O3";
size_t len = strlen(line);
while (++argv && len < MAX_LEN) {
strncat(line, " ", MAX_LEN - len - 1);
len++;
strncat(line, *argv, MAX_LEN - len - 1);
len += strlen(*argv);
}
#if DEBUG
puts(line);
return 0;
#endif
return system(line);
}