I suppose you would like to rotate accelerograms and then calculate fault parallel and fault normal response spectra. I suggest, before rotating horizontal components, to follow the processing described in Boore and Bommer http://daveboore.com/pubs_online/record_processing_sdee_final.pdf
The rotation of two horizontal components after a coorect processing is quite simple. Here you find a tutorial by Charles Ammon with some matlab code you can easily re-program in C or Fortran. http://eqseis.geosc.psu.edu/~cammon/HTML/UsingMATLAB/PDF/ML1%20Rotation.pdf