COP4338 Systems Programming : Call It mytar

$20 Bonus + 25% OFF

Securing Higher Grades Costing Your Pocket?
Book Your Assignment at The Lowest Price
Now!

Students Who Viewed This Also Studied

COP4338 Systems Programming

Task:

In this assignment. you are asked to implement a simple version of ‘tar’. The program (call it mytar) can either create an archive file from a list of files or extract the files from a given archive file. The program takes the follow arguments: 

mytar {-t | -c | -x | -u} -f [list_of_files]

 
-t List the contents of the archive file to stdout

-c Create a new archive containing the list of one or more files

-x Extract the files from the archive

-u Add one or more new files to an existing archive 

All four options above requires the name of the archive file be provided using the -f option. 

Only the -c and -u options require the user to provide the list of file names (there could be one or more files). The list is ignored for the other options. You can assume that the files in the list must be from the current directory. 

The -t option lists the files stored in the archive (including the name and the size of each file). The list of the files should be sorted. 

The -x option extracts files from the archive and place them in the current directory. 

Implementation

1. You should use the getopt() function to process the command-line arguments. (You learned how to use this function in interactive activity 6.)

2. The archive file is a binary file with the following format:

• The first four bytes contain an integer which is the number of files contained by the archive.

• The next 480 bytes contain a directory. It’s an array of 20 elements, each being the following data structure: 

struct directory_entry_t {

char name(20]; /• file name as a null-terminated string •/

int size; /• the size of the file in bytes •/

int offset; /• the location (offset from the start of the archive file in bytes) of the file placed in the archive •/

}
This means the archive must not contain more than 20 files. And each file’s name must not exceed 19 characters (an a null character). 

• Starting from byte 484 will be the content of the files listed one after another (with their starting offsets registered in the corresponding directory entry).

3. The -c option creates a new archive, meaning that you need to format the archive file accordingly (putting the number of files, creating the directory, and placing the content of the files). The -u option, however, only needs to add additional files (updating the directory, and appending the content of the new files at the end of the archive). The -t option lists the content of the archive. You should print both the name and the size (in bytes) of each file. Also, you need to sort the files according to their names. The -x option extract all the files stored in the archive. You need to create a new file of the given name, and copy the content from the archive.

4. Your code should be able to handle normal error conditions:

A. Either -c, -t, -x, or -u option should be provided. And only one of them is provided.

B. The -f option must be provided.

C. The list of file names (to be archived) cannot be longer than 19.

D. For -c and -u options, one must provide one or more file names.

E. The -u option requires an existing archive.

F. The files to be archived must exist in the current directory (as regular files, not directories). They can be read.

G. The total number of archived files must not exceed 20.

H. The same file cannot be archived twice.

I. The -x option extracts the files by writing them to the current directory. One cannot overwrite an existing file already in the directory (for safety reason). 

COP4338 Systems Programming

Answer in Detail


Solved by qualified expert

Get Access to This Answer

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Hac habitasse platea dictumst vestibulum rhoncus est pellentesque. Amet dictum sit amet justo donec enim diam vulputate ut. Neque convallis a cras semper auctor neque vitae. Elit at imperdiet dui accumsan. Nisl condimentum id venenatis a condimentum vitae sapien pellentesque. Imperdiet massa tincidunt nunc pulvinar sapien et ligula. Malesuada fames ac turpis egestas maecenas pharetra convallis posuere. Et ultrices neque ornare aenean euismod. Suscipit tellus mauris a diam maecenas sed enim. Potenti nullam ac tortor vitae purus faucibus ornare. Morbi tristique senectus et netus et malesuada. Morbi tristique senectus et netus et malesuada. Tellus pellentesque eu tincidunt tortor aliquam. Sit amet purus gravida quis blandit. Nec feugiat in fermentum posuere urna. Vel orci porta non pulvinar neque laoreet suspendisse interdum. Ultricies tristique nulla aliquet enim tortor at auctor urna. Orci sagittis eu volutpat odio facilisis mauris sit amet.

