Branch: Tag:

1998-04-14

1998-04-14 20:10:49 by Fredrik Hübinette (Hubbe) <hubbe@hubbe.net>

field lengths added to %d %x and %o in sscanf()

Rev: src/opcodes.c:1.18

21:   #include "cyclic.h"   #include "builtin_functions.h"    - RCSID("$Id: opcodes.c,v 1.17 1998/04/06 04:18:33 hubbe Exp $"); + RCSID("$Id: opcodes.c,v 1.18 1998/04/14 20:10:49 hubbe Exp $");      void index_no_free(struct svalue *to,struct svalue *what,struct svalue *ind)   {
504:    char * t;       if(eye>=input_len) return matches; +  if(field_length != -1 && eye+field_length < input_len) +  { +  char save=input[eye+field_length+1];    sval.u.integer=STRTOL(input+eye,&t,10); -  +  input[eye+field_length+1]=save; +  }else +  sval.u.integer=STRTOL(input+eye,&t,10); +     if(input + eye == t) return matches;    eye=t-input;    sval.type=T_INT;
517:    char * t;       if(eye>=input_len) return matches; +  if(field_length != -1 && eye+field_length < input_len) +  { +  char save=input[eye+field_length+1];    sval.u.integer=STRTOL(input+eye,&t,16); -  +  input[eye+field_length+1]=save; +  }else +  sval.u.integer=STRTOL(input+eye,&t,16);    if(input + eye == t) return matches;    eye=t-input;    sval.type=T_INT;
530:    char * t;       if(eye>=input_len) return matches; +  if(field_length != -1 && eye+field_length < input_len) +  { +  char save=input[eye+field_length+1];    sval.u.integer=STRTOL(input+eye,&t,8); -  +  input[eye+field_length+1]=save; +  }else +  sval.u.integer=STRTOL(input+eye,&t,8);    if(input + eye == t) return matches;    eye=t-input;    sval.type=T_INT;
544:    char * t;       if(eye>=input_len) return matches; +  if(field_length != -1 && eye+field_length < input_len) +  { +  char save=input[eye+field_length+1];    sval.u.integer=STRTOL(input+eye,&t,0); -  +  input[eye+field_length+1]=save; +  }else +  sval.u.integer=STRTOL(input+eye,&t,0);    if(input + eye == t) return matches;    eye=t-input;    sval.type=T_INT;