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

📄 userlookup_services.c

📁 this gives details of the network programming
💻 C
字号:
/* * This is sample code generated by rpcgen. * These are only templates and you can use them * as a guideline for developing your own functions. */#include <pwd.h>		/* needed for pw lookup functions */#include <sys/types.h>          /* needed for pw database types */#include "userlookup.h"int * byname_1_svc(username *argp, struct svc_req *rqstp){	static int  result;	struct passwd *pw;	/* argp is a pointer to: a string (a char *)! */	pw = getpwnam( *argp );	if (pw==NULL) {	  /* ERROR ! NO USER FOUND */	  result = -1;	} else {	  result = pw->pw_uid;	}	return(&result);}char *error="ERROR";username * bynum_1_svc(int *argp, struct svc_req *rqstp){	static username  result;	struct passwd *pw;	/* username is a pointer to: a string (a char *)! */	pw = getpwuid( *argp );	if (pw==NULL) {	  /* ERROR ! NO USER FOUND */	  /* WE CANNOT RETURN A NULL (will screw up xdr filter) */	  /* Point to an error string */	  result=error;	} else {	  result = pw->pw_name;	}	return(&result);}

⌨️ 快捷键说明

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