grub2: bring back build of aros-side grub2 tools
[AROS.git] / tools / adflib / adf_link.c
blob6093f5af1c3b002772701738f5ad62287d46ca72
1 /*
2 * ADF Library
4 * adf_link.c
6 */
8 #include<string.h>
10 #include"adf_defs.h"
11 #include"adf_str.h"
12 #include"adf_link.h"
13 #include"adf_dir.h"
15 extern struct Env adfEnv;
21 char* path(struct Volume *vol, SECTNUM parent)
23 struct bEntryBlock entryBlk;
24 char *tmpPath;
25 int len;
27 tmpPath = NULL;
28 adfReadEntryBlock(vol, parent, &entryBlk);
29 len = min(entryBlk.nameLen, MAXNAMELEN);
30 memcpy(tmpPath,entryBlk.name,len);
31 tmpPath[len]='\0';
32 /* if (entryBlk.parent!=vol->rootBlock) {
33 return(strcat(path(vol,entryBlk.parent), tmpPath));
35 else
36 */ return(tmpPath);
44 RETCODE adfBlockPtr2EntryName(struct Volume *vol, SECTNUM nSect, SECTNUM lPar,
45 char **name, ULONG *size)
47 struct bEntryBlock entryBlk;
48 struct Entry entry;
50 if (*name==0) {
51 adfReadEntryBlock(vol, nSect, &entryBlk);
52 *size = entryBlk.byteSize;
53 return RC_OK;
54 adfEntBlock2Entry(&entryBlk, &entry); //error
55 /* if (entryBlk.secType!=ST_ROOT && entry.parent!=lPar)
56 printf("path=%s\n",path(vol,entry.parent));
58 *name = strdup("");
59 if (*name==NULL)
60 return RC_MALLOC;
61 return RC_OK;
63 else
65 return RC_OK;
68 /*##################################################################################*/