projects
/
unix-history
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
tags
|
clone url
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
fd60a66
)
Bell 32V development
author
Tom London
<tbl@research.uucp>
Sat, 20 Jan 1979 04:53:45 +0000
(23:53 -0500)
committer
Tom London
<tbl@research.uucp>
Sat, 20 Jan 1979 04:53:45 +0000
(23:53 -0500)
Work on file usr/src/libc/gen/strncpy.c
Co-Authored-By: John Reiser <jfr@research.uucp>
Synthesized-from: 32v
usr/src/libc/gen/strncpy.c
[new file with mode: 0644]
patch
|
blob
diff --git a/usr/src/libc/gen/strncpy.c
b/usr/src/libc/gen/strncpy.c
new file mode 100644
(file)
index 0000000..
40c511e
--- /dev/null
+++ b/
usr/src/libc/gen/strncpy.c
@@ -0,0
+1,21
@@
+/*
+ * Copy s2 to s1, truncating or null-padding to always copy n bytes
+ * return s1
+ */
+
+char *
+strncpy(s1, s2, n)
+register char *s1, *s2;
+{
+ register i;
+ register char *os1;
+
+ os1 = s1;
+ for (i = 0; i < n; i++)
+ if ((*s1++ = *s2++) == '\0') {
+ while (++i < n)
+ *s1++ = '\0';
+ return(os1);
+ }
+ return(os1);
+}