42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
|
** the left margin and that a single line can contain no more than
** lineLength characters. Indent all subsequent lines by indent.
**
** Return the number of newlines that are output.
*/
int comment_print(const char *zText, int indent, int lineLength){
int tlen = lineLength - indent;
int len = 0;
int doIndent = 0;
const char *zBuf;
int lineCnt = 0;
#if defined(_WIN32)
if( lineLength<0 ){
CONSOLE_SCREEN_BUFFER_INFO csbi;
memset(&csbi, 0, sizeof(CONSOLE_SCREEN_BUFFER_INFO));
if( GetConsoleScreenBufferInfo(GetStdHandle(STD_OUTPUT_HANDLE), &csbi) ){
tlen = csbi.srWindow.Right - csbi.srWindow.Left - indent;
|
|
<
<
|
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
|
** the left margin and that a single line can contain no more than
** lineLength characters. Indent all subsequent lines by indent.
**
** Return the number of newlines that are output.
*/
int comment_print(const char *zText, int indent, int lineLength){
int tlen = lineLength - indent;
int len = 0, doIndent = 0, lineCnt = 0;
const char *zBuf;
#if defined(_WIN32)
if( lineLength<0 ){
CONSOLE_SCREEN_BUFFER_INFO csbi;
memset(&csbi, 0, sizeof(CONSOLE_SCREEN_BUFFER_INFO));
if( GetConsoleScreenBufferInfo(GetStdHandle(STD_OUTPUT_HANDLE), &csbi) ){
tlen = csbi.srWindow.Right - csbi.srWindow.Left - indent;
|
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
|
#endif
if( zText==0 ) zText = "(NULL)";
if( tlen<=0 ){
tlen = strlen(zText);
}
while( fossil_isspace(zText[0]) ){ zText++; }
if( zText[0]==0 ){
if( doIndent==0 ){
fossil_print("\n");
lineCnt = 1;
}
return lineCnt;
}
zBuf = zText;
for(;;){
if( zText[0]==0 ){
if( doIndent ){
|
|
|
|
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
|
#endif
if( zText==0 ) zText = "(NULL)";
if( tlen<=0 ){
tlen = strlen(zText);
}
while( fossil_isspace(zText[0]) ){ zText++; }
if( zText[0]==0 ){
if( !doIndent ){
fossil_print("\n");
lineCnt++;
}
return lineCnt;
}
zBuf = zText;
for(;;){
if( zText[0]==0 ){
if( doIndent ){
|