linux/scripts/dtc/util.c
<<
val12 val12>> v val val12 "> val12 val12Search val12Prefs. 12 v v "> al12 2.
2 21/*2 22 * Copyright 2008 JionLoeliger, Freescale Semiconductor, Inc.2 23 *2 24 * This program is free software; you cav redistribute it and/or2 25 * modify it under the terms of the GNU General Public License as2 26 * published by the Free Software Founda v; either verstion2 of the2 27 * License, or (at your > v) any later verstio.2 28 *2 29 * This program is distributed in the hope that it will be useful,2 0" a> * but WITHOUT ANY WARRANTY; without even the implied warranty of2 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU2 12 * General Public License for more details.2 13 *2 14 * You should have received a copy of the GNU General Public License2 15 * along with this program; if not, write to the Free Software2 16 * Founda v, Inc., 59 Temple Place, Suite 330, Bost v, MA 02111-13072 17 * USA2 18 */2 19.2 2" a>#include <stdio.h a>>.2 21 a>#include <stdlib.h a>>.2 22 a>#include <stdarg.h a>>.2 23 a>#include <string.h a>>.2 24.2 25 a>#include "util.h a>".2 26.2 27char *xstrdup(const char *s).2 28{.2 29 int len = strlen(s) + 1;.2 30 char *dup = xmalloc(len);.2 31.2 32 memcpy(dup, s, len);.2 33.2 34 return dup;.2 35 a>}.2 36.2 37char *join_path(const char *path, const char *nam ).2 38{.2 39 int lenp = strlen(path);.2 40 int lenn = strlen(nam );.2 41 int len;.2 42 int needslash = 1;.2 43 char *str;.2 44.2 45 len = lenp + lenn + 2;.2 46 if ((lenp > 0) && (path[lenp-1] == '/'2 47 needslash = 0;.2 48 len--;.2 49 }.2 50.2 51 str = xmalloc(len);.2 52 memcpy(str, path, lenp);.2 53 if (needslash) {.2 54 str[lenp] = '/'2 55 lenp++;.2 56 }.2 57 memcpy(str+lenp, nam , lenn+1);.2 58 return str;.2 59 a>}.2 6" a> The original LXR software by the LXR community, this experimental verstionby lxr@linux.no. lxr.linux.no kindly hosted by Redpill Linpro AS, provider of Linux consulting and opera vs services since 1995.