conflict merge
This commit is contained in:
BIN
srcs/a.out
Executable file
BIN
srcs/a.out
Executable file
Binary file not shown.
@@ -1,20 +0,0 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* get_smallest_square.c :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: vmanzoni <vmanzoni@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2019/04/12 22:29:45 by vmanzoni #+# #+# */
|
||||
/* Updated: 2019/04/14 14:17:47 by vmanzoni ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include "../includes/fillit.h"
|
||||
|
||||
/*
|
||||
char *get_smallest_square()
|
||||
{
|
||||
|
||||
}
|
||||
*/
|
||||
@@ -1,54 +0,0 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* handle_errors.c :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: vmanzoni <vmanzoni@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2019/03/01 13:29:05 by vmanzoni #+# #+# */
|
||||
/* Updated: 2019/04/14 14:39:12 by vmanzoni ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include "../includes/fillit.h"
|
||||
|
||||
/*
|
||||
** Function that display error message *s on fd
|
||||
*/
|
||||
|
||||
void print_error(char *s)
|
||||
{
|
||||
write(2, s, strlen(s));
|
||||
}
|
||||
|
||||
/*
|
||||
** Function to see if there if an error if the file
|
||||
** - less than 4 lines
|
||||
** - more than 104 (26 tetri) + 25 (\n) = 129 lines
|
||||
** - two \n in a row
|
||||
*/
|
||||
|
||||
int ft_file_errors(char *file)
|
||||
{
|
||||
int line_nbr;
|
||||
|
||||
line_nbr = 0;
|
||||
while (*file)
|
||||
{
|
||||
if (*file == '\n')
|
||||
line_nbr++;
|
||||
file++;
|
||||
//if (*file == '\n')
|
||||
//return (1);
|
||||
}
|
||||
if (line_nbr < 4 || line_nbr > 129)
|
||||
return (1);
|
||||
return (0);
|
||||
}
|
||||
|
||||
/*
|
||||
int ft_tetri_errors()
|
||||
{
|
||||
|
||||
}
|
||||
*/
|
||||
37
srcs/main.c
37
srcs/main.c
@@ -1,37 +0,0 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* main.c :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: vmanzoni <vmanzoni@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2019/02/12 13:20:48 by vmanzoni #+# #+# */
|
||||
/* Updated: 2019/04/14 15:18:46 by hulamy ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include "../includes/fillit.h"
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
char *input;
|
||||
|
||||
if (argc == 2)
|
||||
{
|
||||
if (!(input = read_file(argv[1])))
|
||||
print_error("Error: Could not read file.\n");
|
||||
else if (ft_file_errors(input))
|
||||
print_error("Error: Invalid file.\n");
|
||||
/*
|
||||
Check if every tetrimino is valid
|
||||
Transform input to tetriminos
|
||||
Backtracking for smallest square
|
||||
Transform tetriminos with letters
|
||||
Print result
|
||||
*/
|
||||
print_test(input);
|
||||
}
|
||||
else
|
||||
print_error("Error: Please submit a file.\n");
|
||||
return (0);
|
||||
}
|
||||
@@ -1,25 +0,0 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* print_fillit.c :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: vmanzoni <vmanzoni@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2019/03/01 13:35:48 by vmanzoni #+# #+# */
|
||||
/* Updated: 2019/04/14 14:32:02 by vmanzoni ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include "../includes/fillit.h"
|
||||
|
||||
/*
|
||||
void ft_print_fillit()
|
||||
{
|
||||
|
||||
}
|
||||
*/
|
||||
|
||||
void print_test(char *test)
|
||||
{
|
||||
write(1, test, strlen(test));
|
||||
}
|
||||
@@ -1,36 +0,0 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* read_file.c :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: vmanzoni <vmanzoni@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2019/04/13 12:09:46 by vmanzoni #+# #+# */
|
||||
/* Updated: 2019/04/14 14:23:24 by vmanzoni ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include "../includes/fillit.h"
|
||||
|
||||
char *read_file(char *file)
|
||||
{
|
||||
char buf[BUFFER_SIZE];
|
||||
int fd;
|
||||
int rv;
|
||||
int i;
|
||||
char *result;
|
||||
|
||||
if (((fd = open(file, O_RDONLY)) < 0) \
|
||||
|| ((rv = read(fd, &buf, BUFFER_SIZE)) < 0) \
|
||||
|| !(result = malloc(sizeof(char))))
|
||||
return (NULL);
|
||||
buf[rv] = '\0';
|
||||
i = 0;
|
||||
while (rv--)
|
||||
{
|
||||
result[i] = buf[i];
|
||||
i++;
|
||||
}
|
||||
close(fd);
|
||||
return (result);
|
||||
}
|
||||
Reference in New Issue
Block a user