Changeset d96d9bc in mainline for uspace/app/bdsh/cmds


Ignore:
Timestamp:
2017-04-02T20:38:50Z (7 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
c23275a
Parents:
1e2e5795
Message:

Rename chdir() to vfs_cwd_set() and getcwd() to vfs_cwd_get()

Location:
uspace/app/bdsh/cmds
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • uspace/app/bdsh/cmds/builtins/cd/cd.c

    r1e2e5795 rd96d9bc  
    2929#include <stdio.h>
    3030#include <stdlib.h>
    31 #include <unistd.h>
    3231#include <str.h>
    3332#include <errno.h>
     33#include <vfs/vfs.h>
    3434
    3535#include "util.h"
     
    5151static bool previous_directory_set = false;
    5252
    53 static int chdir_and_remember(const char *new_dir) {
     53static int chdir_and_remember(const char *new_dir)
     54{
    5455
    55         char *ok = getcwd(previous_directory_tmp, PATH_MAX);
    56         previous_directory_valid = ok != NULL;
     56        int rc = vfs_cwd_get(previous_directory_tmp, PATH_MAX);
     57        previous_directory_valid = (rc == EOK);
    5758        previous_directory_set = true;
    5859
    59         if (chdir(new_dir) != 0)
    60                 return errno;
     60        rc = vfs_cwd_set(new_dir);
     61        if (rc != EOK)
     62                return rc;
    6163
    6264        str_cpy(previous_directory, PATH_MAX, previous_directory_tmp);
  • uspace/app/bdsh/cmds/modules/ls/ls.c

    r1e2e5795 rd96d9bc  
    3434#include <stdio.h>
    3535#include <stdlib.h>
    36 #include <unistd.h>
    3736#include <dirent.h>
    3837#include <getopt.h>
     
    387386
    388387        if (argc == 0) {
    389                 if (getcwd(de.name, PATH_MAX) == NULL) {
     388                if (vfs_cwd_get(de.name, PATH_MAX) != EOK) {
    390389                        cli_error(CL_EFAIL, "%s: Failed determining working "
    391390                            "directory", cmdname);
  • uspace/app/bdsh/cmds/modules/mkdir/mkdir.c

    r1e2e5795 rd96d9bc  
    208208
    209209        if (follow && (argv[optind] != NULL)) {
    210                 if (chdir(argv[optind]) != 0)
     210                if (vfs_cwd_set(argv[optind]) != EOK)
    211211                        printf("%s: Error switching to directory.", cmdname);
    212212        }
  • uspace/app/bdsh/cmds/modules/pwd/pwd.c

    r1e2e5795 rd96d9bc  
    3030#include <stdlib.h>
    3131#include <mem.h>
     32#include <vfs/vfs.h>
     33#include <abi/errno.h>
    3234
    3335#include "config.h"
     
    5759        memset(buff, 0, PATH_MAX);
    5860
    59         if (getcwd(buff, PATH_MAX) == NULL) {
     61        if (vfs_cwd_get(buff, PATH_MAX) != EOK) {
    6062                cli_error(CL_EFAIL,
    6163                        "Unable to determine the current working directory");
  • uspace/app/bdsh/cmds/modules/rm/rm.c

    r1e2e5795 rd96d9bc  
    3030#include <stdio.h>
    3131#include <stdlib.h>
    32 #include <unistd.h>
    3332#include <dirent.h>
    3433#include <getopt.h>
     
    110109        memset(rm->cwd, 0, PATH_MAX);
    111110
    112         chdir(".");
    113 
    114         if (NULL == (getcwd(rm->owd, PATH_MAX)))
     111        vfs_cwd_set(".");
     112
     113        if (EOK != vfs_cwd_get(rm->owd, PATH_MAX))
    115114                return 0;
    116115
Note: See TracChangeset for help on using the changeset viewer.