Changeset 1115 for toilet/trunk/src


Ignore:
Timestamp:
Sep 27, 2006, 1:13:01 AM (16 years ago)
Author:
Sam Hocevar
Message:
  • Added -d and completed -I options.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • toilet/trunk/src/main.c

    r1114 r1115  
    5050    char const *export = "utf8";
    5151    char const *font = "mono9";
     52    char const *dir = "/usr/share/figlet/";
    5253    unsigned int flag_gay = 0;
    5354    unsigned int flag_metal = 0;
     
    6566            /* Long option, needs arg, flag, short option */
    6667            { "font", 1, NULL, 'f' },
     68            { "directory", 1, NULL, 'd' },
    6769            { "width", 1, NULL, 'w' },
    6870            { "gay", 0, NULL, 'g' },
     
    7577        };
    7678
    77         int c = getopt_long(argc, argv, "f:w:gmihI:v",
     79        int c = getopt_long(argc, argv, "d:f:I:w:ghimv",
    7880                            long_options, &option_index);
    7981#   else
    8082#       define MOREINFO "Try `%s -h' for more information.\n"
    81         int c = getopt(argc, argv, "f:w:gmihI:v");
     83        int c = getopt(argc, argv, "d:f:I:w:ghimv");
    8284#   endif
    8385        if(c == -1)
     
    9799        case 'f': /* --font */
    98100            font = optarg;
     101            break;
     102        case 'd': /* --directory */
     103            dir = optarg;
    99104            break;
    100105        case 'g': /* --gay */
     
    135140            return 0;
    136141        case 2:
    137             printf("/usr/share/figlet\n");
     142            printf("%s\n", dir);
    138143            return 0;
    139144        case 3:
    140             printf("mono9\n");
     145            printf("%s\n", font);
    141146            return 0;
    142147        case 4:
     
    217222static void usage(void)
    218223{
    219     printf("Usage: toilet [ -gmihv ] [ message ]\n");
     224    printf("Usage: toilet [ -ghimv ] [ -d fontdirectory ]\n");
    220225    printf("              [ -f fontfile ] [ -w outputwidth ]\n");
    221     printf("              [ -I infocode ]\n");
     226    printf("              [ -I infocode ] [ message ]\n");
    222227#   ifdef HAVE_GETOPT_LONG
    223228    printf("  -f, --font <fontfile>    select the font\n");
     229    printf("  -d, --directory <dir>    specify font directory\n");
    224230    printf("  -w, --width <width>      set output width\n");
    225231    printf("  -g, --gay                add a rainbow effect to the text\n");
     
    231237#   else
    232238    printf("  -f <fontfile>    select the font\n");
     239    printf("  -d <dir>         specify font directory\n");
    233240    printf("  -w <width>       set output width\n");
    234241    printf("  -g               add a rainbow effect to the text\n");
Note: See TracChangeset for help on using the changeset viewer.