Modifing problem to work from the commandline

This commit is contained in:
Denis Nuțiu 2016-04-21 16:58:45 +03:00
parent 64d57514f9
commit b160d1a647
2 changed files with 8 additions and 7 deletions

View file

@ -45,7 +45,11 @@ int main(int argc, char *argv[]) {
perror("Can't open file!");
return -1;
}
draw_peg_scene(file, 3, 10);
if ( argc < 3 ) {
printf("Invalid ussage. Correct usage: %s pegs disks\n", argv[0]);
return -1;
}
draw_peg_scene(file, atoi(argv[1]), atoi(argv[2]));
if ( fclose(file) ) {
perror("Can't close file!");

View file

@ -3,10 +3,7 @@
<rect x="70" y="120" width="15" height="130" fill="firebrick" />
<rect x="170" y="120" width="15" height="130" fill="firebrick" />
<rect x="270" y="120" width="15" height="130" fill="firebrick" />
<rect x="240" y="230" width="80" height="20" fill="#ee6517" stroke="black" stroke-width="1" />
<rect x="250" y="209" width="60" height="20" fill="#7fffd4" stroke="black" stroke-width="1" />
<rect x="258" y="188" width="45" height="20" fill="#bbe200" stroke="black" stroke-width="1" />
<rect x="263" y="167" width="34" height="20" fill="#bbe200" stroke="black" stroke-width="1" />
<rect x="267" y="146" width="26" height="20" fill="#149dca" stroke="black" stroke-width="1" />
<rect x="270" y="125" width="20" height="20" fill="#ffc4c4" stroke="black" stroke-width="1" />
<rect x="40" y="230" width="80" height="20" fill="#ffc4c4" stroke="black" stroke-width="1" />
<rect x="50" y="209" width="60" height="20" fill="#ee6517" stroke="black" stroke-width="1" />
<rect x="58" y="188" width="45" height="20" fill="#e4d93c" stroke="black" stroke-width="1" />
</svg>

Before

Width:  |  Height:  |  Size: 904 B

After

Width:  |  Height:  |  Size: 613 B