1
0
Fork 0
mirror of git://git.code.sf.net/p/cdesktopenv/code synced 2025-03-09 15:50:02 +00:00

INIT: remove proto, ratz (re: 46593a89, 6137b99a); major cleanup

This takes another step towards cleaning up the build system. We
now do not even pretend to be theoretically compatible with
pre-1989 K&R C compilers or with C++ compilers. In practice, this
had already been broken for many years due to bit rot.

Commit 46593a89 already removed the license handling enormity that
depended on proto, so now we can cleanly remove it altogether. But
we do need to leave some backwards compatibility stubs to keep the
build system compatible with older AST code; it should remain
possible to build older ksh versions with the current build system
(the bin/ and src/cmd/INIT/ directories) for testing purposes.

So as of now there is no more __MANGLE__d rubbish in your generated
header files. This is only about a quarter of a century overdue...

This commit also includes a huge amount of code cleanup to remove
thousands of unused K&R C fallbacks and other cruft, particularly
in libast. This code base should now be a little easier to
understand for people who are familiar with a modern(ish) C
standard.

ratz is now also removed; this was a standalone and simplified 2005
version of gunzip. As of 6137b99a, none of our code uses it, even
theoretically. And the real g(un)zip is now everywhere.

src/cmd/INIT/proto.c, src/cmd/INIT/ratz.c:
- Removed.

COPYRIGHT:
- Remove zlib license; this only applied to ratz.

bin/package, src/cmd/INIT/package.sh:
- Related cleanups.
- Unset LC_ALL before invoking a new shell, respecting the user's
  locale again and avoiding multibyte character corruption on the
  command line.

src/cmd/INIT/proto.sh:
- Add stub for backwards compatibility with Mamfiles that depend on
  proto. It does nothing but pass input without modification and is
  now installed as the new arch/*/bin/proto by src/cmd/INIT/Mamfile.

src/cmd/INIT/iffe.sh:
- Ignore the proto-related -e (--package) and -p (--prototyped)
  options; keep parsing them for backwards compatibility.
- Trim the macros passed to every test to their standard C
  versions, removing K&R C and C++ versions. These are now
  considered to be for backwards compatibility only.

src/cmd/INIT/iffe.tst:
- Remove proto(1) mangling code.
  By the way, iffe can be regression-tested as follows:
        $ bin/package use   # set up environment in a child shell
        $ regress src/cmd/INIT/iffe.tst
        $ exit              # leave package environment

src/cmd/INIT/make.probe, src/cmd/INIT/probe.win32:
- Remove code to handle C++.

src/lib/libast/features/common:
- As in iffe.sh above, trim macros designed for compatibility with
  C++ and ancient C compilers to their standard C versions and
  comment that they are for backwards compatibility with AST code.
  This is needed to keep all the old ast and ksh code compiling.

src/cmd/ksh93/sh/init.c,
src/cmd/ksh93/sh/name.c:
- Clarify libshell ABI compatibility function versions of macros.
  A "proto workaround" comment in the original code mislead me into
  thinking this had something to do with the removed proto(1), but
  it's unrelated. Call the workaround macro BYPASS_MACRO instead.

src/cmd/ksh93/include/defs.h:
- sh_sigcheck() macro: allow &sh as an argument: parenthesise shp.

src/cmd/ksh93/sh/nvtype.c:
- Remove unused nv_mkstruct() function. (re: d0a5cab1)

**/features/*:
- Remove obsolete iffe 'set prototyped' option.

**/Mamfile:
- Remove all references to the ast/prototyped.h header.
- Remove all use of the proto command. Simply copy instead.

*** 850-ish source files: ***
- Remove all '#pragma prototyped' directives.
- Remove all C++ compat code conditional upon defined(__cplusplus).
- Remove all use of the _ARG_ macro, which on standard C expands to
  its argument:
        #define _ARG_(x)        x
  (on K&R C, it expanded to nothing)
- Remove all use of _BEGIN_EXTERNS_ and _END_EXTERNS_ macros (empty
  on standard C; this was for C++ compatibility)
- Reduce all #if __STD_C (standard code) #else (K&R code) #endif
  blocks to the standard code only, without use of the macro.
- Same for _STD_ macro which seems to have had the same function.
- Change all instances of 'Void_t' to standard 'void'.
This commit is contained in:
Martijn Dekker 2021-12-23 03:14:20 +00:00
parent 3785a0685c
commit a1f5c99204
869 changed files with 1853 additions and 14292 deletions

