Index: mpg123/Makefile
diff -c mpg123/Makefile:1.1.1.2 mpg123/Makefile:1.6
*** mpg123/Makefile:1.1.1.2	Tue Jul 27 21:54:53 1999
--- mpg123/Makefile	Thu Oct  7 00:28:33 1999
***************
*** 9,14 ****
--- 9,31 ----
  MANDIR=$(PREFIX)/man
  SECTION=1
  
+ 
+ # IPv6 setting
+ CFLAGS+=-DINET6
+ 
+ ### KAME stack
+ IPV6LIBDIR=-L/usr/local/v6/lib
+ IPV6LIB=-linet6
+ IPV6STACK="KAME"
+ ### BSD/OS 4.0 (NRL) stack
+ #IPV6LIBDIR=
+ #IPV6LIB=
+ #IPV6STACK="BSD/OS 4.0"
+ ### Linux stack
+ #IPV6LIBDIR= #/usr/inet6/lib
+ #IPV6LIB= #-linet6
+ #IPV6STACK="Linux"
+ 
  ###################################################
  ######                                       ######
  ######   End of user-configurable settings   ######
***************
*** 17,22 ****
--- 34,41 ----
  
  nothing-specified:
  	@echo ""
+ 	@echo "The Makefile is configured for ${IPV6STACK} IPv6 stack."
+ 	@echo ""
  	@echo "You must specify the system which you want to compile for:"
  	@echo ""
  	@echo "make linux-help     Linux, more help"
***************
*** 89,95 ****
  linux-devel:
  	$(MAKE) OBJECTS='decode_i386.o dct64_i386.o audio_oss.o' \
          CC=gcc LDFLAGS= \
!         CFLAGS='-DREAL_IS_FLOAT -DLINUX -Wall -g -m486 \
  		-DREAD_MMAP -DOSS -funroll-all-loops \
  		-finline-functions -ffast-math' \
          mpg123-make
--- 108,114 ----
  linux-devel:
  	$(MAKE) OBJECTS='decode_i386.o dct64_i386.o audio_oss.o' \
          CC=gcc LDFLAGS= \
!         CFLAGS='$(CFLAGS) -DREAL_IS_FLOAT -DLINUX -Wall -g -m486 \
  		-DREAD_MMAP -DOSS -funroll-all-loops \
  		-finline-functions -ffast-math' \
          mpg123-make
***************
*** 97,103 ****
  linux-profile:
  	$(MAKE) OBJECTS='decode_i386.o dct64_i386.o audio_oss.o' \
          CC=gcc LDFLAGS='-pg' \
!         CFLAGS='-DREAL_IS_FLOAT -DLINUX -Wall -pg -m486 \
  		-DREAD_MMAP -DOSS -funroll-all-loops \
  		-finline-functions -ffast-math' \
          mpg123-make
--- 116,122 ----
  linux-profile:
  	$(MAKE) OBJECTS='decode_i386.o dct64_i386.o audio_oss.o' \
          CC=gcc LDFLAGS='-pg' \
!         CFLAGS='$(CFLAGS) -DREAL_IS_FLOAT -DLINUX -Wall -pg -m486 \
  		-DREAD_MMAP -DOSS -funroll-all-loops \
  		-finline-functions -ffast-math' \
          mpg123-make
***************
*** 106,112 ****
  	$(MAKE) CC=gcc LDFLAGS= \
  		OBJECTS='decode_i386.o dct64_i386.o decode_i586.o \
  			audio_oss.o term.o' \
! 		CFLAGS='-DI386_ASSEM -DPENTIUM_OPT -DREAL_IS_FLOAT -DLINUX \
  			-DREAD_MMAP -DOSS -DTERM_CONTROL\
  			-Wall -O2 -m486 \
  			-fomit-frame-pointer -funroll-all-loops \
--- 125,131 ----
  	$(MAKE) CC=gcc LDFLAGS= \
  		OBJECTS='decode_i386.o dct64_i386.o decode_i586.o \
  			audio_oss.o term.o' \
! 		CFLAGS='$(CFLAGS) -DI386_ASSEM -DPENTIUM_OPT -DREAL_IS_FLOAT -DLINUX \
  			-DREAD_MMAP -DOSS -DTERM_CONTROL\
  			-Wall -O2 -m486 \
  			-fomit-frame-pointer -funroll-all-loops \
***************
*** 117,123 ****
  	$(MAKE) CC=gcc LDFLAGS= \
  		OBJECTS='decode_i386.o dct64_3dnow.o \
  			decode_3dnow.o audio_oss.o term.o' \
! 		CFLAGS='-DI386_ASSEM -DREAL_IS_FLOAT -DPENTIUM_OPT -DLINUX \
  			-DUSE_3DNOW -DREAD_MMAP -DOSS -DTERM_CONTROL\
  			-Wall -O2 -m486 \
  			-fomit-frame-pointer -funroll-all-loops \
--- 136,142 ----
  	$(MAKE) CC=gcc LDFLAGS= \
  		OBJECTS='decode_i386.o dct64_3dnow.o \
  			decode_3dnow.o audio_oss.o term.o' \
! 		CFLAGS='$(CFLAGS) -DI386_ASSEM -DREAL_IS_FLOAT -DPENTIUM_OPT -DLINUX \
  			-DUSE_3DNOW -DREAD_MMAP -DOSS -DTERM_CONTROL\
  			-Wall -O2 -m486 \
  			-fomit-frame-pointer -funroll-all-loops \
***************
*** 128,134 ****
  	$(MAKE) CC=gcc LDFLAGS= \
  		OBJECTS='decode_i386.o dct64_i386.o decode_i586.o \
  			decode_i486.o dct64_i486.o audio_oss.o term.o' \
! 		CFLAGS='-DI386_ASSEM -DREAL_IS_FLOAT -DI486_OPT -DLINUX \
  			-DREAD_MMAP -DOSS -DTERM_CONTROL\
  			-Wall -O2 -m486 \
  			-fomit-frame-pointer -funroll-all-loops \
--- 147,153 ----
  	$(MAKE) CC=gcc LDFLAGS= \
  		OBJECTS='decode_i386.o dct64_i386.o decode_i586.o \
  			decode_i486.o dct64_i486.o audio_oss.o term.o' \
! 		CFLAGS='$(CFLAGS) -DI386_ASSEM -DREAL_IS_FLOAT -DI486_OPT -DLINUX \
  			-DREAD_MMAP -DOSS -DTERM_CONTROL\
  			-Wall -O2 -m486 \
  			-fomit-frame-pointer -funroll-all-loops \
***************
*** 140,146 ****
  		AUDIO_LIB='-lesd -laudiofile' \
  		OBJECTS='decode_i386.o dct64_i386.o decode_i586.o \
  			audio_esd.o' \
! 		CFLAGS='-DI386_ASSEM -DREAL_IS_FLOAT -DPENTIUM_OPT -DLINUX \
  			-DREAD_MMAP -DOSS -DUSE_ESD \
  			-Wall  -O2 -m486 \
  			-fomit-frame-pointer -funroll-all-loops \
--- 159,165 ----
  		AUDIO_LIB='-lesd -laudiofile' \
  		OBJECTS='decode_i386.o dct64_i386.o decode_i586.o \
  			audio_esd.o' \
