[GRASSLIST:240] distance function for raster and line coverage

Dear Grasslist Members,
I do have following problem:
I have a binary raster file of several 100s floodplains and a line coverage of corresponding rivers. I would like to join the river file to the floodplains in the way that each floodplain-pixel has the same id-number as the closest river.

Does anybody has some idea how to cope with that?

Thanks in advance
Thomas H.