Changeset 1101
- Timestamp:
- Sep 24, 2006, 12:53:17 AM (16 years ago)
- Location:
- toilet/trunk/src
- Files:
-
- 2 added
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
toilet/trunk/src/Makefile.am
r1100 r1101 2 2 bin_PROGRAMS = toilet 3 3 4 toilet_SOURCES = main.c render.c render.h filters.c filter.h 4 toilet_SOURCES = main.c \ 5 render.c render.h \ 6 filters.c filter.h \ 7 figlet.c figlet.h 5 8 toilet_CFLAGS = `pkg-config --cflags cucul` 6 9 toilet_LDFLAGS = `pkg-config --libs cucul` @GETOPT_LIBS@ -
toilet/trunk/src/main.c
r1100 r1101 26 26 27 27 #include "render.h" 28 #include "figlet.h" 28 29 #include "filters.h" 29 30 … … 39 40 40 41 char const *export = "utf8"; 42 char const *font = "mono9"; 41 43 unsigned flag_gay = 0; 42 44 unsigned flag_metal = 0; … … 51 53 { 52 54 /* Long option, needs arg, flag, short option */ 55 { "font", 1, NULL, 'f' }, 56 { "gay", 0, NULL, 'g' }, 53 57 { "metal", 0, NULL, 'm' }, 54 { "gay", 0, NULL, 'g' },55 58 { "irc", 0, NULL, 'i' }, 56 59 { "help", 0, NULL, 'h' }, … … 59 62 }; 60 63 61 int c = getopt_long(argc, argv, " gmihv", long_options, &option_index);64 int c = getopt_long(argc, argv, "f:gmihv", long_options, &option_index); 62 65 # else 63 66 # define MOREINFO "Try `%s -h' for more information.\n" 64 int c = getopt(argc, argv, " gmihv");67 int c = getopt(argc, argv, "f:gmihv"); 65 68 # endif 66 69 if(c == -1) … … 70 73 { 71 74 case 'h': /* --help */ 72 printf("Usage: %s [ - gmihv ] [ message ]\n", argv[0]);75 printf("Usage: %s [ -f:gmihv ] [ message ]\n", argv[0]); 73 76 # ifdef HAVE_GETOPT_LONG 77 printf(" -f, --font <fontfile>\n"); 78 printf(" select the font\n"); 74 79 printf(" -g, --gay add a rainbow effect to the text\n"); 75 80 printf(" -m, --metal add a metal effect to the text\n"); … … 78 83 printf(" -v, --version output version information and exit\n"); 79 84 # else 85 printf(" -f <fontfile>\n"); 86 printf(" select the font\n"); 80 87 printf(" -g add a rainbow effect to the text\n"); 81 88 printf(" -m add a metal effect to the text\n"); … … 85 92 # endif 86 93 return 0; 87 case 'm': /* --metal */88 flag_metal = 1;89 break;90 case 'g': /* --gay */91 flag_gay = 1;92 break;93 case 'i': /* --irc */94 export = "irc";95 break;96 94 case 'v': /* --version */ 97 95 printf("TOIlet Copyright 2006 Sam Hocevar %s\n", VERSION); … … 99 97 printf("\n"); 100 98 return 0; 99 case 'f': /* --font */ 100 font = optarg; 101 break; 102 case 'g': /* --gay */ 103 flag_gay = 1; 104 break; 105 case 'm': /* --metal */ 106 flag_metal = 1; 107 break; 108 case 'i': /* --irc */ 109 export = "irc"; 110 break; 101 111 case '?': 102 112 printf(MOREINFO, argv[0]); … … 145 155 } 146 156 157 /* Render string to canvas */ 158 if(!strcasecmp(font, "mono9")) 159 cv = render_big(string, length); 160 else if(!strcasecmp(font, "term")) 161 cv = render_tiny(string, length); 162 else 163 cv = render_figlet(string, length, font); 164 165 /* Crop output */ 166 filter_autocrop(cv); 167 147 168 /* Do gay stuff with our string (léopard) */ 148 cv = render_big(string, length);149 filter_autocrop(cv);150 169 if(flag_metal) 151 170 filter_metal(cv);
Note: See TracChangeset
for help on using the changeset viewer.