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

📄 rdict_srp.c

📁 &#61599 Douglas Comer
💻 C
字号:
/* rdict_srp.c - initw, insertw, deletew, lookupw */#include <rpc/rpc.h>#include <string.h>#include "rdict.h"/* Server-side remote procedures and the global data they use */char	dict[DICTSIZ][MAXWORD+1];/* storage for a dictionary of words	*/int	nwords = 0;		/* number of words in the dictionary	*//*------------------------------------------------------------------------ * initw - initialize the dictionary to contain no words at all *------------------------------------------------------------------------ */intinitw(){	nwords = 0;	return 1;}/*------------------------------------------------------------------------ * insertw - insert  a word in the dictionary *------------------------------------------------------------------------ */intinsertw(char *word){	strcpy(dict[nwords], word);	nwords++;	return nwords;}/*------------------------------------------------------------------------ * deletew - delete  a word from the dictionary *------------------------------------------------------------------------ */intdeletew(char *word){	int	i;	for (i=0 ; i<nwords ; i++)		if (strcmp(word, dict[i]) == 0) {			nwords--;			strcpy(dict[i], dict[nwords]);			return 1;		}	return 0;}/*------------------------------------------------------------------------ * lookupw - look up a word in the dictionary *------------------------------------------------------------------------ */intlookupw(char *word){	int	i;	for (i=0 ; i<nwords ; i++)		if (strcmp(word, dict[i]) == 0)			return 1;	return 0;}

⌨️ 快捷键说明

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