! 		CFLAGS='$(CFLAGS) -DI386_ASSEM -DREAL_IS_FLOAT -DPENTIUM_OPT -DLINUX \
  			-DREAD_MMAP -DOSS -DUSE_ESD \
  			-Wall  -O2 -m486 \
  			-fomit-frame-pointer -funroll-all-loops \
***************
*** 153,159 ****
  		AUDIO_LIB='-lasound' \
  		OBJECTS='decode_i386.o dct64_i386.o decode_i586.o \
  			audio_alsa.o term.o' \
! 		CFLAGS='-DI386_ASSEM -DREAL_IS_FLOAT -DPENTIUM_OPT -DLINUX \
  			-DREAD_MMAP -DALSA -DTERM_CONTROL\
  			-Wall  -O2 -m486 \
  			-fomit-frame-pointer -funroll-all-loops \
--- 172,178 ----
  		AUDIO_LIB='-lasound' \
  		OBJECTS='decode_i386.o dct64_i386.o decode_i586.o \
  			audio_alsa.o term.o' \
! 		CFLAGS='$(CFLAGS) -DI386_ASSEM -DREAL_IS_FLOAT -DPENTIUM_OPT -DLINUX \
  			-DREAD_MMAP -DALSA -DTERM_CONTROL\
  			-Wall  -O2 -m486 \
  			-fomit-frame-pointer -funroll-all-loops \
***************
*** 165,171 ****
  	$(MAKE) CC=gcc LDFLAGS= \
  		AUDIO_LIB='-lasound' \
  		OBJECTS='decode.o dct64.o audio_alsa.o term.o' \
! 		CFLAGS='-DREAL_IS_FLOAT -DLINUX -DREAD_MMAP -DALSA \
  			-DTERM_CONTROL -Wall  -O2 \
  			-fomit-frame-pointer -funroll-all-loops \
  			-finline-functions -ffast-math \
--- 184,190 ----
  	$(MAKE) CC=gcc LDFLAGS= \
  		AUDIO_LIB='-lasound' \
  		OBJECTS='decode.o dct64.o audio_alsa.o term.o' \
! 		CFLAGS='$(CFLAGS) -DREAL_IS_FLOAT -DLINUX -DREAD_MMAP -DALSA \
  			-DTERM_CONTROL -Wall  -O2 \
  			-fomit-frame-pointer -funroll-all-loops \
  			-finline-functions -ffast-math \
***************
*** 174,180 ****
  
  linux-alpha:
  	$(MAKE) CC=gcc LDFLAGS= OBJECTS='decode.o dct64.o audio_oss.o' \
! 		CFLAGS='-DLINUX -DOSS -Wall -O2 \
  			-fomit-frame-pointer -funroll-all-loops \
  			-finline-functions -ffast-math \
  			-Wall -O6 -DUSE_MMAP \
--- 193,199 ----
  
  linux-alpha:
  	$(MAKE) CC=gcc LDFLAGS= OBJECTS='decode.o dct64.o audio_oss.o' \
! 		CFLAGS='$(CFLAGS) -DLINUX -DOSS -Wall -O2 \
  			-fomit-frame-pointer -funroll-all-loops \
  			-finline-functions -ffast-math \
  			-Wall -O6 -DUSE_MMAP \
***************
*** 185,191 ****
  	$(MAKE) CC=gcc LDFLAGS= \
  		AUDIO_LIB='-lesd -laudiofile' \
  		OBJECTS='decode.o dct64.o audio_esd.o' \
! 		CFLAGS='-DLINUX -DOSS -Wall -O2 \
  			-fomit-frame-pointer -funroll-all-loops \
  			-finline-functions -ffast-math \
  			-Wall -O6 -DUSE_MMAP \
--- 204,210 ----
  	$(MAKE) CC=gcc LDFLAGS= \
  		AUDIO_LIB='-lesd -laudiofile' \
  		OBJECTS='decode.o dct64.o audio_esd.o' \
! 		CFLAGS='$(CFLAGS) -DLINUX -DOSS -Wall -O2 \
  			-fomit-frame-pointer -funroll-all-loops \
  			-finline-functions -ffast-math \
  			-Wall -O6 -DUSE_MMAP \
***************
*** 195,201 ****
  #linux-ppc:
  #	$(MAKE) CC=gcc  LDFLAGS= \
  #		OBJECTS='decode.o dct64.o audio_oss.o' \
! #		CFLAGS='-DREAL_IS_FLOAT -DLINUX -Wall -O2 -mcpu=ppc \
  #			-DOSS -DPPC_ENDIAN \
  #			-fomit-frame-pointer -funroll-all-loops \
  #			-finline-functions -ffast-math' \
--- 214,220 ----
  #linux-ppc:
  #	$(MAKE) CC=gcc  LDFLAGS= \
  #		OBJECTS='decode.o dct64.o audio_oss.o' \
! #		CFLAGS='$(CFLAGS) -DREAL_IS_FLOAT -DLINUX -Wall -O2 -mcpu=ppc \
  #			-DOSS -DPPC_ENDIAN \
  #			-fomit-frame-pointer -funroll-all-loops \
  #			-finline-functions -ffast-math' \
***************
*** 205,211 ****
  #	$(MAKE) CC=gcc  LDFLAGS= \
  #		AUDIO_LIB='-lesd -laudiofile' \
  #		OBJECTS='decode.o dct64.o audio_esd.o' \
! #		CFLAGS='-DREAL_IS_FLOAT -DLINUX -Wall -O2 -mcpu=ppc \
  #			-DOSS -DPPC_ENDIAN \
  #			-fomit-frame-pointer -funroll-all-loops \
  #			-finline-functions -ffast-math' \
--- 224,230 ----
  #	$(MAKE) CC=gcc  LDFLAGS= \
  #		AUDIO_LIB='-lesd -laudiofile' \
  #		OBJECTS='decode.o dct64.o audio_esd.o' \
! #		CFLAGS='$(CFLAGS) -DREAL_IS_FLOAT -DLINUX -Wall -O2 -mcpu=ppc \
  #			-DOSS -DPPC_ENDIAN \
  #			-fomit-frame-pointer -funroll-all-loops \
  #			-finline-functions -ffast-math' \
***************
*** 214,220 ****
  linux-ppc:
  	$(MAKE) CC=gcc  LDFLAGS= \
  		OBJECTS='decode.o dct64.o audio_oss.o' \
! 		CFLAGS='-DREAL_IS_FLOAT -DLINUX -Wall -O2 -mcpu=ppc \
  			-DOSS \
  			-fomit-frame-pointer -funroll-all-loops \
  			-finline-functions -ffast-math' \
--- 233,239 ----
  linux-ppc:
  	$(MAKE) CC=gcc  LDFLAGS= \
  		OBJECTS='decode.o dct64.o audio_oss.o' \
! 		CFLAGS='$(CFLAGS) -DREAL_IS_FLOAT -DLINUX -Wall -O2 -mcpu=ppc \
  			-DOSS \
  			-fomit-frame-pointer -funroll-all-loops \
  			-finline-functions -ffast-math' \
***************
*** 224,230 ****
  	$(MAKE) CC=gcc  LDFLAGS= \
  		AUDIO_LIB='-lesd -laudiofile' \
  		OBJECTS='decode.o dct64.o audio_esd.o' \
! 		CFLAGS='-DREAL_IS_FLOAT -DLINUX -Wall -O2 -mcpu=ppc \
  			-DOSS  \
  			-fomit-frame-pointer -funroll-all-loops \
  			-finline-functions -ffast-math' \
--- 243,249 ----
  	$(MAKE) CC=gcc  LDFLAGS= \
  		AUDIO_LIB='-lesd -laudiofile' \
  		OBJECTS='decode.o dct64.o audio_esd.o' \
