projects
/
darcs-mirror-screen-message.debian.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
c299e53
)
Ignore trailing newline from standard in
author
Joachim Breitner
<mail@joachim-breitner.de>
Tue, 12 Aug 2008 04:32:23 +0000
(
04:32
+0000)
committer
Joachim Breitner
<mail@joachim-breitner.de>
Tue, 12 Aug 2008 04:32:23 +0000
(
04:32
+0000)
Thanks to Chris Lamb <chris@chris-lamb.co.uk> for the patch.
sm.c
patch
|
blob
|
history
diff --git
a/sm.c
b/sm.c
index
e85cf8b
..
0667965
100644
(file)
--- a/
sm.c
+++ b/
sm.c
@@
-281,6
+281,11
@@
int main(int argc, char **argv) {
while ((num = fread (buf, 1, sizeof(buf), stdin)) > 0) {
g_string_append_len(input, buf, num);
}
+
+ // remove trailing newline, if any
+ if ((input->len > 0) && (input->str[input->len - 1] == '\n')) {
+ g_string_truncate(input, input->len - 1);
+ }
} else {
int i;