Deleted Added
full compact
27c27
< # $FreeBSD: head/usr.sbin/bsdconfig/share/media/common.subr 252987 2013-07-07 18:51:44Z dteske $
---
> # $FreeBSD: head/usr.sbin/bsdconfig/share/media/common.subr 253333 2013-07-14 03:08:52Z dteske $
44a45,51
> #
> # Media probe values to use for `f_media_get_TYPE media $file $PROBE' or
> # `f_device_get media $file $PROBE' (where $PROBE is one of the below values).
> #
> PROBE_EXIST=1
> PROBE_SIZE=2
>
86c93
< # f_media_generic_get $base $file [$probe_only]
---
> # f_media_generic_get $base $file [$probe_type]
89c96,98
< # $probe_only is present and non-NULL, returns success if $file exists.
---
> # $probe_type is present and non-NULL, returns success if $file exists. If
> # $probe_type is equal to $PROBE_SIZE, prints the size of $file in bytes to
> # standard-out.
93c102
< local base="$1" file="$2" probe_only="$3"
---
> local base="$1" file="$2" probe_type="$3"
96,97c105,106
< f_dprintf "%s: base=[%s] files=[%s] probe_only=%s" \
< $fname "$base" "$file" "$probe_only"
---
> f_dprintf "%s: base=[%s] files=[%s] probe_type=%s" \
> $fname "$base" "$file" "$probe_type"
109c118,128
< [ "$probe_only" ] && return $SUCCESS
---
> if [ "$probe_type" = "$PROBE_SIZE" ]; then
> local size
> if ! size=$( stat -f %z "$path" 2>&1 ); then
> f_dprintf "stat: %s" "$size"
> echo "-1"
> else
> f_isinteger "$size" || size=-1
> echo $size
> fi
> fi
> [ "$probe_type" ] && return $SUCCESS
118,119c137,149
< [ "$probe_only" ] && return $SUCCESS
< elif [ "$probe_only" ]; then
---
> if [ "$probe_type" = "$PROBE_SIZE" ]; then
> local size
> if ! size=$( stat -f %z "$path" 2>&1 ); then
> f_dprintf "stat: %s" "$size"
> echo "-1"
> else
> f_isinteger "$size" || size=-1
> echo $size
> fi
> fi
> [ "$probe_type" ] && return $SUCCESS
> elif [ "$probe_type" ]; then
> [ "$probe_type" = "$PROBE_SIZE" ] && echo "-1"