92ed0103b1
2.3-mls (12 Aug 2004) Updated winamp plugin, thanks to K`rai. 2.2-mls (1 May 2004) Added README.cl-amp (taken from Eli's page). Added a fflush to nosefart for the benifit of gnosefart. 2.1-mls (23 April 2004) gnosefart updated to 1.0. 2.0-mls (16 April 2004) Added gnosefart 0.9, a GTK frontend for nosefart. Decided to be more confident about my version numbering. Nosefart now returns 0 if nothing went wrong. 1.92k-mls (4 April 2004) Fixed a bug in the UI that made it not refresh properly. Improved spec file. 1.92j-mls (21 March 2004) A few small tweaks to nsfinfo and the interface. Added spec file for building RPMs.
89 lines
3.1 KiB
Text
89 lines
3.1 KiB
Text
$NetBSD: patch-ab,v 1.2 2004/12/03 13:02:18 wiz Exp $
|
|
|
|
--- src/linux/main_linux.c.orig Sat May 1 16:53:54 2004
|
|
+++ src/linux/main_linux.c Thu Dec 2 01:58:01 2004
|
|
@@ -3,6 +3,7 @@
|
|
UNIX systems */
|
|
|
|
#include <ctype.h>
|
|
+#include <signal.h>
|
|
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
#include <string.h>
|
|
@@ -342,12 +343,59 @@
|
|
static void printsonginfo(int current_frame, int total_frames, int limited)
|
|
{
|
|
/*Why not printf directly? Our termios hijinks for input kills the output*/
|
|
+
|
|
+ /*
|
|
+ * Once again, the termios hijinks cause trouble for NetBSD. \r
|
|
+ * sometimes doesn't get printed. Following is a mostly complete
|
|
+ * rewrite of the text output section as presented in my NetBSD
|
|
+ * pkgsrc package for version 1.92i-mls. The fix was suggested by
|
|
+ * Bruce J.A. Nourish. I'm David Griffith.
|
|
+ */
|
|
+
|
|
char *hi = (char *)malloc(255);
|
|
char blank[82];
|
|
memset(blank, ' ', 80);
|
|
blank[80] = '\r';
|
|
blank[81] = '\0';
|
|
|
|
+ if (total_frames !=0) {
|
|
+ if (limited) {
|
|
+ snprintf(hi, 254, "\rPlaying track %d of %d, channels %c%c%c%c%c%c, %d/%d seconds, %d/%d frames\r",
|
|
+ nsf->current_song, nsf->num_songs,
|
|
+ enabled[0]?'1':'-', enabled[1]?'2':'-',
|
|
+ enabled[2]?'3':'-', enabled[3]?'4':'-',
|
|
+ enabled[4]?'5':'-', enabled[5]?'6':'-',
|
|
+ (int)((float)(current_frame + nsf->playback_rate - 1)/(float)nsf->playback_rate),
|
|
+ (int)((float)(total_frames + nsf->playback_rate - 1)/(float)nsf->playback_rate),
|
|
+ current_frame,
|
|
+ total_frames);
|
|
+ } else {
|
|
+ snprintf(hi, 254, "\rPlaying track %d of %d, channels %c%c%c%c%c%c, %d/? seconds, %d/? frames\r",
|
|
+ nsf->current_song, nsf->num_songs,
|
|
+ enabled[0]?'1':'-', enabled[1]?'2':'-',
|
|
+ enabled[2]?'3':'-', enabled[3]?'4':'-',
|
|
+ enabled[4]?'5':'-', enabled[5]?'6':'-',
|
|
+ (int)((float)(current_frame + nsf->playback_rate - 1)/(float)nsf->playback_rate),
|
|
+ current_frame);
|
|
+ }
|
|
+ } else {
|
|
+ snprintf(hi, 254, "\rPlaying track %d of %d, channels %c%c%c%c%c%c, %d seconds, %d frames\r",
|
|
+ nsf->current_song, nsf->num_songs,
|
|
+ enabled[0]?'1':'-', enabled[1]?'2':'-',
|
|
+ enabled[2]?'3':'-', enabled[3]?'4':'-',
|
|
+ enabled[4]?'5':'-', enabled[5]?'6':'-',
|
|
+ (int)((float)(current_frame + nsf->playback_rate - 1)/(float)nsf->playback_rate),
|
|
+ current_frame);
|
|
+ }
|
|
+
|
|
+
|
|
+/*
|
|
+ * Not only does the following section do funny things to terminals,
|
|
+ * it's a good example of how to use the trinary operator to make your
|
|
+ * code very hard to understand. Please don't use the trinary operator
|
|
+ * when if-then-else will do.
|
|
+ */
|
|
+#ifdef __REALLY_BIG_COMMENT__
|
|
snprintf(hi, 254,
|
|
total_frames != 0 ?
|
|
"Playing track %d/%d, channels %c%c%c%c%c%c, %d/%d sec, %d/%d frames\r":
|
|
@@ -363,9 +411,16 @@
|
|
current_frame,
|
|
total_frames
|
|
);
|
|
+#endif /* __REALLY_BIG_COMMENT__ */
|
|
+
|
|
|
|
+/*
|
|
+ * I'm not sure what this is supposed to do. Under NetBSD it garbles
|
|
+ * the screen, but not to the degree as the above commented-out code.
|
|
+/*
|
|
if(!(current_frame%10))
|
|
write(STDOUT_FILENO, (void *)blank, strlen(blank));
|
|
+*/
|
|
|
|
write(STDOUT_FILENO, (void *)hi, strlen(hi));
|
|
free(hi);
|