Tellus molestie nunc non blandit massa enim nec dui. Tellus molestie nunc non blandit massa enim nec dui. Ac tortor vitae purus faucibus ornare suspendisse sed nisi. Pharetra et ultrices neque ornare aenean euismod. Pretium viverra suspendisse potenti nullam ac tortor vitae. Morbi quis commodo odio aenean sed. At consectetur lorem donec massa sapien faucibus et. Nisi quis eleifend quam adipiscing vitae proin sagittis nisl rhoncus. Duis at tellus at urna condimentum mattis pellentesque. Vivamus at augue eget arcu dictum varius duis at. Justo donec enim diam vulputate ut. Blandit libero volutpat sed cras ornare arcu. Ac felis donec et odio pellentesque diam volutpat commodo. Convallis a cras semper auctor neque. Tempus iaculis urna id volutpat lacus. Tortor consequat id porta nibh.

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Hac habitasse platea dictumst vestibulum rhoncus est pellentesque. Amet dictum sit amet justo donec enim diam vulputate ut. Neque convallis a cras semper auctor neque vitae. Elit at imperdiet dui accumsan. Nisl condimentum id venenatis a condimentum vitae sapien pellentesque. Imperdiet massa tincidunt nunc pulvinar sapien et ligula. Malesuada fames ac turpis egestas maecenas pharetra convallis posuere. Et ultrices neque ornare aenean euismod. Suscipit tellus mauris a diam maecenas sed enim. Potenti nullam ac tortor vitae purus faucibus ornare. Morbi tristique senectus et netus et malesuada. Morbi tristique senectus et netus et malesuada. Tellus pellentesque eu tincidunt tortor aliquam. Sit amet purus gravida quis blandit. Nec feugiat in fermentum posuere urna. Vel orci porta non pulvinar neque laoreet suspendisse interdum. Ultricies tristique nulla aliquet enim tortor at auctor urna. Orci sagittis eu volutpat odio facilisis mauris sit amet.

Tellus molestie nunc non blandit massa enim nec dui. Tellus molestie nunc non blandit massa enim nec dui. Ac tortor vitae purus faucibus ornare suspendisse sed nisi. Pharetra et ultrices neque ornare aenean euismod. Pretium viverra suspendisse potenti nullam ac tortor vitae. Morbi quis commodo odio aenean sed. At consectetur lorem donec massa sapien faucibus et. Nisi quis eleifend quam adipiscing vitae proin sagittis nisl rhoncus. Duis at tellus at urna condimentum mattis pellentesque. Vivamus at augue eget arcu dictum varius duis at. Justo donec enim diam vulputate ut. Blandit libero volutpat sed cras ornare arcu. Ac felis donec et odio pellentesque diam volutpat commodo. Convallis a cras semper auctor neque. Tempus iaculis urna id volutpat lacus. Tortor consequat id porta nibh.

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Hac habitasse platea dictumst vestibulum rhoncus est pellentesque. Amet dictum sit amet justo donec enim diam vulputate ut. Neque convallis a cras semper auctor neque vitae. Elit at imperdiet dui accumsan. Nisl condimentum id venenatis a condimentum vitae sapien pellentesque. Imperdiet massa tincidunt nunc pulvinar sapien et ligula. Malesuada fames ac turpis egestas maecenas pharetra convallis posuere. Et ultrices neque ornare aenean euismod. Suscipit tellus mauris a diam maecenas sed enim. Potenti nullam ac tortor vitae purus faucibus ornare. Morbi tristique senectus et netus et malesuada. Morbi tristique senectus et netus et malesuada. Tellus pellentesque eu tincidunt tortor aliquam. Sit amet purus gravida quis blandit. Nec feugiat in fermentum posuere urna. Vel orci porta non pulvinar neque laoreet suspendisse interdum. Ultricies tristique nulla aliquet enim tortor at auctor urna. Orci sagittis eu volutpat odio facilisis mauris sit amet.

Tellus molestie nunc non blandit massa enim nec dui. Tellus molestie nunc non blandit massa enim nec dui. Ac tortor vitae purus faucibus ornare suspendisse sed nisi. Pharetra et ultrices neque ornare aenean euismod. Pretium viverra suspendisse potenti nullam ac tortor vitae. Morbi quis commodo odio aenean sed. At consectetur lorem donec massa sapien faucibus et. Nisi quis eleifend quam adipiscing vitae proin sagittis nisl rhoncus. Duis at tellus at urna condimentum mattis pellentesque. Vivamus at augue eget arcu dictum varius duis at. Justo donec enim diam vulputate ut. Blandit libero volutpat sed cras ornare arcu. Ac felis donec et odio pellentesque diam volutpat commodo. Convallis a cras semper auctor neque. Tempus iaculis urna id volutpat lacus. Tortor consequat id porta nibh.

22 More Pages to Come in This Document. Get access to the complete answer.

Do you want to hire the most trustworthy assignment expert writer? If yes, then your quest ends at MyAssignmenthelp.com as you can avail qualitative online assignment help here. We strive to make a positive brand name for ourselves when it comes to offering academic assignment help. The credit goes to our team of 3000+ PhD and Master’s level expert writers who provide authentic assignment help services. And it is because of them that we have got such a huge network of customers from nations like USA, UK and Australia. If you have any doubt regarding the assignment help material provided to you then put forward your queries through our 24/7 live chat support facility.

More COP4338 COP4338 Systems Programming: Questions & Answers

Information Technology

A Program according to the Specification attached in Java and a 2-page report of the findings …

View Answer

IAB303 Data Analytics

Question:
Data Analytics Notebook
This assessment will involve the creation of two Jupyter notebooks, demonstrating your understanding of the technical process required to ask good questions and obtain meaningful answers using data analytics.
You will use your knowledge from the studio sessions …

View Answer

Search and Social Media Marketing

