I’m looking at the following code I found in libgksu and I’m wondering what the %s inside the string does. I’m unable to use Google for this since it strips away characters such as the percentile during the search, leaving me only with ‘s’ as a search term.
if (!strcmp(context->user, "root"))
msg = g_strdup_printf (_("<b><big>Enter your password to perform"
" administrative tasks</big></b>\n\n"
"The application '%s' lets you "
"modify essential parts of your "
"system."),
command);
The purpose of this piece of code is to provide the text for the dialogue box that the user sees when an application requests superuser privileges on Linux, as can be seen in this screenshot

The %s in this case is the variable that contains the name of the application requesting privileges, but it isn’t as simple as that because I’ve seen the %s used throughout the code in completely different contexts. For example, the else component of the above if statement is
else
msg = g_strdup_printf (_("<b><big>Enter your password to run "
"the application '%s' as user %s"
"</big></b>"),
command, context->user);
and %s is being used to mark the name of both an application and a user. Can someone please tell me what purpose of %s is and where I can find out more information on it’s use? I’m assuming this is a regular expression, but as I said earlier, I can’t Google to find out.
%s is a C format specifier for a string.
means “where you see the first
%s, replace it with the contents ofcommandas a string, and where you see the second%s, replace it with the contents ofcontext->useras a string.