Changeset 16da5f8e in mainline
- Timestamp:
- 2009-03-02T21:18:15Z (16 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 20f1597
- Parents:
- 8dc72b64
- Location:
- kernel
- Files:
-
- 2 added
- 20 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/Makefile
r8dc72b64 r16da5f8e 186 186 generic/src/lib/memstr.c \ 187 187 generic/src/lib/sort.c \ 188 generic/src/lib/string.c \ 188 189 generic/src/lib/elf.c \ 189 190 generic/src/lib/rd.c \ -
kernel/arch/ia32/src/boot/cboot.c
r8dc72b64 r16da5f8e 39 39 #include <config.h> 40 40 #include <memstr.h> 41 #include < func.h>41 #include <string.h> 42 42 43 43 /* This is a symbol so the type is only dummy. Obtain the value using &. */ -
kernel/arch/sparc64/src/console.c
r8dc72b64 r16da5f8e 57 57 #include <arch.h> 58 58 #include <panic.h> 59 #include < func.h>59 #include <string.h> 60 60 #include <print.h> 61 61 -
kernel/arch/sparc64/src/drivers/kbd.c
r8dc72b64 r16da5f8e 46 46 #include <arch/types.h> 47 47 #include <align.h> 48 #include < func.h>48 #include <string.h> 49 49 #include <print.h> 50 50 #include <sysinfo/sysinfo.h> -
kernel/arch/sparc64/src/drivers/pci.c
r8dc72b64 r16da5f8e 43 43 #include <debug.h> 44 44 #include <print.h> 45 #include < func.h>45 #include <string.h> 46 46 #include <arch/asm.h> 47 47 #include <sysinfo/sysinfo.h> -
kernel/arch/sparc64/src/drivers/scr.c
r8dc72b64 r16da5f8e 38 38 #include <genarch/fb/visuals.h> 39 39 #include <arch/types.h> 40 #include < func.h>40 #include <string.h> 41 41 #include <align.h> 42 42 #include <print.h> -
kernel/arch/sparc64/src/drivers/sgcn.c
r8dc72b64 r16da5f8e 39 39 #include <genarch/ofw/ofw_tree.h> 40 40 #include <debug.h> 41 #include < func.h>41 #include <string.h> 42 42 #include <print.h> 43 43 #include <mm/page.h> -
kernel/genarch/src/ofw/ebus.c
r8dc72b64 r16da5f8e 39 39 #include <arch/memstr.h> 40 40 #include <arch/trap/interrupt.h> 41 #include < func.h>41 #include <string.h> 42 42 #include <panic.h> 43 43 #include <debug.h> -
kernel/genarch/src/ofw/fhc.c
r8dc72b64 r16da5f8e 39 39 #include <arch/drivers/fhc.h> 40 40 #include <arch/memstr.h> 41 #include < func.h>41 #include <string.h> 42 42 #include <panic.h> 43 43 #include <macros.h> -
kernel/genarch/src/ofw/ofw_tree.c
r8dc72b64 r16da5f8e 39 39 #include <arch/memstr.h> 40 40 #include <mm/slab.h> 41 #include < func.h>41 #include <string.h> 42 42 #include <print.h> 43 43 #include <panic.h> -
kernel/genarch/src/ofw/pci.c
r8dc72b64 r16da5f8e 40 40 #include <arch/trap/interrupt.h> 41 41 #include <arch/memstr.h> 42 #include < func.h>42 #include <string.h> 43 43 #include <panic.h> 44 44 #include <macros.h> -
kernel/generic/include/func.h
r8dc72b64 r16da5f8e 42 42 43 43 extern void halt(void); 44 45 extern size_t strlen(const char *str);46 extern int strcmp(const char *src, const char *dst);47 extern int strncmp(const char *src, const char *dst, size_t len);48 extern void strncpy(char *dest, const char *src, size_t len);49 44 extern unative_t atoi(const char *text); 50 45 extern void order(const uint64_t val, uint64_t *rv, char *suffix); -
kernel/generic/include/memstr.h
r8dc72b64 r16da5f8e 47 47 extern void *memmove(void *dst, const void *src, size_t cnt); 48 48 49 extern char *strcpy(char *dest, const char *src);50 51 49 #endif 52 50 -
kernel/generic/src/console/cmd.c
r8dc72b64 r16da5f8e 51 51 #include <config.h> 52 52 #include <func.h> 53 #include <string.h> 53 54 #include <macros.h> 54 55 #include <debug.h> -
kernel/generic/src/console/kconsole.c
r8dc72b64 r16da5f8e 50 50 #include <debug.h> 51 51 #include <func.h> 52 #include <string.h> 52 53 #include <symtab.h> 53 54 #include <macros.h> -
kernel/generic/src/debug/symtab.c
r8dc72b64 r16da5f8e 38 38 #include <symtab.h> 39 39 #include <byteorder.h> 40 #include < func.h>40 #include <string.h> 41 41 #include <print.h> 42 42 #include <arch/types.h> -
kernel/generic/src/lib/func.c
r8dc72b64 r16da5f8e 78 78 } 79 79 80 /** Return number of characters in a string.81 *82 * @param str NULL terminated string.83 *84 * @return Number of characters in str.85 */86 size_t strlen(const char *str)87 {88 int i;89 90 for (i = 0; str[i]; i++)91 ;92 93 return i;94 }95 96 /** Compare two NULL terminated strings97 *98 * Do a char-by-char comparison of two NULL terminated strings.99 * The strings are considered equal iff they consist of the same100 * characters on the minimum of their lengths.101 *102 * @param src First string to compare.103 * @param dst Second string to compare.104 *105 * @return 0 if the strings are equal, -1 if first is smaller, 1 if second smaller.106 *107 */108 int strcmp(const char *src, const char *dst)109 {110 for (; *src && *dst; src++, dst++) {111 if (*src < *dst)112 return -1;113 if (*src > *dst)114 return 1;115 }116 if (*src == *dst)117 return 0;118 if (!*src)119 return -1;120 return 1;121 }122 123 124 /** Compare two NULL terminated strings125 *126 * Do a char-by-char comparison of two NULL terminated strings.127 * The strings are considered equal iff they consist of the same128 * characters on the minimum of their lengths and specified maximal129 * length.130 *131 * @param src First string to compare.132 * @param dst Second string to compare.133 * @param len Maximal length for comparison.134 *135 * @return 0 if the strings are equal, -1 if first is smaller, 1 if second smaller.136 *137 */138 int strncmp(const char *src, const char *dst, size_t len)139 {140 unsigned int i;141 142 for (i = 0; (*src) && (*dst) && (i < len); src++, dst++, i++) {143 if (*src < *dst)144 return -1;145 if (*src > *dst)146 return 1;147 }148 if (i == len || *src == *dst)149 return 0;150 if (!*src)151 return -1;152 return 1;153 }154 155 156 157 /** Copy NULL terminated string.158 *159 * Copy at most 'len' characters from string 'src' to 'dest'.160 * If 'src' is shorter than 'len', '\0' is inserted behind the161 * last copied character.162 *163 * @param src Source string.164 * @param dest Destination buffer.165 * @param len Size of destination buffer.166 */167 void strncpy(char *dest, const char *src, size_t len)168 {169 unsigned int i;170 for (i = 0; i < len; i++) {171 if (!(dest[i] = src[i]))172 return;173 }174 dest[i-1] = '\0';175 }176 177 80 /** Convert ascii representation to unative_t 178 81 * -
kernel/generic/src/lib/memstr.c
r8dc72b64 r16da5f8e 161 161 } 162 162 163 /** Copy string.164 *165 * Copy string from src address to dst address. The copying is done166 * char-by-char until the null character. The source and destination memory167 * areas cannot overlap.168 *169 * @param src Source string to copy from.170 * @param dst Destination string to copy to.171 *172 * @return Address of the destination string.173 */174 char *strcpy(char *dest, const char *src)175 {176 char *orig = dest;177 178 while ((*(dest++) = *(src++)))179 ;180 return orig;181 }182 183 163 /** @} 184 164 */ -
kernel/generic/src/printf/printf_core.c
r8dc72b64 r16da5f8e 41 41 #include <arch/arg.h> 42 42 #include <macros.h> 43 #include < func.h>43 #include <string.h> 44 44 #include <arch.h> 45 45 -
kernel/generic/src/proc/task.c
r8dc72b64 r16da5f8e 53 53 #include <errno.h> 54 54 #include <func.h> 55 #include <string.h> 55 56 #include <syscall/copy.h> 56 57
Note:
See TracChangeset
for help on using the changeset viewer.