Changeset 92fd52d7 in mainline
- Timestamp:
- 2009-04-09T21:16:50Z (16 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 7afb4a5
- Parents:
- a2c58f6
- Location:
- uspace
- Files:
-
- 25 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/app/bdsh/cmds/builtin_cmds.c
ra2c58f6 r92fd52d7 50 50 51 51 for (cmd = builtins; cmd->name != NULL; cmd++, i++) { 52 if (!str cmp(cmd->name, command))52 if (!str_cmp(cmd->name, command)) 53 53 return i; 54 54 } … … 65 65 66 66 for(i=0; builtin_aliases[i] != NULL; i+=2) { 67 if (!str cmp(builtin_aliases[i], command))67 if (!str_cmp(builtin_aliases[i], command)) 68 68 return 1; 69 69 } … … 80 80 81 81 for(i=0; builtin_aliases[i] != NULL; i++) { 82 if (!str cmp(builtin_aliases[i], command))82 if (!str_cmp(builtin_aliases[i], command)) 83 83 return (char *)builtin_aliases[++i]; 84 84 i++; -
uspace/app/bdsh/cmds/mod_cmds.c
ra2c58f6 r92fd52d7 65 65 66 66 for (mod = modules; mod->name != NULL; mod++, i++) { 67 if (!str cmp(mod->name, command))67 if (!str_cmp(mod->name, command)) 68 68 return i; 69 69 } … … 82 82 83 83 for(i=0; mod_aliases[i] != NULL; i+=2) { 84 if (!str cmp(mod_aliases[i], command))84 if (!str_cmp(mod_aliases[i], command)) 85 85 return 1; 86 86 } … … 98 98 99 99 for(i=0; mod_aliases[i] != NULL; i++) { 100 if (!str cmp(mod_aliases[i], command))100 if (!str_cmp(mod_aliases[i], command)) 101 101 return (char *)mod_aliases[++i]; 102 102 i++; -
uspace/app/bdsh/cmds/modules/help/help.c
ra2c58f6 r92fd52d7 108 108 109 109 if (argc == 3) { 110 if (!str cmp("extended", argv[2]))110 if (!str_cmp("extended", argv[2])) 111 111 level = HELP_LONG; 112 112 else -
uspace/app/bdsh/cmds/modules/mkdir/mkdir.c
ra2c58f6 r92fd52d7 150 150 /* Sometimes make or scripts conjoin odd paths. Account for something 151 151 * like this: ../../foo/bar/../foo/foofoo/./bar */ 152 if (!str cmp(dirs[i], "..") || !strcmp(dirs[i], ".")) {152 if (!str_cmp(dirs[i], "..") || !str_cmp(dirs[i], ".")) { 153 153 if (0 != (chdir(dirs[i]))) { 154 154 cli_error(CL_EFAIL, "%s: impossible path: %s", -
uspace/app/bdsh/cmds/modules/rm/rm.c
ra2c58f6 r92fd52d7 217 217 i = optind; 218 218 while (NULL != argv[i]) { 219 len = str len(argv[i]) + 2;219 len = str_size(argv[i]) + 2; 220 220 buff = (char *) realloc(buff, len); 221 221 if (buff == NULL) { -
uspace/app/bdsh/exec.c
ra2c58f6 r92fd52d7 72 72 char *path[PATH_MAX]; 73 73 int n = 0, i = 0; 74 size_t x = str len(cmd) + 2;74 size_t x = str_size(cmd) + 2; 75 75 76 76 found = (char *)malloc(PATH_MAX); … … 86 86 path[n] = strtok(path_tok, PATH_DELIM); 87 87 while (NULL != path[n]) { 88 if ((str len(path[n]) + x ) > PATH_MAX) {88 if ((str_size(path[n]) + x ) > PATH_MAX) { 89 89 cli_error(CL_ENOTSUP, 90 90 "Segment %d of path is too large, search ends at segment %d", -
uspace/app/bdsh/input.c
ra2c58f6 r92fd52d7 147 147 { 148 148 char line[INPUT_MAX]; 149 size_t len = 0;150 149 151 150 console_set_style(STYLE_EMPHASIS); … … 154 153 155 154 read_line(line, INPUT_MAX); 156 len = strlen(line);157 155 /* Make sure we don't have rubbish or a C/R happy user */ 158 if ( len == 0 || line[0] == '\n')156 if (str_cmp(line, "") == 0 || str_cmp(line, "\n") == 0) 159 157 return; 160 158 usr->line = strdup(line); -
uspace/app/tester/devmap/devmap1.c
ra2c58f6 r92fd52d7 141 141 req = async_send_2(phone, DEVMAP_DRIVER_REGISTER, 0, 0, &answer); 142 142 143 retval = ipc_data_write_start(phone, (char *)name, str len(name) + 1);143 retval = ipc_data_write_start(phone, (char *)name, str_size(name) + 1); 144 144 145 145 if (retval != EOK) { … … 174 174 &answer); 175 175 176 retval = ipc_data_write_start(driver_phone, name, str len(name) + 1);176 retval = ipc_data_write_start(driver_phone, name, str_size(name) + 1); 177 177 178 178 if (retval != EOK) { … … 216 216 217 217 retval = ipc_data_write_start(driver_phone, (char *)name, 218 str len(name) + 1);218 str_size(name) + 1); 219 219 220 220 if (retval != EOK) { -
uspace/app/tetris/scores.c
ra2c58f6 r92fd52d7 290 290 /* me = thisuser(); */ 291 291 /* for (i = 0, sp = &scores[0]; i < nscores; i++, sp++) { */ 292 /* if (sp->hs_level != level || str cmp(sp->hs_name, me) != 0) */292 /* if (sp->hs_level != level || str_cmp(sp->hs_name, me) != 0) */ 293 293 /* continue; */ 294 294 /* if (score > sp->hs_score) { */ … … 418 418 /* *\/ */ 419 419 /* for (j = 0, pu = count; j < numnames; j++, pu++) */ 420 /* if (str cmp(sp->hs_name, pu->name) == 0) */420 /* if (str_cmp(sp->hs_name, pu->name) == 0) */ 421 421 /* break; */ 422 422 /* if (j == numnames) { */ … … 555 555 /* sp->hs_level == level && */ 556 556 /* sp->hs_score == score && */ 557 /* str cmp(sp->hs_name, me) == 0) { */557 /* str_cmp(sp->hs_name, me) == 0) { */ 558 558 /* putpad(SOstr); */ 559 559 /* highlight = 1; */ -
uspace/app/tetris/screen.c
ra2c58f6 r92fd52d7 281 281 { 282 282 283 int l = str len(s);283 int l = str_size(s); 284 284 285 285 moveto(Rows - 2, ((Cols - l) >> 1) - 1); -
uspace/app/tetris/tetris.c
ra2c58f6 r92fd52d7 278 278 /* break; */ 279 279 /* case 'k': */ 280 /* if (str len(keys = optarg) != 6) */280 /* if (str_size(keys = optarg) != 6) */ 281 281 /* usage(); */ 282 282 /* break; */ -
uspace/lib/libc/generic/console.c
ra2c58f6 r92fd52d7 220 220 ssize_t rc; 221 221 222 len = str len(s);222 len = str_size(s); 223 223 while (len > 0) { 224 224 rc = console_write(s, len); -
uspace/lib/libc/generic/getopt.c
ra2c58f6 r92fd52d7 383 383 has_equal++; 384 384 } else 385 current_argv_len = str len(current_argv);385 current_argv_len = str_size(current_argv); 386 386 387 387 for (i = 0; long_options[i].name; i++) { … … 391 391 continue; 392 392 393 if (str len(long_options[i].name) ==393 if (str_size(long_options[i].name) == 394 394 (unsigned)current_argv_len) { 395 395 /* exact match */ -
uspace/lib/libc/generic/string.c
ra2c58f6 r92fd52d7 607 607 } 608 608 609 /** Count the number of characters in the string, not including terminating 0.610 *611 * @param str String.612 * @return Number of characters in string.613 */614 size_t strlen(const char *str)615 {616 size_t counter = 0;617 618 while (str[counter] != 0)619 counter++;620 621 return counter;622 }623 624 int strcmp(const char *a, const char *b)625 {626 int c = 0;627 628 while (a[c] && b[c] && (!(a[c] - b[c])))629 c++;630 631 return (a[c] - b[c]);632 }633 634 609 int strncmp(const char *a, const char *b, size_t n) 635 610 { … … 871 846 char * strdup(const char *s1) 872 847 { 873 size_t len = str len(s1) + 1;848 size_t len = str_size(s1) + 1; 874 849 void *ret = malloc(len); 875 850 -
uspace/lib/libc/include/stdio.h
ra2c58f6 r92fd52d7 50 50 n = snprintf(buf, sizeof(buf), fmt, ##__VA_ARGS__); \ 51 51 if (n > 0) \ 52 (void) __SYSCALL3(SYS_KLOG, 1, (sysarg_t) buf, str len(buf)); \52 (void) __SYSCALL3(SYS_KLOG, 1, (sysarg_t) buf, str_size(buf)); \ 53 53 } 54 54 -
uspace/lib/libc/include/string.h
ra2c58f6 r92fd52d7 46 46 #define STR_NO_LIMIT ((size_t) -1) 47 47 48 /**< Maximum size of a string containing cntcharacters */49 #define STR_BOUNDS( cnt) (cnt<< 2)48 /**< Maximum size of a string containing @c length characters */ 49 #define STR_BOUNDS(length) ((length) << 2) 50 50 51 51 extern wchar_t str_decode(const char *str, size_t *offset, size_t sz); … … 82 82 */ 83 83 84 extern int strcmp(const char *, const char *);85 84 extern int strncmp(const char *, const char *, size_t); 86 85 extern int stricmp(const char *, const char *); … … 90 89 91 90 extern char *strcat(char *, const char *); 92 93 extern size_t strlen(const char *);94 91 95 92 extern char *strdup(const char *); -
uspace/srv/devmap/devmap.c
ra2c58f6 r92fd52d7 564 564 ipc_answer_0(iid, EOK); 565 565 566 size_t name_size = str len(device->name);566 size_t name_size = str_size(device->name); 567 567 568 568 /* FIXME: -
uspace/srv/fs/fat/fat_dentry.c
ra2c58f6 r92fd52d7 63 63 { 64 64 int rc; 65 size_t size; 66 65 67 if (!(rc = stricmp(name, component))) 66 68 return rc; … … 70 72 * space for appending an extra '.' to name. 71 73 */ 72 name[strlen(name)] = '.'; 73 name[strlen(name) + 1] = '\0'; 74 size = str_size(name); 75 name[size] = '.'; 76 name[size + 1] = '\0'; 74 77 rc = stricmp(name, component); 75 78 } -
uspace/srv/fs/fat/fat_ops.c
ra2c58f6 r92fd52d7 488 488 d = (fat_dentry_t *)b->data; 489 489 if (fat_classify_dentry(d) == FAT_DENTRY_LAST || 490 str cmp(d->name, FAT_NAME_DOT) == 0) {490 str_cmp(d->name, FAT_NAME_DOT) == 0) { 491 491 memset(d, 0, sizeof(fat_dentry_t)); 492 492 strcpy(d->name, FAT_NAME_DOT); … … 498 498 d++; 499 499 if (fat_classify_dentry(d) == FAT_DENTRY_LAST || 500 str cmp(d->name, FAT_NAME_DOT_DOT) == 0) {500 str_cmp(d->name, FAT_NAME_DOT_DOT) == 0) { 501 501 memset(d, 0, sizeof(fat_dentry_t)); 502 502 strcpy(d->name, FAT_NAME_DOT_DOT); … … 938 938 return; 939 939 hit: 940 (void) ipc_data_read_finalize(callid, name, str len(name) + 1);940 (void) ipc_data_read_finalize(callid, name, str_size(name) + 1); 941 941 bytes = (pos - spos) + 1; 942 942 } -
uspace/srv/fs/tmpfs/tmpfs_dump.c
ra2c58f6 r92fd52d7 178 178 179 179 tag[5] = 0; 180 if (str cmp(tag, "TMPFS") != 0)180 if (str_cmp(tag, "TMPFS") != 0) 181 181 goto error; 182 182 -
uspace/srv/fs/tmpfs/tmpfs_ops.c
ra2c58f6 r92fd52d7 256 256 assert(hlp); 257 257 tmpfs_name_t *namep = hash_table_get_instance(hlp, tmpfs_name_t, link); 258 return !str cmp(namep->name, component);258 return !str_cmp(namep->name, component); 259 259 } 260 260 … … 320 320 return ENOMEM; 321 321 tmpfs_name_initialize(namep); 322 size_t len = strlen(nm);323 namep->name = malloc( len+ 1);322 size_t size = str_size(nm); 323 namep->name = malloc(size + 1); 324 324 if (!namep->name) { 325 325 free(namep); … … 455 455 */ 456 456 ipc_callid_t callid; 457 size_t len;458 if (!ipc_data_read_receive(&callid, & len)) {457 size_t size; 458 if (!ipc_data_read_receive(&callid, &size)) { 459 459 ipc_answer_0(callid, EINVAL); 460 460 ipc_answer_0(rid, EINVAL); … … 464 464 size_t bytes; 465 465 if (dentry->type == TMPFS_FILE) { 466 bytes = max(0, min(dentry->size - pos, len));466 bytes = max(0, min(dentry->size - pos, size)); 467 467 (void) ipc_data_read_finalize(callid, dentry->data + pos, 468 468 bytes); … … 495 495 496 496 (void) ipc_data_read_finalize(callid, namep->name, 497 str len(namep->name) + 1);497 str_size(namep->name) + 1); 498 498 bytes = 1; 499 499 } … … 528 528 */ 529 529 ipc_callid_t callid; 530 size_t len;531 if (!ipc_data_write_receive(&callid, & len)) {530 size_t size; 531 if (!ipc_data_write_receive(&callid, &size)) { 532 532 ipc_answer_0(callid, EINVAL); 533 533 ipc_answer_0(rid, EINVAL); … … 538 538 * Check whether the file needs to grow. 539 539 */ 540 if (pos + len<= dentry->size) {540 if (pos + size <= dentry->size) { 541 541 /* The file size is not changing. */ 542 (void) ipc_data_write_finalize(callid, dentry->data + pos, len);543 ipc_answer_2(rid, EOK, len, dentry->size);544 return; 545 } 546 size_t delta = (pos + len) - dentry->size;542 (void) ipc_data_write_finalize(callid, dentry->data + pos, size); 543 ipc_answer_2(rid, EOK, size, dentry->size); 544 return; 545 } 546 size_t delta = (pos + size) - dentry->size; 547 547 /* 548 548 * At this point, we are deliberately extremely straightforward and … … 562 562 dentry->size += delta; 563 563 dentry->data = newdata; 564 (void) ipc_data_write_finalize(callid, dentry->data + pos, len);565 ipc_answer_2(rid, EOK, len, dentry->size);564 (void) ipc_data_write_finalize(callid, dentry->data + pos, size); 565 ipc_answer_2(rid, EOK, size, dentry->size); 566 566 } 567 567 -
uspace/srv/loader/main.c
ra2c58f6 r92fd52d7 151 151 { 152 152 ipc_callid_t callid; 153 size_t buf_ len, arg_len;153 size_t buf_size, arg_size; 154 154 char *p; 155 155 int n; 156 156 157 if (!ipc_data_write_receive(&callid, &buf_ len)) {157 if (!ipc_data_write_receive(&callid, &buf_size)) { 158 158 ipc_answer_0(callid, EINVAL); 159 159 ipc_answer_0(rid, EINVAL); … … 171 171 } 172 172 173 arg_buf = malloc(buf_ len+ 1);173 arg_buf = malloc(buf_size + 1); 174 174 if (!arg_buf) { 175 175 ipc_answer_0(callid, ENOMEM); … … 178 178 } 179 179 180 ipc_data_write_finalize(callid, arg_buf, buf_ len);181 182 arg_buf[buf_ len] = '\0';180 ipc_data_write_finalize(callid, arg_buf, buf_size); 181 182 arg_buf[buf_size] = '\0'; 183 183 184 184 /* … … 187 187 p = arg_buf; 188 188 n = 0; 189 while (p < arg_buf + buf_ len) {190 arg_ len = strlen(p);191 p = p + arg_ len+ 1;189 while (p < arg_buf + buf_size) { 190 arg_size = str_size(p); 191 p = p + arg_size + 1; 192 192 ++n; 193 193 } … … 207 207 p = arg_buf; 208 208 n = 0; 209 while (p < arg_buf + buf_ len) {209 while (p < arg_buf + buf_size) { 210 210 argv[n] = p; 211 211 212 arg_ len = strlen(p);213 p = p + arg_ len+ 1;212 arg_size = str_size(p); 213 p = p + arg_size + 1; 214 214 ++n; 215 215 } -
uspace/srv/pci/libpci/names.c
ra2c58f6 r92fd52d7 104 104 unsigned int h = id_hash(cat, id12, id34); 105 105 struct id_entry *n = a->id_hash[h]; 106 int len = str len((char *) text);106 int len = str_size((char *) text); 107 107 108 108 while (n && (n->id12 != id12 || n->id34 != id34 || n->cat != cat)) -
uspace/srv/rd/rd.c
ra2c58f6 r92fd52d7 197 197 req = async_send_2(phone, DEVMAP_DRIVER_REGISTER, 0, 0, &answer); 198 198 199 retval = ipc_data_write_start(phone, (char *) name, str len(name) + 1);199 retval = ipc_data_write_start(phone, (char *) name, str_size(name) + 1); 200 200 201 201 if (retval != EOK) { … … 220 220 req = async_send_2(driver_phone, DEVMAP_DEVICE_REGISTER, 0, 0, &answer); 221 221 222 retval = ipc_data_write_start(driver_phone, (char *) name, strlen(name) + 1); 222 retval = ipc_data_write_start(driver_phone, (char *) name, 223 str_size(name) + 1); 223 224 224 225 if (retval != EOK) { -
uspace/srv/vfs/vfs_ops.c
ra2c58f6 r92fd52d7 92 92 /* We already have the root FS. */ 93 93 rwlock_write_lock(&namespace_rwlock); 94 if ( (strlen(mp) == 1) && (mp[0] == '/')) {94 if (str_cmp(mp, "/") == 0) { 95 95 /* Trying to mount root FS over root FS */ 96 96 rwlock_write_unlock(&namespace_rwlock); … … 125 125 } else { 126 126 /* We still don't have the root file system mounted. */ 127 if ( (strlen(mp) == 1) && (mp[0] == '/')) {127 if (str_cmp(mp, "/") == 0) { 128 128 vfs_lookup_res_t mr_res; 129 129 vfs_node_t *mr_node;
Note:
See TracChangeset
for help on using the changeset viewer.