+#if !defined (HAVE_X_WINDOWS) && defined (NoValue)
+
+/*
+ * XParseGeometry parses strings of the form
+ * "=<width>x<height>{+-}<xoffset>{+-}<yoffset>", where
+ * width, height, xoffset, and yoffset are unsigned integers.
+ * Example: "=80x24+300-49"
+ * The equal sign is optional.
+ * It returns a bitmask that indicates which of the four values
+ * were actually found in the string. For each value found,
+ * the corresponding argument is updated; for each value
+ * not found, the corresponding argument is left unchanged.
+ */
+
+static int
+XParseGeometry (char *string,
+ int *x, int *y,
+ unsigned int *width, unsigned int *height)
+{
+ int mask = NoValue;
+ char *strind;
+ unsigned long int tempWidth, tempHeight;
+ long int tempX, tempY;
+ char *nextCharacter;
+
+ if (string == NULL || *string == '\0')
+ return mask;
+ if (*string == '=')
+ string++; /* ignore possible '=' at beg of geometry spec */
+
+ strind = string;
+ if (*strind != '+' && *strind != '-' && *strind != 'x')
+ {
+ tempWidth = strtoul (strind, &nextCharacter, 10);
+ if (strind == nextCharacter)
+ return 0;
+ strind = nextCharacter;
+ mask |= WidthValue;
+ }
+
+ if (*strind == 'x' || *strind == 'X')
+ {
+ strind++;
+ tempHeight = strtoul (strind, &nextCharacter, 10);
+ if (strind == nextCharacter)
+ return 0;
+ strind = nextCharacter;
+ mask |= HeightValue;
+ }
+
+ if (*strind == '+' || *strind == '-')
+ {
+ if (*strind == '-')
+ mask |= XNegative;
+ tempX = strtol (strind, &nextCharacter, 10);
+ if (strind == nextCharacter)
+ return 0;
+ strind = nextCharacter;
+ mask |= XValue;
+ if (*strind == '+' || *strind == '-')
+ {
+ if (*strind == '-')
+ mask |= YNegative;
+ tempY = strtol (strind, &nextCharacter, 10);
+ if (strind == nextCharacter)
+ return 0;
+ strind = nextCharacter;
+ mask |= YValue;
+ }
+ }
+
+ /* If strind isn't at the end of the string then it's an invalid
+ geometry specification. */
+
+ if (*strind != '\0')
+ return 0;
+
+ if (mask & XValue)
+ *x = clip_to_bounds (INT_MIN, tempX, INT_MAX);
+ if (mask & YValue)
+ *y = clip_to_bounds (INT_MIN, tempY, INT_MAX);
+ if (mask & WidthValue)
+ *width = min (tempWidth, UINT_MAX);
+ if (mask & HeightValue)
+ *height = min (tempHeight, UINT_MAX);
+ return mask;
+}
+
+#endif /* !defined (HAVE_X_WINDOWS) && defined (NoValue) */