Shaping carbon nanostructures by controlling the synthesis process