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

📄 fig7.9

📁 unix环境高级编程第二版配套源代码 unix环境高级编程第二版配套源代码
💻 9
字号:
#include "apue.h"#define	TOK_ADD	   5void	do_line(char *);void	cmd_add(void);int		get_token(void);intmain(void){	char	line[MAXLINE];	while (fgets(line, MAXLINE, stdin) != NULL)		do_line(line);	exit(0);}char	*tok_ptr;		/* global pointer for get_token() */voiddo_line(char *ptr)		/* process one line of input */{	int		cmd;	tok_ptr = ptr;	while ((cmd = get_token()) > 0) {		switch (cmd) {	/* one case for each command */		case TOK_ADD:				cmd_add();				break;		}	}}voidcmd_add(void){	int		token;	token = get_token();	/* rest of processing for this command */}intget_token(void){	/* fetch next token from line pointed to by tok_ptr */}

⌨️ 快捷键说明

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