|
Register or have you forgotten your password?
|
|
|
| Amiga OS -- Development This particular forum deals with issues regarding development for all versions of AmigaOS. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 | ||||||||
|
Technoid
![]()
Join Date: Feb 2003
Posts: 414
|
hi all. i have little question about ctrl+c and 'break' handling. sas/c compiler used. so:
main() { while(1) { if (CheckSignal(SIGBREAKF_CTRL_C)) {exit(0);}; } } if i press ctrl+c in cli, all ok, and 'status' command said that not load program. but if i kill my programm by 'break' command, 'status' said: Proccess 1: No command loaded. but anyway process present. how i must handler 'break' in my whyle loop for good killing by 'break' ? |
||||||||
|
|
|
|
|
#2 | ||||||||
|
Kindred of Babble-on
![]()
Join Date: Jun 2002
Posts: 2,925
|
I hope your real code dosn't busy-wait like the fragment above. Well, which AmigaOS and which compiler do you use ? What does your CheckSignal function do ? Did you free all AmigaOS resources before you exit() ? Exit() only frees ANSI C resources (malloc and similar). How did you start the program ? E.g. if you opened two Shell windows, one for your programm and another one for the Break command, after the break your program returns to the Shell, but the Shell window is still there, so the "no command loaded" is correct. The process only disappears if you end the Shell. To strip down your code fragment to the essential and to make it system-friendly, it should look like this: #include <proto/exec.h> #include <dos/dos.h> int main (void) { Wait (SIGBREAKF_CTRL_C); return (0); } Bye, Thomas |
||||||||
|
|
|
|
|
#3 | ||||||||
|
Technoid
![]()
Join Date: Feb 2003
Posts: 414
|
>I hope your real code dosn't busy-wait like the fragment above.
i recv() from socket in while. and test on ctrl+c: while(recv(.....)) { ......... ctrl+c(); ......... } >Well, which AmigaOS and which compiler do you use ? 3.9bb2, sasc/vbcc. >What does your CheckSignal function do ? it's not my, it's from dos.library(): NAME CheckSignal -- Checks for break signals (V36) FUNCTION This function checks to see if any signals specified in the mask have been set and if so, returns them. Otherwise it returns FALSE.All signals specified in mask will be cleared. i don't now, who preferred Wait() or CheckSignal().. btw, thnx for answer, it was 2 open shells so, all is ok.btw, maybe you know what i can redirect all 'cli' output to file or memory ? i mean: char buf[500]; SystemTags("newcli",???); // cli start, but output redirect // to buf[]; ? |
||||||||
|
|
|
|
|
#4 | ||||||||||
|
' union select name,pwd--
Join Date: Aug 2002
Location: Helsinki, Finland
Posts: 6,946
|
Quote:
Quote:
|
||||||||||
|
|
|
|
|
#5 | ||||||||
|
Technoid
![]()
Join Date: Feb 2003
Posts: 414
|
i can create tmp file in memory ? i mean, i not want create file on hdd. (in ram: too, becouse name of file will be anyway). maybe here is some flag for 'memory file' ?
|
||||||||
|
|
|
|
|
#6 | ||||||||
|
Kindred of Babble-on
![]()
Join Date: Jun 2002
Posts: 2,925
|
No, you cannot create a file in memory. RAM: or PIPE: are the only possibilities. You can use the task pointer to make the file name unique. Something like this: char tempfilename[30]; BPTR tempfile; sprintf (tempfilename,"t:tempfile%x",FindTask(NULL)); tempfile = Open(tempfilename,MODE_NEWFILE); Execute ("command",NULL,tempfile); Close (tempfile); Open (tempfile,MODE_OLDFILE); bytes_read = Read (tempfile,buffer,buffersize); Close (tempfile); Delete (tempfilename); Bye, Thomas |
||||||||
|
|
|
![]() |
| Bookmarks |
| Tags |
| break , ctrl , signal |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Ctrl A-A Diagnostic Screen | AndyC | Amiga Hardware Issues and discussion | 5 | 02-26-2009 01:46 PM |
| problem with CTRL+C combo? | daniel_swe | Amiga Software Issues and Discussion | 4 | 02-13-2009 10:02 AM |
| Amterm break signal? | MrZammler | Amiga Software Issues and Discussion | 0 | 05-10-2005 07:29 AM |
| Christina Applegate REALLY Break A Leg | asian1 | CH / Entertainment | 0 | 03-13-2005 04:08 PM |
| Break It Down Again | MiAmigo | Amiga Software Issues and Discussion | 12 | 12-27-2004 01:31 PM |