This commit is contained in:
Mario Stöckl 2025-06-20 22:08:10 +02:00
parent 536dcc8c6b
commit 6d8140dc59
2 changed files with 20 additions and 1 deletions

BIN
bin/main

Binary file not shown.

View File

@ -40,6 +40,18 @@ struct errorLogEntry_t {
char *connection_id_message;
};
// https://nginx.org/en/docs/http/ngx_http_log_module.html
struct access_log_entry_t {
char remote_addr;
char remote_user;
struct datetime_t time_local;
char request;
unsigned int status;
unsigned int body_bytes_sent;
char http_referer;
char http_user_agent;
};
void debugmsg(char *msg) {
if(DEBUG==true){
printf("DEBUG: %s\n", msg);
@ -74,7 +86,7 @@ int main(int argc, char *argv[]) {
sprintf(msg,"Argument %d: %s, Speicheradresse: %p\n", i, argv[i], &argv[i]);
debugmsg(msg);
i++;
};
}
checkparams(&argc, argv);
char *filepath = argv[1];
FILE *fp = fopen(filepath, "r");
@ -88,6 +100,13 @@ int main(int argc, char *argv[]) {
long filesize = ftell(fp);
sprintf(msg, "Datei %s geöffnet. Speicheradresse %p, Speichergröße %ld\n", filepath, &fp, filesize);
debugmsg(msg);
char filebuffer[BUF];
rewind(fp);
while (fgets(filebuffer, BUF, fp)){
debugmsg("entered loop\n");
fputs(filebuffer, stdout);
debugmsg("endloop");
}
}
debugmsg("END OF PROGRAM");
return 0;