hexedit: optimize output buffering
[oweals/busybox.git] / miscutils / dc.c
index 3fbb89f5b88960819fba39a144cfa7cad4c13bbe..b922a7184d7d2fe2934662fca61b7ad50dd5cef6 100644 (file)
@@ -2,10 +2,24 @@
 /*
  * Licensed under GPLv2 or later, see file LICENSE in this source tree.
  */
-
-#include "libbb.h"
-#include "common_bufsiz.h"
-#include <math.h>
+//config:config DC
+//config:      bool "dc (4.2 kb)"
+//config:      default y
+//config:      help
+//config:      Dc is a reverse-polish desk calculator which supports unlimited
+//config:      precision arithmetic.
+//config:
+//config:config FEATURE_DC_LIBM
+//config:      bool "Enable power and exp functions (requires libm)"
+//config:      default y
+//config:      depends on DC
+//config:      help
+//config:      Enable power and exp functions.
+//config:      NOTE: This will require libm to be present for linking.
+
+//applet:IF_DC(APPLET(dc, BB_DIR_USR_BIN, BB_SUID_DROP))
+
+//kbuild:lib-$(CONFIG_DC) += dc.o
 
 //usage:#define dc_trivial_usage
 //usage:       "EXPRESSION..."
 //usage:       "$ echo 72 9 div 8 mul p | dc\n"
 //usage:       "64\n"
 
+#include "libbb.h"
+#include "common_bufsiz.h"
+#include <math.h>
+
 #if 0
 typedef unsigned data_t;
 #define DATA_FMT ""
@@ -53,6 +71,7 @@ enum { STACK_SIZE = (COMMON_BUFSIZE - offsetof(struct globals, stack)) / sizeof(
 #define base      (G.base      )
 #define stack     (G.stack     )
 #define INIT_G() do { \
+       setup_common_bufsiz(); \
        base = 10; \
 } while (0)