+/*
+ * A modified version of 'strtok'. This version skips \ sequences.
+ */
+
+char *expect_strtok (s, term)
+char *s, *term;
+ {
+ static char *str = "";
+ int escape_flag = 0;
+ char *result;
+/*
+ * If a string was specified then do initial processing.
+ */
+ if (s)
+ {
+ str = s;
+ }
+/*
+ * If this is the escape flag then reset it and ignore the character.
+ */
+ if (*str)
+ {
+ result = str;
+ }
+ else
+ {
+ result = (char *) 0;
+ }
+
+ while (*str)
+ {
+ if (escape_flag)
+ {
+ escape_flag = 0;
+ ++str;
+ continue;
+ }
+
+ if (*str == '\\')
+ {
+ ++str;
+ escape_flag = 1;
+ continue;
+ }
+/*
+ * If this is not in the termination string, continue.
+ */
+ if (strchr (term, *str) == (char *) 0)
+ {
+ ++str;
+ continue;
+ }
+/*
+ * This is the terminator. Mark the end of the string and stop.
+ */
+ *str++ = '\0';
+ break;
+ }
+ return (result);
+ }
+