OLD | NEW |
1 /* $OpenBSD: strlcpy.c,v 1.5 2001/05/13 15:40:16 deraadt Exp $ */ | 1 /* $OpenBSD: strlcpy.c,v 1.5 2001/05/13 15:40:16 deraadt Exp $ */ |
2 | 2 |
3 /* | 3 /* |
4 * Copyright (c) 1998 Todd C. Miller <Todd.Miller@courtesan.com> | 4 * Copyright (c) 1998 Todd C. Miller <Todd.Miller@courtesan.com> |
5 * All rights reserved. | 5 * All rights reserved. |
6 * | 6 * |
7 * Redistribution and use in source and binary forms, with or without | 7 * Redistribution and use in source and binary forms, with or without |
8 * modification, are permitted provided that the following conditions | 8 * modification, are permitted provided that the following conditions |
9 * are met: | 9 * are met: |
10 * 1. Redistributions of source code must retain the above copyright | 10 * 1. Redistributions of source code must retain the above copyright |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
67 if (n == 0) { | 67 if (n == 0) { |
68 if (siz != 0) | 68 if (siz != 0) |
69 *d = '\0'; /* NUL-terminate dst */ | 69 *d = '\0'; /* NUL-terminate dst */ |
70 while (*s++) | 70 while (*s++) |
71 ; | 71 ; |
72 } | 72 } |
73 | 73 |
74 return(s - src - 1); /* count does not include NUL */ | 74 return(s - src - 1); /* count does not include NUL */ |
75 } | 75 } |
76 #endif | 76 #endif |
OLD | NEW |