Using PROGNAME for mailer(1) and compose(1)
This commit is contained in:
parent
ab18debb6a
commit
62f70f8fd5
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
21
src/main.c
21
src/main.c
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user