CSCI 320 - Operating Systems & Concurrency
Spring 2019
Rust Assignment 1
Implement the following shell commands as Rust programs. You might find the
fs crate useful in writing many of
these programs:
-
destroy
(3 points): Delete every file in the list of command-line arguments.
-
newname
(3 points): This program expects two command-line arguments.
It will give a "usage" message if it does not receive them. It will change the
name of the file given by the first argument to be the name given by the
second argument.
-
duplicate
(3 points): This program also expects two command-line
arguments. It will give a "usage" message if it does not receive them. It will
make a copy of the file given by the first argument with the name given by
the second argument.
-
dir
(3 points): Prints out all of the names of the
files in the current directory. It will not employ any command-line arguments.
-
counter
(4 points): Prints out the number of words, lines, and characters for each file listed in its command-line arguments. If the first argument begins with a dash, the letters "w", "l", and "c" immediately
following the dash indicate which of words, lines, and characters get displayed.
-
start
(4 points): Prints out the first ten lines of each file listed in the command-line arguments. If the first argument begins with a dash, use the number immediately following the dash instead of ten.
Grading
The total value of the assignment is 20 points. No credit
will be given for code that fails to compile. Partial credit may be given for
partially working solutions.