[aur-general] Wrote Small AUR Helper
jonno.conder+arch at gmail.com
Thu Jan 13 21:41:15 EST 2011
On 14 January 2011 15:57, Nathan Owens <ndowens.aur at gmail.com> wrote:
> I wrote a little AUR helper in C++, though currently it only downloads the
> tarball if the package name is valid. I am new to C++ and wanted to know if
> you thought the code was good. I was thinking about putting it in AUR, but
> figured I would asked for opinion first. Here is the url for the code:
So far so good, just a few pointers:
- The struct Aur isn't necessary - the file field is never used. You should
remove Aur:: from the getFile definition to make it an ordinary function.
- The return type of getFile should be void, not char. I would suggest
passing the -Wall and -pedantic options to g++ so the compiler would catch
these types of issues.
- The only headers I think you need are <iostream>, <stdlib.h> and <string>
(not <string.h>, which is a C header). I might have missed something though.
- As a next step I would use a library to download the file, rather than
calling wget which isn't very efficient. You might choose libcurl, libfetch,
libsoup, Qt, or maybe something else.
- Although it isn't needed yet, I would suggest adding a break statement
after case 1, to avoid errors when you add more cases.
Hope this helps,
More information about the aur-general