Correction of an endwin forgotten + little error in arguments handling

This commit is contained in:
Phyks 2013-07-28 20:05:57 +02:00
parent a0171f8a7c
commit 6522e8219d
2 changed files with 10 additions and 11 deletions

BIN
a.out

Binary file not shown.

15
main.c
View File

@ -7,8 +7,6 @@
#include <unistd.h>
#include <fcntl.h>
//TODO !!!!
// Inverser X et Y cf. Le retour
int kbhit(void)
{
struct termios oldt, newt;
@ -44,7 +42,7 @@ int main(int argc, char **argv)
// o (=old), n(=new) for switching between the two matrices X*Y
//Nbre_iterations = number of iterations
int **m[2];
int i, j, k;
int i, j;
int count = 0, density = 50, o = 0, n, Y, X, nbre_iterations=0;
int carac = 64; //@
@ -55,11 +53,11 @@ int main(int argc, char **argv)
X -= 1;
// If there's not enough args, give a short How-To
if(argc < 1)
if(argc < 2)
{
printw("Usage : %s [density in %] \n", argv[0]);
refresh();
return 0;
endwin();
printf("Usage : %s [density in %] \n", argv[0]);
return 0;
}
// Put the 2nd (if exists) into density
@ -92,9 +90,10 @@ int main(int argc, char **argv)
for(j = 0; j < Y; j++)
{
// We put 1 if the number token is > density
m[0][i][j] = (rand() % 100 > density) ? 1 : 0;
m[0][i][j] = ((rand() % 100) > density) ? 1 : 0;
}
}
// Clear the screen and print the matrice 0
clear();