git: lpr(1): Fix '-i' option with optional argument

Aaron LI aly at crater.dragonflybsd.org
Sat Feb 19 19:27:03 PST 2022


commit 7a1c99d311f1595cdc33d2ea3804d7fe580e1d87
Author: Aaron LI <aly at aaronly.me>
Date:   Sat Feb 19 17:53:05 2022 +0800

    lpr(1): Fix '-i' option with optional argument
    
    lpr(1)'s '-i' option accepts an optional argument, but the
    implementation was incomplete.  For example, 'lpr -i -#3' errors with:
    'Bad argument to -i, number expected'.
    
    However, because the argument to '-i' option can have a leading white
    space (i.e., '-i 4'), we can't use getopt(3)'s new 'option::' feature
    here.  Fix the code in another way inspired by dma(8) (see
    'libexec/dma/dma.c').
    
    In addition, update the usage text as well as the man page.

Summary of changes:
 usr.sbin/lpr/lpr/lpr.1 | 12 ++++++++----
 usr.sbin/lpr/lpr/lpr.c | 16 ++++++++++++----
 2 files changed, 20 insertions(+), 8 deletions(-)

http://gitweb.dragonflybsd.org/dragonfly.git/commitdiff/7a1c99d311f1595cdc33d2ea3804d7fe580e1d87


-- 
DragonFly BSD source repository


More information about the Commits mailing list