Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

The goal o f this project i s t o practice o n basic library functions for reading directories i n Linux. You will implement

The goal of this project isto practice on basic library functions for reading directories
in Linux. You will implement a program that lists all the files in a given directory.
You can start from scratch or use the myls version 3 attached.
1. Your program should take two possible command line arguments. For example
.myls-a~Document
2. The first argument isan option started with a dash -. Legitimate options are -a
and -l.
3.If-ais giving, you need to list all files including hidden file start with ..
4.If-lis giving, you need to list one file per line with detailed information (file type,
permission, link number, user, group, size, modification time, and file name). The
format should be the same as the real ls-l.
5.Ifno dash option is given, you only list file names with hidden file excluded.
6. The second argument is a path (relativeorabsolute)to a directory. If present, list
the files in the specified directory. Ifno second argument is given, list the files in
current directory.
7. Your project submission should include the implementation files myls.c, header file
(optional), Makefile (optional), and a README file.
8. All the file names need tobe listed in ascending order. You can compare the outputs
with real ls.
II. Important:
1. You will need todo your own research on how to use masking, getpwuid(),
getgrgid(), ctime()to decode the file type, permission, user name, group name,
modification time in the stat structure.
2. You can write your own sorting function or research on how to use qsort().
III. Grading Criteria:
Please make sure your program compiles, otherwise your submission will not be
graded, and you will receive zero.
Point deduction rule:
Compile warning: 3 points each.
Minor error: such as not meeting the assignment inputoutput requirement, 5
points each.
Major error: examples include, infinite loop, runtime errors, any segmentation fault,
15 points each.
Default list function (no argument): 10%.
List the files in the specified directory: 10%.
-a option: 10%
-l option: 30%
Ascending order sorting: 30%.
README: 10%.
Extra credits: -al option (list details for all files including hidden files, check ls-al for
reference)20%
IV. Submission:
1. Each student submits one copy of the source code.
2. Create a folder and name it[first name]lastname?h7($ mkdir zhengxih7)
3. Copy all your source code to the above folder (source code only, no binary files!).
4. Edit a README.txt file (in text format only, do not use Microsoft Word, use notepad
in Windows or use vior nano in Linux) and provide the following information:
Project description
Compiling instruction if any
A sample test run if any
Existing bugs (things not finished)
5.scp the folder (e.g.,zhengxih7)to your account in grail.
6.sshlogin grail, goto the parent directory of the folder you created, and run
(suppose that your folder is"zhengxih7")
turnin22h7@cis340jzhengxih7
You should see a list of files followed by a message like the following:
You are about to turnin X files for [XKB] for h7to cis340j
***Do you want to continue?
Answer yor yes to submit or answer nornoif you do not want to submit.
You should now see as list of the files being submitted, followed by:
*** TURNIN ofh7to cis340j COMPLETE! ***
7. You can submit more than one time. Your most recent submission will always
automatically overwrite the previous one.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Systems Introduction To Databases And Data Warehouses

Authors: Nenad Jukic, Susan Vrbsky, Svetlozar Nestorov

1st Edition

1943153191, 978-1943153190

More Books

Students also viewed these Databases questions

Question

Know how procedures protect an organization

Answered: 1 week ago