tools/adflib: build only host variant which is used by Sam440 target
[AROS.git] / workbench / network / stacks / AROSTCP / bsdsocket / kern / amiga_rc.c
blobc1e12dce058aaa6e02fb811191e43b18f9211526
1 #include <conf.h>
3 #include <dos/dostags.h>
4 #include <proto/dos.h>
5 #include <proto/exec.h>
6 #include <kern/amiga_gui.h>
7 #include <kern/amiga_netdb.h>
8 #include <stdio.h>
10 extern UBYTE InitFlags;
11 extern TEXT db_path[];
12 struct Task * AmiTCP_Task;
13 UBYTE RcCommand[FILENAME_MAX];
14 UBYTE RcStartDone = 0;
15 UBYTE RC_Stopped = 1;
17 void SAVEDS rc_start_process(void)
19 BPTR lock, oldcd;
20 struct RcentNode *rc;
22 lock = Lock(db_path, ACCESS_READ);
23 if (lock) {
24 oldcd = CurrentDir(lock);
25 LOCK_R_NDB(NDB);
26 for (rc = (struct RcentNode *)NDB->ndb_Rc.mlh_Head;
27 rc->rn_Node.mln_Succ;
28 rc = (struct RcentNode *)rc->rn_Node.mln_Succ) {
29 snprintf(RcCommand, sizeof(RcCommand), "%s start", rc->rn_Ent);
30 RcCommand[sizeof(RcCommand)-1]=0;
31 Execute(RcCommand, BNULL, BNULL);
32 /* FIXME: Why doesn't SystemTags() doesn't work here?
33 SystemTags(rc->rn_Ent, NP_Arguments, "start", TAG_DONE);*/
35 UNLOCK_NDB(NDB);
36 CurrentDir(oldcd);
37 UnLock(lock);
39 Forbid();
40 InternalProc--;
43 void SAVEDS rc_stop_process(void)
45 BPTR lock, oldcd;
46 struct RcentNode *rc;
48 lock = Lock(db_path, ACCESS_READ);
49 if (lock) {
50 oldcd = CurrentDir(lock);
51 LOCK_R_NDB(NDB);
52 for (rc = (struct RcentNode *)NDB->ndb_Rc.mlh_TailPred;
53 rc->rn_Node.mln_Pred;
54 rc = (struct RcentNode *)rc->rn_Node.mln_Pred) {
55 snprintf(RcCommand, sizeof(RcCommand), "%s stop", rc->rn_Ent);
56 RcCommand[sizeof(RcCommand)-1] = 0;
57 Execute(RcCommand, BNULL, BNULL);
58 /* SystemTags(rc->rn_Ent, NP_Arguments, "stop", TAG_DONE);*/
60 UNLOCK_NDB(NDB);
61 CurrentDir(oldcd);
62 UnLock(lock);
64 Forbid();
65 InternalProc--;
66 RC_Stopped = 1;
67 Signal(AmiTCP_Task, SIGBREAKF_CTRL_F);
71 void rc_start(void)
73 InternalProc++;
74 if (!(CreateNewProcTags(NP_Entry, (IPTR)&rc_start_process,
75 NP_Name, (IPTR)"AROSTCP RC startup",
76 NP_Cli, TRUE,
77 #ifdef __MORPHOS__
78 NP_CodeType, CODETYPE_PPC,
79 #endif
80 TAG_DONE)))
81 InternalProc--;
82 else
83 RC_Stopped = 0;
86 void rc_stop(void)
88 InternalProc++;
89 if (!(CreateNewProcTags(NP_Entry, (IPTR)&rc_stop_process,
90 NP_Name, (IPTR)"AROSTCP RC shutdown",
91 NP_Cli, TRUE,
92 #ifdef __MORPHOS__
93 NP_CodeType, CODETYPE_PPC,
94 #endif
95 TAG_DONE)))
96 InternalProc--;