tmerge - plan9port - [fork] Plan 9 from user space
 (HTM) git clone git://src.adamsgaard.dk/plan9port
 (DIR) Log
 (DIR) Files
 (DIR) Refs
 (DIR) README
 (DIR) LICENSE
       ---
 (DIR) commit ebda53e16b473c6ad8df070edd6f58e2e1e10994
 (DIR) parent 841d71b5c6be4851572a60c5a9f9dd239ea69e56
 (HTM) Author: Russ Cox <rsc@swtch.com>
       Date:   Wed, 22 Aug 2007 09:00:26 -0400
       
       merge
       
       Diffstat:
         M man/man1/dict.1                     |       6 ++++++
         M src/cmd/9pfuse/fuse.c               |       4 +++-
         M src/cmd/dict/dict.c                 |      29 +++++++++++++++++++++++++----
         M src/cmd/dict/dict.h                 |       1 +
         M src/cmd/dict/robert.c               |      10 +++++-----
         M src/cmd/dict/utils.c                |     122 ++++++++++++++++----------------
       
       6 files changed, 101 insertions(+), 71 deletions(-)
       ---
 (DIR) diff --git a/man/man1/dict.1 b/man/man1/dict.1
       t@@ -146,6 +146,12 @@ the default command is
        .BR p .
        Otherwise, the default command is the previous command.
        .PP
       +.I Dict
       +searches for dictionaries in the directory named by
       +.B $dictpath 
       +(default
       +.BR \*9/dict ).
       +.PP
        .I Adict
        is a dictionary browser for
        .IR acme (1).
 (DIR) diff --git a/src/cmd/9pfuse/fuse.c b/src/cmd/9pfuse/fuse.c
       t@@ -803,7 +803,9 @@ mountfuse(char *mtpt)
                        if(access(f="/System/Library/Extensions/fusefs.kext"
                                "/Contents/Resources/load_fusefs", 0) < 0 &&
                           access(f="/Library/Extensions/fusefs.kext"
       -                           "/Contents/Resources/load_fusefs", 0) < 0){
       +                           "/Contents/Resources/load_fusefs", 0) < 0 &&
       +                   access(f="/System/Library/Filesystems"
       +                         "/fusefs.fs/Support/load_fusefs", 0) < 0){
                                   werrstr("cannot find load_fusefs");
                                   return -1;
                        }
 (DIR) diff --git a/src/cmd/dict/dict.c b/src/cmd/dict/dict.c
       t@@ -68,7 +68,7 @@ main(int argc, char **argv)
                dict = 0;
        
                for(i=0; dicts[i].name; i++){
       -                if(access(unsharp(dicts[i].path), 0)>=0 && access(unsharp(dicts[i].indexpath), 0)>=0){
       +                if(access(dictfile(dicts[i].path), 0)>=0 && access(dictfile(dicts[i].indexpath), 0)>=0){
                                dict = &dicts[i];
                                break;
                        }
       t@@ -119,8 +119,8 @@ main(int argc, char **argv)
                        line = malloc(strlen(p)+5);
                        sprint(line, "/%s/P\n", p);
                }
       -        dict->path = unsharp(dict->path);
       -        dict->indexpath = unsharp(dict->indexpath);
       +        dict->path = dictfile(dict->path);
       +        dict->indexpath = dictfile(dict->indexpath);
                bdict = Bopen(dict->path, OREAD);
                if(!bdict) {
                        err("can't open dictionary %s", dict->path);
       t@@ -171,7 +171,7 @@ usage(void)
                Bprint(bout, "dictionaries (brackets mark dictionaries not present on this system):\n");
                for(i = 0; dicts[i].name; i++){
                        a = b = "";
       -                if(access(unsharp(dicts[i].path), 0)<0 || access(unsharp(dicts[i].indexpath), 0)<0){
       +                if(access(dictfile(dicts[i].path), 0)<0 || access(dictfile(dicts[i].indexpath), 0)<0){
                                a = "[";
                                b = "]";
                        }
       t@@ -675,3 +675,24 @@ setdotprev(void)
                dot->n = 1;
                dot->cur = 0;
        }
       +
       +/*
       + * find the specified file and return a path.
       + * default location is #9/dict, but can be 
       + * in $dictdir instead.
       + */
       +char*
       +dictfile(char *f)
       +{
       +        static char *dict;
       +        static int did;
       +        
       +        if(!did){
       +                dict = getenv("dictpath");
       +                did = 1;
       +        }
       +        
       +        if(dict)
       +                return smprint("%s/%s", dict, f);
       +        return unsharp(smprint("#9/dict/%s", f));
       +}
 (DIR) diff --git a/src/cmd/dict/dict.h b/src/cmd/dict/dict.h
       t@@ -115,6 +115,7 @@ void        outnl(int);
        void        outpiece(char *, char *);
        void        runescpy(Rune*, Rune*);
        long        runetol(Rune*);
       +char        *dictfile(char*);
        
        long        oednextoff(long);
        void        oedprintentry(Entry, int);
 (DIR) diff --git a/src/cmd/dict/robert.c b/src/cmd/dict/robert.c
       t@@ -84,10 +84,10 @@ initsubtab(void)
        #define        GSHORT(p)        (((p)[0]<<8) | (p)[1])
        #define        GLONG(p)        (((p)[0]<<24) | ((p)[1]<<16) | ((p)[2]<<8) | (p)[3])
        
       -static char        cfile[] = "#9/dict/robert/cits.rob";
       -static char        dfile[] = "#9/dict/robert/defs.rob";
       -static char        efile[] = "#9/dict/robert/etym.rob";
       -static char        kfile[] = "#9/dict/robert/_phon";
       +static char        cfile[] = "robert/cits.rob";
       +static char        dfile[] = "robert/defs.rob";
       +static char        efile[] = "robert/etym.rob";
       +static char        kfile[] = "robert/_phon";
        
        static Biobuf *        cb;
        static Biobuf *        db;
       t@@ -316,7 +316,7 @@ Bouvrir(char *fichier)
        {
                Biobuf *db;
        
       -        fichier = unsharp(fichier);
       +        fichier = dictfile(fichier);
                db = Bopen(fichier, OREAD);
                if(db == 0){
                        fprint(2, "%s: impossible d'ouvrir %s: %r\n", argv0, fichier);
 (DIR) diff --git a/src/cmd/dict/utils.c b/src/cmd/dict/utils.c
       t@@ -5,163 +5,163 @@
        
        Dict dicts[] = {
                {"oed",                "Oxford English Dictionary, 2nd Ed.",
       -         "#9/dict/oed2",        "#9/dict/oed2index",
       +         "oed2",        "oed2index",
                 oednextoff,        oedprintentry,                oedprintkey},
                {"ahd",                "American Heritage Dictionary, 2nd College Ed.",
       -         "#9/dict/ahd/DICT.DB",        "#9/dict/ahd/index",
       +         "ahd/DICT.DB",        "ahd/index",
                 ahdnextoff,        ahdprintentry,                ahdprintkey},
                {"pgw",                "Project Gutenberg Webster Dictionary",
       -         "#9/dict/pgw",        "#9/dict/pgwindex",
       +         "pgw",        "pgwindex",
                 pgwnextoff,        pgwprintentry,                pgwprintkey},
                {"thesaurus",        "Collins Thesaurus",
       -         "#9/dict/thesaurus",        "#9/dict/thesindex",
       +         "thesaurus",        "thesindex",
                 thesnextoff,        thesprintentry,        thesprintkey},
                {"roget",                "Project Gutenberg Roget's Thesaurus",
       -         "#9/dict/roget", "#9/dict/rogetindex",
       +         "roget", "rogetindex",
                 rogetnextoff,        rogetprintentry,        rogetprintkey},
        
                {"ce",                "Gendai Chinese->English",
       -         "#9/dict/world/sansdata/sandic24.dat",
       -         "#9/dict/world/sansdata/ceindex",
       +         "world/sansdata/sandic24.dat",
       +         "world/sansdata/ceindex",
                 worldnextoff,        worldprintentry,        worldprintkey},
                {"ceh",                "Gendai Chinese->English (Hanzi index)",
       -         "#9/dict/world/sansdata/sandic24.dat",
       -         "#9/dict/world/sansdata/cehindex",
       +         "world/sansdata/sandic24.dat",
       +         "world/sansdata/cehindex",
                 worldnextoff,        worldprintentry,        worldprintkey},
                {"ec",                "Gendai English->Chinese",
       -         "#9/dict/world/sansdata/sandic24.dat",
       -         "#9/dict/world/sansdata/ecindex",
       +         "world/sansdata/sandic24.dat",
       +         "world/sansdata/ecindex",
                 worldnextoff,        worldprintentry,        worldprintkey},
        
                {"dae",                "Gyldendal Danish->English",
       -         "#9/dict/world/gylddata/sandic30.dat",
       -         "#9/dict/world/gylddata/daeindex",
       +         "world/gylddata/sandic30.dat",
       +         "world/gylddata/daeindex",
                 worldnextoff,        worldprintentry,        worldprintkey},
                {"eda",                "Gyldendal English->Danish",
       -         "#9/dict/world/gylddata/sandic29.dat",
       -         "#9/dict/world/gylddata/edaindex",
       +         "world/gylddata/sandic29.dat",
       +         "world/gylddata/edaindex",
                 worldnextoff,        worldprintentry,        worldprintkey},
        
                {"due",                "Wolters-Noordhoff Dutch->English",
       -         "#9/dict/world/woltdata/sandic07.dat",
       -         "#9/dict/world/woltdata/deindex",
       +         "world/woltdata/sandic07.dat",
       +         "world/woltdata/deindex",
                 worldnextoff,        worldprintentry,        worldprintkey},
                {"edu",                "Wolters-Noordhoff English->Dutch",
       -         "#9/dict/world/woltdata/sandic06.dat",
       -         "#9/dict/world/woltdata/edindex",
       +         "world/woltdata/sandic06.dat",
       +         "world/woltdata/edindex",
                 worldnextoff,        worldprintentry,        worldprintkey},
        
                {"fie",                "WSOY Finnish->English",
       -         "#9/dict/world/werndata/sandic32.dat",
       -         "#9/dict/world/werndata/fieindex",
       +         "world/werndata/sandic32.dat",
       +         "world/werndata/fieindex",
                 worldnextoff,        worldprintentry,        worldprintkey},
                {"efi",                "WSOY English->Finnish",
       -         "#9/dict/world/werndata/sandic31.dat",
       -         "#9/dict/world/werndata/efiindex",
       +         "world/werndata/sandic31.dat",
       +         "world/werndata/efiindex",
                 worldnextoff,        worldprintentry,        worldprintkey},
        
                {"fe",                "Collins French->English",
       -         "#9/dict/fe",        "#9/dict/feindex",
       +         "fe",        "feindex",
                 pcollnextoff,        pcollprintentry,        pcollprintkey},
                {"ef",                "Collins English->French",
       -         "#9/dict/ef",        "#9/dict/efindex",
       +         "ef",        "efindex",
                 pcollnextoff,        pcollprintentry,        pcollprintkey},
        
                {"ge",                "Collins German->English",
       -         "#9/dict/ge",        "#9/dict/geindex",
       +         "ge",        "geindex",
                 pcollgnextoff,        pcollgprintentry,        pcollgprintkey},
                {"eg",                "Collins English->German",
       -         "#9/dict/eg",        "#9/dict/egindex",
       +         "eg",        "egindex",
                 pcollgnextoff,        pcollgprintentry,        pcollgprintkey},
        
                {"ie",                "Collins Italian->English",
       -         "#9/dict/ie",        "#9/dict/ieindex",
       +         "ie",        "ieindex",
                 pcollnextoff,        pcollprintentry,        pcollprintkey},
                {"ei",                "Collins English->Italian",
       -         "#9/dict/ei",        "#9/dict/eiindex",
       +         "ei",        "eiindex",
                 pcollnextoff,        pcollprintentry,        pcollprintkey},
        
                {"je",                "Sanshusha Japanese->English",
       -         "#9/dict/world/sansdata/sandic18.dat",
       -         "#9/dict/world/sansdata/jeindex",
       +         "world/sansdata/sandic18.dat",
       +         "world/sansdata/jeindex",
                 worldnextoff,        worldprintentry,        worldprintkey},
                {"jek",                "Sanshusha Japanese->English (Kanji index)",
       -         "#9/dict/world/sansdata/sandic18.dat",
       -         "#9/dict/world/sansdata/jekindex",
       +         "world/sansdata/sandic18.dat",
       +         "world/sansdata/jekindex",
                 worldnextoff,        worldprintentry,        worldprintkey},
                {"ej",                "Sanshusha English->Japanese",
       -         "#9/dict/world/sansdata/sandic18.dat",
       -         "#9/dict/world/sansdata/ejindex",
       +         "world/sansdata/sandic18.dat",
       +         "world/sansdata/ejindex",
                 worldnextoff,        worldprintentry,        worldprintkey},
        
                {"tjeg",        "Sanshusha technical Japanese->English,German",
       -         "#9/dict/world/sansdata/sandic16.dat",
       -         "#9/dict/world/sansdata/tjegindex",
       +         "world/sansdata/sandic16.dat",
       +         "world/sansdata/tjegindex",
                 worldnextoff,        worldprintentry,        worldprintkey},
                {"tjegk",        "Sanshusha technical Japanese->English,German (Kanji index)",
       -         "#9/dict/world/sansdata/sandic16.dat",
       -         "#9/dict/world/sansdata/tjegkindex",
       +         "world/sansdata/sandic16.dat",
       +         "world/sansdata/tjegkindex",
                 worldnextoff,        worldprintentry,        worldprintkey},
                {"tegj",        "Sanshusha technical English->German,Japanese",
       -         "#9/dict/world/sansdata/sandic16.dat",
       -         "#9/dict/world/sansdata/tegjindex",
       +         "world/sansdata/sandic16.dat",
       +         "world/sansdata/tegjindex",
                 worldnextoff,        worldprintentry,        worldprintkey},
                {"tgje",        "Sanshusha technical German->Japanese,English",
       -         "#9/dict/world/sansdata/sandic16.dat",
       -         "#9/dict/world/sansdata/tgjeindex",
       +         "world/sansdata/sandic16.dat",
       +         "world/sansdata/tgjeindex",
                 worldnextoff,        worldprintentry,        worldprintkey},
        
                {"ne",                "Kunnskapforlaget Norwegian->English",
       -         "#9/dict/world/kunndata/sandic28.dat",
       -         "#9/dict/world/kunndata/neindex",
       +         "world/kunndata/sandic28.dat",
       +         "world/kunndata/neindex",
                 worldnextoff,        worldprintentry,        worldprintkey},
                {"en",                "Kunnskapforlaget English->Norwegian",
       -         "#9/dict/world/kunndata/sandic27.dat",
       -         "#9/dict/world/kunndata/enindex",
       +         "world/kunndata/sandic27.dat",
       +         "world/kunndata/enindex",
                 worldnextoff,        worldprintentry,        worldprintkey},
        
                {"re",                "Leon Ungier Russian->English",
       -         "#9/dict/re",        "#9/dict/reindex",
       +         "re",        "reindex",
                 simplenextoff,        simpleprintentry,        simpleprintkey},
                {"er",                "Leon Ungier English->Russian",
       -         "#9/dict/re",        "#9/dict/erindex",
       +         "re",        "erindex",
                 simplenextoff,        simpleprintentry,        simpleprintkey},
        
                {"se",                "Collins Spanish->English",
       -         "#9/dict/se",        "#9/dict/seindex",
       +         "se",        "seindex",
                 pcollnextoff,        pcollprintentry,        pcollprintkey},
                {"es",                "Collins English->Spanish",
       -         "#9/dict/es",        "#9/dict/esindex",
       +         "es",        "esindex",
                 pcollnextoff,        pcollprintentry,        pcollprintkey},
        
                {"swe",                "Esselte Studium Swedish->English",
       -         "#9/dict/world/essedata/sandic34.dat",
       -         "#9/dict/world/essedata/sweindex",
       +         "world/essedata/sandic34.dat",
       +         "world/essedata/sweindex",
                 worldnextoff,        worldprintentry,        worldprintkey},
                {"esw",                "Esselte Studium English->Swedish",
       -         "#9/dict/world/essedata/sandic33.dat",
       -         "#9/dict/world/essedata/eswindex",
       +         "world/essedata/sandic33.dat",
       +         "world/essedata/eswindex",
                 worldnextoff,        worldprintentry,        worldprintkey},
        
                {"movie",        "Movies -- by title",
       -         "movie/data",        "#9/dict/movtindex",
       +         "movie/data",        "movtindex",
                 movienextoff,        movieprintentry,        movieprintkey},
                {"moviea",        "Movies -- by actor",
       -         "movie/data",        "#9/dict/movaindex",
       +         "movie/data",        "movaindex",
                 movienextoff,        movieprintentry,        movieprintkey},
                {"movied",        "Movies -- by director",
       -         "movie/data",        "#9/dict/movdindex",
       +         "movie/data",        "movdindex",
                 movienextoff,        movieprintentry,        movieprintkey},
        
                {"slang",        "English Slang",
       -         "#9/dict/slang",        "#9/dict/slangindex",
       +         "slang",        "slangindex",
                 slangnextoff,        slangprintentry,        slangprintkey},
        
                {"robert",        "Robert Électronique",
       -         "#9/dict/robert/_pointers",        "#9/dict/robert/_index",
       +         "robert/_pointers",        "robert/_index",
                 robertnextoff,        robertindexentry,        robertprintkey},
                {"robertv",        "Robert Électronique - formes des verbes",
       -         "#9/dict/robert/flex.rob",        "#9/dict/robert/_flexindex",
       +         "robert/flex.rob",        "robert/_flexindex",
                 robertnextflex,        robertflexentry,        robertprintkey},
        
                {0, 0, 0, 0, 0}