btrfsprogs/0185-btrfs-progs-Correct-xstrip-function.patch

52 lines
1.1 KiB
Diff
Raw Normal View History

From e38f0663be83e68f682919ca4e2d60cf6683b643 Mon Sep 17 00:00:00 2001
From: Goffredo Baroncelli <kreijack@inwind.it>
Date: Mon, 26 Mar 2012 17:43:26 +0200
Subject: [PATCH 02/10] btrfs-progs: Correct xstrip() function
Signed-off-by: Goffredo Baroncelli <kreijack@inwind.it>
---
helpextract.c | 9 +++++----
1 files changed, 5 insertions(+), 4 deletions(-)
diff --git a/helpextract.c b/helpextract.c
index 9489ea0..a729074 100644
--- a/helpextract.c
+++ b/helpextract.c
@@ -38,20 +38,21 @@ static char *xstrip(char *s){
char *last=NULL;
char *first;
+ char prev;
while(*s && isspace(*s) ) s++;
first=s;
-
+ prev=*s;
while(*s){
- if(isspace(*s)) last=s;
+ if(!isspace(prev) && isspace(*s)) last=s;
+ prev=*s;
s++;
}
if(last) *last=0;
return first;
-
}
static void addtuple(char *key, char *cmdline, char *short_help,
@@ -184,7 +185,7 @@ static int search_in_file(char *nf){
return 0;
}
-/* remove all the escape sequence excepet \\ */
+/* remove all the escape sequence except \\ */
static char * my_escape(char *src, char *filters[] ){
static char buffer[LINEBUF*5];
--
1.7.6.233.gd79bc