Commit | Line | Data |
---|---|---|
f37bdae6 | 1 | /* |
9e452516 KB |
2 | * Copyright (c) 1993 |
3 | * The Regents of the University of California. All rights reserved. | |
f37bdae6 KB |
4 | * |
5 | * %sccs.include.redist.c% | |
6 | */ | |
7 | ||
8 | #ifndef lint | |
9e452516 | 9 | static char sccsid[] = "@(#)addnstr.c 8.1 (Berkeley) %G%"; |
f37bdae6 KB |
10 | #endif /* not lint */ |
11 | ||
12 | #include <curses.h> | |
13 | #include <string.h> | |
14 | ||
15 | /* | |
16 | * waddnstr -- | |
17 | * Add a string (at most n characters) to the given window | |
18 | * starting at (_cury, _curx). If n is negative, add the | |
19 | * entire string. | |
20 | */ | |
21 | int | |
22 | waddnstr(win, s, n) | |
23 | WINDOW *win; | |
24 | const char *s; | |
25 | int n; | |
26 | { | |
27 | size_t len; | |
922c549d | 28 | const char *p; |
f37bdae6 | 29 | |
922c549d KB |
30 | if (n > 0) |
31 | for (p = s, len = 0; n-- && *p++; ++len); | |
32 | else | |
33 | len = strlen(s); | |
f37bdae6 KB |
34 | return (waddbytes(win, s, len)); |
35 | } |