summaryrefslogtreecommitdiff
path: root/xcalc.c
diff options
context:
space:
mode:
authorAlan Coopersmith <alan.coopersmith@oracle.com>2023-01-28 11:25:46 -0800
committerAlan Coopersmith <alan.coopersmith@oracle.com>2023-01-28 11:25:46 -0800
commitd624c05dc44dcb69ae48d0c0665e326fcdc972ba (patch)
treef64ab6821b6b2475060747fbbf5bef01bdc47518 /xcalc.c
parent846249c8bb9f113573c7c6504ea45ae673f4652b (diff)
Add -version option
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Diffstat (limited to 'xcalc.c')
-rw-r--r--xcalc.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/xcalc.c b/xcalc.c
index f3ca18f..e188439 100644
--- a/xcalc.c
+++ b/xcalc.c
@@ -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);