[FFmpeg-devel] configure: sort decoder/encoder/filter/... names in alphabet order in one page

Submitted by Guo, Yejun on April 10, 2019, 3:16 p.m.

Details

Message ID 1554909366-15448-1-git-send-email-yejun.guo@intel.com
State New
Headers show

Commit Message

Guo, Yejun April 10, 2019, 3:16 p.m.
takes 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.

This patch calculates the proper page length, so all the names are printed
in one page, and so strictly in alphabet order, column by column.

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

Comments

Carl Eugen Hoyos April 10, 2019, 8:14 p.m.
2019-04-10 17:16 GMT+02:00, Guo, Yejun <yejun.guo@intel.com>:
> takes 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.
>
> This patch calculates the proper page length, so all the names
> are printed in one page, and so strictly in alphabet order, column
> by column.

There is a report that busybox does not support pr
and we should therefore remove its usage, there is
even an old patch suggestion for doing this, see ticket #5680

Maybe this would be a good moment to do this?

Carl Eugen
Guo, Yejun April 11, 2019, 2:31 a.m.
> -----Original Message-----

> From: ffmpeg-devel [mailto:ffmpeg-devel-bounces@ffmpeg.org] On Behalf

> Of Carl Eugen Hoyos

> Sent: Thursday, April 11, 2019 4:14 AM

> To: FFmpeg development discussions and patches <ffmpeg-

> devel@ffmpeg.org>

> Subject: Re: [FFmpeg-devel] [PATCH] configure: sort

> decoder/encoder/filter/... names in alphabet order in one page

> 

> 2019-04-10 17:16 GMT+02:00, Guo, Yejun <yejun.guo@intel.com>:

> > takes 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.

> >

> > This patch calculates the proper page length, so all the names

> > are printed in one page, and so strictly in alphabet order, column

> > by column.

> 

> There is a report that busybox does not support pr

> and we should therefore remove its usage, there is

> even an old patch suggestion for doing this, see ticket #5680


I tried the patch and found it does not work well for print_in_columns,
it just prints all the names one by one, line by line, not in good format. 

I'll send out a new patch for print_in_columns in a better format with printf.

> 

> Maybe this would be a good moment to do this?

> 

> Carl Eugen

> _______________________________________________

> ffmpeg-devel mailing list

> ffmpeg-devel@ffmpeg.org

> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

> 

> To unsubscribe, visit link above, or email

> ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

Patch hide | download patch | download mbox

diff --git a/configure b/configure
index f6123f5..2eace26 100755
--- a/configure
+++ b/configure
@@ -3829,7 +3829,12 @@  die_unknown(){
 
 print_in_columns() {
     cols=$(expr $ncols / 24)
-    cat | tr ' ' '\n' | sort | pr -r "-$cols" -w $ncols -t
+    if [ -n "$1" ]; then
+        page_length=$(expr \( $1 + $cols - 1 \) / $cols)
+        cat | tr ' ' '\n' | sort | pr -r "-$cols" -w $ncols -t -l $page_length
+    else
+        cat | tr ' ' '\n' | sort | pr -r "-$cols" -w $ncols -t
+    fi
 }
 
 show_list() {
@@ -7134,7 +7139,8 @@  echo
 for type in decoder encoder hwaccel parser demuxer muxer protocol filter bsf indev outdev; do
     echo "Enabled ${type}s:"
     eval list=\$$(toupper $type)_LIST
-    print_enabled '_*' $list | print_in_columns
+    eanbled_list=`print_enabled '_*' $list`
+    echo $eanbled_list | print_in_columns `echo $eanbled_list | wc -w`
     echo
 done