Lines Matching refs:buf
262 struct dirent *buf = NULL; in shell_cmd_ls() local
267 buf = readdir(dir); in shell_cmd_ls()
268 if (buf == NULL) in shell_cmd_ls()
272 if (buf->d_type == DT_DIR) in shell_cmd_ls()
274 else if (buf->d_type == DT_REG) in shell_cmd_ls()
276 else if (buf->d_type == DT_BLK || buf->d_type == DT_CHR) in shell_cmd_ls()
281 sprintf(output_buf, "%s ", buf->d_name); in shell_cmd_ls()
333 char *buf = (char *)malloc(512); in shell_cmd_cat() local
337 memset(buf, 0, 512); in shell_cmd_cat()
338 int l = read(fd, buf, 511); in shell_cmd_cat()
344 buf[l] = '\0'; in shell_cmd_cat()
347 printf("%s", buf); in shell_cmd_cat()
350 free(buf); in shell_cmd_cat()
616 int parse_command(char *buf, int *argc, char ***argv) in parse_command() argument
621 while (index < INPUT_BUFFER_SIZE && buf[index] == ' ') in parse_command()
624 if (!buf[index]) in parse_command()
631 if (!buf[i]) in parse_command()
633 if (buf[i] != ' ' && (buf[i + 1] == ' ' || buf[i + 1] == '\0')) in parse_command()
646 *((*argv) + i) = &buf[index]; in parse_command()
647 while (index < (INPUT_BUFFER_SIZE - 1) && buf[index] && buf[index] != ' ') in parse_command()
649 buf[index++] = '\0'; in parse_command()
652 while (index < INPUT_BUFFER_SIZE && buf[index] == ' ') in parse_command()