Skip to content

Commit

Permalink
Clang wrapper script, demo of simple IO sans scanf.
Browse files Browse the repository at this point in the history
  • Loading branch information
mblair committed Oct 7, 2010
1 parent 60dec0a commit 20d9489
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 0 deletions.
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
*.out
*.o
*.a
*.swp

#Because I'm not using gcc or csh.
book_code/unix-xwindows/gccx
19 changes: 19 additions & 0 deletions ch1/simple_io.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#include <stdio.h>
#include "../book_code/unix-xwindows/genlib.h"
#include "../book_code/unix-xwindows/simpio.h"

int main() {
double n1, n2, n3, average;

printf("This program averages three numbers.\n");
printf("1st number: ");
n1 = GetReal();
printf("2nd number: ");
n2 = GetReal();
printf("3rd number: ");
n3 = GetReal();
average = (n1 + n2 + n3) / 3;
printf("The average is %g\n", average);

return 0;
}
5 changes: 5 additions & 0 deletions roberts_clang
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#! /usr/bin/env sh
INCLUDE=/home/matt/dev/c/roberts_abstractions/book_code/unix-xwindows
CSLIB=$INCLUDE/cslib.a
LIBRARIES="$CSLIB -lX11 -lm"
clang -I$INCLUDE $* $LIBRARIES

0 comments on commit 20d9489

Please sign in to comment.