From owner-freebsd-hackers Thu Jun 22 15:43:31 2000 Delivered-To: freebsd-hackers@freebsd.org Received: from dan.emsphone.com (dan.emsphone.com [199.67.51.101]) by hub.freebsd.org (Postfix) with ESMTP id C296937BF73 for ; Thu, 22 Jun 2000 15:43:22 -0700 (PDT) (envelope-from dan@dan.emsphone.com) Received: (from dan@localhost) by dan.emsphone.com (8.9.3/8.9.3) id RAA28664; Thu, 22 Jun 2000 17:42:37 -0500 (CDT) (envelope-from dan) Date: Thu, 22 Jun 2000 17:42:37 -0500 From: Dan Nelson To: gerald stoller Cc: freebsd-hackers@FreeBSD.ORG Subject: Re: Passing values between shell-variables Message-ID: <20000622174237.A27819@dan.emsphone.com> References: <20000622220725.30429.qmail@hotmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.3.4i In-Reply-To: <20000622220725.30429.qmail@hotmail.com>; from "gerald stoller" on Thu Jun 22 18:07:25 GMT 2000 X-OS: FreeBSD 5.0-CURRENT Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG In the last episode (Jun 22), gerald stoller said: > I want to take an integer value from one shell-variable and pass > a modified value to another shell-variable. First I tried setint_v > (after using local to get tbl structures for the two shell-variables) > and second I tried various forms of the var.c functions intval & > setint . To see if things worked, I print the shell-variable (to > which I assigned a value) afterwards, but neither path seems to have > succeeded. I may try getint next, and also make my tests more basic, > but if anyone could give me a good hint, I'd appreciate it. > One thing that puzzles me is can be illustrated by the following code: > struct tbl *var1 ; > int val1 ; > > var1 = local( "LINENO" , FALSE ) ; > getint( var1 , &val1 ) ; > printf( "%d %d\n" , var1->val.i , val1 ) ; > which gives differing values in the two fields (the val1 value appears to > be correct). Isn't val.i (from struct tbl ) where the integer (or is it > floating point?, but it is declared long ) is stored? > Please send a response directly to me, my bulk-mail folder is > over-stuffed. I'm not sure what local() and getint() are, since you didn't include the source to them, but you should probably be using the getenv() and putenv() functions to read environment variables. -- Dan Nelson dnelson@emsphone.com To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message