URI: 
       tRely on stat(2) rather than strchr - pm - barely a pack manager
  HTML git clone git://z3bra.org/pm
   DIR Log
   DIR Files
   DIR Refs
   DIR README
   DIR LICENSE
       ---
   DIR commit 2c89cf4793591b24f6ec0770250b931479972686
   DIR parent cf0441277b56ecaae38641dfe2bd5a2355617ac1
  HTML Author: z3bra <willyatmailoodotorg>
       Date:   Wed, 30 Dec 2015 17:15:37 +0100
       
       Rely on stat(2) rather than strchr
       
       stat(2) does a better job at checking if the given name is a
       file name, or a pack name. Let's just use it.
       
       Diffstat:
         M pm.c                                |      19 +++++++++++--------
       
       1 file changed, 11 insertions(+), 8 deletions(-)
       ---
   DIR diff --git a/pm.c b/pm.c
       t@@ -125,16 +125,18 @@ base_name(char *path)
        int
        inspect(char *name)
        {
       +        struct stat st;
       +
                /* name is NULL, list packages installed */
                if (!name)
                        return list_local(1, PACKAGE_DATA);
        
       -        /* if name contains a '/', assume it's an archive */
       -        if (strchr(name, '/'))
       -                return list_archive(1, name);
       +        /* if name isn't a filename, list installed files */
       +        if (stat(name, &st) < 0)
       +                return list_content(1, name);
        
       -        /* otherwise, list files installed by a package */
       -        return list_content(1, name);
       +        /* otherwise, list the content of the pack */
       +        return list_archive(1, name);
        }
        
        /*
       t@@ -504,12 +506,13 @@ struct pkg *
        pack_load(char *name)
        {
                struct pkg *p = NULL;
       +        struct stat st;
        
       -        if (strchr(name, '/'))
       -                p = pack_load_file(name);
       -        else
       +        if (stat(name, &st) < 0)
                        return NULL;
        
       +        p = pack_load_file(name);
       +
                if (!p) {
                        fprintf(stderr, "could not load package %s\n", name);
                        return NULL;