CS 3113 Spring 19

Logo

This is the web page for Operation Systems at the University of Oklahoma.

View the Project on GitHub oudalab/cs3113sp19

Introduction to Operating Systems

CS 3113, Spring 2019

Project 0 (Due 2/21 end of day)

The name Linux typically refers to the operating system kernel. When describing the Linux kernel and associated tools, one should use the term GNU/Linux where many of the tools are developed as part if GNU software. The goal of project 0 is to create your own shell tools. The shell tools are each mini programis that can perform a single task; the program can each Do One thing and Do it Well.

Proper Academic Conduct

The code solution to this project must be done individually. These tools have been around for a while. Do not copy solutions to this problem from the network and do not look at or copy solutions from others. However, you may use the net for inspiration and you may discuss your general approach with others.

Specification

You project will have six functions.

Below we will describe the programs needed for the project. Be sure to handle edge cases in your implementation. Note, below, when print is mentioned, it is the same as writing to the stdout file.

oucat <files>

This function takes as an argument the names of 0 or more files. If one or more file is specified, the program prints out each the contents of each file, in order, to the stdout file. If no file is specified, the oucat program reads from the special stdin file. If a file does not exist or cannot be accessed the program will EXIT_FAILURE otherwise the program will return EXIT_SUCCESS. If an error is detected, the program should print a usage statement to stderr. The usage string is usage: oucat <files>

ouecho [string]

This function takes command line text and write each passed in word or phrase to the stdout file. Each piece of string written on the command line should only be separated by a single space. If no arguments are passed, a new line is written to stdout. Any error should result in the programming returning EXIT_FAILURE otherwise EXIT_SUCCESS should be returned. If an error is detected, the program should print a usage statement to stderr.

ouhead [-n N] <file>

This function may take a file and prints the first N lines of the file. If no N is specified, the default N is 10. If the file contains less than N lines, the whole content of the file will be printed. If no file is specified, the program will read from stdin and will accept input until receiving EOF or reaching the maximum number of lines. Any error should result in the programming returning EXIT_FAILURE otherwise EXIT_SUCCESS should be returned. If an error is detected, the program should print a usage statement to stderr. The usage string is usage: ouhead [-n N] <file>

outail [-n N] <file>

This function may take a file and prints the last N lines of the file. If no N is specified, the default N is 10. If the file contains less than N lines, the whole content of the file will be printed. If no file is specified, the program will read from stdin and will accept input until receiving EOF or reaching the maximum number of lines. Any error should result in the programming returning EXIT_FAILURE otherwise EXIT_SUCCESS should be returned. If an error is detected, the program should print a usage statement to stderr. The usage string is usage: outail [-n N] <file>

ouseq [M] N

This program prints the numbers between M and N inclusively. Numbers should be printed one per line. If only N is supplied, numbers are printed from 0 to N. If M > N, the numbers should be printed in decreasing order. If M < N, the numbers should be printed in increasing order. If M = N, only the value of M should be printed. The maximum and minimum value of N and M is the same as the max and min value of integers on your system. Any error should result in the programming returning EXIT_FAILURE otherwise EXIT_SUCCESS should be returned. If an error is detected, the program should print a usage statement to stderr. The usage string is usage: ouseq [M] N

ouwc [-l | -c] <file>

This function takes a file or stdin if no file is provided and returns the number of lines or characters read. It will only take either -l, meaning return the number of lines, or -c meaning return the number of bytes. If no flag is provided, the program will print the number of lines followed by the number of bytes. When each number is printed, white space should be prepended to the number so total space used by the number is eight characters. Any error should result in the programming returning EXIT_FAILURE otherwise EXIT_SUCCESS should be returned. If an error is detected, the program should print a usage statement to stderr. The usage string is usage: ouwc [-l | -c] <file>

Makefile

Include a makefile with the standard targets all and clean. The all target should make each program and clean target should remove executables and temporary files. Your makefile should support the following commands specific to each program:

README.md

The README file should be all uppercase with either no extension or a .md extension. You should write your name in it, and example of how to run it, and a list of any web or external resources that you used for help. The README file should also contain a list of any bugs or assumptions made whhile writing the program. Note that you should not be copying code from any website not provided by the instructor.

Tests

The test_project0.bats file contains a bats script to test each file. You should create your own bats files to test your code. We strongly recommend performing tests above and beyond those that are provided for you. Our testing program will automatically compare the output of your program against a known file. In order to receive credit for the correctness of your program, your output must match ours exactly (down to the byte).

COLLABORATORS file

This file should contain a comma separated list describing who you worked with and a small text description describing the nature of the collaboration. This information should be listed in three fields as in the example is below:

Katherine Johnson, kj@nasa.gov, Helped me understand calculations
Dorothy Vaughan, doro@dod.gov, Helped me with multiplexed time management

Create a repository for your project on your instance and GitHub

Create a private repository GitHub called cs3113sp19-project0

Add collaborators cegme and Vinothini-Rajasekaran by going to Settings > Collaborators.

Then go to your instance, create a new folder /projects if it is not already created, and clone the repository into that folder. For example:

cd /
sudo mkdir /projects
sudo chown `whoami`:`whoami` /projects
chmod 777 /projects
cd projects
git clone https://github.com/cegme/cs3113sp19-project0

Submitting your code

When ready to submit, create a tag on your repository using git tag on the latest commit:

git tag v1.0
git push origin v1.0

The version v1.0 lets us know when and what version of code you would like us to grade. If you would like to submit a a second version before the 24 hour deadline, use the tag v2.0.

If you need to update a tag, view the commands in the following StackOverflow post.

Deadline

Your submission/release is due on Thursday, 21st at 11:45pm. Submissions arriving between 11:45:01pm and 11:45pm on the following day will receive a 10% penalty; meaning these scores will only receive 90% of its value. Any later submissions will receive not receive credits. You must have your instance running and code available otherwise you will not receive credit.

Grading

Grades will be assessed according to the following distribution:

Notes

Addenda

2019-02-09

2019-02-12

2019-02-13

2019-02-15

2019-02-17

2019-02-19

2019-02-20


Back to Project List