This commit is contained in:
2026-04-30 23:42:34 +02:00
commit 6ccc96b2fe
16 changed files with 32397 additions and 0 deletions
@@ -0,0 +1,15 @@
CC=gcc
CFLAGS=-Wall -Wextra -Werror -fsanitize=address -g -pedantic
SRCS=dlist.c main.c
OBJS=$(SRCS:.c=.o)
TARGET=dlist
all: $(TARGET)
$(TARGET): $(OBJS)
$(CC) $(CFLAGS) -o $@ $^
clean:
$(RM) -r $(TARGET) $(OBJS)
@@ -0,0 +1,63 @@
#include "dlist.h"
#include <stdio.h>
#include <stdlib.h>
struct dlist *dlist_init(void)
{
// TODO
return NULL;
}
void dlist_clear(struct dlist *list)
{
}
size_t dlist_length(struct dlist *l)
{
// TODO
return 0;
}
void dlist_push_front(struct dlist *l, int data)
{
// TODO
}
void dlist_push_back(struct dlist *l, int data)
{
// TODO
}
void dlist_remove(struct dlist *list, int data)
{
// TODO
}
struct dlist *dlist_from_str(char *str)
{
// TODO
return NULL;
}
struct node *dlist_find(struct dlist *list, int data)
{
// TODO
return NULL;
}
void dlist_print(struct dlist *l)
{
// TODO
}
void dlist_concat(struct dlist *l1, struct dlist *l2)
{
// TODO
}
void dlist_insert(struct dlist *l, int data, int i)
{
// TODO
}
@@ -0,0 +1,8 @@
// This file will not be tested, you can modify it.
#include "dlist.h"
int main(void)
{
// TODO
}
@@ -0,0 +1,16 @@
CC = gcc
CFLAGS = -Wall -Wextra -Werror
all: fork.o main.o
is_prime: fork.o main.o
$(CC) $^ -o $@
salute: fork.o main.o
$(CC) $^ -o $@
clean:
$(RM) fork.o main.o is_prime salute
.PHONY: all clean run
@@ -0,0 +1,19 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/wait.h>
#include <unistd.h>
#include "fork.h"
int is_prime(size_t n)
{
// TODO
return 0;
}
int salute(int num_guests, char *guests[])
{
// TODO
return 0;
}
@@ -0,0 +1,9 @@
#ifndef FORK_H
#define FORK_H
#include <stddef.h>
int is_prime(size_t n);
int salute(int num_guests, char *guests[]);
#endif /* FORK_H */
@@ -0,0 +1,28 @@
// This file will not be tested, you can modify it.
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "fork.h"
int main(int argc, char *argv[])
{
if (!strcmp(argv[0], "./is_prime"))
{
for (int i = 1; i < argc; i++)
{
is_prime(atoi(argv[i]));
}
}
else if (!strcmp(argv[0], "./salute"))
{
return salute(argc, argv);
}
else
{
printf("No such thing as %s\n", argv[0]);
}
return 0;
}