=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/less/cmdbuf.c,v retrieving revision 1.15 retrieving revision 1.16 diff -c -r1.15 -r1.16 *** src/usr.bin/less/cmdbuf.c 2016/03/16 15:36:26 1.15 --- src/usr.bin/less/cmdbuf.c 2016/09/17 15:06:41 1.16 *************** *** 436,447 **** /* * Make room for the new character (shift the tail of the buffer right). */ ! for (s = &cmdbuf[strlen(cmdbuf)]; s >= cp; s--) s[clen] = s[0]; /* * Insert the character into the buffer. */ ! for (s = cp; s < cp + clen; s++) *s = *cs++; /* * Reprint the tail of the line from the inserted char. --- 436,447 ---- /* * Make room for the new character (shift the tail of the buffer right). */ ! for (s = &cmdbuf[strlen(cmdbuf)]; s >= cp; s--) s[clen] = s[0]; /* * Insert the character into the buffer. */ ! for (s = cp; s < cp + clen; s++) *s = *cs++; /* * Reprint the tail of the line from the inserted char. *************** *** 883,894 **** * without a corresponding close quote), we return everything * from the open quote, including spaces. */ ! for (word = cmdbuf; word < cp; word++) if (*word != ' ') break; if (word >= cp) return (cp); ! for (p = cmdbuf; p < cp; p++) { if (meta_quoted) { meta_quoted = 0; } else if (esclen > 0 && p + esclen < cp && --- 883,894 ---- * without a corresponding close quote), we return everything * from the open quote, including spaces. */ ! for (word = cmdbuf; word < cp; word++) if (*word != ' ') break; if (word >= cp) return (cp); ! for (p = cmdbuf; p < cp; p++) { if (meta_quoted) { meta_quoted = 0; } else if (esclen > 0 && p + esclen < cp && *************** *** 1155,1161 **** off_t n = 0; int err; ! for (p = cmdbuf; *p >= '0' && *p <= '9'; p++) n = (n * 10) + (*p - '0'); *frac = 0; if (*p++ == '.') { --- 1155,1161 ---- off_t n = 0; int err; ! for (p = cmdbuf; *p >= '0' && *p <= '9'; p++) n = (n * 10) + (*p - '0'); *frac = 0; if (*p++ == '.') { *************** *** 1239,1245 **** return; } while (fgets(line, sizeof (line), f) != NULL) { ! for (p = line; *p != '\0'; p++) { if (*p == '\n' || *p == '\r') { *p = '\0'; break; --- 1239,1245 ---- return; } while (fgets(line, sizeof (line), f) != NULL) { ! for (p = line; *p != '\0'; p++) { if (*p == '\n' || *p == '\r') { *p = '\0'; break; *************** *** 1274,1285 **** histsize = 100; ml = ml->prev; ! for (n = 0; n < histsize; n++) { if (ml->string == NULL) break; ml = ml->prev; } ! for (ml = ml->next; ml->string != NULL; ml = ml->next) (void) fprintf(f, "\"%s\n", ml->string); } --- 1274,1285 ---- histsize = 100; ml = ml->prev; ! for (n = 0; n < histsize; n++) { if (ml->string == NULL) break; ml = ml->prev; } ! for (ml = ml->next; ml->string != NULL; ml = ml->next) (void) fprintf(f, "\"%s\n", ml->string); }