summaryrefslogtreecommitdiffstats
path: root/src/b_sqb_file.c
blob: d6d07e0e9abd65593c52b89e3b28069c8ebf3257 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
/* ************************************************************************** */
/*                                                                            */
/*                                                        :::      ::::::::   */
/*   b_sqb_file.c                                       :+:      :+:    :+:   */
/*                                                    +:+ +:+         +:+     */
/*   By: rbousset <marvin@42.fr>                    +#+  +:+       +#+        */
/*                                                +#+#+#+#+#+   +#+           */
/*   Created: 2020/02/14 17:19:27 by rbousset          #+#    #+#             */
/*   Updated: 2020/02/14 17:19:29 by rbousset         ###   ########lyon.fr   */
/*                                                                            */
/* ************************************************************************** */

#include <sys/stat.h>
#include <stdint.h>

static uint8_t
	b_file_tests_one(uint8_t id,
					struct stat *st)
{
	if (id == FT_ID_SQB_B && S_st->st_mode)
	return (0);
}

uint8_t
	b_sqb_file(uint8_t id,
			char *argv[])
{
	struct stat	st;
	int32_t	fd;
	uint8_t	ret;

	ret = 0;
	if ((fd = open(argv[1])) == -1)
		return (1);
	fstat(fd, &st);
	ret = b_file_tests_one(id, &st);
	close(fd);
	return (ret);
}