Skip to contentSkip to conversation

How to call a command from another one

DISCUSSION adrian15 3 participants 4 messages Jun 12, 2007

lore
Share & tools
lore

adrian15

author
#0 lore raw

Hi,

I want to implement the pause command so that it is the same thing as
the echo command with all of its options and also that it stops.

My first approach which I could not compile because I do not how to add
a new command to grub2 is the following one:

  char key;
  if (argc!=0)
    grub_cmd_echo(state,argc,args);
  key = grub_getkey ();

return 0;

So my question is if it's an orthodox way of calling another command, if I should call it in another way or if I should not call it in any way.

adrian15

#1 lore raw
Quoted 15 lines · On Tue, Jun 12, 2007 at 01:57:11PM +0200, adrian15 wrote:

Hi,

I want to implement the pause command so that it is the same thing as
the echo command with all of its options and also that it stops.

My first approach which I could not compile because I do not how to add
a new command to grub2 is the following one:

  char key;
  if (argc!=0)
    grub_cmd_echo(state,argc,args);
  key = grub_getkey ();
Quoted 6 lines

return 0;

So my question is if it's an orthodox way of calling another command, if I should call it in another way or if I should not call it in any way.

I don't know how to call other commands, but in this case, maybe grub_printf() will be good enough?

Signature · 4 lines
Robert Millan

My spam trap is [email protected].  Note: this address is only intended
for spam harvesters.  Writing to it will get you added to my black list.
author
#2 lore raw
Quoted 7 lines · Robert Millan
Quoted 4 lines · On Tue, Jun 12, 2007 at 01:57:11PM +0200, adrian15 wrote:

Hi,

I want to implement the pause command so that it is the same thing as
the echo command with all of its options and also that it stops.

I don't know how to call other commands, but in this case, maybe grub_printf() will be good enough?

I agree with you but...

I think it would be a good idea to have a pause message that has the same options as the echo command because the echo command has some nice options and because I like to reuse code.

adrian15

#3 lore raw
Quoted 6 lines · adrian15 <[email protected]> writes:
Quoted 5 lines · Robert Millan
Quoted 4 lines · On Tue, Jun 12, 2007 at 01:57:11PM +0200, adrian15 wrote:

Hi,

I want to implement the pause command so that it is the same thing as
the echo command with all of its options and also that it stops.

Quoted 8 lines
Quoted 2 lines

I don't know how to call other commands, but in this case, maybe grub_printf() will be good enough?

I agree with you but...

I think it would be a good idea to have a pause message that has the same options as the echo command because the echo command has some nice options and because I like to reuse code.

Make them share the same file. Call grub_cmd_echo with the same arguments which are used for pause. Before and after that you can do whatever you want. The disadvantage of this approach is that the set of arguments should be the same.

--
Marco