OSDN Git Service

man2html: Fix a bug that a table which has a format specification with a '.' only...
authorR4000 2.2 <tati@kc5.so-net.ne.jp>
Thu, 20 Oct 2011 13:10:02 +0000 (22:10 +0900)
committerAkihiro MOTOKI <amotoki@gmail.com>
Thu, 20 Oct 2011 13:13:54 +0000 (22:13 +0900)
Signed-off-by: Akihiro MOTOKI <amotoki@gmail.com>
admin/man-1.6g/man2html/man2html.c

index 6b1b3c6..d55831d 100644 (file)
@@ -717,6 +717,7 @@ static void clear_table(TABLEROW *table)
 }
 
 char *scan_expression(char *c, int *result);
+char itemsep='\t';
 
 static char *scan_format(char *c, TABLEROW **result, int *maxcol)
 {
@@ -790,13 +791,18 @@ static char *scan_format(char *c, TABLEROW **result, int *maxcol)
            curfield->space=i;
            break;
        case ',': case '\n':
-           currow->next=(TABLEROW*)xmalloc(sizeof(TABLEROW));
-           currow->next->prev=currow;
-           currow=currow->next;
-           currow->next=NULL;
-           curfield=currow->first=(TABLEITEM*)xmalloc(sizeof(TABLEITEM));
-           *curfield=emptyfield;
            c++;
+           while (*c==',' || *c=='\n' || *c=='\t' || *c==itemsep) {
+               c++;
+           }
+           if ( *c != '.' ) {
+               currow->next=(TABLEROW*)xmalloc(sizeof(TABLEROW));
+               currow->next->prev=currow;
+               currow=currow->next;
+               currow->next=NULL;
+               curfield=currow->first=(TABLEITEM*)xmalloc(sizeof(TABLEITEM));
+               *curfield=emptyfield;
+           }
            break;
        default:
            c++;
@@ -872,7 +878,6 @@ scan_table(char *c) {
     int center=0, expand=0, box=0, border=0, linesize=1;
     int i,j,maxcol=0, finished=0;
     int oldfont, oldsize,oldfillout;
-    char itemsep='\t';
     TABLEROW *layout=NULL, *currow;
     TABLEITEM *curfield;
     while (*c++!='\n');                /* skip TS */