Where are these variables defined?
I think %h is host name.
There must be list somewhere deep within TDE.
Darrell
On 21 January 2012 13:18, Timothy Pearson kb9vqf@pearsoncomputing.netwrote:
Where are these variables defined?
I think %h is host name.
There must be list somewhere deep within TDE.
Darrell
Context please? I have no idea which variables you are talking about. :-)
Tim
If you are referring to the stdlib (I think it is quite similar to C's) function like sprintf or the like, %s would signify a string etc.
http://www.cplusplus.com/reference/clibrary/cstdio/sprintf/
that might be it.
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
On Sat, 21 Jan 2012 10:55:19 -0800 (PST) Darrell Anderson humanreadable@yahoo.com wrote:
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."
In dm.c, line 159. This variable is exported in dm.h, and its value is computed at run-time, for Linux systems (the code is in a "#ifdef __linux__"), as the file pointed by the /proc/self/exe symlink (which always points to the binary of the executable). More precisely, progpath is the full path and prog is the file name of the binary. If kdm was renamed to tdm, it would automagically rename kdm.log to tdm.log.
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
To unsubscribe, e-mail: trinity-devel-unsubscribe@lists.pearsoncomputing.net For additional commands, e-mail: trinity-devel-help@lists.pearsoncomputing.net Read list messsages on the Web archive: http://trinity-devel.pearsoncomputing.net/ Please remember not to top-post: http://trinity.pearsoncomputing.net/mailing_lists/#top-posting
I still don't where prog is assigned the value of
"kdm." In dm.c, line 159. This variable is exported in dm.h, and its value is computed at run-time, for Linux systems (the code is in a "#ifdef __linux__"), as the file pointed by the /proc/self/exe symlink (which always points to the binary of the executable). More precisely, progpath is the full path and prog is the file name of the binary. If kdm was renamed to tdm, it would automagically rename kdm.log to tdm.log.
Okay, thanks. I'm still too much of newbie with C++ to fully understand the syntax and the full bread crumb trail, but I get the gist of what is happening.
Yes, I see that changing kdm to tdm would resolve the bug report in a clean manner.
Tim:
If you have no objections to renaming Trinity kdm to tdm, would you provide me a punch list of sorts for how you proceeded to rename kdesu to tdesu?
If you object to renaming kdm to tdm, then to resolve the bug report I think we could resolve with something like this (I'm still learning syntax --- need help! :) ):
// Avoid naming collisions with KDE4. char *logname; logname = prog; strcat ( logname, "-tde" ); sprintf( buf, "/var/log/%s.log", logname )
Darrell
On Sat, 21 Jan 2012 11:42:02 -0800 (PST) Darrell Anderson humanreadable@yahoo.com wrote:
I still don't where prog is assigned the value of
"kdm." In dm.c, line 159. This variable is exported in dm.h, and its value is computed at run-time, for Linux systems (the code is in a "#ifdef __linux__"), as the file pointed by the /proc/self/exe symlink (which always points to the binary of the executable). More precisely, progpath is the full path and prog is the file name of the binary. If kdm was renamed to tdm, it would automagically rename kdm.log to tdm.log.
Okay, thanks. I'm still too much of newbie with C++ to fully understand the syntax and the full bread crumb trail, but I get the gist of what is happening.
Yes, I see that changing kdm to tdm would resolve the bug report in a clean manner.
Tim:
If you have no objections to renaming Trinity kdm to tdm, would you provide me a punch list of sorts for how you proceeded to rename kdesu to tdesu?
If you object to renaming kdm to tdm, then to resolve the bug report I think we could resolve with something like this (I'm still learning syntax --- need help! :) ):
// Avoid naming collisions with KDE4. char *logname; logname = prog; strcat ( logname, "-tde" ); sprintf( buf, "/var/log/%s.log", logname )
sprintf( buf, "/var/log/%s-tde.log", logname );
without the strcat line is better because if you strcat you could cause a buffer overflow in logname. Anyway sprintf is potentially insecure, using snprintf would probably be better.
Darrell
To unsubscribe, e-mail: trinity-devel-unsubscribe@lists.pearsoncomputing.net For additional commands, e-mail: trinity-devel-help@lists.pearsoncomputing.net Read list messsages on the Web archive: http://trinity-devel.pearsoncomputing.net/ Please remember not to top-post: http://trinity.pearsoncomputing.net/mailing_lists/#top-posting
// Avoid naming collisions with KDE4. char *logname; logname = prog; strcat ( logname, "-tde" ); sprintf( buf, "/var/log/%s.log", logname )
sprintf( buf, "/var/log/%s-tde.log", logname );
without the strcat line is better because if you strcat you could cause a buffer overflow in logname. Anyway sprintf is potentially insecure, using snprintf would probably be better.
Okay, thanks. So much to learn. :)
Tim decided to bump the bug report to blocker in order to rename kdm to tdm because he has his super duper magical conversion scripts to do things like that. :)
Darrell