No subject
Net.Noise owner
news at max.cecer.army.mil
Fri Mar 26 01:35:16 EST 1993
Newsgroups: info.grass.user
Path: zorro.cecer.army.mil!shapiro
From: shapiro at zorro.cecer.army.mil (Michael Shapiro)
Subject: Re: xgrass on DECstation? (strdup undefined)
Message-ID: <C4HGyp.LGq at news.cecer.army.mil>
Sender: news at news.cecer.army.mil (Net.Noise owner)
Organization: US Army Corps of Engineers Construction Engineering Research Labs
References: <Mailstrom.1.0.61886.11025.nsmith at polar.bowdoin.edu> <9303241850.AA10605 at sonoma.ced.berkeley.edu>
Date: Fri, 26 Mar 1993 06:35:13 GMT
Lines: 84
>>
>> Seeing xgrass in Reston was enough to convince me it was
>> time to make it. I made grass4.1beta without any problems,
>> but am stuck on xgrass at xgrass/display : the loader
>> can't find strdup. Sure enough, it's called in lex.c
>> (and declared twice!), and not defined in any of the code
>> in src/xgrass/display.
>>
>> Have I missed a header file somewhere?
>>
>> I'm compiling on a DECStation 5000, X with Motif; the
>> X headers seem to be in order.
>strdup is one of the string functions defined under SunOS, among
>others. But, it is not available for Ultrix, for reasons that are
>unclear to all but DEC.
You could use G_store() from the GRASS $(GISLIB) which does
a strdup() (except ti calls exit() if malloc() fails). Or write
a strdup():
char *strdup(s) char *s;
{
char *b;
char *malloc();
if(b = malloc(strlen(s)+1))
strcpy (b, s);
return b;
}
>==================================================================
>STRING(3) C LIBRARY FUNCTIONS STRING(3)
>NAME
> strcat, strncat, strdup, strcmp, strncmp, strcasecmp,
> strncasecmp, strcpy, strncpy, strlen, strchr, strrchr,
> strpbrk, strspn, strcspn, strstr, strtok, index, rindex -
> string operations
>SYNOPSIS
> #include <string.h>
>...
> char *strdup(s1)
> char *s1;
>...
>DESCRIPTION
> These functions operate on null-terminated strings. They do
> not check for overflow of any receiving string.
>...
> strdup() returns a pointer to a new string which is a dupli-
> cate of the string pointed to by s1. The space for the new
> string is obtained using malloc(3V). If the new string can-
> not be created, a NULL pointer is returned.
>...
>=========================
>I have fiddled around a bit, trying to get around this, but havn't had any
>luck getting the resulting code to run. I don't think this one will be too
>hard to fix.
>+------------------------------------------------------------------------------+
>| Kenn Gardels Tel +01 (510) 642-9205 Fax +01 (510) 643-5571 |
>| CEDR - 390 Wurster Hall Internet gardels at ced.berkeley.edu |
>| University of California Bitnet gardels at UCBCED |
>| Berkeley, CA 94720 Calendar gardels at tahoe.ced.berkeley.edu |
>+------------------------------------------------------------------------------+
--
Michael Shapiro U.S. Army CERL
Environmental Division
More information about the grass-user
mailing list