| 1 | /* Copyright (c) 2000 TXT DataKonsult Ab & Monty Program Ab |
| 2 | Copyright (c) 2009-2011, Monty Program Ab |
| 3 | |
| 4 | Redistribution and use in source and binary forms, with or without |
| 5 | modification, are permitted provided that the following conditions are |
| 6 | met: |
| 7 | |
| 8 | 1. Redistributions of source code must retain the above copyright |
| 9 | notice, this list of conditions and the following disclaimer. |
| 10 | |
| 11 | 2. Redistributions in binary form must the following disclaimer in |
| 12 | the documentation and/or other materials provided with the |
| 13 | distribution. |
| 14 | |
| 15 | THIS SOFTWARE IS PROVIDED BY <COPYRIGHT HOLDER> ``AS IS'' AND ANY |
| 16 | EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
| 17 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
| 18 | PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> OR |
| 19 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
| 20 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
| 21 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF |
| 22 | USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND |
| 23 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, |
| 24 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT |
| 25 | OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 26 | SUCH DAMAGE. |
| 27 | */ |
| 28 | |
| 29 | /* File : strappend.c |
| 30 | Author : Monty |
| 31 | Updated: 1987.02.07 |
| 32 | Defines: strappend() |
| 33 | |
| 34 | strappend(dest, len, fill) appends fill-characters to a string so that |
| 35 | the result length == len. If the string is longer than len it's |
| 36 | trunked. The des+len character is always set to NULL. |
| 37 | */ |
| 38 | |
| 39 | #include "strings_def.h" |
| 40 | |
| 41 | void strappend(register char *s, size_t len, pchar fill) |
| 42 | { |
| 43 | register char *endpos; |
| 44 | |
| 45 | endpos = s+len; |
| 46 | while (*s++); |
| 47 | s--; |
| 48 | while (s<endpos) *(s++) = fill; |
| 49 | *(endpos) = '\0'; |
| 50 | } /* strappend */ |
| 51 | |