Changeset 4681
- Timestamp:
- Oct 7, 2010, 11:38:43 PM (11 years ago)
- Location:
- toilet/trunk
- Files:
-
- 2 deleted
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
toilet/trunk/configure.ac
r4355 r4681 25 25 fi 26 26 27 AC_CHECK_HEADERS(getopt.h sys/ioctl.h) 28 29 ac_cv_have_getopt_long="no" 30 AC_CHECK_FUNCS(getopt_long, 31 [ac_cv_have_getopt_long="yes"], 32 [AC_CHECK_LIB(gnugetopt, getopt_long, 33 [ac_cv_have_getopt_long="yes" 34 GETOPT_LIBS="${GETOPT_LIBS} -lgnugetopt"])]) 35 if test "$ac_cv_have_getopt_long" != "no"; then 36 AC_DEFINE(HAVE_GETOPT_LONG, 1, Define to 1 if you have the ‘getopt_long’ function.) 37 fi 38 AM_CONDITIONAL(NEED_GETOPT_LONG, test "$ac_cv_have_getopt_long" = "no") 39 AC_SUBST(GETOPT_LIBS) 27 AC_CHECK_HEADERS(sys/ioctl.h) 40 28 41 29 AC_CACHE_CHECK([for TIOCGWINSZ], … … 52 40 53 41 CUCUL="no" 54 PKG_CHECK_MODULES(CACA, caca >= 0.99.beta1 7,42 PKG_CHECK_MODULES(CACA, caca >= 0.99.beta18, 55 43 [CUCUL="yes"], 56 44 [AC_MSG_RESULT(no) 57 AC_MSG_ERROR([you need libcaca version 0.99.beta1 7or later])])45 AC_MSG_ERROR([you need libcaca version 0.99.beta18 or later])]) 58 46 59 47 AC_MSG_CHECKING([for release date]) -
toilet/trunk/src/Makefile.am
r4355 r4681 6 6 filter.c filter.h \ 7 7 export.c export.h \ 8 term.c figlet.c \ 9 $(GETOPT) 8 term.c figlet.c 10 9 11 10 toilet_CPPFLAGS = -DFONTDIR=\"$(datadir)/figlet\" 12 11 toilet_CFLAGS = @CACA_CFLAGS@ 13 toilet_LDADD = @CACA_LIBS@ @GETOPT_LIBS@ 14 15 if NEED_GETOPT_LONG 16 GETOPT = mygetopt.c mygetopt.h 17 endif 12 toilet_LDADD = @CACA_LIBS@ 18 13 19 14 echo-sources: ; echo $(SOURCES) -
toilet/trunk/src/main.c
r4350 r4681 20 20 # include <inttypes.h> 21 21 #endif 22 #if !defined HAVE_GETOPT_LONG23 # include "mygetopt.h"24 #elif defined HAVE_GETOPT_H25 # include <getopt.h>26 #endif27 22 #if defined HAVE_SYS_IOCTL_H && defined HAVE_TIOCGWINSZ 28 23 # include <sys/ioctl.h> … … 38 33 #include "export.h" 39 34 40 #if defined HAVE_GETOPT_LONG41 # define mygetopt getopt_long42 # define myoptind optind43 # define myoptarg optarg44 # define myoption option45 #endif46 47 35 static void version(void); 48 36 static void usage(void); … … 70 58 #define MOREINFO "Try `%s --help' for more information.\n" 71 59 int option_index = 0; 72 static struct myoption long_options[] =60 static struct caca_option long_options[] = 73 61 { 74 62 /* Long option, needs arg, flag, short option */ … … 89 77 }; 90 78 91 int c = mygetopt(argc, argv, "f:d:w:tsSkWoF:E:hI:v",92 long_options, &option_index);79 int c = caca_getopt(argc, argv, "f:d:w:tsSkWoF:E:hI:v", 80 long_options, &option_index); 93 81 if(c == -1) 94 82 break; … … 100 88 return 0; 101 89 case 'I': /* --infocode */ 102 infocode = atoi( myoptarg);90 infocode = atoi(caca_optarg); 103 91 break; 104 92 case 'v': /* --version */ … … 106 94 return 0; 107 95 case 'f': /* --font */ 108 cx->font = myoptarg;96 cx->font = caca_optarg; 109 97 break; 110 98 case 'd': /* --directory */ 111 cx->dir = myoptarg;99 cx->dir = caca_optarg; 112 100 break; 113 101 case 'F': /* --filter */ 114 if(!strcmp( myoptarg, "list"))102 if(!strcmp(caca_optarg, "list")) 115 103 return filter_list(); 116 if(filter_add(cx, myoptarg) < 0)104 if(filter_add(cx, caca_optarg) < 0) 117 105 return -1; 118 106 break; … … 124 112 break; 125 113 case 'w': /* --width */ 126 cx->term_width = atoi( myoptarg);114 cx->term_width = atoi(caca_optarg); 127 115 break; 128 116 case 't': /* --termwidth */ … … 154 142 break; 155 143 case 'E': /* --export */ 156 if(!strcmp( myoptarg, "list"))144 if(!strcmp(caca_optarg, "list")) 157 145 return export_list(); 158 if(export_set(cx, myoptarg) < 0)146 if(export_set(cx, caca_optarg) < 0) 159 147 return -1; 160 148 break; … … 201 189 return -1; 202 190 203 if( myoptind >= argc)191 if(caca_optind >= argc) 204 192 render_stdin(cx); 205 193 else 206 render_list(cx, argc - myoptind, argv + myoptind);194 render_list(cx, argc - caca_optind, argv + caca_optind); 207 195 208 196 render_end(cx);
Note: See TracChangeset
for help on using the changeset viewer.