Correct xstrip() function
PATCH 1/7 Correct xstrip() function
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
--- helpextract.c | 9 +++++---- 1 files changed, 5 insertions(+), 4 deletions(-)
helpextract.c +5 -4
@@ -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 ];
Signature · 2 lines
gpg key@ keyserver.linux.it: Goffredo Baroncelli (ghigo) <[email protected]> Key fingerprint = 4769 7E51 5293 D36C 814E C054 BF04 F161 3DC5 0512
helpextract.c +5 -4
@@ -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 ];
Quoted 7 lines · Goffredo Baroncelli
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.
Please don't do this -- it makes it harder for me to integrate,
because I throw away each integration branch before making the next one, so I have to rebase your patches back to master before I can integrate them...
Basing patches on Chris's master (or my for-chris branch, if I've
got one) is greatly preferred from my point of view.
Hugo.
Quoted 53 lines
This patch correct a bug in the
xstrip()function, which prevented to erase the
unneeded spaces.Comments are welcome.
BR
G.BaroncelliSigned-off-by Goffredo Baroncelli <[email protected]>--- helpextract.c | 9 +++++---- 1 files changed, 5 insertions(+), 4 deletions(-)helpextract.c +5
-4@@ -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 ];
Signature · 3 lines
=== Hugo Mills: hugo@... carfax.org.uk | darksatanic.net | lug.org.uk === PGP key: 515C238D from wwwkeys.eu.pgp.net or http://www.carfax.org.uk --- Startle, startle, little twink. How I wonder what you think. ---