! 		CFLAGS='$(CFLAGS) -DREAL_IS_FLOAT -DLINUX -Wall -O2 -mcpu=ppc \
  			-DOSS  \
  			-fomit-frame-pointer -funroll-all-loops \
  			-finline-functions -ffast-math' \
***************
*** 233,246 ****
  linux-sparc:
  	$(MAKE) CC=gcc  LDFLAGS= \
  		OBJECTS='decode.o dct64.o audio_sun.o' \
! 		CFLAGS='-DREAL_IS_FLOAT -DUSE_MMAP -DSPARCLINUX -Wall -O2 \
  			-fomit-frame-pointer -funroll-all-loops \
  			-finline-functions -ffast-math' \
  		mpg123-make
  
  linux-m68k:
  	$(MAKE) CC=gcc LDFLAGS= OBJECTS='decode.o dct64.o audio_oss.o' \
! 		CFLAGS='-DREAL_IS_FLOAT -DLINUX -DREAD_MMAP \
  			-DOSS -DOSS_BIG_ENDIAN -Wall -O2 -m68040 \
  			-fomit-frame-pointer -funroll-loops \
  			-finline-functions -ffast-math' \
--- 252,265 ----
  linux-sparc:
  	$(MAKE) CC=gcc  LDFLAGS= \
  		OBJECTS='decode.o dct64.o audio_sun.o' \
! 		CFLAGS='$(CFLAGS) -DREAL_IS_FLOAT -DUSE_MMAP -DSPARCLINUX -Wall -O2 \
  			-fomit-frame-pointer -funroll-all-loops \
  			-finline-functions -ffast-math' \
  		mpg123-make
  
  linux-m68k:
  	$(MAKE) CC=gcc LDFLAGS= OBJECTS='decode.o dct64.o audio_oss.o' \
! 		CFLAGS='$(CFLAGS) -DREAL_IS_FLOAT -DLINUX -DREAD_MMAP \
  			-DOSS -DOSS_BIG_ENDIAN -Wall -O2 -m68040 \
  			-fomit-frame-pointer -funroll-loops \
  			-finline-functions -ffast-math' \
***************
*** 262,268 ****
  	$(MAKE) CC=gcc LDFLAGS= \
  		OBJECTS='decode_i386.o dct64_i386.o decode_i586.o \
  			control_sajber.o control_tk3play.o audio_oss.o' \
! 		CFLAGS='-DFRONTEND -DOSS -DI386_ASSEM -DREAL_IS_FLOAT \
  			-DPENTIUM_OPT -DLINUX -Wall -O2 -m486 \
  			-fomit-frame-pointer -funroll-all-loops \
  			-finline-functions -ffast-math' \
--- 281,287 ----
  	$(MAKE) CC=gcc LDFLAGS= \
  		OBJECTS='decode_i386.o dct64_i386.o decode_i586.o \
  			control_sajber.o control_tk3play.o audio_oss.o' \
! 		CFLAGS='$(CFLAGS) -DFRONTEND -DOSS -DI386_ASSEM -DREAL_IS_FLOAT \
  			-DPENTIUM_OPT -DLINUX -Wall -O2 -m486 \
  			-fomit-frame-pointer -funroll-all-loops \
  			-finline-functions -ffast-math' \
***************
*** 272,278 ****
  	$(MAKE) CC=gcc LDFLAGS='-L/usr/X11R6/lib' \
  		AUDIO_LIB='-laudio -lXau' \
  		OBJECTS='decode_i386.o dct64_i386.o audio_nas.o' \
! 		CFLAGS='-I/usr/X11R6/include \
  			-DI386_ASSEM -DREAL_IS_FLOAT -DLINUX -DNAS \
  			-Wall -O2 -m486 \
  			-fomit-frame-pointer -funroll-all-loops \
--- 291,297 ----
  	$(MAKE) CC=gcc LDFLAGS='-L/usr/X11R6/lib' \
  		AUDIO_LIB='-laudio -lXau' \
  		OBJECTS='decode_i386.o dct64_i386.o audio_nas.o' \
! 		CFLAGS='$(CFLAGS) -I/usr/X11R6/include \
  			-DI386_ASSEM -DREAL_IS_FLOAT -DLINUX -DNAS \
  			-Wall -O2 -m486 \
  			-fomit-frame-pointer -funroll-all-loops \
***************
*** 281,294 ****
  
  #### the following defines are for experimental use ... 
  #
! #CFLAGS='-pg -DI386_ASSEM -DREAL_IS_FLOAT -DLINUX -Wall -O2 -m486 -funroll-all-loops -finline-functions -ffast-math' mpg123
! #CFLAGS='-DI386_ASSEM -O2 -DREAL_IS_FLOAT -DLINUX -Wall -g'
! #CFLAGS='-DI386_ASSEM -DREAL_IS_FLOAT -DLINUX -Wall -O2 -m486 -fomit-frame-pointer -funroll-all-loops -finline-functions -ffast-math -malign-loops=2 -malign-jumps=2 -malign-functions=2'
  
  freebsd:
  	$(MAKE) CC=cc LDFLAGS= \
  		OBJECTS='decode_i386.o dct64_i386.o audio_oss.o' \
! 		CFLAGS='-Wall -ansi -pedantic -O4 -m486 -fomit-frame-pointer \
  			-funroll-all-loops -ffast-math -DROT_I386 \
  			-DREAD_MMAP \
  			-DI386_ASSEM -DREAL_IS_FLOAT -DUSE_MMAP -DOSS' \
--- 300,313 ----
  
  #### the following defines are for experimental use ... 
  #
! #CFLAGS='$(CFLAGS) -pg -DI386_ASSEM -DREAL_IS_FLOAT -DLINUX -Wall -O2 -m486 -funroll-all-loops -finline-functions -ffast-math' mpg123
! #CFLAGS='$(CFLAGS) -DI386_ASSEM -O2 -DREAL_IS_FLOAT -DLINUX -Wall -g'
! #CFLAGS='$(CFLAGS) -DI386_ASSEM -DREAL_IS_FLOAT -DLINUX -Wall -O2 -m486 -fomit-frame-pointer -funroll-all-loops -finline-functions -ffast-math -malign-loops=2 -malign-jumps=2 -malign-functions=2'
  
  freebsd:
  	$(MAKE) CC=cc LDFLAGS= \
  		OBJECTS='decode_i386.o dct64_i386.o audio_oss.o' \
! 		CFLAGS='$(CFLAGS) -Wall -ansi -pedantic -O4 -m486 -fomit-frame-pointer \
  			-funroll-all-loops -ffast-math -DROT_I386 \
  			-DREAD_MMAP \
  			-DI386_ASSEM -DREAL_IS_FLOAT -DUSE_MMAP -DOSS' \
***************
*** 298,304 ****
  	$(MAKE) CC=cc LDFLAGS= \
  		AUDIO_LIB='-lesd -laudiofile' \
  		OBJECTS='decode_i386.o dct64_i386.o $(GETBITS) audio_esd.o' \
! 		CFLAGS='-Wall -ansi -pedantic -O4 -m486 -fomit-frame-pointer \
  			-funroll-all-loops -ffast-math -DROT_I386 \
  			-DREAD_MMAP \
  			-DI386_ASSEM -DREAL_IS_FLOAT -DUSE_MMAP -DOSS \
--- 317,323 ----
  	$(MAKE) CC=cc LDFLAGS= \
  		AUDIO_LIB='-lesd -laudiofile' \
  		OBJECTS='decode_i386.o dct64_i386.o $(GETBITS) audio_esd.o' \
