|
|
| version 1.18, 2004/03/01 19:48:25 | version 1.19, 2004/03/01 21:36:14 |
|---|---|
| Line 10 | Line 10 |
| */ | */ |
| #include <sys/types.h> | #include <sys/types.h> |
| #include <sys/stat.h> | |
| #include <stdio.h> | #include <stdio.h> |
| #include <stdlib.h> | #include <stdlib.h> |
| #include <unistd.h> | #include <unistd.h> |
| Line 104 main(int ac, char **av) | Line 105 main(int ac, char **av) |
| FILE *fi; | FILE *fi; |
| char *base; | char *base; |
| int i; | int i; |
| char buf[50]; | |
| /* one week in future */ | |
| time_t t = time(NULL) + 604800; | |
| /* | /* |
| * Process options | * Process options |
| Line 131 main(int ac, char **av) | Line 128 main(int ac, char **av) |
| * Output headers and HTML start. | * Output headers and HTML start. |
| */ | */ |
| printf("Content-Type: text/html\r\n"); | printf("Content-Type: text/html\r\n"); |
| /* | |
| * The Expires: header should keep these pages cached, as some | |
| * search engines assume they should not since cgi = dynamic | |
| */ | |
| strftime(buf,sizeof buf, "%a, %d %b %Y %H:%M:%S GMT", gmtime(&t)); | |
| printf("Expires: %s\r\n", buf); | |
| if (FilePath == NULL) { | if (FilePath == NULL) { |
| fprintf(stderr, "%s: no file specified\n", av[0]); | fprintf(stderr, "%s: no file specified\n", av[0]); |
| Line 174 main(int ac, char **av) | Line 165 main(int ac, char **av) |
| char buf[256]; | char buf[256]; |
| char *las; | char *las; |
| char *ptr; | char *ptr; |
| struct stat sb; | |
| fstat(fileno(fi), &sb); | |
| strftime(buf,sizeof buf, "%a, %d %b %Y %H:%M:%S GMT", gmtime(&sb.st_mtime)); | |
| printf("Last-Modified: %s\r\n", buf); | |
| while (fgets(buf, sizeof(buf), fi) != NULL) { | while (fgets(buf, sizeof(buf), fi) != NULL) { |
| if (buf[0] == '#') | if (buf[0] == '#') |
| Line 205 main(int ac, char **av) | Line 201 main(int ac, char **av) |
| fclose(fi); | fclose(fi); |
| } | } |
| /* | /* |
| * End request header first. | |
| */ | |
| printf("\r\n"); | |
| /* | |
| * Generate the table structure after processing the web page so | * Generate the table structure after processing the web page so |
| * we can populate the tags properly. | * we can populate the tags properly. |
| */ | */ |
| printf("<HTML>\n"); | printf("<HTML>\n"); |
| printf("<HEAD>\n"); | printf("<HEAD>\n"); |