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

📄 helpers.c

📁 这个是内存数据库中的一个管理工具
💻 C
字号:
/* * 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. */#include "monetdb_config.h"#include "helpers.h"#include <ctype.h>#include <stdlib.h>#include <string.h>#ifndef DIR_SEP# define DIR_SEP '/'#endifvoidErrXit(char *text1, char *text2, int num){	fprintf(stderr, "ERROR: %s%s\n", text1, text2);	exit(num);}/* ErrXit */FILE *Rfopen(char *name){	FILE *fp;	if (!strcmp(name, "-"))		fp = stdin;	else if (!(fp = fopen(name, "r")))		ErrXit("could not read file ", name, 1);	return fp;}/* Rfopen */FILE *Wfopen(char *name){	FILE *fp;	if (!strcmp(name, "-"))		fp = stdout;	else if (!(fp = fopen(name, "w")))		ErrXit("could not write file ", name, 1);	return fp;}/* Wfopen */FILE *Afopen(char *name){	FILE *fp;	if (!strcmp(name, "-"))		fp = stdout;	else if (!(fp = fopen(name, "a")))		ErrXit("could not append file ", name, 1);	return fp;}/* Afopen */char *strconcat(char *a, char *b){	char *s = (char *) malloc(strlen(a) + strlen(b) + 1);	sprintf(s, "%s%s", a, b);	return s;}/* strconcat */intisalpha_(int c){	return (isalpha(c) || (c == '_'));}char *filename(char *path){	char *fn = strrchr(path, (int) DIR_SEP);	if (fn)		return (fn + 1);	else		return path;}#if DIR_SEP == '/'char *default_tmpdir = "/tmp";#define TMPDIR_ENV "TMPDIR"#elsechar *default_tmpdir = "C:\\Temp";#define TMPDIR_ENV "TEMP"#endifchar *tmpdir(void){	char *rtrn = getenv(TMPDIR_ENV);	if (!rtrn)		rtrn = default_tmpdir;	return rtrn;}

⌨️ 快捷键说明

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