+/*
+ * gdelete: delete inside a global command. Handles the
+ * special case g/r.e./d. All lines to be deleted have
+ * already been marked. Squeeze the remaining lines together.
+ * Note that other cases such as g/r.e./p, g/r.e./s/r.e.2/rhs/,
+ * and g/r.e./.,/r.e.2/d are not treated specially. There is no
+ * good reason for this except the question: where to you draw the line?
+ */
+gdelete()
+{
+ register line *a1, *a2, *a3;
+
+ a3 = dol;
+ /* find first marked line. can skip all before it */
+ for (a1=zero; (*a1&01)==0; a1++)
+ if (a1>=a3)
+ return;
+ /* copy down unmarked lines, compacting as we go. */
+ for (a2=a1+1; a2<=a3;) {
+ if (*a2&01) {
+ a2++; /* line is marked, skip it */
+ dot = a1; /* dot left after line deletion */
+ } else
+ *a1++ = *a2++; /* unmarked, copy it */
+ }
+ dol = a1-1;
+ if (dot>dol)
+ dot = dol;
+ change();
+}
+
+bool cflag;