Changeset 1921

Show
Ignore:
Timestamp:
02/25/09 13:13:16 (3 years ago)
Author:
mwhitworth
Message:

Fix case where we printed out completions in /applications twice (when we are in /applications), set cwd to NULL.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • Whitix/trunk/user/burn/main.c

    r1920 r1921  
    274274char* CommandCompleter(struct ConsReadContext* context, char* string, int state) 
    275275{ 
    276         struct FileDirEnt* ent; 
     276        struct FileDirEnt* ent = NULL; 
    277277        struct FileDirEnt* cwdent; 
    278278        struct Stat stat; 
    279279        struct CmdTable* currCmd; 
    280          
     280                 
    281281        if (!state) 
    282282        { 
     
    290290        } 
    291291         
    292         while ( ( ent = FileDirNext(dir) ) ) 
    293         { 
    294                 if (ent->name[0] == '.') 
    295                         continue; 
    296                          
    297                 if (SysStat(ent->name, &stat, dir->fd)) 
    298                         continue; 
    299                          
    300                 /* Only files can be executed. */ 
    301                 if (!(stat.mode & _SYS_STAT_FILE)) 
    302                         continue; 
    303                          
    304                 if (!strncasecmp(string, ent->name, strlen(string))) 
    305                         goto out; 
     292//      printf("%s %s, %d\n", "/applications/", currPath, strcasecmp(currPath, "/applications/")); 
     293         
     294        if (strcasecmp(currPath, "/applications/")) 
     295        { 
     296                while ( ( ent = FileDirNext(dir) ) ) 
     297                { 
     298                        if (ent->name[0] == '.') 
     299                                continue; 
     300                         
     301                        if (SysStat(ent->name, &stat, dir->fd)) 
     302                                continue; 
     303                         
     304                        /* Only files can be executed. */ 
     305                        if (!(stat.mode & _SYS_STAT_FILE)) 
     306                                continue; 
     307                         
     308                        if (!strncasecmp(string, ent->name, strlen(string))) 
     309                                goto out; 
     310                } 
    306311        } 
    307312