paquette@cpsc.ucalgary.ca (Trevor Paquette) (02/02/90)
#! /bin/sh
# This is a shell archive. Remove anything before this line, then unpack
# it by saving it into a file and typing "sh file". To overwrite existing
# files, type "sh file -c". You can also feed this as standard input via
# unshar, or by typing "sh <file", e.g.. If this archive is complete, you
# will see the following message at the end:
# "End of shell archive."
# Contents: README auc.c defs.h extern.h gen.c include.h keys.h main.c
# makefile readdatafile.c util.c
# Wrapped by paquette@cpsc.UCalgary.CA on Fri Feb 2 07:59:52 1990
PATH=/bin:/usr/bin:/usr/ucb ; export PATH
if test -f 'README' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'README'\"
else
echo shar: Extracting \"'README'\" \(826 characters\)
sed "s/^X//" >'README' <<'END_OF_FILE'
X This program is cheesy at best. VERY simplistic but it works.
X It runs on a SparcStation 1 and the Amiga.
X
X Little or no comments are provided, most of the code is very
X straight forward. Don't forget to change the machine definition in defs.h
X
X Trev
X Comments, questions, flames to
X___________________________________________/No man is a failure who has friends
XTrevor Paquette ICBM:51'03"N/114'05"W|I accept the challange, body and soul,
X{ubc-cs,utai,alberta}!calgary!paquette|to seek the knowledge of the ones of old
Xpaquette@cpsc.ucalgary.ca | - engraved on the Kersa Blade of Esalon
END_OF_FILE
if test 826 -ne `wc -c <'README'`; then
echo shar: \"'README'\" unpacked with wrong size!
fi
# end of 'README'
fi
if test -f 'auc.c' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'auc.c'\"
else
echo shar: Extracting \"'auc.c'\" \(2992 characters\)
sed "s/^X//" >'auc.c' <<'END_OF_FILE'
X#include "include.h"
X#include "extern.h"
X
Xauc()
X{
X int done = 0;
X int choice = 0;
X int i;
X char str[256];
X float search;
X
X while(!done) {
X printf("\nChoose one of the following\n");
X printf(" 0) Exit 5) List Comments\n");
X printf(" 1) List Entry 6) Search Entries for a Keynumber\n");
X printf(" 2) List Names 7) List Keynumbers\n");
X printf(" 3) List Email addresses 8) List ALL entries\n");
X printf(" 4) List Systems\n");
X printf("\nEnter choice :");
X scanf("%s",str);
X if(isanumber(str)) {
X choice = atoi(str);
X switch(choice) {
X case 0 : done = 1;
X break;
X
X case 1 : printf("Enter Entry Number to list:");
X scanf("%d",&choice);
X if((choice < 0) || (choice > numentries-1)){
X printf("There aren't that many entries!\n");
X break;
X }
X curr = head;
X for(i = 0;i < choice;i++) /* scan through the list till found */
X curr = curr -> next;
X printf("Entry %d\n", choice);
X liststr("Name:",curr -> name);
X liststr("Email:",curr -> email);
X liststr("System:",curr -> system);
X listint(curr);
X liststr("Comment:",curr -> comment);
X break;
X
X case 2 : curr = head;
X i = 0;
X while(curr != NULL) {
X sprintf(str,"%d. ",i++);
X liststr(str,curr -> name);
X curr = curr -> next;
X }
X break;
X
X case 3 : curr = head;
X i = 0;
X while(curr != NULL) {
X sprintf(str,"%d. ",i++);
X liststr(str,curr -> email);
X curr = curr -> next;
X }
X break;
X
X case 4 : curr = head;
X i = 0;
X while(curr != NULL) {
X sprintf(str,"%d. ",i++);
X liststr(str,curr -> system);
X curr = curr -> next;
X }
X break;
X
X case 5 : curr = head;
X i = 0;
X while(curr != NULL) {
X sprintf(str,"%d. ",i++);
X liststr(str,curr -> comment);
X curr = curr -> next;
X }
X break;
X
X case 6 : printf("Enter Key Number to search for:");
X scanf("%f",&search);
X searchfor(search);
X break;
X
X case 7 : listkeys();
X break;
X
X case 8 : curr = head;
X i = 0;
X while(curr != NULL) {
X printf("---------------------------------------------------------------------------\n");
X printf("Entry %d\n", i++);
X liststr("Name:",curr -> name);
X liststr("Email:",curr -> email);
X liststr("System:",curr -> system);
X listint(curr);
X liststr("Comment:",curr -> comment);
X curr = curr -> next;
X }
X break;
X
X default: break;
X }
X }
X }
X return(1);
X}
X
END_OF_FILE
if test 2992 -ne `wc -c <'auc.c'`; then
echo shar: \"'auc.c'\" unpacked with wrong size!
fi
# end of 'auc.c'
fi
if test -f 'defs.h' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'defs.h'\"
else
echo shar: Extracting \"'defs.h'\" \(375 characters\)
sed "s/^X//" >'defs.h' <<'END_OF_FILE'
X/* set the right system type before compiling */
X
X#define UNIX 1
X#define VMS 0
X
X
X#define AUCDATAFILE "auc.dat"
X#define MAXNUMKEYS 50
X
Xtypedef struct dummy0 {
X float num;
X char *title;
X char *description;
X} key_struct;
X
Xtypedef struct dummy1 {
X char *name;
X char *email;
X char *system;
X int numkeys;
X float *keys;
X char *comment;
X struct dummy1 *next;
X} entry;
X
X
END_OF_FILE
if test 375 -ne `wc -c <'defs.h'`; then
echo shar: \"'defs.h'\" unpacked with wrong size!
fi
# end of 'defs.h'
fi
if test -f 'extern.h' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'extern.h'\"
else
echo shar: Extracting \"'extern.h'\" \(97 characters\)
sed "s/^X//" >'extern.h' <<'END_OF_FILE'
Xextern entry *head, *curr, *temp;
Xextern int numentries, longest;
Xextern key_struct keywords[];
X
END_OF_FILE
if test 97 -ne `wc -c <'extern.h'`; then
echo shar: \"'extern.h'\" unpacked with wrong size!
fi
# end of 'extern.h'
fi
if test -f 'gen.c' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'gen.c'\"
else
echo shar: Extracting \"'gen.c'\" \(1172 characters\)
sed "s/^X//" >'gen.c' <<'END_OF_FILE'
X#include "include.h"
X#include "extern.h"
X
Xchar *
Xgenchar(n)
Xint n;
X{
X#if UNIX
X char *malloc();
X#endif
X#if VMS
X void *malloc();
X#endif
X
X char *dummy, *end;
X register char *c;
X
X#if UNIX
X dummy = malloc(sizeof(char) * n);
X#endif
X#if VMS
X dummy = (char*) malloc(sizeof(char) * n);
X#endif
X
X if(dummy == NULL) {
X printf("Not enough memory. Exiting\n");
X exit(-1);
X }
X end = dummy + (n*sizeof(char));
X for(c = dummy; c < end; c++)
X *c = 0;
X return(dummy);
X}
X
Xentry *
Xgenentry()
X{
X char *genchar();
X entry *dummy;
X register int i;
X
X dummy = (entry *) malloc(sizeof(entry));
X if(dummy == NULL) {
X printf("Not enough memory. Exiting\n");
X exit(-1);
X }
X dummy -> name = NULL;
X dummy -> email = NULL;
X dummy -> system = NULL;
X dummy -> numkeys = 0;
X dummy -> keys = NULL;
X dummy -> comment = NULL;
X dummy -> next = NULL;
X return(dummy);
X}
X
X
Xfreeall()
X{
X register int i;
X
X printf("Cleaning up..\n");
X curr = head;
X while(curr != NULL) {
X free(curr -> name);
X free(curr -> email);
X free(curr -> system);
X for(i = 0; i < curr -> numkeys; i++)
X free(curr -> keys[i]);
X free(curr -> numkeys);
X free(curr -> comment);
X free(curr);
X curr = curr -> next;
X }
X}
X
END_OF_FILE
if test 1172 -ne `wc -c <'gen.c'`; then
echo shar: \"'gen.c'\" unpacked with wrong size!
fi
# end of 'gen.c'
fi
if test -f 'include.h' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'include.h'\"
else
echo shar: Extracting \"'include.h'\" \(57 characters\)
sed "s/^X//" >'include.h' <<'END_OF_FILE'
X#include <stdio.h>
X#include <ctype.h>
X#include "defs.h"
X
END_OF_FILE
if test 57 -ne `wc -c <'include.h'`; then
echo shar: \"'include.h'\" unpacked with wrong size!
fi
# end of 'include.h'
fi
if test -f 'keys.h' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'keys.h'\"
else
echo shar: Extracting \"'keys.h'\" \(2717 characters\)
sed "s/^X//" >'keys.h' <<'END_OF_FILE'
Xkey_struct keywords[] = {
X { 1.0,"Telecommunications","General" },
X { 1.1,"Sysoping","I run a bbs, I would like to run a bbs" },
X { 1.2,"BBS","General. Can answer most questions about a bbs." },
X { 1.3,"Protocols","Know abouy XYZ-modem etc." },
X { 1.4,"FidoNet Finatic","I might be able to help set one up for you" },
X { 2.0,"Business","General" },
X { 2.1,"Accounting","Spreadsheets, finance packages etc." },
X { 2.2,"DataBases","SuperBase, etc." },
X { 3.0,"Word Processing","General" },
X { 3.1,"Desktop Publishing","Info on packages, WordPerfect, etc." },
X { 4.0,"Desktop Video","Using commercial packages, genlock, etc." },
X { 5.0,"Games","General" },
X { 5.1,"Action","shoot-em-up games, Emerald Mine, cheats, etc." },
X { 5.2,"Adventure","Dungeon Master, Deja-vu, spoilers, etc." },
X { 5.3,"Designing","ideas, algorithms, what is needed to do this? etc." },
X { 5.4,"Educational","math helpers, typing tutors, etc." },
X { 5.5,"Simulation","Falcon, Jet, Sub simulations, Simcity, etc." },
X { 6.0,"Graphics","General" },
X { 6.1,"Animation","using commercial packages, asking for objects, etc." },
X { 6.2,"Art","pictures, Digi-paint, Deluxe Paint, etc." },
X { 6.3,"Overview","ray-tracing, bump maps, texturing, A-Buffer, etc." },
X { 7.0,"Hardware","General" },
X { 7.1,"500","500 specific hardware, problems with the 500" },
X { 7.2,"1000","1000 specific hardware, problems with the 1000" },
X { 7.3,"2000","2000 specific hardware, problems with the 2000" },
X { 7.4,"Designing","Will this design work? " },
X { 7.5,"Drives","hard, floppy, controllers, partitioning, etc." },
X { 7.6,"Expansion","memory, Co-processor, serial, midi cards etc." },
X { 7.7,"Monitor","cables, Sony monitors, cleaning, etc." },
X { 7.8,"Printers","drivers, ribbons, etc." },
X { 7.9,"Networking","how to set up one. would like to talk about it." },
X { 8.0,"Mail Order","dealings with,horror stories,excellent deals, etc." },
X { 9.0,"Music","General" },
X { 9.1,"Midi","hardware setup for midi, Dr T series, etc." },
X { 9.2,"Playing","using commercial packages, DCMS, Sonix, etc." },
X {10.0,"PD Software","General" },
X {10.1,"Fish Disks","What is on disk 132?" },
X {10.2,"Other","Where can I find fonts? I have fonts, etc." },
X {11.0,"Programming","General" },
X {11.1,"ARexx","Rexx, how do I send a file to rexxcomm?" },
X {11.2,"Asm","how do I read the keyboard in asm?" },
X {11.3,"C","how do I open a font? how do you open a file?" },
X {11.4,"Graphics","Amiga specific, bobs, sprites, etc." },
X {11.5,"Other","Pascal, Modula2, C++, etc." },
X {11.6,"Sound","Amiga specific, how do you play a note?" },
X {11.7,"Utilities","GOMF, PowerWindows, etc." },
X {11.8,"Basic","Programs and such. " },
X { 0 },
X};
END_OF_FILE
if test 2717 -ne `wc -c <'keys.h'`; then
echo shar: \"'keys.h'\" unpacked with wrong size!
fi
# end of 'keys.h'
fi
if test -f 'main.c' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'main.c'\"
else
echo shar: Extracting \"'main.c'\" \(370 characters\)
sed "s/^X//" >'main.c' <<'END_OF_FILE'
X#include "include.h"
X#include "keys.h"
X
Xentry *head, *curr, *temp;
Xint numentries, longest;
X
Xmain()
X{
X key_struct *key;
X
X head = NULL;
X curr = NULL;
X temp = NULL;
X numentries = 0;
X longest = 0;
X
X for(key = keywords;(key -> num != 0.0); key++)
X if(strlen(key -> title) > longest)
X longest = strlen(key -> title);
X
X readdatafile();
X auc();
X freeall();
X exit(0);
X}
X
END_OF_FILE
if test 370 -ne `wc -c <'main.c'`; then
echo shar: \"'main.c'\" unpacked with wrong size!
fi
# end of 'main.c'
fi
if test -f 'makefile' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'makefile'\"
else
echo shar: Extracting \"'makefile'\" \(354 characters\)
sed "s/^X//" >'makefile' <<'END_OF_FILE'
X# don't forget to set the system type in defs.h
X
XFILES = main.o gen.o util.o auc.o readdatafile.o
XCFLAGS =
X
Xauc: $(FILES)
X ln $(CFLAGS) -o auc $(FILES) -lm -lc
X
X
X# If you are running this from a VMS system use the following
X# for your makefile
X#
X#FILES = main.obj,gen.obj,util.obj,auc.obj,readdatafile.obj
X#
X#
X#auc: $(FILES)
X# link/exe=auc $(FILES)
X
X
END_OF_FILE
if test 354 -ne `wc -c <'makefile'`; then
echo shar: \"'makefile'\" unpacked with wrong size!
fi
# end of 'makefile'
fi
if test -f 'readdatafile.c' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'readdatafile.c'\"
else
echo shar: Extracting \"'readdatafile.c'\" \(2149 characters\)
sed "s/^X//" >'readdatafile.c' <<'END_OF_FILE'
X#include "include.h"
X#include "extern.h"
X
Xreaddatafile()
X{
X FILE *fp;
X char str[256], str1[256], *tmp, *ptr, *getline(), *genchar();
X int done = 0;
X register int i, keynum;
X entry *genentry();
X float key, atof(), tmpkeylist[MAXNUMKEYS];
X
X fp = fopen(AUCDATAFILE, "r");
X if(fp == NULL) {
X printf("Cannot open %s for read. Exiting.\n");
X exit(-1);
X }
X
X while(!done) {
X tmp = getline(str,fp); /* get name of entry */
X numentries++; /* inc number of entries */
X if(tmp) {
X temp = genentry(); /* create a new entry */
X
X if(head == NULL) { /* if first entry, initialize list */
X head = temp;
X curr = head;
X }
X else
X curr -> next = temp;
X curr = temp;
X curr -> name = genchar(strlen(str) + 1);
X strcpy(curr -> name, str);
X }
X else
X done = 1;
X
X if(!done)
X tmp = getline(str,fp); /* get email address of entry */
X if(tmp) {
X curr -> email = genchar(strlen(str) + 1);
X strcpy(curr -> email, str);
X }
X else
X done = 1;
X
X if(!done)
X tmp = getline(str,fp); /* get system desc of entry */
X if(tmp) {
X curr -> system = genchar(strlen(str) + 1);
X strcpy(curr -> system, str);
X }
X else
X done = 1;
X
X if(!done)
X tmp = getline(str,fp); /* get keycodes of entry */
X if(tmp) {
X done = 1; /* done = 1 if key read, else 0 */
X keynum = 0;
X ptr = str;
X while(done > 0) {
X done = sscanf(ptr,"%s",str1);
X if(done > 0) {
X sscanf(str1,"%f",&tmpkeylist[keynum++]);
X ptr += (strlen(str1) + 1);
X }
X if(keynum == MAXNUMKEYS) {
X done = -1;
X printf("To many interests encountered for %s.\n",curr -> name);
X }
X }
X done = 0;
X }
X else
X done = 1;
X
X curr -> keys = (float *) genchar(sizeof(float)*keynum);
X curr -> numkeys = keynum;
X for(i = 0; i < keynum; i++) {
X curr -> keys[i] = tmpkeylist[i];
X }
X
X if(!done)
X tmp = getline(str,fp); /* get comment of entry */
X if(tmp) {
X curr -> comment = genchar(strlen(str) + 1);
X strcpy(curr -> comment, str);
X }
X else
X done = 1;
X }
X fclose(fp);
X}
X
END_OF_FILE
if test 2149 -ne `wc -c <'readdatafile.c'`; then
echo shar: \"'readdatafile.c'\" unpacked with wrong size!
fi
# end of 'readdatafile.c'
fi
if test -f 'util.c' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'util.c'\"
else
echo shar: Extracting \"'util.c'\" \(2377 characters\)
sed "s/^X//" >'util.c' <<'END_OF_FILE'
X#include "include.h"
X#include "extern.h"
X
Xchar *
Xgetline(str,fp)
Xchar *str;
XFILE *fp;
X{
X /* get a line from a file. */
X /* skip over blank lines */
X char *tmp;
X char *fgets();
X
X do {
X tmp = fgets(str,256,fp);
X }
X while((tmp) && (*tmp != EOF) && (*tmp == '\n'));
X
X if(tmp)
X if(*tmp)
X str[strlen(str)-1] = 0;
X return(tmp);
X}
X
Xliststr(title, str)
Xchar *title, *str;
X{
X printf("%s",title);
X printf("%s\n",str);
X}
X
Xprspaces(n)
Xint n;
X{
X for(;n;n--)
X printf(" ");
X}
X
Xsearchfor(num)
Xfloat num;
X{
X int done;
X int entrynum = -1;
X int found = 0;
X register int i;
X
X curr = head;
X printf("Found matches in Entries:");
X while(curr != NULL) {
X done = 0;
X entrynum++;
X for(i = 0;((i < MAXNUMKEYS) && (!done)); i++) {
X if(curr -> keys[i] == 0.0)
X done = 1;
X else
X if(num == curr -> keys[i]) {
X printf("%d ", entrynum);
X found = 1;
X done = 1;
X }
X }
X curr = curr -> next;
X }
X if(!found)
X printf("None.");
X printf("\n");
X}
X
Xlistkeys()
X{
X key_struct *key;
X char str[256], out[256];
X int area1, area2;
X
X area1 = area2 = 0;
X for(key = keywords;(key -> num != 0.0); key++) {
X pad(str, key -> title, longest);
X sprintf(out,"%2.2f %s %s\n",key -> num, str, key -> description);
X sscanf(out,"%d",&area2);
X if(area1 == area2)
X printf(" ");
X else
X area1 = area2;
X printf("%s",out);
X }
X}
X
X
Xlistint(tmp)
Xentry *tmp;
X{
X key_struct *key;
X register int i;
X int done, len = 0;
X char str[80];
X
X for(key = keywords;(key -> num != 0.0); key++) {
X done = 0;
X for(i = 0;((i < tmp -> numkeys) && (!done)); i++) {
X if(tmp -> keys[i] == 0.0)
X done = 1;
X else
X if(key -> num == tmp -> keys[i]) {
X sprintf(str,"%.2f %-25s ", key -> num, key -> title);
X len += 25;
X str[25] = 0;
X if(len > 80) {
X printf("\n%s",str);
X len = strlen(str);
X }
X else
X printf("%s",str);
X }
X }
X }
X printf("\n");
X}
X
X/* ---------------------------------------------------------------------- */
X/* returns true if the entire string passed is a number */
Xisanumber(str)
Xchar *str;
X{
X char *c;
X
X c = str;
X while(*c) {
X if(!isdigit(*c))
X return(0);
X c++;
X }
X return(1);
X}
X
Xpad(str1, str2, len)
Xchar *str1, *str2;
Xint len;
X{
X register int i;
X
X for(i = 0; (i < strlen(str2)) && (i < len); i++)
X str1[i] = str2[i];
X
X for(;i<len;i++)
X str1[i] = ' ';
X
X str1[i] = 0;
X}
X
END_OF_FILE
if test 2377 -ne `wc -c <'util.c'`; then
echo shar: \"'util.c'\" unpacked with wrong size!
fi
# end of 'util.c'
fi
echo shar: End of shell archive.
exit 0
___________________________________________/No man is a failure who has friends
Trevor Paquette ICBM:51'03"N/114'05"W|I accept the challange, body and soul,
{ubc-cs,utai,alberta}!calgary!paquette|to seek the knowledge of the ones of old
paquette@cpsc.ucalgary.ca | - engraved on the Kersa Blade of Esalonpaquette@cpsc.ucalgary.ca (Trevor Paquette) (03/07/90)
#! /bin/sh
# This is a shell archive. Remove anything before this line, then unpack
# it by saving it into a file and typing "sh file". To overwrite existing
# files, type "sh file -c". You can also feed this as standard input via
# unshar, or by typing "sh <file", e.g.. If this archive is complete, you
# will see the following message at the end:
# "End of shell archive."
# Contents: README auc.c defs.h extern.h gen.c include.h keys.h main.c
# makefile readdatafile.c util.c
# Wrapped by paquette@cpsc.UCalgary.CA on Tue Mar 6 08:02:53 1990
PATH=/bin:/usr/bin:/usr/ucb ; export PATH
if test -f 'README' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'README'\"
else
echo shar: Extracting \"'README'\" \(682 characters\)
sed "s/^X//" >'README' <<'END_OF_FILE'
X This program is cheesy at best. VERY simplistic but it works.
X It runs on a SparcStation 1 and with some mods should go on the
X Amiga. Anyone want to Intuitize it??? Please?
X
X Little or no comments are provided, most of the code is very
X straight forward. Don't forget to change the machine definition in defs.h
X
X Trev
X Comments, questions, flames to
X___________________________________________/No man is a failure who has friends
XTrevor Paquette ICBM:51'03"N/114'05"W|I accept the challange, body and soul,
X{ubc-cs,utai,alberta}!calgary!paquette|to seek the knowledge of the ones of old
Xpaquette@cpsc.ucalgary.ca | - engraved on the Kersa Blade of Esalon
END_OF_FILE
if test 682 -ne `wc -c <'README'`; then
echo shar: \"'README'\" unpacked with wrong size!
fi
# end of 'README'
fi
if test -f 'auc.c' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'auc.c'\"
else
echo shar: Extracting \"'auc.c'\" \(2992 characters\)
sed "s/^X//" >'auc.c' <<'END_OF_FILE'
X#include "include.h"
X#include "extern.h"
X
Xauc()
X{
X int done = 0;
X int choice = 0;
X int i;
X char str[256];
X float search;
X
X while(!done) {
X printf("\nChoose one of the following\n");
X printf(" 0) Exit 5) List Comments\n");
X printf(" 1) List Entry 6) Search Entries for a Keynumber\n");
X printf(" 2) List Names 7) List Keynumbers\n");
X printf(" 3) List Email addresses 8) List ALL entries\n");
X printf(" 4) List Systems\n");
X printf("\nEnter choice :");
X scanf("%s",str);
X if(isanumber(str)) {
X choice = atoi(str);
X switch(choice) {
X case 0 : done = 1;
X break;
X
X case 1 : printf("Enter Entry Number to list:");
X scanf("%d",&choice);
X if((choice < 0) || (choice > numentries-1)){
X printf("There aren't that many entries!\n");
X break;
X }
X curr = head;
X for(i = 0;i < choice;i++) /* scan through the list till found */
X curr = curr -> next;
X printf("Entry %d\n", choice);
X liststr("Name:",curr -> name);
X liststr("Email:",curr -> email);
X liststr("System:",curr -> system);
X listint(curr);
X liststr("Comment:",curr -> comment);
X break;
X
X case 2 : curr = head;
X i = 0;
X while(curr != NULL) {
X sprintf(str,"%d. ",i++);
X liststr(str,curr -> name);
X curr = curr -> next;
X }
X break;
X
X case 3 : curr = head;
X i = 0;
X while(curr != NULL) {
X sprintf(str,"%d. ",i++);
X liststr(str,curr -> email);
X curr = curr -> next;
X }
X break;
X
X case 4 : curr = head;
X i = 0;
X while(curr != NULL) {
X sprintf(str,"%d. ",i++);
X liststr(str,curr -> system);
X curr = curr -> next;
X }
X break;
X
X case 5 : curr = head;
X i = 0;
X while(curr != NULL) {
X sprintf(str,"%d. ",i++);
X liststr(str,curr -> comment);
X curr = curr -> next;
X }
X break;
X
X case 6 : printf("Enter Key Number to search for:");
X scanf("%f",&search);
X searchfor(search);
X break;
X
X case 7 : listkeys();
X break;
X
X case 8 : curr = head;
X i = 0;
X while(curr != NULL) {
X printf("---------------------------------------------------------------------------\n");
X printf("Entry %d\n", i++);
X liststr("Name:",curr -> name);
X liststr("Email:",curr -> email);
X liststr("System:",curr -> system);
X listint(curr);
X liststr("Comment:",curr -> comment);
X curr = curr -> next;
X }
X break;
X
X default: break;
X }
X }
X }
X return(1);
X}
X
END_OF_FILE
if test 2992 -ne `wc -c <'auc.c'`; then
echo shar: \"'auc.c'\" unpacked with wrong size!
fi
# end of 'auc.c'
fi
if test -f 'defs.h' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'defs.h'\"
else
echo shar: Extracting \"'defs.h'\" \(375 characters\)
sed "s/^X//" >'defs.h' <<'END_OF_FILE'
X/* set the right system type before compiling */
X
X#define UNIX 1
X#define VMS 0
X
X
X#define AUCDATAFILE "auc.dat"
X#define MAXNUMKEYS 50
X
Xtypedef struct dummy0 {
X float num;
X char *title;
X char *description;
X} key_struct;
X
Xtypedef struct dummy1 {
X char *name;
X char *email;
X char *system;
X int numkeys;
X float *keys;
X char *comment;
X struct dummy1 *next;
X} entry;
X
X
END_OF_FILE
if test 375 -ne `wc -c <'defs.h'`; then
echo shar: \"'defs.h'\" unpacked with wrong size!
fi
# end of 'defs.h'
fi
if test -f 'extern.h' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'extern.h'\"
else
echo shar: Extracting \"'extern.h'\" \(97 characters\)
sed "s/^X//" >'extern.h' <<'END_OF_FILE'
Xextern entry *head, *curr, *temp;
Xextern int numentries, longest;
Xextern key_struct keywords[];
X
END_OF_FILE
if test 97 -ne `wc -c <'extern.h'`; then
echo shar: \"'extern.h'\" unpacked with wrong size!
fi
# end of 'extern.h'
fi
if test -f 'gen.c' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'gen.c'\"
else
echo shar: Extracting \"'gen.c'\" \(1172 characters\)
sed "s/^X//" >'gen.c' <<'END_OF_FILE'
X#include "include.h"
X#include "extern.h"
X
Xchar *
Xgenchar(n)
Xint n;
X{
X#if UNIX
X char *malloc();
X#endif
X#if VMS
X void *malloc();
X#endif
X
X char *dummy, *end;
X register char *c;
X
X#if UNIX
X dummy = malloc(sizeof(char) * n);
X#endif
X#if VMS
X dummy = (char*) malloc(sizeof(char) * n);
X#endif
X
X if(dummy == NULL) {
X printf("Not enough memory. Exiting\n");
X exit(-1);
X }
X end = dummy + (n*sizeof(char));
X for(c = dummy; c < end; c++)
X *c = 0;
X return(dummy);
X}
X
Xentry *
Xgenentry()
X{
X char *genchar();
X entry *dummy;
X register int i;
X
X dummy = (entry *) malloc(sizeof(entry));
X if(dummy == NULL) {
X printf("Not enough memory. Exiting\n");
X exit(-1);
X }
X dummy -> name = NULL;
X dummy -> email = NULL;
X dummy -> system = NULL;
X dummy -> numkeys = 0;
X dummy -> keys = NULL;
X dummy -> comment = NULL;
X dummy -> next = NULL;
X return(dummy);
X}
X
X
Xfreeall()
X{
X register int i;
X
X printf("Cleaning up..\n");
X curr = head;
X while(curr != NULL) {
X free(curr -> name);
X free(curr -> email);
X free(curr -> system);
X for(i = 0; i < curr -> numkeys; i++)
X free(curr -> keys[i]);
X free(curr -> numkeys);
X free(curr -> comment);
X free(curr);
X curr = curr -> next;
X }
X}
X
END_OF_FILE
if test 1172 -ne `wc -c <'gen.c'`; then
echo shar: \"'gen.c'\" unpacked with wrong size!
fi
# end of 'gen.c'
fi
if test -f 'include.h' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'include.h'\"
else
echo shar: Extracting \"'include.h'\" \(57 characters\)
sed "s/^X//" >'include.h' <<'END_OF_FILE'
X#include <stdio.h>
X#include <ctype.h>
X#include "defs.h"
X
END_OF_FILE
if test 57 -ne `wc -c <'include.h'`; then
echo shar: \"'include.h'\" unpacked with wrong size!
fi
# end of 'include.h'
fi
if test -f 'keys.h' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'keys.h'\"
else
echo shar: Extracting \"'keys.h'\" \(2717 characters\)
sed "s/^X//" >'keys.h' <<'END_OF_FILE'
Xkey_struct keywords[] = {
X { 1.0,"Telecommunications","General" },
X { 1.1,"Sysoping","I run a bbs, I would like to run a bbs" },
X { 1.2,"BBS","General. Can answer most questions about a bbs." },
X { 1.3,"Protocols","Know abouy XYZ-modem etc." },
X { 1.4,"FidoNet Finatic","I might be able to help set one up for you" },
X { 2.0,"Business","General" },
X { 2.1,"Accounting","Spreadsheets, finance packages etc." },
X { 2.2,"DataBases","SuperBase, etc." },
X { 3.0,"Word Processing","General" },
X { 3.1,"Desktop Publishing","Info on packages, WordPerfect, etc." },
X { 4.0,"Desktop Video","Using commercial packages, genlock, etc." },
X { 5.0,"Games","General" },
X { 5.1,"Action","shoot-em-up games, Emerald Mine, cheats, etc." },
X { 5.2,"Adventure","Dungeon Master, Deja-vu, spoilers, etc." },
X { 5.3,"Designing","ideas, algorithms, what is needed to do this? etc." },
X { 5.4,"Educational","math helpers, typing tutors, etc." },
X { 5.5,"Simulation","Falcon, Jet, Sub simulations, Simcity, etc." },
X { 6.0,"Graphics","General" },
X { 6.1,"Animation","using commercial packages, asking for objects, etc." },
X { 6.2,"Art","pictures, Digi-paint, Deluxe Paint, etc." },
X { 6.3,"Overview","ray-tracing, bump maps, texturing, A-Buffer, etc." },
X { 7.0,"Hardware","General" },
X { 7.1,"500","500 specific hardware, problems with the 500" },
X { 7.2,"1000","1000 specific hardware, problems with the 1000" },
X { 7.3,"2000","2000 specific hardware, problems with the 2000" },
X { 7.4,"Designing","Will this design work? " },
X { 7.5,"Drives","hard, floppy, controllers, partitioning, etc." },
X { 7.6,"Expansion","memory, Co-processor, serial, midi cards etc." },
X { 7.7,"Monitor","cables, Sony monitors, cleaning, etc." },
X { 7.8,"Printers","drivers, ribbons, etc." },
X { 7.9,"Networking","how to set up one. would like to talk about it." },
X { 8.0,"Mail Order","dealings with,horror stories,excellent deals, etc." },
X { 9.0,"Music","General" },
X { 9.1,"Midi","hardware setup for midi, Dr T series, etc." },
X { 9.2,"Playing","using commercial packages, DCMS, Sonix, etc." },
X {10.0,"PD Software","General" },
X {10.1,"Fish Disks","What is on disk 132?" },
X {10.2,"Other","Where can I find fonts? I have fonts, etc." },
X {11.0,"Programming","General" },
X {11.1,"ARexx","Rexx, how do I send a file to rexxcomm?" },
X {11.2,"Asm","how do I read the keyboard in asm?" },
X {11.3,"C","how do I open a font? how do you open a file?" },
X {11.4,"Graphics","Amiga specific, bobs, sprites, etc." },
X {11.5,"Other","Pascal, Modula2, C++, etc." },
X {11.6,"Sound","Amiga specific, how do you play a note?" },
X {11.7,"Utilities","GOMF, PowerWindows, etc." },
X {11.8,"Basic","Programs and such. " },
X { 0 },
X};
END_OF_FILE
if test 2717 -ne `wc -c <'keys.h'`; then
echo shar: \"'keys.h'\" unpacked with wrong size!
fi
# end of 'keys.h'
fi
if test -f 'main.c' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'main.c'\"
else
echo shar: Extracting \"'main.c'\" \(370 characters\)
sed "s/^X//" >'main.c' <<'END_OF_FILE'
X#include "include.h"
X#include "keys.h"
X
Xentry *head, *curr, *temp;
Xint numentries, longest;
X
Xmain()
X{
X key_struct *key;
X
X head = NULL;
X curr = NULL;
X temp = NULL;
X numentries = 0;
X longest = 0;
X
X for(key = keywords;(key -> num != 0.0); key++)
X if(strlen(key -> title) > longest)
X longest = strlen(key -> title);
X
X readdatafile();
X auc();
X freeall();
X exit(0);
X}
X
END_OF_FILE
if test 370 -ne `wc -c <'main.c'`; then
echo shar: \"'main.c'\" unpacked with wrong size!
fi
# end of 'main.c'
fi
if test -f 'makefile' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'makefile'\"
else
echo shar: Extracting \"'makefile'\" \(354 characters\)
sed "s/^X//" >'makefile' <<'END_OF_FILE'
X# don't forget to set the system type in defs.h
X
XFILES = main.o gen.o util.o auc.o readdatafile.o
XCFLAGS =
X
Xauc: $(FILES)
X ln $(CFLAGS) -o auc $(FILES) -lm -lc
X
X
X# If you are running this from a VMS system use the following
X# for your makefile
X#
X#FILES = main.obj,gen.obj,util.obj,auc.obj,readdatafile.obj
X#
X#
X#auc: $(FILES)
X# link/exe=auc $(FILES)
X
X
END_OF_FILE
if test 354 -ne `wc -c <'makefile'`; then
echo shar: \"'makefile'\" unpacked with wrong size!
fi
# end of 'makefile'
fi
if test -f 'readdatafile.c' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'readdatafile.c'\"
else
echo shar: Extracting \"'readdatafile.c'\" \(2149 characters\)
sed "s/^X//" >'readdatafile.c' <<'END_OF_FILE'
X#include "include.h"
X#include "extern.h"
X
Xreaddatafile()
X{
X FILE *fp;
X char str[256], str1[256], *tmp, *ptr, *getline(), *genchar();
X int done = 0;
X register int i, keynum;
X entry *genentry();
X float key, atof(), tmpkeylist[MAXNUMKEYS];
X
X fp = fopen(AUCDATAFILE, "r");
X if(fp == NULL) {
X printf("Cannot open %s for read. Exiting.\n");
X exit(-1);
X }
X
X while(!done) {
X tmp = getline(str,fp); /* get name of entry */
X numentries++; /* inc number of entries */
X if(tmp) {
X temp = genentry(); /* create a new entry */
X
X if(head == NULL) { /* if first entry, initialize list */
X head = temp;
X curr = head;
X }
X else
X curr -> next = temp;
X curr = temp;
X curr -> name = genchar(strlen(str) + 1);
X strcpy(curr -> name, str);
X }
X else
X done = 1;
X
X if(!done)
X tmp = getline(str,fp); /* get email address of entry */
X if(tmp) {
X curr -> email = genchar(strlen(str) + 1);
X strcpy(curr -> email, str);
X }
X else
X done = 1;
X
X if(!done)
X tmp = getline(str,fp); /* get system desc of entry */
X if(tmp) {
X curr -> system = genchar(strlen(str) + 1);
X strcpy(curr -> system, str);
X }
X else
X done = 1;
X
X if(!done)
X tmp = getline(str,fp); /* get keycodes of entry */
X if(tmp) {
X done = 1; /* done = 1 if key read, else 0 */
X keynum = 0;
X ptr = str;
X while(done > 0) {
X done = sscanf(ptr,"%s",str1);
X if(done > 0) {
X sscanf(str1,"%f",&tmpkeylist[keynum++]);
X ptr += (strlen(str1) + 1);
X }
X if(keynum == MAXNUMKEYS) {
X done = -1;
X printf("To many interests encountered for %s.\n",curr -> name);
X }
X }
X done = 0;
X }
X else
X done = 1;
X
X curr -> keys = (float *) genchar(sizeof(float)*keynum);
X curr -> numkeys = keynum;
X for(i = 0; i < keynum; i++) {
X curr -> keys[i] = tmpkeylist[i];
X }
X
X if(!done)
X tmp = getline(str,fp); /* get comment of entry */
X if(tmp) {
X curr -> comment = genchar(strlen(str) + 1);
X strcpy(curr -> comment, str);
X }
X else
X done = 1;
X }
X fclose(fp);
X}
X
END_OF_FILE
if test 2149 -ne `wc -c <'readdatafile.c'`; then
echo shar: \"'readdatafile.c'\" unpacked with wrong size!
fi
# end of 'readdatafile.c'
fi
if test -f 'util.c' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'util.c'\"
else
echo shar: Extracting \"'util.c'\" \(2377 characters\)
sed "s/^X//" >'util.c' <<'END_OF_FILE'
X#include "include.h"
X#include "extern.h"
X
Xchar *
Xgetline(str,fp)
Xchar *str;
XFILE *fp;
X{
X /* get a line from a file. */
X /* skip over blank lines */
X char *tmp;
X char *fgets();
X
X do {
X tmp = fgets(str,256,fp);
X }
X while((tmp) && (*tmp != EOF) && (*tmp == '\n'));
X
X if(tmp)
X if(*tmp)
X str[strlen(str)-1] = 0;
X return(tmp);
X}
X
Xliststr(title, str)
Xchar *title, *str;
X{
X printf("%s",title);
X printf("%s\n",str);
X}
X
Xprspaces(n)
Xint n;
X{
X for(;n;n--)
X printf(" ");
X}
X
Xsearchfor(num)
Xfloat num;
X{
X int done;
X int entrynum = -1;
X int found = 0;
X register int i;
X
X curr = head;
X printf("Found matches in Entries:");
X while(curr != NULL) {
X done = 0;
X entrynum++;
X for(i = 0;((i < MAXNUMKEYS) && (!done)); i++) {
X if(curr -> keys[i] == 0.0)
X done = 1;
X else
X if(num == curr -> keys[i]) {
X printf("%d ", entrynum);
X found = 1;
X done = 1;
X }
X }
X curr = curr -> next;
X }
X if(!found)
X printf("None.");
X printf("\n");
X}
X
Xlistkeys()
X{
X key_struct *key;
X char str[256], out[256];
X int area1, area2;
X
X area1 = area2 = 0;
X for(key = keywords;(key -> num != 0.0); key++) {
X pad(str, key -> title, longest);
X sprintf(out,"%2.2f %s %s\n",key -> num, str, key -> description);
X sscanf(out,"%d",&area2);
X if(area1 == area2)
X printf(" ");
X else
X area1 = area2;
X printf("%s",out);
X }
X}
X
X
Xlistint(tmp)
Xentry *tmp;
X{
X key_struct *key;
X register int i;
X int done, len = 0;
X char str[80];
X
X for(key = keywords;(key -> num != 0.0); key++) {
X done = 0;
X for(i = 0;((i < tmp -> numkeys) && (!done)); i++) {
X if(tmp -> keys[i] == 0.0)
X done = 1;
X else
X if(key -> num == tmp -> keys[i]) {
X sprintf(str,"%.2f %-25s ", key -> num, key -> title);
X len += 25;
X str[25] = 0;
X if(len > 80) {
X printf("\n%s",str);
X len = strlen(str);
X }
X else
X printf("%s",str);
X }
X }
X }
X printf("\n");
X}
X
X/* ---------------------------------------------------------------------- */
X/* returns true if the entire string passed is a number */
Xisanumber(str)
Xchar *str;
X{
X char *c;
X
X c = str;
X while(*c) {
X if(!isdigit(*c))
X return(0);
X c++;
X }
X return(1);
X}
X
Xpad(str1, str2, len)
Xchar *str1, *str2;
Xint len;
X{
X register int i;
X
X for(i = 0; (i < strlen(str2)) && (i < len); i++)
X str1[i] = str2[i];
X
X for(;i<len;i++)
X str1[i] = ' ';
X
X str1[i] = 0;
X}
X
END_OF_FILE
if test 2377 -ne `wc -c <'util.c'`; then
echo shar: \"'util.c'\" unpacked with wrong size!
fi
# end of 'util.c'
fi
echo shar: End of shell archive.
exit 0
___________________________________________/No man is a failure who has friends
Trevor Paquette ICBM:51'03"N/114'05"W|I accept the challange, body and soul,
{ubc-cs,utai,alberta}!calgary!paquette|to seek the knowledge of the ones of old
paquette@cpsc.ucalgary.ca | - engraved on the Kersa Blade of Esalon