The question on the highlighted sentence from this excerpt from L'Étranger by Camus.
En mangeant, il a commencé à me raconter son histoire. Il hésitait d’abord un peu. « J’ai connu une dame… c’était pour autant dire ma maîtresse. » L’homme avec qui il s’était battu était le frère de cette femme. Il m’a dit qu’il l’avait entretenue. Je n’ai rien répondu et pourtant il a ajouté tout de suite qu’il savait ce qu’on disait dans le quartier, mais qu’il avait sa conscience pour lui et qu’il était magasinier.
« Pour en venir à mon histoire, m’a-t-il dit, je me suis aperçu qu’il y avait de la tromperie. » Il lui donnait juste de quoi vivre. Il payait lui-même le loyer de sa chambre et il lui donnait vingt francs par jour pour la nourriture.
Question: How does lui donner juste de quoi vivre come to mean what it means?
There it is, but I am afraid you could not understand what it's really about without reading what follows. I am sorry I cannot condense this question.
Background
When I first saw de quoi vivre, I thought it was my old friend vivre de from the previous question. If so, we have a nice, almost word-per-word correspondence between these sentences:
Il lui donnait juste de quoi vivre.
He gave her just what to live on.
The only difference is that a French infinitive does not need anything like to to set if off and that de (unlike English on) moved up. But consider:
As-tu de quoi écrire?
According to this dictionary entry, that means, "Have you got anything to write with?" But write with is écrire avec. So what happened? Something like this perhaps?
As-tu + de quoi + écrire avec > (As-tu + avec + de quoi + écrire) > As-tu + de quoi + écrire.
Namely, de quoi is a unit in its own right and a suppression of avec took place (with or without an intervening step of transposition).
Then maybe the same thing happened to our friend vivre de.
Il lui donnait juste + de quoi + vivre de > (Il lui donnait juste + de + de quoi + vivre) > Il lui donnait juste + de quoi + vivre.
Namely, the surviving de did not come from vivre de but from de quoi.
Another expression avoir de quoi faire, from this dictionary entry, seems to suggest further awesome powers of de quoi. To have to do something is ordinarily avoir à faire, but:
avoir à + de quoi + faire > avoir + de quoi + faire
Namely, de quoi caused a suppression of à. (Of course, I am not saying this is what happened, only that I am trying to find an explanation.)
To restate the question, I want to know whether Il lui donnait juste de quoi vivre comes to mean what it does through either of the two routes above (word-per-word correspondence vs. suppression of de in vivre de) or in some other way I have not been able to think of. Thanks.