/* This program, written in ANSI C, is designed to be called by HTTPD, and return * data in HTML, readable by Mosaic. You must have HTTPD and Mosaic to use it. * The compiled program should be placed in the cgi-bin directory of your HTTPD * heirarchy. I MAKE NO CLAIMS AS TO PORTABILITY; ONLY TESTED ON SunOS 4.1.1, * COMPILED WITH GCC. * The unit descriptions must be named box%.unit#, where % represents a * box number in arbitary format, and # is the unit * number, unpadded. Clearly this must be changed for DOS. * The unit desired is passed to the program by the environment variable PATH_INFO, * and a leading slash is deleted. Thus e.g., a correct URL to call this program * to return the description of unit 9 would be: * http://hostname/cgi-bin/lithterp_html/9 * * You must make one modification: change the sprintf command below to * reflect the actual full path to the directory where you place the unit * descriptions. * * Version 2.0 6/17/94 File format changed; RQD moved to header; unused fields dropped. * Version 1.0 6/16/94 * Paul Asimow (paul@expet.gps.caltech.edu) */ #include #include #include #include #include void main() { FILE *fp1; char *buf, *data[100], instring[600], outstring[100]; char filename[20][50], *unitstring; int field,unit,i=0,j,k; int fd, activecomma; buf = (char *) malloc(sizeof(char)); unitstring = getenv("PATH_INFO"); /* Get the unit number as passed by */ unit = atoi(++unitstring); /* HTTPD and remove the slash */ /* Modify this line to reflect the full path of the directory where your data is */ sprintf(outstring, "ls /home2/httpd/httphome/units/box*.unit%d",unit); fp1 = popen(outstring, "r"); /* get a listing of */ while (fscanf(fp1, "%s", filename[i]) != EOF) i++; /* all files which */ pclose(fp1); /* describe this unit*/ printf("Content-type: text/html%c%c",10,10); /* Needed by Mosaic */ printf("Unit Summaries for unit %d ",unit); printf("

Lithologic Unit #%d

(appears in %d boxes)
",unit,i); for (j=0;jBox %s", data[0]); /*Begin writing data*/ printf("Core runs in box: "); for(k=1;k<=6;k++) { if (data[k] == "") break; else printf("%s ",data[k]); } printf("
Recovery in %% core runs in box: "); for(k=7;k<=12;k++) { if (data[k] == "") break; else printf("%s ", data[k]); } printf("
RQD in ratio form for core runs: "); for(k=13;k<=18;k++) { if (data[k] == "") break; else printf("%s ",data[k]); } printf("

Logged by %s, on date %s
", data[19], data[20]); printf("Checked by %s on date %s
", data[21], data[22]); printf("Driller's depth of box: top %s ft., bottom %s ft.
", data[23], data[24]); printf("Core Type: %s; # of Units in box: %s


",data[25],data[26]); printf("

Unit #%s, %s

",data[27],data[28]); if (strlen(data[29])) printf("Unit type: %s
",data[29]); if (strlen(data[30])) printf("Comments: %s

",data[30]); printf("

Contacts

Top:"); if (strlen(data[31])) printf(" Core run %s,",data[31]); if (strlen(data[32])) printf(" revised depth %s,",data[32]); if (strlen(data[33])) printf(" contact type %s",data[33]); printf("
"); printf("Bottom:"); if (strlen(data[34])) printf(" Core run %s,",data[34]); if (strlen(data[35])) printf(" revised depth %s,",data[35]); if (strlen(data[36])) printf(" contact type %s",data[36]); printf("
"); if (strlen(data[37])) printf("Comments: %s
", data[37]); else printf("
"); printf("

Phenocrysts

"); if (strlen(data[38])) printf("Overall abundance %s
",data[38]); if (strlen(data[39])) printf("Overall comments: %s
",data[39]); if (strlen(data[40])) { printf("a: %s.",data[40]); if (strlen(data[41])) printf(" Abundance %s,",data[41]); if (strlen(data[42])) printf(" Average size %s,",data[42]); if (strlen(data[42])) printf(" shape %s,",data[43]); if (strlen(data[44])) printf(" alteration %s,",data[44]); if (strlen(data[45])) printf(" comments: %s",data[45]); if (strlen(data[46])) { printf("
b: %s.",data[46]); if (strlen(data[47])) printf(" Abundance %s,",data[47]); if (strlen(data[48])) printf(" Average size %s,",data[48]); if (strlen(data[49])) printf(" shape %s,",data[49]); if (strlen(data[50])) printf(" alteration %s,",data[50]); if (strlen(data[51])) printf(" comments: %s",data[51]); if (strlen(data[52])) { printf("
c: %s.",data[52]); if (strlen(data[53])) printf(" Abundance %s,",data[53]); if (strlen(data[54])) printf(" Average size %s,",data[54]); if (strlen(data[55])) printf(" shape %s,",data[55]); if (strlen(data[56])) printf(" alteration %s,",data[56]); if (strlen(data[57])) printf(" comments: %s",data[57]); } } } if (strlen(data[59])||strlen(data[60])||strlen(data[58])) { printf("

Groundmass

"); if (strlen(data[54])) printf(" Lithology %s,",data[58]); if (strlen(data[55])) printf(" texture %s,",data[59]); if (strlen(data[56])) printf(" comments %s",data[60]); } if (strlen(data[61])) printf("

Color (dry)

%s
",data[61]); if (strlen(data[62])) printf("

Sedimentary/Volcanic Structures

%s
", data[62]); if (strlen(data[63])) printf("

Sorting

%s
",data[63]); if (strlen(data[64])) { printf("

Vesicles

abundance %s,",data[64]); if (strlen(data[65])) printf(" Average size %s,",data[65]); if (strlen(data[66])) printf(" Shape %s,",data[66]); if (strlen(data[67])) printf(" Fillings %s,",data[67]); if (strlen(data[68])) printf(" Aspect ratio %s,",data[68]); if (strlen(data[69])) printf(" Comments %s",data[69]); } if (strlen(data[70])||strlen(data[71])||strlen(data[72])) { printf("

Alteration

"); if (strlen(data[70])) printf(" Abundance %s,",data[70]); if (strlen(data[71])) printf(" Mineralogy %s,",data[71]); if (strlen(data[72])) printf(" Comments %s",data[72]); } if (strlen(data[73])) printf("

Veins

%s
",data[73]); if (strlen(data[74])) printf("

Fractures

%s
",data[74]); if (strlen(data[75])) printf("

Additional Comments

%s",data[75]); printf("
"); for (k=0;k