mirror of
https://github.com/KeyZox71/ft_minipowershell.git
synced 2025-05-14 00:08:47 +02:00
「✨」 feat(Prompt): prompt working
This commit is contained in:
@ -6,11 +6,11 @@
|
||||
/* By: adjoly <adjoly@student.42angouleme.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2023/11/17 16:48:37 by adjoly #+# #+# */
|
||||
/* Updated: 2024/03/16 21:46:36 by adjoly ### ########.fr */
|
||||
/* Updated: 2024/04/27 17:27:13 by adjoly ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include "ft_printf.h"
|
||||
#include "../../libft.h"
|
||||
|
||||
int ft_putaddr(void *ptr)
|
||||
{
|
||||
@ -19,7 +19,7 @@ int ft_putaddr(void *ptr)
|
||||
if (ptr == NULL)
|
||||
return (write(1, "(nil)", 5));
|
||||
write(1, "0x", 2);
|
||||
r = ft_putnbrbase_p((long unsigned int)ptr, "0123456789abcdef");
|
||||
r = ft_putnbrbasep((long unsigned int)ptr, "0123456789abcdef");
|
||||
return (2 + r);
|
||||
}
|
||||
|
||||
@ -56,9 +56,9 @@ int ft_printconversion(char conversion, va_list args)
|
||||
else if (conversion == 'p')
|
||||
count = ft_putaddr(va_arg(args, void *));
|
||||
else if (conversion == 'x')
|
||||
count = ft_pputnbrbase(va_arg(args, unsigned long), "0123456789abcdef");
|
||||
count = ft_putnbrbasep(va_arg(args, unsigned long), "0123456789abcdef");
|
||||
else if (conversion == 'X')
|
||||
count = ft_pputnbrbase(va_arg(args, unsigned long), "0123456789ABCDEF");
|
||||
count = ft_putnbrbasep(va_arg(args, unsigned long), "0123456789ABCDEF");
|
||||
return (count);
|
||||
}
|
||||
|
||||
|
@ -1,33 +0,0 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* ft_printf.h :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: adjoly <adjoly@student.42angouleme.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2023/11/17 16:50:36 by adjoly #+# #+# */
|
||||
/* Updated: 2024/03/16 21:47:28 by adjoly ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#ifndef FT_PRINTF_H
|
||||
# define FT_PRINTF_H
|
||||
|
||||
# include <stdlib.h>
|
||||
# include <stdarg.h>
|
||||
# include <unistd.h>
|
||||
|
||||
int ft_printf(const char *format, ...);
|
||||
int ft_printconversion(char conversion, va_list args);
|
||||
int ft_putnbrulong(unsigned int n);
|
||||
int ft_putaddr(void *ptr);
|
||||
|
||||
int ft_putstr_p(char *s);
|
||||
|
||||
int ft_putnbrbase_p(unsigned long int n, char *base);
|
||||
int ft_pputnbrbase(unsigned int n, char *base);
|
||||
int ft_putchar_p(char c);
|
||||
int ft_putnbr_p(int n);
|
||||
size_t ft_strlen(const char *s);
|
||||
|
||||
#endif
|
@ -6,11 +6,11 @@
|
||||
/* By: adjoly <adjoly@student.42angouleme.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2023/11/18 10:49:00 by adjoly #+# #+# */
|
||||
/* Updated: 2024/02/04 15:17:42 by adjoly ### ########.fr */
|
||||
/* Updated: 2024/04/27 17:22:30 by adjoly ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include "ft_printf.h"
|
||||
#include <unistd.h>
|
||||
|
||||
int ft_putchar_p(char c)
|
||||
{
|
||||
|
@ -6,11 +6,11 @@
|
||||
/* By: adjoly <adjoly@student.42angouleme.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2023/10/31 11:52:46 by adjoly #+# #+# */
|
||||
/* Updated: 2024/02/04 15:20:26 by adjoly ### ########.fr */
|
||||
/* Updated: 2024/04/27 17:24:27 by adjoly ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include "ft_printf.h"
|
||||
#include "../../libft.h"
|
||||
|
||||
int ft_putnbr_p(int n)
|
||||
{
|
||||
|
@ -6,11 +6,11 @@
|
||||
/* By: adjoly <adjoly@student.42angouleme.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2023/11/18 10:57:44 by adjoly #+# #+# */
|
||||
/* Updated: 2024/02/04 15:21:56 by adjoly ### ########.fr */
|
||||
/* Updated: 2024/04/27 17:29:04 by adjoly ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include "ft_printf.h"
|
||||
#include "../../libft.h"
|
||||
|
||||
int ft_putnbrbase_pf(unsigned int n, char *base)
|
||||
{
|
||||
@ -29,7 +29,7 @@ int ft_putnbrbase_pf(unsigned int n, char *base)
|
||||
return (len);
|
||||
}
|
||||
|
||||
int ft_putnbrbase_p(unsigned long int n, char *base)
|
||||
int ft_putnbrbasep(unsigned long int n, char *base)
|
||||
{
|
||||
unsigned long int base_len;
|
||||
int len;
|
||||
@ -40,7 +40,7 @@ int ft_putnbrbase_p(unsigned long int n, char *base)
|
||||
len += write(1, &base[n % base_len], 1);
|
||||
else
|
||||
{
|
||||
len += ft_putnbrbase_p(n / base_len, base);
|
||||
len += ft_putnbrbasep(n / base_len, base);
|
||||
len += write(1, &base[n % base_len], 1);
|
||||
}
|
||||
return (len);
|
||||
|
@ -6,11 +6,11 @@
|
||||
/* By: adjoly <adjoly@student.42angouleme.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2023/10/31 11:45:55 by adjoly #+# #+# */
|
||||
/* Updated: 2024/03/12 15:05:16 by adjoly ### ########.fr */
|
||||
/* Updated: 2024/04/27 17:24:56 by adjoly ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include "ft_printf.h"
|
||||
#include "../../libft.h"
|
||||
|
||||
int ft_putstr_p(char *s)
|
||||
{
|
||||
|
Reference in New Issue
Block a user