Changeset 095003a8 in mainline
- Timestamp:
- 2009-04-09T22:32:23Z (16 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- f4b1535
- Parents:
- 7afb4a5
- Location:
- uspace
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/app/bdsh/cmds/modules/ls/ls.c
r7afb4a5 r095003a8 183 183 getcwd(buff, PATH_MAX); 184 184 else 185 str ncpy(buff, argv[1], PATH_MAX);185 str_ncpy(buff, argv[1], PATH_MAX); 186 186 187 187 scope = ls_scope(buff); -
uspace/app/bdsh/cmds/modules/mkdir/mkdir.c
r7afb4a5 r095003a8 94 94 /* Its a good idea to allocate path, plus we (may) need a copy of 95 95 * path to tokenize if parents are specified */ 96 if (NULL == (tmp = str dup(path))) {96 if (NULL == (tmp = str_dup(path))) { 97 97 cli_error(CL_ENOMEM, "%s: path too big?", cmdname); 98 98 return 1; -
uspace/app/bdsh/cmds/modules/touch/touch.c
r7afb4a5 r095003a8 81 81 82 82 for (i = 1; i < argc; i ++) { 83 buff = str dup(argv[i]);83 buff = str_dup(argv[i]); 84 84 dirp = opendir(buff); 85 85 if (dirp) { -
uspace/app/bdsh/exec.c
r7afb4a5 r095003a8 81 81 } 82 82 83 path_tok = str dup(PATH);83 path_tok = str_dup(PATH); 84 84 85 85 /* Extract the PATH env to a path[] array */ … … 115 115 char *tmp; 116 116 117 tmp = str dup(find_command(cmd));117 tmp = str_dup(find_command(cmd)); 118 118 free(found); 119 119 -
uspace/app/bdsh/input.c
r7afb4a5 r095003a8 62 62 return CL_EFAIL; 63 63 64 tmp = str dup(usr->line);64 tmp = str_dup(usr->line); 65 65 66 66 cmd[n] = strtok(tmp, " "); … … 156 156 if (str_cmp(line, "") == 0 || str_cmp(line, "\n") == 0) 157 157 return; 158 usr->line = str dup(line);158 usr->line = str_dup(line); 159 159 160 160 return; -
uspace/app/tetris/scores.c
r7afb4a5 r095003a8 132 132 moveto(10 , 10); 133 133 puts("Insert your name: "); 134 str ncpy(scores[NUMSPOTS - 1].hs_name, "Player", MAXLOGNAME);134 str_ncpy(scores[NUMSPOTS - 1].hs_name, "Player", MAXLOGNAME); 135 135 i = 6; off = 6; 136 136 … … 196 196 int i; 197 197 for(i = 0; i < NUMSPOTS; i++) { 198 str ncpy(scores[i].hs_name, "HelenOS Team", MAXLOGNAME);198 str_ncpy(scores[i].hs_name, "HelenOS Team", MAXLOGNAME); 199 199 scores[i].hs_score = (NUMSPOTS - i) * 200; 200 200 scores[i].hs_level = (i + 1 > MAXLEVEL?MAXLEVEL:i + 1); -
uspace/app/tetris/tetris.c
r7afb4a5 r095003a8 312 312 } 313 313 if (keys[i] == ' ') 314 str ncpy(key_write[i], "<space>", sizeof key_write[i]);314 str_ncpy(key_write[i], "<space>", sizeof key_write[i]); 315 315 else { 316 316 key_write[i][0] = keys[i]; -
uspace/lib/libc/generic/string.c
r7afb4a5 r095003a8 41 41 #include <errno.h> 42 42 #include <align.h> 43 #include <mem.h> 43 44 #include <string.h> 44 45 … … 807 808 } 808 809 809 char *strncpy(char *dest, const char *src, size_t n)810 {811 char *orig = dest;812 813 while ((*(dest++) = *(src++)) && --n)814 ;815 return orig;816 }817 818 810 char *strcat(char *dest, const char *src) 819 811 { … … 827 819 } 828 820 829 char * strdup(const char *s1)830 { 831 size_t len = str_size(s1) + 1;832 void * ret = malloc(len);833 834 if ( ret == NULL)821 char *str_dup(const char *src) 822 { 823 size_t size = str_size(src); 824 void *dest = malloc(size + 1); 825 826 if (dest == NULL) 835 827 return (char *) NULL; 836 828 837 return (char *) memcpy( ret, s1, len);829 return (char *) memcpy(dest, src, size + 1); 838 830 } 839 831 -
uspace/lib/libc/generic/vfs/vfs.c
r7afb4a5 r095003a8 100 100 * though they both point into the same dynamically allocated buffer. 101 101 */ 102 ncwd_path = str dup(ncwd_path);102 ncwd_path = str_dup(ncwd_path); 103 103 free(ncwd_path_nc); 104 104 if (!ncwd_path) { -
uspace/lib/libc/include/string.h
r7afb4a5 r095003a8 79 79 extern bool wstr_remove(wchar_t *str, count_t pos); 80 80 81 extern char *str_dup(const char *); 82 81 83 /* 82 84 * TODO: Get rid of this. … … 87 89 88 90 extern char *strcpy(char *, const char *); 89 extern char *strncpy(char *, const char *, size_t);90 91 91 extern char *strcat(char *, const char *); 92 93 extern char *strdup(const char *);94 92 95 93 extern long int strtol(const char *, char **, int);
Note:
See TracChangeset
for help on using the changeset viewer.