URI:
       strip trailing, leading and repeated whitespace - tscrape - twitter scraper
  HTML git clone git://git.codemadness.org/tscrape
   DIR Log
   DIR Files
   DIR Refs
   DIR README
   DIR LICENSE
       ---
   DIR commit 6cf84bf60592da634069878ba2953f11398a96fc
   DIR parent 50af4c451907a854adf9ae313e534ab56c5d442c
  HTML Author: Hiltjo Posthuma <hiltjo@codemadness.org>
       Date:   Sat, 23 Apr 2016 13:14:35 +0200
       
       strip trailing, leading and repeated whitespace
       
       Diffstat:
         M tscrape.c                           |      11 +++++++++--
       
       1 file changed, 9 insertions(+), 2 deletions(-)
       ---
   DIR diff --git a/tscrape.c b/tscrape.c
       @@ -48,9 +48,16 @@ static void
        printescape(const char *s)
        {
                size_t i;
       +        char *e;
       +
       +        /* strip leading and trailing white-space */
       +        for (; *s && isspace(*s); s++)
       +                ;
       +        for (e = s + strlen(s); e > s && isspace(*(e - 1)); e--)
       +                ;
        
       -        for (i = 0; *s; s++) {
       -                if (iscntrl(*s)) {
       +        for (i = 0; *s && s < e; s++) {
       +                if (iscntrl(*s) || isspace(*s)) {
                                i++;
                                continue;
                        }