You must conduct a Search and Social Media Marketing analysis for those key skills and attributes that are desired by potential employers, in an area where you would like to work. i.e Sports Writer/Reporter.This should include the keywords for main industry specific skills, key influencers and indiv …

View Answer

cs115 Computer Science

Question 1.Write a struct ‘Student’ that has member variables:(string)first name,(int)age and (double) fee. Create a sorted (in ascending order according to the age) linked list of threeinstances of the struct Student. The age of the students mustbe 21, 24 and 27. Write a function to ins …

View Answer

Content Removal Request

If you are the original writer of this content and no longer wish to have your work published on Myassignmenthelp.com then please raise the
content removal request.

Choose Our Best Expert to Help You

Jaida Patrick

I am research scholar at Michigan State University, acquiring my doctorate degree on Paediatrics.

350 – Completed Orders

Hire Me

Still in Two Minds? The Proof is in Numbers!

33845 Genuine Reviews With a Rating of 4.9/5.

Management

Assignment: 3 Pages, Deadline:
6 days

Very good piece of work, exactly what I needed. Everything was done very smooth from order to the end.

User ID: 5***28 London, Great Britain

Organizational Behavior

Assignment: 10 Pages, Deadline:
9 days

Thank you for your help, I manage to submit my assignment on time and I got a good grade!

User ID: 5***28 London, Great Britain

Marketing

Assignment: 6 Pages, Deadline:
12 days

Fantastic work, I received my order on time and it was very well done. I got exellent mark for my assingment!

User ID: 5***28 London, Great Britain

Project Management

Assignment: 6 Pages, Deadline:
11 days

I have very complicated project to do and your experts helped me with an exellent work. Thank you so much!

User ID: 5***28 London, Great Britain

Statistics

Programming: 1 Page, Deadline:
26 days

A good solution has been provided and I am satisfied with the solution provided.

User ID: 7***32 Zimbabwe

Finance

Home Work: 8 Pages, Deadline:
19 days

Got the assignment ahead of time and it is very good with attention to detail with all the calculations as asked earlier.

User ID: 8***20 India

It Write Up

Assignment: 20 Pages, Deadline:
3 days

Excellent Job, got excellent grades and passed in the assignment highly recommend. Best solution out there

User ID: 6***94 Mauritius

It Write Up

Essay: 0.8 Pages, Deadline:
1 day

I am one of the regular customer and I am happy with experts which helps me to clear my study. I am satisfied with solutions and thank you for helping …

User ID: 2***87 Bexley, Australia

Accounting

Home Work: 1 Page, Deadline:
8 days

thank you you guys, even though i dont have high marks, but im happy with your effort on that. really appreciate for that

User ID: 6***24 Australia

Management

Assignment: 2.4 Pages, Deadline:
4 days

thank you expert and your team. u guys really helpful for my assignment . really appreciate your effort

User ID: 6***24 Australia

Management

Assignment: 3 Pages, Deadline:
6 days

Very good piece of work, exactly what I needed. Everything was done very smooth from order to the end.

User ID: 5***28 London, Great Britain

Organizational Behavior

Assignment: 10 Pages, Deadline:
9 days

Thank you for your help, I manage to submit my assignment on time and I got a good grade!

User ID: 5***28 London, Great Britain

Marketing

Assignment: 6 Pages, Deadline:
12 days

Fantastic work, I received my order on time and it was very well done. I got exellent mark for my assingment!

User ID: 5***28 London, Great Britain

Project Management

Assignment: 6 Pages, Deadline:
11 days

I have very complicated project to do and your experts helped me with an exellent work. Thank you so much!

User ID: 5***28 London, Great Britain

Statistics

Programming: 1 Page, Deadline:
26 days

A good solution has been provided and I am satisfied with the solution provided.

User ID: 7***32 Zimbabwe

Finance

Home Work: 8 Pages, Deadline:
19 days

Got the assignment ahead of time and it is very good with attention to detail with all the calculations as asked earlier.

User ID: 8***20 India

It Write Up

Assignment: 20 Pages, Deadline:
3 days

Excellent Job, got excellent grades and passed in the assignment highly recommend. Best solution out there

User ID: 6***94 Mauritius

It Write Up

Essay: 0.8 Pages, Deadline:
1 day

I am one of the regular customer and I am happy with experts which helps me to clear my study. I am satisfied with solutions and thank you for helping …

User ID: 2***87 Bexley, Australia

Accounting

Home Work: 1 Page, Deadline:
8 days

thank you you guys, even though i dont have high marks, but im happy with your effort on that. really appreciate for that

User ID: 6***24 Australia

Management

Assignment: 2.4 Pages, Deadline:
4 days

thank you expert and your team. u guys really helpful for my assignment . really appreciate your effort

User ID: 6***24 Australia

Have any Query?
Reference no: EM132069492

WhatsApp
Hello! Need help with your assignments? We are here

GRAB 25% OFF YOUR ORDERS TODAY

X