paquette@cpsc.ucalgary.ca (Trevor Paquette) (07/05/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: src src/README src/auc.c src/defs.h src/extern.h src/gen.c # src/include.h src/keys.h src/main.c src/makefile # src/readdatafile.c src/util.c # Wrapped by paquette@cpsc.UCalgary.CA on Thu Jul 5 07:54:59 1990 PATH=/bin:/usr/bin:/usr/ucb ; export PATH if test ! -d 'src' ; then echo shar: Creating directory \"'src'\" mkdir 'src' fi if test -f 'src/README' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'src/README'\" else echo shar: Extracting \"'src/README'\" \(660 characters\) sed "s/^X//" >'src/README' <<'END_OF_FILE' X This program is cheesy at best. VERY simplistic but it works. X It runs on a SparcStation 1, SGI, and the Amiga. Anyone want to Intuitize X 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 660 -ne `wc -c <'src/README'`; then echo shar: \"'src/README'\" unpacked with wrong size! fi # end of 'src/README' fi if test -f 'src/auc.c' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'src/auc.c'\" else echo shar: Extracting \"'src/auc.c'\" \(2992 characters\) sed "s/^X//" >'src/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 <'src/auc.c'`; then echo shar: \"'src/auc.c'\" unpacked with wrong size! fi # end of 'src/auc.c' fi if test -f 'src/defs.h' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'src/defs.h'\" else echo shar: Extracting \"'src/defs.h'\" \(392 characters\) sed "s/^X//" >'src/defs.h' <<'END_OF_FILE' X/* set the right system type before compiling */ X X#define UNIX 1 /* or Amiga */ 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 392 -ne `wc -c <'src/defs.h'`; then echo shar: \"'src/defs.h'\" unpacked with wrong size! fi # end of 'src/defs.h' fi if test -f 'src/extern.h' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'src/extern.h'\" else echo shar: Extracting \"'src/extern.h'\" \(97 characters\) sed "s/^X//" >'src/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 <'src/extern.h'`; then echo shar: \"'src/extern.h'\" unpacked with wrong size! fi # end of 'src/extern.h' fi if test -f 'src/gen.c' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'src/gen.c'\" else echo shar: Extracting \"'src/gen.c'\" \(1172 characters\) sed "s/^X//" >'src/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 <'src/gen.c'`; then echo shar: \"'src/gen.c'\" unpacked with wrong size! fi # end of 'src/gen.c' fi if test -f 'src/include.h' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'src/include.h'\" else echo shar: Extracting \"'src/include.h'\" \(57 characters\) sed "s/^X//" >'src/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 <'src/include.h'`; then echo shar: \"'src/include.h'\" unpacked with wrong size! fi # end of 'src/include.h' fi if test -f 'src/keys.h' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'src/keys.h'\" else echo shar: Extracting \"'src/keys.h'\" \(3027 characters\) sed "s/^X//" >'src/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 { 5.6,"Strategy","Shanghai, Empire, ChessMaster 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 {11.9,"Mathmatics","Calulators, algorithms, Maple, Mathmatica.." }, X {12.0,"User Groups"," " }, X {12.1,"Member","Member of an Amiga group" }, X {12.2,"Exec","Executive member" }, X {12.3,"Liason","Contact me to arrange communications between" }, X { 0 }, X}; END_OF_FILE if test 3027 -ne `wc -c <'src/keys.h'`; then echo shar: \"'src/keys.h'\" unpacked with wrong size! fi # end of 'src/keys.h' fi if test -f 'src/main.c' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'src/main.c'\" else echo shar: Extracting \"'src/main.c'\" \(370 characters\) sed "s/^X//" >'src/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 <'src/main.c'`; then echo shar: \"'src/main.c'\" unpacked with wrong size! fi # end of 'src/main.c' fi if test -f 'src/makefile' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'src/makefile'\" else echo shar: Extracting \"'src/makefile'\" \(437 characters\) sed "s/^X//" >'src/makefile' <<'END_OF_FILE' X# don't forget to set the system type in defs.h X#this makefile for Manx 3.6a 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 Xmain.o: main.c X cc $(CFLAGS) -Z 3072 -o main.o main.c 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 437 -ne `wc -c <'src/makefile'`; then echo shar: \"'src/makefile'\" unpacked with wrong size! fi # end of 'src/makefile' fi if test -f 'src/readdatafile.c' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'src/readdatafile.c'\" else echo shar: Extracting \"'src/readdatafile.c'\" \(2161 characters\) sed "s/^X//" >'src/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",AUCDATAFILE); 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 2161 -ne `wc -c <'src/readdatafile.c'`; then echo shar: \"'src/readdatafile.c'\" unpacked with wrong size! fi # end of 'src/readdatafile.c' fi if test -f 'src/util.c' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'src/util.c'\" else echo shar: Extracting \"'src/util.c'\" \(2377 characters\) sed "s/^X//" >'src/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 <'src/util.c'`; then echo shar: \"'src/util.c'\" unpacked with wrong size! fi # end of 'src/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
paquette@cs-sun-fsa.cpsc.ucalgary.ca (Trevor Paquette) (12/09/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: src src/README src/auc.c src/defs.h src/extern.h src/gen.c # src/include.h src/keys.h src/main.c src/makefile # src/readdatafile.c src/util.c # Wrapped by paquette@cpsc.UCalgary.CA on Thu Jul 5 07:54:59 1990 PATH=/bin:/usr/bin:/usr/ucb ; export PATH if test ! -d 'src' ; then echo shar: Creating directory \"'src'\" mkdir 'src' fi if test -f 'src/README' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'src/README'\" else echo shar: Extracting \"'src/README'\" \(660 characters\) sed "s/^X//" >'src/README' <<'END_OF_FILE' X This program is cheesy at best. VERY simplistic but it works. X It runs on a SparcStation 1, SGI, and the Amiga. Anyone want to Intuitize X 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 660 -ne `wc -c <'src/README'`; then echo shar: \"'src/README'\" unpacked with wrong size! fi # end of 'src/README' fi if test -f 'src/auc.c' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'src/auc.c'\" else echo shar: Extracting \"'src/auc.c'\" \(2992 characters\) sed "s/^X//" >'src/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 <'src/auc.c'`; then echo shar: \"'src/auc.c'\" unpacked with wrong size! fi # end of 'src/auc.c' fi if test -f 'src/defs.h' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'src/defs.h'\" else echo shar: Extracting \"'src/defs.h'\" \(392 characters\) sed "s/^X//" >'src/defs.h' <<'END_OF_FILE' X/* set the right system type before compiling */ X X#define UNIX 1 /* or Amiga */ 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 392 -ne `wc -c <'src/defs.h'`; then echo shar: \"'src/defs.h'\" unpacked with wrong size! fi # end of 'src/defs.h' fi if test -f 'src/extern.h' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'src/extern.h'\" else echo shar: Extracting \"'src/extern.h'\" \(97 characters\) sed "s/^X//" >'src/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 <'src/extern.h'`; then echo shar: \"'src/extern.h'\" unpacked with wrong size! fi # end of 'src/extern.h' fi if test -f 'src/gen.c' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'src/gen.c'\" else echo shar: Extracting \"'src/gen.c'\" \(1172 characters\) sed "s/^X//" >'src/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 <'src/gen.c'`; then echo shar: \"'src/gen.c'\" unpacked with wrong size! fi # end of 'src/gen.c' fi if test -f 'src/include.h' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'src/include.h'\" else echo shar: Extracting \"'src/include.h'\" \(57 characters\) sed "s/^X//" >'src/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 <'src/include.h'`; then echo shar: \"'src/include.h'\" unpacked with wrong size! fi # end of 'src/include.h' fi if test -f 'src/keys.h' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'src/keys.h'\" else echo shar: Extracting \"'src/keys.h'\" \(3027 characters\) sed "s/^X//" >'src/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 { 5.6,"Strategy","Shanghai, Empire, ChessMaster 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 {11.9,"Mathmatics","Calulators, algorithms, Maple, Mathmatica.." }, X {12.0,"User Groups"," " }, X {12.1,"Member","Member of an Amiga group" }, X {12.2,"Exec","Executive member" }, X {12.3,"Liason","Contact me to arrange communications between" }, X { 0 }, X}; END_OF_FILE if test 3027 -ne `wc -c <'src/keys.h'`; then echo shar: \"'src/keys.h'\" unpacked with wrong size! fi # end of 'src/keys.h' fi if test -f 'src/main.c' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'src/main.c'\" else echo shar: Extracting \"'src/main.c'\" \(370 characters\) sed "s/^X//" >'src/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 <'src/main.c'`; then echo shar: \"'src/main.c'\" unpacked with wrong size! fi # end of 'src/main.c' fi if test -f 'src/makefile' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'src/makefile'\" else echo shar: Extracting \"'src/makefile'\" \(437 characters\) sed "s/^X//" >'src/makefile' <<'END_OF_FILE' X# don't forget to set the system type in defs.h X#this makefile for Manx 3.6a 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 Xmain.o: main.c X cc $(CFLAGS) -Z 3072 -o main.o main.c 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 437 -ne `wc -c <'src/makefile'`; then echo shar: \"'src/makefile'\" unpacked with wrong size! fi # end of 'src/makefile' fi if test -f 'src/readdatafile.c' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'src/readdatafile.c'\" else echo shar: Extracting \"'src/readdatafile.c'\" \(2161 characters\) sed "s/^X//" >'src/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",AUCDATAFILE); 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 2161 -ne `wc -c <'src/readdatafile.c'`; then echo shar: \"'src/readdatafile.c'\" unpacked with wrong size! fi # end of 'src/readdatafile.c' fi if test -f 'src/util.c' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'src/util.c'\" else echo shar: Extracting \"'src/util.c'\" \(2377 characters\) sed "s/^X//" >'src/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 <'src/util.c'`; then echo shar: \"'src/util.c'\" unpacked with wrong size! fi # end of 'src/util.c' fi echo shar: End of shell archive. exit 0 -- ______________________________________/Through the darkness, the future past, Trevor Paquette ICBM:51'03"N/114'05"W|The magician longs to see. {ubc-cs,utai,alberta}!calgary!paquette|One chants out, between two worlds, paquette@cpsc.ucalgary.ca |"Fire, walk with me."