Changeset a202ff1 in code for icb.c


Ignore:
Timestamp:
Mar 3, 2014, 1:13:50 AM (11 years ago)
Author:
Mike Belopuhov <mike@…>
Branches:
master
Children:
fa271b8
Parents:
e2fcbc7
Message:

strip trailing spaces from all fields; based on the idea by sthen

File:
1 edited

Legend:

Unmodified
Added
Removed
  • icb.c

    re2fcbc7 ra202ff1  
    562562/*
    563563 *  icb_nextfield: advances through a given buffer returning pointer to the
    564  *                 beginning of the icb field or an empty string otherwise
     564 *                 beginning of the icb field or an empty string otherwise;
     565 *                 cleans up trailing spaces
    565566 */
    566567char *
     
    568569{
    569570        char *start = *buf;
     571        char *end = NULL;
    570572
    571573        while (*buf && **buf != '\0' && **buf != ICB_M_SEP)
     
    573575        if (*buf && **buf == ICB_M_SEP) {
    574576                **buf = '\0';
     577                end = *buf;
    575578                (*buf)++;
    576         }
     579        } else
     580                end = *buf;
     581        while (end && *(--end) == ' ' && end > start)
     582                *end = '\0';
    577583        return (start);
    578584}
Note: See TracChangeset for help on using the changeset viewer.