projects
/
fw
/
sdcc
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
| inline |
side by side
* doc/sdccman.lyx,
[fw/sdcc]
/
device
/
lib
/
_strncpy.c
diff --git
a/device/lib/_strncpy.c
b/device/lib/_strncpy.c
index fd5f445c15403eb77d9c763fc7f6653e607b99df..505379eb4754206a2ae2d27ed131b9301fcd7bd1 100644
(file)
--- a/
device/lib/_strncpy.c
+++ b/
device/lib/_strncpy.c
@@
-26,11
+26,18
@@
char *strncpy (
char * d,
char * s,
- size_t n )
+ size_t n )
{
register char * d1 = d;
- while ( n-- )
+ while ( n && *s )
+ {
+ n-- ;
*d++ = *s++ ;
+ }
+ while ( n-- )
+ {
+ *d++ = '\0' ;
+ }
return d1;
}