1 /*
2 * ADF Library
3 *
4 * adf_link.c
5 *
6 * $Id$
7 *
8 * This file is part of ADFLib.
9 *
10 * ADFLib is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
14 *
15 * ADFLib is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
19 *
20 * You should have received a copy of the GNU General Public License
21 * along with Foobar; if not, write to the Free Software
22 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
23 *
24 */
25
26 #include<string.h>
27
28 #include"adf_defs.h"
29 #include"adf_str.h"
30 #include"adf_link.h"
31 #include"adf_dir.h"
32
33 extern struct Env adfEnv;
34
35 /*
36 *
37 *
38 */
path(struct Volume * vol,SECTNUM parent)39 char* path(struct Volume *vol, SECTNUM parent)
40 {
41 struct bEntryBlock entryBlk;
42 char *tmpPath;
43 int len;
44
45 tmpPath = NULL;
46 adfReadEntryBlock(vol, parent, &entryBlk);
47 len = min(entryBlk.nameLen, MAXNAMELEN);
48 memcpy(tmpPath,entryBlk.name,len);
49 tmpPath[len]='\0';
50 /* if (entryBlk.parent!=vol->rootBlock) {
51 return(strcat(path(vol,entryBlk.parent), tmpPath));
52 }
53 else
54 */ return(tmpPath);
55 }
56
57
58 /*
59 *
60 *
61 */
adfBlockPtr2EntryName(struct Volume * vol,SECTNUM nSect,SECTNUM lPar,char ** name,int32_t * size)62 RETCODE adfBlockPtr2EntryName(struct Volume *vol, SECTNUM nSect, SECTNUM lPar,
63 char **name, int32_t *size)
64 {
65 struct bEntryBlock entryBlk;
66 struct Entry entry;
67
68 if (*name==0) {
69 adfReadEntryBlock(vol, nSect, &entryBlk);
70 *size = entryBlk.byteSize;
71 return RC_OK;
72 adfEntBlock2Entry(&entryBlk, &entry); /*error*/
73 /* if (entryBlk.secType!=ST_ROOT && entry.parent!=lPar)
74 printf("path=%s\n",path(vol,entry.parent));
75 */
76 *name = strdup("");
77 if (*name==NULL)
78 return RC_MALLOC;
79 return RC_OK;
80 }
81 else
82
83 return RC_OK;
84 }
85
86 /*##################################################################################*/
87