Package: bsd-mailx / 8.1.2-0.20111106cvs-1+deb7u1

22-Replace-newlines-with-spaces.patch Patch series | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
From: Robert Luberda <robert@debian.org>
Date: Thu, 3 May 2007 12:30:00 +0200
Subject: 22 Replace newlines with spaces.

main.c: Replace with spaces any embeded newline passed in arguments i
for '-s' and '-a' options (closes: #419840).
---
 main.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/main.c b/main.c
index 82e709f..0b73fdb 100644
--- a/main.c
+++ b/main.c
@@ -149,11 +149,16 @@ main(int argc, char **argv)
 		case 'd':
 			debug++;
 			break;
+#define REMOVE_NEWLINES(arg) { 	char *t; 					\
+				for (t = (arg); *t; t++)			\
+					if (*t == '\n' || *t == '\r') *t = ' '; \
+			     }
 		case 's':
 			/*
 			 * Give a subject field for sending from
 			 * non terminal
 			 */
+			REMOVE_NEWLINES(optarg);
 			subject = optarg;
 			break;
 
@@ -162,6 +167,7 @@ main(int argc, char **argv)
 			 * Give additional header fields for sending from
 			 * non terminal
 			 */
+			REMOVE_NEWLINES(optarg);
 			if (header == NULL) {
 				if ((header = (char *)malloc(strlen(optarg)+1)) != NULL)
 					strcpy(header, optarg);
--