From 692be57e53d1fa58356e1d25fed6a4a94980e768 Mon Sep 17 00:00:00 2001 From: Martok Date: Sun, 16 Apr 2017 18:46:02 +0200 Subject: [PATCH] uutlCommandLine: new function utlUsageProgramName --- uutlCommandLine.pas | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/uutlCommandLine.pas b/uutlCommandLine.pas index 5a15fe0..16ce768 100644 --- a/uutlCommandLine.pas +++ b/uutlCommandLine.pas @@ -5,7 +5,7 @@ unit uutlCommandLine; interface uses - getopts; + SysUtils, getopts; { Forward definitions so getopts doesn't have to be used } type @@ -32,6 +32,9 @@ type *) function utlHandleAllOptions(ShortOpts : String; LongOpts : POptions; Handler: TOptionHandler): integer; +// Get program binary name suitable for Usage statements +function utlUsageProgramName: string; + implementation function utlHandleAllOptions(ShortOpts : String; LongOpts : POptions; Handler: TOptionHandler): integer; @@ -51,5 +54,10 @@ begin Result:= getopts.OptInd; end; +function utlUsageProgramName: string; +begin + Result:= ChangeFileExt(ExtractFileName(ParamStr(0)), ''); +end; + end.