//****************************************************************************** //****************************************************************************** // Code disclaimer information //------------------------------------------------------------------------------ // This file contains programming code examples. // // IBM grants you a nonexclusive copyright license to use all programming // code examples from which you can generate similar functions tailored to // your own specific needs. // // All sample code is provided by IBM for illustrative purposes only. // These examples have not been thoroughly tested under all conditions. IBM, // therefore, cannot guarantee or imply reliability, serviceability, or // function of these programs. // // All programs contained herein are provided to you "AS IS" without any // warranties of any kind. The implied warranties of non-infringement, // merchantability, and fitness for a particular purpose are expressly // disclaimed. //****************************************************************************** //****************************************************************************** //-- START OF SPECIFICATIONS ------------------------------------------------ // // Source File Name : resetFID.C // // Module Name : RESETFID // // Program Name : RESETFID // // Source File Description: Source file containing the implementation of // fid table reset program. This is used for the // demo after it's been performed once, but the // demo'er wants to repeat the demo without completely // cleaning up the programs. // // //****** WARNING ***** PLEASE READ ME ****************************************** // USE OF THIS SOURCE CODE IS AT YOUR OWN RISK. // This code is being used in the IFS Journaling Replication demo that was // first used at COMMON in March 2003. This code is NOT a complete replication // solution, and should not be used to provide object or data replication. // It was written to provide a way to demo replication of a small subset of IFS // journal entries using a remote journal on the SAME system. It is being made // available for public browsing as an example what was really involved in // performing some of the steps required in providing IFS object/data // replication. Therefore, some of the code within this demo takes shortcuts // that would not be available in a normal replication environment involving // separate source and target systems. //****************************************************************************** // // Change Activity : // // CFD List : // // FLAG REASON RELEASE DATE PGMR CHANGE DESCRIPTION // ---- --------- ---------- ------ --------- ---------------------------------- // $A0= DEMO xxxx 030129 IBMG8PA: New module // // End CFD List. // // Additional notes about the Change Activity // // End Change Activity. // //------------------------------------------------------------------------------ #include "rplcmn.H" #include "fidtbl.H" #include #include #include //-- START OF FUNCTION SPECIFICATIONS -------------------------------------- // // Function Name : resetFID (main) // // Descriptive Name : Program called by MAINDEMO *RESET to "reset" the // FIDTable in the job. // // Input : // argv[1] - char [10] // Pointer to blank padded string containing the IASP name // that contains the target journal and target directory, since // they will always be one in the same. // This is equivalent to the Primary IASP on the MAINDEMO pgm. //-- END OF SPECIFICATIONS ------------------------------------------------- int main(int argc, char *argv[]) { _SYSPTR usrspcP; usrspcP = getUsrspcPtr(); if (usrspcP == NULL) { // Return succesful here. Might be called when it doesn't exist. return 0; } // Now delete the old FID Table. Shouldn't need to clear out anything else // in the user space, since the constructor should do that. delete ((FIDTable *)setsppfp(usrspcP)); // Figure out what the target path should be like. char targetPath[MAX_PATH_LENGTH]; memset(targetPath,0,sizeof(targetPath)); // If the caller did not pass an IASP name, then use target dir name as-is. if (0 == memcmp(argv[1],"*NONE ",10)) { strcpy(targetPath,TGTDIR); } else // Else, pre-pend the IASP name onto the path. { strcpy(targetPath,"/"); // Starting slash memcpy(&targetPath[1], argv[1], 10); // IASP name char *p = &targetPath[1]; while (p != &targetPath[11] && *p != ' ') { ++p; } // Now p either points to the first blank padding in the IASP name, // or it points beyond the 10 character name meaning the IASP name is // exactly 10 characters. If exactly 10, no need to null-term since // the entire buffer was zero'd. if (p != &targetPath[11]) { *p = 0; // Null term the path } strcat(targetPath,TGTDIR); // target dir, already has beginning slash. } // Construct the fid table in the user space. new(setsppfp(usrspcP)) FIDTable((char *)SRCDIR,targetPath); return(0); }