Merge branch 'master' of ssh://bitsetter.de:8090/netsl
This commit is contained in:
commit
584b54b7f8
|
@ -24,16 +24,21 @@ void cleanup_display() {
|
||||||
char *image; // dimension is width x height
|
char *image; // dimension is width x height
|
||||||
*/
|
*/
|
||||||
void print_current_image(struct message* msg, int start, int end) {
|
void print_current_image(struct message* msg, int start, int end) {
|
||||||
|
end++; // suppress unused warning :->
|
||||||
// end is ignored and 80 is used, should be considered later
|
// end is ignored and 80 is used, should be considered later
|
||||||
|
|
||||||
move(0,0); // start in the upper left corner
|
move(0,0); // start in the upper left corner
|
||||||
char *pic = msg->image; // get a ptr to the actual image
|
char *pic = msg->image; // get a ptr to the actual image
|
||||||
|
|
||||||
for (int row=0; row < 25; row++) { // iterate rows
|
for (int row=0; row < 25; row++) { // iterate over rows
|
||||||
char *line = (char*) malloc(81);
|
char *original_line;
|
||||||
strcpy(line, strtok(pic, '\n')); // get a line
|
original_line = strtok(pic, "\n");
|
||||||
line[80] = '\0'; // terminate
|
|
||||||
printw("%s", line+start);
|
char *line = (char*) malloc(81); // allocate a line because we modify it
|
||||||
|
strcpy(line, original_line + start); // get a line from the right start
|
||||||
|
line[80] = '\0'; // terminate it
|
||||||
|
printw("%s", line); // print it
|
||||||
|
free(line); // free it
|
||||||
}
|
}
|
||||||
|
|
||||||
refresh(); // refresh the screen
|
refresh(); // refresh the screen
|
||||||
|
|
Loading…
Reference in New Issue
Block a user