|
||||||
| Forums FAQ | Members List | Search | Today's Posts | Mark Forums Read |
| ARCHIVES - Programming & Scripting A place to discuss website design, programming, shell scripts, etc |
|
|
|
LinkBack | Thread Tools | Display Modes |
|
|||
|
This is a question that I have been wondering about since I first started using Linux, maybe 6 years ago. In KDE or GNOME control panels, preferences etc, I often see apps coded to start like this;
firefox %s or thunderbird %u What do those command extensions do? In other words what specifically does %s do and where can I find a list of all such extra control characters/extensions(if that's what you call them) |
|
|||
|
Hi Harryc,
No aswer on your otherwise interresting query. I've tried to find some logic in the parameters passed between various programs, but cannot find any either. Tried to find something on the net, but no luck. Thumbed through my (old and new) unix/Linux books, but nothing there either. There are some references to % type varable substitutions in AWK and such, but nothing I can point to as a standard. In programs like Firefox, Thunderbird, the parameters passed do not rely on a standard character such as a % sign. The parameters passed depend an a so-called calling convention, that is defined as a standard when a compiler such as C, C++ is called. For C C++ in Linux, tnat is : Arguments are pushed on the stack in reverse order. The caller pops arguments after return. Primitive data types, except floating point values, are returned in EAX or EAX:EDX depending on the size. float and double are returned in fp0, i.e. the first floating point register. All structures and classes are returned in memory regardless of complexity or size. When a return is made in memory the caller passes a pointer to the memory location as the first parameter (hidden). The callee populates the memory, and returns the pointer. The callee pops the hidden pointer from the stack when returning. Classes that have a destructor are always passed by reference, even if the parameter is defined to be by value. But here are others. But the main thing is, this is what a program expects when it's called. Bob |
|
|||
|
They are not extensions in firefox, etc, but rather a feature in the KDE/GNOME launcher which allows substitutions to be passed to the invoked program. It's as if you called the program from the CLI with those arguments. I think %u is the name of the logged in user, etc. Unfortunately I can't find a reference to them, this sort of thing is hard to google for if you don't know what terms to use.
|
|
|||
|
Thanks bobbyn and ken_yap. I had figured that these options passed something to the program they invoked. I appreciate the information. If anyone comes up with a list of what they are/do, that would be great.
|
|
|||
|
Is it possible that the argument for Firefox has something to do with the URL or Html file that it should load instead of the %s ?
It seems to me that these are some kinds of special symbols that take a certain argument. For example, in the SuSe menu, Kfind takes the option %f ... And if you press Alt+F2 and type "Kfind Videos" than it looks inside file:///home/Darkelve/Videos . So for Kfind it seems to be a placeholder for a directory name. When you press Alt+F2 and type "firefox www.userfriendly.org" then it takes that argument and loads that website. Thunderbird might use %u it to open links from Firefox, or something similar. It is hard to find any information about this, since I don't know how I can escape special characters (%) in Google... I *think* these symbols are replaced by whatever input is given to the program. But, I'm not sure of it. It's more like I'm speculating about it. |
|
|||
|
Quote:
|
|
|||
|
Well, if you're really interrested, you could download the source for Firefox/Thunderbird. The parameters passed to a program are picked up right at the main() entry point. argc[] contains the number of params and argv[] contains the actual parameters (argv[0] contains the name of the program called). A simple printf statement can show tha actual parameters. I doubt you'd like to go that far, there seems to be no systemwide standard.
Bob |
|
|||
|
I don't think the code's in Firefox. The substitutions will have already been made by then. It's more likely to be in the launcher.
|
|
|||
|
Ah yes,
But with my method you could display what was subtituted Bob |
|
|||
|
Answers for this appear hard to come by, I searched around a bit and found the following that explain bits and pieces.
Maybe it will help give more detail on what to search for anyway. <_< UbuntuForums KDE-Forum Good Luck, Greg |
|
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|