This program concatenates MIDI files. It uses this framework. In a Unix (or Mac OS X) shell it may be compiled thus:
gcc mcat.c r.c w.c lcm.c -Wall -o ~/bin/mcat
You will need h.h too.
This will add the mcat command to be used thus:
mcat *.mid all.mid
This command concatenates the .mid files in the order shown by the command echo *.mid. The last file name in the command becomes the name of the output file.

This program currently assumes that corresponding tracks in different input files use the same voice (program timbre).