[Pkg-wmaker-commits] [wmbiff] 25/77: duplicate perl's chomp()

Doug Torrance dtorrance-guest at moszumanska.debian.org
Thu Aug 20 03:01:07 UTC 2015


This is an automated email from the git hooks/post-receive script.

dtorrance-guest pushed a commit to tag wmbiff_0_4_0
in repository wmbiff.

commit 699ba97a3467b48e84817be5ad83cec845273ed2
Author: bluehal <bluehal>
Date:   Mon Apr 15 01:26:21 2002 +0000

    duplicate perl's chomp()
---
 wmbiff/charutil.c | 10 +++++++++-
 wmbiff/charutil.h |  5 ++++-
 2 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/wmbiff/charutil.c b/wmbiff/charutil.c
index be4c031..64fe72a 100644
--- a/wmbiff/charutil.c
+++ b/wmbiff/charutil.c
@@ -1,4 +1,4 @@
-/* $Id: charutil.c,v 1.7 2002/01/12 05:30:09 bluehal Exp $ */
+/* $Id: charutil.c,v 1.8 2002/04/15 01:26:21 bluehal Exp $ */
 #include <stdlib.h>
 #include <stdio.h>
 #include <string.h>
@@ -219,3 +219,11 @@ int compile_and_match_regex(const char *regex, const char *str,	/*@out@ */
 
 	return matchedchars;
 }
+
+/* like perl chomp(); useful for dealing with input from popen */
+void chomp(char *s)
+{
+	int l = strlen(s) - 1;
+	if (l > 0 && s[l] == '\n')
+		s[l] = '\0';
+}
diff --git a/wmbiff/charutil.h b/wmbiff/charutil.h
index 161ff87..014047e 100644
--- a/wmbiff/charutil.h
+++ b/wmbiff/charutil.h
@@ -1,4 +1,4 @@
-/* $Id: charutil.h,v 1.6 2002/04/07 05:08:23 bluehal Exp $ */
+/* $Id: charutil.h,v 1.7 2002/04/15 01:26:21 bluehal Exp $ */
 /* Author: Mark Hurley  (debian4tux at telocity.com)
  *
  * Character / string manipulation utilities. 
@@ -37,4 +37,7 @@ void grab_authList(const char *source, char *destination);
 /* handles main regex work */
 int compile_and_match_regex(const char *regex, const char *str,
 							/*@out@ */ struct re_registers *regs);
+
+/* acts like perl's function of the same name */
+void chomp(char *s);
 #endif

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-wmaker/wmbiff.git



More information about the Pkg-wmaker-commits mailing list