freebsd-ports/audio/squash/files/patch-src::display.c
Pav Lucistnik 576f3e78f4 Squash is a learning ncurses music player written in C. It supports mp3,
ogg and flac. Squash uses statistics to determine songs to play automatically.
It garners this information through whether or not a song is skipped.

PR:			ports/55275
Submitted by:		Matthias Andree <matthias.andree@web.de>
Based on shar by:	trevor
Approved by:		adamw (mentor)
2003-11-22 22:32:00 +00:00

36 lines
673 B
C

$FreeBSD$
--- src/display.c~ Tue Jul 29 06:56:49 2003
+++ src/display.c Tue Aug 5 11:59:03 2003
@@ -673,6 +673,22 @@
wrefresh( win );
}
+char *mystrndup(const char *s, size_t sz)
+{
+ size_t l = strlen(s), i;
+ char *x;
+
+ i = l < sz ? l : sz;
+
+ x = malloc(i + 1);
+
+ if (x) {
+ memcpy(x, s, i);
+ x[i] = '\0';
+ }
+ return x;
+}
+
/*
* Draw the info window.
*/
@@ -744,7 +760,7 @@
}
/* Clip filename */
- filename = strndup( filename, win_width - 2 );
+ filename = mystrndup( filename, win_width - 2 );
/* Display filename and songs loaded */
mvwprintw( win, 1, 1, "Current Selected Song filename:" );