114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
|
}
zText++;
}
return lineCnt;
}
/*
** Test the comment printing
**
** COMMAND: test-comment-format
*/
void test_comment_format(void){
const char *zPrefix;
const char *zText;
int indent, width;
if( g.argc!=4 && g.argc!=5 ){
usage("PREFIX TEXT ?WIDTH?");
}
zPrefix = g.argv[2];
zText = g.argv[3];
indent = strlen(zPrefix);
if( g.argc==5 ){
width = atoi(g.argv[4]);
}else{
width = -1; /* automatic */
}
if( indent>0 ){
fossil_print("%s", zPrefix);
}
fossil_print("(%d lines output)\n", comment_print(zText, indent, width));
}
|
<
>
>
>
>
>
>
>
>
|
>
>
>
>
>
|
>
>
|
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
|
}
zText++;
}
return lineCnt;
}
/*
**
** COMMAND: test-comment-format
**
** Usage: %fossil test-comment-format ?OPTIONS? PREFIX TEXT ?WIDTH?
**
** Test comment formatting and printing. Use for testing only.
**
** Options:
** --decode Decode the text using the same method used when
** handling the value of a C-card from a manifest.
*/
void test_comment_format(void){
const char *zPrefix;
char *zText;
int indent, width;
int decode = find_option("decode", 0, 0)!=0;
if( g.argc!=4 && g.argc!=5 ){
usage("PREFIX TEXT ?WIDTH?");
}
zPrefix = g.argv[2];
if( decode ){
zText = mprintf("%s", g.argv[3]);
defossilize(zText);
}else{
zText = g.argv[3];
}
indent = strlen(zPrefix);
if( g.argc==5 ){
width = atoi(g.argv[4]);
}else{
width = -1; /* automatic */
}
if( indent>0 ){
fossil_print("%s", zPrefix);
}
fossil_print("(%d lines output)\n", comment_print(zText, indent, width));
if( zText!=g.argv[3] ) fossil_free(zText);
}
|