! 		CFLAGS='$(CFLAGS) -Wall -ansi -pedantic -O4 -m486 -fomit-frame-pointer \
  			-funroll-all-loops -ffast-math -DROT_I386 \
  			-DREAD_MMAP \
  			-DI386_ASSEM -DREAL_IS_FLOAT -DUSE_MMAP -DOSS \
***************
*** 310,316 ****
  	$(MAKE) CC=cc LDFLAGS= \
  		OBJECTS='decode_i386.o dct64_i386.o audio_oss.o \
  			control_sajber.o control_tk3play.o' \
! 		CFLAGS='-Wall -ansi -pedantic -O4 -m486 -fomit-frame-pointer \
  			-funroll-all-loops -ffast-math -DROT_I386 \
  			-DFRONTEND \
  			-DI386_ASSEM -DREAL_IS_FLOAT -DUSE_MMAP -DOSS' \
--- 329,335 ----
  	$(MAKE) CC=cc LDFLAGS= \
  		OBJECTS='decode_i386.o dct64_i386.o audio_oss.o \
  			control_sajber.o control_tk3play.o' \
! 		CFLAGS='$(CFLAGS) -Wall -ansi -pedantic -O4 -m486 -fomit-frame-pointer \
  			-funroll-all-loops -ffast-math -DROT_I386 \
  			-DFRONTEND \
  			-DI386_ASSEM -DREAL_IS_FLOAT -DUSE_MMAP -DOSS' \
***************
*** 325,338 ****
  	$(MAKE) CC='purify -cache-dir=/tmp cc' \
  		LDFLAGS='-lsocket -lnsl' \
  		OBJECTS='decode.o dct64.o audio_sun.o term.o' \
! 		CFLAGS='-fast -native -xO4 -DSOLARIS -DTERM_CONTROL \
  			-DUSE_MMAP ' \
  		mpg123-make
  
  solaris-ccscc:
  	$(MAKE) CC=/usr/ccs/bin/ucbcc LDFLAGS='-lsocket -lnsl' \
  		OBJECTS='decode.o dct64.o audio_sun.o term.o' \
! 		CFLAGS='-fast -native -xO4 -DSOLARIS \
  			-DUSE_MMAP ' \
  		mpg123-make
  
--- 344,357 ----
  	$(MAKE) CC='purify -cache-dir=/tmp cc' \
  		LDFLAGS='-lsocket -lnsl' \
  		OBJECTS='decode.o dct64.o audio_sun.o term.o' \
! 		CFLAGS='$(CFLAGS) -fast -native -xO4 -DSOLARIS -DTERM_CONTROL \
  			-DUSE_MMAP ' \
  		mpg123-make
  
  solaris-ccscc:
  	$(MAKE) CC=/usr/ccs/bin/ucbcc LDFLAGS='-lsocket -lnsl' \
  		OBJECTS='decode.o dct64.o audio_sun.o term.o' \
! 		CFLAGS='$(CFLAGS) -fast -native -xO4 -DSOLARIS \
  			-DUSE_MMAP ' \
  		mpg123-make
  
***************
*** 340,346 ****
  solaris:
  	$(MAKE) CC=cc LDFLAGS='-lsocket -lnsl' \
  		OBJECTS='decode.o dct64.o audio_sun.o term.o' \
! 		CFLAGS='-fast -native -xO4 -DSOLARIS \
  			-DUSE_MMAP -DTERM_CONTROL' \
  		mpg123-make
  
--- 359,365 ----
  solaris:
  	$(MAKE) CC=cc LDFLAGS='-lsocket -lnsl' \
  		OBJECTS='decode.o dct64.o audio_sun.o term.o' \
! 		CFLAGS='$(CFLAGS) -fast -native -xO4 -DSOLARIS \
  			-DUSE_MMAP -DTERM_CONTROL' \
  		mpg123-make
  
***************
*** 348,354 ****
  	$(MAKE) CC='gcc' \
  		LDFLAGS='-lsocket -lnsl -pg' \
  		OBJECTS='decode.o dct64.o audio_sun.o' \
! 		CFLAGS='-g -pg -O2 -Wall -DSOLARIS -DREAL_IS_FLOAT -DUSE_MMAP \
  			-DREAD_MMAP \
  			-funroll-all-loops -finline-functions' \
  		mpg123-make
--- 367,373 ----
  	$(MAKE) CC='gcc' \
  		LDFLAGS='-lsocket -lnsl -pg' \
  		OBJECTS='decode.o dct64.o audio_sun.o' \
! 		CFLAGS='$(CFLAGS) -g -pg -O2 -Wall -DSOLARIS -DREAL_IS_FLOAT -DUSE_MMAP \
  			-DREAD_MMAP \
  			-funroll-all-loops -finline-functions' \
  		mpg123-make
***************
*** 357,363 ****
  	$(MAKE) CC=gcc \
  		LDFLAGS='-lsocket -lnsl' \
  		OBJECTS='decode.o dct64.o audio_sun.o term.o' \
! 		CFLAGS='-O2 -Wall -pedantic -DSOLARIS -DREAL_IS_FLOAT -DUSE_MMAP \
  			-DREAD_MMAP -DTERM_CONTROL \
  			-funroll-all-loops  -finline-functions' \
  		mpg123-make
--- 376,382 ----
  	$(MAKE) CC=gcc \
  		LDFLAGS='-lsocket -lnsl' \
  		OBJECTS='decode.o dct64.o audio_sun.o term.o' \
! 		CFLAGS='$(CFLAGS) -O2 -Wall -pedantic -DSOLARIS -DREAL_IS_FLOAT -DUSE_MMAP \
  			-DREAD_MMAP -DTERM_CONTROL \
  			-funroll-all-loops  -finline-functions' \
  		mpg123-make
***************
*** 366,372 ****
  	$(MAKE) CC=gcc LDFLAGS='-lsocket -lnsl' \
  		AUDIO_LIB='-lesd -lresolv' \
  		OBJECTS='decode.o dct64.o audio_esd.o' \
! 		CFLAGS='-O2 -Wall -DSOLARIS -DREAL_IS_FLOAT -DUSE_MMAP \
  			-DREAD_MMAP \
  			-funroll-all-loops -finline-functions' \
  		mpg123-make
--- 385,391 ----
  	$(MAKE) CC=gcc LDFLAGS='-lsocket -lnsl' \
  		AUDIO_LIB='-lesd -lresolv' \
  		OBJECTS='decode.o dct64.o audio_esd.o' \
! 		CFLAGS='$(CFLAGS) -O2 -Wall -DSOLARIS -DREAL_IS_FLOAT -DUSE_MMAP \
  			-DREAD_MMAP \
  			-funroll-all-loops -finline-functions' \
  		mpg123-make
***************
*** 375,381 ****
  	$(MAKE) CC=gcc LDFLAGS='-lsocket -lnsl' \
  		OBJECTS='decode_i386.o dct64_i386.o decode_i586.o \
  			audio_oss.o' \
! 		CFLAGS='-DI386_ASSEM -DREAL_IS_FLOAT -DPENTIUM_OPT -DUSE_MMAP \
  			-DREAD_MMAP -DOSS \
  			-Wall -O2 -m486 \
  			-funroll-all-loops -finline-functions' \
--- 394,400 ----
  	$(MAKE) CC=gcc LDFLAGS='-lsocket -lnsl' \
  		OBJECTS='decode_i386.o dct64_i386.o decode_i586.o \
  			audio_oss.o' \
