[Techtalk] install from source problem
Alice Moomlyn
alice_moomlyn at yahoo.com
Tue Mar 23 15:32:17 EST 2004
I was reading through the linuxchix course archives
when I discovered that my machine does not have
'locate' installed.
.......................................
alice at linux:~> locate
bash: locate: command not found
alice at linux:~> man locate
No manual entry for locate
........................................
So I looked on the net and found what looked to be the
sources at:
http://www.gnu.org/directory/GNU/findutils.html
I downloaded these sources, and tried to 'make' them,
but got:
..................................................
nextelem.c:35: parse error before "__extension__"
nextelem.c:35: `__len' undeclared here (not in a
function)
nextelem.c:35: initializer element is not constant
nextelem.c:35: parse error before "if"
nextelem.c:35: conflicting types for `__retval'
nextelem.c:35: previous declaration of `__retval'
nextelem.c:35: warning: data definition has no type or
storage class
nextelem.c:35: parse error before '}' token
make: *** [nextelem.o] Error 1
.................................................
So I peak inside nextelem.c and I find:
................................................
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <stdio.h>
#if defined(HAVE_STRING_H) || defined(STDC_HEADERS)
#include <string.h>
#else
#include <strings.h>
#ifndef strchr
#define strchr index
#endif
#endif
char *strdup (); <============== offending line
void free ();
.............................................
What does it mean?
No '__extension__' or '__len' or '__retval' on line
35!
But I did find this in string.h:
....................................................
#if defined __USE_SVID || defined __USE_BSD || defined
__USE_XOPEN_EXTENDED
/* Duplicate S, returning an identical malloc'd
string. */
extern char *strdup (__const char *__s) __THROW
__attribute_malloc__;
#endif
#if defined __USE_GNU && defined __GNUC__
/* Duplicate S, returning an identical alloca'd
string. */
# define strdupa(s)
\
(__extension__
\
({
\
__const char *__old = (s);
\
size_t __len = strlen (__old) + 1;
\
char *__new = (char *) __builtin_alloca (__len);
\
(char *) memcpy (__new, __old, __len);
\
}))
/* Return an alloca'd copy of at most N bytes of
string. */
# define strndupa(s, n)
\
(__extension__
\
({
\
__const char *__old = (s);
\
size_t __len = strnlen (__old, (n));
\
char *__new = (char *) __builtin_alloca (__len +
1); \
__new[__len] = '\0';
\
(char *) memcpy (__new, __old, __len);
\
}))
#endif
............................................
No clue what any of it means though 8^<
............................................
This is what the man-pages say:
NAME
strdup, strndup, strdupa, strndupa - duplicate
a string
SYNOPSIS
#include <string.h>
char *strdup(const char *s);
#define _GNU_SOURCE
#include <string.h>
char *strndup(const char *s, size_t n);
char *strdupa(const char *s);
char *strndupa(const char *s, size_t n);
DESCRIPTION
The strdup() function returns a pointer to a
new string
which is a duplicate of the string s. Memory
for the new
string is obtained with malloc(3), and can be
freed with
free(3).
The strndup() function is similar, but only
copies at most
n characters. If s is longer than n, only n
characters are
copied, and a terminating NUL is added.
strdupa and strndupa are similar, but use
alloca(3) to
allocate the buffer. They are only available
when using
the GNU GCC suite, and suffer from the same
limitations
described in alloca(3).
RETURN VALUE
The strdup() function returns a pointer to the
duplicated
string, or NULL if insufficient memory was
available.
....................................................
/me is still clueless.
=====
"the only way to learn how to be clever is to say stupid things" - anon
__________________________________
Do you Yahoo!?
Yahoo! Finance Tax Center - File online. File on time.
http://taxes.yahoo.com/filing.html
More information about the Techtalk
mailing list