git: 9front

Download patch

ref: bdf520d281cec4923aac1c00b00d5dc3e9ef11c2
parent: 4b0c17c8e2f8b4fb4bc4ec33f71e5cf761aef407
author: cinap_lenrek <cinap_lenrek@felloff.net>
date: Fri May 13 07:13:26 EDT 2016

upas/marshal: strip trailing whitespace from header values

when using rio auto-complete to resolve file names for the "attach:" and
"include:" headers, the auto-completer might leave whitespaces at
the end of the line which leads upas/marshal to not find the file.

--- a/sys/src/cmd/upas/marshal/marshal.c
+++ b/sys/src/cmd/upas/marshal/marshal.c
@@ -1847,9 +1847,14 @@
 char*
 hdrval(char *p)
 {
+	char *e;
+
 	p = strchr(p, ':') + 1;
 	while(*p == ' ' || *p == '\t')
 		p++;
+	e = strchr(p, 0) - 1;
+	while(e >= p && (*e == ' ' || *e == '\t'))
+		*e-- = 0;
 	return p;
 }
 
--