getdelim.c revision 3f54fd611f536639ec30dd53c48e5ec1897cc7d9
/***********************************************************************
* *
* This software is part of the ast package *
* Copyright (c) 1985-2011 AT&T Intellectual Property *
* and is licensed under the *
* Eclipse Public License, Version 1.0 *
* by AT&T Intellectual Property *
* *
* A copy of the License is available at *
* (with md5 checksum b35adb5213ca9657e911e9befb180842) *
* *
* Information and Software Systems Research *
* AT&T Research *
* Florham Park NJ *
* *
* Glenn Fowler <gsf@research.att.com> *
* David Korn <dgk@research.att.com> *
* Phong Vo <kpv@research.att.com> *
* *
***********************************************************************/
#pragma prototyped
#include "stdhdr.h"
{
ssize_t m;
ssize_t n;
ssize_t k;
ssize_t p;
uchar* s;
SFMTXDECL(f);
SFMTXENTER(f, -1);
SFMTXRETURN(f, -1);
SFMTXRETURN(f, -1);
SFLOCK(f,0);
for(m = 0;; )
{ /* read new data */
{ m = -1;
break;
}
}
for(k = 0; k < p; ++k) /* find the delimiter */
{ k += 1; /* include delim in copying */
break;
}
}
if((m+k+1) >= n ) /* make sure there is space */
{ n = ((m+k+15)/8)*8;
m = -1;
break;
}
}
if(s[m-1] == delim)
{ s[m] = 0; /* 0-terminated */
break;
}
}
SFOPEN(f,0);
SFMTXRETURN(f,m);
}
{
}