|
samba unix风格的配置文件配置信息读取C代码.(4) * both names and values. * * Only the first equals sign in a parameter line is significant. * Parameter values may contain equals signs, square brackets and * semicolons. Internal whitespace is retained in parameter values, * with the exception of the '\r' character, which is stripped for * historic reasons. Parameter names may not start with a left square * bracket, an equal sign, a pound sign, or a semicolon, because these * are used to identify other tokens. * * -------------------------------------------------------------------------- ** */ #include "stdafx.h" #include <stdio.h> #include <stdlib.h> #include <fcntl.h> #include <string.h> #include <ctype.h> #include <sys/stat.h> #include <sys/types.h>
#ifdef WIN32 #include <io.h> #define open _open #define read _read #define close _close #endif #ifndef WIN32 #include <unistd.h> #endif /* -------------------------------------------------------------------------- ** * Define & Constants... */ #define BUFR_INC 1024 #define False (0) #define True (1) #define Auto (2) #ifndef _BOOL typedef int BOOL; #define _BOOL /* So we don't typedef BOOL again in vfs.h */ #endif /* free memory if the pointer is valid and zero the pointer */ #ifndef SAFE_FREE #define SAFE_FREE(x) do { if ((x) != NULL) {free((x)); (x)=NULL;} } while(0) #endif /* Global val set if multibyte codepage. */ extern int global_is_multibyte_codepage; extern int (*_skip_multibyte_char)(char c); #define skip_multibyte_char(c) ((*_skip_multibyte_char)((c))) //#define get_character_len(x) (global_is_multibyte_codepage ? skip_multibyte_char((x)) : 0)
|