Skip to content

Commit

Permalink
Minor changes
Browse files Browse the repository at this point in the history
  • Loading branch information
vshan committed Feb 1, 2016
1 parent b08c390 commit 06423f7
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
Binary file added src/dash
Binary file not shown.
8 changes: 6 additions & 2 deletions src/sh/shell.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,12 @@ char *dash_read_line(void)
{
char *line = NULL;
ssize_t bufsize = 0; // have getline allocate a buffer for us
getline(&line, &bufsize, stdin);
int chars = getline(&line, &bufsize, stdin);
if ((line)[chars - 1] == '\n')
{
(line)[chars - 1] = '\0';
--chars;
}
return line;
}

Expand Down Expand Up @@ -71,7 +76,6 @@ char *dash_exec_scmd(char **tokens, int start, int fin, char *std_input)
char *std_output;
//validate_command(tokens, num);
dash_exec_t dash_cmd = create_exec_t(tokens, start, fin, std_input);

std_output = fork_pipe_exec(dash_cmd);

return std_output;
Expand Down
5 changes: 5 additions & 0 deletions src/util/util.c
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,11 @@ char **str_split(char *string, const char *delim, int *num_split)
end = strstr(end, delim);
}

if (end == NULL) {
substrings[0] = strdup(string);
num_sub_strings++;
}

while (end != NULL)
{
if (flag) {
Expand Down

0 comments on commit 06423f7

Please sign in to comment.