| 1 | /* Copyright Richard A. O'Keefe. |
| 2 | Copyright (c) 2000 TXT DataKonsult Ab & Monty Program Ab |
| 3 | Copyright (c) 2009-2011, Monty Program Ab |
| 4 | |
| 5 | Redistribution and use in source and binary forms, with or without |
| 6 | modification, are permitted provided that the following conditions are |
| 7 | met: |
| 8 | |
| 9 | 1. Redistributions of source code must retain the above copyright |
| 10 | notice, this list of conditions and the following disclaimer. |
| 11 | |
| 12 | 2. Redistributions in binary form must the following disclaimer in |
| 13 | the documentation and/or other materials provided with the |
| 14 | distribution. |
| 15 | |
| 16 | THIS SOFTWARE IS PROVIDED BY <COPYRIGHT HOLDER> ``AS IS'' AND ANY |
| 17 | EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
| 18 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
| 19 | PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> OR |
| 20 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
| 21 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
| 22 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF |
| 23 | USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND |
| 24 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, |
| 25 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT |
| 26 | OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 27 | SUCH DAMAGE. |
| 28 | */ |
| 29 | |
| 30 | /* File : strend.c |
| 31 | Author : Richard A. O'Keefe. |
| 32 | Updated: 23 April 1984 |
| 33 | Defines: strend() |
| 34 | |
| 35 | strend(s) returns a character pointer to the NUL which ends s. That |
| 36 | is, strend(s)-s == strlen(s). This is useful for adding things at |
| 37 | the end of strings. It is redundant, because strchr(s,'\0') could |
| 38 | be used instead, but this is clearer and faster. |
| 39 | */ |
| 40 | |
| 41 | #include "strings_def.h" |
| 42 | |
| 43 | char *strend(register const char *s) |
| 44 | { |
| 45 | while (*s++); |
| 46 | return (char*) (s-1); |
| 47 | } |
| 48 | |
| 49 | |