From owner-freebsd-hackers Sun Jun 25 10:12:30 2000 Delivered-To: freebsd-hackers@freebsd.org Received: from hotmail.com (f53.law9.hotmail.com [64.4.9.53]) by hub.freebsd.org (Postfix) with SMTP id 2FDED37B6DD for ; Sun, 25 Jun 2000 10:12:26 -0700 (PDT) (envelope-from gerald_stoller@hotmail.com) Received: (qmail 15344 invoked by uid 0); 25 Jun 2000 17:12:23 -0000 Message-ID: <20000625171223.15343.qmail@hotmail.com> Received: from 209.246.86.55 by www.hotmail.com with HTTP; Sun, 25 Jun 2000 10:12:22 PDT X-Originating-IP: [209.246.86.55] From: "gerald stoller" To: dnelson@emsphone.com Cc: freebsd-hackers@FreeBSD.ORG Subject: Re: Passing values between shell-variables Date: Sun, 25 Jun 2000 13:12:22 EDT Mime-Version: 1.0 Content-Type: text/plain; format=flowed Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG Dan Nelson resonded on Thu, 22 Jun 2000 17:42:37 -0500 with >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 Sorry for leaving out info; local() and getint() are functions in the file var.c of pdksh as is setint_v() , which I also tried. I am using version 3.3 . struct tbl is a structure defined in the file table.h of pdksh . Probably soon I will upgrade to version 4.1 or so. I want to be able to work with general variables, not only environment variables, so I don't feel that getenv() & putenv() are the way to go. ________________________________________________________________________ Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message