! 		CFLAGS='$(CFLAGS) -DI386_ASSEM -DREAL_IS_FLOAT -DPENTIUM_OPT -DUSE_MMAP \
  			-DREAD_MMAP -DOSS \
  			-Wall -O2 -m486 \
  			-funroll-all-loops -finline-functions' \
***************
*** 385,391 ****
  	$(MAKE) CC=gcc LDFLAGS='-lsocket -lnsl' \
  		AUDIO_LIB='-L/usr/openwin/lib -laudio -lXau'\
  		OBJECTS='decode.o dct64.o audio_nas.o' \
! 		CFLAGS='-O2 -I/usr/openwin/include -Wall \
  			-DSOLARIS -DREAL_IS_FLOAT -DUSE_MMAP \
  			-DREAD_MMAP -DNAS \
  			-funroll-all-loops -finline-functions' \
--- 404,410 ----
  	$(MAKE) CC=gcc LDFLAGS='-lsocket -lnsl' \
  		AUDIO_LIB='-L/usr/openwin/lib -laudio -lXau'\
  		OBJECTS='decode.o dct64.o audio_nas.o' \
! 		CFLAGS='$(CFLAGS) -O2 -I/usr/openwin/include -Wall \
  			-DSOLARIS -DREAL_IS_FLOAT -DUSE_MMAP \
  			-DREAD_MMAP -DNAS \
  			-funroll-all-loops -finline-functions' \
***************
*** 394,461 ****
  sunos:
  	$(MAKE) CC=gcc LDFLAGS= \
  		OBJECTS='decode.o dct64.o audio_sun.o' \
! 		CFLAGS='-O2 -DSUNOS -DREAL_IS_FLOAT -DUSE_MMAP \
  			-funroll-loops' \
  		mpg123-make
  
! #		CFLAGS='-DREAL_IS_FLOAT -Aa +O3 -D_HPUX_SOURCE -DHPUX'
  hpux:
  	$(MAKE) CC=cc LDFLAGS= \
  		OBJECTS='decode.o dct64.o audio_hp.o' \
! 		CFLAGS='-DREAL_IS_FLOAT -Ae +O3 -D_HPUX_SOURCE -DHPUX' \
  		mpg123-make
  
  hpux-alib:
  	$(MAKE) CC=cc LDFLAGS='-L/opt/audio/lib' \
  		OBJECTS='decode.o dct64.o audio_alib.o' \
  		AUDIO_LIB=-lAlib \
! 		CFLAGS='-DREAL_IS_FLOAT -Ae +O3 -D_HPUX_SOURCE -DHPUX \
  			-I/opt/audio/include' \
  		mpg123-make
  
  hpux-gcc:
  	$(MAKE) CC=gcc LDFLAGS= OBJECTS='decode.o dct64.o audio_hp.o' \
! 		CFLAGS='-DREAL_IS_FLOAT -O3 -D_HPUX_SOURCE -DHPUX' \
  		mpg123-make
  sgi:
  	$(MAKE) CC=cc LDFLAGS= \
  		OBJECTS='decode.o dct64.o audio_sgi.o' AUDIO_LIB=-laudio \
! 		CFLAGS='-O2 -DSGI -DREAL_IS_FLOAT -DUSE_MMAP' \
  		mpg123-make
  
  sgi-gcc:
  	$(MAKE) CC=gcc LDFLAGS= \
  		OBJECTS='decode.o dct64.o audio_sgi.o' AUDIO_LIB=-laudio \
! 		CFLAGS='-O2 -DSGI -DREAL_IS_FLOAT -DUSE_MMAP' \
  		mpg123-make
  
  dec:
  	$(MAKE) CC=cc LDFLAGS= OBJECTS='decode.o dct64.o audio_dummy.o' \
! 		CFLAGS='-std1 -warnprotos -O4 -DUSE_MMAP' \
  		mpg123-make
  
  dec-nas:
  	$(MAKE) CC=cc LDFLAGS='-L/usr/X11R6/lib' \
  		AUDIO_LIB='-laudio -lXau -ldnet_stub'\
  		OBJECTS='decode.o dct64.o  audio_nas.o' \
! 		CFLAGS='-I/usr/X11R6/include -std1 -warnprotos -O4 -DUSE_MMAP' \
  		mpg123-make
  
  ultrix:
  	$(MAKE) CC=cc LDFLAGS= OBJECTS='decode.o dct64.o audio_dummy.o' \
! 		CFLAGS='-std1 -O2 -DULTRIX' \
  		mpg123-make
  
  aix-gcc:
  	$(MAKE) CC=gcc LDFLAGS= OBJECTS='decode.o dct64.o audio_aix.o' \
! 		CFLAGS='-DAIX -Wall -O6 -DUSE_MMAP -DREAD_MMAP -DREAL_IS_FLOAT \
  			-fomit-frame-pointer -funroll-all-loops \
  			-finline-functions -ffast-math' \
  		mpg123-make
  
  aix-xlc:
  	$(MAKE) LDFLAGS= OBJECTS='decode.o dct64.o audio_aix.o' \
! 		CFLAGS="$(CFLAGS) -O3 -qstrict -qcpluscmt -DAIX -DUSE_MMAP \
  			-DREAD_MMAP " \
  		mpg123-make
  
--- 413,480 ----
  sunos:
  	$(MAKE) CC=gcc LDFLAGS= \
  		OBJECTS='decode.o dct64.o audio_sun.o' \
! 		CFLAGS='$(CFLAGS) -O2 -DSUNOS -DREAL_IS_FLOAT -DUSE_MMAP \
  			-funroll-loops' \
  		mpg123-make
  
! #		CFLAGS='$(CFLAGS) -DREAL_IS_FLOAT -Aa +O3 -D_HPUX_SOURCE -DHPUX'
  hpux:
  	$(MAKE) CC=cc LDFLAGS= \
  		OBJECTS='decode.o dct64.o audio_hp.o' \
! 		CFLAGS='$(CFLAGS) -DREAL_IS_FLOAT -Ae +O3 -D_HPUX_SOURCE -DHPUX' \
  		mpg123-make
  
  hpux-alib:
  	$(MAKE) CC=cc LDFLAGS='-L/opt/audio/lib' \
  		OBJECTS='decode.o dct64.o audio_alib.o' \
  		AUDIO_LIB=-lAlib \
! 		CFLAGS='$(CFLAGS) -DREAL_IS_FLOAT -Ae +O3 -D_HPUX_SOURCE -DHPUX \
  			-I/opt/audio/include' \
  		mpg123-make
  
  hpux-gcc:
  	$(MAKE) CC=gcc LDFLAGS= OBJECTS='decode.o dct64.o audio_hp.o' \
! 		CFLAGS='$(CFLAGS) -DREAL_IS_FLOAT -O3 -D_HPUX_SOURCE -DHPUX' \
  		mpg123-make
  sgi:
  	$(MAKE) CC=cc LDFLAGS= \
  		OBJECTS='decode.o dct64.o audio_sgi.o' AUDIO_LIB=-laudio \
! 		CFLAGS='$(CFLAGS) -O2 -DSGI -DREAL_IS_FLOAT -DUSE_MMAP' \
  		mpg123-make
  
  sgi-gcc:
  	$(MAKE) CC=gcc LDFLAGS= \
  		OBJECTS='decode.o dct64.o audio_sgi.o' AUDIO_LIB=-laudio \
! 		CFLAGS='$(CFLAGS) -O2 -DSGI -DREAL_IS_FLOAT -DUSE_MMAP' \
  		mpg123-make
  
  dec:
  	$(MAKE) CC=cc LDFLAGS= OBJECTS='decode.o dct64.o audio_dummy.o' \
! 		CFLAGS='$(CFLAGS) -std1 -warnprotos -O4 -DUSE_MMAP' \
  		mpg123-make
  
  dec-nas:
  	$(MAKE) CC=cc LDFLAGS='-L/usr/X11R6/lib' \
  		AUDIO_LIB='-laudio -lXau -ldnet_stub'\
  		OBJECTS='decode.o dct64.o  audio_nas.o' \
! 		CFLAGS='$(CFLAGS) -I/usr/X11R6/include -std1 -warnprotos -O4 -DUSE_MMAP' \
  		mpg123-make
  
  ultrix:
  	$(MAKE) CC=cc LDFLAGS= OBJECTS='decode.o dct64.o audio_dummy.o' \
! 		CFLAGS='$(CFLAGS) -std1 -O2 -DULTRIX' \
  		mpg123-make
  
  aix-gcc:
  	$(MAKE) CC=gcc LDFLAGS= OBJECTS='decode.o dct64.o audio_aix.o' \
! 		CFLAGS='$(CFLAGS) -DAIX -Wall -O6 -DUSE_MMAP -DREAD_MMAP -DREAL_IS_FLOAT \
  			-fomit-frame-pointer -funroll-all-loops \
  			-finline-functions -ffast-math' \
  		mpg123-make
  
  aix-xlc:
  	$(MAKE) LDFLAGS= OBJECTS='decode.o dct64.o audio_aix.o' \
! 		CFLAGS="$(CFLAGS) $(CFLAGS) -O3 -qstrict -qcpluscmt -DAIX -DUSE_MMAP \
  			-DREAD_MMAP " \
  		mpg123-make
  
***************
*** 465,471 ****
  aix-frontend:
  	$(MAKE) LDFLAGS= OBJECTS='decode.o dct64.o audio_aix.o \
  			control_sajber.o control_tk3play.o' \
! 		CFLAGS='-DAIX -Wall -O6 -DUSE_MMAP -DFRONTEND \
  			-fomit-frame-pointer -funroll-all-loops \
  			-finline-functions -ffast-math' \
  		$(FRONTEND)
--- 484,490 ----
  aix-frontend:
  	$(MAKE) LDFLAGS= OBJECTS='decode.o dct64.o audio_aix.o \
  			control_sajber.o control_tk3play.o' \
! 		CFLAGS='$(CFLAGS) -DAIX -Wall -O6 -DUSE_MMAP -DFRONTEND \
  			-fomit-frame-pointer -funroll-all-loops \
  			-finline-functions -ffast-math' \
  		$(FRONTEND)
***************
*** 473,479 ****
  os2:
  	$(MAKE) CC=gcc LDFLAGS= \
  		OBJECTS='decode_i386.o dct64_i386.o audio_os2.o' \
! 		CFLAGS='-DREAL_IS_FLOAT -DNOXFERMEM -DOS2 -Wall -O2 -m486 \
  		-fomit-frame-pointer -funroll-all-loops \
  		-finline-functions -ffast-math' \
  		LIBS='-los2me -lsocket' \
--- 492,498 ----
  os2:
  	$(MAKE) CC=gcc LDFLAGS= \
  		OBJECTS='decode_i386.o dct64_i386.o audio_os2.o' \
! 		CFLAGS='$(CFLAGS) -DREAL_IS_FLOAT -DNOXFERMEM -DOS2 -Wall -O2 -m486 \
  		-fomit-frame-pointer -funroll-all-loops \
  		-finline-functions -ffast-math' \
  		LIBS='-los2me -lsocket' \
***************
*** 482,488 ****
  netbsd:
  	$(MAKE) CC=cc LDFLAGS= \
  		OBJECTS='decode.o dct64.o audio_sun.o' \
! 		CFLAGS='-Wall -ansi -pedantic -O3 -fomit-frame-pointer \
  			-funroll-all-loops -ffast-math \
  			-DREAL_IS_FLOAT -DUSE_MMAP -DNETBSD' \
  		mpg123-make
--- 501,507 ----
  netbsd:
  	$(MAKE) CC=cc LDFLAGS= \
  		OBJECTS='decode.o dct64.o audio_sun.o' \
! 		CFLAGS='$(CFLAGS) -Wall -ansi -pedantic -O3 -fomit-frame-pointer \
  			-funroll-all-loops -ffast-math \
  			-DREAL_IS_FLOAT -DUSE_MMAP -DNETBSD' \
  		mpg123-make
***************
*** 490,496 ****
  netbsd-i386:
  	$(MAKE) CC=cc LDFLAGS= \
  		OBJECTS='decode_i386.o dct64_i386.o audio_sun.o' \
! 		CFLAGS='-Wall -ansi -pedantic -O4 -m486 -fomit-frame-pointer \
  			-funroll-all-loops -ffast-math -DROT_I386 \
  			-DI386_ASSEM -DREAL_IS_FLOAT -DUSE_MMAP -DNETBSD' \
  		mpg123-make
--- 509,515 ----
  netbsd-i386:
  	$(MAKE) CC=cc LDFLAGS= \
  		OBJECTS='decode_i386.o dct64_i386.o audio_sun.o' \
! 		CFLAGS='$(CFLAGS) -Wall -ansi -pedantic -O4 -m486 -fomit-frame-pointer \
  			-funroll-all-loops -ffast-math -DROT_I386 \
  			-DI386_ASSEM -DREAL_IS_FLOAT -DUSE_MMAP -DNETBSD' \
  		mpg123-make
***************
*** 499,505 ****
  	$(MAKE) CC=shlicc2 LDFLAGS= \
  		OBJECTS='decode_i386.o dct64_i386.o \
  			 audio_oss.o' \
! 		CFLAGS='-Wall -O4 -m486 -fomit-frame-pointer \
  			-funroll-all-loops -ffast-math -DROT_I386 \
  			-DI386_ASSEM -DREAL_IS_FLOAT -DUSE_MMAP -DOSS \
  			-DDONT_CATCH_SIGNALS' \
--- 518,524 ----
  	$(MAKE) CC=shlicc2 LDFLAGS= \
  		OBJECTS='decode_i386.o dct64_i386.o \
  			 audio_oss.o' \
! 		CFLAGS='$(CFLAGS) -Wall -O4 -m486 -fomit-frame-pointer \
  			-funroll-all-loops -ffast-math -DROT_I386 \
  			-DI386_ASSEM -DREAL_IS_FLOAT -DUSE_MMAP -DOSS \
  			-DDONT_CATCH_SIGNALS' \
***************
*** 508,514 ****
  bsdos4:
  	$(MAKE) CC=gcc LDFLAGS= \
  		OBJECTS='decode_i386.o dct64_i386.o audio_oss.o' \
! 		CFLAGS='-Wall -O4 -m486 -fomit-frame-pointer \
  			-funroll-all-loops -ffast-math -DROT_I386 \
  			-DI386_ASSEM -DREAL_IS_FLOAT -DUSE_MMAP -DOSS \
  			-DREAD_MMAP -DDONT_CATCH_SIGNALS' \
--- 527,533 ----
  bsdos4:
  	$(MAKE) CC=gcc LDFLAGS= \
  		OBJECTS='decode_i386.o dct64_i386.o audio_oss.o' \
! 		CFLAGS='$(CFLAGS) -Wall -O4 -m486 -fomit-frame-pointer \
  			-funroll-all-loops -ffast-math -DROT_I386 \
  			-DI386_ASSEM -DREAL_IS_FLOAT -DUSE_MMAP -DOSS \
  			-DREAD_MMAP -DDONT_CATCH_SIGNALS' \
***************
*** 519,525 ****
  		AUDIO_LIB='-laudio -lXau -L/usr/X11R6/lib' \
  		OBJECTS='decode_i386.o dct64_i386.o \
  			audio_nas.o' \
! 		CFLAGS='-Wall -O4 -m486 -fomit-frame-pointer \
  			-funroll-all-loops -ffast-math -DROT_I386 \
  			-DI386_ASSEM -DREAL_IS_FLOAT -DUSE_MMAP -DOSS \
  			-DDONT_CATCH_SIGNALS -DNAS' \
--- 538,544 ----
  		AUDIO_LIB='-laudio -lXau -L/usr/X11R6/lib' \
  		OBJECTS='decode_i386.o dct64_i386.o \
  			audio_nas.o' \
! 		CFLAGS='$(CFLAGS) -Wall -O4 -m486 -fomit-frame-pointer \
  			-funroll-all-loops -ffast-math -DROT_I386 \
  			-DI386_ASSEM -DREAL_IS_FLOAT -DUSE_MMAP -DOSS \
  			-DDONT_CATCH_SIGNALS -DNAS' \
***************
*** 528,534 ****
  mint:
  	$(MAKE) CC=gcc LDFLAGS= \
  		OBJECTS='decode.o dct64.o audio_mint.o' \
! 		CFLAGS='-Wall -O2 -m68020-40 -m68881 \
  		-fomit-frame-pointer -funroll-all-loops \
  		-finline-functions -ffast-math \
  		-DREAL_IS_FLOAT -DMINT -DNOXFERMEM' \
--- 547,553 ----
  mint:
  	$(MAKE) CC=gcc LDFLAGS= \
  		OBJECTS='decode.o dct64.o audio_mint.o' \
! 		CFLAGS='$(CFLAGS) -Wall -O2 -m68020-40 -m68881 \
  		-fomit-frame-pointer -funroll-all-loops \
  		-finline-functions -ffast-math \
  		-DREAL_IS_FLOAT -DMINT -DNOXFERMEM' \
***************
*** 538,544 ****
  # maybe you need the additonal options LDFLAGS='-lnsl -lsocket' when linking (see solaris:)
  generic:
  	$(MAKE) LDFLAGS= OBJECTS='decode.o dct64.o audio_dummy.o' \
! 		CFLAGS='-O -DGENERIC -DNOXFERMEM' \
  		mpg123-make
  
  ###########################################################################
--- 557,563 ----
  # maybe you need the additonal options LDFLAGS='-lnsl -lsocket' when linking (see solaris:)
  generic:
  	$(MAKE) LDFLAGS= OBJECTS='decode.o dct64.o audio_dummy.o' \
! 		CFLAGS='$(CFLAGS) -O -DGENERIC -DNOXFERMEM' \
  		mpg123-make
  
  ###########################################################################
***************
*** 563,569 ****
  		layer2.o layer3.o audio.o buffer.o decode_2to1.o equalizer.o \
  		decode_4to1.o getlopt.o httpget.o xfermem.o decode_ntom.o \
  		wav.o readers.o getbits.o control_generic.o \
! 		$(OBJECTS) -o $(BINNAME) -lm $(AUDIO_LIB)
  
  mpg123.exe: mpg123.o common.o $(OBJECTS) decode_2to1.o decode_4to1.o \
  		tabinit.o audio.o layer1.o layer2.o layer3.o buffer.o \
--- 582,588 ----
  		layer2.o layer3.o audio.o buffer.o decode_2to1.o equalizer.o \
  		decode_4to1.o getlopt.o httpget.o xfermem.o decode_ntom.o \
  		wav.o readers.o getbits.o control_generic.o \
! 		$(OBJECTS) -o $(BINNAME) -lm $(AUDIO_LIB) $(IPV6LIBDIR) $(IPV6LIB)
  
  mpg123.exe: mpg123.o common.o $(OBJECTS) decode_2to1.o decode_4to1.o \
  		tabinit.o audio.o layer1.o layer2.o layer3.o buffer.o \
***************
*** 644,648 ****
  	rm -f "$$DISTNAME".tar.gz "$$DISTNAME".tar ; \
  	tar cvf "$$DISTNAME".tar "$$DISTNAME" ; \
  	gzip -9 "$$DISTNAME".tar
- 
- 
--- 663,665 ----
Index: mpg123/httpget.c
diff -c mpg123/httpget.c:1.1.1.2 mpg123/httpget.c:1.12
*** mpg123/httpget.c:1.1.1.2	Tue Jul 27 21:54:52 1999
--- mpg123/httpget.c	Wed Oct  6 12:51:32 1999
***************
*** 134,182 ****
    return 0;
  }
  
! char *url2hostport (char *url, char **hname, unsigned long *hip, unsigned int *port)
  {
! 	char *cptr;
! 	struct hostent *myhostent;
! 	struct in_addr myaddr;
! 	int isip = 1;
! 
! 	if (!(strncmp(url, "http://", 7)))
! 		url += 7;
! 	cptr = url;
! 	while (*cptr && *cptr != ':' && *cptr != '/') {
! 		if ((*cptr < '0' || *cptr > '9') && *cptr != '.')
! 			isip = 0;
! 		cptr++;
  	}
! 	*hname = strdup(url); /* removed the strndup for better portability */
! 	if (!(*hname)) {
  		*hname = NULL;
! 		return (NULL);
  	}
! 	(*hname)[cptr - url] = 0;
! 	if (!isip) {
! 		if (!(myhostent = gethostbyname(*hname)))
! 			return (NULL);
! 		memcpy (&myaddr, myhostent->h_addr, sizeof(myaddr));
! 		*hip = myaddr.s_addr;
! 	}
! 	else
! 		if ((*hip = inet_addr(*hname)) == INADDR_NONE)
! 			return (NULL);
! 	if (!*cptr || *cptr == '/') {
! 		*port = 80;
! 		return (cptr);
! 	}
! 	*port = atoi(++cptr);
! 	while (*cptr && *cptr != '/')
! 		cptr++;
! 	return (cptr);
  }
  
  char *proxyurl = NULL;
  unsigned long proxyip = 0;
! unsigned int proxyport;
  
  #define ACCEPT_HEAD "Accept: audio/mpeg, audio/x-mpegurl, */*\r\n"
  
--- 134,215 ----
    return 0;
  }
  
