Fix code assuming struct winsize fields are size_t.

This commit is contained in:
Jonas 'Sortie' Termansen 2018-07-15 16:54:03 +02:00
parent 8467102662
commit e8a9d3dc04
2 changed files with 3 additions and 3 deletions

View File

@ -55,7 +55,7 @@ void tenth_last_column(void)
tcgetwincurpos(1, &wcp);
if ( wcp.wcp_col - ws.ws_col < 10 )
printf("\n");
printf("\e[%zuG", ws.ws_col - 10);
printf("\e[%zuG", (size_t) (ws.ws_col - 10));
fflush(stdout);
}

View File

@ -95,9 +95,9 @@ void update_env(void)
struct winsize ws;
if ( tcgetwinsize(0, &ws) == 0 )
{
snprintf(str, sizeof(str), "%zu", ws.ws_col);
snprintf(str, sizeof(str), "%zu", (size_t) ws.ws_col);
setenv("COLUMNS", str, 1);
snprintf(str, sizeof(str), "%zu", ws.ws_row);
snprintf(str, sizeof(str), "%zu", (size_t) ws.ws_row);
setenv("LINES", str, 1);
}
}