09/23/2008 10:53 AM
post13863
|
>
> Seek for the first '='. Everything to the left is the variable's
> name, everything to the right up to the terminating ASCII NUL is
> the value:
>
> void getit( const char *env_var_val ) {
> char *name = strdup( env_var_val );
> char *value = strchr( name, '=' );
> *value++ = '\0';
> printf( "Variable '%s' has value '%s'\n", name, value );
> }
>
>
> Or did I miss your point?
Yes and no. My example wasn't clear and I'm the one that got confuse. I had modify Environment() ( as found in
pidin_proc.c ) to return one big string instead of going to stdout. I was trying to parse that string which separated
the variables with spaces and not '\0', making it impossible to parse reliably.
I just realize that Environment() is getting each variable one by one.
Sorry about that.
>
> - Thomas
>
> > -----Ursprungliche Nachricht-----
> > Von: Mario Charest [mailto:community-noreply@qnx.com]
> > Gesendet: 23 September 2008 15:51
> > An: ostech-core_os
> > Betreff: pidin env
> >
> >
> > I'm been using code from pidin env to get access to other
> > processes environment variables. My problem is with parsing
> > of the data. Say a variable is setup like
> >
> > VAR="see the=sign "
> >
> > This make parsing close to impossible. Suggestions?
> >
> >
> >
> > _______________________________________________
> > OSTech
> > http://community.qnx.com/sf/go/post13854
> >
> >
|
|
|