本文主要是介绍学习使用的PL/0编译器增强版PL/0plusplusCompiler(三)加入“man” 功能,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
Linux中很赞的工具man,查看命令或者工具的帮助手册manual。
在PL0.h中声明help方法,
void help();
在PL0.c中实现help这个方法,
/*显示帮助文档*/
void help(){printf("\n\nPL0 plus plus Compiler:\n");printf("编译源码: pl0 test.pl0\n");printf("显示帮助文档: pl0 help\n");printf("使用debug模式编译: pl0 test.pl0 d \n\n\n");}
在PL0.c中main入口处检测命令行参数help
/*如果命令行参数是"help"那么显示帮助文档*/if(strcmp("help",argv[1])==0){help();return 0;}
用命令编译PL0.c
gcc PL0.c -o pl0
运行
./pl0 help
效果图:
这篇关于学习使用的PL/0编译器增强版PL/0plusplusCompiler(三)加入“man” 功能的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!