Beispiel #1
0
int		my_cd_2(char **tab3, int a)
{
  t_mini	mini;

  tab3[1][a + 1] = '/';
  if (chdir(tab3[1]) == -1)
    {
      if (access(tab3[1], F_OK) == -1)
	my_printf("\033[31mError : No such file or directory\n\033[37m");
      else
	my_printf("\033[31mError: Permission denied\n\033[37m");
    }
  show_cwd(mini);
  free(tab3[1]);
}
Beispiel #2
0
int
main(int argc, char **argv)
{
	int retc = 0;

	if ((command = strrchr(argv[0], '/')) != NULL)
		command++;
	else
		command = argv[0];

	if (argc <= 1) {
		(void) fprintf(stderr, "usage:\t%s pid ...\n", command);
		(void) fprintf(stderr, "  (show process working directory)\n");
	}

	while (--argc >= 1)
		retc += show_cwd(*++argv);

	return (retc);
}