Changeset 1c481ee in mainline for uspace/app/bdsh/util.c


Ignore:
Timestamp:
2019-03-09T15:40:05Z (5 years ago)
Author:
Matthieu Riolo <matthieu.riolo@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
587867a
Parents:
c56a3eb
git-author:
Matthieu Riolo <matthieu.riolo@…> (2019-03-02 15:55:07)
git-committer:
Matthieu Riolo <matthieu.riolo@…> (2019-03-09 15:40:05)
Message:

This commit fixes #684 and adds autocompletion for subdirectories in search_path. The original implementation of find_command()
will find cmd inside the working directory even without
the prefix './'. However, those cmds would have not been visible in
the auto completion. This commit prevents this from happening.

The problem can be traced back to vfs_absolutize() which treats paths
without the './' prefix as relative paths. The changes made unsures
that only relative or absolute pathes will be passed to vfs_absolutize()

This commit also fixes the problem, that subdirectories inside the
search_path would not be autocomplete. BDSH would execute such paths.
The reason being is that such paths was interpreted as relative paths.
Now BDSH makes a distinction between relatives paths or paths inside
search_path

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/app/bdsh/util.c

    rc56a3eb r1c481ee  
    7474        return 0;
    7575}
     76
     77/*
     78 * Returns true if the string is a relative or an absolute path
     79 */
     80bool is_path(const char *cmd)
     81{
     82
     83        bool ret = str_lcmp(cmd, "/", 1) == 0;
     84        ret = ret || str_lcmp(cmd, "./", 2) == 0;
     85        ret = ret || str_lcmp(cmd, "../", 3) == 0;
     86
     87        return ret;
     88}
Note: See TracChangeset for help on using the changeset viewer.