! static const char *defaultportstr = "80";
! 
! char *url2hostport (char *url, char **hname, unsigned long *hip, unsigned char **port)
  {
! 	char *h, *p;
! 	char *hostptr;
! 	char *r_hostptr;
! 	char *pathptr;
! 	char *portptr;
! 	char *p0;
! 	size_t stringlength;
! 
! 	p = url;
! 	if (strncmp(p, "http://", 7) == 0)
! 		p += 7;
! 	hostptr = p;
! 	while (*p && *p != '/')
! 		p++;
! 	pathptr = p;
! 
! 	r_hostptr = --p;
! 	while (*p && hostptr < p && *p != ':' && *p != ']')
! 		p--;
! 
! 	if (!*p || p < hostptr || *p != ':') {
! 		portptr = NULL;
! 	}
! 	else{
! 		portptr = p + 1;
! 		r_hostptr = p - 1;
! 	}
! 	if (*hostptr == '[' && *r_hostptr == ']') {
! 		hostptr++;
! 		r_hostptr--;
  	}
! 
! 	stringlength = r_hostptr - hostptr + 1;
! 	h = malloc(stringlength + 1); /* removed the strndup for better portability */
! 	if (h == NULL) {
  		*hname = NULL;
! 		*port = NULL;
! 		return NULL;
! 	}
! 	strncpy(h, hostptr, stringlength);
! 	*(h+stringlength) = '\0';
! 	*hname = h;
! 
! 	if (portptr) {
! 		stringlength = (pathptr - portptr);
! 		if(!stringlength) portptr = NULL;
! 	}
! 	if (portptr == NULL) {
! 		portptr = defaultportstr;
! 		stringlength = strlen(defaultportstr);
  	}
! 	p0 = malloc(stringlength + 1);
! 	if (p0 == NULL) {
! 		free(h);
! 		*hname = NULL;
! 		*port = NULL;
! 		return NULL;
! 	}
! 	strncpy(p0, portptr, stringlength);
! 	*(p0 + stringlength) = '\0';
! 
! 	for (p = p0; *p && isdigit(*p); p++)
! 		;
! 	*p = '\0';
! 	*port = p0;
! 
! 	return pathptr;
  }
  
  char *proxyurl = NULL;
  unsigned long proxyip = 0;
! unsigned char *proxyport;
  
  #define ACCEPT_HEAD "Accept: audio/mpeg, audio/x-mpegurl, */*\r\n"
  
***************
*** 188,213 ****
  	char *purl, *host, *request, *sptr;
  	int linelength;
  	unsigned long myip;
! 	unsigned int myport;
  	int sock;
  	int relocate, numrelocs = 0;
- 	struct sockaddr_in server;
  	FILE *myfile;
! 
  	if (!proxyip) {
  		if (!proxyurl)
  			if (!(proxyurl = getenv("MP3_HTTP_PROXY")))
  				if (!(proxyurl = getenv("http_proxy")))
  					proxyurl = getenv("HTTP_PROXY");
  		if (proxyurl && proxyurl[0] && strcmp(proxyurl, "none")) {
- 			host = NULL;
  			if (!(url2hostport(proxyurl, &host, &proxyip, &proxyport))) {
  				fprintf (stderr, "Unknown proxy host \"%s\".\n",
  					host ? host : "");
  				exit (1);
  			}
  			if (host)
  				free (host);
  		}
  		else
  			proxyip = INADDR_NONE;
--- 221,256 ----
  	char *purl, *host, *request, *sptr;
  	int linelength;
  	unsigned long myip;
! 	unsigned char *myport;
  	int sock;
  	int relocate, numrelocs = 0;
  	FILE *myfile;
! #ifdef INET6
! 	struct addrinfo hints, *res, *res0;
! 	int error;
! #else
! 	struct hostent *hp;
! 	struct sockaddr_in sin;
! #endif
! 
! 	host = NULL;
! 	proxyport = NULL;
! 	myport = NULL;
  	if (!proxyip) {
  		if (!proxyurl)
  			if (!(proxyurl = getenv("MP3_HTTP_PROXY")))
  				if (!(proxyurl = getenv("http_proxy")))
  					proxyurl = getenv("HTTP_PROXY");
  		if (proxyurl && proxyurl[0] && strcmp(proxyurl, "none")) {
  			if (!(url2hostport(proxyurl, &host, &proxyip, &proxyport))) {
  				fprintf (stderr, "Unknown proxy host \"%s\".\n",
  					host ? host : "");
  				exit (1);
  			}
+ #if 0
  			if (host)
  				free (host);
+ #endif
  		}
  		else
  			proxyip = INADDR_NONE;
***************
*** 234,240 ****
  			myip = proxyip;
  		}
  		else {
! 			host = NULL;
  			if (!(sptr = url2hostport(purl, &host, &myip, &myport))) {
  				fprintf (stderr, "Unknown host \"%s\".\n",
  					host ? host : "");
--- 277,290 ----
  			myip = proxyip;
  		}
  		else {
! 			if (host) {
! 				free(host);
! 				host=NULL;
! 			}
! 			if (proxyport) {
! 				free(proxyport);
! 				proxyport=NULL;
! 			}
  			if (!(sptr = url2hostport(purl, &host, &myip, &myport))) {
  				fprintf (stderr, "Unknown host \"%s\".\n",
  					host ? host : "");
***************
*** 247,267 ****
  			prgName, prgVersion);
  		if (host) {
  			sprintf(request + strlen(request),
! 				"Host: %s:%u\r\n", host, myport);
  			free (host);
  		}
- 
  		strcat (request, ACCEPT_HEAD);
! 		server.sin_family = AF_INET;
! 		server.sin_port = htons(myport);
! 		server.sin_addr.s_addr = myip;
! 		if ((sock = socket(PF_INET, SOCK_STREAM, 6)) < 0) {
! 			perror ("socket");
! 			exit (1);
  		}
! 		if (connect(sock, (struct sockaddr *)&server, sizeof(server))) {
! 			perror ("connect");
! 			exit (1);
  		}
  
  		if (strlen(httpauth1) || httpauth) {
--- 297,356 ----
  			prgName, prgVersion);
  		if (host) {
  			sprintf(request + strlen(request),
! 				"Host: %s:%s\r\n", host, myport);
! #if 0
  			free (host);
+ #endif
  		}
  		strcat (request, ACCEPT_HEAD);
! 
! #ifdef INET6
! 		memset(&hints, 0, sizeof(hints));
! 		hints.ai_socktype = SOCK_STREAM;
! 		error = getaddrinfo(host, (char *)myport, &hints, &res0);
! 		if (error) {
! 			fprintf(stderr, "getaddrinfo: %s\n", gai_strerror(error));
! 			exit(1);
  		}
! 
! 		sock = -1;
! 		for (res = res0; res; res = res->ai_next) {
! 			if ((sock = socket(res->ai_family, res->ai_socktype, res->ai_protocol)) < 0) {
! 				continue;
! 			}
! 			if (connect(sock, res->ai_addr, res->ai_addrlen)) {
! 				close(sock);
! 				sock = -1;
! 				continue;
! 			}
! 			break;
! 		}
! 
! 		freeaddrinfo(res0);
! #else
! 		sock = -1;
! 		hp = gethostbyname(host);
! 		if (!hp)
! 			goto fail;
! 		if (hp->h_length != sizeof(sin.sin_addr))
! 			goto fail;
! 		sock = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
! 		if (sock < 0)
! 			goto fail;
! 		memset(&sin, 0, sizeof(sin));
! 		sin.sin_family = AF_INET;
! 		sin.sin_len = sizeof(struct sockaddr_in);
! 		memcpy(&sin.sin_addr, hp->h_addr, hp->h_length);
! 		if (connect(sock, (struct sockaddr *)&sin, sin.sin_len) < 0) {
! 			close(sock);
! 			sock = -1;
! 		}
! fail:
! #endif
! 
! 		if (sock < 0) {
! 			perror("socket");
! 			exit(1);
  		}
  
  		if (strlen(httpauth1) || httpauth) {
***************
*** 308,313 ****
--- 397,405 ----
  	}
  	free (purl);
  	free (request);
+ 	free(host);
+ 	free(proxyport);
+ 	free(myport);
  
  	return sock;
  }
