[FFmpeg-devel] [PATCH] configure: sort decoder/encoder/filter/... names in alphabet order, row by row

Guo, Yejun yejun.guo at intel.com
Fri Apr 12 16:24:03 EEST 2019

take decoder names an example, with the default page length, shell command
'pr' needs two pages for all the decoder names. The names are firstly printed
in the first page, then in the second page. So, as a whole, the names are
sorted neither in column order nor in row order. It's a little confused.

One method is to calculate the proper page length, so all the names are printed
in one page by 'pr -l', and so strictly in alphabet order, column by column.

Another method is to use command printf instead of pr, because buybox doesn't
have pr. This patch refines print_in_columns to print the names with printf
in alphabet order, row by row.

Signed-off-by: Guo, Yejun <yejun.guo at intel.com>
 configure | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/configure b/configure
index f6123f5..2666b4d 100755
--- a/configure
+++ b/configure
@@ -3828,8 +3828,13 @@ die_unknown(){
 print_in_columns() {
-    cols=$(expr $ncols / 24)
-    cat | tr ' ' '\n' | sort | pr -r "-$cols" -w $ncols -t
+    width=24
+    cols=$(expr $ncols / $width)
+    eval format="%-${width}s"
+    content=$(cat | tr ' ' '\n' | sort)
+    count=$(echo $content | wc -w)
+    pfmt=$(for c in $(seq 1 $count); do printf '%s' $format; [ $(($c % $cols)) -eq 0 -o $c -eq $count ] && printf '\\n'; done)
+    printf "$pfmt" $(echo $content)
 show_list() {

More information about the ffmpeg-devel mailing list