annotate libcommon/localcd.c @ 9:c9ef9e91dd8e

new libcommon, initial version
author Mychaela Falconia <falcon@freecalypso.org>
date Sun, 14 Mar 2021 06:55:38 +0000
parents
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
9
c9ef9e91dd8e new libcommon, initial version
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1 /*
c9ef9e91dd8e new libcommon, initial version
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
2 * This module implements the local cd command.
c9ef9e91dd8e new libcommon, initial version
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
3 */
c9ef9e91dd8e new libcommon, initial version
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
4
c9ef9e91dd8e new libcommon, initial version
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
5 #include <stdio.h>
c9ef9e91dd8e new libcommon, initial version
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
6 #include <stdlib.h>
c9ef9e91dd8e new libcommon, initial version
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
7 #include <unistd.h>
c9ef9e91dd8e new libcommon, initial version
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
8
c9ef9e91dd8e new libcommon, initial version
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
9 cmd_cd(argc, argv)
c9ef9e91dd8e new libcommon, initial version
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
10 char **argv;
c9ef9e91dd8e new libcommon, initial version
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
11 {
c9ef9e91dd8e new libcommon, initial version
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
12 int rc;
c9ef9e91dd8e new libcommon, initial version
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
13
c9ef9e91dd8e new libcommon, initial version
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
14 rc = chdir(argv[1]);
c9ef9e91dd8e new libcommon, initial version
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
15 if (rc < 0)
c9ef9e91dd8e new libcommon, initial version
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
16 perror(argv[1]);
c9ef9e91dd8e new libcommon, initial version
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
17 return rc;
c9ef9e91dd8e new libcommon, initial version
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
18 }