Use stpcpy instead of home grown solution
This commit is contained in:
parent
b9cedb46e2
commit
b274c68a20
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=334527
@ -822,7 +822,7 @@ i_process(int line, char *thisline)
|
||||
|
||||
/* copy it in to our buffer */
|
||||
base = smart_terminal ? screenbuf + lineindex(line) : screenbuf;
|
||||
p = strecpy(base, thisline);
|
||||
p = stpcpy(base, thisline);
|
||||
|
||||
/* zero fill the rest of it */
|
||||
bzero(p, display_width - (p - base));
|
||||
@ -861,7 +861,7 @@ u_process(int line, char *newline)
|
||||
fputs(newline, stdout);
|
||||
|
||||
/* copy it in to the buffer */
|
||||
optr = strecpy(bufferline, newline);
|
||||
optr = stpcpy(bufferline, newline);
|
||||
|
||||
/* zero fill the rest of it */
|
||||
bzero(optr, display_width - (optr - bufferline));
|
||||
@ -1110,30 +1110,30 @@ static void summary_format(char *str, int *numbers, char **names)
|
||||
if (thisname[0] == 'K')
|
||||
{
|
||||
/* yes: format it as a memory value */
|
||||
p = strecpy(p, format_k(num));
|
||||
p = stpcpy(p, format_k(num));
|
||||
|
||||
/* skip over the K, since it was included by format_k */
|
||||
p = strecpy(p, thisname+1);
|
||||
p = stpcpy(p, thisname+1);
|
||||
}
|
||||
/* is this number a ratio? */
|
||||
else if (thisname[0] == ':')
|
||||
{
|
||||
(void) snprintf(rbuf, sizeof(rbuf), "%.2f",
|
||||
(float)*(numbers - 2) / (float)num);
|
||||
p = strecpy(p, rbuf);
|
||||
p = strecpy(p, thisname);
|
||||
p = stpcpy(p, rbuf);
|
||||
p = stpcpy(p, thisname);
|
||||
}
|
||||
else
|
||||
{
|
||||
p = strecpy(p, itoa(num));
|
||||
p = strecpy(p, thisname);
|
||||
p = stpcpy(p, itoa(num));
|
||||
p = stpcpy(p, thisname);
|
||||
}
|
||||
}
|
||||
|
||||
/* ignore negative numbers, but display corresponding string */
|
||||
else if (num < 0)
|
||||
{
|
||||
p = strecpy(p, thisname);
|
||||
p = stpcpy(p, thisname);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -130,18 +130,6 @@ int digits(int val)
|
||||
return(cnt);
|
||||
}
|
||||
|
||||
/*
|
||||
* strecpy(to, from) - copy string "from" into "to" and return a pointer
|
||||
* to the END of the string "to".
|
||||
*/
|
||||
|
||||
char *
|
||||
strecpy(char *to, const char *from)
|
||||
{
|
||||
while ((*to++ = *from++) != '\0');
|
||||
return(--to);
|
||||
}
|
||||
|
||||
/*
|
||||
* string_index(string, array) - find string in array and return index
|
||||
*/
|
||||
@ -393,7 +381,7 @@ char *format_k(int amt)
|
||||
}
|
||||
}
|
||||
|
||||
p = strecpy(p, itoa(amt));
|
||||
p = stpcpy(p, itoa(amt));
|
||||
*p++ = tag;
|
||||
*p = '\0';
|
||||
|
||||
@ -423,7 +411,7 @@ format_k2(unsigned long long amt)
|
||||
}
|
||||
}
|
||||
|
||||
p = strecpy(p, itoa((int)amt));
|
||||
p = stpcpy(p, itoa((int)amt));
|
||||
*p++ = tag;
|
||||
*p = '\0';
|
||||
|
||||
|
@ -14,7 +14,6 @@ int atoiwi(const char *);
|
||||
char *itoa(unsigned int);
|
||||
char *itoa7(unsigned int);
|
||||
int digits(int);
|
||||
char *strecpy(char *, const char *);
|
||||
char **argparse(char *, int *);
|
||||
long percentages(int, int *, long *, long *, long *);
|
||||
char *format_time(long);
|
||||
|
Loading…
Reference in New Issue
Block a user