+ if (cp) {
+ *cp++ = '\0';
+ speed = cp;
+ cp = index(speed, '/');
+ if (cp)
+ *cp++ = '\0';
+ for (cpp = speeds; cpp < &speeds[NSPEEDS]; cpp++)
+ if (strcmp(*cpp, speed) == 0) {
+ tp->sg_ispeed = tp->sg_ospeed = cpp-speeds;
+ break;
+ }
+ ws.ws_row = ws.ws_col = -1;
+ ws.ws_xpixel = ws.ws_ypixel = -1;
+ if (cp) {
+ ws.ws_row = atoi(cp);
+ cp = index(cp, ',');
+ if (cp == 0)
+ goto done;
+ ws.ws_col = atoi(++cp);
+ cp = index(cp, ',');
+ if (cp == 0)
+ goto done;
+ ws.ws_xpixel = atoi(++cp);
+ cp = index(cp, ',');
+ if (cp == 0)
+ goto done;
+ ws.ws_ypixel = atoi(++cp);
+ }
+done:
+ if (ws.ws_row != -1 && ws.ws_col != -1 &&
+ ws.ws_xpixel != -1 && ws.ws_ypixel != -1)
+ win = ws;
+ }
+ tp->sg_flags = ECHO|CRMOD|ANYP|XTABS;
+}
+
+/*
+ * Set the value of var to be arg in the Unix 4.2 BSD environment env.
+ * Var should end with '='.
+ * (bindings are of the form "var=value")
+ * This procedure assumes the memory for the first level of environ
+ * was allocated using malloc.
+ */
+setenv(var, value)
+ char *var, *value;
+{
+ extern char **environ;
+ int index = 0;
+ int varlen = strlen(var);
+ int vallen = strlen(value);
+
+ for (index = 0; environ[index] != NULL; index++) {
+ if (strncmp(environ[index], var, varlen) == 0) {
+ /* found it */
+ environ[index] = malloc(varlen + vallen + 1);
+ strcpy(environ[index], var);
+ strcat(environ[index], value);
+ return;
+ }
+ }
+ environ = (char **) realloc(environ, sizeof (char *) * (index + 2));
+ if (environ == NULL) {
+ fprintf(stderr, "login: malloc out of memory\n");
+ exit(1);
+ }
+ environ[index] = malloc(varlen + vallen + 1);
+ strcpy(environ[index], var);
+ strcat(environ[index], value);
+ environ[++index] = NULL;