| 1062 | ********************************************************************************/ |
| 1063 | |
| 1064 | static int get_line_width(FILE *instream) |
| 1065 | { |
| 1066 | char line[LINE_SIZE]; /* The current line being examined */ |
| 1067 | int max = 0; |
| 1068 | int min = INT_MAX; |
| 1069 | int lineno = 0; |
| 1070 | int lineno_max = 0; |
| 1071 | int lineno_min = 0; |
| 1072 | int len; |
| 1073 | |
| 1074 | while (fgets(line, LINE_SIZE, instream)) |
| 1075 | { |
| 1076 | lineno++; |
| 1077 | len = block_comment_width(line); |
| 1078 | if (len > 0) |
| 1079 | { |
| 1080 | if (len > max) |
| 1081 | { |
| 1082 | max = len; |
| 1083 | lineno_max = lineno; |
| 1084 | } |
| 1085 | |
| 1086 | if (len < min) |
| 1087 | { |
| 1088 | min = len; |
| 1089 | lineno_min = lineno; |
| 1090 | } |
| 1091 | } |
| 1092 | } |
| 1093 | |
| 1094 | if (max < min) |
| 1095 | { |
| 1096 | ERRORFL("No block comments found", g_file_name); |
| 1097 | return DEFAULT_WIDTH; |
| 1098 | } |
| 1099 | else if (max != min) |
| 1100 | { |
| 1101 | ERROR("Block comments have different lengths", lineno_max, max); |
| 1102 | ERROR("Block comments have different lengths", lineno_min, min); |
| 1103 | return DEFAULT_WIDTH; |
| 1104 | } |
| 1105 | |
| 1106 | return min; |
| 1107 | } |
| 1108 | |
| 1109 | /******************************************************************************** |
| 1110 | * Name: check_section_header |
no test coverage detected