int main(struct ExecBase * SysBase, struct Library * DOSBase) { LONG rc = RETURN_FAIL; BPTR sseq = Open("S:Startup-Sequence", FMF_READ); BPTR cis = Open("CON:20/20///Boot Shell/AUTO", FMF_READ); if (cis) { struct TagItem tags[] = { { SYS_Asynch, TRUE }, { SYS_Background, FALSE }, { SYS_Input, (IPTR)cis }, { SYS_Output, (IPTR)NULL }, { SYS_Error, (IPTR)NULL }, { SYS_ScriptInput, (IPTR)sseq }, { TAG_DONE, 0 } }; rc = SystemTagList("", tags); if (rc != -1) { cis = NULL; sseq = NULL; } else rc = RETURN_FAIL; } else { PutStr(CANNOT_OPEN_CON); } Close(cis); Close(sseq); return rc; }
int system(const char *string) { static struct TagItem notags[]={ { TAG_END,0 } }; if(!string) return 1; else return SystemTagList((char *)string,notags); }
int system(const char *string) { static struct TagItem notags[]={ { TAG_END,0 } }; if(string == NULL) { errno = EINVAL; return -1; } if (((struct Library *)DOSBase)->lib_Version >= 36) return SystemTagList((char *)string, notags); else return (int)~Execute((STRPTR)string, 0l, Output()); }
// Save settings void font_save_settings(font_data *data) { char buf[80]; // Set busy pointer SetWindowBusy(data->window); // Build settings string lsprintf(buf,"%ld/%ld/%ld/%ld\n", data->window->LeftEdge, data->window->TopEdge, data->window->GZZWidth, data->window->Height-data->window->BorderTop-2); // Set variable if (SetVar("dopus/Font Viewer",buf,-1,GVF_GLOBAL_ONLY)) { // Copy to ENVARC: SystemTagList("copy \"env:dopus/Font Viewer\" envarc:dopus",0); } // Clear busy pointer ClearWindowBusy(data->window); }
/* send a message to an AREXX port. */ static int ADDRESS (const char *hostname, const char *cmd) { struct MsgPort *RexxPort, *ReplyPort; struct RexxMsg *HostMsg, *answer; int result = RC_WARN; if (!stricmp (hostname, "COMMAND")) return SystemTagList(cmd,NULL); if ((RexxPort = (void *)FindPort (hostname))) { if ((ReplyPort = (void *)CreateMsgPort ())) { if ((HostMsg = CreateRexxMsg (ReplyPort, NULL, hostname))) { unsigned int len = strlen (cmd); /* holger: trick for powerup */ if ((HostMsg->rm_Args[0] = CreateArgstring ((char *)cmd, len))) { HostMsg->rm_Action = RXCOMM | RXFF_RESULT; PutMsg (RexxPort, (void*)HostMsg); WaitPort (ReplyPort); while (!(answer = (void *)GetMsg (ReplyPort))); result = answer->rm_Result1; if (result == RC_OK) { if (answer->rm_Result2) { strncpy (RESULT,(char *)answer->rm_Result2, RESULT_LEN); DeleteArgstring ((char *)answer->rm_Result2); } else RESULT[0] = '\0'; } DeleteArgstring (HostMsg->rm_Args[0]); } else strcpy (RESULT, "Can't create argstring!"); DeleteRexxMsg (HostMsg); } else strcpy (RESULT, "Can't create rexx message!"); DeleteMsgPort (ReplyPort); } else strcpy (RESULT, "Can't alloc reply port!"); } else sprintf (RESULT, "Port \"%s\" not found!", hostname); return result; }
int main(int argc, char **argv) { LONG rc = RETURN_FAIL; STRPTR filename, commandLine = NULL, ixWindow = DEFWINDOW; LONG ixWait = 0, ixStack = DEFSTACK; BOOL ixUShell = DEFUSHELL; BPTR oldlock = (BPTR)-1, dirlock = (BPTR)-1, window = NULL; struct DiskObject *dobj = NULL; D(bug("IconX argc %d\n", argc)); if (argc != 0) { displayMsg(ERROR_REQUIRED_ARG_MISSING); goto exit; } struct WBStartup *startup = (struct WBStartup *) argv; if (startup->sm_NumArgs < 2) { displayMsg(ERROR_REQUIRED_ARG_MISSING); goto exit; } D(bug("[IconX] startup->sm_NumArgs: %d\n", startup->sm_NumArgs)); dirlock = startup->sm_ArgList[1].wa_Lock; filename = startup->sm_ArgList[1].wa_Name; oldlock = CurrentDir(dirlock); /* query diskobject for tooltypes */ dobj = GetDiskObject(filename); if (dobj == NULL) { struct EasyStruct es = {sizeof(struct EasyStruct), 0, "Error", "IconX\nGetDiskObject failed for:\n%s", "OK"}; EasyRequest(0, &es, 0, filename); goto exit; } if (dobj->do_Type == WBPROJECT) { const STRPTR *toolarray = (const STRPTR *)dobj->do_ToolTypes; STRPTR s; if ((s = FindToolType(toolarray, "WINDOW"))) { ixWindow = s; } if ((s = FindToolType(toolarray, "STACK"))) { ixStack = atol(s); } if ((s = FindToolType(toolarray, "USERSHELL"))) { if (MatchToolValue(s, "NO")) { ixUShell = FALSE; } } if ((s = FindToolType(toolarray, "WAIT"))) { ixWait += atol(s) * 50; } if ((s = FindToolType(toolarray, "DELAY"))) { ixWait += atol(s); } } else { displayMsg(ERROR_OBJECT_WRONG_TYPE); goto exit; } if (ixWait <= 0) ixWait = DEFWAIT; if (ixStack <= 4096) ixStack = DEFSTACK; D(bug("wait %d stack %d usershell %d window %s\n", ixWait, ixStack, ixUShell, ixWindow)); D(bug("Building command line\n")); commandLine = BuildCommandLine(startup); if (commandLine == NULL) { displayMsg(IoErr()); goto exit; } D(bug("[IconX] commandLine: '%s'\n", commandLine)); window = Open(ixWindow, MODE_OLDFILE); if (window == NULL) { /* try to open default window */ window = Open(DEFWINDOW, MODE_OLDFILE); } if (window) { D(bug("[IconX] window ok\n")); struct TagItem tags[] = { { SYS_Asynch, FALSE }, { SYS_Background, TRUE }, { SYS_Input, (IPTR)window }, { SYS_Output, (IPTR)NULL }, { SYS_Error, (IPTR)NULL }, { SYS_UserShell, ixUShell }, { NP_StackSize, ixStack }, { TAG_DONE, 0 } }; rc = SystemTagList(commandLine, tags); if (rc == -1) { displayMsg(IoErr()); rc = RETURN_FAIL; } } else { displayMsg(IoErr()); goto exit; } Delay(ixWait); rc = RETURN_OK; exit: Close(window); FreeDiskObject(dobj); if (oldlock != (BPTR)-1) CurrentDir(oldlock); return rc; }