corrected some more

This commit is contained in:
ceriel 1988-07-04 11:44:03 +00:00
parent 5157a5a186
commit bd5583311e
3 changed files with 13 additions and 8 deletions

View file

@ -14,11 +14,16 @@ String *_hex(i)
int i;
{
char buffer[30];
register char *p = buffer;
sprintf(buffer,"%x",i);
while (*p) {
if (*p >= 'a' && *p <= 'f') *p += 'A'-'a';
p++;
}
return( (String *)_newstr(buffer));
}
String *_nstr(f)
double f;
{
char buffer[80];
_str(f, buffer);
return (String *) _newstr(buffer);
}

View file

@ -56,7 +56,6 @@ char *buffer;
}
if( *c=='.') *c=0;
}
strcat(buffer," ");
}
_prfnum(f)
double f;
@ -68,6 +67,7 @@ double f;
_asschn();
c= buffer;
_str(f,c);
strcat(buffer," ");
_out(buffer);
}
_prstr(str)

View file

@ -129,7 +129,7 @@ double d,f;
s->strlength= i;
s->strcount=1;
s->strval= salloc(i+1);
s->strval[i]=0;
s->strval[i--]=0;
for(; i>=0;i--)
s->strval[i]= j;
return(s);
@ -142,7 +142,7 @@ String *s, *s2;
/*printf("mid called %d %d %s %s\n",i1,i2,s->strval, s2->strval);*/
if (i2 < 0 || i1 < -1) error(3);
if( s->strlength<i2 || s->strlength < i1+i2) error(3); /* source string too short */
if( s->strlength<i2 || s2->strlength < i1) error(3); /* source string too short */
if( i1== -1) i1= s2->strlength;
l= s->strlength - i2+1;
if( i1>l ) i1=l;