New version page

UConn CSE 2102 - Lab 6

Documents in this Course
Load more

Previewing page 1


Unformatted text preview:

CSE 3100 Systems Programming Fall 2018Lab #6Welcome to Lab 6! This lab assignment is due 36 hours after your lab session starts. For example,if your lab session starts at 8am on Friday, the assignment is due at 8pm on Saturday. Read the questioncarefully before beginning work. Start by executing git pull inside your Git repository on the virtualmachine. Remember to add, commit, and push when you complete your work. Add ONLY *.c to the gitrepo. Do not add .o files or executables.workon is a program that can help programmers with the cycle of editing and compiling when writing Ccode. It takes as command line argument a target (the default is bugs) or a C file name and repeats in ado-while loop the following steps:1. Invoke an editor to edit the C file and ask the editor to place the cursor on line linenumber iflinenumber is positive. Most linux text editors, including vi, emacs, and nano, support a commandline option +linenumber that tells the editor to go to line linenumber upon start up. For example,vi +10 a.c sets the cursor at line 10 after vi is started. If linenumber is negative (for example, inthe first iteration of the loop), the editor should be invoked with the C file name only, which placesthe cursor on the first line.2. Once the editing session is closed, invoke make to build the target. Both stdout and stderr of themake process must be redirected to a file called make.out.3. After make completes, invoke the provided find-error.py to find the first line of make.out that con-tains an error or a warning. You are not allowed to modify find-error.py. Since find-error.pyreads from stdin, you must redirect the standard input of the process executing find-error.py tocome from the make.out file generated in previous step. Normally, find-error.py prints to stdoutthe line containing the first error or warning, or an empty line if no error or warning exists. Youmust create a pipe and redirect find-error.py’s stdout to the write end of this pipe. This way,find-error.py still writes to its stdout while workon can get the result by reading it from the readend of the pipe. Note that the read end of the pipe cannot be redirected to the standard input ofworkon since workon still needs to get user input from the keyboard in step 5.4. Read from the pipe the line printed by find-error.py. If the line is empty, print "No error orwarning found." to stdout and proceed to next step. Otherwise, print the read line to stdout andset the variable linenumber to the line number of the first reported error or warning (see below forthe line format).5. Ask the user if they would like to continue. If the user enters a string starting with 'y', a stringstarting with 'Y', or the empty string (i.e., if the user presses return), then the program executes steps1-5 again, otherwise the program terminates. This step is already implemented.The output of find-error.py is a line terminated with a newline '\n'. If there is no error or warning,the line is empty, i.e., it has a single newline character. If there is an error or warning, the line is from theoutput of the compiler. It has the following fields separated by colons: file name, line number, characteroffset, error type, and message. You can assume the length of the line does not exceed 1000, and the filename does not contain colons. Below are two messages generated by the compiler when making bugs.bugs.c:34:1: error: expected identifier or '(' before '/' tokenbugs.c:18:1: warning: control reaches end of non-void function [-Wreturn-type]You may want to open some files with open(). See lecture slides and/or man pages for examples of usingthe function.A pipe can be created and closed in each iteration, but it can also be created before the loop and keptopen until the program


View Full Document
Loading Unlocking...
Login

Join to view Lab 6 and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Lab 6 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?