Mercurial > ~mikael > mcabber > hg
comparison mcabber/mcabber/utils.c @ 2133:69d00a118c0c
Fix ANSI C-incompatible change
author | Mikael Berthe <mikael@lilotux.net> |
---|---|
date | Tue, 24 Jun 2014 20:58:46 +0200 |
parents | 3b26f3a58cb9 |
children | fc7a758ebbde |
comparison
equal
deleted
inserted
replaced
2132:a09cdfceae17 | 2133:69d00a118c0c |
---|---|
579 // Ex.: ["a b"] -> [a b]; [a\"b] -> [a"b] | 579 // Ex.: ["a b"] -> [a b]; [a\"b] -> [a"b] |
580 void strip_arg_special_chars(char *s) | 580 void strip_arg_special_chars(char *s) |
581 { | 581 { |
582 int instring = FALSE; | 582 int instring = FALSE; |
583 int escape = FALSE; | 583 int escape = FALSE; |
584 char *p; | 584 char *p, *t; |
585 | 585 |
586 if (!s) return; | 586 if (!s) return; |
587 | 587 |
588 for (p = s; *p; p++) { | 588 for (p = s; *p; p++) { |
589 if (*p == '"') { | 589 if (*p == '"') { |
590 if (!escape) { | 590 if (!escape) { |
591 instring = !instring; | 591 instring = !instring; |
592 //memmove(p, p+1, strlen(p)); | 592 //memmove(p, p+1, strlen(p)); |
593 for (char *t=p; *t; t++) | 593 for (t=p; *t; t++) |
594 *t = *(t+1); | 594 *t = *(t+1); |
595 p--; | 595 p--; |
596 } else | 596 } else |
597 escape = FALSE; | 597 escape = FALSE; |
598 } else if (*p == '\\') { | 598 } else if (*p == '\\') { |
599 if (!escape) { | 599 if (!escape) { |
600 //memmove(p, p+1, strlen(p)); | 600 //memmove(p, p+1, strlen(p)); |
601 for (char *t=p; *t; t++) | 601 for (t=p; *t; t++) |
602 *t = *(t+1); | 602 *t = *(t+1); |
603 p--; | 603 p--; |
604 } | 604 } |
605 escape = !escape; | 605 escape = !escape; |
606 } else | 606 } else |