Re: [dev] [dwmstatus] Mail counter

From: Kurt Van Dijck <kurt.van.dijck_AT_eia.be>
Date: Sat, 22 Dec 2012 22:26:15 +0100

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:

_AT_@ -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
_AT_@ -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");
_AT_@ -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
Received on Sat Dec 22 2012 - 22:26:15 CET

This archive was generated by hypermail 2.3.0 : Sat Dec 22 2012 - 22:36:04 CET