File:  [Power 6/32 Unix Tahoe 4.2BSD] / cci / usr / src / bin / cdb / t.c
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs
Sun Jul 28 12:24:19 2019 UTC (7 years ago) by root
Branches: bsd, MAIN
CVS tags: v12b, v121, HEAD
Power 6/32 Unix version 1.2b

static char sccsid[] = "@(#)t.c	2.10";

#include <stdio.h>
/* this is a toy file used for testing cdb */

typedef enum {
	red, orange, yellow, green=10, blue, violet} 
COLORE;


typedef union {
	struct {
		int	s11;
	} 
	s1;
	struct {
		int	s21;
		int	s22;
	} 
	s2;
	struct {
		int	s31;
		int	s32;
		int	s33;
	} 
	s3;
	COLORE	color;
} 
U1U, *pU1U;
U1U	vu;

typedef struct {
	short   a;
	char    b[9];
	long    c;
unsigned foo1 : 
	1;
unsigned foo2 : 
	2;
unsigned foo3 : 
	3;
unsigned foo4 : 
	4;
	COLORE  color;
} 
MOMR, *pMOMR;
MOMR    vamom = {
	12, "Apple Pie", -34, 1, 2, 4, 8, green};

typedef union {
	long    lng;
	float   fl;
	struct {
		short       shortLo;
		short       shortHi;
	} 
	shorts;
	struct {
		char        chLoLo;
		char        chLoHi;
		char        chHiLo;
		char        chHiHi;
	} 
	chars;
} 
STUFFU;

STUFFU vstuff;

int     arI1[10];
int     arI2[5][6];
char    arC1[10];
char    arC2[5][6];
MOMR    vrgMom[4];
char	*mumble[5] = {
	"0", "1", "2", "3", "4"
};

int     k;

bar(a, b, c)
int     a, b, c;
{
	printf("in bar\n");
	baz(++a, -1L, "Hi, Mom!");
}


baz(d, e, f)
register int    d;
long    e;
char    *f;
{
	int         x, y, z;
	register float      fl;
	MOMR        amom;
	pMOMR       mom;

	mom = &amom;
	fl = 1.3;
	d = 2;
	e = d + e;
	switch (d) {
	case 0: 
		printf("0\n");  
		break;
	case 1: 
		printf("1\n");  
		break;
	case 2: 
		printf("2\n");  
		break;
	case 3: 
		printf("3\n");  
		break;
	case 4: 
		printf("4\n");  
		break;
	default:
		printf("default\n");    
		break;
	}
	printf("in baz  %s  %g\n",f, fl);
}

foo(i)
register int    i;
{
	printf("in foo\n");
	bar(++i, ++i, ++i);
}

int foo2(i, d)
int     i;
int d;
{
	int e;
	int x;
	long q;
	int y;

	printf("in foo2\n");
	bar(++i, ++i, ++i);
	return(i);
}

foo3(i, d, h, z)
int     i;
long d;
int     h;
int z;
{
	int e;
	long f;
	int m, n, o, p, q, r;

	printf("in foo3\n");
	bar(++i, ++i, ++i);
	return(i+d+h);
}


main(argc, argv)
int     argc;
char    *argv[];
{
	char        ch;
	char	*mumble[5];

	mumble[0] = "a";
	mumble[1] = "b";
	mumble[2] = "c";
	mumble[3] = "d";
	mumble[4] = "e";

	vstuff.lng = 0x12345678;
	vu.s3.s31 = 1;
	vu.s3.s32 = 2;
	vu.s3.s33 = 3;

	while (*argv)
		printf("%s\n",*(argv++));

	for (k=1; k != 0; k++) {
		foo(k);
	}
	printf("done\n");
	exit(0);
}

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.