⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 getopttest.c

📁 klibc精简化的c程序库
💻 C
字号:
/* * getopttest.c * * Simple test for getopt, set the environment variable GETOPTTEST * to give the argument string to getopt() */#include <stdlib.h>#include <unistd.h>#include <stdio.h>int main(int argc, char *const *argv){	const char *parser;	char showchar[] = "\'?\'";	int c;	parser = getenv("GETOPTTEST");	if (!parser)		parser = "abzf:o:";	do {		c = getopt(argc, argv, parser);		showchar[1] = c;		printf		    ("c = %s, optind = %d (%s), optarg = \"%s\", optopt = \'%c\'\n",		     (c == EOF) ? "EOF" : showchar, optind, argv[optind],		     optarg, optopt);	} while (c != -1);	return 0;}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -