summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--man/xcalc.man3
-rw-r--r--xcalc.c12
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:
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);