Lines Matching refs:buf
251 struct dirent *buf = NULL; in shell_cmd_ls() local
256 buf = readdir(dir); in shell_cmd_ls()
257 if (buf == NULL) in shell_cmd_ls()
261 if (buf->d_type & VFS_IF_DIR) in shell_cmd_ls()
263 else if (buf->d_type & VFS_IF_FILE) in shell_cmd_ls()
265 else if (buf->d_type & VFS_IF_DEVICE) in shell_cmd_ls()
270 sprintf(output_buf, "%s ", buf->d_name); in shell_cmd_ls()
317 char *buf = (char *)malloc(512); in shell_cmd_cat() local
318 memset(buf, 0, 512); in shell_cmd_cat()
321 int l = read(fd, buf, 511); in shell_cmd_cat()
322 buf[l] = '\0'; in shell_cmd_cat()
325 printf("%s", buf); in shell_cmd_cat()
328 free(buf); in shell_cmd_cat()
595 int parse_command(char *buf, int *argc, char ***argv) in parse_command() argument
600 while (index < INPUT_BUFFER_SIZE && buf[index] == ' ') in parse_command()
607 if (!buf[i]) in parse_command()
609 if (buf[i] != ' ' && (buf[i + 1] == ' ' || buf[i + 1] == '\0')) in parse_command()
622 *((*argv) + i) = &buf[index]; in parse_command()
623 while (index < (INPUT_BUFFER_SIZE - 1) && buf[index] && buf[index] != ' ') in parse_command()
625 buf[index++] = '\0'; in parse_command()
628 while (index < INPUT_BUFFER_SIZE && buf[index] == ' ') in parse_command()