-#include "busybox.h"
-#include <stdio.h>
-#include <fcntl.h>
-#include <signal.h>
-#include <stdlib.h>
-#include <sys/ioctl.h>
-#define BB_DECLARE_EXTERN
-#define bb_need_help
-#include "messages.c"
-
-/* ED: sparc termios is broken: revert back to old termio handling. */
-#ifdef BB_FEATURE_USE_TERMIOS
-# if #cpu(sparc)
-# include <termio.h>
-# define termios termio
-# define setTermSettings(fd,argp) ioctl(fd,TCSETAF,argp)
-# define getTermSettings(fd,argp) ioctl(fd,TCGETA,argp)
-# else
-# include <termios.h>
-# define setTermSettings(fd,argp) tcsetattr(fd,TCSANOW,argp)
-# define getTermSettings(fd,argp) tcgetattr(fd, argp);
-# endif
-
-static FILE *cin;
-
-static struct termios initial_settings, new_settings;
-
-static void gotsig(int sig)
+//usage:#define more_trivial_usage
+//usage: "[FILE]..."
+//usage:#define more_full_usage "\n\n"
+//usage: "View FILE (or stdin) one screenful at a time"
+//usage:
+//usage:#define more_example_usage
+//usage: "$ dmesg | more\n"
+
+#include "libbb.h"
+
+/* Support for FEATURE_USE_TERMIOS */
+
+struct globals {
+ int cin_fileno;
+ struct termios initial_settings;
+ struct termios new_settings;
+} FIX_ALIASING;
+#define G (*(struct globals*)bb_common_bufsiz1)
+#define INIT_G() ((void)0)
+#define initial_settings (G.initial_settings)
+#define new_settings (G.new_settings )
+#define cin_fileno (G.cin_fileno )
+
+#define setTermSettings(fd, argp) \
+do { \
+ if (ENABLE_FEATURE_USE_TERMIOS) \
+ tcsetattr(fd, TCSANOW, argp); \
+} while (0)
+#define getTermSettings(fd, argp) tcgetattr(fd, argp)
+
+static void gotsig(int sig UNUSED_PARAM)