1 /* 2 * dir.x: Remote directory listing protocol 3 */ 4 const MAXNAMELEN = 255; /* maximum length of a directory entry */ 5 6 typedef string nametype<MAXNAMELEN>; /* a directory entry */ 7 8 typedef struct namenode *namelist; /* a link in the listing */ 9 10 /* 11 * A node in the directory listing 12 */ 13 struct namenode { 14 nametype name; /* name of directory entry */ 15 namelist next; /* next entry */ 16 }; 17 18 /* 19 * The result of a READDIR operation. 20 */ 21 union readdir_res switch (int errno) { 22 case 0: 23 namelist list; /* no error: return directory listing */ 24 default: 25 void; /* error occurred: nothing else to return */ 26 }; 27 28 /* 29 * The directory program definition 30 */ 31 program DIRPROG { 32 version DIRVERS { 33 readdir_res 34 READDIR(nametype) = 1; 35 } = 1; 36 } = 76; 37