C: improve templates
This commit is contained in:
@@ -18,8 +18,8 @@ int main(int ac, char **av)
|
||||
|
||||
for (; arg<ac-1; ++arg, ++arg) {
|
||||
*i=atoi(av[arg]);
|
||||
//*(i+1)=atoi(av[arg+1]);
|
||||
printf("color(%d, %d)=%d\n", i[0], i[1], color_code(i));
|
||||
*(i+1)=atoi(av[arg+1]);
|
||||
printf("color(%d, %d)=%d\n", *i, *(i+1), color_code(i));
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
@@ -18,9 +18,9 @@ if (($# != 1)) || [[ ! -d $1 ]]; then
|
||||
fi
|
||||
TEMPLATES="$ROOT/templates"
|
||||
|
||||
# copy GNUmakefile and br-common.h
|
||||
# copy main.c, GNUmakefile and br-common.h
|
||||
echo -n "copying GNUmakefile and br-common.h files... "
|
||||
cp -p "$TEMPLATES/"{GNUmakefile,br-common.h} "$1"
|
||||
cp -p "$TEMPLATES/"{GNUmakefile,br-common.h,main.c} "$1"
|
||||
echo done.
|
||||
# add include br-common.h in exercise include file
|
||||
INC=${1%/}
|
||||
|
@@ -1,16 +0,0 @@
|
||||
/* See GNUmakefile below for explanation
|
||||
* https://github.com/braoult/exercism/blob/master/c/templates/GNUmakefile
|
||||
*/
|
||||
#ifdef UNIT_TEST
|
||||
int main(int ac, char **av)
|
||||
{
|
||||
int arg=1;
|
||||
resistor_band_t i[2];
|
||||
|
||||
for (; arg<ac-1; ++arg, ++arg) {
|
||||
*i=atoi(av[arg]);
|
||||
*(i+1)=atoi(av[arg+1]);
|
||||
printf("color(%d, %d)=%d\n", i[0], i[1], color_code(i));
|
||||
}
|
||||
}
|
||||
#endif
|
Reference in New Issue
Block a user