Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 22 Jun 2013 02:57:52 +0000 (UTC)
From:      Devin Teske <dteske@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r252083 - head/usr.sbin/bsdconfig/share/media
Message-ID:  <201306220257.r5M2vquh049066@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: dteske
Date: Sat Jun 22 02:57:52 2013
New Revision: 252083
URL: http://svnweb.freebsd.org/changeset/base/252083

Log:
  Take advantage of the fact that f_getvar evaluates the $var_to_get parameter
  within braces, allowing all manner of parameter expansions (properly quoted
  or escaped, of course).

Modified:
  head/usr.sbin/bsdconfig/share/media/ftp.subr
  head/usr.sbin/bsdconfig/share/media/httpproxy.subr

Modified: head/usr.sbin/bsdconfig/share/media/ftp.subr
==============================================================================
--- head/usr.sbin/bsdconfig/share/media/ftp.subr	Sat Jun 22 02:51:22 2013	(r252082)
+++ head/usr.sbin/bsdconfig/share/media/ftp.subr	Sat Jun 22 02:57:52 2013	(r252083)
@@ -853,11 +853,10 @@ f_media_get_ftp()
 		userpass="$userpass${userpass:+@}"
 	fi
 
-	local ftp_dir mode rx
-	f_getvar $VAR_FTP_DIR ftp_dir
+	local dir mode rx
+	f_getvar $VAR_FTP_DIR\#/ dir
 	f_getvar $VAR_FTP_STATE mode
 
-	local dir="${ftp_dir#/}"
 	local port="${ftp_port:+:$ftp_port}"
 	case "$host" in *:*) host="[$host]"; esac
 

Modified: head/usr.sbin/bsdconfig/share/media/httpproxy.subr
==============================================================================
--- head/usr.sbin/bsdconfig/share/media/httpproxy.subr	Sat Jun 22 02:51:22 2013	(r252082)
+++ head/usr.sbin/bsdconfig/share/media/httpproxy.subr	Sat Jun 22 02:57:52 2013	(r252083)
@@ -292,7 +292,7 @@ f_media_init_http_proxy()
 			;;
 		*)
 			local fdir fp
-			f_getvar $VAR_FTP_PATH fp
+			f_getvar $VAR_FTP_PATH%/ fp
 			for fdir in $FTP_DIRS; do
 				setvar $VAR_HTTP_PROXY_PATH "$fp/$fdir/$rel"
 				if f_http_proxy_check_access; then
@@ -380,9 +380,9 @@ f_media_get_http_proxy()
 	fi
 
 	local proxy_path mode
-	f_getvar $VAR_HTTP_PROXY_PATH proxy_path
+	f_getvar $VAR_HTTP_PROXY_PATH%/ proxy_path
 	f_getvar $VAR_HTTP_FTP_MODE mode
-	local url="${proxy_path%/}/$file$mode" rx
+	local url="$proxy_path/$file$mode" rx
 
 	f_dprintf "sending http request for: %s" "$url"
 	printf "GET %s HTTP/1.0\r\n\r\n" "$url" | nc -n "$host" "$proxy_port" |



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201306220257.r5M2vquh049066>