+}
+
+static int
+get_rotation(const char *arg)
+{
+ long rot;
+ char *endp;
+
+ errno = 0;
+ rot = strtol(arg, &endp, 10);
+ if (errno == 0 && (arg[0] == '\0' || *endp != '\0'))
+ errno = EINVAL;
+ if (errno == 0 && (rot < 0 || rot > INT_MAX))
+ errno = ERANGE;
+ if (errno)
+ err(EXIT_FAILURE, "Bad rotation value `%s'", arg);
+ return (int)rot;
+}
+
+static void
+guess_and_rotate(void)
+{
+ unsigned char inbuf[2048];
+ unsigned int obs[NCHARS];
+ size_t i, nread;
+ double dot, winnerdot;
+ int try, winner;
+ int ch;