📄 userlookup_client.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 <stdio.h>#include "userlookup.h"intl_byname( char* host, char *name ) { CLIENT *clnt; int *uid; clnt = clnt_create(host, ULKUP_PROG, ULKUP_VERSION, "udp"); if (clnt == NULL) { clnt_pcreateerror(host); exit(1); } uid = byname_1(&name, clnt); if (uid == NULL) { clnt_perror(clnt, "call failed:"); } clnt_destroy( clnt ); return(*uid);}char *l_bynum( char* host, int uid ){ CLIENT *clnt; username *name; clnt = clnt_create(host, ULKUP_PROG, ULKUP_VERSION, "udp"); if (clnt == NULL) { clnt_pcreateerror(host); exit(1); } name = bynum_1(&uid, clnt); if (name == NULL) { clnt_perror(clnt, "call failed:"); } clnt_destroy( clnt ); return(*name); }int main( int argc, char* argv[] ) { char *host; char *name; int uid; if(argc < 3) { printf("usage: %s server_host name_or_uid\n", argv[0]); exit(1); } host = argv[1]; name = argv[2]; if ((name[0]>='0')&&(name[0]<='9')) { uid = atoi(name); printf("UID %d, Name is %s\n",uid,l_bynum(host,uid)); } else { printf("Name %s, UID is %d\n",name,l_byname(host,name)); } return(0);}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -