1. Homepage
  2. Programming
  3. FIT2100 Operating Systems - Assignment Part A: Building a File Utility with C

FIT2100 Operating Systems - Assignment Part A: Building a File Utility with C

Engage in a Conversation
MonashFIT2100Operating SystemsCAustralia

FIT2100 Assignment Part A: Building a File Utility with C Programming Semester 2 2022 CourseNana.COM

Dr Charith Jayasekara
Lecturer, Faculty of IT
Email:
charith.jayasekara@monash.edu © 2022, Monash University CourseNana.COM

August 9, 2022 CourseNana.COM

Contents CourseNana.COM

1  Introduction 3 CourseNana.COM

2  Caveats 3 CourseNana.COM

3  If you require extra help 4 CourseNana.COM

References .................................... 4 CourseNana.COM

4  File content viewing functions. 4 CourseNana.COM

Task1:Filecontentviewingfunctionalities................... 4 CourseNana.COM

5  Support Command-line Arguments 5 CourseNana.COM

5.1  Task 2: Functionality to support the use of a different source file . . . . . . . 5 CourseNana.COM

5.2  Task3:Appendfilefunctionality ........................ 5 CourseNana.COM

5.3  Task4:CustomView/Appendfilefunctionality................. 6 CourseNana.COM

5.4  Command-lineargumentsummary........................ 6 CourseNana.COM

5.5  Examplecommands:............................... 7 CourseNana.COM

5.6  Important:commentingisrequired ....................... 8 CourseNana.COM

5.7  Hintsandtips .................................. 9 CourseNana.COM

5.8  Markingcriteria ................................. 9 CourseNana.COM

6  Submission 10 CourseNana.COM

6.1 Deliverables ................................... 10 6.2 AcademicIntegrity:PlagiarismandCollusion .................. 11 CourseNana.COM

1 Introduction CourseNana.COM

This document constitutes the requirement specification for this assignment. You will be assessed on your ability to both comprehend and comply with the requirements as specified herein. CourseNana.COM

Submission due date: 26th August 2022 (Friday) 11:55pm AEST.
Late submissions: A late submission penalty of 10% of the total available marks per day will apply. CourseNana.COM

This assignment is worth 15% of the total marks for this unit. CourseNana.COM

2 Caveats CourseNana.COM

To complete these tasks, you are allowed to use any of the standard C library functions found CourseNana.COM

You are NOT allowed to use any functions available in <stdio.h>. This means you cannot use printf() to produce output. (For example: to print output in the terminal, you will need to write to standard output directly, using appropriate file system calls.) In addition, you are NOT allowed to use the system() library function, and any library functions which spawns new process(s) from your program. This makes the assignment more challenging, but also means you are interacting with services of the operating system directly. CourseNana.COM

Your main C source file should be named with your student ID as: 123456789_fileutil.c, CourseNana.COM

In this assignment, you will build a multipurpose file utility , which combines the simplified features of multiple Linux utilities such as head, tail, cat, and cp. CourseNana.COM

on your virtual machine environment , except the following: CourseNana.COM

where 123456789 is your student ID. CourseNana.COM

3 If you require extra help CourseNana.COM

This assignment is an independent learning and assessment exercise. CourseNana.COM

You may utilise the Ed Discussion Forum to ask questions and obtain clarification, however you may not share details or code in your implementation with other students, nor may you show your code to the teaching team prior to submission. This is an assessment task: tutors and lecturers are not permitted to help you debug your assignment code directly (you are expected to debug and test your own code), but can help with more general queries, such as queries related to C programming syntax, concepts and debugging tips. CourseNana.COM

You may make use of online references with appropriate citation in accordance with academic integrity policies, however your work must be your own. CourseNana.COM

3.1 References CourseNana.COM

The following resources are available on the FIT2100 Unit Information page. CourseNana.COM

Curry, David, UNIX Systems Programming for SVR4, Chapter 3: ‘Low-Level I/O Rou- tines’. CourseNana.COM

Curry, David, Using C on the UNIX System, Chapter 3: ‘Low-Level I/O’. He, Jialong, LINUX System Call Quick Reference. CourseNana.COM

4 File content viewing functions. CourseNana.COM

4.1 Task 1: File content viewing functionalities CourseNana.COM

Write an utility called fileutil (‘File Utility’) which does the following: CourseNana.COM

  1. Opens a file named sample.txt in the current working directory.
  2. Outputs the first 10 words (consider 1 letter words too) of the file contents. If the file contains less than 10 words, then show entire file contents (to standard output—usually the terminal). Note that, when the program completes normally, no other output should be produced.

Your program should always exit ’cleanly.’ This means closing any open files and freeing any other resources you may have allocated before termination. CourseNana.COM

If there is a problem accessing the file (e.g. file does not exist), your program should display an appropriate and sensible error message (you should output this to the program’s standard error stream rather than standard output) and exit cleanly with a return value of 1. On successful completion, your program should return an error code of 0. CourseNana.COM

Write up an instruction manual (user documentation) in a plain text file, explaining how to compile your program and how to use it. You may use your user documentation itself or any other text file to test your program. CourseNana.COM

5 Support Command-line Arguments CourseNana.COM

Now, extend the functionalities of the same program (from Task 1) to allow the user to run it with command-line arguments as follows. Extend your user documentation to include all the added usage functionalities. CourseNana.COM

5.1 Task 2: Functionality to support the use of a different source file CourseNana.COM

Allow the user to specify a different sourcefile as a source (instead of sample.txt) by putting the filename as a command-line argument. You can assume that the user will provide the absolute path4 for the file. Note that, if the sourcefile argument is specified, it must be the first argument. If the sourcefile argument is not specified, the sample.txt should be used as the source file by default. CourseNana.COM

5.5 Example commands: CourseNana.COM

  • $ ./fileutil
    Displays the first 10 words of the sample.txt file from the current directory
  • $ ./fileutil -n 20
    Displays the first 20 words of the sample.txt file from the current directory
  • $ ./fileutil /home/student/dir1/a.txt Displays the first 10 words of the a.txt file
  • $ ./fileutil /home/student/dir1/a.txt -n 20 Displays the first 20 words of the a.txt file
  • $ ./fileutil /home/student/dir1/a.txt -a /home/student/dir2/b.txt append first 10 words in a.txt to the end of b.txt. If b.txt does not exist, a new b.txt should be created and first 10 words of the a.txt should be copied to it.
  • $ ./fileutil /home/student/dir1/a.txt -a /home/student/dir2/b.txt -n 15 append first 15 words in a.txt to the end of b.txt. If b.txt does not exist, a new b.txt should be created and first 15 words of the a.txt should be copied to it.
  • $ ./fileutil -a /home/student/dir2/b.txt
    Append the first 10 lines of sample.txt from the current directory to b.txt
  • $ ./fileutil /home/student/dir1/a.txt -n
    Invalid argument, no line numbers specified after the -n argument!
  • $ ./fileutil /home/student/dir1/a.txt -n 15 -a /home/student/dir2/b.txt append first 15 words in a.txt to the end of b.txt. If b.txt does not exist, a new b.txt should be created and first 15 words of the a.txt should be copied to it.
  • $ ./fileutil /home/student/dir1/a.txt -a /home/student/dir2/b.txt -n 15 append first 15 words in a.txt to the end of b.txt. If b.txt does not exist, a new b.txt should be created and first 15 words of the a.txt should be copied to it.

5.6 Important: commenting is required CourseNana.COM

Commenting your code is essential as part of the assessment criteria (refer to Section 5.8). All program code should include three types of comments: CourseNana.COM

  1. (a)  File header comments at the beginning of your program file, which specify your name, your Student ID, the start date and the last modified date of the program, as well as with a high-level description of the program.
  2. (b)  Function header comments at the beginning of each function should describe the func- tion, arguments and interpretation of return value.
  3. (c)  In-line comments within the program are also part of the required documentation.

Get in Touch with Our Experts

WeChat (微信) WeChat (微信)
Whatsapp WhatsApp
Monash代写,FIT2100代写,Operating Systems代写,C代写,Australia代写,Monash代编,FIT2100代编,Operating Systems代编,C代编,Australia代编,Monash代考,FIT2100代考,Operating Systems代考,C代考,Australia代考,Monashhelp,FIT2100help,Operating Systemshelp,Chelp,Australiahelp,Monash作业代写,FIT2100作业代写,Operating Systems作业代写,C作业代写,Australia作业代写,Monash编程代写,FIT2100编程代写,Operating Systems编程代写,C编程代写,Australia编程代写,Monashprogramming help,FIT2100programming help,Operating Systemsprogramming help,Cprogramming help,Australiaprogramming help,Monashassignment help,FIT2100assignment help,Operating Systemsassignment help,Cassignment help,Australiaassignment help,Monashsolution,FIT2100solution,Operating Systemssolution,Csolution,Australiasolution,