* Added -d and completed -I options.
This commit is contained in:
parent
256071d876
commit
15a742ce5c
1 changed files with 13 additions and 6 deletions
19
src/main.c
19
src/main.c
|
@ -49,6 +49,7 @@ int main(int argc, char *argv[])
|
||||||
|
|
||||||
char const *export = "utf8";
|
char const *export = "utf8";
|
||||||
char const *font = "mono9";
|
char const *font = "mono9";
|
||||||
|
char const *dir = "/usr/share/figlet/";
|
||||||
unsigned int flag_gay = 0;
|
unsigned int flag_gay = 0;
|
||||||
unsigned int flag_metal = 0;
|
unsigned int flag_metal = 0;
|
||||||
unsigned int term_width = 80;
|
unsigned int term_width = 80;
|
||||||
|
@ -64,6 +65,7 @@ int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
/* Long option, needs arg, flag, short option */
|
/* Long option, needs arg, flag, short option */
|
||||||
{ "font", 1, NULL, 'f' },
|
{ "font", 1, NULL, 'f' },
|
||||||
|
{ "directory", 1, NULL, 'd' },
|
||||||
{ "width", 1, NULL, 'w' },
|
{ "width", 1, NULL, 'w' },
|
||||||
{ "gay", 0, NULL, 'g' },
|
{ "gay", 0, NULL, 'g' },
|
||||||
{ "metal", 0, NULL, 'm' },
|
{ "metal", 0, NULL, 'm' },
|
||||||
|
@ -74,11 +76,11 @@ int main(int argc, char *argv[])
|
||||||
{ NULL, 0, NULL, 0 }
|
{ NULL, 0, NULL, 0 }
|
||||||
};
|
};
|
||||||
|
|
||||||
int c = getopt_long(argc, argv, "f:w:gmihI:v",
|
int c = getopt_long(argc, argv, "d:f:I:w:ghimv",
|
||||||
long_options, &option_index);
|
long_options, &option_index);
|
||||||
# else
|
# else
|
||||||
# define MOREINFO "Try `%s -h' for more information.\n"
|
# define MOREINFO "Try `%s -h' for more information.\n"
|
||||||
int c = getopt(argc, argv, "f:w:gmihI:v");
|
int c = getopt(argc, argv, "d:f:I:w:ghimv");
|
||||||
# endif
|
# endif
|
||||||
if(c == -1)
|
if(c == -1)
|
||||||
break;
|
break;
|
||||||
|
@ -97,6 +99,9 @@ int main(int argc, char *argv[])
|
||||||
case 'f': /* --font */
|
case 'f': /* --font */
|
||||||
font = optarg;
|
font = optarg;
|
||||||
break;
|
break;
|
||||||
|
case 'd': /* --directory */
|
||||||
|
dir = optarg;
|
||||||
|
break;
|
||||||
case 'g': /* --gay */
|
case 'g': /* --gay */
|
||||||
flag_gay = 1;
|
flag_gay = 1;
|
||||||
break;
|
break;
|
||||||
|
@ -134,10 +139,10 @@ int main(int argc, char *argv[])
|
||||||
printf("20201\n");
|
printf("20201\n");
|
||||||
return 0;
|
return 0;
|
||||||
case 2:
|
case 2:
|
||||||
printf("/usr/share/figlet\n");
|
printf("%s\n", dir);
|
||||||
return 0;
|
return 0;
|
||||||
case 3:
|
case 3:
|
||||||
printf("mono9\n");
|
printf("%s\n", font);
|
||||||
return 0;
|
return 0;
|
||||||
case 4:
|
case 4:
|
||||||
printf("%u\n", term_width);
|
printf("%u\n", term_width);
|
||||||
|
@ -216,11 +221,12 @@ static void version(void)
|
||||||
#if defined(HAVE_GETOPT_H)
|
#if defined(HAVE_GETOPT_H)
|
||||||
static void usage(void)
|
static void usage(void)
|
||||||
{
|
{
|
||||||
printf("Usage: toilet [ -gmihv ] [ message ]\n");
|
printf("Usage: toilet [ -ghimv ] [ -d fontdirectory ]\n");
|
||||||
printf(" [ -f fontfile ] [ -w outputwidth ]\n");
|
printf(" [ -f fontfile ] [ -w outputwidth ]\n");
|
||||||
printf(" [ -I infocode ]\n");
|
printf(" [ -I infocode ] [ message ]\n");
|
||||||
# ifdef HAVE_GETOPT_LONG
|
# ifdef HAVE_GETOPT_LONG
|
||||||
printf(" -f, --font <fontfile> select the font\n");
|
printf(" -f, --font <fontfile> select the font\n");
|
||||||
|
printf(" -d, --directory <dir> specify font directory\n");
|
||||||
printf(" -w, --width <width> set output width\n");
|
printf(" -w, --width <width> set output width\n");
|
||||||
printf(" -g, --gay add a rainbow effect to the text\n");
|
printf(" -g, --gay add a rainbow effect to the text\n");
|
||||||
printf(" -m, --metal add a metal effect to the text\n");
|
printf(" -m, --metal add a metal effect to the text\n");
|
||||||
|
@ -230,6 +236,7 @@ static void usage(void)
|
||||||
printf(" -v, --version output version information and exit\n");
|
printf(" -v, --version output version information and exit\n");
|
||||||
# else
|
# else
|
||||||
printf(" -f <fontfile> select the font\n");
|
printf(" -f <fontfile> select the font\n");
|
||||||
|
printf(" -d <dir> specify font directory\n");
|
||||||
printf(" -w <width> set output width\n");
|
printf(" -w <width> set output width\n");
|
||||||
printf(" -g add a rainbow effect to the text\n");
|
printf(" -g add a rainbow effect to the text\n");
|
||||||
printf(" -m add a metal effect to the text\n");
|
printf(" -m add a metal effect to the text\n");
|
||||||
|
|
Loading…
Reference in a new issue