aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/dict
diff options
context:
space:
mode:
authorrsc <devnull@localhost>2003-12-11 17:48:38 +0000
committerrsc <devnull@localhost>2003-12-11 17:48:38 +0000
commit32f69c36e0eec1227934bbd34854bfebd88686f2 (patch)
tree1587e9de84816b77168afa81c1594cc686809910 /src/cmd/dict
parentac244f8d287a6119155ea672c8fd13c487c5e4c7 (diff)
downloadplan9port-32f69c36e0eec1227934bbd34854bfebd88686f2.tar.gz
plan9port-32f69c36e0eec1227934bbd34854bfebd88686f2.tar.bz2
plan9port-32f69c36e0eec1227934bbd34854bfebd88686f2.zip
Add support for user-level 9P servers/clients and various bug fixes to go with them.
Diffstat (limited to 'src/cmd/dict')
-rw-r--r--src/cmd/dict/dict.c11
-rw-r--r--src/cmd/dict/utils.c118
2 files changed, 62 insertions, 67 deletions
diff --git a/src/cmd/dict/dict.c b/src/cmd/dict/dict.c
index dccd3037..8cbf6aac 100644
--- a/src/cmd/dict/dict.c
+++ b/src/cmd/dict/dict.c
@@ -59,18 +59,13 @@ void
main(int argc, char **argv)
{
int i, cmd, kflag;
- char *line, *p, *root;
+ char *line, *p;
Binit(&binbuf, 0, OREAD);
Binit(&boutbuf, 1, OWRITE);
kflag = 0;
line = 0;
dict = 0;
- root = getenv("PLAN9");
- if(root == nil)
- root = "/usr/local/plan9";
- if(chdir(root) < 0)
- sysfatal("chdir %s: %r", root);
for(i=0; dicts[i].name; i++){
if(access(dicts[i].path, 0)>=0 && access(dicts[i].indexpath, 0)>=0){
@@ -126,12 +121,12 @@ main(int argc, char **argv)
}
bdict = Bopen(dict->path, OREAD);
if(!bdict) {
- err("can't open dictionary %s/%s", root, dict->path);
+ err("can't open dictionary %s", dict->path);
exits("nodict");
}
bindex = Bopen(dict->indexpath, OREAD);
if(!bindex) {
- err("can't open index %s/%s", root, dict->indexpath);
+ err("can't open index %s", dict->indexpath);
exits("noindex");
}
indextop = Bseek(bindex, 0L, 2);
diff --git a/src/cmd/dict/utils.c b/src/cmd/dict/utils.c
index 8e4db9e9..6916d549 100644
--- a/src/cmd/dict/utils.c
+++ b/src/cmd/dict/utils.c
@@ -5,160 +5,160 @@
Dict dicts[] = {
{"oed", "Oxford English Dictionary, 2nd Ed.",
- "dict/oed2", "dict/oed2index",
+ "#9/dict/oed2", "#9/dict/oed2index",
oednextoff, oedprintentry, oedprintkey},
{"ahd", "American Heritage Dictionary, 2nd College Ed.",
"ahd/DICT.DB", "ahd/index",
ahdnextoff, ahdprintentry, ahdprintkey},
{"pgw", "Project Gutenberg Webster Dictionary",
- "dict/pgw", "dict/pgwindex",
+ "#9/dict/pgw", "#9/dict/pgwindex",
pgwnextoff, pgwprintentry, pgwprintkey},
{"thesaurus", "Collins Thesaurus",
- "dict/thesaurus", "dict/thesindex",
+ "#9/dict/thesaurus", "#9/dict/thesindex",
thesnextoff, thesprintentry, thesprintkey},
{"ce", "Gendai Chinese->English",
- "dict/world/sansdata/sandic24.dat",
- "dict/world/sansdata/ceindex",
+ "#9/dict/world/sansdata/sandic24.dat",
+ "#9/dict/world/sansdata/ceindex",
worldnextoff, worldprintentry, worldprintkey},
{"ceh", "Gendai Chinese->English (Hanzi index)",
- "dict/world/sansdata/sandic24.dat",
- "dict/world/sansdata/cehindex",
+ "#9/dict/world/sansdata/sandic24.dat",
+ "#9/dict/world/sansdata/cehindex",
worldnextoff, worldprintentry, worldprintkey},
{"ec", "Gendai English->Chinese",
- "dict/world/sansdata/sandic24.dat",
- "dict/world/sansdata/ecindex",
+ "#9/dict/world/sansdata/sandic24.dat",
+ "#9/dict/world/sansdata/ecindex",
worldnextoff, worldprintentry, worldprintkey},
{"dae", "Gyldendal Danish->English",
- "dict/world/gylddata/sandic30.dat",
- "dict/world/gylddata/daeindex",
+ "#9/dict/world/gylddata/sandic30.dat",
+ "#9/dict/world/gylddata/daeindex",
worldnextoff, worldprintentry, worldprintkey},
{"eda", "Gyldendal English->Danish",
- "dict/world/gylddata/sandic29.dat",
- "dict/world/gylddata/edaindex",
+ "#9/dict/world/gylddata/sandic29.dat",
+ "#9/dict/world/gylddata/edaindex",
worldnextoff, worldprintentry, worldprintkey},
{"due", "Wolters-Noordhoff Dutch->English",
- "dict/world/woltdata/sandic07.dat",
- "dict/world/woltdata/deindex",
+ "#9/dict/world/woltdata/sandic07.dat",
+ "#9/dict/world/woltdata/deindex",
worldnextoff, worldprintentry, worldprintkey},
{"edu", "Wolters-Noordhoff English->Dutch",
- "dict/world/woltdata/sandic06.dat",
- "dict/world/woltdata/edindex",
+ "#9/dict/world/woltdata/sandic06.dat",
+ "#9/dict/world/woltdata/edindex",
worldnextoff, worldprintentry, worldprintkey},
{"fie", "WSOY Finnish->English",
- "dict/world/werndata/sandic32.dat",
- "dict/world/werndata/fieindex",
+ "#9/dict/world/werndata/sandic32.dat",
+ "#9/dict/world/werndata/fieindex",
worldnextoff, worldprintentry, worldprintkey},
{"efi", "WSOY English->Finnish",
- "dict/world/werndata/sandic31.dat",
- "dict/world/werndata/efiindex",
+ "#9/dict/world/werndata/sandic31.dat",
+ "#9/dict/world/werndata/efiindex",
worldnextoff, worldprintentry, worldprintkey},
{"fe", "Collins French->English",
- "dict/fe", "dict/feindex",
+ "#9/dict/fe", "#9/dict/feindex",
pcollnextoff, pcollprintentry, pcollprintkey},
{"ef", "Collins English->French",
- "dict/ef", "dict/efindex",
+ "#9/dict/ef", "#9/dict/efindex",
pcollnextoff, pcollprintentry, pcollprintkey},
{"ge", "Collins German->English",
- "dict/ge", "dict/geindex",
+ "#9/dict/ge", "#9/dict/geindex",
pcollgnextoff, pcollgprintentry, pcollgprintkey},
{"eg", "Collins English->German",
- "dict/eg", "dict/egindex",
+ "#9/dict/eg", "#9/dict/egindex",
pcollgnextoff, pcollgprintentry, pcollgprintkey},
{"ie", "Collins Italian->English",
- "dict/ie", "dict/ieindex",
+ "#9/dict/ie", "#9/dict/ieindex",
pcollnextoff, pcollprintentry, pcollprintkey},
{"ei", "Collins English->Italian",
- "dict/ei", "dict/eiindex",
+ "#9/dict/ei", "#9/dict/eiindex",
pcollnextoff, pcollprintentry, pcollprintkey},
{"je", "Sanshusha Japanese->English",
- "dict/world/sansdata/sandic18.dat",
- "dict/world/sansdata/jeindex",
+ "#9/dict/world/sansdata/sandic18.dat",
+ "#9/dict/world/sansdata/jeindex",
worldnextoff, worldprintentry, worldprintkey},
{"jek", "Sanshusha Japanese->English (Kanji index)",
- "dict/world/sansdata/sandic18.dat",
- "dict/world/sansdata/jekindex",
+ "#9/dict/world/sansdata/sandic18.dat",
+ "#9/dict/world/sansdata/jekindex",
worldnextoff, worldprintentry, worldprintkey},
{"ej", "Sanshusha English->Japanese",
- "dict/world/sansdata/sandic18.dat",
- "dict/world/sansdata/ejindex",
+ "#9/dict/world/sansdata/sandic18.dat",
+ "#9/dict/world/sansdata/ejindex",
worldnextoff, worldprintentry, worldprintkey},
{"tjeg", "Sanshusha technical Japanese->English,German",
- "dict/world/sansdata/sandic16.dat",
- "dict/world/sansdata/tjegindex",
+ "#9/dict/world/sansdata/sandic16.dat",
+ "#9/dict/world/sansdata/tjegindex",
worldnextoff, worldprintentry, worldprintkey},
{"tjegk", "Sanshusha technical Japanese->English,German (Kanji index)",
- "dict/world/sansdata/sandic16.dat",
- "dict/world/sansdata/tjegkindex",
+ "#9/dict/world/sansdata/sandic16.dat",
+ "#9/dict/world/sansdata/tjegkindex",
worldnextoff, worldprintentry, worldprintkey},
{"tegj", "Sanshusha technical English->German,Japanese",
- "dict/world/sansdata/sandic16.dat",
- "dict/world/sansdata/tegjindex",
+ "#9/dict/world/sansdata/sandic16.dat",
+ "#9/dict/world/sansdata/tegjindex",
worldnextoff, worldprintentry, worldprintkey},
{"tgje", "Sanshusha technical German->Japanese,English",
- "dict/world/sansdata/sandic16.dat",
- "dict/world/sansdata/tgjeindex",
+ "#9/dict/world/sansdata/sandic16.dat",
+ "#9/dict/world/sansdata/tgjeindex",
worldnextoff, worldprintentry, worldprintkey},
{"ne", "Kunnskapforlaget Norwegian->English",
- "dict/world/kunndata/sandic28.dat",
- "dict/world/kunndata/neindex",
+ "#9/dict/world/kunndata/sandic28.dat",
+ "#9/dict/world/kunndata/neindex",
worldnextoff, worldprintentry, worldprintkey},
{"en", "Kunnskapforlaget English->Norwegian",
- "dict/world/kunndata/sandic27.dat",
- "dict/world/kunndata/enindex",
+ "#9/dict/world/kunndata/sandic27.dat",
+ "#9/dict/world/kunndata/enindex",
worldnextoff, worldprintentry, worldprintkey},
{"re", "Leon Ungier Russian->English",
- "dict/re", "dict/reindex",
+ "#9/dict/re", "#9/dict/reindex",
simplenextoff, simpleprintentry, simpleprintkey},
{"er", "Leon Ungier English->Russian",
- "dict/re", "dict/erindex",
+ "#9/dict/re", "#9/dict/erindex",
simplenextoff, simpleprintentry, simpleprintkey},
{"se", "Collins Spanish->English",
- "dict/se", "dict/seindex",
+ "#9/dict/se", "#9/dict/seindex",
pcollnextoff, pcollprintentry, pcollprintkey},
{"es", "Collins English->Spanish",
- "dict/es", "dict/esindex",
+ "#9/dict/es", "#9/dict/esindex",
pcollnextoff, pcollprintentry, pcollprintkey},
{"swe", "Esselte Studium Swedish->English",
- "dict/world/essedata/sandic34.dat",
- "dict/world/essedata/sweindex",
+ "#9/dict/world/essedata/sandic34.dat",
+ "#9/dict/world/essedata/sweindex",
worldnextoff, worldprintentry, worldprintkey},
{"esw", "Esselte Studium English->Swedish",
- "dict/world/essedata/sandic33.dat",
- "dict/world/essedata/eswindex",
+ "#9/dict/world/essedata/sandic33.dat",
+ "#9/dict/world/essedata/eswindex",
worldnextoff, worldprintentry, worldprintkey},
{"movie", "Movies -- by title",
- "movie/data", "dict/movtindex",
+ "movie/data", "#9/dict/movtindex",
movienextoff, movieprintentry, movieprintkey},
{"moviea", "Movies -- by actor",
- "movie/data", "dict/movaindex",
+ "movie/data", "#9/dict/movaindex",
movienextoff, movieprintentry, movieprintkey},
{"movied", "Movies -- by director",
- "movie/data", "dict/movdindex",
+ "movie/data", "#9/dict/movdindex",
movienextoff, movieprintentry, movieprintkey},
{"slang", "English Slang",
- "dict/slang", "dict/slangindex",
+ "#9/dict/slang", "#9/dict/slangindex",
slangnextoff, slangprintentry, slangprintkey},
{"robert", "Robert Électronique",
- "dict/robert/_pointers", "dict/robert/_index",
+ "#9/dict/robert/_pointers", "#9/dict/robert/_index",
robertnextoff, robertindexentry, robertprintkey},
{"robertv", "Robert Électronique - formes des verbes",
- "dict/robert/flex.rob", "dict/robert/_flexindex",
+ "#9/dict/robert/flex.rob", "#9/dict/robert/_flexindex",
robertnextflex, robertflexentry, robertprintkey},
{0, 0, 0, 0, 0}