The p T spectrum in heavy-flavour hadroproduction