// TLegend* l was already defined and drawn
if(l==NULL) return;
TIter next(l->GetListOfPrimitives());
TLegendEntry* le;
UInt_t n = 1;
while((le=(TLegendEntry*)next()))
{
le->SetOption("l");
n++;
}
Just to add something to the absolutely correct answer of ferhue and Benedikt, if you are using a version of ROOT6 you can do
auto primitives = l->GetListOfPrimitives();
for (auto primitiveObj : *primitives){
auto primitive = (TLegendEntry*)primitiveObj;
primitive->SetOption("l");
}