add some work
This commit is contained in:
parent
4b22633cab
commit
ad25d505b4
176 changed files with 2036 additions and 1746 deletions
54
42sh/includes/btree.h
Normal file
54
42sh/includes/btree.h
Normal file
|
|
@ -0,0 +1,54 @@
|
||||||
|
/* ************************************************************************** */
|
||||||
|
/* */
|
||||||
|
/* ::: :::::::: */
|
||||||
|
/* btree.h :+: :+: :+: */
|
||||||
|
/* +:+ +:+ +:+ */
|
||||||
|
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
|
||||||
|
/* +#+#+#+#+#+ +#+ */
|
||||||
|
/* Created: 2016/11/16 11:13:15 by jhalford #+# #+# */
|
||||||
|
/* Updated: 2016/12/05 11:53:30 by jhalford ### ########.fr */
|
||||||
|
/* */
|
||||||
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
#ifndef BTREE_H
|
||||||
|
# define BTREE_H
|
||||||
|
|
||||||
|
# include "libft.h"
|
||||||
|
|
||||||
|
struct s_btree
|
||||||
|
{
|
||||||
|
void *item;
|
||||||
|
size_t content_size;
|
||||||
|
struct s_btree *left;
|
||||||
|
struct s_btree *right;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct s_printdata
|
||||||
|
{
|
||||||
|
int is_left;
|
||||||
|
int offset;
|
||||||
|
int depth;
|
||||||
|
int left;
|
||||||
|
int right;
|
||||||
|
};
|
||||||
|
|
||||||
|
typedef struct s_btree t_btree;
|
||||||
|
typedef struct s_printdata t_printdata;
|
||||||
|
|
||||||
|
t_btree *btree_create_node(void const *item, size_t content_size);
|
||||||
|
void btree_insert_data(
|
||||||
|
t_btree **root,
|
||||||
|
void *item,
|
||||||
|
size_t content_size,
|
||||||
|
int (*cmpf)(void *, void *));
|
||||||
|
void *btree_search_item(t_btree *root,
|
||||||
|
void *data_ref, int (*cmpf)(void *, void *));
|
||||||
|
int btree_level_count(t_btree *root);
|
||||||
|
void btree_apply_prefix(t_btree *root, void (*applyf)(void *));
|
||||||
|
void btree_apply_infix(t_btree *root, void (*applyf)(void *));
|
||||||
|
void btree_apply_suffix(t_btree *root, void (*applyf)(void *));
|
||||||
|
void btree_print(int fd, t_btree *tree, char *(*printer)(void *));
|
||||||
|
void btree_del(t_btree **root, void (*del)(void *, size_t));
|
||||||
|
void btree_delone(t_btree **root, void (*del)(void *, size_t));
|
||||||
|
|
||||||
|
#endif
|
||||||
56
42sh/includes/color.h
Normal file
56
42sh/includes/color.h
Normal file
|
|
@ -0,0 +1,56 @@
|
||||||
|
/* ************************************************************************** */
|
||||||
|
/* */
|
||||||
|
/* ::: :::::::: */
|
||||||
|
/* color.h :+: :+: :+: */
|
||||||
|
/* +:+ +:+ +:+ */
|
||||||
|
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
|
||||||
|
/* +#+#+#+#+#+ +#+ */
|
||||||
|
/* Created: 2016/11/25 13:36:48 by jhalford #+# #+# */
|
||||||
|
/* Updated: 2016/12/09 22:09:24 by jhalford ### ########.fr */
|
||||||
|
/* */
|
||||||
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
#ifndef COLOR_H
|
||||||
|
# define COLOR_H
|
||||||
|
# include "libft.h"
|
||||||
|
|
||||||
|
struct s_color
|
||||||
|
{
|
||||||
|
char fg[7];
|
||||||
|
char bg[7];
|
||||||
|
};
|
||||||
|
|
||||||
|
typedef struct s_color t_color;
|
||||||
|
|
||||||
|
# define FG_DEFAULT "\x1b[0m"
|
||||||
|
# define ON_BOLD "\x1b[1m"
|
||||||
|
|
||||||
|
# define ON_UNDERLINED "\x1b[4m"
|
||||||
|
# define ON_INVERTED "\x1b[7m"
|
||||||
|
|
||||||
|
# define FG_BLACK "\x1b[30m"
|
||||||
|
# define FG_RED "\x1b[31m"
|
||||||
|
# define FG_GREEN "\x1b[32m"
|
||||||
|
# define FG_YELLOW "\x1b[33m"
|
||||||
|
# define FG_BLUE "\x1b[34m"
|
||||||
|
# define FG_MAGENTA "\x1b[35m"
|
||||||
|
# define FG_CYAN "\x1b[36m"
|
||||||
|
|
||||||
|
# define BG_BLACK "\x1b[40m"
|
||||||
|
# define BG_RED "\x1b[41m"
|
||||||
|
# define BG_GREEN "\x1b[42m"
|
||||||
|
# define BG_YELLOW "\x1b[43m"
|
||||||
|
# define BG_BLUE "\x1b[44m"
|
||||||
|
# define BG_MAGENTA "\x1b[45m"
|
||||||
|
# define BG_CYAN "\x1b[46m"
|
||||||
|
# define BG_DEFAULT "\x1b[49m"
|
||||||
|
|
||||||
|
# define FBG_DEFAULT "\x1b[49m\x1b[20m"
|
||||||
|
|
||||||
|
void ft_color_reset(void);
|
||||||
|
void ft_color_set(t_color color);
|
||||||
|
|
||||||
|
void ft_color_mk(t_color *color, char fg[7], char bg[7]);
|
||||||
|
void ft_color_mkif(t_color *color, int cond, char fg[7], char bg[7]);
|
||||||
|
|
||||||
|
#endif
|
||||||
35
42sh/includes/dlst.h
Normal file
35
42sh/includes/dlst.h
Normal file
|
|
@ -0,0 +1,35 @@
|
||||||
|
/* ************************************************************************** */
|
||||||
|
/* */
|
||||||
|
/* ::: :::::::: */
|
||||||
|
/* dlst.h :+: :+: :+: */
|
||||||
|
/* +:+ +:+ +:+ */
|
||||||
|
/* By: jhalford <marvin@42.fr> +#+ +:+ +#+ */
|
||||||
|
/* +#+#+#+#+#+ +#+ */
|
||||||
|
/* Created: 2016/11/07 13:21:04 by jhalford #+# #+# */
|
||||||
|
/* Updated: 2016/11/07 13:21:52 by jhalford ### ########.fr */
|
||||||
|
/* */
|
||||||
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
#ifndef DLST_H
|
||||||
|
# define DLST_H
|
||||||
|
|
||||||
|
struct s_dlist
|
||||||
|
{
|
||||||
|
void *content;
|
||||||
|
size_t content_size;
|
||||||
|
struct s_dlist *next;
|
||||||
|
struct s_dlist *prev;
|
||||||
|
};
|
||||||
|
|
||||||
|
typedef struct s_dlist t_dlist;
|
||||||
|
|
||||||
|
void ft_dlstadd_after(t_dlist **alst, t_dlist *new);
|
||||||
|
void ft_dlstadd_before(t_dlist **alst, t_dlist *new);
|
||||||
|
void ft_dlstdel(t_dlist **alst, void (*del)(void *, size_t));
|
||||||
|
void ft_dlstdelone(t_dlist **alst, void (*del)(void *, size_t));
|
||||||
|
int ft_dlstsize(t_dlist *list);
|
||||||
|
t_dlist *ft_dlstnew(void const *content, size_t content_size);
|
||||||
|
t_dlist *ft_dlstlast(t_dlist *list);
|
||||||
|
char *ft_dlsttostr(t_dlist *list);
|
||||||
|
|
||||||
|
#endif
|
||||||
81
42sh/includes/ft_printf.h
Normal file
81
42sh/includes/ft_printf.h
Normal file
|
|
@ -0,0 +1,81 @@
|
||||||
|
/* ************************************************************************** */
|
||||||
|
/* */
|
||||||
|
/* ::: :::::::: */
|
||||||
|
/* ftprintf.h :+: :+: :+: */
|
||||||
|
/* +:+ +:+ +:+ */
|
||||||
|
/* By: jhalford <marvin@42.fr> +#+ +:+ +#+ */
|
||||||
|
/* +#+#+#+#+#+ +#+ */
|
||||||
|
/* Created: 2016/11/07 13:22:54 by jhalford #+# #+# */
|
||||||
|
/* Updated: 2016/12/15 15:29:22 by jhalford ### ########.fr */
|
||||||
|
/* */
|
||||||
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
#ifndef FT_PRINTF_H
|
||||||
|
# define FT_PRINTF_H
|
||||||
|
# include "libft.h"
|
||||||
|
# include <stdarg.h>
|
||||||
|
# define ALL_FLAGS "#0- +"
|
||||||
|
# define ALL_CONVERSIONS "sSpdDioOuUxXcCb"
|
||||||
|
|
||||||
|
typedef struct s_fmt t_fmt;
|
||||||
|
typedef struct s_conv t_conv;
|
||||||
|
typedef char *(t_converter)(t_fmt *fmt, va_list ap);
|
||||||
|
typedef void (t_pad_func)(char *str, t_fmt *fmt);
|
||||||
|
|
||||||
|
struct s_conv
|
||||||
|
{
|
||||||
|
char id;
|
||||||
|
char allowed_flags[6];
|
||||||
|
char base[20];
|
||||||
|
t_converter *converter;
|
||||||
|
t_pad_func *sharp_func;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct s_fmt
|
||||||
|
{
|
||||||
|
char flags[6];
|
||||||
|
int width;
|
||||||
|
int precision;
|
||||||
|
char modifier[3];
|
||||||
|
char conversion;
|
||||||
|
int valid;
|
||||||
|
t_conv conv;
|
||||||
|
};
|
||||||
|
|
||||||
|
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[];
|
||||||
|
|
||||||
|
t_fmt *ft_fmt_init(void);
|
||||||
|
void ft_fmt_print(t_fmt *fmt);
|
||||||
|
void ft_printf_color(int fd, char **final, char **str);
|
||||||
|
|
||||||
|
t_fmt *ft_printf_parse(char **format, va_list ap);
|
||||||
|
void ft_printf_parse_flags(t_fmt *fmt, char **format);
|
||||||
|
void ft_printf_parse_width(t_fmt *fmt, char **format, va_list ap);
|
||||||
|
void ft_printf_parse_precision(t_fmt *fmt, char **format, va_list ap);
|
||||||
|
void ft_printf_parse_modifiers(t_fmt *fmt, char **format);
|
||||||
|
|
||||||
|
char *ft_transform(t_fmt *fmt, va_list ap);
|
||||||
|
|
||||||
|
void ft_fmt_error_conv(char conv);
|
||||||
|
void ft_fmt_error_mod_conv(char *mod, char conv);
|
||||||
|
void ft_fmt_error_flag_conv(char flag, char conv);
|
||||||
|
void ft_fmt_error_flag_flag(char flag1, char flag2);
|
||||||
|
|
||||||
|
void ft_fmt_simplify(t_fmt *fmt);
|
||||||
|
int ft_fmt_validate_conv(t_fmt *fmt);
|
||||||
|
void ft_fmt_validate_flags(t_fmt *fmt);
|
||||||
|
void ft_fmt_validate_mod(t_fmt *fmt);
|
||||||
|
|
||||||
|
char *ft_signed_conversion(t_fmt *fmt, va_list ap);
|
||||||
|
char *ft_unsigned_conversion(t_fmt *fmt, va_list ap);
|
||||||
|
char *ft_str_conversion(t_fmt *fmt, va_list ap);
|
||||||
|
char *ft_char_conversion(t_fmt *fmt, va_list ap);
|
||||||
|
|
||||||
|
void ft_pad_sharp_o(char *str, t_fmt *fmt);
|
||||||
|
void ft_pad_sharp_xb(char *str, t_fmt *fmt);
|
||||||
|
void ft_pad_left(char *str, t_fmt *fmt);
|
||||||
|
void ft_pad_right(char *str, t_fmt *fmt);
|
||||||
|
#endif
|
||||||
|
|
@ -6,209 +6,104 @@
|
||||||
/* By: sbenning <sbenning@student.42.fr> +#+ +:+ +#+ */
|
/* By: sbenning <sbenning@student.42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2016/12/08 18:02:25 by sbenning #+# #+# */
|
/* Created: 2016/12/08 18:02:25 by sbenning #+# #+# */
|
||||||
/* Updated: 2017/01/11 17:31:09 by jhalford ### ########.fr */
|
/* Updated: 2017/01/19 16:47:18 by gwojda ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
#ifndef FT_READLINE_H
|
#ifndef FT_READLINE_H
|
||||||
# define FT_READLINE_H
|
# define FT_READLINE_H
|
||||||
|
|
||||||
# include "libft.h"
|
# include <termios.h>
|
||||||
# include "ft_curs.h"
|
# include <unistd.h>
|
||||||
|
# include <stdlib.h>
|
||||||
|
# include <stdio.h>
|
||||||
|
# include <term.h>
|
||||||
|
# include <sys/types.h>
|
||||||
|
# include <sys/xattr.h>
|
||||||
|
# include <sys/stat.h>
|
||||||
|
# include <sys/types.h>
|
||||||
|
# include <pwd.h>
|
||||||
|
# include <grp.h>
|
||||||
|
# include <uuid/uuid.h>
|
||||||
|
# include <time.h>
|
||||||
|
# include <dirent.h>
|
||||||
|
# include <locale.h>
|
||||||
|
|
||||||
/*
|
# define FLECHE_HAUT 4283163
|
||||||
* Input-Key Mapping !!! LINUX Or MACOSX !!!
|
# define FLECHE_BAS 4348699
|
||||||
*/
|
# define FLECHE_GAUCHE 4479771
|
||||||
|
# define FLECHE_DROITE 4414235
|
||||||
|
# define TOUCHE_DELETE 2117294875
|
||||||
|
# define TOUCHE_HOME 4741915
|
||||||
|
# define TOUCHE_END 4610843
|
||||||
|
# define TOUCHE_TAB 9
|
||||||
|
# define TOUCHE_OPT_RIGHT 1130044187
|
||||||
|
# define TOUCHE_OPT_LEFT 1146821403
|
||||||
|
# define TOUCHE_OPT_UP 1096489755
|
||||||
|
# define TOUCHE_OPT_DOWN 1113266971
|
||||||
|
# define TOUCHE_OPT_V 10127586
|
||||||
|
# define TOUCHE_OPT_C 42947
|
||||||
|
# define TOUCHE_OPT_X 8948194
|
||||||
|
|
||||||
//# define LINUX
|
typedef struct s_line
|
||||||
# define MACOSX
|
|
||||||
# include "ft_input.h"
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Default offset for dynamic allocation
|
|
||||||
*/
|
|
||||||
|
|
||||||
# define RL_OFFSET 1024
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Readline possible prompt
|
|
||||||
*/
|
|
||||||
|
|
||||||
# define RL_PROMPT_DEFAULT "$> "
|
|
||||||
# define RL_PROMPT_ESC "> "
|
|
||||||
# define RL_PROMPT_QUOTE "quote> "
|
|
||||||
# define RL_PROMPT_DQUOTE "double quote> "
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Bitset manipulation : X is the bitset and Y is the bit to manipulate
|
|
||||||
* IS : Is Y set in X
|
|
||||||
* NOT : Is Y not set in X
|
|
||||||
* SET : Set Y in X
|
|
||||||
* UNSET : Unset Y from X
|
|
||||||
*/
|
|
||||||
|
|
||||||
# define RL_IS(X, Y) (X & Y)
|
|
||||||
# define RL_NOT(X, Y) (!RL_IS(X, Y))
|
|
||||||
# define RL_SET(X, Y) (X |= Y)
|
|
||||||
# define RL_UNSET(X, Y) (X &= ~Y)
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Possible bit for t_line.bitset
|
|
||||||
*
|
|
||||||
* FINISH : bit to terminate and flush the readline
|
|
||||||
* STACK : bit to stack the current line and begin another one
|
|
||||||
* INSERT : bit to toogle insert-mode/replace-mode
|
|
||||||
* SELECT : bit to toogle extend-video-area-mode/clear-video-area-mode
|
|
||||||
* ESC : bit to escape quoting and new line
|
|
||||||
* QUOTE : bit to toogle quote-terminated-mode/quote-not-terminated-mode
|
|
||||||
* DQUOTE : bit to toogle dquote-terminated-mode/dquote-not-terminated-mode
|
|
||||||
* QUOTING : Regroup ESC, QUOTE and DQUOTE
|
|
||||||
*/
|
|
||||||
|
|
||||||
# define RL_FINISH (1 << 0)
|
|
||||||
# define RL_STACK (1 << 1)
|
|
||||||
# define RL_INSERT (1 << 2)
|
|
||||||
# define RL_SELECT (1 << 3)
|
|
||||||
# define RL_ESC (1 << 4)
|
|
||||||
# define RL_QUOTE (1 << 5)
|
|
||||||
# define RL_DQUOTE (1 << 6)
|
|
||||||
# define RL_QUOTING (RL_ESC | RL_QUOTE | RL_DQUOTE)
|
|
||||||
|
|
||||||
typedef struct s_data t_data;
|
|
||||||
typedef struct s_line t_line;
|
|
||||||
typedef struct s_input t_input;
|
|
||||||
typedef int (*t_input_function)(t_line *, long int);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Interactive line data:
|
|
||||||
*
|
|
||||||
* bitset : global/local state and settings for readline
|
|
||||||
* prompt : current prompt
|
|
||||||
* input : destination buffer
|
|
||||||
* pos : cursor position in the destination buffer
|
|
||||||
* size : allocated size of the destination buffer
|
|
||||||
* used : actual used size in the destination buffer
|
|
||||||
* select : start position of the video (aka selected) area in the destination buffer
|
|
||||||
* clipboard : duplication of the copied/cuted part of the destination buffer
|
|
||||||
* stack : list of stacked line. (lines are stacked when a quoted (or escaped) new line appear)
|
|
||||||
*/
|
|
||||||
|
|
||||||
struct s_line
|
|
||||||
{
|
{
|
||||||
int bitset;
|
|
||||||
char *prompt;
|
|
||||||
char *input;
|
char *input;
|
||||||
char *clipboard;
|
int prompt_size;
|
||||||
int pos;
|
} t_line;
|
||||||
int size;
|
|
||||||
int used;
|
|
||||||
int select;
|
|
||||||
t_curs curs;
|
|
||||||
t_list *stack;
|
|
||||||
t_dlist *history;
|
|
||||||
};
|
|
||||||
|
|
||||||
/*
|
typedef struct s_list_history
|
||||||
* Input data:
|
|
||||||
* code : input identifier
|
|
||||||
* function : input handler
|
|
||||||
*/
|
|
||||||
|
|
||||||
struct s_input
|
|
||||||
{
|
{
|
||||||
long int code;
|
char *str;
|
||||||
t_input_function function;
|
struct s_list_history *prev;
|
||||||
};
|
struct s_list_history *next;
|
||||||
|
} t_list_history;
|
||||||
|
|
||||||
# include "minishell.h"
|
long long ft_pow(int nbr, int power);
|
||||||
|
char *ft_strndup(char const *s, int n);
|
||||||
|
char *ft_strdupi(char const *s);
|
||||||
|
void ft_puttermcaps(char *str);
|
||||||
|
void ft_putnc(char c, int n);
|
||||||
|
int ft_size_term(void);
|
||||||
|
void ft_free_tabstr(char ***env);
|
||||||
|
int ft_is_whitespaces(char *str);
|
||||||
|
int ft_get_size_prev(char *str, size_t pos);
|
||||||
|
int ft_nb_line(char *str, size_t pos);
|
||||||
|
int ft_get_ind_prev(char *str, size_t pos);
|
||||||
|
void ft_found_next_word(char *str, size_t *pos);
|
||||||
|
void ft_move_to_beggin(char *str, size_t *pos);
|
||||||
|
int ft_nb_last_line(char *str, size_t pos);
|
||||||
|
void ft_found_prev_word(char *str, size_t *pos);
|
||||||
|
char *ft_remove_imput(char *str, size_t pos);
|
||||||
|
char *ft_realloc_imput(char *str, int a, size_t pos);
|
||||||
|
int ft_readline(void);
|
||||||
|
struct termios *ft_stats_term_termcaps(void);
|
||||||
|
struct termios *ft_save_stats_term(void);
|
||||||
|
void ft_init_line(void);
|
||||||
|
void ft_read_it(int input, size_t *pos, char **str);
|
||||||
|
void ft_check_quotes(char **s, t_list_history *head);
|
||||||
|
int ft_check_quotes_num(char *s);
|
||||||
|
void ft_del_2(char **str, size_t *i);
|
||||||
|
void ft_del_1(char **str, size_t *i);
|
||||||
|
void ft_suppr_2(char **str, size_t *i);
|
||||||
|
void ft_suppr_1(char **str, size_t *i);
|
||||||
|
void ft_print(char **str, int ret, size_t *i);
|
||||||
|
void ft_move_to_line(int ret, size_t *pos, char *str);
|
||||||
|
void ft_get_head(t_list_history **head);
|
||||||
|
void ft_push_back_history(t_list_history **head, t_list_history *new);
|
||||||
|
t_list_history *ft_create_history_list(char *str);
|
||||||
|
void ft_curse_move(char *str);
|
||||||
|
void ft_move_suppr(char *str, size_t pos);
|
||||||
|
void ft_move_dell(char *str, size_t pos);
|
||||||
|
void ft_move_to_word(int ret, size_t *pos, char *str);
|
||||||
|
void ft_history(char **str, int ret, t_list_history **head);
|
||||||
|
void ft_move_term(int ret, size_t *pos, char *str);
|
||||||
|
void ft_move_left(size_t pos, char *str);
|
||||||
|
void ft_home_end(char *str, int ret, size_t *pos);
|
||||||
|
int ft_put(int nb);
|
||||||
|
char **ft_split_whitespaces(char const *s);
|
||||||
|
void ft_cxv(int ret, size_t *pos, char **str);
|
||||||
|
char *ft_lecture(t_list_history *head);
|
||||||
|
void ft_prompt(void);
|
||||||
|
|
||||||
/*
|
|
||||||
* Readline setup/cleanup/teardown
|
|
||||||
*/
|
|
||||||
|
|
||||||
int rl_setup(t_line *line);
|
|
||||||
int rl_cleanup(t_line *line);
|
|
||||||
void rl_teardown(t_line *line);
|
|
||||||
int rl_set_termios(int input_mode);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Dynamic allocated buffer manipulation
|
|
||||||
*/
|
|
||||||
|
|
||||||
int input_maj(t_line *line, char *str, int size);
|
|
||||||
int input_move(t_line *line, char *str, int size);
|
|
||||||
void input_remove(t_line *line, int size);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Readline internal function
|
|
||||||
*/
|
|
||||||
|
|
||||||
void rl_set_prompt(t_line *line);
|
|
||||||
void rl_put_prompt(t_line *line);
|
|
||||||
int rl_previous_word(t_line *line);
|
|
||||||
int rl_next_word(t_line *line);
|
|
||||||
int rl_clipboard_new(t_line *line);
|
|
||||||
int rl_clipboard_new_cut(t_line *line);
|
|
||||||
void rl_toogle_bitset(t_line *line, int set);
|
|
||||||
int rl_finish(t_line *line);
|
|
||||||
int rl_stack_line(t_line *line);
|
|
||||||
int rl_merge_line(t_line *line);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Realine display functions:
|
|
||||||
*
|
|
||||||
* reset_display : Redraw the interactive buffer and replace the cursor
|
|
||||||
* based on t_line.input, t_line.pos and t_line.select .
|
|
||||||
* reset_display_ante : Redraw before the cursor position.
|
|
||||||
* reset_display_post : Redraw after the cursor position.
|
|
||||||
*/
|
|
||||||
|
|
||||||
void rl_reset_display(t_line *line);
|
|
||||||
void rl_reset_display_ante(t_line *line);
|
|
||||||
void rl_reset_display_post(t_line *line);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* input handler functions
|
|
||||||
*
|
|
||||||
* An handler use curs_<utilities-function> to manipulate the cursor position
|
|
||||||
* and recalc t_line.pos based on the cursor movement.
|
|
||||||
*
|
|
||||||
* An handler can also modify the content of the destination buffer.
|
|
||||||
* If it do so, it must reset all display that appear
|
|
||||||
* after the first index of that modification.
|
|
||||||
* If t_line.pos is that index, rl_reset_display_post can simply do the work.
|
|
||||||
*/
|
|
||||||
|
|
||||||
int rl_default_function(t_line *line, long int input); /* Not handled input */
|
|
||||||
int rl_esc_function(t_line *line, long int input); /* Backslash */
|
|
||||||
int rl_quote_function(t_line *line, long int input); /* Simple quote */
|
|
||||||
int rl_dquote_function(t_line *line, long int input); /* Double quote */
|
|
||||||
int rl_nl_function(t_line *line, long int input); /* New line */
|
|
||||||
int rl_comp_function(t_line *line, long int input); /* Tabulation */
|
|
||||||
int rl_left_function(t_line *line, long int input); /* Left move */
|
|
||||||
int rl_right_function(t_line *line, long int input); /* Right move */
|
|
||||||
int rl_wleft_function(t_line *line, long int input); /* Word left move */
|
|
||||||
int rl_wright_function(t_line *line, long int input); /* Word right move */
|
|
||||||
int rl_home_function(t_line *line, long int input); /* Home move */
|
|
||||||
int rl_end_function(t_line *line, long int input); /* End move */
|
|
||||||
int rl_pageup_function(t_line *line, long int input); /* Pageup move */
|
|
||||||
int rl_pagedown_function(t_line *line, long int input); /* Pagedown move*/
|
|
||||||
int rl_select_left_function(t_line *line, long int input); /* Left extend video area */
|
|
||||||
int rl_select_right_function(t_line *line, long int input); /* Right extend video area */
|
|
||||||
int rl_select_wleft_function(t_line *line, long int input); /* Word left extend video area */
|
|
||||||
int rl_select_wright_function(t_line *line, long int input); /* Word right extend video area */
|
|
||||||
int rl_select_home_function(t_line *line, long int input); /* Home extend video area */
|
|
||||||
int rl_select_end_function(t_line *line, long int input); /* End extend video area */
|
|
||||||
int rl_select_pageup_function(t_line *line, long int input); /* Pageup extend video area */
|
|
||||||
int rl_select_pagedown_function(t_line *line, long int input); /* Pagedown extend video area */
|
|
||||||
int rl_retarr_function(t_line *line, long int input); /* Remove before the cursor */
|
|
||||||
int rl_suppr_function(t_line *line, long int input); /* Remove after the cursor */
|
|
||||||
int rl_clear_function(t_line *line, long int input); /* Clear screen */
|
|
||||||
int rl_copy_function(t_line *line, long int input); /* Copy selected area or current cursor line */
|
|
||||||
int rl_cut_function(t_line *line, long int input); /* Cut selected area or current cursor line */
|
|
||||||
int rl_paste_function(t_line *line, long int input); /* Paste copied/cuted area */
|
|
||||||
int rl_insert_function(t_line *line, long int input); /* Toogle insert-mode/replacement-mode */
|
|
||||||
|
|
||||||
int ft_readline();
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -1,26 +1,21 @@
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
/* */
|
/* */
|
||||||
/* ::: :::::::: */
|
/* ::: :::::::: */
|
||||||
/* curs_single.c :+: :+: :+: */
|
/* ftxattr.h :+: :+: :+: */
|
||||||
/* +:+ +:+ +:+ */
|
/* +:+ +:+ +:+ */
|
||||||
/* By: sbenning <sbenning@student.42.fr> +#+ +:+ +#+ */
|
/* By: jhalford <marvin@42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2016/12/08 17:04:53 by sbenning #+# #+# */
|
/* Created: 2016/11/07 13:24:05 by jhalford #+# #+# */
|
||||||
/* Updated: 2016/12/09 16:40:41 by sbenning ### ########.fr */
|
/* Updated: 2016/11/07 13:24:05 by jhalford ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
#include "ft_curs.h"
|
#ifndef FT_XATTR_H
|
||||||
|
# define FT_XATTR_H
|
||||||
|
# define FT_XATTR_SIZE 10000
|
||||||
|
# include <sys/types.h>
|
||||||
|
# include <sys/xattr.h>
|
||||||
|
|
||||||
/*
|
int ft_xattr_print(char *path);
|
||||||
* Save cursor reference or return a previous saved reference
|
int ft_xattr_count(char *path);
|
||||||
*/
|
#endif
|
||||||
|
|
||||||
t_curs *curs_single(t_curs *curs, int set)
|
|
||||||
{
|
|
||||||
static t_curs *single;
|
|
||||||
|
|
||||||
if (set)
|
|
||||||
single = curs;
|
|
||||||
return (single);
|
|
||||||
}
|
|
||||||
|
|
@ -1,34 +1,31 @@
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
/* */
|
/* */
|
||||||
/* ::: :::::::: */
|
/* ::: :::::::: */
|
||||||
/* curs_clear.c :+: :+: :+: */
|
/* get_next_line.h :+: :+: :+: */
|
||||||
/* +:+ +:+ +:+ */
|
/* +:+ +:+ +:+ */
|
||||||
/* By: sbenning <sbenning@student.42.fr> +#+ +:+ +#+ */
|
/* By: jhalford <marvin@42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2016/12/08 17:28:50 by sbenning #+# #+# */
|
/* Created: 2016/11/05 12:21:36 by jhalford #+# #+# */
|
||||||
/* Updated: 2017/01/10 17:20:41 by jhalford ### ########.fr */
|
/* Updated: 2016/12/15 13:07:58 by jhalford ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
#include "ft_curs.h"
|
#ifndef GET_NEXT_LINE_H
|
||||||
|
# define GET_NEXT_LINE_H
|
||||||
|
# define BUFF_SIZE 32
|
||||||
|
|
||||||
/*
|
# include "libft.h"
|
||||||
* Clear screen and keep track of cursoe's coordonate
|
# include <sys/types.h>
|
||||||
*/
|
# include <sys/uio.h>
|
||||||
|
|
||||||
void curs_clear(t_curs *curs)
|
typedef struct s_save t_save;
|
||||||
|
|
||||||
|
struct s_save
|
||||||
{
|
{
|
||||||
ft_putstr(tgetstr("cl", NULL));
|
int fd;
|
||||||
curs->li = 0;
|
char *str;
|
||||||
curs->co = 0;
|
};
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
int get_next_line(int const fd, char **line);
|
||||||
* Clear screen after cursor position without moving cursor
|
|
||||||
*/
|
|
||||||
|
|
||||||
void curs_clear_post(t_curs *curs)
|
#endif
|
||||||
{
|
|
||||||
ft_putstr(tgetstr("cd", NULL));
|
|
||||||
(void)curs;
|
|
||||||
}
|
|
||||||
162
42sh/includes/libft.h
Normal file
162
42sh/includes/libft.h
Normal file
|
|
@ -0,0 +1,162 @@
|
||||||
|
/* ************************************************************************** */
|
||||||
|
/* */
|
||||||
|
/* ::: :::::::: */
|
||||||
|
/* libft.h :+: :+: :+: */
|
||||||
|
/* +:+ +:+ +:+ */
|
||||||
|
/* By: jhalford <jhalford@student.42.fr> +#+ +:+ +#+ */
|
||||||
|
/* +#+#+#+#+#+ +#+ */
|
||||||
|
/* Created: 2016/11/07 13:49:04 by jhalford #+# #+# */
|
||||||
|
/* Updated: 2017/01/19 16:13:05 by gwojda ### ########.fr */
|
||||||
|
/* */
|
||||||
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
#ifndef LIBFT_H
|
||||||
|
# define LIBFT_H
|
||||||
|
|
||||||
|
# define STDIN 0
|
||||||
|
# define STDOUT 1
|
||||||
|
# define STDERR 2
|
||||||
|
# define STDBUG 3
|
||||||
|
|
||||||
|
# define DG_MSG0 "{inv}{yel}%21s {bol}{blu}%-3d{eoc}"
|
||||||
|
# define DG_MSG1 ft_path_notdir(__FILE__), __LINE__
|
||||||
|
# define DG(f, ...) ft_dprintf(STDBUG, DG_MSG0 f "{eoc}\n", DG_MSG1, ##__VA_ARGS__)
|
||||||
|
|
||||||
|
# include "get_next_line.h"
|
||||||
|
# include "ft_xattr.h"
|
||||||
|
# include "mytime.h"
|
||||||
|
# include "lst.h"
|
||||||
|
# include "dlst.h"
|
||||||
|
# include "btree.h"
|
||||||
|
# include "color.h"
|
||||||
|
|
||||||
|
# include <string.h>
|
||||||
|
# include <unistd.h>
|
||||||
|
# include <stdio.h>
|
||||||
|
# include <stdlib.h>
|
||||||
|
# include <time.h>
|
||||||
|
# include <sys/xattr.h>
|
||||||
|
# include <sys/acl.h>
|
||||||
|
|
||||||
|
# define FT_WS(x) (x == ' ' || x == '\t' || x == '\n')
|
||||||
|
# define FT_ABS(x) (((x) < 0) ? -(x) : (x))
|
||||||
|
# define FT_NEG(x) (((x) < 0) ? 1 : 0)
|
||||||
|
# define FT_POS(x) (((x) > 0) ? 1 : 0)
|
||||||
|
# define FT_MIN(a, b) ((a) < (b) ? (a) : (b))
|
||||||
|
# define FT_MAX(a, b) ((a) > (b) ? (a) : (b))
|
||||||
|
# define FT_DIST(a, b) (FT_ABS((a) - (b)))
|
||||||
|
|
||||||
|
typedef struct s_stof t_stof;
|
||||||
|
typedef struct s_stos t_stos;
|
||||||
|
|
||||||
|
struct s_stos
|
||||||
|
{
|
||||||
|
char *key;
|
||||||
|
char *val;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct s_stof
|
||||||
|
{
|
||||||
|
char *name;
|
||||||
|
int (*f)();
|
||||||
|
};
|
||||||
|
|
||||||
|
void ft_debug(void);
|
||||||
|
|
||||||
|
void *ft_memset(void *b, int c, size_t len);
|
||||||
|
void ft_bzero(void *s, size_t n);
|
||||||
|
void *ft_memcpy(void *dst, const void *src, size_t n);
|
||||||
|
void *ft_memccpy(void *dst, const void *src, int c, size_t n);
|
||||||
|
void *ft_memmove(void *dst, const void *src, size_t len);
|
||||||
|
void *ft_memchr(const void *s, int c, size_t n);
|
||||||
|
int ft_memcmp(const void *s1, const void *s2, size_t n);
|
||||||
|
size_t ft_strlen(const char *s);
|
||||||
|
char *ft_strdup(const char *s1);
|
||||||
|
char *ft_strcpy(char *dst, const char *src);
|
||||||
|
char *ft_strncpy(char *dst, const char *src, size_t len);
|
||||||
|
char *ft_strcat(char *s1, const char *s2);
|
||||||
|
char *ft_strncat(char *s1, const char *s2, size_t n);
|
||||||
|
size_t ft_strlcat(char *dst, const char *src, size_t size);
|
||||||
|
char *ft_strchr(const char *s, int c);
|
||||||
|
char *ft_strrchr(const char *s, int c);
|
||||||
|
char *ft_strstr(const char *big, const char *little);
|
||||||
|
char *ft_strnstr(const char *big, const char *little, size_t len);
|
||||||
|
int ft_strcmp(const char *s1, const char *s2);
|
||||||
|
int ft_strncmp(const char *s1, const char *s2, size_t n);
|
||||||
|
int ft_atoi(const char *str);
|
||||||
|
int ft_isalpha(int c);
|
||||||
|
int ft_isdigit(int c);
|
||||||
|
int ft_isalnum(int c);
|
||||||
|
int ft_isascii(int c);
|
||||||
|
int ft_isprint(int c);
|
||||||
|
int ft_toupper(int c);
|
||||||
|
int ft_tolower(int c);
|
||||||
|
|
||||||
|
void *ft_memalloc(size_t size);
|
||||||
|
void ft_memdel(void **ap);
|
||||||
|
char *ft_strnew(size_t size);
|
||||||
|
void ft_strdel(char **as);
|
||||||
|
void ft_strclr(char *s);
|
||||||
|
void ft_striter(char *s, void (*f)(char *));
|
||||||
|
void ft_striteri(char *s, void (*f)(unsigned int, char *));
|
||||||
|
char *ft_strmap(char const *s, char (*f)(char));
|
||||||
|
char *ft_strmapi(char const *s, char (*f)(unsigned int, char));
|
||||||
|
int ft_strequ(char const *s1, char const *s2);
|
||||||
|
int ft_strnequ(char const *s1, char const *s2, size_t n);
|
||||||
|
char *ft_strsub(char const *s, unsigned int start, size_t len);
|
||||||
|
char *ft_strjoin(char const *s1, char const *s2);
|
||||||
|
char *ft_strtrim(char const *s);
|
||||||
|
char **ft_strsplit(char const *s, char c);
|
||||||
|
char *ft_itoa(int n);
|
||||||
|
int ft_putchar(int c);
|
||||||
|
void ft_putstr(char const *s);
|
||||||
|
void ft_putendl(char const *s);
|
||||||
|
void ft_putnbr(int n);
|
||||||
|
void ft_putchar_fd(char c, int fd);
|
||||||
|
void ft_putstr_fd(char const *s, int fd);
|
||||||
|
void ft_putendl_fd(char const *s, int fd);
|
||||||
|
void ft_putnbr_fd(int n, int fd);
|
||||||
|
void ft_putaddr(void *a);
|
||||||
|
|
||||||
|
char *ft_strrev(char *str);
|
||||||
|
char **ft_strsplit(char const *s, char c);
|
||||||
|
char *ft_str3join(char const *s1, char const *s2, char const *s3);
|
||||||
|
char *ft_strcut(char *str, char *cut);
|
||||||
|
char **ft_split_whitespaces(char const *str);
|
||||||
|
char *ft_convert_base(
|
||||||
|
char *str, char *base_from, char *base_to, char *flags);
|
||||||
|
char *ft_strcatf(char *s1, const char *s2);
|
||||||
|
char *ft_strinsert(char *str, char c, int n);
|
||||||
|
int ft_strappend(char **dst, char *src);
|
||||||
|
char *ft_strbetween(char *start, char *end);
|
||||||
|
char *ft_strreplace(char **str, char *start, char *end, char *new);
|
||||||
|
|
||||||
|
char *ft_itoa_base(int nbr, char *base, char *flags);
|
||||||
|
char *ft_lltoa_base(long long nbr, char *base, char *flags);
|
||||||
|
char *ft_ulltoa_base(unsigned long long nbr, char *base);
|
||||||
|
char *ft_uitoa_base(unsigned int nbr, char *base);
|
||||||
|
size_t ft_ilen(int n);
|
||||||
|
size_t ft_ilen_base(int n, int base);
|
||||||
|
size_t ft_uilen(unsigned int n);
|
||||||
|
size_t ft_lllen(long long n);
|
||||||
|
size_t ft_lllen_base(long long n, int base);
|
||||||
|
int ft_addrcmp(void *a, void *b);
|
||||||
|
|
||||||
|
char **ft_sstradd(char **list, char *new);
|
||||||
|
void ft_sstrsort(char **list, int (*cmp)());
|
||||||
|
void ft_sstrprint(char **list, char sep);
|
||||||
|
void ft_sstrprint_fd(int fd, char **list, char sep);
|
||||||
|
char **ft_sstrdup(char **list);
|
||||||
|
void ft_sstrdel(char **sstr, int index);
|
||||||
|
void ft_sstrfree(char **sstr);
|
||||||
|
char *ft_sstrcat(char **sstr, char sep);
|
||||||
|
|
||||||
|
char *ft_path_notdir(char *path);
|
||||||
|
|
||||||
|
int ft_printf(const char *format, ...);
|
||||||
|
int ft_dprintf(int fd, const char *format, ...);
|
||||||
|
|
||||||
|
char *ft_getenv(char **env, char *key);
|
||||||
|
|
||||||
|
void *ft_realloc(void *data, int size);
|
||||||
|
#endif
|
||||||
80
42sh/includes/lst.h
Normal file
80
42sh/includes/lst.h
Normal file
|
|
@ -0,0 +1,80 @@
|
||||||
|
/* ************************************************************************** */
|
||||||
|
/* */
|
||||||
|
/* ::: :::::::: */
|
||||||
|
/* lst.h :+: :+: :+: */
|
||||||
|
/* +:+ +:+ +:+ */
|
||||||
|
/* By: jhalford <marvin@42.fr> +#+ +:+ +#+ */
|
||||||
|
/* +#+#+#+#+#+ +#+ */
|
||||||
|
/* Created: 2016/11/07 13:27:46 by jhalford #+# #+# */
|
||||||
|
/* Updated: 2016/12/12 14:59:12 by jhalford ### ########.fr */
|
||||||
|
/* */
|
||||||
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
#ifndef LST_H
|
||||||
|
# define LST_H
|
||||||
|
|
||||||
|
# include "libft.h"
|
||||||
|
|
||||||
|
struct s_list
|
||||||
|
{
|
||||||
|
void *content;
|
||||||
|
size_t content_size;
|
||||||
|
struct s_list *next;
|
||||||
|
};
|
||||||
|
|
||||||
|
typedef struct s_list t_list;
|
||||||
|
|
||||||
|
t_list *ft_lstnew(void const *content, size_t content_size);
|
||||||
|
void ft_lstdel(t_list **alst, void (*del)(void *, size_t));
|
||||||
|
void ft_lstdelone(t_list **alst, void (*del)(void *, size_t));
|
||||||
|
void ft_lstadd(t_list **alst, t_list *new);
|
||||||
|
void ft_lstiter(t_list *lst, void (*f)(t_list *elem));
|
||||||
|
t_list *ft_lstmap(t_list *lst, t_list *(*f)(t_list *elem));
|
||||||
|
|
||||||
|
t_list *ft_lstnew_range(int a, int b);
|
||||||
|
void ft_lsteadd(t_list **alst, t_list *new);
|
||||||
|
void ft_lstnadd(t_list **alst, t_list *new, int n);
|
||||||
|
void ft_lstsort(t_list **begin_list, int (*cmp)());
|
||||||
|
void ft_lst_print(t_list *list, void (*printer)());
|
||||||
|
int ft_lstsize(t_list *lst);
|
||||||
|
t_list *ft_lstlast(t_list *lst);
|
||||||
|
void ft_lst_sorted_merge(
|
||||||
|
t_list **begin_list1,
|
||||||
|
t_list *begin_list2,
|
||||||
|
int (*cmp)());
|
||||||
|
void ft_lst_sorted_insert(
|
||||||
|
t_list **begin_list,
|
||||||
|
t_list *insert,
|
||||||
|
int (*cmp)());
|
||||||
|
void ft_lst_delif(
|
||||||
|
t_list **alist,
|
||||||
|
void *data_ref,
|
||||||
|
int (*cmp)(),
|
||||||
|
void (*del)(void *, size_t));
|
||||||
|
void ft_lst_delsub(
|
||||||
|
t_list **alst,
|
||||||
|
t_list *sub, int (*cmp)(),
|
||||||
|
void (*del)(void *, size_t));
|
||||||
|
void ft_lst_cfree(void *ptr, size_t size);
|
||||||
|
void ft_lst_bfree(void *ptr, size_t size);
|
||||||
|
t_list *ft_lst_filter(
|
||||||
|
t_list *lst,
|
||||||
|
void const *data_ref,
|
||||||
|
t_list *(*f)(t_list *elem, void const *));
|
||||||
|
t_list *ft_lst_removeif(
|
||||||
|
t_list **alst,
|
||||||
|
void *data_ref,
|
||||||
|
int (*cmp)());
|
||||||
|
t_list *ft_lst_find(
|
||||||
|
t_list *begin_list,
|
||||||
|
void *data_ref,
|
||||||
|
int (*cmp)());
|
||||||
|
t_list *ft_lstpop(t_list **lst);
|
||||||
|
void ft_lst_merge(t_list **begin_list1, t_list *begin_list2);
|
||||||
|
void ft_lst_reverse(t_list **begin_list);
|
||||||
|
|
||||||
|
int ft_diff(void *a, void *b);
|
||||||
|
t_list *ft_id(t_list *a);
|
||||||
|
t_list *ft_lst_at(t_list *list, unsigned int nbr);
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
@ -3,10 +3,10 @@
|
||||||
/* ::: :::::::: */
|
/* ::: :::::::: */
|
||||||
/* minishell.h :+: :+: :+: */
|
/* minishell.h :+: :+: :+: */
|
||||||
/* +:+ +:+ +:+ */
|
/* +:+ +:+ +:+ */
|
||||||
/* By: jhalford <marvin@42.fr> +#+ +:+ +#+ */
|
/* By: jhalford <jhalford@student.42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2016/11/10 13:07:44 by jhalford #+# #+# */
|
/* Created: 2016/11/10 13:07:44 by jhalford #+# #+# */
|
||||||
/* Updated: 2017/01/11 17:17:16 by jhalford ### ########.fr */
|
/* Updated: 2017/01/19 15:21:51 by gwojda ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,32 +1,34 @@
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
/* */
|
/* */
|
||||||
/* ::: :::::::: */
|
/* ::: :::::::: */
|
||||||
/* rl_clear_function.c :+: :+: :+: */
|
/* mytime.h :+: :+: :+: */
|
||||||
/* +:+ +:+ +:+ */
|
/* +:+ +:+ +:+ */
|
||||||
/* By: sbenning <sbenning@student.42.fr> +#+ +:+ +#+ */
|
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2016/12/09 13:34:29 by sbenning #+# #+# */
|
/* Created: 2016/11/25 11:43:12 by jhalford #+# #+# */
|
||||||
/* Updated: 2017/01/10 17:46:00 by jhalford ### ########.fr */
|
/* Updated: 2016/11/25 20:26:20 by jhalford ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
#include "ft_readline.h"
|
#ifndef MYTIME_H
|
||||||
|
# define MYTIME_H
|
||||||
|
# include "libft.h"
|
||||||
|
|
||||||
int rl_clear_function(t_line *line, long int input)
|
struct s_mytime
|
||||||
{
|
{
|
||||||
int pos;
|
char *year;
|
||||||
|
char *month;
|
||||||
|
char *day;
|
||||||
|
char *hour;
|
||||||
|
char *min;
|
||||||
|
char *sec;
|
||||||
|
};
|
||||||
|
|
||||||
if (RL_IS(line->bitset, RL_SELECT))
|
typedef struct s_mytime t_mytime;
|
||||||
RL_UNSET(line->bitset, RL_SELECT);
|
|
||||||
curs_clear(&line->curs);
|
int ft_time_isrecent(time_t event);
|
||||||
rl_put_prompt(line);
|
|
||||||
pos = line->pos;
|
t_mytime *ft_mytime_get(time_t epoch);
|
||||||
line->pos = 0;
|
void ft_mytime_free(t_mytime **time);
|
||||||
if (line->used)
|
|
||||||
rl_reset_display_post(line);
|
#endif
|
||||||
if (pos)
|
|
||||||
curs_forward(&line->curs, pos);
|
|
||||||
line->pos = pos;
|
|
||||||
return (0);
|
|
||||||
(void)input;
|
|
||||||
}
|
|
||||||
BIN
42sh/obj/ast_free.o
Normal file
BIN
42sh/obj/ast_free.o
Normal file
Binary file not shown.
BIN
42sh/obj/builtin_bg.o
Normal file
BIN
42sh/obj/builtin_bg.o
Normal file
Binary file not shown.
BIN
42sh/obj/builtin_cd.o
Normal file
BIN
42sh/obj/builtin_cd.o
Normal file
Binary file not shown.
BIN
42sh/obj/builtin_echo.o
Normal file
BIN
42sh/obj/builtin_echo.o
Normal file
Binary file not shown.
BIN
42sh/obj/builtin_env.o
Normal file
BIN
42sh/obj/builtin_env.o
Normal file
Binary file not shown.
BIN
42sh/obj/builtin_exit.o
Normal file
BIN
42sh/obj/builtin_exit.o
Normal file
Binary file not shown.
BIN
42sh/obj/builtin_fg.o
Normal file
BIN
42sh/obj/builtin_fg.o
Normal file
Binary file not shown.
BIN
42sh/obj/builtin_jobs.o
Normal file
BIN
42sh/obj/builtin_jobs.o
Normal file
Binary file not shown.
BIN
42sh/obj/builtin_setenv.o
Normal file
BIN
42sh/obj/builtin_setenv.o
Normal file
Binary file not shown.
BIN
42sh/obj/builtin_unsetenv.o
Normal file
BIN
42sh/obj/builtin_unsetenv.o
Normal file
Binary file not shown.
BIN
42sh/obj/command_getoutput.o
Normal file
BIN
42sh/obj/command_getoutput.o
Normal file
Binary file not shown.
BIN
42sh/obj/copy_cut_paste.o
Normal file
BIN
42sh/obj/copy_cut_paste.o
Normal file
Binary file not shown.
BIN
42sh/obj/data_exit.o
Normal file
BIN
42sh/obj/data_exit.o
Normal file
Binary file not shown.
BIN
42sh/obj/data_init.o
Normal file
BIN
42sh/obj/data_init.o
Normal file
Binary file not shown.
BIN
42sh/obj/data_singleton.o
Normal file
BIN
42sh/obj/data_singleton.o
Normal file
Binary file not shown.
BIN
42sh/obj/do_job_notification.o
Normal file
BIN
42sh/obj/do_job_notification.o
Normal file
Binary file not shown.
BIN
42sh/obj/exec_ampersand.o
Normal file
BIN
42sh/obj/exec_ampersand.o
Normal file
Binary file not shown.
BIN
42sh/obj/exec_and_if.o
Normal file
BIN
42sh/obj/exec_and_if.o
Normal file
Binary file not shown.
BIN
42sh/obj/exec_command.o
Normal file
BIN
42sh/obj/exec_command.o
Normal file
Binary file not shown.
BIN
42sh/obj/exec_dgreat.o
Normal file
BIN
42sh/obj/exec_dgreat.o
Normal file
Binary file not shown.
BIN
42sh/obj/exec_great.o
Normal file
BIN
42sh/obj/exec_great.o
Normal file
Binary file not shown.
BIN
42sh/obj/exec_less.o
Normal file
BIN
42sh/obj/exec_less.o
Normal file
Binary file not shown.
BIN
42sh/obj/exec_or_if.o
Normal file
BIN
42sh/obj/exec_or_if.o
Normal file
Binary file not shown.
BIN
42sh/obj/exec_pipe.o
Normal file
BIN
42sh/obj/exec_pipe.o
Normal file
Binary file not shown.
BIN
42sh/obj/exec_semi.o
Normal file
BIN
42sh/obj/exec_semi.o
Normal file
Binary file not shown.
BIN
42sh/obj/ft_exec.o
Normal file
BIN
42sh/obj/ft_exec.o
Normal file
Binary file not shown.
BIN
42sh/obj/ft_findexec.o
Normal file
BIN
42sh/obj/ft_findexec.o
Normal file
Binary file not shown.
BIN
42sh/obj/ft_parse.o
Normal file
BIN
42sh/obj/ft_parse.o
Normal file
Binary file not shown.
BIN
42sh/obj/ft_post_tokenize.o
Normal file
BIN
42sh/obj/ft_post_tokenize.o
Normal file
Binary file not shown.
BIN
42sh/obj/ft_putast.o
Normal file
BIN
42sh/obj/ft_putast.o
Normal file
Binary file not shown.
BIN
42sh/obj/ft_putast2.o
Normal file
BIN
42sh/obj/ft_putast2.o
Normal file
Binary file not shown.
BIN
42sh/obj/ft_split_whitespaces.o
Normal file
BIN
42sh/obj/ft_split_whitespaces.o
Normal file
Binary file not shown.
BIN
42sh/obj/ft_tokenize.o
Normal file
BIN
42sh/obj/ft_tokenize.o
Normal file
Binary file not shown.
BIN
42sh/obj/get_lexer_state.o
Normal file
BIN
42sh/obj/get_lexer_state.o
Normal file
Binary file not shown.
BIN
42sh/obj/get_touch.o
Normal file
BIN
42sh/obj/get_touch.o
Normal file
Binary file not shown.
BIN
42sh/obj/get_touch_toolz.o
Normal file
BIN
42sh/obj/get_touch_toolz.o
Normal file
Binary file not shown.
BIN
42sh/obj/get_touch_toolz_2.o
Normal file
BIN
42sh/obj/get_touch_toolz_2.o
Normal file
Binary file not shown.
BIN
42sh/obj/is_builtin.o
Normal file
BIN
42sh/obj/is_builtin.o
Normal file
Binary file not shown.
BIN
42sh/obj/job_addprocess.o
Normal file
BIN
42sh/obj/job_addprocess.o
Normal file
Binary file not shown.
BIN
42sh/obj/job_cmp_id.o
Normal file
BIN
42sh/obj/job_cmp_id.o
Normal file
Binary file not shown.
BIN
42sh/obj/job_format.o
Normal file
BIN
42sh/obj/job_format.o
Normal file
Binary file not shown.
BIN
42sh/obj/job_format_head.o
Normal file
BIN
42sh/obj/job_format_head.o
Normal file
Binary file not shown.
BIN
42sh/obj/job_free.o
Normal file
BIN
42sh/obj/job_free.o
Normal file
Binary file not shown.
BIN
42sh/obj/job_getprocess.o
Normal file
BIN
42sh/obj/job_getprocess.o
Normal file
Binary file not shown.
BIN
42sh/obj/job_getrank.o
Normal file
BIN
42sh/obj/job_getrank.o
Normal file
Binary file not shown.
BIN
42sh/obj/job_is_completed.o
Normal file
BIN
42sh/obj/job_is_completed.o
Normal file
Binary file not shown.
BIN
42sh/obj/job_is_stopped.o
Normal file
BIN
42sh/obj/job_is_stopped.o
Normal file
Binary file not shown.
BIN
42sh/obj/job_kill_all.o
Normal file
BIN
42sh/obj/job_kill_all.o
Normal file
Binary file not shown.
BIN
42sh/obj/job_notify_change.o
Normal file
BIN
42sh/obj/job_notify_change.o
Normal file
Binary file not shown.
BIN
42sh/obj/job_notify_new.o
Normal file
BIN
42sh/obj/job_notify_new.o
Normal file
Binary file not shown.
BIN
42sh/obj/job_remove.o
Normal file
BIN
42sh/obj/job_remove.o
Normal file
Binary file not shown.
BIN
42sh/obj/job_update_id.o
Normal file
BIN
42sh/obj/job_update_id.o
Normal file
Binary file not shown.
BIN
42sh/obj/job_update_status.o
Normal file
BIN
42sh/obj/job_update_status.o
Normal file
Binary file not shown.
BIN
42sh/obj/job_wait.o
Normal file
BIN
42sh/obj/job_wait.o
Normal file
Binary file not shown.
BIN
42sh/obj/launch_process.o
Normal file
BIN
42sh/obj/launch_process.o
Normal file
Binary file not shown.
BIN
42sh/obj/lexer_backslash.o
Normal file
BIN
42sh/obj/lexer_backslash.o
Normal file
Binary file not shown.
BIN
42sh/obj/lexer_default.o
Normal file
BIN
42sh/obj/lexer_default.o
Normal file
Binary file not shown.
BIN
42sh/obj/lexer_delim.o
Normal file
BIN
42sh/obj/lexer_delim.o
Normal file
Binary file not shown.
BIN
42sh/obj/lexer_dquote.o
Normal file
BIN
42sh/obj/lexer_dquote.o
Normal file
Binary file not shown.
BIN
42sh/obj/lexer_great.o
Normal file
BIN
42sh/obj/lexer_great.o
Normal file
Binary file not shown.
BIN
42sh/obj/lexer_greatand.o
Normal file
BIN
42sh/obj/lexer_greatand.o
Normal file
Binary file not shown.
BIN
42sh/obj/lexer_less.o
Normal file
BIN
42sh/obj/lexer_less.o
Normal file
Binary file not shown.
BIN
42sh/obj/lexer_lessand.o
Normal file
BIN
42sh/obj/lexer_lessand.o
Normal file
Binary file not shown.
BIN
42sh/obj/lexer_number.o
Normal file
BIN
42sh/obj/lexer_number.o
Normal file
Binary file not shown.
BIN
42sh/obj/lexer_quote.o
Normal file
BIN
42sh/obj/lexer_quote.o
Normal file
Binary file not shown.
BIN
42sh/obj/lexer_sep.o
Normal file
BIN
42sh/obj/lexer_sep.o
Normal file
Binary file not shown.
BIN
42sh/obj/lexer_special.o
Normal file
BIN
42sh/obj/lexer_special.o
Normal file
Binary file not shown.
BIN
42sh/obj/lexer_var.o
Normal file
BIN
42sh/obj/lexer_var.o
Normal file
Binary file not shown.
BIN
42sh/obj/lexer_word.o
Normal file
BIN
42sh/obj/lexer_word.o
Normal file
Binary file not shown.
BIN
42sh/obj/line_return_toolz.o
Normal file
BIN
42sh/obj/line_return_toolz.o
Normal file
Binary file not shown.
BIN
42sh/obj/list_toolz.o
Normal file
BIN
42sh/obj/list_toolz.o
Normal file
Binary file not shown.
BIN
42sh/obj/main.o
Normal file
BIN
42sh/obj/main.o
Normal file
Binary file not shown.
BIN
42sh/obj/mark_job_as_running.o
Normal file
BIN
42sh/obj/mark_job_as_running.o
Normal file
Binary file not shown.
BIN
42sh/obj/move_to_line.o
Normal file
BIN
42sh/obj/move_to_line.o
Normal file
Binary file not shown.
BIN
42sh/obj/parse_dgreat.o
Normal file
BIN
42sh/obj/parse_dgreat.o
Normal file
Binary file not shown.
BIN
42sh/obj/parse_dless.o
Normal file
BIN
42sh/obj/parse_dless.o
Normal file
Binary file not shown.
BIN
42sh/obj/parse_great.o
Normal file
BIN
42sh/obj/parse_great.o
Normal file
Binary file not shown.
BIN
42sh/obj/parse_greatand.o
Normal file
BIN
42sh/obj/parse_greatand.o
Normal file
Binary file not shown.
BIN
42sh/obj/parse_less.o
Normal file
BIN
42sh/obj/parse_less.o
Normal file
Binary file not shown.
BIN
42sh/obj/parse_lessand.o
Normal file
BIN
42sh/obj/parse_lessand.o
Normal file
Binary file not shown.
BIN
42sh/obj/parse_separator.o
Normal file
BIN
42sh/obj/parse_separator.o
Normal file
Binary file not shown.
BIN
42sh/obj/parse_subshell.o
Normal file
BIN
42sh/obj/parse_subshell.o
Normal file
Binary file not shown.
BIN
42sh/obj/parse_word.o
Normal file
BIN
42sh/obj/parse_word.o
Normal file
Binary file not shown.
BIN
42sh/obj/print_and_del.o
Normal file
BIN
42sh/obj/print_and_del.o
Normal file
Binary file not shown.
BIN
42sh/obj/process_cmp_pid.o
Normal file
BIN
42sh/obj/process_cmp_pid.o
Normal file
Binary file not shown.
BIN
42sh/obj/process_format.o
Normal file
BIN
42sh/obj/process_format.o
Normal file
Binary file not shown.
BIN
42sh/obj/process_free.o
Normal file
BIN
42sh/obj/process_free.o
Normal file
Binary file not shown.
BIN
42sh/obj/process_mark_status.o
Normal file
BIN
42sh/obj/process_mark_status.o
Normal file
Binary file not shown.
BIN
42sh/obj/process_redirect.o
Normal file
BIN
42sh/obj/process_redirect.o
Normal file
Binary file not shown.
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue