/branches/network/uspace/app/bdsh/input.c |
---|
61,7 → 61,7 |
if (NULL == usr->line) |
return CL_EFAIL; |
tmp = str_dup(usr->line); |
tmp = strdup(usr->line); |
cmd[n] = strtok(tmp, " "); |
while (cmd[n] && n < WORD_MAX) { |
146,6 → 146,7 |
void get_input(cliuser_t *usr) |
{ |
char line[INPUT_MAX]; |
size_t len = 0; |
console_set_style(STYLE_EMPHASIS); |
printf("%s", usr->prompt); |
152,10 → 153,11 |
console_set_style(STYLE_NORMAL); |
read_line(line, INPUT_MAX); |
len = strlen(line); |
/* Make sure we don't have rubbish or a C/R happy user */ |
if (str_cmp(line, "") == 0 || str_cmp(line, "\n") == 0) |
if (len == 0 || line[0] == '\n') |
return; |
usr->line = str_dup(line); |
usr->line = strdup(line); |
return; |
} |
/branches/network/uspace/app/bdsh/cmds/modules/touch/touch.c |
---|
80,7 → 80,7 |
} |
for (i = 1; i < argc; i ++) { |
buff = str_dup(argv[i]); |
buff = strdup(argv[i]); |
dirp = opendir(buff); |
if (dirp) { |
cli_error(CL_ENOTSUP, "%s is a directory", buff); |
/branches/network/uspace/app/bdsh/cmds/modules/mkdir/mkdir.c |
---|
93,7 → 93,7 |
/* Its a good idea to allocate path, plus we (may) need a copy of |
* path to tokenize if parents are specified */ |
if (NULL == (tmp = str_dup(path))) { |
if (NULL == (tmp = strdup(path))) { |
cli_error(CL_ENOMEM, "%s: path too big?", cmdname); |
return 1; |
} |
149,7 → 149,7 |
while (dirs[i] != NULL) { |
/* Sometimes make or scripts conjoin odd paths. Account for something |
* like this: ../../foo/bar/../foo/foofoo/./bar */ |
if (!str_cmp(dirs[i], "..") || !str_cmp(dirs[i], ".")) { |
if (!strcmp(dirs[i], "..") || !strcmp(dirs[i], ".")) { |
if (0 != (chdir(dirs[i]))) { |
cli_error(CL_EFAIL, "%s: impossible path: %s", |
cmdname, path); |
/branches/network/uspace/app/bdsh/cmds/modules/help/help.c |
---|
107,7 → 107,7 |
} |
if (argc == 3) { |
if (!str_cmp("extended", argv[2])) |
if (!strcmp("extended", argv[2])) |
level = HELP_LONG; |
else |
level = HELP_SHORT; |
/branches/network/uspace/app/bdsh/cmds/modules/ls/ls.c |
---|
182,7 → 182,7 |
if (argc == 1) |
getcwd(buff, PATH_MAX); |
else |
str_cpy(buff, PATH_MAX, argv[1]); |
strncpy(buff, argv[1], PATH_MAX); |
scope = ls_scope(buff); |
/branches/network/uspace/app/bdsh/cmds/modules/rm/rm.c |
---|
216,7 → 216,7 |
i = optind; |
while (NULL != argv[i]) { |
len = str_size(argv[i]) + 2; |
len = strlen(argv[i]) + 2; |
buff = (char *) realloc(buff, len); |
if (buff == NULL) { |
printf("rm: out of memory\n"); |
/branches/network/uspace/app/bdsh/cmds/mod_cmds.c |
---|
64,7 → 64,7 |
return -2; |
for (mod = modules; mod->name != NULL; mod++, i++) { |
if (!str_cmp(mod->name, command)) |
if (!strcmp(mod->name, command)) |
return i; |
} |
81,7 → 81,7 |
return -1; |
for(i=0; mod_aliases[i] != NULL; i+=2) { |
if (!str_cmp(mod_aliases[i], command)) |
if (!strcmp(mod_aliases[i], command)) |
return 1; |
} |
97,7 → 97,7 |
return (char *)NULL; |
for(i=0; mod_aliases[i] != NULL; i++) { |
if (!str_cmp(mod_aliases[i], command)) |
if (!strcmp(mod_aliases[i], command)) |
return (char *)mod_aliases[++i]; |
i++; |
} |
/branches/network/uspace/app/bdsh/cmds/builtin_cmds.c |
---|
49,7 → 49,7 |
return -2; |
for (cmd = builtins; cmd->name != NULL; cmd++, i++) { |
if (!str_cmp(cmd->name, command)) |
if (!strcmp(cmd->name, command)) |
return i; |
} |
64,7 → 64,7 |
return -1; |
for(i=0; builtin_aliases[i] != NULL; i+=2) { |
if (!str_cmp(builtin_aliases[i], command)) |
if (!strcmp(builtin_aliases[i], command)) |
return 1; |
} |
79,7 → 79,7 |
return (char *)NULL; |
for(i=0; builtin_aliases[i] != NULL; i++) { |
if (!str_cmp(builtin_aliases[i], command)) |
if (!strcmp(builtin_aliases[i], command)) |
return (char *)builtin_aliases[++i]; |
i++; |
} |
/branches/network/uspace/app/bdsh/exec.c |
---|
71,7 → 71,7 |
char *path_tok; |
char *path[PATH_MAX]; |
int n = 0, i = 0; |
size_t x = str_size(cmd) + 2; |
size_t x = strlen(cmd) + 2; |
found = (char *)malloc(PATH_MAX); |
80,12 → 80,12 |
return (char *) cmd; |
} |
path_tok = str_dup(PATH); |
path_tok = strdup(PATH); |
/* Extract the PATH env to a path[] array */ |
path[n] = strtok(path_tok, PATH_DELIM); |
while (NULL != path[n]) { |
if ((str_size(path[n]) + x ) > PATH_MAX) { |
if ((strlen(path[n]) + x ) > PATH_MAX) { |
cli_error(CL_ENOTSUP, |
"Segment %d of path is too large, search ends at segment %d", |
n, n-1); |
114,7 → 114,7 |
task_id_t tid; |
char *tmp; |
tmp = str_dup(find_command(cmd)); |
tmp = strdup(find_command(cmd)); |
free(found); |
tid = task_spawn((const char *)tmp, argv); |
/branches/network/uspace/app/init/init.c |
---|
45,7 → 45,6 |
#include <malloc.h> |
#include <macros.h> |
#include <console.h> |
#include <string.h> |
#include "init.h" |
#include "version.h" |
52,13 → 51,9 |
static bool mount_fs(const char *fstype) |
{ |
int rc = -1; |
char *opts = ""; |
if (str_cmp(fstype, "tmpfs") == 0) |
opts = "restore"; |
while (rc < 0) { |
rc = mount(fstype, "/", "initrd", opts, IPC_FLAG_BLOCKING); |
rc = mount(fstype, "/", "initrd", IPC_FLAG_BLOCKING); |
switch (rc) { |
case EOK: |
88,8 → 83,12 |
argv[0] = fname; |
argv[1] = NULL; |
if (!task_spawn(fname, argv)) |
if (task_spawn(fname, argv)) { |
/* Add reasonable delay to avoid intermixed klog output. */ |
usleep(10000); |
} else { |
printf(NAME ": Error spawning %s\n", fname); |
} |
} |
int main(int argc, char *argv[]) |
/branches/network/uspace/app/tester/devmap/devmap1.c |
---|
140,7 → 140,7 |
req = async_send_2(phone, DEVMAP_DRIVER_REGISTER, 0, 0, &answer); |
retval = ipc_data_write_start(phone, (char *)name, str_size(name) + 1); |
retval = ipc_data_write_start(phone, (char *)name, strlen(name) + 1); |
if (retval != EOK) { |
async_wait_for(req, NULL); |
173,7 → 173,7 |
req = async_send_2(driver_phone, DEVMAP_DEVICE_GET_HANDLE, 0, 0, |
&answer); |
retval = ipc_data_write_start(driver_phone, name, str_size(name) + 1); |
retval = ipc_data_write_start(driver_phone, name, strlen(name) + 1); |
if (retval != EOK) { |
printf("Failed to send device name '%s'.\n", name); |
215,7 → 215,7 |
req = async_send_2(driver_phone, DEVMAP_DEVICE_REGISTER, 0, 0, &answer); |
retval = ipc_data_write_start(driver_phone, (char *)name, |
str_size(name) + 1); |
strlen(name) + 1); |
if (retval != EOK) { |
printf("Failed to send device name '%s'.\n", name); |
/branches/network/uspace/app/tester/vfs/vfs1.c |
---|
45,7 → 45,7 |
{ |
int rc; |
rc = mount("tmpfs", "/", "nulldev0", "", 0); |
rc = mount("tmpfs", "/", "nulldev0", 0); |
switch (rc) { |
case EOK: |
if (!quiet) |
/branches/network/uspace/app/tetris/scores.c |
---|
117,8 → 117,7 |
*/ |
static void copyhiscore(int dest, int src) |
{ |
str_cpy(scores[dest].hs_name, STR_BOUNDS(MAXLOGNAME) + 1, |
scores[src].hs_name); |
strcpy(scores[dest].hs_name, scores[src].hs_name); |
scores[dest].hs_score = scores[src].hs_score; |
scores[dest].hs_level = scores[src].hs_level; |
} |
132,8 → 131,7 |
clear_screen(); |
moveto(10 , 10); |
puts("Insert your name: "); |
str_cpy(scores[NUMSPOTS - 1].hs_name, STR_BOUNDS(MAXLOGNAME) + 1, |
"Player"); |
strncpy(scores[NUMSPOTS - 1].hs_name, "Player", MAXLOGNAME); |
i = 6; off = 6; |
moveto(10 , 28); |
197,7 → 195,7 |
{ |
int i; |
for(i = 0; i < NUMSPOTS; i++) { |
str_cpy(scores[i].hs_name, STR_BOUNDS(MAXLOGNAME) + 1, "HelenOS Team"); |
strncpy(scores[i].hs_name, "HelenOS Team", MAXLOGNAME); |
scores[i].hs_score = (NUMSPOTS - i) * 200; |
scores[i].hs_level = (i + 1 > MAXLEVEL?MAXLEVEL:i + 1); |
} |
291,7 → 289,7 |
/* change = 0; */ |
/* me = thisuser(); */ |
/* for (i = 0, sp = &scores[0]; i < nscores; i++, sp++) { */ |
/* if (sp->hs_level != level || str_cmp(sp->hs_name, me) != 0) */ |
/* if (sp->hs_level != level || strcmp(sp->hs_name, me) != 0) */ |
/* continue; */ |
/* if (score > sp->hs_score) { */ |
/* (void)printf("%s bettered %s %d score of %d!\n", */ |
419,7 → 417,7 |
/* * This is O(n^2), but do you think we care? */ |
/* *\/ */ |
/* for (j = 0, pu = count; j < numnames; j++, pu++) */ |
/* if (str_cmp(sp->hs_name, pu->name) == 0) */ |
/* if (strcmp(sp->hs_name, pu->name) == 0) */ |
/* break; */ |
/* if (j == numnames) { */ |
/* /\* */ |
556,7 → 554,7 |
/* if (me != NULL && */ |
/* sp->hs_level == level && */ |
/* sp->hs_score == score && */ |
/* str_cmp(sp->hs_name, me) == 0) { */ |
/* strcmp(sp->hs_name, me) == 0) { */ |
/* putpad(SOstr); */ |
/* highlight = 1; */ |
/* } */ |
/branches/network/uspace/app/tetris/input.c |
---|
115,7 → 115,7 |
if (!lastchar) { |
again: |
if (!getchar_inprog) { |
cons_phone = console_open(true); |
cons_phone = console_phone_get(true); |
getchar_inprog = async_send_2(cons_phone, |
CONSOLE_GETKEY, 0, 0, &charcall); |
} |
/branches/network/uspace/app/tetris/screen.c |
---|
280,7 → 280,7 |
scr_msg(char *s, int set) |
{ |
int l = str_size(s); |
int l = strlen(s); |
moveto(Rows - 2, ((Cols - l) >> 1) - 1); |
if (set) |
/branches/network/uspace/app/tetris/tetris.c |
---|
277,7 → 277,7 |
/* classic = 1; */ |
/* break; */ |
/* case 'k': */ |
/* if (str_size(keys = optarg) != 6) */ |
/* if (strlen(keys = optarg) != 6) */ |
/* usage(); */ |
/* break; */ |
/* case 'l': */ |
311,7 → 311,7 |
errx(1, "duplicate command keys specified."); |
} |
if (keys[i] == ' ') |
str_cpy(key_write[i], sizeof key_write[i], "<space>"); |
strncpy(key_write[i], "<space>", sizeof key_write[i]); |
else { |
key_write[i][0] = keys[i]; |
key_write[i][1] = '\0'; |