/***********************************************************************
* *
* This software is part of the ast package *
* Copyright (c) 1985-2011 AT&T Intellectual Property *
* and is licensed under the *
* Common Public License, Version 1.0 *
* by AT&T Intellectual Property *
* *
* A copy of the License is available at *
* (with md5 checksum 059e8cd6165cb4c31e351f2b69388fd9) *
* *
* 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> *
* *
***********************************************************************/
#include "sfdchdr.h"
/* Discipline to turn \r\n into \n.
** This is useful to deal with DOS text files.
**
** Written by David Korn (03/18/1998).
*/
struct map
{
};
typedef struct _dosdisc
{
int mapsize;
int maptop;
int skip;
void *buff;
char last;
char extra;
int bsize;
} Dosdisc_t;
#if __STD_C
#else
static void addmapping(dp)
#endif
{
register int n;
{
{
return;
}
}
}
#if __STD_C
#else
register int whence;
#endif
{
{
return(&dummy);
}
{
return(&dummy);
}
return(mp-1);
}
#if __STD_C
#else
void *buff;
#endif
{
register int n, count, m;
{
return(1);
}
while(1)
{
return(n);
{
/* should insert a '\r' */ ;
}
if(n>1)
break;
{
return(1);
}
}
n--;
*cpmax = '\r';
while(1)
{
while(*cp++ != '\r');
break;
}
/* if not \r\n in buffer, just return */
{
count=0;
goto done;
}
{
{
}
}
/* save original discipline inside buffer */
{
else
return(-1);
}
count=1;
while(1)
{
cp++;
else
while(*cp++ != '\r');
continue;
break;
count++;
}
done:
{
addmapping(dp);
}
return(n-count);
}
/*
* returns the current offset
* <offset> must be in the current buffer
* if <whence> is SEEK_CUR, physical offset converted to logical offset
* otherwise, logical offset is converted to physical offset
*/
#if __STD_C
#else
register int whence;
#endif
{
register Sfoff_t n,m=0;
register char *cp;
{
whence= -1;
}
else
{
whence = 1;
}
offset +=n;
{
m=whence;
while(n--)
{
{
m += whence;
if(whence>0)
n++;
}
}
}
if(whence<0)
return(offset+m);
}
#if __STD_C
#else
register int whence;
#endif
{
register int n,size;
switch(whence)
{
case SEEK_CUR:
return(offset);
/* check for seek outside buffer */
break;
case SEEK_SET:
/* check for seek outside buffer */
break;
case SEEK_END:
break;
}
else
if(mp)
{
return(-1);
}
while(1)
{
break;
break;
if(n < 0)
return(-1);
if(n==0)
{
{
goto retry;
}
break;
}
}
else
{
{
}
else
}
return(offset);
}
#if __STD_C
#else
int type;
void *arg;
#endif
{
{
}
return(0);
}
#if __STD_C
#else
int sfdcdos(f)
Sfio_t *f;
#endif
{
/* this is a readonly discipline */
return(-1);
return -1;
return -1;
}
return(0);
}