diff options
author | Alan Coopersmith <alan.coopersmith@oracle.com> | 2023-01-28 11:25:46 -0800 |
---|---|---|
committer | Alan Coopersmith <alan.coopersmith@oracle.com> | 2023-01-28 11:25:46 -0800 |
commit | d624c05dc44dcb69ae48d0c0665e326fcdc972ba (patch) | |
tree | f64ab6821b6b2475060747fbbf5bef01bdc47518 | |
parent | 846249c8bb9f113573c7c6504ea45ae673f4652b (diff) |
Add -version option
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
-rw-r--r-- | man/xcalc.man | 3 | ||||
-rw-r--r-- | xcalc.c | 12 |
2 files changed, 14 insertions, 1 deletions
diff --git a/man/xcalc.man b/man/xcalc.man index 8e58d01..e286692 100644 --- a/man/xcalc.man +++ b/man/xcalc.man @@ -65,6 +65,9 @@ displays improves the appearance. This option indicates that Reverse Polish Notation should be used. In this mode the calculator will look and behave like an HP-10C. Without this flag, it will emulate a TI-30. +.TP 8 +.B \-version +This option indicates that \fIxcalc\fP should print its version and exit. .SH OPERATION .PP .I Pointer Usage: @@ -88,13 +88,15 @@ static unsigned char check_bits[] = { /* command line options specific to the application */ static XrmOptionDescRec Options[] = { {"-rpn", "rpn", XrmoptionNoArg, (XtPointer)"on"}, -{"-stipple", "stipple", XrmoptionNoArg, (XtPointer)"on"} +{"-stipple", "stipple", XrmoptionNoArg, (XtPointer)"on"}, +{"-version", "version", XrmoptionNoArg, (XtPointer)"on"} }; /* resources specific to the application */ static struct resources { Boolean rpn; /* reverse polish notation (HP mode) */ Boolean stipple; /* background stipple */ + Boolean version; /* print version */ Cursor cursor; } appResources; @@ -104,6 +106,8 @@ static XtResource Resources[] = { offset(rpn), XtRImmediate, (XtPointer) False}, {"stipple", "Stipple", XtRBoolean, sizeof(Boolean), offset(stipple), XtRImmediate, (XtPointer) False}, +{"version", "Version", XtRBoolean, sizeof(Boolean), + offset(version), XtRImmediate, (XtPointer) False}, {"cursor", "Cursor", XtRCursor, sizeof(Cursor), offset(cursor), XtRCursor, (XtPointer)NULL} }; @@ -127,6 +131,12 @@ main(int argc, char **argv) XtGetApplicationResources(toplevel, (XtPointer)&appResources, Resources, XtNumber(Resources), (ArgList) NULL, ZERO); + if (appResources.version) + { + puts(PACKAGE_STRING); + exit(0); + } + create_calculator(toplevel); XtAppAddActions(xtcontext, Actions, ActionsCount); |