📄 main.c
字号:
/*============================================================================FILE main.cMEMBER OF process cmppCopyright 1991Georgia Tech Research CorporationAtlanta, Georgia 30332All Rights ReservedPROJECT A-8503AUTHORS 9/12/91 Bill KuhnMODIFICATIONS <date> <person name> <nature of modifications>SUMMARY This file contains the top-level function for the Code Model PreProcessor (cmpp). It handles reading the command-line arguments, and then vectors to an appropriate function.INTERFACES main()REFERENCED FILES None.NON-STANDARD FEATURES None.============================================================================*/#include <stdio.h>#include <stdlib.h>#include <string.h>#include "cmpp.h"#define USAGE_MSG "Usage: cmpp [-ifs] [-mod [<filename>]] [-lst]"#define TOO_FEW_ARGS "ERROR - Too few arguments"#define TOO_MANY_ARGS "ERROR - Too many arguments"#define UNRECOGNIZED_ARGS "ERROR - Unrecognized argument"/* *********************************************************************** */extern void init_error (char *program_name);/*mainFunction main checks the validity of the command-line argumentssupplied when the program is invoked and calls one of the threemajor functions as appropriate: preprocess_ifs_file Process Interface Specification File. preprocess_mod_file Process Model Definition File. preprocess_lst_file Process Pathname List Files. depending on the argument.*/int main( int argc, /* Number of command line arguments */ char *argv[]) /* Command line argument text */{ init_error (argv[0]); /* Process command line arguments and vector to appropriate function */ if(argc < 2) { print_error(TOO_FEW_ARGS); print_error(USAGE_MSG); exit(1); } if(strcmp(argv[1],"-ifs") == 0) { if(argc == 2) { preprocess_ifs_file(); } else { print_error(TOO_MANY_ARGS); print_error(USAGE_MSG); exit(1); } } else if(strcmp(argv[1],"-lst") == 0) { if(argc == 2) { preprocess_lst_files(); } else { print_error(TOO_MANY_ARGS); print_error(USAGE_MSG); exit(1); } } else if(strcmp(argv[1],"-mod") == 0) { if(argc == 2) { preprocess_mod_file("cfunc.mod"); } else if(argc == 3) { preprocess_mod_file(argv[2]); } else { print_error(TOO_MANY_ARGS); print_error(USAGE_MSG); exit(1); } } else { print_error(UNRECOGNIZED_ARGS); print_error(USAGE_MSG); exit(1); } exit(0);}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -