added nix build stuff
This commit is contained in:
@ -220,10 +220,12 @@ void loadFiles()
|
||||
fgets(buff2, 255, fp);
|
||||
if (buff2[0] == '\t') {
|
||||
valuecount++;
|
||||
|
||||
names = realloc(names, sizeof(char*) * valuecount);
|
||||
names[valuecount - 1] = malloc(strlen(buff) - 1);
|
||||
strncpy(names[valuecount - 1], buff, strlen(buff) - 1);
|
||||
names[valuecount - 1][strlen(buff)] = '\0';
|
||||
|
||||
values = realloc(values, sizeof(char*) * valuecount);
|
||||
values[valuecount - 1] = malloc(strlen(buff2) - 2);
|
||||
strncpy(values[valuecount - 1], buff2 + 1, strlen(buff2) - 1);
|
||||
@ -373,43 +375,18 @@ int main(int argc, char *argv[])
|
||||
exit(1);
|
||||
}
|
||||
|
||||
/* Now start listening for the clients, here
|
||||
* process will go in sleep mode and will wait
|
||||
* for the incoming connection
|
||||
*/
|
||||
|
||||
listen(sockfd,5);
|
||||
clilen = sizeof(cli_addr);
|
||||
|
||||
while (alive) {
|
||||
newsockfd = accept(sockfd, (struct sockaddr *) &cli_addr, &clilen);
|
||||
|
||||
if (newsockfd < 0) {
|
||||
perror("ERROR on accept");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
/* Create child process */
|
||||
//pid = fork();
|
||||
pid = 1;
|
||||
|
||||
if (pid < 0) {
|
||||
perror("ERROR on fork");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if (pid == 0) {
|
||||
/* This is the child process */
|
||||
//close(sockfd);
|
||||
//doprocessing(newsockfd);
|
||||
//exit(0);
|
||||
}
|
||||
else {
|
||||
doprocessing(newsockfd);
|
||||
close(newsockfd);
|
||||
}
|
||||
|
||||
} /* end of while */
|
||||
doprocessing(newsockfd);
|
||||
close(newsockfd);
|
||||
}
|
||||
free(run);
|
||||
close(sockfd);
|
||||
}
|
||||
|
37
src2/tui.c
37
src2/tui.c
@ -67,30 +67,19 @@ void printbig(int x, int y, int ms)
|
||||
printf("\033[%d;%dH", y + sy, x); //go to position
|
||||
for (int cc = 0; cc < 12; cc++) { //then, for every character
|
||||
int c = small[cc]; //check what character we're on
|
||||
if (c >= 48 && c <= 57) { //if its a number, print 4 pixels
|
||||
for (int xx = 0; xx < 4; xx++) {
|
||||
int xxx = c - 48;
|
||||
if (numbermap[sy][(xxx * 4) + xx] == 'x')
|
||||
printf("\033[48;2;%d;%d;%dm ", f.r, f.g, f.b);
|
||||
if (numbermap[sy][(xxx * 4) + xx] == '.')
|
||||
printf("\033[48;2;%d;%d;%dm ", b.r, b.g, b.b);
|
||||
}
|
||||
}
|
||||
if (c == 46 || c == 58) { //if its punctuation, print 2 pixels
|
||||
for (int xx = 0; xx < 2; xx++) {
|
||||
if (c == 46) {
|
||||
if (numbermap[sy][42 + xx] == 'x')
|
||||
printf("\033[48;2;%d;%d;%dm ", f.r, f.g, f.b);
|
||||
if (numbermap[sy][42 + xx] == '.')
|
||||
printf("\033[48;2;%d;%d;%dm ", b.r, b.g, b.b);
|
||||
}
|
||||
if (c == 58) {
|
||||
if (numbermap[sy][40 + xx] == 'x')
|
||||
printf("\033[48;2;%d;%d;%dm ", f.r, f.g, f.b);
|
||||
if (numbermap[sy][40 + xx] == '.')
|
||||
printf("\033[48;2;%d;%d;%dm ", b.r, b.g, b.b);
|
||||
}
|
||||
}
|
||||
int mapcharacterwidth = (c >= 48 && c <= 57) ? 4 : 2;//if its a number, print 4 pixels, if its punctuation, print 2 pixels
|
||||
int mapoffset;
|
||||
if (c >= 48 && c <= 57)
|
||||
mapoffset = (c - 48) * 4;
|
||||
else if (c == 46)
|
||||
mapoffset = 42;
|
||||
else
|
||||
mapoffset = 40;
|
||||
for (int xx = 0; xx < mapcharacterwidth; xx++) {
|
||||
if (numbermap[sy][mapoffset + xx] == 'x')
|
||||
printf("\033[48;2;%d;%d;%dm ", f.r, f.g, f.b);
|
||||
if (numbermap[sy][mapoffset + xx] == '.')
|
||||
printf("\033[48;2;%d;%d;%dm ", b.r, b.g, b.b);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user