[BTRFS-PROG][PATCH 1/7] Correct xstrip() function

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi all,

this is the first of 7 patches, which improve the man page of the btrfs 
command.
I added some basic text fro the man page for the "filesystem restriper *" and 
the "quota/qgroup *" commands. I put in CC the writer hoping that they will 
care to maintain aligned the documentation with the code.

These patches are base on the latest "Hugo Mills" integration branch.

This patch correct a bug in the xstrip() function, which prevented to erase the
 unneeded spaces.

Comments are welcome.

BR
G.Baroncelli

Signed-off-by: Goffredo Baroncelli <kreijack@xxxxxxxxx>

---
 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];

-- 
gpg key@ keyserver.linux.it: Goffredo Baroncelli (ghigo) <kreijack@xxxxxxxxx>
Key fingerprint = 4769 7E51 5293 D36C 814E  C054 BF04 F161 3DC5 0512
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];

Attachment: signature.asc
Description: This is a digitally signed message part.


[Index of Archives]     [Linux Filesystem Development]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux