diff options
author | Antti-Juhani Kaijanaho <ajk@debian.org> | 2006-01-28 21:41:43 +0100 |
---|---|---|
committer | Antti-Juhani Kaijanaho <ajk@debian.org> | 2006-01-28 21:41:43 +0100 |
commit | 407de8aa062422f1bbb8e1ecc079f6522a5a00cb (patch) | |
tree | 330dca18e24839ce5377466eee74ae6a826ef1f0 /strutil.c | |
parent | d697bf1ada7b8f9af73192b7f4f536bb34e665f0 (diff) | |
download | dctrl-tools-407de8aa062422f1bbb8e1ecc079f6522a5a00cb.tar.gz |
Import 2.1.3
Diffstat (limited to 'strutil.c')
-rw-r--r-- | strutil.c | 13 |
1 files changed, 11 insertions, 2 deletions
@@ -1,5 +1,5 @@ /* dctrl-tools - Debian control file inspection tools - Copyright (C) 1999, 2003 Antti-Juhani Kaijanaho + Copyright (C) 1999, 2003, 2004 Antti-Juhani Kaijanaho This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -17,6 +17,7 @@ */ #include <ctype.h> +#include <string.h> #include "strutil.h" const char * left_trimmed(const char * s) @@ -28,7 +29,15 @@ const char * left_trimmed(const char * s) return p; } -void trim_right (char * s) +void chomp(char * s) +{ + size_t sl = strlen(s); + if (sl == 0) return; + if (s[sl-1] != '\n') return; + s[sl-1] = '\0'; +} + +void trim_right (char * s) { char * p; char * herep; |