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

📄 unix.mx

📁 一个内存数据库的源代码这是服务器端还有客户端
💻 MX
字号:
@' The contents of this file are subject to the MonetDB Public License@' Version 1.1 (the "License"); you may not use this file except in@' compliance with the License. You may obtain a copy of the License at@' http://monetdb.cwi.nl/Legal/MonetDBLicense-1.1.html@'@' Software distributed under the License is distributed on an "AS IS"@' basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the@' License for the specific language governing rights and limitations@' under the License.@'@' The Original Code is the MonetDB Database System.@'@' The Initial Developer of the Original Code is CWI.@' Portions created by CWI are Copyright (C) 1997-2007 CWI.@' All Rights Reserved.@f unix@a Tim Ruhl, Martin Kersten, A.R. van Ballegooij@v 0.2@+ Unix standard library callsThe unix module is currently of rather limited size.It should include only those facilities that are UNIXspecific, i.e. not portable to other platforms.Similar modules may be defined for Windows platforms.@{@malmodule unix;command getenv(nme:str) :str address UNIXgetenvcomment "Get the environment variable string.";command setenv(nme:str,val:str) :bit address UNIXsetenvcomment "Set the environment variable string.";@- ImplementationThe remainder is a straight forward mapping to the underlyingfacilities@c#include "mal_config.h"#include "mal.h"#include "mal_exception.h"#include <stdio.h>#include <stdlib.h>#include <stdarg.h>/*---------------------------------------------------------------------------- * The Basic UNIX commands. */intunix_getenv(str *res, str varname){	char *p = getenv(varname);	if (p)		*res = GDKstrdup(p);	else		*res = GDKstrdup("");	return GDK_SUCCEED;}intunix_setenv(bit *res, str varname, str valname){#ifdef HAVE_PUTENV		/* prefer POSIX putenv */	/* leaks memory when varname value reused */	size_t len = strlen(varname) + strlen(valname) + 2;	char *envval = GDKmalloc(len);	strcpy(envval, varname);	strcat(envval, "=");	strcat(envval, valname);	*res = putenv(envval);	/* don't free envval! */#else#ifdef HAVE_SETENV	*res = setenv(varname, valname, TRUE);#else	*res = -1;#endif#endif	return GDK_SUCCEED;}/*Local Variables:c-basic-offset: 4End:*/@- WrappingThe remainder simply wraps the old code.@c#include "mal.h"#ifdef WIN32#ifndef LIBUNIX#define unix_export extern __declspec(dllimport)#else#define unix_export extern __declspec(dllexport)#endif#else#define unix_export extern#endifunix_export str UNIXgetenv(str *res, str *varname);strUNIXgetenv(str *res, str *varname){	unix_getenv(res, *varname);	return MAL_SUCCEED;}unix_export str UNIXsetenv(bit *res, str *name, str *value);strUNIXsetenv(bit *res, str *name, str *value){	unix_setenv(res, *name, *value);	return MAL_SUCCEED;}@}

⌨️ 快捷键说明

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