On Sat, Dec 22, 2012 at 09:00:06AM +0100, Thuban wrote: > First of all, thank you for your patience with the beginner I am, > because I still have a lot to learn. > > Concerning French parts, you're right, it's a big mistake. I just forgot > to translate comments. I would do:
@@ -1,7 +1,3 @@ -// Fichier: dwmstatus.c -// Crée le 10 déc. 2012 22:28:11 -// Dernière modification: 21 déc. 2012 16:25:16 - #define _BSD_SOURCE #include <unistd.h> #include <stdio.h> > > > a) I would have put your username & Mail folder as parameters, > > argv[1] & argv[2] or so. > > I'm not sure to understand. Why using the username? Sorry, after a second look, I see no username, but label. So, I would do: --- a/mailcount.c +++ b/mailcount.c @@ -78,6 +78,11 @@ main(void) { char *status; char *mail_laposte; + + if (!argv[1]) { + fprintf(stderr, "usage: %s DIRECTORY [NAME]\n"); + exit(1); + } if (!(dpy = XOpenDisplay(NULL))) { fprintf(stderr, "dwmstatus: cannot open display.\n"); @@ -85,7 +90,7 @@ main(void) } for (;;sleep(60)) { - mail_laposte = get_nmail("/home/xavier/Maildir/laposte/new", "Laposte:"); + mail_laposte = get_nmail(argv[1], argv[2] ?: "Mail:"); status = smprintf("%s",mail_laposte); Kind regards, Kurt