Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- gcc -c -Wall -Wextra -Werror ft_putchar.c ft_swap.c ft_putstr.c ft_strlen.c ft_strcmp.c &&
- ar r libft.a ft_putchar.o ft_swap.o ft_putstr.o ft_strlen.o ft_strcmp.o && rm *.o
- /* ************************************************************************** */
- /* */
- /* ::: :::::::: */
- /* ft_print_program_name.c :+: :+: :+: */
- /* +:+ +:+ +:+ */
- /* By: dcaudoux <[email protected]> +#+ +:+ +#+ */
- /* +#+#+#+#+#+ +#+ */
- /* Created: 2017/08/14 06:40:03 by dcaudoux #+# #+# */
- /* Updated: 2017/08/17 23:06:18 by dcaudoux ### ########.fr */
- /* */
- /* ************************************************************************** */
- #include <unistd.h>
- #include <stdio.h>
- void ft_putchar(char c);
- void ft_putstr(char *str)
- {
- int i;
- i = 0;
- while (str[i] != '\0')
- {
- ft_putchar(str[i]);
- i++;
- }
- }
- int main(int argc, char **argv)
- {
- argc = 0;
- ft_putstr(argv[0]);
- ft_putchar('\n');
- return (0);
- }
- /* ************************************************************************** */
- /* */
- /* ::: :::::::: */
- /* ft_putchar.c :+: :+: :+: */
- /* +:+ +:+ +:+ */
- /* By: dcaudoux <[email protected]> +#+ +:+ +#+ */
- /* +#+#+#+#+#+ +#+ */
- /* Created: 2017/08/14 05:39:05 by dcaudoux #+# #+# */
- /* Updated: 2017/08/17 02:19:55 by dcaudoux ### ########.fr */
- /* */
- /* ************************************************************************** */
- #include <unistd.h>
- void ft_putchar(char c);
- void ft_putstr(char *str)
- {
- int i;
- i = 0;
- while (str[i])
- {
- ft_putchar(str[i]);
- i++;
- }
- }
- int main(int argc, char **argv)
- {
- int i;
- i = 1;
- if (argc == 1)
- {
- return (0);
- }
- while (argv[i] != '\0')
- {
- ft_putstr(argv[i]);
- i++;
- ft_putchar('\n');
- }
- return (0);
- }
- /* ************************************************************************** */
- /* */
- /* ::: :::::::: */
- /* ft_print_program_name.c :+: :+: :+: */
- /* +:+ +:+ +:+ */
- /* By: dcaudoux <[email protected]> +#+ +:+ +#+ */
- /* +#+#+#+#+#+ +#+ */
- /* Created: 2017/08/14 06:40:03 by dcaudoux #+# #+# */
- /* Updated: 2017/08/17 01:16:29 by dcaudoux ### ########.fr */
- /* */
- /* ************************************************************************** */
- #include <unistd.h>
- #include <stdio.h>
- void ft_putchar(char c);
- void ft_putstr(char *str)
- {
- int i;
- i = 0;
- while (str[i] != '\0')
- {
- ft_putchar(str[i]);
- i++;
- }
- }
- int main(int argc, char **argv)
- {
- int i;
- int j;
- i = argc - 1;
- while (i > 0)
- {
- j = 0;
- while (argv[i][j])
- {
- ft_putchar(argv[i][j]);
- j++;
- }
- ft_putchar('\n');
- i--;
- }
- return (0);
- }
- /* ************************************************************************** */
- /* */
- /* ::: :::::::: */
- /* ft_sort_params.c :+: :+: :+: */
- /* +:+ +:+ +:+ */
- /* By: dcaudoux <[email protected]> +#+ +:+ +#+ */
- /* +#+#+#+#+#+ +#+ */
- /* Created: 2017/08/17 01:19:58 by dcaudoux #+# #+# */
- /* Updated: 2017/08/18 02:13:59 by dcaudoux ### ########.fr */
- /* */
- /* ************************************************************************** */
- #include <unistd.h>
- #include <stdio.h>
- #include <string.h>
- void ft_putchar(char c);
- void ft_putstr(char *str)
- {
- int i;
- i = 0;
- while (str[i] != '\0')
- {
- ft_putchar(str[i]);
- i++;
- }
- }
- int ft_strcmp(char *s1, char *s2)
- {
- int i;
- i = 0;
- while (s1[i] || s2[i])
- {
- if (s1[i] != s2[i])
- return (s1[i] - s2[i]);
- i++;
- }
- return (0);
- }
- int main(int argc, char **argv)
- {
- int i;
- char *tmp;
- i = 1;
- while (i < argc - 1)
- {
- if (ft_strcmp(argv[i], argv[i + 1]) > 0)
- {
- tmp = argv[i];
- argv[i] = argv[i + 1];
- argv[i + 1] = tmp;
- i = 0;
- }
- i++;
- }
- i = 1;
- while (i < argc)
- {
- ft_putstr(argv[i]);
- ft_putchar('\n');
- i++;
- }
- return (0);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement