A new addition to desktop-file-utils? (Repost)

Brian J. Tarricone bjt23 at cornell.edu
Fri Oct 6 23:39:21 EEST 2006


On 10/6/2006 1:24 PM, Jeff Abbott wrote:

> It's actually less than 7KB, so it's attached.  Again, C is *not* my
> forte, so if there are better ways to do what I'm doing please let me
> know as I'd love to learn and improve.

Looks reasonable to me, though a few issues.

1.  If it's going into a cross-desktop set of utility programs, the
calls to gnome_desktop_file_*() have to go.  It should't be too hard to
just fopen() the file, fgets() each line until you see "[Desktop
Entry]", then, assuming you don't see another line starting with '[',
grab the first line that starts with "Exec=", "Name=", etc.

2.  Instead of using system() and returning its exit code, you should
use one of the exec*() functions instead.

3.  Just use fprintf(stderr, ...) and avoid needing glib at all.

4.  Your use of strcat() is unsafe.

	-brian




More information about the xdg mailing list