norme ok
This commit is contained in:
parent
4cc6576d32
commit
f249b18aec
10 changed files with 63 additions and 203 deletions
|
|
@ -8,7 +8,7 @@ if expand('%') == '' && !&modified && line('$') <= 1 && getline(1) == ''
|
|||
let s:wipebuf = bufnr('%')
|
||||
endif
|
||||
set shortmess=aoO
|
||||
badd +51 src/lib_ls_long2.c
|
||||
badd +28 src/lib_ls_long2.c
|
||||
badd +23 src/ft_ls_long.c
|
||||
badd +1 includes/ft_ls.h
|
||||
badd +60 ~/.tmux.conf
|
||||
|
|
@ -26,8 +26,8 @@ badd +1 Makefile
|
|||
badd +22 src/lib_error.c
|
||||
badd +32 src/lib_dirs.c
|
||||
badd +31 src/ft_dir_get_ents.c
|
||||
badd +9 libft/src/ft_printf/ft_printf.c
|
||||
badd +43 libft/includes/ft_printf.h
|
||||
badd +69 libft/src/ft_printf/ft_printf.c
|
||||
badd +46 libft/includes/ft_printf.h
|
||||
badd +2 libft/src/printing/ft_putstr_fd.c
|
||||
badd +11 libft/includes/libft.h
|
||||
badd +2 libft/src/ft_printf/lib_fmt.c
|
||||
|
|
@ -44,14 +44,16 @@ badd +25 libft/src/lst/ft_lst_removeif.c
|
|||
badd +42 ~/.vimrc
|
||||
badd +12 src/ft_ent_has_dir.c
|
||||
badd +35 src/ft_ent_get_dirs.c
|
||||
badd +1 src/lib_ent.c
|
||||
badd +18 src/lib_ent.c
|
||||
badd +11 .Makefile.swp
|
||||
badd +18 ~/dotfiles/vim.symlink/plugins.vim
|
||||
badd +22 libft/src/str/ft_strsub.c
|
||||
badd +1 libft/Makefile
|
||||
badd +14 libft/src/btree/btree_print.c
|
||||
badd +14 libft/src/printing/ft_putaddr.c
|
||||
badd +1 libft/src/str/ft_strinsert.c
|
||||
badd +13 libft/src/str/ft_strinsert.c
|
||||
badd +20 libft/src/str/ft_strdel.c
|
||||
badd +22 libft/src/str/ft_strjoin.c
|
||||
args src/lib_ls_long2.c
|
||||
edit includes/ft_ls.h
|
||||
set splitbelow splitright
|
||||
|
|
@ -123,19 +125,13 @@ if s:l < 1 | let s:l = 1 | endif
|
|||
exe s:l
|
||||
normal! zt
|
||||
23
|
||||
normal! 011l
|
||||
tabedit src/lib_ent.c
|
||||
normal! 01l
|
||||
tabedit src/ft_ls.c
|
||||
set splitbelow splitright
|
||||
wincmd _ | wincmd |
|
||||
vsplit
|
||||
1wincmd h
|
||||
wincmd w
|
||||
set nosplitbelow
|
||||
set nosplitright
|
||||
wincmd t
|
||||
set winheight=1 winwidth=1
|
||||
exe 'vert 1resize ' . ((&columns * 90 + 90) / 181)
|
||||
exe 'vert 2resize ' . ((&columns * 90 + 90) / 181)
|
||||
argglobal
|
||||
setlocal fdm=manual
|
||||
setlocal fde=0
|
||||
|
|
@ -146,78 +142,13 @@ setlocal fml=1
|
|||
setlocal fdn=20
|
||||
setlocal fen
|
||||
silent! normal! zE
|
||||
let s:l = 38 - ((37 * winheight(0) + 40) / 80)
|
||||
if s:l < 1 | let s:l = 1 | endif
|
||||
exe s:l
|
||||
normal! zt
|
||||
38
|
||||
normal! 01l
|
||||
wincmd w
|
||||
argglobal
|
||||
edit src/ft_ls.c
|
||||
setlocal fdm=manual
|
||||
setlocal fde=0
|
||||
setlocal fmr={{{,}}}
|
||||
setlocal fdi=#
|
||||
setlocal fdl=0
|
||||
setlocal fml=1
|
||||
setlocal fdn=20
|
||||
setlocal fen
|
||||
silent! normal! zE
|
||||
let s:l = 49 - ((48 * winheight(0) + 40) / 80)
|
||||
if s:l < 1 | let s:l = 1 | endif
|
||||
exe s:l
|
||||
normal! zt
|
||||
49
|
||||
normal! 026l
|
||||
wincmd w
|
||||
exe 'vert 1resize ' . ((&columns * 90 + 90) / 181)
|
||||
exe 'vert 2resize ' . ((&columns * 90 + 90) / 181)
|
||||
tabedit src/lib_ls_long2.c
|
||||
set splitbelow splitright
|
||||
set nosplitbelow
|
||||
set nosplitright
|
||||
wincmd t
|
||||
set winheight=1 winwidth=1
|
||||
argglobal
|
||||
setlocal fdm=manual
|
||||
setlocal fde=0
|
||||
setlocal fmr={{{,}}}
|
||||
setlocal fdi=#
|
||||
setlocal fdl=0
|
||||
setlocal fml=1
|
||||
setlocal fdn=20
|
||||
setlocal fen
|
||||
silent! normal! zE
|
||||
let s:l = 1 - ((0 * winheight(0) + 40) / 80)
|
||||
if s:l < 1 | let s:l = 1 | endif
|
||||
exe s:l
|
||||
normal! zt
|
||||
1
|
||||
normal! 0
|
||||
tabedit libft/src/str/ft_strinsert.c
|
||||
set splitbelow splitright
|
||||
set nosplitbelow
|
||||
set nosplitright
|
||||
wincmd t
|
||||
set winheight=1 winwidth=1
|
||||
argglobal
|
||||
setlocal fdm=manual
|
||||
setlocal fde=0
|
||||
setlocal fmr={{{,}}}
|
||||
setlocal fdi=#
|
||||
setlocal fdl=0
|
||||
setlocal fml=1
|
||||
setlocal fdn=20
|
||||
setlocal fen
|
||||
silent! normal! zE
|
||||
let s:l = 1 - ((0 * winheight(0) + 40) / 80)
|
||||
if s:l < 1 | let s:l = 1 | endif
|
||||
exe s:l
|
||||
normal! zt
|
||||
1
|
||||
normal! 0
|
||||
tabnext 4
|
||||
tabnext 2
|
||||
if exists('s:wipebuf')
|
||||
silent exe 'bwipe ' . s:wipebuf
|
||||
endif
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
/* By: jhalford <marvin@42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2016/11/07 13:22:54 by jhalford #+# #+# */
|
||||
/* Updated: 2016/11/16 10:53:57 by jhalford ### ########.fr */
|
||||
/* Updated: 2016/11/21 18:20:10 by jhalford ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
|
@ -43,6 +43,7 @@ struct s_fmt
|
|||
};
|
||||
|
||||
int ft_vdprintf(int fd, const char *format, va_list ap);
|
||||
int ft_fmtcalc(char **final, char **str, va_list ap);
|
||||
|
||||
extern t_conv g_convs[];
|
||||
|
||||
|
|
|
|||
|
|
@ -1,97 +0,0 @@
|
|||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* btree_print.c :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: jhalford <marvin@42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2016/11/14 18:06:24 by jhalford #+# #+# */
|
||||
/* Updated: 2016/11/21 15:13:44 by jhalford ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include "btree.h"
|
||||
|
||||
enum e_data
|
||||
{
|
||||
is_left,
|
||||
offset,
|
||||
depth,
|
||||
};
|
||||
|
||||
static int print_t(t_btree *tree,
|
||||
int data[3], char s[20][255], char *(*printer)(void *))
|
||||
{
|
||||
char b[20];
|
||||
int width;
|
||||
int left;
|
||||
int right;
|
||||
int i;
|
||||
|
||||
width = 5;
|
||||
if (!tree)
|
||||
return (0);
|
||||
sprintf(b, "%5s", printer(tree->item));
|
||||
left = print_t(tree->left, (int[3]){
|
||||
1, data[offset], data[depth] + 1}, s, printer);
|
||||
right = print_t(tree->right, (int[3]){
|
||||
0, data[offset] + left + width, data[depth] + 1}, s, printer);
|
||||
i = -1;
|
||||
while (++i < width)
|
||||
s[data[depth]][data[offset] + left + i] = b[i];
|
||||
if (data[depth] && data[is_left])
|
||||
{
|
||||
i = -1;
|
||||
while (++i < width)
|
||||
s[data[depth] - 1][data[offset] + left + width / 2 + i] = '-';
|
||||
s[data[depth] - 1][data[offset] + left + width / 2] = '.';
|
||||
}
|
||||
else if (data[depth] && !data[is_left])
|
||||
{
|
||||
i = -1;
|
||||
while (++i < width)
|
||||
s[data[depth] - 1][data[offset] - width / 2 + i] = '-';
|
||||
s[data[depth] - 1][data[offset] + left + width / 2] = '.';
|
||||
}
|
||||
i = -1;
|
||||
while (++i < width)
|
||||
s[2 * data[depth]][data[offset] + left + i] = b[i];
|
||||
if (data[depth] && data[is_left])
|
||||
{
|
||||
i = -1;
|
||||
while (++i < width)
|
||||
s[2 * data[depth] - 1][data[offset] + left + width / 2 + i] = '-';
|
||||
s[2 * data[depth] - 1][data[offset] + left + width / 2] = '+';
|
||||
s[2 * data[depth] - 1][
|
||||
data[offset] + left + right + 3 * width / 2] = '+';
|
||||
}
|
||||
else if (data[depth] && !data[is_left])
|
||||
{
|
||||
i = -1;
|
||||
while (++i < width)
|
||||
s[2 * data[depth] - 1][data[offset] - width / 2 + i] = '-';
|
||||
s[2 * data[depth] - 1][data[offset] + left + width / 2] = '+';
|
||||
s[2 * data[depth] - 1][data[offset] - width / 2 - 1] = '+';
|
||||
}
|
||||
return (left + width + right);
|
||||
}
|
||||
|
||||
void btree_print(t_btree *tree, char *(*printer)(void *))
|
||||
{
|
||||
char s[20][255];
|
||||
char empty[255];
|
||||
int i;
|
||||
|
||||
i = -1;
|
||||
while (++i < 20)
|
||||
sprintf(s[i], "%80s", " ");
|
||||
sprintf(empty, "%80s", " ");
|
||||
print_t(tree, (int[3]){0, 0, 0}, s, printer);
|
||||
i = -1;
|
||||
while (++i < 20)
|
||||
{
|
||||
if (ft_strcmp(s[i], empty) == 0)
|
||||
break ;
|
||||
printf("%s\n", s[i]);
|
||||
}
|
||||
}
|
||||
|
|
@ -6,7 +6,7 @@
|
|||
/* By: jhalford <marvin@42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2016/11/07 13:33:27 by jhalford #+# #+# */
|
||||
/* Updated: 2016/11/21 15:15:04 by jhalford ### ########.fr */
|
||||
/* Updated: 2016/11/21 18:22:26 by jhalford ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
|
@ -44,32 +44,44 @@ int ft_dprintf(int fd, const char *format, ...)
|
|||
int ft_vdprintf(int fd, const char *format, va_list ap)
|
||||
{
|
||||
char *str;
|
||||
char *transform;
|
||||
char final[1000];
|
||||
t_fmt *fmt;
|
||||
char *tmp;
|
||||
char *final;
|
||||
|
||||
str = (char *)format;
|
||||
ft_bzero(final, 1000);
|
||||
final = ft_strnew(1);
|
||||
while (*str)
|
||||
{
|
||||
tmp = final;
|
||||
if (*str == '%')
|
||||
{
|
||||
str++;
|
||||
if (!(fmt = ft_printf_parse(&str, ap)))
|
||||
if (ft_fmtcalc(&final, &str, ap))
|
||||
return (1);
|
||||
if (!fmt->valid)
|
||||
ft_strncat(final, &fmt->conversion, 1);
|
||||
else
|
||||
{
|
||||
transform = ft_transform(fmt, ap);
|
||||
ft_strcat(final, transform);
|
||||
free(transform);
|
||||
}
|
||||
free(fmt);
|
||||
}
|
||||
else
|
||||
ft_strncat(final, str++, 1);
|
||||
final = ft_strjoin(final, (char[]){*str++, 0});
|
||||
ft_strdel(&tmp);
|
||||
}
|
||||
ft_putstr_fd(final, fd);
|
||||
ft_strdel(&final);
|
||||
return (0);
|
||||
}
|
||||
|
||||
int ft_fmtcalc(char **final, char **str, va_list ap)
|
||||
{
|
||||
t_fmt *fmt;
|
||||
char *transform;
|
||||
|
||||
*str += 1;
|
||||
if (!(fmt = ft_printf_parse(str, ap)))
|
||||
return (1);
|
||||
if (!fmt->valid)
|
||||
ft_strncat(*final, &fmt->conversion, 1);
|
||||
else
|
||||
{
|
||||
transform = ft_transform(fmt, ap);
|
||||
*final = ft_strjoin(*final, transform);
|
||||
ft_strdel(&transform);
|
||||
}
|
||||
free(fmt);
|
||||
return (0);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
/* By: jhalford <marvin@42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2016/11/03 14:58:00 by jhalford #+# #+# */
|
||||
/* Updated: 2016/11/03 14:58:00 by jhalford ### ########.fr */
|
||||
/* Updated: 2016/11/21 18:03:21 by jhalford ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
|
@ -14,6 +14,9 @@
|
|||
|
||||
void ft_strdel(char **as)
|
||||
{
|
||||
free(*as);
|
||||
*as = NULL;
|
||||
if (as)
|
||||
{
|
||||
free(*as);
|
||||
*as = NULL;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,3 +1,15 @@
|
|||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* ft_strinsert.c :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2016/11/21 18:21:57 by jhalford #+# #+# */
|
||||
/* Updated: 2016/11/21 18:21:57 by jhalford ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include "libft.h"
|
||||
|
||||
char *ft_strinsert(char *str, char c, int n)
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
/* By: jhalford <marvin@42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2016/11/03 14:58:18 by jhalford #+# #+# */
|
||||
/* Updated: 2016/11/10 10:14:09 by jhalford ### ########.fr */
|
||||
/* Updated: 2016/11/21 18:10:22 by jhalford ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
/* By: jhalford <marvin@42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2016/11/07 15:00:05 by jhalford #+# #+# */
|
||||
/* Updated: 2016/11/21 17:22:13 by jhalford ### ########.fr */
|
||||
/* Updated: 2016/11/21 18:23:05 by jhalford ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
|
@ -14,8 +14,6 @@
|
|||
|
||||
void ft_ent_filter(t_list **ent, int opts)
|
||||
{
|
||||
/* (void)ent; */
|
||||
/* (void)opts; */
|
||||
if (!(opts & OPTS_LA))
|
||||
ft_lst_delif(ent, ".", &ft_lsdata_cmp0, &ft_ent_free);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
/* By: jhalford <marvin@42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2016/11/07 15:01:01 by jhalford #+# #+# */
|
||||
/* Updated: 2016/11/21 17:29:24 by jhalford ### ########.fr */
|
||||
/* Updated: 2016/11/21 17:54:05 by jhalford ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
/* By: jhalford <marvin@42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2016/11/07 15:00:15 by jhalford #+# #+# */
|
||||
/* Updated: 2016/11/21 14:33:22 by jhalford ### ########.fr */
|
||||
/* Updated: 2016/11/21 18:23:52 by jhalford ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue