source: grub-pc/trunk/fuentes/grub-core/osdep/aros/relpath.c @ 22

Last change on this file since 22 was 22, checked in by mabarracus, 4 years ago

updated version and apply net.ifnames=0 into debian/rules

File size: 1.8 KB
Line 
1/*
2 *  GRUB  --  GRand Unified Bootloader
3 *  Copyright (C) 2013  Free Software Foundation, Inc.
4 *
5 *  GRUB is free software: you can redistribute it and/or modify
6 *  it under the terms of the GNU General Public License as published by
7 *  the Free Software Foundation, either version 3 of the License, or
8 *  (at your option) any later version.
9 *
10 *  GRUB is distributed in the hope that it will be useful,
11 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
12 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13 *  GNU General Public License for more details.
14 *
15 *  You should have received a copy of the GNU General Public License
16 *  along with GRUB.  If not, see <http://www.gnu.org/licenses/>.
17 */
18
19#include <config-util.h>
20#include <config.h>
21
22#include <grub/util/misc.h>
23
24#include <grub/mm.h>
25#include <grub/misc.h>
26#include <grub/emu/misc.h>
27#include <grub/emu/hostdisk.h>
28#include <grub/emu/getroot.h>
29
30#include <string.h>
31#include <dos/dos.h>
32#include <dos/filesystem.h>
33#include <dos/exall.h>
34#include <proto/dos.h>
35#include <proto/exec.h>
36#include <devices/trackdisk.h>
37
38char *
39grub_make_system_path_relative_to_its_root (const char *path)
40{
41  char *p;
42  unsigned char *tmp;
43  char *ret;
44  BPTR lck;
45
46  if (path[0] == '/' && path[1] == '/' && path[2] == ':')
47    return xstrdup (path);
48
49  tmp = xmalloc (2048);
50
51  lck = Lock ((const unsigned char *) path, SHARED_LOCK);
52  if (!lck || !NameFromLock (lck, tmp, 2040))
53    {
54      free (tmp);
55      tmp = (unsigned char *) xstrdup (path);
56    }
57  if (lck)
58    UnLock (lck);
59  p = strchr ((char *) tmp, ':');
60  if (!p)
61    return (char *) tmp;
62  if (p[1] == '/' || p[1] == '\0')
63    {
64      ret = xstrdup (p + 1);
65    }
66  else
67    {
68      ret = xmalloc (strlen (p + 1) + 2);
69      ret[0] = '/';
70      strcpy (ret + 1, p + 1);
71    }
72
73  free (tmp);
74  return ret;
75}
Note: See TracBrowser for help on using the repository browser.