资源简介
snappy-1.0.5源码
代码片段和文件信息
#ifndef lint
static char Rcs_Id[] =
“$Id: fields.cv 1.7 1994/01/06 05:26:37 geoff Exp $“;
#endif
/*
* $Log: fields.cv $
* Revision 1.7 1994/01/06 05:26:37 geoff
* Get rid of all references to System V string routines for portability
* (sigh).
*
* Revision 1.6 1994/01/05 20:13:43 geoff
* Add the maxf parameter
*
* Revision 1.5 1994/01/04 02:40:21 geoff
* Make the increments settable (field_line_inc and field_field_inc).
* Add support for the FLD_NOSHRINK flag.
*
* Revision 1.4 1993/09/27 17:48:02 geoff
* Fix some lint complaints and some parenthesization errors.
*
* Revision 1.3 1993/09/09 01:11:11 geoff
* Add a return value to fieldwrite. Add support for backquotes and for
* unstripped backslashes.
*
* Revision 1.2 1993/08/26 00:02:50 geoff
* Fix a stupid null-pointer bug
*
* Revision 1.1 1993/08/25 21:32:05 geoff
* Initial revision
*
*/
#include
#include “config.h“
#include “fields.h“
field_t * fieldread P ((FILE * file char * delims
int flags int maxf));
/* Read a line with fields from a file */
field_t * fieldmake P ((char * line int allocated char * delims
int flags int maxf));
/* Make a field structure from a line */
static field_t * fieldparse P ((field_t * fieldp char * line char * delims
int flags int maxf));
/* Parse the fields in a line */
static int fieldbackch P ((char * str char ** out int strip));
/* Process backslash sequences */
int fieldwrite P ((FILE * file field_t * fieldp int delim));
/* Write a line with fields to a file */
void fieldfree P ((field_t * fieldp));
/* Free a field returned by fieldread */
unsigned int field_field_inc = 20; /* Increment to increase # fields by */
unsigned int field_line_inc = 512; /* Incr to increase line length by */
#ifndef USG
#define strchr index
#endif /* USG */
extern void free ();
extern char * malloc ();
extern char * realloc ();
extern char * strchr ();
extern int strlen ();
/*
* Read one line of the given file into a buffer break it up into
* fields and return them to the caller. The field_t structure
* returned must eventually be freed with fieldfree.
*/
field_t * fieldread (file delims flags maxf)
FILE * file; /* File to read lines from */
char * delims; /* Characters to use for field delimiters */
int flags; /* Option flags; see fields.h */
int maxf; /* Maximum number of fields to parse */
{
register char * linebuf; /* Buffer to hold the line read in */
int linemax; /* Maximum line buffer size */
int linesize; /* Current line buffer size */
linebuf = (char *) malloc (field_line_inc);
if (linebuf == NULL)
return NULL;
linemax = field_line_inc;
linesize = 0;
/*
* Read in the line.
*/
while (fgets (&linebuf[linesize] linemax - linesize file)
!= NULL)
{
linesize += strlen (&linebuf[linesize]);
if (linebuf[linesize - 1] == ‘\n‘)
break;
else
{
lin
相关资源
-
fli
nk核心源码(追源索骥:透过源码 - Scratch源码
- E4A无障碍跨程序操作类库(带源码、
- 设备管理系统源码
- 安卓wifi直连app源码
- 我的世界源码(易语言版)
- labview编程软件滤波器以及编写程序设
- 我的界面(visual foxpro)源码
- 易语言:一键cf基址源码
- The Secret Path 3D 3D魔方迷宫[源码][scra
- scratch垃圾分类源码(最终版本).sb
- 安卓QQ6.71协议源码易语言,qq协议源码
- 编译原理实验工具及参考源码(lex&
- E盾偷后台工具源码
- UNIX/LINUX编程实践教程的源码
- 十以内加减法练习 powerbuilder源码
- 农场开发项目
- OCR源码
- PLC上位机编程软件
- 用foobar2000听google音乐[更新一下]
- 学生信息管理系统源码
- 用VC 编写的仿QQ聊天室程序源代码
- 毕业论文之温度传感器DS18B20(源码
- 可自定义导航网站源码
- 栅栏填充算法源码(VC)
- msp430F149操作红外接收模块源码
- [免费]图像识别c 源码
- 周易排盘源码
- RSA算法源码
- 一个人脸识别程序源码
评论
共有 条评论