This commit is contained in:
Timo Schmidt 2023-04-01 07:42:29 +02:00
commit f8b6ac11d4
8 changed files with 230 additions and 0 deletions

57
ex00/Makefile Normal file
View File

@ -0,0 +1,57 @@
SRC = main.c \
ft_lib.c
HEADERS = ft_lib.h
OBJDIR = obj
INCDIR = include
CC = cc
CFLAGS = \
-Wall \
-Wextra \
-Werror \
-I$(INCDIR)
LDFLAGS =
_OBJ = $(SRC:.c=.o)
OBJ = $(addprefix $(OBJDIR)/,$(_OBJ))
DEPS = $(addprefix $(INCDIR)/,$(HEADERS))
RM = /bin/rm -f
RMDIR = /bin/rmdir
.DEFAULT_GOAL=test
NAME ?= rush-02
.PHONY: re fclean clean all
all: $(NAME)
clean:
@$(RM) $(OBJ)
fclean: clean
@$(RM) $(NAME)
@$(RMDIR) $(OBJDIR) 2>/dev/null || true
re: fclean all
$(NAME): $(OBJ)
@$(CC) $(LDFLAGS) $^ -o $@
$(OBJ): | $(OBJDIR)
$(OBJDIR)/%.o: %.c $(DEPS)
@norminette $< >/dev/null || { printf '\033[107;41m%s\033[m\n' "!Norminette Failed>>>"; norminette $<; printf '\033[107;41m%s\033[m\n' "<<<Norminette Failed!"; exit 1; }
@$(CC) $(CFLAGS) -c $< -o $@
$(OBJDIR):
@mkdir -p $@
tests: test
test: re run fclean
run:
./$(NAME)

1
ex00/TODO.txt Normal file
View File

@ -0,0 +1 @@
Change .DEFAULT_GOAL in Makefile to 'all'

32
ex00/dicts/numbers.dict Normal file
View File

@ -0,0 +1,32 @@
0: zero
1: one
2: two
3: three
4: four
5: five
6: six
7: seven
8: eight
9: nine
10: ten
11: eleven
12: twelve
13: thirteen
14: fourteen
15: fifteen
16: sixteen
17: seventeen
18: eighteen
19: nineteen
20: twenty
30: thirty
40: forty
50: fifty
60: sixty
70: seventy
80: eighty
90: ninety
100: hundred
1000: thousand
1000000: million
1000000000: billion

42
ex00/dicts/numbers2.dict Normal file
View File

@ -0,0 +1,42 @@
0: zero
1: one
2: two
3: three
4: four
5: five
6: six
7: seven
8: eight
9: nine
10: ten
11: eleven
12: twelve
13: thirteen
14: fourteen
15: fifteen
16: sixteen
17: seventeen
18: eighteen
19: nineteen
20: twenty
30: thirty
40: forty
50: fifty
60: sixty
70: seventy
80: eighty
90: ninety
100: hundred
1000: thousand
1000000: million
1000000000: billion
1000000000000: trillion
1000000000000000: quadrillion
1000000000000000000: quintillion
1000000000000000000000: sextillion
1000000000000000000000000: septillion
1000000000000000000000000000: octillion
1000000000000000000000000000000: nonillion
1000000000000000000000000000000000: decillion
1000000000000000000000000000000000000: undecillion
1000000000000000000000000000000000000000: tridecillion

32
ex00/dicts/numbers3.dict Normal file
View File

@ -0,0 +1,32 @@
70: seventy
9: nine
60: sixty
16: sixteen
12: twelve
50: fifty
20: twenty
5: five
1000000000: billion
13: thirteen
19: nineteen
1000000: million
80: eighty
40: forty
17: seventeen
18: eighteen
3: three
7: seven
4: four
10: ten
100: hundred
8: eight
15: fifteen
6: six
11: eleven
14: fourteen
30: thirty
1000: thousand
0: zero
2: two
90: ninety
1: one

25
ex00/ft_lib.c Normal file
View File

@ -0,0 +1,25 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_lib.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: tischmid <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/04/01 07:13:31 by tischmid #+# #+# */
/* Updated: 2023/04/01 07:13:58 by tischmid ### ########.fr */
/* */
/* ************************************************************************** */
#include "ft_lib.h"
void ft_putchar(char c)
{
write(1, &c, 1);
}
void ft_puts(char *str)
{
while (*str)
ft_putchar(*str++);
ft_putchar('\n');
}

20
ex00/include/ft_lib.h Normal file
View File

@ -0,0 +1,20 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_lib.h :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: tischmid <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/04/01 07:14:29 by tischmid #+# #+# */
/* Updated: 2023/04/01 07:23:26 by tischmid ### ########.fr */
/* */
/* ************************************************************************** */
#ifndef FT_LIB_H
# define FT_LIB_H
# include <unistd.h>
void ft_putchar(char c);
void ft_puts(char *str);
#endif

21
ex00/main.c Normal file
View File

@ -0,0 +1,21 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* main.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: tischmid <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/04/01 07:11:58 by tischmid #+# #+# */
/* Updated: 2023/04/01 07:41:31 by tischmid ### ########.fr */
/* */
/* ************************************************************************** */
#include "ft_lib.h"
int main(int argc, char **argv)
{
(void)argc;
(void)argv;
ft_puts("Hello, World!");
return (0);
}