home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The C Users' Group Library 1994 August
/
wc-cdrom-cusersgrouplibrary-1994-08.iso
/
listings
/
v_07_07
/
v7n7068a.txt
< prev
next >
Wrap
Text File
|
1989-09-04
|
2KB
|
107 lines
----------- A sample.c input file showing different func decl styles ----
#include <stdio.h>
typedef struct waldo { int i; float z; } FOOBAR;
double x;
extern something(); /* should be elided by the tool */
char *strcat();
main(argc,argv)
int argc;
char *argv[];
{
float x = 2.0;
FOOBAR y;
extern double waldo();
func1(x,y);
noargs();
weird();
}
char *strcmp();
double func1(x,y,z,q,r)
float x;
FOOBAR y,z;
struct waldo *q,r;
{
}
int noargs()
{
}
weird()
{
/* no args and defaults to int type func */
}
double *
crazy(q)
int ***q;
{
/* The func type is on the previous line! */
}
-------------- proto.out --------------------------------------------------
extern double func1(float x,FOOBAR y,FOOBAR z,struct waldo *q,struct waldo r);
extern int noargs(void);
extern int weird(void);
extern double * crazy(int ***q);
-------------- ed.out ------------------------------------------------------
5,10d
11i\
main(int argc,char *argv[])
14d
21,26d
27i\
double func1(float x,FOOBAR y,FOOBAR z,struct waldo *q,struct waldo r)
29,30d
31i\
int noargs(void)
33,34d
35i\
weird(void)
39,41d
42i\
double * crazy(int ***q)
----------------- The input file after editing by sed -----------------
#include <stdio.h>
typedef struct waldo { int i; float z; } FOOBAR;
double x;
main(int argc,char *argv[])
{
float x = 2.0;
FOOBAR y;
func1(x,y);
noargs();
weird();
}
double func1(float x,FOOBAR y,FOOBAR z,struct waldo *q,struct waldo r)
{
}
int noargs(void)
{
}
weird(void)
{
/* no args and defaults to int type func */
}
double * crazy(int ***q)
{
/* The func type is on the previous line! */
}