diff options
| author | Mike Smith <msmith@FreeBSD.org> | 1998-09-03 02:10:09 +0000 |
|---|---|---|
| committer | Mike Smith <msmith@FreeBSD.org> | 1998-09-03 02:10:09 +0000 |
| commit | 06b57b0e096b169e96e363151b867f99c7cd4877 (patch) | |
| tree | 95d1040f91a6dfbc5efa08f2abd404562dac8542 /sys/boot/common/misc.c | |
| parent | 9de9848b61e1f78985a975fe38bf0e24a42b868a (diff) | |
Notes
Diffstat (limited to 'sys/boot/common/misc.c')
| -rw-r--r-- | sys/boot/common/misc.c | 36 |
1 files changed, 35 insertions, 1 deletions
diff --git a/sys/boot/common/misc.c b/sys/boot/common/misc.c index 98ec3deb2c52..2999da5ba50f 100644 --- a/sys/boot/common/misc.c +++ b/sys/boot/common/misc.c @@ -23,11 +23,12 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id$ + * $Id: misc.c,v 1.1.1.1 1998/08/21 03:17:41 msmith Exp $ */ #include <string.h> #include <stand.h> +#include <bootstrap.h> /* * Concatenate the (argc) elements of (argv) into a single string, and return @@ -53,3 +54,36 @@ unargv(int argc, char *argv[]) return(cp); } +/* + * Get the length of a string in kernel space + */ +size_t +strlenout(vm_offset_t src) +{ + char c; + size_t len; + + for (len = 0; ; len++) { + archsw.arch_copyout(src++, &c, 1); + if (c == 0) + break; + } + return(len); +} + +/* + * Make a duplicate copy of a string in kernel space + */ +char * +strdupout(vm_offset_t str) +{ + char *result, *cp; + + result = malloc(strlenout(str) + 1); + for (cp = result; ;cp++) { + archsw.arch_copyout(str++, cp, 1); + if (*cp == 0) + break; + } + return(result); +} |
