Package: bsd-mailx / 8.1.2-0.20141216cvs-2

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
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
for '-s' and '-a' options (closes: #419840).
---
 main.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/main.c b/main.c
index 434ea6d..31fd560 100644
--- a/main.c
+++ b/main.c
@@ -139,11 +139,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;
 
@@ -152,6 +157,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);