Skip to content
Snippets Groups Projects
Forked from Debian Installer / netcfg
Source project has a limited visibility.
  • Hendrik Brueckner's avatar
    common/ipaddr: remove leading and trailing whitespaces · f4dfa408
    Hendrik Brueckner authored and Dimitri Ledkov's avatar Dimitri Ledkov committed
    
    Leading or trailing whitespaces are not removed from the IP address,
    for example, when specified by the user.  If the IP address contains
    whitespaces, parsing the address fails and a malformed address is
    reported even if the IP address would be valid.
    
    To remove trailing whitespaces, extend the rtrim() function to remove
    multiple spaces.  Introduce a new function, strtrim() to remove any
    leading spaces.
    
    Also add a test case to verify the changed behavior.
    
    Signed-off-by: default avatarHendrik Brueckner <brueckner@linux.vnet.ibm.com>
    f4dfa408