]> git.ipfire.org Git - thirdparty/sarg.git/commitdiff
Accept spaces in the replacement label of the usertab file
authorFrédéric Marchal <fmarchal@users.sourceforge.net>
Mon, 29 Mar 2010 13:51:03 +0000 (13:51 +0000)
committerFrédéric Marchal <fmarchal@users.sourceforge.net>
Mon, 29 Mar 2010 13:51:03 +0000 (13:51 +0000)
usertab.c

index 51e1c4f619a6d8e121f448be9bfa5ba03ae60593..0adf064a9dd455bb37f539a35e7ddde89b6c43a7 100644 (file)
--- 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';