boundary_node_list, a FreeFem++ code which sets up a mesh, and then queries the mesh to produce a list of boundary elements (line segments) and the indices of the nodes that form them.
The information on this web page is distributed under the MIT license.