История изменений
Исправление beastie, (текущая версия) :
Вот вам мой наколенный быдлокод:
#include <stdio.h>
#include <string.h>
char *
cutout(char *hay, char *needle)
{
        char *p, *s = hay;
        while ((s = strstr(s, needle)) != NULL) {
                if ((p = strchr(s, ' ')) != NULL)
                        memmove(s, p + 1, strlen(p));
                else
                        *s = '\0';
        }
        return hay;
}
char teststring[] = "debug some debug and not only debug=debug but also debug";
int
main()
{
        puts(teststring);
        puts(cutout(teststring, "debug"));
        return 0;
}
Исправление beastie, :
Вот вам мой наколенный быдлокод:
#include <stdio.h>
#include <string.h>
char *
cutout(char *hay, char *needle)
{
        char *p, *s = hay;
        while ((s = strstr(s, needle)) != NULL) {
                if ((p = strchr(s, ' ')) != NULL)
                        memmove(s, p + 1, strlen(p));
                else
                        *s = '\0';
        }
        return hay;
}
char teststring[] = "debug some debug and not only debug=debug but also debug";
int
main()
{
        puts(teststring);
        puts(cutout(teststring, "debug"));
        return 0;
}
Исправление beastie, :
Вот вам мой наколенный быдлокод:
#include <stdlib.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
char *
cutout(char *hay, char *needle)
{
        char *p, *s = hay;
        while ((s = strstr(s, needle)) != NULL) {
                if ((p = strchr(s, ' ')) != NULL)
                        memmove(s, p + 1, strlen(p));
                else
                        *s = '\0';
        }
        return hay;
}
char teststring[] = "debug some debug and not only debug=debug but also debug";
int
main()
{
        puts(teststring);
        puts(cutout(teststring, "debug"));
        return 0;
}
Исходная версия beastie, :
Вот вам мой наколенный быдлокод:
#include <stdlib.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
char *
cutout(char *hay, char *needle)
{
        char *p, *s = hay;
        while ((s = strstr(s, needle)) != NULL) {
                p = strchr(s, ' ');
                if (p)
                        memmove(s, p + 1, strlen(p));
                else
                        *s = '\0';
        }
        return hay;
}
char teststring[] = "debug some debug and not only debug=debug but also debug";
int
main()
{
        puts(teststring);
        puts(cutout(teststring, "debug"));
        return 0;
}