Giter Club home page Giter Club logo

ls's Introduction

Qwasar MSCS, 2024: my_ls

Mimic the behavior of native linux ls in C.

SPECIFICATIONS

Write a program called my_ls. Following the specifications of this man page.

NAME

my_ls -- list directory contents

SYNOPSIS

my_ls [-at] [file ...]

DESCRIPTION

For each operand that names a file of a type other than directory, my_ls displays its name as well as any requested, associated information. For each operand that names a file of type directory, my_ls displays the names of files contained within that directory, as well as any requested, associated information.

If no operands are given, the contents of the current directory are displayed. If more than one operand is given, non-directory operands are displayed first; directory and non-directory operands are sorted separately and in lexicographical order.

The following options are available:

-a Include directory entries whose names begin with a dot (.). -t Sort by time modified (most recently modified first) before sorting the operands by lexicographical order.

Requirements

Your code must be compiled with the flags -Wall -Wextra -Werror. Hint(s) Watch out for memory leaks ! You can test your code against memory errors by compiling with the debugging flags -g3 -fsanitize=address Global variables are strictly FORBIDDEN tv_sec AND tv_nsec are used for the -t options ;-) st_mtime is not what you want to use. You want to use st_mtim

Technical information

you must create a Makefile, and the ouput is the command itself You can use: malloc(3) free(3) printf(3) write(2) stat(2) lstat(2) opendir(2) closedir(2) readdir(2) You can NOT use: Any functions / syscalls which does not appear in the previous list Yes, it includes exit Multiline macros are forbidden Include another .c is forbidden Macros with logic (while/if/variables/...) are forbidden

Your output needs to be respecting the "sorting" criteria and in one column. It will be compared with: ls -1. $>./my_ls > my_ls.output $>ls -1 > ls.output $>diff my_ls.output ls.output $>

ls's People

Contributors

arosenfeld2003 avatar

Watchers

 avatar

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.