On Tue, 21.10.14 22:55, Ronny Chevalier ([email protected]) wrote: > > That way we wouldn't have to allocate an strv, and just open code the > > search logic. This would then mirror nicely how the pager logic > > works... > > I agree but I can't (or I don't know how to do this), because we need > to give the paths of the units to execvp, and since the first argument > must be the name of the editor, I need to add it to the strv. The > original strv is a strv of units path, so I copy it and prepend the > name of the editor.
The strv is just a string array, you can just go ahead and override its entries. Of course, afterwards deallocating it is not easy, since you'd have to replace the first string again with the the original malloc()ed one, but ultimately this doesn't really matter anyway, since you invoke execlp() which will replace the process and where you won't have time to free the strv anyway. > We can do this for the pager because there is no arguments to give, > here we have a list of paths. THinking about this: are all those editors actually fine with editing multiple files at once? is nano? Maybe we should invoke them one-by-one instead of just once? (just thinking out loud...) Lennart -- Lennart Poettering, Red Hat _______________________________________________ systemd-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/systemd-devel
