Okay, I've read through the GNU Free Documentation License a couple of times now and I can say categorically that anyone who licences their work using this document is actually asking for you to reproduce their code in your book as a means of publicising their work.
The licence is not intended for people who wish to incorporate their code into software but is intended for people who wish to use a text version of their code (as you will be doing).
The important thing is to follow the instructions in the section: 'How to use this License for your documents' to ensure that you give credit where credit is due. Other than that, you're good to go.
I'm not a lawyer, but I am a smart enough guy with a couple of years in software development, a degree in Computing with Psychological Studies (so I knows my software) and half a Masters in Creative Writing (so I knows how to read and write).
Good luck with your book, GP.