Coder Social home page Coder Social logo

ft_ls's Introduction

Hi there, I'm Andrey! ๐Ÿ‘‹

My Codewars Profile Badge

About Me

Tech Stack

> man reysand

  OS:     Arch Linux
  Shell:  Zsh
  VCS:    Git
  Editor: Vim
  Stack:  C/C++, Java, SQL, Docker

> โ–ˆ

GitHub Analytics

ft_ls's People

Contributors

reysand avatar

Watchers

 avatar

ft_ls's Issues

Norm

Norme: include/ft_ls.h

  1. Error (line 52): line has 92 characters
    int ft_ls(char *name, t_file **file, t_option *option, int i, int ret);

Norme: src/ft_ls.c

  1. Error (line 55): ft_ls have 5 parameters
    int ft_ls(char *name, t_file **file, t_option *option, int i, int ret)
  2. Error (line 55): function ft_ls has 29 lines

    ft_ls/src/ft_ls.c

    Lines 55 to 86 in fe4054c

    int ft_ls(char *name, t_file **file, t_option *option, int i, int ret)
    {
    t_dirent *entry;
    DIR *dir;
    if (!(dir = opendir(name)))
    {
    if (errno == ENOTDIR)
    {
    ft_printf("%s\n", name);
    return (EXIT_SUCCESS);
    }
    else
    {
    ft_printf_fd(STDERR_FILENO, ERR_MSG, name, strerror(errno));
    return (EXIT_FAILURE);
    }
    }
    if (i > 1 && ret == EXIT_SUCCESS)
    ft_printf("\n");
    if (i > 1)
    ft_printf("%s:\n", name);
    while ((entry = readdir(dir)))
    {
    if (option->dot_files)
    get_info(&file, entry);
    else if ((entry->d_name)[0] != '.')
    get_info(&file, entry);
    }
    closedir(dir);
    return (EXIT_SUCCESS);
    }

Norme: src/main.c

  1. Error (line 37): function args_handler has 36 lines

    ft_ls/src/main.c

    Lines 37 to 75 in fe4054c

    int args_handler(char **files, t_args *args, t_option *option)
    {
    t_file *file_info;
    int i;
    int ret;
    i = 0;
    ret = EXIT_SUCCESS;
    file_info = NULL;
    while (i < args->files_c)
    {
    if (ft_ls(files[i], &file_info, option, i, ret))
    ret = EXIT_FAILURE;
    /*
    ** Needed add to list of file_info
    */
    /*
    if (file_info)
    {
    if (i >= 0)
    {
    if (ret == EXIT_SUCCESS && i > 0 && i < args->files_c)
    ft_printf("\n");
    ft_printf("%s:\n", files[i]);
    }
    get_ascii_sort(&file_info);
    print_list(file_info);
    */free_list(file_info);/*
    file_info = NULL;
    }
    */
    ++i;
    }
    free_matrix(files, args->files_c);
    ft_printf_fd(STDERR_FILENO, "\nOptions[%s]: %d %d %d %d %d\n", OPTIONS, \
    option->recursive_read, option->dot_files, option->long_format, \
    option->reverse_order, option->time_sort);
    return (ret);
    }
  2. Error (line 50): bad indentation
    /*
  3. Error (line 50): comment not well formatted
    /*
  4. Error (line 50): comment not well placed
    /*
  5. Error (line 53): bad indentation
    /*
  6. Error (line 53): comment not well formatted
    /*
  7. Error (line 53): comment not well placed
    /*
  8. Error (line 64): bad indentation
    */free_list(file_info);/*
  9. Error (line 64): comment not well formatted
    */free_list(file_info);/*
  10. Error (line 64): comment not well placed
    */free_list(file_info);/*

Algorithms

Bad algorithm in the get_ascii_sorted function

ft_ls/src/sorting.c

Lines 97 to 124 in bf9b147

void get_ascii_sorted(t_file **head)
{
t_file *list;
t_file **first;
t_file **second;
list = *head;
first = &(*head);
second = &(*first)->next;
while ((*first)->next)
{
ft_printf_fd(STDERR_FILENO, "%s ", (*first)->name);
ft_printf_fd(STDERR_FILENO, "%s\n", (*second)->name);
if (ft_strcmp((*first)->name, (*second)->name) > 0)
{
ft_printf_fd(STDERR_FILENO, "NEED_SWAP\t");
*first = (*first)->next;
ft_printf_fd(STDERR_FILENO, "%s ", (*first)->name);
ft_printf_fd(STDERR_FILENO, "%s\n", (*second)->name);
ft_printf_fd(STDERR_FILENO, "---open---\n");
ft_printf_fd(STDERR_FILENO, "%s ", (*first)->next->name);
ft_printf_fd(STDERR_FILENO, "%s\n", (*second)->next->name);
ft_printf_fd(STDERR_FILENO, "---close---\n");
}
first = &(*first)->next;
second = &(*second)->next;
}
}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.