From: Frédéric Marchal Date: Mon, 29 Mar 2010 13:51:03 +0000 (+0000) Subject: Accept spaces in the replacement label of the usertab file X-Git-Tag: v2.3-pre2~38 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c4f21132e1c16f262bdbcf71c2a5493de0205b3c;p=thirdparty%2Fsarg.git Accept spaces in the replacement label of the usertab file --- diff --git a/usertab.c b/usertab.c index 51e1c4f..0adf064 100644 --- a/usertab.c +++ b/usertab.c @@ -58,8 +58,7 @@ static void init_file_usertab(const char *UserTabFile) FILE *fp_usr; long int nreg; char buf[MAXLEN]; - int z2; - int z1; + int z1, z2; if((fp_usr=fopen(UserTabFile,"r"))==NULL) { debuga(_("(usertab) Cannot open file %s - %s\n"),UserTabFile,strerror(errno)); @@ -92,13 +91,14 @@ static void init_file_usertab(const char *UserTabFile) } while(buf[z1] && (unsigned char)buf[z1]<=' ') z1++; userfile[z2++]='\n'; - while(buf[z1] && (unsigned char)buf[z1]>' ') { + while(buf[z1] && (unsigned char)buf[z1]>=' ') { if (z2+2>=nreg) { //need at least 2 additional bytes for "\t\0" debuga(_("The list of the users is too long in your %s file.\n"),UserTabFile); exit(EXIT_FAILURE); } userfile[z2++]=buf[z1++]; } + while(userfile[z2-1]==' ') z2--; userfile[z2++]='\t'; } userfile[z2]='\0';