+
+/*
+ * cost figures out how much (in characters) it costs to send the string
+ * str to the terminal. It takes into account padding information, as
+ * much as it can, for a typical case. (Right now the typical case assumes
+ * the number of lines affected is the size of the screen, since this is
+ * mainly used to decide if AL or SR is better, and this always happens
+ * at the top of the screen. We assume cursor motion (CM) has little
+ * padding, if any, required, so that case, which is really more important
+ * than AL vs SR, won't be really affected.)
+ */
+static int costnum;
+cost(str)
+char *str;
+{
+ int countnum();
+
+ if (str == NULL)
+ return 10000; /* infinity */
+ costnum = 0;
+ tputs(str, LINES, countnum);
+ return costnum;
+}
+
+/* ARGSUSED */
+countnum(ch)
+char ch;
+{
+ costnum++;
+}