diff options
| author | forsyth <forsyth@vitanuova.com> | 2009-08-25 19:35:34 +0100 |
|---|---|---|
| committer | forsyth <forsyth@vitanuova.com> | 2009-08-25 19:35:34 +0100 |
| commit | cbfacb4e903227dde62ad60b129dc2e3569913fa (patch) | |
| tree | 30d8fa5a8c6b557311a15b319bbc492171f56a08 /emu/port/devtab.c | |
| parent | 67d4cb07c1a40a27872c4da282fbe1417aa87731 (diff) | |
20090825-1935
Diffstat (limited to 'emu/port/devtab.c')
| -rw-r--r-- | emu/port/devtab.c | 36 |
1 files changed, 33 insertions, 3 deletions
diff --git a/emu/port/devtab.c b/emu/port/devtab.c index cc77a035..6f244e62 100644 --- a/emu/port/devtab.c +++ b/emu/port/devtab.c @@ -1,5 +1,35 @@ -void -placeholderonly(void) +#include "dat.h" +#include "fns.h" +#include "error.h" + +extern Dev* devtab[]; + +long +devtabread(Chan *c, void* buf, long n, vlong off) { - /* just in case some host compiler hates empty files */ + int i; + Dev *dev; + char *alloc, *e, *p; + + USED(c); + alloc = malloc(READSTR); + if(alloc == nil) + error(Enomem); + + p = alloc; + e = p + READSTR; + for(i = 0; devtab[i] != nil; i++){ + dev = devtab[i]; + p = seprint(p, e, "#%C %s\n", dev->dc, dev->name); + } + + if(waserror()){ + free(alloc); + nexterror(); + } + n = readstr(off, buf, n, alloc); + free(alloc); + poperror(); + + return n; } |
