Hello, dear friend, you can consult us at any time if you have any questions, add WeChat: THEend8_
EC602 Design by Software
Program Restrictions 3 1 Introduction 1.1 Assignment Goals The first assignment goals are to ensure • you have the development environments available to you • you are able to use the assignment submission system • you understand executables and permission in the unix file system • you can use the unix help system (man) • you can write short programs in python involving modules and terminal I/O 1.2 Group Size For this assignment, the maximum group size is 2. 1 1.3 Due Date This assignment is due 2021-9-24 at 23:59, i.e. one minute before midnight. This assignment will be accepted through a grace period of H = 60 hours. The grade will be scaled on a linear scale from 100% at the deadline to 50% at the end of the grade period. If the natural grade on the assignment is g, the number of hours late is h, and the grace period is H, then the grade is grade = (h > H) ? 0 : g * (1- h/(2*H)); in C++ or grade = 0 if h>H else g * (1- h/(2*H)) in python. If the same assignment is submitted ontime and late, the grade for that compo- nent will be the maximum of the ontime submission grade and the scaled late submission grade. 1.4 Submission Link Assignment One Submission Page 1.5 Points This assignment is worth 5 points. 2 The Assignment This assignment will implement various versions and parts of the unix command ls. 2.1 About ls All information about how ls works can be found using two methods • reading the man page with man ls • experimenting with ls in the virtual machine, to basically “reverse-engineer” its properties. We have done both of these in class: you will probably need to do more investi- gations using these methods to complete the assignment. To about confusion between our programs and the real ls, all of the assignment components will have names similar to but different from ls. 2 Note: the ls provided by macOS does not function in precisely the same way as ls as provided in the VM (which is GNU coreutils 8.32) Note: ls provides short style options like -t as will as long-style options like --time=WORD. For this assignment, we will assume only short style options. No testing will be done with any long style options, and you are not expected to handle these cases. 2.1.1 Quotes Some filenames cause ls to add quote symbols around the actual filenames (‘filename’ or “filename”). This creates substantial additional complication to the problems described below. Therefore, you can assume that the option to turn off this mechanism -N or --literal is always specified and so you should not attempt to add quotes around the filenames you print. 2.2 List files one-per line: lsone The command ls -1 where the 1 is a one not an ell, forces ls to print the file information one item per line. Write an executable python script lsone that performs this operation. For this program, all command line arguments should be ignored. 2.3 List files in column form: lscol The command ls -C forces ls to print the file information in columns. Write an executable python script lscol that performs this operation. For this program, all command line arguments should be ignored. 3 Program Restrictions You may not access the actual program ls as part of any of your solutions, i.e. inside the python scripts themselves. This means that, for example, you may not use: • os.system • subprocess.run 3 • subprocess.Popen or any other such facility in python to directly access the ls utility. You may use os.listdir and other features of the os and sys modules as needed.