Since the partition/slice names do vary in length, check the length of the fixed part of the line against 3 * 8, if the lenth is less than 3 tab stops, print out extra tab. use snprintf() instead of sprintf.