bool CFileExistsDlg::CreateControls() { if (!Load(GetParent(), _T("ID_FILEEXISTSDLG"))) { return false; } wxString localFile = m_pNotification->localFile; wxString remoteFile = m_pNotification->remotePath.FormatFilename(m_pNotification->remoteFile); DisplayFile(m_pNotification->download, localFile, m_pNotification->localSize, m_pNotification->localTime, m_pNotification->localFile); DisplayFile(!m_pNotification->download, remoteFile, m_pNotification->remoteSize, m_pNotification->remoteTime, m_pNotification->remoteFile); xrc_call(*this, "ID_UPDOWNONLY", &wxCheckBox::SetLabel, m_pNotification->download ? _("A&pply only to downloads") : _("A&pply only to uploads")); return true; }
frmHbaConfig::frmHbaConfig(frmMain *parent, pgServer *server) : frmConfig(parent, BACE_TITLE, 0) { wxString applicationname = appearanceFactory->GetLongAppName() + _(" - Configuration Editor"); if (server) conn = server->CreateConn(wxEmptyString, 0, applicationname); Init(); if (conn) { serverFileName = conn->ExecuteScalar(wxT("SHOW hba_file")); if (serverFileName == wxT("unset") || serverFileName.IsEmpty()) serverFileName = wxT("pg_hba.conf"); wxString txt; txt.Printf(_(" - %s on %s (%s:%d)"), serverFileName.c_str(), server->GetDescription().c_str(), server->GetName().c_str(), server->GetPort()); SetTitle(BACE_TITLE + txt); wxString str; str = conn->ExecuteScalar(wxT("SELECT pg_file_read('") + serverFileName + wxT("', 0, ") wxT("pg_file_length('") + serverFileName + wxT("'))")); DisplayFile(str); statusBar->SetStatusText(wxString::Format(_(" Configuration read from %s"), conn->GetHost().c_str())); } }
CMSourceDirector::CMSourceDirector ( CMCommandDirector* commandDir, const JCharacter* fileOrFn, const Type type ) : JXWindowDirector(JXGetApplication()), itsType(type), itsSrcMainCmd(NULL), itsGetAssemblyCmd(NULL) { CMSourceViewDirectorX(commandDir); if (itsType == kAsmType && !JStringEmpty(fileOrFn)) { CMLocation loc; loc.SetFunctionName(fileOrFn); loc.SetMemoryAddress("0x0"); // not allowed to be null DisplayDisassembly(loc); } else if (itsType == kSourceType && JFileReadable(fileOrFn)) { DisplayFile(fileOrFn); } }
void Write(std::vector<char> *Data) { // Write data to end of file m_Stream.write(&(*Data)[0], Data->size()); // Increase position to track how much data has been written m_Position += Data->size(); // Update file progress DisplayFile(m_Filename, m_Position, m_Size); };
VirtScreen::VirtScreen(World * const world_, Player * const player_) : w(world_), player(player_), settings(home_path + "freg.ini", QSettings::IniFormat), previousCommand(settings.value("last_command", "moo").toString()) { connect( w, SIGNAL(Notify(QString)), SLOT(Notify(QString)), Qt::DirectConnection); connect(player, SIGNAL(Notify(QString)), SLOT(Notify(QString)), Qt::DirectConnection); connect(player, SIGNAL(ShowFile(QString)), SLOT(DisplayFile(QString))); connect(player, SIGNAL(GetFocus(int *, int *, int *)), SLOT(ActionXyz(int *, int *, int *)), Qt::DirectConnection); connect( w, SIGNAL(GetString(QString &)), SLOT(PassString(QString &)), Qt::DirectConnection); connect(player, SIGNAL(GetString(QString &)), SLOT(PassString(QString &)), Qt::DirectConnection); connect(player, SIGNAL(Updated()), SLOT(UpdatePlayer()), Qt::DirectConnection); connect(w, SIGNAL(UpdatedAll()), SLOT(UpdateAll()), Qt::DirectConnection); connect(w, SIGNAL(Moved(int)), SLOT(Move(int)), Qt::DirectConnection); connect(w, SIGNAL(Updated(int, int, int)), SLOT(Update(int, int, int)), Qt::DirectConnection); connect(w, SIGNAL(UpdatedAround(int, int, int, int)), SLOT(UpdateAround(int, int, int, int)), Qt::DirectConnection); connect(w, SIGNAL(UpdatesEnded()), SLOT(UpdatesEnd()), Qt::DirectConnection); connect(player, SIGNAL(Destroyed()), SLOT(DeathScreen()), Qt::DirectConnection ); }
//opens a .ben file void CWindow::OpenFile() { OpenedFile = QFileDialog::getOpenFileName(this, tr("Open File"), "", tr("Ben Image Files (*.ben*)")); //if something was actually loaded DisplayFile(); }
void CWindow::OpenedWithFile(const string &file) { OpenedFile = QString::fromAscii(file.data(), file.size()); DisplayFile(); }
void DoMenu(int Type) { int Strlen, i, x; char *sPrompt, *sPromptBak, *temp; sPrompt = calloc(81, sizeof(char)); sPromptBak = calloc(81, sizeof(char)); temp = calloc(81, sizeof(char)); TimeCheck(); switch(Type) { case 0: /* Display Prompt Line Only */ break; case 1: /* Goto another menu */ strncpy(Menus[MenuLevel], menus.OptionalData, 14); break; case 2: /* Gosub another menu */ if (MenuLevel < 49) { MenuLevel++; strncpy(Menus[MenuLevel], menus.OptionalData, 14); } else Syslog('?', "More than 50 menu levels"); break; case 3: /* Return from gosub */ if (MenuLevel > 0) MenuLevel--; break; case 4: /* Return to top menu */ MenuLevel = 0; break; case 5: /* Display .a?? file with controlcodes */ DisplayFile(menus.OptionalData); break; case 6: /* Show menu prompt */ Strlen = strlen(menus.OptionalData); for (x = 0; x < Strlen; x++) { if (menus.OptionalData[x] == '~') { strcat(sPrompt, sUserTimeleft); } else { snprintf(temp, 81, "%c", menus.OptionalData[x]); strcat(sPrompt, temp); } } strcpy(sPromptBak, sPrompt); strcpy(sPrompt, ""); Strlen = strlen(sPromptBak); for (x = 0; x < Strlen; x++) { if (*(sPromptBak + x) == '@') strcat(sPrompt, sAreaDesc); else if (*(sPromptBak + x) == '^') strcat(sPrompt, sMsgAreaDesc); else if (*(sPromptBak + x) == '#') snprintf(sPrompt, 81, "%s%s", sPrompt, (char *) GetLocalHM()); else { snprintf(temp, 81, "%c", *(sPromptBak + x)); strcat(sPrompt, temp); } } if (le_int(menus.ForeGnd) || le_int(menus.BackGnd)) pout(le_int(menus.ForeGnd), le_int(menus.BackGnd), sPrompt); else pout(WHITE, BLACK, sPrompt); break; case 7: /* Run external program */ if (strlen(menus.DoorName) && !menus.HideDoor) { memset(temp, 0, sizeof(temp)); strcpy(temp, menus.DoorName); ExtDoor(menus.OptionalData, menus.NoDoorsys, menus.Y2Kdoorsys, menus.Comport, menus.NoSuid, menus.NoPrompt, menus.SingleUser, temp); } else { ExtDoor(menus.OptionalData, menus.NoDoorsys, menus.Y2Kdoorsys, menus.Comport, menus.NoSuid, menus.NoPrompt, menus.SingleUser, NULL); } break; case 8: /* Show product information */ cr(); break; case 9: /* display todays callers */ LastCallers(menus.OptionalData); break; case 10: /* display userlist */ UserList(menus.OptionalData); break; case 11: /* display time statistics */ TimeStats(); break; case 12: /* page sysop for chat */ Page_Sysop(menus.OptionalData); break; case 13: /* terminate call */ free(sPrompt); free(sPromptBak); free(temp); Good_Bye(FTNERR_OK); break; case 14: /* make a log entry */ LogEntry(menus.OptionalData); break; case 15: /* print text to screen */ if (exitinfo.Security.level >= le_int(menus.MenuSecurity.level)) { for (i = 0; i < strlen(menus.OptionalData); i++) if (*(menus.OptionalData + i) == '@') *(menus.OptionalData + i) = '\n'; snprintf(temp, 81, "%s\r\n", menus.OptionalData); PUTSTR(temp); } break; case 16: /* who's currently online */ WhosOn(menus.OptionalData); Pause(); break; case 17: /* comment to sysop */ SysopComment((char *)"Comment to Sysop"); break; case 18: /* send on-line message */ SendOnlineMsg(menus.OptionalData); break; case 19: /* display Textfile with more */ MoreFile(menus.OptionalData); break; case 20: /* display a?? file with controlcode and wait for enter */ DisplayFileEnter(menus.OptionalData); break; case 21: /* display menuline only */ break; case 22: /* Chat with any user */ Chat(NULL, NULL); break; case 101: FileArea_List(menus.OptionalData); break; case 102: File_List(); break; case 103: ViewFile(NULL); break; case 104: Download(); break; case 105: File_RawDir(menus.OptionalData); break; case 106: KeywordScan(); break; case 107: FilenameScan(); break; case 108: NewfileScan(TRUE); break; case 109: Upload(); break; case 110: EditTaglist(); break; case 111: /* View file in homedir */ break; case 112: DownloadDirect(menus.OptionalData, TRUE); break; case 113: Copy_Home(); break; case 114: List_Home(); break; case 115: Delete_Home(); break; /* 116 Unpack file in homedir */ /* 117 Pack files in homedir */ case 118: Download_Home(); break; case 119: Upload_Home(); break; case 201: MsgArea_List(menus.OptionalData); break; case 202: Post_Msg(); break; case 203: Read_Msgs(); break; case 204: CheckMail(); break; case 205: QuickScan_Msgs(); break; case 206: Delete_Msg(); break; case 207: MailStatus(); break; case 208: OLR_TagArea(); break; case 209: OLR_UntagArea(); break; case 210: OLR_ViewTags(); break; case 211: OLR_RestrictDate(); break; case 212: OLR_Upload(); break; case 213: OLR_DownBW(); break; case 214: OLR_DownQWK(); break; case 215: OLR_DownASCII(); break; case 216: Read_Email(); break; case 217: Write_Email(); break; case 218: Trash_Email(); break; case 219: Choose_Mailbox(menus.OptionalData); break; case 220: QuickScan_Email(); break; case 221: DisplayRules(); break; case 301: Chg_Protocol(); break; case 302: Chg_Password(); break; case 303: Chg_Location(); break; case 305: Chg_VoicePhone(); break; case 306: Chg_DataPhone(); break; case 307: Chg_News(); break; case 309: Chg_DOB(); break; case 310: Chg_Language(FALSE); break; case 311: Chg_Hotkeys(); break; case 312: Chg_Handle(); break; case 313: Chg_MailCheck(); break; case 314: Chg_Disturb(); break; case 315: Chg_FileCheck(); break; case 316: Chg_FsMsged(); break; case 317: Chg_FsMsgedKeys(); break; case 318: Chg_Address(); break; case 319: signature(); break; case 320: Chg_OLR_ExtInfo(); break; case 321: Chg_Charset(); break; case 322: Chg_Archiver(); break; case 401: Oneliner_Add(); break; case 402: Oneliner_List(); break; case 403: Oneliner_Show(); break; case 404: Oneliner_Delete(); break; case 405: Oneliner_Print(); break; default: Enter(1); pout(WHITE, BLACK, (char *) Language(339)); Enter(2); Syslog('?', "Option: %s -> Unknown Menu Type: %d on %s", menus.MenuKey, Type, Menus[MenuLevel]); Pause(); } free(sPrompt); free(sPromptBak); free(temp); }
void CMSourceDirector::Receive ( JBroadcaster* sender, const Message& message ) { if (IsMainSourceWindow() && sender == itsLink && message.Is(CMLink::kDebuggerStarted)) { ClearDisplay(); } else if (sender == itsLink && message.Is(CMLink::kPrepareToLoadSymbols)) { if (!itsCurrentFile.IsEmpty()) // reload file, in case it changed { const JString fileName = itsCurrentFile; const JIndex lineIndex = itsText->HasSelection() ? itsText->GetLineForChar(itsText->GetInsertionIndex()) : itsTable->GetCurrentLine(); itsCurrentFile.Clear(); // force reload DisplayFile(fileName, lineIndex); } } else if (IsMainSourceWindow() && sender == itsLink && message.Is(CMLink::kSymbolsLoaded)) { const CMLink::SymbolsLoaded* info = dynamic_cast<const CMLink::SymbolsLoaded*>(&message); assert( info != NULL ); UpdateWindowTitle(info->GetProgramName()); } else if (IsMainSourceWindow() && sender == itsLink && message.Is(CMLink::kProgramStopped)) { const CMLink::ProgramStopped* info = dynamic_cast<const CMLink::ProgramStopped*>(&message); assert( info != NULL); const CMLocation* loc; const JBoolean hasFile = info->GetLocation(&loc); if (itsType == kMainSourceType && hasFile) { DisplayFile(loc->GetFileName(), loc->GetLineNumber()); } else if (itsType == kMainAsmType && !loc->GetFunctionName().IsEmpty() && !loc->GetMemoryAddress().IsEmpty()) { DisplayDisassembly(*loc); } else if (itsType == kMainAsmType) { // wait for kProgramStopped2 } else { #ifdef _J_OLD_OSX itsTable->SetCurrentLine(0); // we get blank location the first time #else ClearDisplay(); (CMGetCommandDirector())->GetStackDir()->Activate(); #endif } } else if (itsType == kMainAsmType && sender == itsLink && message.Is(CMLink::kProgramStopped2)) { const CMLink::ProgramStopped2* info = dynamic_cast<const CMLink::ProgramStopped2*>(&message); assert( info != NULL); const CMLocation* loc; info->GetLocation(&loc); if (!loc->GetFunctionName().IsEmpty() && !loc->GetMemoryAddress().IsEmpty()) { DisplayDisassembly(*loc); } else { ClearDisplay(); } } else if (sender == itsLink && (message.Is(CMLink::kProgramFinished) || message.Is(CMLink::kCoreCleared) || message.Is(CMLink::kDetachedFromProcess))) { if (itsSrcMainCmd != NULL) { itsSrcMainCmd->CMCommand::Send(); } else if (itsType == kMainAsmType) { ClearDisplay(); } } else if (sender == itsFileMenu && message.Is(JXMenu::kNeedsUpdate)) { UpdateFileMenu(); } else if (sender == itsFileMenu && message.Is(JXMenu::kItemSelected)) { const JXMenu::ItemSelected* selection = dynamic_cast<const JXMenu::ItemSelected*>(&message); assert( selection != NULL ); HandleFileMenu(selection->GetIndex()); } else if (sender == itsDebugMenu && message.Is(JXMenu::kNeedsUpdate)) { itsCommandDir->UpdateDebugMenu(itsDebugMenu, itsText, NULL); } else if (sender == itsDebugMenu && message.Is(JXMenu::kItemSelected)) { const JXMenu::ItemSelected* selection = dynamic_cast<const JXMenu::ItemSelected*>(&message); assert( selection != NULL ); itsCommandDir->HandleDebugMenu(itsDebugMenu, selection->GetIndex(), itsText, NULL); } else if (sender == itsPrefsMenu && message.Is(JXMenu::kNeedsUpdate)) { UpdatePrefsMenu(); } else if (sender == itsPrefsMenu && message.Is(JXMenu::kItemSelected)) { const JXMenu::ItemSelected* selection = dynamic_cast<const JXMenu::ItemSelected*>(&message); assert( selection != NULL ); HandlePrefsMenu(selection->GetIndex()); } else if (sender == itsHelpMenu && message.Is(JXMenu::kItemSelected)) { const JXMenu::ItemSelected* selection = dynamic_cast<const JXMenu::ItemSelected*>(&message); assert( selection != NULL ); HandleHelpMenu(selection->GetIndex()); } else if (sender == CMGetPrefsManager() && message.Is(CMPrefsManager::kFileTypesChanged)) { UpdateFileType(); } else if (sender == CMGetPrefsManager() && message.Is(CMPrefsManager::kCustomCommandsChanged)) { itsCommandDir->AdjustDebugMenu(itsDebugMenu); } else { JXWindowDirector::Receive(sender,message); } }
void Cdodproperror::DisplayLogs() { DisplayFile(LogOutput); DisplayFile(LogError); }
//--------------------------------------------------------- bool Cdodproperror::On_Execute(void) { if (!GetParameterValues()) { return false; } CSG_String TempDirPath = Parameters("TEMP_DIR")->asFilePath()->asString(); LogOutput = SG_File_Make_Path(TempDirPath, CSG_String("out"), CSG_String("txt")); LogError = SG_File_Make_Path(TempDirPath, CSG_String("error"), CSG_String("txt"));; NewDEM_InputPath = SG_File_Make_Path(TempDirPath, CSG_String("newdem"), CSG_String("tif")); OldDEM_InputPath = SG_File_Make_Path(TempDirPath, CSG_String("olddem"), CSG_String("tif")); PropError_InputPath = SG_File_Make_Path(TempDirPath, CSG_String("properror"), CSG_String("tif")); RawDoD_OutputPath = SG_File_Make_Path(TempDirPath, CSG_String("rawdodoutput"), CSG_String("tif")); ThresholdedDoD_OutputPath = SG_File_Make_Path(TempDirPath, CSG_String("threshdodoutput"), CSG_String("tif")); // convert grids to tiffs for command input CSG_Grid* InputGrids [3] = {NewDEM, OldDEM, PropError}; CSG_Strings InputGridPaths = CSG_Strings(); InputGridPaths.Add(NewDEM_InputPath); InputGridPaths.Add(OldDEM_InputPath); InputGridPaths.Add(PropError_InputPath); if (!SaveGridsAsTIFF(InputGrids, InputGridPaths)) { return false; } CSG_Strings OutputGridPaths = CSG_Strings(); OutputGridPaths.Add(RawDoD_OutputPath); OutputGridPaths.Add(ThresholdedDoD_OutputPath); CSG_Strings OutputGridNames = CSG_Strings(); OutputGridNames.Add("Raw DoD"); OutputGridNames.Add("Thresholded DoD"); // delete old output files (GCD throws an error if a file already exists) if (!DeleteFiles(OutputGridPaths)) { return false; } CSG_String CMD = CSG_String::Format(SG_T("\"\"%s\" %s \"%s\" \"%s\" \"%s\" \"%s\" \"%s\" >\"%s\" 2>\"%s\"\""), GCD.c_str(), GCD_CMD.c_str(), NewDEM_InputPath.c_str(), OldDEM_InputPath.c_str(), PropError_InputPath.c_str(), RawDoD_OutputPath.c_str(), ThresholdedDoD_OutputPath.c_str(), LogOutput.c_str(), LogError.c_str()); Message_Add(CSG_String("Executing: ") + CMD); if (system(CMD.b_str()) != 0) { Message_Dlg(CSG_String::Format(SG_T("Error while executing %s, see Execution Log for details"), GCD_CMD.c_str())); DisplayLogs(); return false; } CSG_Grid* OutputGrids [3] = {RawDoD, ThresholdedDoD}; if (!LoadTIFFsAsGrids(OutputGridPaths, OutputGrids, OutputGridNames)) { return false; } Parameters("RAW_DOD")->Set_Value(RawDoD); Parameters("THRESHOLDED_DOD")->Set_Value(ThresholdedDoD); ApplyColors(NewDEM, RawDoD); ApplyColors(NewDEM, ThresholdedDoD); DisplayFile(LogOutput); return true; }
void Good_Bye(int onsig) { FILE *pUsrConfig, *pExitinfo; char *temp; int offset; time_t t_end; int i; IsDoing("Hangup"); temp = calloc(PATH_MAX, sizeof(char)); Syslog('+', "Good_Bye(%d)", onsig); /* * Don't display goodbye screen on SIGHUP and idle timeout. * With idle timeout this will go into a loop. */ if ((onsig != SIGALRM) && (onsig != FTNERR_TIMEOUT) && (hanged_up == 0)) DisplayFile((char *)"goodbye"); SaveLastCallers(); /* * Update the users database record. */ snprintf(temp, PATH_MAX, "%s/etc/users.data", getenv("FTND_ROOT")); if ((pUsrConfig = fopen(temp,"r+")) != NULL) { snprintf(temp, PATH_MAX, "%s/%s/exitinfo", CFG.bbs_usersdir, exitinfo.Name); if ((pExitinfo = fopen(temp,"rb")) != NULL) { fread(&usrconfighdr, sizeof(usrconfighdr), 1, pUsrConfig); fread(&exitinfo, sizeof(exitinfo), 1, pExitinfo); usrconfig = exitinfo; fclose(pExitinfo); usrconfig.iLastFileArea = iAreaNumber; /* If time expired, do not say say successful logoff */ if (!iExpired && !hanged_up) Syslog('+', "User successfully logged off BBS"); usrconfig.iLastMsgArea = iMsgAreaNumber; offset = usrconfighdr.hdrsize + (grecno * usrconfighdr.recsize); if (fseek(pUsrConfig, offset, SEEK_SET) != 0) { WriteError("$Can't move pointer in file %s/etc/users.data", getenv("FTND_ROOT")); } else { fwrite(&usrconfig, sizeof(usrconfig), 1, pUsrConfig); } fclose(pUsrConfig); } } /* * Update mib counters */ t_end = time(NULL); mib_minutes = (unsigned int) ((t_end - t_start) / 60); mib_sessions++; sendmibs(); /* * Flush all data to the user, wait 5 seconds to * be sure the user received all data. */ if ((onsig != SIGALRM) && (onsig != FTNERR_TIMEOUT) && (hanged_up == 0)) { colour(LIGHTGRAY, BLACK); sleep(4); } for (i = 0; i < NSIG; i++) { if (i == SIGCHLD) signal(i, SIG_DFL); else if ((i != SIGKILL) && (i != SIGSTOP)) signal(i, SIG_DFL); } if ((onsig != SIGALRM) && (onsig != FTNERR_TIMEOUT) && (hanged_up == 0)) { cookedport(); } /* * Ignore SIGHUP during hangup. */ signal(SIGHUP, SIG_IGN); hangup(); for (i = 0; i < NSIG; i++) { if ((i == SIGHUP) || (i == SIGPIPE) || (i == SIGBUS) || (i == SIGILL) || (i == SIGSEGV) || (i == SIGTERM)) signal(i, SIG_DFL); } if (do_mailout) CreateSema((char *)"mailout"); t_end = time(NULL); Syslog(' ', "FTNDBBS finished in %s", t_elapsed(t_start, t_end)); sleep(1); /* * Start shutting down this session, cleanup some files. */ socket_shutdown(mypid); snprintf(temp, PATH_MAX, "%s/tmp/ftnd%d", getenv("FTND_ROOT"), getpid()); unlink(temp); snprintf(temp, PATH_MAX, "%s/%s/.quote", CFG.bbs_usersdir, exitinfo.Name); unlink(temp); snprintf(temp, PATH_MAX, "%s/%s/data.msg", CFG.bbs_usersdir, exitinfo.Name); unlink(temp); snprintf(temp, PATH_MAX, "%s/%s/door.sys", CFG.bbs_usersdir, exitinfo.Name); unlink(temp); snprintf(temp, PATH_MAX, "%s/%s/door32.sys", CFG.bbs_usersdir, exitinfo.Name); unlink(temp); snprintf(temp, PATH_MAX, "%s/%s/exitinfo", CFG.bbs_usersdir, exitinfo.Name); unlink(temp); free(temp); unlink("taglist"); Free_Language(); free(pTTY); if (StartTime) free(StartTime); deinitnl(); exit(onsig); }
extern "C" int _cdecl wmain(int argc, WCHAR **argv) { wchar_t *pArg = NULL; wchar_t *szObjName = NULL; ULONG DumpFilter = MDInfo::dumpDefault; HRESULT hr = 0; BOOL fWantHelp=FALSE; if (!PAL_RegisterLibrary(L"rotor_palrt") || !PAL_RegisterLibrary(L"sscoree")) { MDInfo::Error("Unable to register libraries", 1); } // Validate incoming arguments for (int i=1; i<argc; i++) { const wchar_t *szArg = argv[i]; if (*szArg == L'-' || *szArg == L'/') { if (_wcsicmp(szArg + 1, L"?") == 0) fWantHelp=TRUE; else if (_wcsicmp(szArg + 1, L"nologo") == 0) DumpFilter |= MDInfo::dumpNoLogo; else if (_wcsicmp(szArg + 1, L"Hex") == 0) DumpFilter |= MDInfo::dumpMoreHex; else if (_wcsicmp(szArg + 1, L"header") == 0) DumpFilter |= MDInfo::dumpHeader; else if (_wcsicmp(szArg + 1, L"csv") == 0) DumpFilter |= MDInfo::dumpCSV; else if (_wcsicmp(szArg + 1, L"raw") == 0) DumpFilter |= MDInfo::dumpRaw; else if (_wcsicmp(szArg + 1, L"heaps") == 0) DumpFilter |= MDInfo::dumpRawHeaps; else if (_wcsicmp(szArg + 1, L"schema") == 0) DumpFilter |= MDInfo::dumpSchema; else if (_wcsicmp(szArg + 1, L"unsat") == 0) DumpFilter |= MDInfo::dumpUnsat; else if (_wcsicmp(szArg + 1, L"stats") == 0) DumpFilter |= MDInfo::dumpStats; else if (_wcsicmp(szArg + 1, L"assem") == 0) DumpFilter |= MDInfo::dumpAssem; else if (_wcsicmp(szArg + 1, L"validate") == 0) DumpFilter |= MDInfo::dumpValidate; else if (_wcsicmp(szArg + 1, L"obj") == 0) { if (++i == argc) Usage(); else szObjName = argv[i]; } #if PLATFORM_UNIX else if (*szArg == L'/') { // Might be a fully qualifed path pArg = argv[i]; } #endif } else pArg = argv[i]; } // Print banner. if (!(DumpFilter & MDInfo::dumpNoLogo)) PrintLogo(); if (!pArg || fWantHelp) Usage(); CoInitializeCor(0); hr = PAL_CoCreateInstance(CLSID_CorMetaDataDispenser, IID_IMetaDataDispenserEx, (void **) &g_pDisp); if(FAILED(hr)) MDInfo::Error("Unable to CoCreate Meta-data Dispenser", hr); // Loop through all files in the file pattern passed WIN32_FIND_DATA fdFiles; HANDLE hFind; wchar_t szSpec[_MAX_PATH]; wchar_t szDrive[_MAX_DRIVE]; wchar_t szDir[_MAX_DIR]; OnUnicodeSystem(); hFind = WszFindFirstFile(pArg, &fdFiles); if (hFind == INVALID_HANDLE_VALUE) { DisplayFile(pArg, false, DumpFilter, szObjName, DisplayString); } else { // Convert relative paths to full paths. LPWSTR szFname; WszGetFullPathName(pArg, _MAX_PATH, szSpec, &szFname); SplitPath(szSpec, szDrive, szDir, NULL, NULL); do { MakePath(szSpec, szDrive, szDir, fdFiles.cFileName, NULL); // display the meta data of the file DisplayFile(szSpec, true, DumpFilter, szObjName, DisplayString); } while (WszFindNextFile(hFind, &fdFiles)) ; FindClose(hFind); } g_pDisp->Release(); CoUninitializeCor(); return 0; }
void Chg_Password() { char *temp1, *temp2, *args[16]; temp1 = calloc(PATH_MAX, sizeof(char)); temp2 = calloc(PATH_MAX, sizeof(char)); ReadExitinfo(); DisplayFile((char *)"password"); Enter(1); /* Old password: */ language(WHITE, BLACK, 120); colour(CFG.InputColourF, CFG.InputColourB); Getpass(temp1); if (!strcmp(exitinfo.Password, temp1)) { while (TRUE) { Enter(1); /* New password: */ language(LIGHTBLUE, BLACK, 121); colour(CFG.InputColourF, CFG.InputColourB); Getpass(temp1); if((strlen(temp1)) >= CFG.password_length) { Enter(1); /* Confirm new password: */ language(LIGHTBLUE, BLACK, 122); colour(CFG.InputColourF, CFG.InputColourB); Getpass(temp2); if(( strcmp(temp1,temp2)) != 0) { /* Passwords do not match! */ Enter(2); language(LIGHTRED, BLACK, 123); Enter(1); } else { break; } } else { colour(LIGHTRED, BLACK); /* Your password must contain at least %d characters! Try again.*/ snprintf(temp2, PATH_MAX, "\r\n%s%d %s\r\n\r\n", (char *) Language(42), CFG.password_length, (char *) Language(43)); PUTSTR(temp2); } } Syslog('+', "%s/bin/ftnpasswd %s ******", getenv("FTND_ROOT"), exitinfo.Name); snprintf(temp1, PATH_MAX, "%s/bin/ftnpasswd", getenv("FTND_ROOT")); memset(args, 0, sizeof(args)); args[0] = temp1; args[1] = exitinfo.Name; args[2] = temp2; args[3] = NULL; if (execute(args, (char *)"/dev/null", (char *)"/dev/null", (char *)"/dev/null") != 0) { WriteError("Failed to set new Unix password"); } else { memset(&exitinfo.Password, 0, sizeof(exitinfo.Password)); strcpy(exitinfo.Password, temp2); exitinfo.tLastPwdChange = time(NULL); Enter(1); /* Password Change Successful */ language(LIGHTGREEN, BLACK, 124); Syslog('+', "User changed his password"); WriteExitinfo(); } } else { Enter(1); /* Old password incorrect! */ language(LIGHTRED, BLACK, 125); } free(temp1); free(temp2); Enter(2); Pause(); }
void user(void) { FILE *pUsrConfig, *pLimits; int i, x, FoundName = FALSE, iFoundLimit = FALSE, IsNew = FALSE, logins = 0, Start; int l1, l2; char *token, temp[PATH_MAX], temp1[84], UserName[37], buf[128], *fullname; time_t LastLogin; struct stat st; grecno = 0; Syslog('+', "Unixmode login: %s", sUnixName); snprintf(temp, PATH_MAX, "%s/etc/users.data", getenv("FTND_ROOT")); if ((pUsrConfig = fopen(temp,"r+")) == NULL) { /* * This should not happen. */ WriteError("$Can't open %s", temp); PUTSTR((char *)"Can't open userfile, run \"newuser\" first"); Enter(1); ExitClient(FTNERR_OK); } fread(&usrconfighdr, sizeof(usrconfighdr), 1, pUsrConfig); while (fread(&usrconfig, usrconfighdr.recsize, 1, pUsrConfig) == 1) { if (strcmp(usrconfig.Name, sUnixName) == 0) { FoundName = TRUE; break; } else grecno++; } if (!FoundName) { fclose(pUsrConfig); snprintf(temp, PATH_MAX, "Unknown username: %s\r\n", sUnixName); PUTSTR(temp); /* FATAL ERROR: You are not in the BBS users file.*/ snprintf(temp, PATH_MAX, "%s\r\n", (char *) Language(389)); PUTSTR(temp); /* Please run 'newuser' to create an account */ snprintf(temp, PATH_MAX, "%s\r\n", (char *) Language(390)); PUTSTR(temp); Syslog('?', "FATAL: Could not find user in BBS users file."); Syslog('?', " and system is using unix accounts\n"); Free_Language(); ExitClient(FTNERR_OK); } /* * Copy username, split first and lastname. */ strncpy(UserName, usrconfig.sUserName, sizeof(UserName)-1); if ((strchr(UserName,' ') == NULL) && !CFG.iOneName) { token = strtok(UserName, " "); strncpy(FirstName, token, sizeof(FirstName)-1); token = strtok(NULL, "\0"); i = strlen(token); for (x = 2; x < i; x++) { if (token[x] == ' ') token[x] = '\0'; } strncpy(LastName, token, sizeof(LastName)-1); } else strncpy(FirstName, UserName, sizeof(FirstName)-1); strncpy(UserName, usrconfig.sUserName, sizeof(UserName)-1); Syslog('+', "%s On-Line from \"%s\", node %d", UserName, ttyinfo.comment, iNode); IsDoing("Just Logged In"); /* * Check some essential files, create them if they don't exist. */ ChkFiles(); /* * Setup users favourite language. */ utf8 = (usrconfig.Charset == FTNC_UTF8); Set_Language(usrconfig.iLanguage); Free_Language(); InitLanguage(); /* * User logged in, tell it to the server. Check if a location is * set, if Ask User location for new users is off, this field is * empty but we have to send something to the server. */ if (strlen(usrconfig.sLocation)) UserCity(mypid, usrconfig.Name, usrconfig.sLocation); else UserCity(mypid, usrconfig.Name, (char *)"N/A"); /* * Count simultaneous logins */ Start = TRUE; while (TRUE) { if (Start) snprintf(buf, 128, "GMON:1,1;"); else snprintf(buf, 128, "GMON:1,0;"); Start = FALSE; if (socket_send(buf) == 0) { strcpy(buf, socket_receive()); if (strncmp(buf, "100:0;", 6) == 0) break; /* No more data */ if (strstr(buf, "ftnbbs")) { /* * Only ftnbbs is wanted */ strtok(buf, ","); /* response */ strtok(NULL, ","); /* pid */ strtok(NULL, ","); /* tty */ fullname = xstrcpy(cldecode(strtok(NULL, ","))); /* username */ if (strcmp(fullname, usrconfig.Name) == 0) { logins++; } free(fullname); } } } if (CFG.max_logins && (logins > CFG.max_logins)) { Syslog('+', "User logins %d, allowed %d, disconnecting", logins, CFG.max_logins); colour(LIGHTRED, BLACK); snprintf(temp, PATH_MAX, "%s %d %s\r\n", (char *) Language(18), CFG.max_logins, (char *) Language(19)); PUTSTR(temp); Quick_Bye(FTNERR_INIT_ERROR); } /* * Set last file and message area so these numbers are saved when * the user hangs up or is logged off before het gets to the main * menu. Later in this function the areas are set permanent. */ iAreaNumber = usrconfig.iLastFileArea; iMsgAreaNumber = usrconfig.iLastMsgArea; /* * See if this user is the Sysop. */ strcpy(temp, UserName); strcpy(temp1, CFG.sysop_name); if ((strcasecmp(CFG.sysop_name, UserName)) == 0) { /* * If login name is sysop, set SYSOP true */ SYSOP = TRUE; Syslog('+', "Sysop is online"); } /* * Is this a new user? */ if (usrconfig.iTotalCalls == 0) IsNew = TRUE; /* * Pause after logo screen. */ alarm_on(); Pause(); if (usrconfig.Archiver[0] == '\0') { usrconfig.Archiver[0] = 'Z'; usrconfig.Archiver[1] = 'I'; usrconfig.Archiver[2] = 'P'; Syslog('+', "Setup default archiver ZIP"); } /* * Check users date format. We do it strict as we * need this to be good for several other purposes. * If it is correct, the users age is set in UserAge */ if (!Test_DOB(usrconfig.sDateOfBirth)) { Syslog('!', "Error in Date of Birth"); Chg_DOB(); strcpy(usrconfig.sDateOfBirth, exitinfo.sDateOfBirth); } /* * Check to see if user must expire */ snprintf(temp,PATH_MAX, "%s", (char *) GetDateDMY()); SwapDate(temp, usrconfig.sExpiryDate); /* Convert Date1 & Date2 to longs for compare */ l1 = atol(Date1); l2 = atol(Date2); if (l1 >= l2 && l2 != 0) { /* * If Expiry Date is the same as today expire to * Expire Sec level */ usrconfig.Security = usrconfig.ExpirySec; Syslog('!', "User is expired, resetting level"); /* * Show texfile to user telling him about this. */ DisplayFile((char *)"expired"); } free(Date1); free(Date2); /* * Copy limits.data into memory */ snprintf(temp, PATH_MAX, "%s/etc/limits.data", getenv("FTND_ROOT")); if ((pLimits = fopen(temp,"rb")) == NULL) { WriteError("$Can't open %s", temp); } else { fread(&LIMIThdr, sizeof(LIMIThdr), 1, pLimits); while (fread(&LIMIT, sizeof(LIMIT), 1, pLimits) == 1) { if (LIMIT.Security == usrconfig.Security.level) { iFoundLimit = TRUE; break; } } fclose(pLimits); } if (!iFoundLimit) { WriteError("Unknown Security Level in limits.data"); usrconfig.iTimeLeft = 0; /* Could not find limit, so set to Zero */ usrconfig.iTimeUsed = 0; /* Set to Zero as well */ } else { /* * Give user new time limit everyday, also new users get a new limit. */ snprintf(temp,PATH_MAX, "%s", (char *) GetDateDMY()); if (((strcmp(StrDateDMY(usrconfig.tLastLoginDate), temp)) != 0) || IsNew) { /* * If no timelimit set give user 24 hours. */ if (LIMIT.Time) usrconfig.iTimeLeft = LIMIT.Time; else usrconfig.iTimeLeft = 86400; usrconfig.iTimeUsed = 0; /* Set time used today to Zero */ usrconfig.iConnectTime = 0; /* Set connect time to Zero */ /* * Give user new bytes and files every day if needed. */ if (LIMIT.DownK) { usrconfig.DownloadKToday = LIMIT.DownK; } if (LIMIT.DownF) { usrconfig.DownloadsToday = LIMIT.DownF; } } } /* End of else */ usrconfig.iConnectTime = 0; /* Copy Users Protocol into Memory */ Set_Protocol(usrconfig.sProtocol); tlf(usrconfig.sProtocol); /* * Set last login Date and Time, copy previous session * values in memory. */ snprintf(LastLoginDate, 12, "%s", StrDateDMY(usrconfig.tLastLoginDate)); snprintf(LastLoginTime, 9, "%s", StrTimeHMS(usrconfig.tLastLoginDate)); LastLogin = usrconfig.tLastLoginDate; usrconfig.tLastLoginDate = ltime; /* Set current login to current date */ usrconfig.iTotalCalls++; /* * Update user record. */ if (fseek(pUsrConfig, usrconfighdr.hdrsize + (grecno * usrconfighdr.recsize), 0) != 0) { WriteError("Can't seek in %s/etc/users.data", getenv("FTND_ROOT")); } else { fwrite(&usrconfig, sizeof(usrconfig), 1, pUsrConfig); } fclose(pUsrConfig); /* * Write users structure to tmp file in ~/home/unixname/exitinfo * A copy of the userrecord is also in the variable exitinfo. */ if (! InitExitinfo()) Good_Bye(FTNERR_INIT_ERROR); /* * If user has not set a preferred character set, force this */ if (exitinfo.Charset == FTNC_NONE) { Chg_Charset(); } setlocale(LC_CTYPE, getlocale(exitinfo.Charset)); Syslog('b', "setlocale(LC_CTYPE, NULL) returns \"%s\"", printable(setlocale(LC_CTYPE, NULL), 0)); GetLastUser(); StartTime = xstrcpy(GetLocalHM()); ChangeHomeDir(exitinfo.Name, exitinfo.Email); Syslog('+', "User successfully logged into BBS"); Syslog('+', "Level %d (%s), %d mins. left, port %s", exitinfo.Security.level, LIMIT.Description, exitinfo.iTimeLeft, pTTY); Time2Go = time(NULL); Time2Go += exitinfo.iTimeLeft * 60; iUserTimeLeft = exitinfo.iTimeLeft; IsDoing("Welcome screens"); DisplayFile((char *)"mainlogo"); DisplayFile((char *)"welcome"); /* * The following files are only displayed if the user has * turned the Bulletins on. */ if (exitinfo.ieNEWS) { DisplayFile((char *)"welcome1"); DisplayFile((char *)"welcome2"); DisplayFile((char *)"welcome3"); DisplayFile((char *)"welcome4"); DisplayFile((char *)"welcome5"); DisplayFile((char *)"welcome6"); DisplayFile((char *)"welcome7"); DisplayFile((char *)"welcome8"); DisplayFile((char *)"welcome9"); snprintf(temp, PATH_MAX, "%s", (char *) GetDateDMY() ); if ((strcmp(exitinfo.sDateOfBirth, temp)) == 0) DisplayFile((char *)"birthday"); /* * Displays file if it exists DD-MM.A?? */ snprintf(temp, PATH_MAX, "%s", (char *) GetDateDMY()); strcpy(temp1, ""); strncat(temp1, temp, 5); snprintf(temp, PATH_MAX, "%s", temp1); DisplayFile(temp); /* * Displays users security file if it exists */ snprintf(temp, PATH_MAX, "sec%d", exitinfo.Security.level); DisplayFile(temp); /* * Display News file */ DisplayFile((char *)"news"); } /* * Display Onceonly file, first get the date of that * file, search order is the same as in DisplayFile() */ st.st_mtime = 0; snprintf(temp, PATH_MAX, "%s/share/int/txtfiles/%s/onceonly.ans", getenv("FTND_ROOT"), lang.lc); stat(temp, &st); if (st.st_mtime == 0) { snprintf(temp, PATH_MAX, "%s/share/int/txtfiles/%s/onceonly.ans", getenv("FTND_ROOT"), CFG.deflang); stat(temp, &st); } if (st.st_mtime == 0) { snprintf(temp, PATH_MAX, "%s/share/int/txtfiles/%s/onceonly.asc", getenv("FTND_ROOT"), lang.lc); stat(temp, &st); if (st.st_mtime == 0) { snprintf(temp, PATH_MAX, "%s/share/int/txtfiles/%s/onceonly.asc", getenv("FTND_ROOT"), CFG.deflang); stat(temp, &st); } } if ((st.st_mtime != 0) && (LastLogin < st.st_mtime)) DisplayFile((char *)"onceonly"); OLR_SyncTags(); if (exitinfo.MailScan) { IsDoing("New mail check"); CheckMail(); } /* * We don't show new files to new users. */ if (exitinfo.ieFILE && (!IsNew)) { IsDoing("New files check"); NewfileScan(FALSE); } /* * Copy last file Area in to current Area */ SetFileArea(exitinfo.iLastFileArea); /* * Copy Last Message Area in to Current Msg Area */ SetMsgArea(usrconfig.iLastMsgArea); SetEmailArea((char *)"mailbox"); /* * Set or Reset the DoNotDisturb flag, now is the time * we may be interrupted. */ UserSilent(usrconfig.DoNotDisturb); /* * Start the menu. */ menu(); }
int main(int nargs, char **args) { enum OSTYPE OS; enum MACHTYPE mach; int h, i, j, k, verb, asmb, nof77, mhz; int vecexts, ISAX; int ptrbits, l2size; int delay=0; /* change this to come from "special" ints in GetFlags */ int THREADS=0; int Use3DNow=0; /* this needs to come from getflags */ int ncpu, omp, AntThr, lapackref; int USEDEFL1, USEARCHDEF, LATUNE, USEIEEE, USEMINGW; int *tids; #define NPREC 4 char pres[NPREC] = {'s', 'd', 'c', 'z'}; char *targ, *sp, *pmake, *flapack, *ADd; char *comps[3*NCOMP], *comp, *flags, *srcdir, *blddir, *f2cdefs, *cdefs; char *outfile, *smaflags, *dmaflags, *f77lib, *gccflags, *goodgcc; char targarg[256], ln[1024]; FILE *fpout; char *adnames[NARDEF] = {"sKERNDEF", "dKERNDEF", "sMMDEF", "dMMDEF"}; GetFlags(nargs, args, &verb, &OS, (enum ASMDIA*) &asmb, &vecexts, &mach, &mhz, &ptrbits, &ncpu, &tids, &omp, &AntThr, comps, &gccflags, &outfile, &srcdir, &blddir, &USEDEFL1, &USEARCHDEF, &USEIEEE, &LATUNE, &nof77, &lapackref, &f2cdefs, &cdefs, &pmake, &flapack, &smaflags, &dmaflags, &f77lib, &ADd, &l2size, &targ); if (ncpu > 1) THREADS = 1; if (!outfile) fpout = stdout; else fpout = fopen(outfile, "w"); assert(fpout); assert(srcdir && blddir); /* * Update l2size, and set f2cdefs/cdefs if they are null */ if (!l2size) l2size = 4*1024*1024; else l2size *= 1024; if (!f2cdefs) f2cdefs = ""; /* * Append any appended flags, and then we have just compilers and flags */ for (i=2*NCOMP; i < 3*NCOMP; i++) { if (comps[i]) { comps[i-NCOMP] = NewAppendedString(comps[i-NCOMP], comps[i]); free(comps[i]); comps[i] = NULL; } } /* * If any C compiler is unspecified, use it to specify the others * Use DKC preferentially if it is specified */ if (comps[DKC_] && comps[NCOMP+DKC_]) k = DKC_; else { k = -1; for (i=0; i < F77_; i++) { if (comps[i] && comps[NCOMP+i]) { k = i; break; } } if (k < 0) { fprintf(stderr, "Need a valid C compiler and flags\n"); exit(100); } } for (i=0; i < F77_; i++) { if (!comps[i]) comps[i] = comps[k]; if (!comps[NCOMP+i]) comps[NCOMP+i] = comps[NCOMP+k]; } USEMINGW = (OSIsWin(OS) && strstr(comps[GCC_], "mgwgcc")); /* * If F77 compiler unspecified or nof77 asserted, set it to ICC for linking */ if (!comps[F77_] || nof77) { comps[F77_] = comps[ICC_]; comps[NCOMP+F77_] = comps[NCOMP+ICC_]; } /* * Find dominant ISA extension */ ISAX = 0; for (i=1; i < NISA && !ISAX; i++) if (vecexts & (1<<i)) ISAX = i; fprintf(fpout, "# ----------------------------\n"); fprintf(fpout, "# Make.inc for ATLAS3.10.2\n"); fprintf(fpout, "# ----------------------------\n\n"); fprintf(fpout, "# ----------------------------------\n"); fprintf(fpout, "# Make sure we get the correct shell\n"); fprintf(fpout, "# ----------------------------------\n"); fprintf(fpout, " SHELL = /bin/sh\n\n"); fprintf(fpout, "# -------------------------------------------------\n"); fprintf(fpout, "# Name indicating the platform to configure BLAS to\n"); fprintf(fpout, "# -------------------------------------------------\n"); fprintf(fpout, " ARCH = %s", machnam[mach]); fprintf(fpout, "%d", ptrbits); if (ISAX) fprintf(fpout, "%s", ISAXNAM[ISAX]); if (!USEIEEE) fprintf(fpout, "NONIEEE"); fprintf(fpout, "\n\n"); fprintf(fpout, "# ----------------------------\n"); fprintf(fpout, "# Paths to various directories\n"); fprintf(fpout, "# ----------------------------\n"); fprintf(fpout, " BLDdir = %s\n", blddir); fprintf(fpout, " SRCdir = %s\n", srcdir); fprintf(fpout, " INCAdir = $(BLDdir)/include\n"); fprintf(fpout, " INCSdir = $(SRCdir)/include\n"); fprintf(fpout, " BINdir = $(BLDdir)/bin\n"); fprintf(fpout, " LIBdir = $(BLDdir)/lib\n\n"); fprintf(fpout, " SYSdir = $(BLDdir)/tune/sysinfo\n"); fprintf(fpout, " GMMdir = $(BLDdir)/src/blas/gemm\n"); fprintf(fpout, " GMVdir = $(BLDdir)/src/blas/gemv\n"); fprintf(fpout, " GR1dir = $(BLDdir)/src/blas/ger\n"); fprintf(fpout, " L1Bdir = $(BLDdir)/src/blas/level1\n"); fprintf(fpout, " L2Bdir = $(BLDdir)/src/blas/level2\n"); fprintf(fpout, " L3Bdir = $(BLDdir)/src/blas/level3\n"); fprintf(fpout, " TSTdir = $(BLDdir)/src/testing\n"); fprintf(fpout, " AUXdir = $(BLDdir)/src/auxil\n"); fprintf(fpout, " CBLdir = $(BLDdir)/interfaces/blas/C/src\n"); fprintf(fpout, " FBLdir = $(BLDdir)/interfaces/blas/F77/src\n"); fprintf(fpout, " MMTdir = $(BLDdir)/tune/blas/gemm\n"); fprintf(fpout, " MVTdir = $(BLDdir)/tune/blas/gemv\n"); fprintf(fpout, " R1Tdir = $(BLDdir)/tune/blas/ger\n"); fprintf(fpout, " L1Tdir = $(BLDdir)/tune/blas/level1\n"); fprintf(fpout, " L3Tdir = $(BLDdir)/tune/blas/level3\n"); fprintf(fpout, " FLAdir = $(BLDdir)/src/lapack/reference\n"); if (ADd) fprintf(fpout, " ADdir = %s\n", ADd); else fprintf(fpout, " ADdir = $(SRCdir)/CONFIG/ARCHS\n"); fprintf(fpout, "\n"); fprintf(fpout, "# ---------------------------------------------------------------------\n"); fprintf(fpout, "# Name and location of scripts for running executables during tuning\n"); fprintf(fpout, "# ---------------------------------------------------------------------\n"); fprintf(fpout, " ATLRUN = $(BLDdir)/bin/ATLrun.sh\n"); fprintf(fpout, " ATLFWAIT = $(BLDdir)/bin/xatlas_waitfile\n\n"); fprintf(fpout, "# ---------------------\n"); fprintf(fpout, "# Libraries to be built\n"); fprintf(fpout, "# ---------------------\n"); fprintf(fpout, " ATLASlib = $(LIBdir)/libatlas.a\n"); fprintf(fpout, " CBLASlib = $(LIBdir)/libcblas.a\n"); fprintf(fpout, " F77BLASlib = $(LIBdir)/libf77blas.a\n"); fprintf(fpout, " LAPACKlib = $(LIBdir)/liblapack.a\n"); if (THREADS) { fprintf(fpout, " PTCBLASlib = $(LIBdir)/libptcblas.a\n"); fprintf(fpout, " PTF77BLASlib = $(LIBdir)/libptf77blas.a\n"); fprintf(fpout, " PTLAPACKlib = $(LIBdir)/libptlapack.a\n"); } fprintf(fpout, " TESTlib = $(LIBdir)/libtstatlas.a\n\n"); fprintf(fpout, "# -------------------------------------------\n"); fprintf(fpout, "# Upper bound on largest cache size, in bytes\n"); fprintf(fpout, "# -------------------------------------------\n"); fprintf(fpout, " L2SIZE = -DL2SIZE=%d\n\n", l2size); fprintf(fpout, "# ---------------------------------------\n"); fprintf(fpout, "# Command setting up correct include path\n"); fprintf(fpout, "# ---------------------------------------\n"); fprintf(fpout, " INCLUDES = -I$(INCAdir) -I$(INCSdir) -I$(INCSdir)/contrib\n\n"); fprintf(fpout, "# -------------------------------------------\n"); fprintf(fpout, "# Defines for setting up F77/C interoperation\n"); fprintf(fpout, "# -------------------------------------------\n"); fprintf(fpout, " F2CDEFS = %s\n\n", f2cdefs); fprintf(fpout, "# ------------------------------\n"); fprintf(fpout, "# Architecture identifying flags\n"); fprintf(fpout, "# ------------------------------\n"); fprintf(fpout, " ARCHDEFS ="); if (OS != OSOther) fprintf(fpout, " -DATL_OS_%s", osnam[OS]); if (mach != MACHOther) fprintf(fpout, " -DATL_ARCH_%s", machnam[mach]); if (mhz) fprintf(fpout, " -DATL_CPUMHZ=%d", mhz); if (OS == OSSunOS) fprintf(fpout, " -DSUN_HR"); if (OSIsWin(OS)) fprintf(fpout, " -DGCCWIN -DUseClock"); for (i=1; i < NISA; i++) if (vecexts & (1<<i)) fprintf(fpout, " -DATL_%s", ISAXNAM[i]); if (Use3DNow) fprintf(fpout, " -DATL_3DNowFLOPS"); if (ptrbits == 64) fprintf(fpout, " -DATL_USE64BITS"); if (mach == IA64Itan || mach == IA64Itan2 ) fprintf(fpout, " -DATL_MAXNREG=128"); if (asmb != ASM_None) fprintf(fpout, " -DATL_%s", ASMNAM[asmb]); if (mach == IA64Itan2) fprintf(fpout, " -DATL_IntelIccBugs"); /* * Need up update handling of apple vs. gnu gcc for altivec */ if ((ISAX == ISA_AV || ISAX == ISA_VSX) && CompIsGcc(comps[DMC_]) && !CompIsAppleGcc(comps[DMC_])) fprintf(fpout, " -DATL_AVgcc"); fprintf(fpout, "\n\n"); if (tids) { int k; fprintf(fpout, " TIDLIST= -tl %d", ncpu); for (k=0; k < ncpu; k++) fprintf(fpout, " %d", tids[k]); } else fprintf(fpout, "TIDLIST="); fprintf(fpout, "\n\n"); fprintf(fpout, "# -------------------------------------------------------------------\n"); fprintf(fpout, "# NM is the flag required to name a compiled object/executable\n"); fprintf(fpout, "# OJ is the flag required to compile to object rather than executable\n"); fprintf(fpout, "# These flags are used by all compilers.\n"); fprintf(fpout, "# -------------------------------------------------------------------\n"); fprintf(fpout, " NM = -o\n"); fprintf(fpout, " OJ = -c\n\n"); sprintf(ln, "%s/CONFIG/src/CompMake.txt", srcdir); DisplayFile(ln, fpout, 0); fprintf(fpout, " NPROC=%d\n", ncpu); fprintf(fpout, " CDEFS = $(L2SIZE) $(INCLUDES) $(F2CDEFS) $(ARCHDEFS)"); if (!USEIEEE) fprintf(fpout, " -DATL_NONIEEE=1"); /* * Dump -m32/-m64 to CDEFS if it is in normal flags, so that generic flags * given in index files will still work. If the user mixes gcc which mandates * these flags, with other compilers that can't take them, there will be * trouble. */ if (strstr(comps[NCOMP+DKC_], " -m32")) fprintf(fpout, " -m32"); else if (strstr(comps[NCOMP+DKC_], " -m64")) fprintf(fpout, " -m64"); if (cdefs) fprintf(fpout, " %s", cdefs); if (THREADS) { fprintf(fpout, " -DATL_NCPU=$(NPROC)"); if (OS == OSFreeBSD) fprintf(fpout, " -D_THREAD_SAFE -D_REENTRANT"); if (OS == OSAIX) fprintf(fpout, " -DIBM_PT_ERROR"); if (OS == OSIRIX) fprintf(fpout, " -D_POSIX_C_SOURCE=199506L"); if (AntThr) fprintf(fpout, " -DATL_TRUST_ANTPT"); else if (omp) fprintf(fpout, " -DATL_OMP_THREADS"); if (AntThr > 1) fprintf(fpout, " -DATL_ANTOINE_THREADS"); } if (delay) fprintf(fpout, " -DATL_FOPENDELAY"); fprintf(fpout, "\n\n"); for (i=0; i < NCOMP; i++) { fprintf(fpout, " %s = %s\n", COMPNAME[i], comps[i]); if (i == F77_) fprintf(fpout, " %sFLAGS = %s\n", COMPNAME[i], comps[NCOMP+i]); else if (i == ICC_ || i == XCC_) fprintf(fpout, " %sFLAGS = $(CDEFS) %s\n", COMPNAME[i], comps[NCOMP+i]); else /* non-interf comps don't include CDEFS by default (added later) */ fprintf(fpout, " %sFLAGS = %s\n", COMPNAME[i], comps[NCOMP+i]); } fprintf(fpout, " F77NOOPT = $(F77FLAGS) -O0 # turn off optimization\n"); fprintf(fpout, " SMAFLAGS ="); if (smaflags) fprintf(fpout, " %s", smaflags); fprintf(fpout, "\n DMAFLAGS ="); if (dmaflags) fprintf(fpout, " %s", dmaflags); fprintf(fpout, "\n"); fprintf(fpout, " CKC = $(SKC)\n"); fprintf(fpout, " ZKC = $(DKC)\n"); fprintf(fpout, " sKCFLAGS = $(CDEFS) $(SKCFLAGS)\n"); fprintf(fpout, " dKCFLAGS = $(CDEFS) $(DKCFLAGS)\n"); fprintf(fpout, " cKCFLAGS = $(CDEFS) $(SKCFLAGS)\n"); fprintf(fpout, " zKCFLAGS = $(CDEFS) $(DKCFLAGS)\n"); for (i=0; i < NCOMP; i++) { if (i == XCC_) continue; /* do not accept cross-compiler */ j = strlen(comps[i]); if (j >= 3 && comps[i][j-3] == 'g' && comps[i][j-2] == 'c' && comps[i][j-1] == 'c') break; } goodgcc = (i < NCOMP) ? comps[i] : "gcc"; fprintf(fpout, " GOODGCC = %s", goodgcc); if (gccflags) fprintf(fpout, " %s", gccflags); GetGccVers(goodgcc, &i, &j, &k, &k); if (OSIsWin(OS) && ptrbits != 64) /* stop gcc breaking ABI */ fprintf(fpout, " -mstackrealign"); sp = GetPtrbitsFlag(OS, mach, ptrbits, goodgcc); if (strlen(sp) > 0) fprintf(fpout, " %s", sp); #ifdef ATL_DYLIBS if (!OSIsWin(OS)) fprintf(fpout, " -fPIC"); #endif fprintf(fpout, "\n"); fprintf(fpout, " KC = $(DKC)\n KCFLAGS = $(CDEFS) $(DKCFLAGS)\n"); fprintf(fpout, " LDFLAGS ="); if (MachIsX86(mach)) { if (OSIsWin(OS)) fprintf(fpout, " -mi386pe"); else { if (ptrbits == 32) fprintf(fpout, " -melf_i386"); else if (ptrbits == 64) fprintf(fpout, " -melf_x86_64"); if (OS == OSFreeBSD) fprintf(fpout, "_fbsd"); } } if (MachIsS390(mach)) fprintf(fpout, ptrbits == 32 ? "-m31" : "-m64"); fprintf(fpout, "\n F77SYSLIB = %s\n", f77lib ? f77lib : ""); fprintf(fpout, " BC = $(KC)\n"); fprintf(fpout, " NCFLAGS = $(KCFLAGS)\n"); fprintf(fpout, "\n CLINKER = $(KC)\n CLINKFLAGS = $(KCFLAGS)\n"); fprintf(fpout, " FLINKER = $(F77)\n"); if (strstr(comps[F77_], "mgwgfortran")) fprintf(fpout, " FLINKFLAGS = $(F77FLAGS) -static\n"); else fprintf(fpout, " FLINKFLAGS = $(F77FLAGS)\n"); fprintf(fpout, " FCLINKFLAGS = $(FLINKFLAGS)"); if (strstr(comps[F77_], "ifort") && !OSIsWin(OS)) fprintf(fpout, " -nofor_main"); if (USEMINGW) fprintf(fpout, "\n ARCHIVER = $(BLDdir)/mgwar\n"); else fprintf(fpout, "\n ARCHIVER = ar\n"); fprintf(fpout, " ARFLAGS = r\n"); /* * JF Mertens says that even x86 OS X still need ranlib for safety */ if (OS == OSOSX) fprintf(fpout, " RANLIB = ranlib\n\n"); else if (USEMINGW) fprintf(fpout, " RANLIB = $(BLDdir)/mgwranlib\n\n"); else fprintf(fpout, " RANLIB = echo\n\n"); fprintf(fpout, "# -------------------------------------\n"); fprintf(fpout, "# tar, gzip, gunzip, and parallel make\n"); fprintf(fpout, "# -------------------------------------\n"); fprintf(fpout, " TAR = tar\n"); fprintf(fpout, " BZIP = bzip2\n"); fprintf(fpout, " BUNZIP = bunzip2\n"); fprintf(fpout, " PMAKE = %s\n\n", pmake ? pmake : "$(MAKE)"); /* * Need to add libs to GetFlags and update GetSysLib to do this right */ fprintf(fpout, "# ------------------------------------\n"); fprintf(fpout, "# Reference and system libraries\n"); fprintf(fpout, "# ------------------------------------\n"); fprintf(fpout, " FBLASlib = $(LIBdir)/libf77refblas.a\n"); fprintf(fpout, " FLAPACKlib = "); if (flapack) fprintf(fpout, "%s", flapack); else if (lapackref) fprintf(fpout, "$(FLAdir)/lapack_$(ARCH).a"); fprintf(fpout, "\n"); fprintf(fpout, " SBLASlib = $(FBLASlib) # should be serial sysblas\n"); fprintf(fpout, " BLASlib = $(FBLASlib) # should be parallel sysblas\n"); fprintf(fpout, " SLAPACKlib = # set to parallel system lapack\n"); fprintf(fpout, " SSLAPACKlib = # set to serial system lapack\n"); if (THREADS) { if (OSIsWin(OS)) fprintf(fpout, " LIBS = -lkernel32 -lm\n\n"); else fprintf(fpout, " LIBS = -lpthread -lm\n\n"); } else fprintf(fpout, " LIBS = -lm\n\n"); fprintf(fpout, "# --------------------------------------------------------------------\n"); fprintf(fpout, "# Compiler names for architectural defaults and flags to atlas_install\n"); fprintf(fpout, "# --------------------------------------------------------------------\n"); for (i=0; i < NCOMP; i++) { sp = NewStringCopy(COMPNAME[i]); for (j=0; sp[j]; j++) sp[j] = tolower(sp[j]); fprintf(fpout, " %sD = ", sp); free(sp); /* * Regardless of actual names, use standard gnu compiler names for defs */ if (CompIsGcc(comps[i])) { if (i == F77_) { GetGccVers(comps[i], &k, &j, &k, &k); if (j < 4) sp = NewStringCopy("g77"); else sp = NewStringCopy("gfortran"); } else sp = NewStringCopy("gcc"); } else { sp = NameWithoutPath(comps[i]); if (!strncmp(sp, "ATLwin_", 7)) sp = NewStringCopy(comps[i]+7); } fprintf(fpout, "%s\n", sp); free(sp); } fprintf(fpout, " INSTFLAGS = -1 %d -a %d -l %d\n\n", USEDEFL1, USEARCHDEF, LATUNE); fprintf(fpout, "# -------------------------------------------------------------------\n"); fprintf(fpout, "# Dependence info for building optional external threading interfaces\n"); fprintf(fpout, "# -------------------------------------------------------------------\n"); for (i=0; i < NPREC; i++) { fprintf(fpout, " %cextthr =", pres[i]); if (AntThr) fprintf(fpout, " %cpt", pres[i]); fprintf(fpout, "\n"); } fprintf(fpout, "# ---------------------------------------\n"); fprintf(fpout, "# Generic targets needed by all makefiles\n"); fprintf(fpout, "# ---------------------------------------\n"); fprintf(fpout, "do_it: all\n"); if (delay) { fprintf(fpout, " waitfile = wfdefault\n"); fprintf(fpout, "waitfile:\n\tcd $(BINdir) ; $(MAKE) xatlas_waitfile\n"); fprintf(fpout, "\t$(ATLFWAIT) -s %d -f $(waitfile)\n", delay); } else fprintf(fpout, "waitfile:\n"); if (fpout != stdout && fpout != stderr) fclose(fpout); return(0); }