bug-global
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: missing links in hypertext generation


From: Shigio YAMAGUCHI
Subject: Re: missing links in hypertext generation
Date: Sat, 25 Nov 2006 18:13:00 +0900

> > o What option will you add to htags?
> 
> What I wanted to know is whether we should add an undocument option
>  (e.g. --no-follow-symlink) to global for keeping compatibility of "global 
> -f".

I acutually try 'global -f', and have finally understood.
The path name in the output of 'global -f' is different from the user's 
specification,
isn't it?

[Example]
-------------------------------------------------------------------------------------
$ cat a.c
main()
{
}
$ ln -s a.c S.c
$ gtags
$ global -f S.c                                 <==== user's specification is 
S.c
            ~~~
main                1 a.c            main()     <==== output is a.c (!= S.c)
                      ~~~
-------------------------------------------------------------------------------------

This should be called a bug of global(1), because the user doesn't understand 
the reason.
It should be like follows:

$ global -f S.c
            ~~~
main                1 S.c            main()     <==== FIXED.
                      ~~~

Htags(1) was just affected by the bug.

> > o How will you change the output of 'global -f'?
> 
> I will add a function such as realpath() which does not follow symlink to 
> path.c,
> and will use it instead of realpath().

I exactly have it.  Function rel2abs() does the opposite of abs2rel() in 
libutil/abs2rel.c.
I will add rel2abs to libutil/abs2rel.c. Could you please see it?

-------------------------------------------------------------------------------------
NAME
     rel2abs - make an absolute path name from a relative path

SYNOPSIS
     char *
     rel2abs(const char *path, const char *base, char *result, size_t size)

DESCRIPTION
     The rel2abs() function makes an absolute path name from a relative path
     name path based on a directory base and copies the resulting path name
     into the memory referenced by result.  The result argument must refer to
     a buffer capable of storing at least size character

     The resulting path name may include symbolic links.  abs2rel() doesn't
     check whether or not any path exists.

RETURN VALUES
     The rel2abs() function returns absolute path name on success.  If an er-
     ror occurs, it returns NULL.

ERRORS
     The rel2abs() function may fail and set the external variable errno to
     indicate the error.

     [EINVAL]           The base directory isn't an absolute path name or the
                        size argument is zero.

     [ERANGE]           The size argument is greater than zero but smaller
                        than the length of the pathname plus 1

EXAMPLE
         char result[MAXPATHLEN];
         char *path = rel2abs("../../src/sys", "/usr/local/lib", result, MAX-
     PATHLEN);

     yields:

         path == "/usr/src/sys"

     Similarly,

         path1 = rel2abs("src/sys", "/usr", result, MAXPATHLEN);
         path2 = rel2abs(".", "/usr/src/sys", result, MAXPATHLEN);

     yields:

         path1 == "/usr/src/sys"
         path2 == "/usr/src/sys"

SEE ALSO
     abs2rel(3)

AUTHORS
     Shigio Yamaguchi (address@hidden)
-------------------------------------------------------------------------------------
--
Shigio YAMAGUCHI <address@hidden> - Tama Communications Corporation
PGP fingerprint: D1CB 0B89 B346 4AB6 5663  C4B6 3CA5 BBB3 57BE DDA3




reply via email to

[Prev in Thread] Current Thread [Next in Thread]