summaryrefslogtreecommitdiff
path: root/Build/source/texk/ps2pkm/sexpr.c
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2006-01-17 21:41:51 +0000
committerKarl Berry <karl@freefriends.org>2006-01-17 21:41:51 +0000
commit487ca4806cc046076293cf6cc5fbba0db282bac7 (patch)
tree847b412ab5158dd7bdd7ed7e5a4cc3fbca94be32 /Build/source/texk/ps2pkm/sexpr.c
parenta3d3111bfe26b8e5f5bc6049dfb2a4ca2edc7881 (diff)
texk 1
git-svn-id: svn://tug.org/texlive/trunk@1485 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/texk/ps2pkm/sexpr.c')
-rw-r--r--Build/source/texk/ps2pkm/sexpr.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/Build/source/texk/ps2pkm/sexpr.c b/Build/source/texk/ps2pkm/sexpr.c
new file mode 100644
index 00000000000..d069cce1c0b
--- /dev/null
+++ b/Build/source/texk/ps2pkm/sexpr.c
@@ -0,0 +1,25 @@
+/*
+ * File: sexpr.c
+ * Purpose: evaluate algebraic expression from single argument
+ * (Derived from expr.c from J.T. Conklin <jtc@netbsd.org>.)
+ * Version: 1.0 (Nov 1995)
+ * Author: Piet Tutelaers
+ */
+
+#include <stdio.h>
+#include "strexpr.h" /* strexpr() */
+#include "basics.h" /* fatal() */
+
+int main(int argc, char *argv[]) {
+ int result;
+
+ if (argc < 2) fatal("Usage: sexpr expression ...\n");
+
+ while (--argc > 0) {
+ if (strexpr(&result, *++argv))
+ fatal("expression error\n");
+
+ printf("%s = %d\n", argv[0] , result);
+ }
+ exit(0);
+}