Hello Project
COP-3223H
Table of Contents
1. Overview
In this project you will create a "hello, world!\n" program. That might sound easy, but the catch is you will need to create it using the command-line development workflow shown in class that we'll be using for all projects in the class, including the emacs editor, make build automation, and git version control for submission.
2. Repository setup
Log into eustis:
ssh NID@eustis.eecs.ucf.edu
Go to your local repository: Be sure you have already completed the git exercise before attempting this project.
cd ~/cop3223spring26/assignments
Create and enter a directory for the hello project:
mkdir hello cd hello
You only need to mkdir once to create the directory.
Make sure you are in the right directory
pwd
You should see
/home/net/NID/cop3223spring26/assignments/hello
3. Create the "hello, world!\n" program with emacs
Using emacs in eustis, record yourself using script (see instructions below) writing, compiling, and running a hello world program in C, i.e., a program that uses printf to write "hello, world!\n" to the console.
Make sure you are in the right directory
pwd
You should see
/home/net/NID/cop3223spring26/assignments/hello
3.1. Start recording
script -T hello.timing hello.script
3.2. Use emacs to create a hello world program called hello.c, then compile it and run it
emacs hello.c
Hand-type yourself do not use copy-and-paste the following C program that prints "hello, world!\n". Remember this is case sensitive and don't forget the \n (backslash n).
#include <stdio.h>
int main(int argc, char **argv) {
printf("hello, world!\n");
}
Then save and exit (for emacs, Ctrl-x Ctrl-s then Ctrl-x Ctrl-c).
Compile your program like this:
gcc -o hello hello.c
Then run your program like this:
./hello
You should see the following output.
hello, world!
3.3. Stop recording
exit
(or Ctrl-D on the empty command prompt.)
3.4. Verify that your recording works by replaying it yourself
scriptreplay hello.timing hello.script 2
Wait and watch a recording of your terminal session play. The 2 is optional and will replay it at 2x speed. You can use a higher number as well to replay faster. Use Ctrl-C to stop playback early.
4. Submitting your program via git
This assumes you have already setup your repository and that you are still in your hello directory in your repository.
4.1. Add and commit each file
Enter
git add hello.c git commit hello.c
Write an appropriate commit message. Remember that you will need to save (Ctrl-x Ctrl-s) then quit (Ctrl-x Ctrl-c) the emacs editor that pops up. If you are having trouble, be sure that you have completed the git project first.
Then enter
git add hello.timing hello.script git commit hello.timing hello.script
Enter an appropriate commit message.
Double-check that you have no uncommitted changes to hello.c.
git status
Do not commit the backup file hello.c~ nor the hello program.
You should see something like this:
On branch master
Your branch is ahead of 'submission/master' by 2 commits.
(use "git push" to publish your local commits)
Untracked files:
(use "git add <file>..." to include in what will be committed)
hello
nothing added to commit but untracked files present (use "git add" to track)
This means you have commits that haven't been pushed to the git server ("Your branch is ahead…") and that your working tree has no differences from your committed code ("nothing to commit…").
It's good practice to omit generated, binary files from source version control, such as your hello program binary. Source version control tools are geared towards source code, program binaries dramatically increase the size of the repository, and the program binary should be easily buildable from source.
You can ignore the hello program and emacs backup files by creating and committing a file called .gitignore, i.e., type in bash
echo -e "hello\n*~" > .gitignore git add .gitignore git commit .gitignore
Then type an appropriate commit message and exit the editor.
Type
git status
and you should now see
On branch master Your branch is ahead of 'submission/master' by 3 commits. (use "git push" to publish your local commits) nothing to commit, working tree clean
At this point, your working tree (where you are editing files) has no uncommitted changes, but the remote repo (where the instructor can access your repo) does not have your local commits yet. To push those changes type
git push
You should see something like
Welcome to eustis.eecs.ucf.edu. Please use your NID and NID password to log in. See http://t.cs.ucf.edu/help/eustis for additional instructions. Enumerating objects: 14, done. Counting objects: 100% (14/14), done. Delta compression using up to 8 threads Compressing objects: 100% (11/11), done. Writing objects: 100% (13/13), 2.69 KiB | 1.35 MiB/s, done. Total 13 (delta 1), reused 0 (delta 0), pack-reused 0 To eustis3.eecs.ucf.edu:cop3223/NID/assignments c048012..99b2200 master -> master
5. Self-check
5.1. Remove the previous self-check
If you have already run the self-check, you can remove it like this
rm -rf ~/tmp/assignments_selfcheck
Double-check the path carefully to avoid deleting the wrong directory.
5.2. Make a fresh clone of your project
git clone gitolite3@eustis3.eecs.ucf.edu:cop3223/$USER/assignments ~/tmp/assignments_selfcheck
You should see something like
Cloning into '/home/net/NID/tmp/assignments_selfcheck'... Welcome to eustis.eecs.ucf.edu. Please use your NID and NID password to log in. See http://t.cs.ucf.edu/help/eustis for additional instructions. remote: Enumerating objects: 16, done. remote: Counting objects: 100% (16/16), done. remote: Compressing objects: 100% (12/12), done. remote: Total 16 (delta 1), reused 0 (delta 0), pack-reused 0 Receiving objects: 100% (16/16), done. Resolving deltas: 100% (1/1), done.
If you see
fatal: destination path '/home/net/NID/tmp/assignments_selfcheck already exists and is not an empty directory.
5.3. Enter the fresh clone's directory
cd ~/tmp/assignments_selfcheck/hello
5.4. Double-check that the required files are submitted
ls -a
You should see the required files (hello.c, hello.script, hello.timing, and optionally .gitignore), ., .., and (optionally) a README.md file, e.g.,
. .. hello.c hello.script hello.timing .gitignore
The order does not matter. If you have a README.md, that is okay. If you have hello or any other program binary, remove it with these instructions and rerun the self-check.
You can also validate what files are actually in the entire repo like this:
git ls-tree --full-tree -r --name-only HEAD
5.5. Make sure hello runs correctly
gcc -o hello hello.c ./hello
This should output hello, world! (and exactly this; caps and the newline matter) on its own line, i.e.,
hello, world!
If you see a missing "\n", which will have the command-prompt immediately after the text, e.g.,
hello, world!NID:~/cop3402fall25/hello$
or if you see a missing comma, missing exclamation point, any capitalized letters, go back and follow the directions closely.
5.6. Make sure your terminal recording works
scriptreplay hello.timing hello.script 2
You should see a recording of yourself opening emacs, entering the hello world program, saving, and exiting.
6. Grading schema
| Criterion | Points |
|---|---|
| The repo contains hello.c required files | 0.5 |
| The repo does not contain hello or any program binaries | 0.5 |
| The replay shows using emacs to code | 0.5 |
| The program runs correctly | 0.5 |
| TOTAL | 2 |