Am 5. Mai 2019 03:53:20 MESZ schrieb "Guo, Yejun" <yejun....@intel.com>: > > >> -----Original Message----- >> From: ffmpeg-devel [mailto:ffmpeg-devel-boun...@ffmpeg.org] On Behalf >Of >> Alexander Strasser >> Sent: Thursday, May 02, 2019 12:08 AM >> To: ffmpeg-devel@ffmpeg.org >> Subject: [FFmpeg-devel] [PATCH 1/2] configure: print_in_columns: >Replace pr >> with awk >> >> Get rid of pr dependency and write the columns strictly >> alphabetical for the given rows. >> >> Before pr would attempt to write pages, thus if a page >> boundary was reached, the output looked confusing as one >> couldn't see there was a new page and the alphabetical >> order was disrupted when scanning down one of the columns. >> >> Fixes output for sizes with width < column width, too. >> >> Fixes part of ticket #5680 >> >> Signed-off-by: Alexander Strasser <eclip...@gmx.net> >> --- >> configure | 18 ++++++++++++++++-- >> 1 file changed, 16 insertions(+), 2 deletions(-) >> >> diff --git a/configure b/configure >> index b122b27268..81e3776060 100755 >> --- a/configure >> +++ b/configure >> @@ -3831,8 +3831,22 @@ die_unknown(){ >> } >> >> print_in_columns() { >> - cols=$(expr $ncols / 24) >> - cat | tr ' ' '\n' | sort | pr -r "-$cols" -w $ncols -t >> + tr ' ' '\n' | sort | tr '\r\n' ' ' | awk -v col_width=24 -v >width="$ncols" ' >> + { >> + num_cols = width > col_width ? int(width / col_width) : 1; >> + num_rows = int((NF + num_cols-1) / num_cols); >> + y = x = 1; >> + for (y = 1; y <= num_rows; y++) { >> + i = y; >> + for (x = 1; x <= num_cols; x++) { >> + if (i <= NF) { >> + line = sprintf("%s%-24s", line, $i); > >not sure how to use col_width instead of the magic number 24.
Good catch! Fortunately it's easy to fix: line = sprintf("%s%-" col_width "s", line, $i); Will change it locally. Thanks. Alexander >> + } >> + i = i + num_rows; >> + } >> + print line; line = ""; >> + } >> + }' | sed 's/ *$//' >> } >> >> show_list() { >> -- _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".