$FreeBSD: ports/audio/mpg123/files/patch-ab,v 1.7 2002/02/18 09:34:12 des Exp $ --- mpg123.c.orig Tue Aug 21 19:48:17 2001 +++ mpg123.c Tue Aug 21 19:49:02 2001 @@ -27,6 +27,10 @@ #include #endif +#ifdef __FreeBSD__ +#include +#endif + #include "mpg123.h" #include "getlopt.h" #include "buffer.h" @@ -223,7 +227,7 @@ { int loop, rannum; - srand(time(NULL)); + srandomdev(); if(shuffleord) free(shuffleord); shuffleord = (int *) malloc((numfiles + 1) * sizeof(int)); @@ -239,7 +243,7 @@ /* now shuffle them */ if(numfiles >= 2) { for (loop = 0; loop < numfiles; loop++) { - rannum = (rand() % (numfiles * 4 - 4)) / 4; + rannum = (random() % (numfiles * 4 - 4)) / 4; rannum += (rannum >= loop); shuffleord[loop] ^= shuffleord[rannum]; shuffleord[rannum] ^= shuffleord[loop]; @@ -381,7 +385,7 @@ curfile++; } else { - newfile = shufflist[ rand() % shuffle_listsize ]; + newfile = shufflist[ random() % shuffle_listsize ]; } return newfile; @@ -605,6 +609,9 @@ } if(fr->header_change > 1 || init) { + + init_output(); + old_rate = ai.rate; old_format = ai.format; old_channels = ai.channels; @@ -787,6 +794,10 @@ _wildcard(&argc,&argv); #endif +#ifdef __FreeBSD__ + fpsetmask(0); +#endif + if(sizeof(short) != 2) { fprintf(stderr,"Ouch SHORT has size of %d bytes (required: '2')\n",(int)sizeof(short)); exit(1); @@ -923,17 +933,6 @@ &dirname, &filename)) fprintf(stderr, "\nDirectory: %s", dirname); fprintf(stderr, "\nPlaying MPEG stream from %s ...\n", filename); - -#if !defined(GENERIC) -{ - const char *term_type; - term_type = getenv("TERM"); - if (!strcmp(term_type,"xterm")) - { - fprintf(stderr, "\033]0;%s\007", filename); - } -} -#endif }