trinity-devel@lists.pearsoncomputing.net

Message: previous - next
Month: January 2012

Re: [trinity-devel] %s, %h variables, etc.

From: Darrell Anderson <humanreadable@...>
Date: Sat, 21 Jan 2012 10:55:19 -0800 (PST)
> Subject: Re: [trinity-devel] %s, %h variables, etc.
> > Where are these variables
> defined?
> >
> > I think %h is host name.
> >
> > There must be list somewhere deep within TDE.

> Context please?  I have no idea which variables you
> are talking about. :-)

Okay. Let me back up. I think this is two questions.

Calvin, yes, this is a stdlib variable.

First, in KDM kdmrc is a list of variables:

%d -> current display
%h -> host name, possibly with domain name
%n -> node name, most probably the host name without domain name
%s -> the operating system
%r -> the operating system's version
%m -> the machine (hardware) type

I was partially trying to remember that list. That list should not be confused with the specific usage I want to understand, which is found in tdebase/kdm/backend/error.c:102:

sprintf( buf, "/var/log/%s.log", prog );

When I look in /var/log, I know that "%s" is translated to "kdm."

As I am learning C/C++, I know that %s in that line is stdlib for string, and "prog" is the data to be passed to sprintf as a string. What is the value of "prog"?

I see that dm.h is part of the preprocessor includes. In dm.h, prog is defined as an extern char variable. (Although I don't know what the asterisk means. :) )

I still don't where prog is assigned the value of "kdm."

I want to submit a patch for bug report 618, which I created. A simple bug report like this is a good way to help me learn a little more about C++. When I better understand the context of %s in error.c, that is, where prog is assigned the value of kdm, I can submit a patch.

Darrell