This commit is contained in:
overcuriousity 2025-07-05 13:11:25 +02:00
parent 48dcb7155e
commit 287fed9795
2 changed files with 17 additions and 16 deletions

BIN
bin/main

Binary file not shown.

View File

@ -68,21 +68,27 @@ int checkparams(int *argc, char *argv[]) {
struct access_log_entry_t parseLogline(char *accessLogLine) {
struct access_log_entry_t logEntry;
logEntry.remote_addr = parse_remote_address(accessLogLine);
//logEntry.remote_addr = parse_remote_address(accessLogLine);
return logEntry;
};
char parse_remote_address(char *accessLogLine) {
char *remote_adress[18];
regcomp
}
//char* parse_remote_address(char *accessLogLine) {
// return 1;
//}
uint32_t my_strlen(char *s) {
uint32_t counter = 0;
while (s[counter] != '\0') {
counter++;
unsigned int count_lines(FILE *filepointer) {
rewind(filepointer);
unsigned int lines = 0;
char c;
for(c=getc(filepointer); c != EOF; c = getc(filepointer)) {
if(c=='\n'){
lines += 1;
}
return counter;
}
char msg[BUF];
sprintf(msg, "Detected %d Lines in filestream\n", lines);
debugmsg(msg);
return lines;
}
int main(int argc, char *argv[]) {
@ -107,6 +113,7 @@ int main(int argc, char *argv[]) {
int filesize = ftell(fp);
sprintf(msg, "Datei %s geöffnet. Speicheradresse %p, Speichergröße %d Byte\n", filepath, &fp, filesize);
debugmsg(msg);
count_lines(fp);
char *access_log_buffer = malloc(BUF);
struct access_log_entry_t *access_log_table = malloc(sizeof(struct access_log_entry_t)*BUF);
if(access_log_buffer==NULL){
@ -114,12 +121,6 @@ int main(int argc, char *argv[]) {
return -1;
};
rewind(fp);
//while (fgets(access_log_buffer, filesize, fp)){
// debugmsg("entered loop\n");
// sprintf(outputline, "LINE %d: %s", counter+1, access_log_buffer);
// fputs(outputline, stdout);
// debugmsg("endloop");
//}
for (int counter = 0; counter < 10 && fgets(access_log_buffer, filesize, fp); counter++) {
//debugmsg("entered loop");
char outputline[BUF];