gethostname.c

来自「关系型数据库 Postgresql 6.5.2」· C语言 代码 · 共 25 行

C
25
字号
/* $Id: gethostname.c,v 1.4 1998/09/01 03:24:25 momjian Exp $ */#include <sys/types.h>#include <string.h>#include <sys/utsname.h>#include "config.h"intgethostname(char *name, int namelen){	static struct utsname mname;	static int	called = 0;	if (!called)	{		called++;		uname(&mname);	}	strncpy(name, mname.nodename, (SYS_NMLN < namelen ? SYS_NMLN : namelen));	return 0;}

⌨️ 快捷键说明

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