View previous topic :: View next topic |
Author |
Message |
gsfgf Veteran
Joined: 08 May 2002 Posts: 1266
|
Posted: Wed Dec 04, 2002 9:08 pm Post subject: passing multiline commands w/ system() |
|
|
if i want to call a comamnd like
Code: |
sfdisk /dev/hdc << EOF
0,407
,407
;
;
EOF
|
from the system command in c, how do i do that? _________________ Aim:gsfgf0 |
|
Back to top |
|
|
Mandr4ke Apprentice
Joined: 25 Jul 2002 Posts: 214 Location: Chicago, IL
|
Posted: Fri Dec 06, 2002 11:29 pm Post subject: Re: passing multiline commands w/ system() |
|
|
gsfgf wrote: | if i want to call a comamnd like
Code: |
sfdisk /dev/hdc << EOF
0,407
,407
;
;
EOF
|
from the system command in c, how do i do that? |
Well this is a bit old,, but try:
char cmd[255] = "sfdisk /dev/hdc << EOF 0,407,407;;EOF";
system(cmd);
maybe.... this will work.. |
|
Back to top |
|
|
gsfgf Veteran
Joined: 08 May 2002 Posts: 1266
|
Posted: Sat Dec 07, 2002 2:47 am Post subject: |
|
|
no go, yo, but thanks _________________ Aim:gsfgf0 |
|
Back to top |
|
|
rac Bodhisattva
Joined: 30 May 2002 Posts: 6553 Location: Japanifornia
|
Posted: Sat Dec 07, 2002 8:38 am Post subject: |
|
|
I think you want to fork, open a pipe to the child, exec sfdisk in the child, and print the stuff you want to send to it to the pipe in the parent. _________________ For every higher wall, there is a taller ladder |
|
Back to top |
|
|
gsfgf Veteran
Joined: 08 May 2002 Posts: 1266
|
Posted: Sat Dec 07, 2002 3:25 pm Post subject: |
|
|
rac wrote: | I think you want to fork, open a pipe to the child, exec sfdisk in the child, and print the stuff you want to send to it to the pipe in the parent. |
What's that mean? That was over my head. _________________ Aim:gsfgf0 |
|
Back to top |
|
|
rac Bodhisattva
Joined: 30 May 2002 Posts: 6553 Location: Japanifornia
|
Posted: Sat Dec 07, 2002 8:01 pm Post subject: |
|
|
I haven't done it in C under Unix in a long time, only Perl, so I didn't feel comfortable writing sample code. There is a description of the process in the perlipc man page under "Using open() for IPC". Also, if you have (or can get to a library that has) W. Richard Stevens' Advanced Programming in the UNIX Environment, chapter 8 on process control and chapter 14 on IPC look like they would be of help to you. BTW, are you the author of cursingcow, or is that a separate project? I read something about this new ncurses installer in the works. _________________ For every higher wall, there is a taller ladder |
|
Back to top |
|
|
gsfgf Veteran
Joined: 08 May 2002 Posts: 1266
|
Posted: Sat Dec 07, 2002 11:18 pm Post subject: |
|
|
rac wrote: | BTW, are you the author of cursingcow, or is that a separate project? I read something about this new ncurses installer in the works. |
cursingcow is only for PPC as of now and no changes have been made to the cvs code in a couple of months). There is an anaconda installer in the works, but thet's pretty un-gentooish and unnecessary imo.
Also, i've turned away from interface design to functionality for a while. Basically i want to get all featrues (include automated and network) installs setup in interactive text mode and then either myself or someone better at curses can convert the interface to curses. _________________ Aim:gsfgf0 |
|
Back to top |
|
|
|