资源简介
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
相关资源
-
Hba
se源码分析 - 毕业设计管理系统源码229863
- 8548平台vxworks6.6 bsp源码
- Linux Shell 脚本攻略 中文 第三版和源码
- Unifalcon完整源码版(2019-10-22)
- andriodapp闹钟源代码
- 华清远见嵌入式培训---驱动教程源码
- yaffs2源码
- net小区物业管理系统源码.rar
- 考试系统网络版(含源码)考试系统
- P2P软件Shareaza 2.2.4.0源码
- AES-128加密解密源码及算法详解。
- 餐饮系统Delphi源码
- 用VFP制作的 学生选修课查询
- 霸主代码.e
- GISpace标绘演示系统1.2.1源码
- 城市医院预约统一挂号平台源码带文
- 整人蓝屏源码
- delphi 会员卡管理系统 源码
- 《netty权威指南》私有协议栈开发完整
- App开源分享-在路上项目源码
- oA办公系统源码MyOffice
- Unity3D平衡类游戏--平衡小球Demo解析(
- ATSHA204加密片源码SWI
- 位置分享APP项目源码
- 试验室预约系统.net 3.0 源码
- 安卓拼图游戏源码
- 在线学习网站系统毕业设计源码
- .NET驾校管理系统毕业设计源码和论文
- qwt的源码及
评论
共有 条评论