View file

@ -20,7 +20,6 @@
* Phong Vo <kpv@research.att.com> *
* *
***********************************************************************/
#pragma prototyped
/*
* install error message handler for fatal malloc exceptions

View file

@ -45,16 +45,7 @@ typedef struct _direct_s
#ifdef F_DIOINFO
#if __STD_C
static ssize_t diordwr(Sfio_t* f, Void_t* buf, size_t n, Direct_t* di, int type)
#else
static ssize_t diordwr(f, buf, n, di, type)
Sfio_t* f;
Void_t* buf;
size_t n;
Direct_t* di;
int type;
#endif
static ssize_t diordwr(Sfio_t* f, void* buf, size_t n, Direct_t* di, int type)
{
size_t rw, done;
ssize_t rv;
@ -81,7 +72,7 @@ int type;
if(rv > 0)
{ rw -= rv; done += rv;
buf = (Void_t*)((char*)buf + rv);
buf = (void*)((char*)buf + rv);
}
if(rv < io || rw < di->dio.d_miniosz)
@ -102,41 +93,17 @@ int type;
return done ? done : rv;
}
#if __STD_C
static ssize_t dioread(Sfio_t* f, Void_t* buf, size_t n, Sfdisc_t* disc)
#else
static ssize_t dioread(f, buf, n, disc)
Sfio_t* f;
Void_t* buf;
size_t n;
Sfdisc_t* disc;
#endif
static ssize_t dioread(Sfio_t* f, void* buf, size_t n, Sfdisc_t* disc)
{
return diordwr(f, buf, n, (Direct_t*)disc, SF_READ);
}
#if __STD_C
static ssize_t diowrite(Sfio_t* f, const Void_t* buf, size_t n, Sfdisc_t* disc)
#else
static ssize_t diowrite(f, buf, n, disc)
Sfio_t* f;
Void_t* buf;
size_t n;
Sfdisc_t* disc;
#endif
static ssize_t diowrite(Sfio_t* f, const void* buf, size_t n, Sfdisc_t* disc)
{
return diordwr(f, (Void_t*)buf, n, (Direct_t*)disc, SF_WRITE);
return diordwr(f, (void*)buf, n, (Direct_t*)disc, SF_WRITE);
}
#if __STD_C
static int dioexcept(Sfio_t* f, int type, Void_t* data, Sfdisc_t* disc)
#else
static int dioexcept(f,type,data,disc)
Sfio_t* f;
int type;
Void_t* data;
Sfdisc_t* disc;
#endif
static int dioexcept(Sfio_t* f, int type, void* data, Sfdisc_t* disc)
{
Direct_t* di = (Direct_t*)disc;
@ -154,20 +121,14 @@ Sfdisc_t* disc;
#endif /* F_DIOINFO */
#if __STD_C
int sfdcdio(Sfio_t* f, size_t bufsize)
#else
int sfdcdio(f, bufsize)
Sfio_t* f;
size_t bufsize;
#endif
{
#ifndef F_DIOINFO
return -1;
#else
int cntl;
struct dioattr dio;
Void_t* buf;
void* buf;
Direct_t* di;
if(f->extent < 0 || (f->flags&SF_STRING))
@ -195,7 +156,7 @@ size_t bufsize;
if(!(di = (Direct_t*)malloc(sizeof(Direct_t))) )
goto no_direct;
if(!(buf = (Void_t*)memalign(dio.d_mem,bufsize)) )
if(!(buf = (void*)memalign(dio.d_mem,bufsize)) )
{ free(di);
goto no_direct;
}

View file

@ -57,12 +57,7 @@ typedef struct _dosdisc
int bsize;
} Dosdisc_t;
#if __STD_C
static void addmapping(register Dosdisc_t *dp)
#else
static void addmapping(dp)
register Dosdisc_t *dp;
#endif
{
register int n;
if((n=dp->maptop++)>=dp->mapsize)
@ -80,14 +75,7 @@ register Dosdisc_t *dp;
dp->maptable[dp->maptop].logical=0;
}
#if __STD_C
static struct map *getmapping(Dosdisc_t *dp, Sfoff_t offset, register int whence)
#else
static struct map *getmapping(dp, offset, whence)
Dosdisc_t *dp;
Sfoff_t offset;
register int whence;
#endif
{
register struct map *mp;
static struct map dummy;
@ -106,15 +94,7 @@ register int whence;
return(mp-1);
}
#if __STD_C
static ssize_t dos_read(Sfio_t *iop, void *buff, size_t size, Sfdisc_t* disc)
#else
static ssize_t dos_read(iop, buff, size, disc)
Sfio_t *iop;
void *buff;
size_t size;
Sfdisc_t* disc;
#endif
{
register Dosdisc_t *dp = (Dosdisc_t*)disc;
register char *cp = (char*)buff, *first, *cpmax;
@ -227,15 +207,7 @@ done:
* if <whence> is SEEK_CUR, physical offset converted to logical offset
* otherwise, logical offset is converted to physical offset
*/
#if __STD_C
static Sfoff_t cur_offset(Dosdisc_t *dp, Sfoff_t offset,Sfio_t *iop,register int whence)
#else
static Sfoff_t cur_offset(dp, offset, iop, whence)
Dosdisc_t *dp;
Sfoff_t offset;
Sfio_t *iop;
register int whence;
#endif
{
register Sfoff_t n,m=0;
register char *cp;
@ -273,15 +245,7 @@ register int whence;
return(offset+m);
}
#if __STD_C
static Sfoff_t dos_seek(Sfio_t *iop, Sfoff_t offset, register int whence, Sfdisc_t* disc)
#else
static Sfoff_t dos_seek(iop, offset, whence, disc)
Sfio_t *iop;
Sfoff_t offset;
register int whence;
Sfdisc_t* disc;
#endif
{
register Dosdisc_t *dp = (Dosdisc_t*)disc;
struct map dummy, *mp=0;
@ -364,15 +328,7 @@ retry:
return(offset);
}
#if __STD_C
static int dos_except(Sfio_t *iop, int type, void *arg, Sfdisc_t *disc)
#else
static int dos_except(iop, type, arg, disc)
Sfio_t *iop;
int type;
void *arg;
Sfdisc_t *disc;
#endif
{
register Dosdisc_t *dp = (Dosdisc_t*)disc;
if(type==SF_DPOP || type==SF_FINAL)
@ -386,12 +342,7 @@ Sfdisc_t *disc;
return(0);
}
#if __STD_C
int sfdcdos(Sfio_t *f)
#else
int sfdcdos(f)
Sfio_t *f;
#endif
{
Dosdisc_t *dos;

View file

@ -37,15 +37,10 @@ typedef struct _filter_s
} Filter_t;
/* read data from the filter */
#if __STD_C
static ssize_t filterread(Sfio_t* f, Void_t* buf, size_t n, Sfdisc_t* disc)
#else
static ssize_t filterread(f, buf, n, disc)
Sfio_t* f; /* stream reading from */
Void_t* buf; /* buffer to read into */
size_t n; /* number of bytes requested */
Sfdisc_t* disc; /* discipline */
#endif
static ssize_t filterread(Sfio_t* f, /* stream reading from */
void* buf, /* buffer to read into */
size_t n, /* number of bytes requested */
Sfdisc_t* disc) /* discipline */
{
Filter_t* fi;
ssize_t r, w;
@ -98,29 +93,16 @@ Sfdisc_t* disc; /* discipline */
}
}
#if __STD_C
static ssize_t filterwrite(Sfio_t* f, const Void_t* buf, size_t n, Sfdisc_t* disc)
#else
static ssize_t filterwrite(f, buf, n, disc)
Sfio_t* f; /* stream writing to */
Void_t* buf; /* buffer to write into */
size_t n; /* number of bytes requested */
Sfdisc_t* disc; /* discipline */
#endif
static ssize_t filterwrite(Sfio_t* f, /* stream writing to */
void* buf, /* buffer to write into */
size_t n, /* number of bytes requested */
Sfdisc_t* disc) /* discipline */
{
return -1;
}
/* for the duration of this discipline, the stream is unseekable */
#if __STD_C
static Sfoff_t filterseek(Sfio_t* f, Sfoff_t addr, int offset, Sfdisc_t* disc)
#else
static Sfoff_t filterseek(f, addr, offset, disc)
Sfio_t* f;
Sfoff_t addr;
int offset;
Sfdisc_t* disc;
#endif
{ f = NIL(Sfio_t*);
addr = 0;
offset = 0;
@ -129,15 +111,7 @@ Sfdisc_t* disc;
}
/* on close, remove the discipline */
#if __STD_C
static int filterexcept(Sfio_t* f, int type, Void_t* data, Sfdisc_t* disc)
#else
static int filterexcept(f,type,data,disc)
Sfio_t* f;
int type;
Void_t* data;
Sfdisc_t* disc;
#endif
static int filterexcept(Sfio_t* f, int type, void* data, Sfdisc_t* disc)
{
if(type == SF_FINAL || type == SF_DPOP)
{ sfclose(((Filter_t*)disc)->filter);
@ -147,13 +121,8 @@ Sfdisc_t* disc;
return 0;
}
#if __STD_C
int sfdcfilter(Sfio_t* f, const char* cmd)
#else
int sfdcfilter(f, cmd)
Sfio_t* f; /* stream to filter data */
char* cmd; /* program to run as a filter */
#endif
int sfdcfilter(Sfio_t* f, /* stream to filter data */
const char* cmd) /* program to run as a filter */
{
reg Filter_t* fi;
reg Sfio_t* filter;
@ -163,7 +132,7 @@ char* cmd; /* program to run as a filter */
return -1;
/* unbuffered stream */
sfsetbuf(filter,NIL(Void_t*),0);
sfsetbuf(filter,NIL(void*),0);
if(!(fi = (Filter_t*)malloc(sizeof(Filter_t))) )
{ sfclose(filter);

View file

@ -56,15 +56,7 @@ typedef struct
* we assume line-at-a-time input
*/
#if __STD_C
static ssize_t moreread(Sfio_t* f, void* buf, size_t n, Sfdisc_t* dp)
#else
static ssize_t moreread(f, buf, n, dp)
Sfio_t* f;
void* buf;
size_t n;
Sfdisc_t* dp;
#endif
{
register More_t* more = (More_t*)dp;
@ -79,15 +71,7 @@ Sfdisc_t* dp;
* return < -1 is -(signal + 1)
*/
#if __STD_C
static int ttyquery(Sfio_t* rp, Sfio_t* wp, const char* label, Sfdisc_t* dp)
#else
static int ttyquery(rp, wp, label, dp)
Sfio_t* rp;
Sfio_t* wp;
char* label;
Sfdisc_t* dp;
#endif
{
register int r;
int n;
@ -144,15 +128,7 @@ Sfdisc_t* dp;
* more write
*/
#if __STD_C
static ssize_t morewrite(Sfio_t* f, const Void_t* buf, register size_t n, Sfdisc_t* dp)
#else
static ssize_t morewrite(f, buf, n, dp)
Sfio_t* f;
Void_t* buf;
register size_t n;
Sfdisc_t* dp;
#endif
static ssize_t morewrite(Sfio_t* f, const void* buf, register size_t n, Sfdisc_t* dp)
{
register More_t* more = (More_t*)dp;
register char* b;
@ -257,15 +233,7 @@ Sfdisc_t* dp;
* remove the discipline on close
*/
#if __STD_C
static int moreexcept(Sfio_t* f, int type, Void_t* data, Sfdisc_t* dp)
#else
static int moreexcept(f, type, data, dp)
Sfio_t* f;
int type;
Void_t* data;
Sfdisc_t* dp;
#endif
static int moreexcept(Sfio_t* f, int type, void* data, Sfdisc_t* dp)
{
register More_t* more = (More_t*)dp;
@ -300,15 +268,7 @@ Sfdisc_t* dp;
* if f==sfstdout then input on sfstdin also resets the state
*/
#if __STD_C
int sfdcmore(Sfio_t* f, const char* prompt, int rows, int cols)
#else
int sfdcmore(f, prompt, rows, cols)
Sfio_t* f;
char* prompt;
int rows;
int cols;
#endif
{
register More_t* more;
size_t n;

View file

@ -44,15 +44,7 @@ typedef struct
* prefix write
*/
#if __STD_C
static ssize_t pfxwrite(Sfio_t* f, const Void_t* buf, register size_t n, Sfdisc_t* dp)
#else
static ssize_t pfxwrite(f, buf, n, dp)
Sfio_t* f;
Void_t* buf;
register size_t n;
Sfdisc_t* dp;
#endif
static ssize_t pfxwrite(Sfio_t* f, const void* buf, register size_t n, Sfdisc_t* dp)
{
register Prefix_t* pfx = (Prefix_t*)dp;
register char* b;
@ -92,15 +84,7 @@ Sfdisc_t* dp;
* remove the discipline on close
*/
#if __STD_C
static int pfxexcept(Sfio_t* f, int type, Void_t* data, Sfdisc_t* dp)
#else
static int pfxexcept(f, type, data, dp)
Sfio_t* f;
int type;
Void_t* data;
Sfdisc_t* dp;
#endif
static int pfxexcept(Sfio_t* f, int type, void* data, Sfdisc_t* dp)
{
if (type == SF_FINAL || type == SF_DPOP)
free(dp);
@ -111,13 +95,7 @@ Sfdisc_t* dp;
* push the prefix discipline on f
*/
#if __STD_C
int sfdcprefix(Sfio_t* f, const char* prefix)
#else
int sfdcprefix(f, prefix)
Sfio_t* f;
char* prefix;
#endif
{
register Prefix_t* pfx;
register char* s;

View file

@ -38,28 +38,18 @@ typedef struct _skable_s
int eof; /* if eof has been reached */
} Seek_t;
#if __STD_C
static ssize_t skwrite(Sfio_t* f, const Void_t* buf, size_t n, Sfdisc_t* disc)
#else
static ssize_t skwrite(f, buf, n, disc)
Sfio_t* f; /* stream involved */
Void_t* buf; /* buffer to read into */
size_t n; /* number of bytes to read */
Sfdisc_t* disc; /* discipline */
#endif
static ssize_t skwrite(Sfio_t* f, /* stream involved */
void* buf, /* buffer to read into */
size_t n, /* number of bytes to read */
Sfdisc_t* disc) /* discipline */
{
return (ssize_t)(-1);
}
#if __STD_C
static ssize_t skread(Sfio_t* f, Void_t* buf, size_t n, Sfdisc_t* disc)
#else
static ssize_t skread(f, buf, n, disc)
Sfio_t* f; /* stream involved */
Void_t* buf; /* buffer to read into */
size_t n; /* number of bytes to read */
Sfdisc_t* disc; /* discipline */
#endif
static ssize_t skread(Sfio_t* f, /* stream involved */
void* buf, /* buffer to read into */
size_t n, /* number of bytes to read */
Sfdisc_t* disc) /* discipline */
{
Seek_t* sk;
Sfio_t* sf;
@ -99,15 +89,7 @@ Sfdisc_t* disc; /* discipline */
return r+w;
}
#if __STD_C
static Sfoff_t skseek(Sfio_t* f, Sfoff_t addr, int type, Sfdisc_t* disc)
#else
static Sfoff_t skseek(f, addr, type, disc)
Sfio_t* f;
Sfoff_t addr;
int type;
Sfdisc_t* disc;
#endif
{
Seek_t* sk;
Sfio_t* sf;
@ -161,15 +143,7 @@ Sfdisc_t* disc;
}
/* on close, remove the discipline */
#if __STD_C
static int skexcept(Sfio_t* f, int type, Void_t* data, Sfdisc_t* disc)
#else
static int skexcept(f,type,data,disc)
Sfio_t* f;
int type;
Void_t* data;
Sfdisc_t* disc;
#endif
static int skexcept(Sfio_t* f, int type, void* data, Sfdisc_t* disc)
{
Seek_t* sk;
@ -192,12 +166,7 @@ Sfdisc_t* disc;
return 0;
}
#if __STD_C
int sfdcseekable(Sfio_t* f)
#else
int sfdcseekable(f)
Sfio_t* f;
#endif
{
reg Seek_t* sk;

View file

@ -28,15 +28,7 @@
** Written by Glenn Fowler (03/18/1998).
*/
#if __STD_C
static int slowexcept(Sfio_t* f, int type, Void_t* v, Sfdisc_t* disc)
#else
static int slowexcept(f, type, v, disc)
Sfio_t* f;
int type;
Void_t* v;
Sfdisc_t* disc;
#endif
static int slowexcept(Sfio_t* f, int type, void* v, Sfdisc_t* disc)
{
NOTUSED(f);
NOTUSED(v);
@ -58,12 +50,7 @@ Sfdisc_t* disc;
return(0);
}
#if __STD_C
int sfdcslow(Sfio_t* f)
#else
int sfdcslow(f)
Sfio_t* f;
#endif
{
Sfdisc_t* disc;

View file

@ -39,16 +39,7 @@ typedef struct _subfile_s
Sfoff_t here; /* current seek location */
} Subfile_t;
#if __STD_C
static ssize_t streamio(Sfio_t* f, Void_t* buf, size_t n, Sfdisc_t* disc, int type)
#else
static ssize_t streamio(f, buf, n, disc, type)
Sfio_t* f;
Void_t* buf;
size_t n;
Sfdisc_t* disc;
int type;
#endif
static ssize_t streamio(Sfio_t* f, void* buf, size_t n, Sfdisc_t* disc, int type)
{
reg Subfile_t *su;
reg Sfoff_t here, parent;
@ -83,41 +74,17 @@ int type;
return io;
}
#if __STD_C
static ssize_t streamwrite(Sfio_t* f, const Void_t* buf, size_t n, Sfdisc_t* disc)
#else
static ssize_t streamwrite(f, buf, n, disc)
Sfio_t* f;
Void_t* buf;
size_t n;
Sfdisc_t* disc;
#endif
static ssize_t streamwrite(Sfio_t* f, const void* buf, size_t n, Sfdisc_t* disc)
{
return streamio(f,(Void_t*)buf,n,disc,SF_WRITE);
return streamio(f,(void*)buf,n,disc,SF_WRITE);
}
#if __STD_C
static ssize_t streamread(Sfio_t* f, Void_t* buf, size_t n, Sfdisc_t* disc)
#else
static ssize_t streamread(f, buf, n, disc)
Sfio_t* f;
Void_t* buf;
size_t n;
Sfdisc_t* disc;
#endif
static ssize_t streamread(Sfio_t* f, void* buf, size_t n, Sfdisc_t* disc)
{
return streamio(f,buf,n,disc,SF_READ);
}
#if __STD_C
static Sfoff_t streamseek(Sfio_t* f, Sfoff_t pos, int type, Sfdisc_t* disc)
#else
static Sfoff_t streamseek(f, pos, type, disc)
Sfio_t* f;
Sfoff_t pos;
int type;
Sfdisc_t* disc;
#endif
{
reg Subfile_t* su;
reg Sfoff_t here, parent;
@ -154,30 +121,17 @@ Sfdisc_t* disc;
return (su->here = pos);
}
#if __STD_C
static int streamexcept(Sfio_t* f, int type, Void_t* data, Sfdisc_t* disc)
#else
static int streamexcept(f, type, data, disc)
Sfio_t* f;
int type;
Void_t* data;
Sfdisc_t* disc;
#endif
static int streamexcept(Sfio_t* f, int type, void* data, Sfdisc_t* disc)
{
if(type == SF_FINAL || type == SF_DPOP)
free(disc);
return 0;
}
#if __STD_C
Sfio_t* sfdcsubstream(Sfio_t* f, Sfio_t* parent, Sfoff_t offset, Sfoff_t extent)
#else
Sfio_t* sfdcsubstream(f, parent, offset, extent)
Sfio_t* f; /* stream */
Sfio_t* parent; /* parent stream */
Sfoff_t offset; /* offset in f */
Sfoff_t extent; /* desired size */
#endif
Sfio_t* sfdcsubstream(Sfio_t* f, /* stream */
Sfio_t* parent, /* parent stream */
Sfoff_t offset, /* offset in f */
Sfoff_t extent) /* desired size */
{
reg Sfio_t* sp;
reg Subfile_t* su;
@ -189,7 +143,7 @@ Sfoff_t extent; /* desired size */
else sfseek(parent,here,SEEK_SET);
sfpurge(parent);
if (!(sp = f) && !(sp = sfnew(NIL(Sfio_t*), NIL(Void_t*), (size_t)SF_UNBOUND, dup(sffileno(parent)), parent->flags)))
if (!(sp = f) && !(sp = sfnew(NIL(Sfio_t*), NIL(void*), (size_t)SF_UNBOUND, dup(sffileno(parent)), parent->flags)))
return 0;
if(!(su = (Subfile_t*)malloc(sizeof(Subfile_t))))

View file

@ -37,15 +37,10 @@ typedef struct _tee_s
} Tee_t;
/* write to the teed stream. */
#if __STD_C
static ssize_t teewrite(Sfio_t* f, const Void_t* buf, size_t size, Sfdisc_t* disc)
#else
static ssize_t teewrite(f,buf,size,disc)
Sfio_t* f; /* the stream being written to */
Void_t* buf; /* the buffer of data being output */
size_t size; /* the data size */
Sfdisc_t* disc; /* the tee discipline */
#endif
static ssize_t teewrite(Sfio_t* f, /* the stream being written to */
const void* buf, /* the buffer of data being output */
size_t size, /* the data size */
Sfdisc_t* disc) /* the tee discipline */
{
reg Tee_t* te = (Tee_t*)disc;
@ -58,15 +53,7 @@ Sfdisc_t* disc; /* the tee discipline */
}
/* on close, remove the discipline */
#if __STD_C
static int teeexcept(Sfio_t* f, int type, Void_t* data, Sfdisc_t* disc)
#else
static int teeexcept(f,type,data,disc)
Sfio_t* f;
int type;
Void_t* data;
Sfdisc_t* disc;
#endif
static int teeexcept(Sfio_t* f, int type, void* data, Sfdisc_t* disc)
{
if(type == SF_FINAL || type == SF_DPOP)
free(disc);
@ -74,13 +61,8 @@ Sfdisc_t* disc;
return 0;
}
#if __STD_C
int sfdctee(Sfio_t* f, Sfio_t* tee)
#else
int sfdctee(f, tee)
Sfio_t* f; /* stream to tee from */
Sfio_t* tee; /* stream to tee to */
#endif
int sfdctee(Sfio_t* f, /* stream to tee from */
Sfio_t* tee) /* stream to tee to */
{
reg Tee_t* te;

View file

@ -46,28 +46,18 @@ typedef struct _union_s
File_t f[1]; /* array of streams */
} Union_t;
#if __STD_C
static ssize_t unwrite(Sfio_t* f, const Void_t* buf, size_t n, Sfdisc_t* disc)
#else
static ssize_t unwrite(f, buf, n, disc)
Sfio_t* f; /* stream involved */
Void_t* buf; /* buffer to read into */
size_t n; /* number of bytes to read */
Sfdisc_t* disc; /* discipline */
#endif
static ssize_t unwrite(Sfio_t* f, /* stream involved */
const void* buf, /* buffer to read into */
size_t n, /* number of bytes to read */
Sfdisc_t* disc) /* discipline */
{
return -1;
}
#if __STD_C
static ssize_t unread(Sfio_t* f, Void_t* buf, size_t n, Sfdisc_t* disc)
#else
static ssize_t unread(f, buf, n, disc)
Sfio_t* f; /* stream involved */
Void_t* buf; /* buffer to read into */
size_t n; /* number of bytes to read */
Sfdisc_t* disc; /* discipline */
#endif
static ssize_t unread(Sfio_t* f, /* stream involved */
void* buf, /* buffer to read into */
size_t n, /* number of bytes to read */
Sfdisc_t* disc) /* discipline */
{
reg Union_t* un;
reg ssize_t r, m;
@ -92,15 +82,7 @@ Sfdisc_t* disc; /* discipline */
return n-m;
}
#if __STD_C
static Sfoff_t unseek(Sfio_t* f, Sfoff_t addr, int type, Sfdisc_t* disc)
#else
static Sfoff_t unseek(f, addr, type, disc)
Sfio_t* f;
Sfoff_t addr;
int type;
Sfdisc_t* disc;
#endif
{
reg Union_t* un;
reg int i;
@ -145,15 +127,7 @@ Sfdisc_t* disc;
}
/* on close, remove the discipline */
#if __STD_C
static int unexcept(Sfio_t* f, int type, Void_t* data, Sfdisc_t* disc)
#else
static int unexcept(f,type,data,disc)
Sfio_t* f;
int type;
Void_t* data;
Sfdisc_t* disc;
#endif
static int unexcept(Sfio_t* f, int type, void* data, Sfdisc_t* disc)
{
if(type == SF_FINAL || type == SF_DPOP)
free(disc);
@ -161,14 +135,7 @@ Sfdisc_t* disc;
return 0;
}
#if __STD_C
int sfdcunion(Sfio_t* f, Sfio_t** array, int n)
#else
int sfdcunion(f, array, n)
Sfio_t* f;
Sfio_t** array;
int n;
#endif
{
reg Union_t* un;
reg int i;

View file

@ -20,7 +20,6 @@
* Phong Vo <kpv@research.att.com> *
* *
***********************************************************************/
#pragma prototyped
/*
* Glenn Fowler

View file

@ -20,7 +20,6 @@
* Phong Vo <kpv@research.att.com> *
* *
***********************************************************************/
#pragma prototyped
/*
* Glenn Fowler
* AT&T Research