Using PROGNAME for mailer(1) and compose(1)

This commit is contained in:
Pierre Pronchery 2015-03-22 17:44:50 +01:00
parent ab18debb6a
commit 62f70f8fd5
2 changed files with 36 additions and 2 deletions

View File

@ -36,6 +36,9 @@
#ifndef LOCALEDIR
# define LOCALEDIR DATADIR "/locale"
#endif
#ifndef PROGNAME
# define PROGNAME "compose"
#endif
/* private */
@ -43,6 +46,9 @@
static Compose * _compose(Config * config, char const * subject,
int toc, char * tov[]);
static int _error(char const * message, int ret);
static int _usage(void);
/* functions */
/* compose */
@ -88,10 +94,19 @@ static Config * _compose_config(void)
}
/* error */
static int _error(char const * message, int ret)
{
fputs(PROGNAME, stderr);
perror(message);
return ret;
}
/* usage */
static int _usage(void)
{
fputs(_("Usage: compose [-s subject] address...\n"), stderr);
fprintf(stderr, _("Usage: %s [-s subject] address...\n"), PROGNAME);
return 1;
}

View File

@ -35,13 +35,32 @@
#ifndef LOCALEDIR
# define LOCALEDIR DATADIR "/locale"
#endif
#ifndef PROGNAME
# define PROGNAME "mailer"
#endif
/* Mailer */
/* private */
/* prototypes */
static int _error(char const * message, int ret);
static int _usage(void);
/* functions */
/* error */
static int _error(char const * message, int ret)
{
fputs(PROGNAME, stderr);
perror(message);
return ret;
}
/* usage */
static int _usage(void)
{
fputs(_("Usage: mailer\n"), stderr);
fprintf(stderr, _("Usage: %s\n"), PROGNAME);
return 1;
}