Skip to content

Commit

Permalink
for now Linux will only print the cmd to terminal
Browse files Browse the repository at this point in the history
  • Loading branch information
SerhiiStets committed Nov 27, 2022
1 parent efc4e3a commit 6146d1e
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions commands/cd.c
Original file line number Diff line number Diff line change
Expand Up @@ -101,21 +101,22 @@ int cmd_cd(int argc, const char **argv)
cd_command[1] = '\0';
strncat(cd_command, and_cmd, strlen(and_cmd) + 1);
strncat(cd_command, buffer, strlen(buffer) + 1);
#endif
#ifdef linux
/* TODO: Linux clipboard if possible */
char *cd_command = malloc(strlen(buffer) + 1 + 4);
strncpy(cd_command, "cd ", 4);
#endif

/* Adding genereted command to the clipboard */
status = add_to_clipboard(cd_command);

if (status)
fprintf(stdout, "The command <%s> is copied to your clipboard.\
\nUse Ctr+V to get the command.\n\n",
cd_command);
else
fprintf(stdout, "%s: There was an error with adding %s command to clipboard.\n\n", CLI_NAME, cd_command);
#endif
#ifdef linux
/* TODO: Linux clipboard if possible */
char *cd_command = malloc(strlen(buffer) + 1 + 4);
strncpy(cd_command, "cd ", 4);
fprintf(stdout, "%s\n\n", cd_command);
#endif

free(cd_command);
return 1;
Expand Down

0 comments on commit 6146d1e

Please sign in to comment.