Changeset 4681 for toilet


Ignore:
Timestamp:
Oct 7, 2010, 11:38:43 PM (9 years ago)
Author:
Sam Hocevar
Message:

Remove the build dependency on the getopt implementation and use libcaca
instead.

Location:
toilet/trunk
Files:
2 deleted
3 edited

Legend:

Unmodified
Added
Removed
  • toilet/trunk/configure.ac

    r4355 r4681  
    2525fi
    2626
    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)
     27AC_CHECK_HEADERS(sys/ioctl.h)
    4028
    4129AC_CACHE_CHECK([for TIOCGWINSZ],
     
    5240
    5341CUCUL="no"
    54 PKG_CHECK_MODULES(CACA, caca >= 0.99.beta17,
     42PKG_CHECK_MODULES(CACA, caca >= 0.99.beta18,
    5543 [CUCUL="yes"],
    5644 [AC_MSG_RESULT(no)
    57   AC_MSG_ERROR([you need libcaca version 0.99.beta17 or later])])
     45  AC_MSG_ERROR([you need libcaca version 0.99.beta18 or later])])
    5846
    5947AC_MSG_CHECKING([for release date])
  • toilet/trunk/src/Makefile.am

    r4355 r4681  
    66                 filter.c filter.h \
    77                 export.c export.h \
    8                  term.c figlet.c \
    9                  $(GETOPT)
     8                 term.c figlet.c
    109
    1110toilet_CPPFLAGS = -DFONTDIR=\"$(datadir)/figlet\"
    1211toilet_CFLAGS = @CACA_CFLAGS@
    13 toilet_LDADD = @CACA_LIBS@ @GETOPT_LIBS@
    14 
    15 if NEED_GETOPT_LONG
    16 GETOPT = mygetopt.c mygetopt.h
    17 endif
     12toilet_LDADD = @CACA_LIBS@
    1813
    1914echo-sources: ; echo $(SOURCES)
  • toilet/trunk/src/main.c

    r4350 r4681  
    2020#   include <inttypes.h>
    2121#endif
    22 #if !defined HAVE_GETOPT_LONG
    23 #   include "mygetopt.h"
    24 #elif defined HAVE_GETOPT_H
    25 #   include <getopt.h>
    26 #endif
    2722#if defined HAVE_SYS_IOCTL_H && defined HAVE_TIOCGWINSZ
    2823#   include <sys/ioctl.h>
     
    3833#include "export.h"
    3934
    40 #if defined HAVE_GETOPT_LONG
    41 #   define mygetopt getopt_long
    42 #   define myoptind optind
    43 #   define myoptarg optarg
    44 #   define myoption option
    45 #endif
    46 
    4735static void version(void);
    4836static void usage(void);
     
    7058#define MOREINFO "Try `%s --help' for more information.\n"
    7159        int option_index = 0;
    72         static struct myoption long_options[] =
     60        static struct caca_option long_options[] =
    7361        {
    7462            /* Long option, needs arg, flag, short option */
     
    8977        };
    9078
    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);
    9381        if(c == -1)
    9482            break;
     
    10088            return 0;
    10189        case 'I': /* --infocode */
    102             infocode = atoi(myoptarg);
     90            infocode = atoi(caca_optarg);
    10391            break;
    10492        case 'v': /* --version */
     
    10694            return 0;
    10795        case 'f': /* --font */
    108             cx->font = myoptarg;
     96            cx->font = caca_optarg;
    10997            break;
    11098        case 'd': /* --directory */
    111             cx->dir = myoptarg;
     99            cx->dir = caca_optarg;
    112100            break;
    113101        case 'F': /* --filter */
    114             if(!strcmp(myoptarg, "list"))
     102            if(!strcmp(caca_optarg, "list"))
    115103                return filter_list();
    116             if(filter_add(cx, myoptarg) < 0)
     104            if(filter_add(cx, caca_optarg) < 0)
    117105                return -1;
    118106            break;
     
    124112            break;
    125113        case 'w': /* --width */
    126             cx->term_width = atoi(myoptarg);
     114            cx->term_width = atoi(caca_optarg);
    127115            break;
    128116        case 't': /* --termwidth */
     
    154142            break;
    155143        case 'E': /* --export */
    156             if(!strcmp(myoptarg, "list"))
     144            if(!strcmp(caca_optarg, "list"))
    157145                return export_list();
    158             if(export_set(cx, myoptarg) < 0)
     146            if(export_set(cx, caca_optarg) < 0)
    159147                return -1;
    160148            break;
     
    201189        return -1;
    202190
    203     if(myoptind >= argc)
     191    if(caca_optind >= argc)
    204192        render_stdin(cx);
    205193    else
    206         render_list(cx, argc - myoptind, argv + myoptind);
     194        render_list(cx, argc - caca_optind, argv + caca_optind);
    207195
    208196    render_end(cx);
Note: See TracChangeset for help on using the changeset viewer.