X-Git-Url: https://ncurses.scripts.mit.edu/?p=ncurses.git;a=blobdiff_plain;f=test%2Fview.c;h=5d94cda05751a7a841c66f9700fa465215cea2d6;hp=fcc0705431f6624c54b0b868e9d9ec0e50923d2d;hb=e2e9c09c48b19b24979cafb2d4864f538b5ddd1c;hpb=bdb754b9f04f332b59d72f761a297497b2db8af1;ds=inline diff --git a/test/view.c b/test/view.c index fcc07054..5d94cda0 100644 --- a/test/view.c +++ b/test/view.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998-2013,2015 Free Software Foundation, Inc. * + * Copyright (c) 1998-2015,2016 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -50,7 +50,7 @@ * scroll operation worked, and the refresh() code only had to do a * partial repaint. * - * $Id: view.c,v 1.95 2015/10/10 20:03:58 tom Exp $ + * $Id: view.c,v 1.97 2016/09/10 21:05:46 tom Exp $ */ #include @@ -353,7 +353,8 @@ main(int argc, char *argv[]) col++; d++; } else { - sprintf(d, "\\%03o", UChar(*s)); + _nc_SPRINTF(d, _nc_SLIMIT(sizeof(temp) - (d - buf)) + "\\%03o", UChar(*s)); d += strlen(d); col = (int) (d - temp); } @@ -566,22 +567,25 @@ show_all(const char *tag) time_t this_time; #if CAN_RESIZE - sprintf(temp, "%.20s (%3dx%3d) col %d ", tag, LINES, COLS, shift); + _nc_SPRINTF(temp, _nc_SLIMIT(sizeof(temp)) + "%.20s (%3dx%3d) col %d ", tag, LINES, COLS, shift); i = (int) strlen(temp); if ((i + 7) < (int) sizeof(temp)) { - sprintf(temp + i, "view %.*s", - (int) (sizeof(temp) - 7 - (size_t) i), - fname); + _nc_SPRINTF(temp + i, _nc_SLIMIT(sizeof(temp) - i) + "view %.*s", + (int) (sizeof(temp) - 7 - (size_t) i), + fname); } #else (void) tag; - sprintf(temp, "view %.*s", (int) sizeof(temp) - 7, fname); + _nc_SPRINTF(temp, _nc_SLIMIT(sizeof(temp)) + "view %.*s", (int) sizeof(temp) - 7, fname); #endif move(0, 0); printw("%.*s", COLS, temp); clrtoeol(); this_time = time((time_t *) 0); - strncpy(temp, ctime(&this_time), (size_t) 30); + _nc_STRNCPY(temp, ctime(&this_time), (size_t) 30); if ((i = (int) strlen(temp)) != 0) { temp[--i] = 0; if (move(0, COLS - i - 2) != ERR)