MCPcopy Create free account
hub / github.com/apache/nuttx / main

Function main

tools/nxstyle.c:1241–3611  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1239 ********************************************************************************/
1240
1241int main(int argc, char **argv, char **envp)
1242{
1243 FILE *instream; /* File input stream */
1244 char line[LINE_SIZE]; /* The current line being examined */
1245 char buffer[100]; /* Locally format error strings */
1246 char *lptr; /* Temporary pointer into line[] */
1247 char *ext; /* Temporary file extension */
1248 bool btabs; /* True: TAB characters found on the line */
1249 bool bcrs; /* True: Carriage return found on the line */
1250 bool bfunctions; /* True: In private or public functions */
1251 bool bstatm; /* True: This line is beginning of a statement */
1252 bool bfor; /* True: This line is beginning of a 'for' statement */
1253 bool bif; /* True: This line is beginning of a 'if' statement */
1254 bool bswitch; /* True: Within a switch statement */
1255 bool bcase; /* True: Within a case statement of a switch */
1256 bool bstring; /* True: Within a string */
1257 bool bquote; /* True: Backslash quoted character next */
1258 bool bblank; /* Used to verify block comment terminator */
1259 bool bexternc; /* True: Within 'extern "C"' */
1260 enum pptype_e ppline; /* > 0: The next line the continuation of a
1261 * pre-processor command */
1262 int rhcomment; /* Indentation of Comment to the right of code
1263 * (-1 -> don't check position) */
1264 int prevrhcmt; /* Indentation of previous Comment to the right
1265 * of code (-1 -> don't check position) */
1266 int lineno; /* Current line number */
1267 int indent; /* Indentation level */
1268 int ncomment; /* Comment nesting level on this line */
1269 int prevncomment; /* Comment nesting level on the previous line */
1270 int bnest; /* Brace nesting level on this line */
1271 int prevbnest; /* Brace nesting level on the previous line */
1272 int dnest; /* Data declaration nesting level on this line */
1273 int prevdnest; /* Data declaration nesting level on the previous line */
1274 int pnest; /* Parenthesis nesting level on this line */
1275 int ppifnest; /* #if nesting level on this line */
1276 int inasm; /* > 0: Within #ifdef __ASSEMBLY__ */
1277 int comment_lineno; /* Line on which the last comment was closed */
1278 int blank_lineno; /* Line number of the last blank line */
1279 int noblank_lineno; /* A blank line is not needed after this line */
1280 int lbrace_lineno; /* Line number of last left brace */
1281 int rbrace_lineno; /* Last line containing a right brace */
1282 int externc_lineno; /* Last line where 'extern "C"' declared */
1283 int linelen; /* Length of the line */
1284 int excess;
1285 int n;
1286 int i;
1287 int c;
1288
1289 excess = 0;
1290 while ((c = getopt(argc, argv, ":hv:gm:r:")) != -1)
1291 {
1292 switch (c)
1293 {
1294 case 'm':
1295 excess = atoi(optarg);
1296 if (excess < 1)
1297 {
1298 show_usage(argv[0], 1, "Bad value for <excess>.");

Callers

nothing calls this directly

Calls 15

getoptFunction · 0.85
atoiFunction · 0.85
strtokFunction · 0.85
backslash_to_slashFunction · 0.85
white_file_listFunction · 0.85
fopenFunction · 0.85
get_line_widthFunction · 0.85
rewindFunction · 0.85
strstrFunction · 0.85
strndupFunction · 0.85
white_content_listFunction · 0.85
check_section_headerFunction · 0.85

Tested by

no test coverage detected