Changeset 3996


Ignore:
Timestamp:
Nov 22, 2009, 1:41:45 PM (14 years ago)
Author:
Jean-Yves Lamoureux
Message:
  • Added preliminary OSX support (by support I mean it barely compiles)
  • Moved client's send commands to client.c
Location:
neercs/trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • neercs/trunk/configure.ac

    r3916 r3996  
    1313AM_PROG_CC_C_O
    1414AC_PROG_CPP
     15
     16AC_CANONICAL_HOST
     17
     18if test "$host_os" == "darwin10.2.0"; then
     19    case x${target} in
     20     x*86*darwin*)
     21      MACOSX_SDK="${MACOSX_SDK:-/Developer/SDKs/MacOSX10.6.sdk}"
     22      GCC_VERSION="${GCC_VERSION:-4.0}"
     23      ARCH="${ARCH:--arch i386}"
     24      MACOSX_SDK_CFLAGS="${MACOSX_SDK_CFLAGS:--isysroot ${MACOSX_SDK}}"
     25      MACOSX_SDK_CXXFLAGS="${MACOSX_SDK_CXXFLAGS:-${MACOSX_SDK_CFLAGS}}"
     26      ;;
     27    esac
     28    CC="${CC:-gcc-${GCC_VERSION}}"
     29    CXX="${CXX:-g++-${GCC_VERSION}}"
     30    MACOSX_SDK_FRAMEWORKS="${MACOSX_SDK_FRAMEWORKS:--F${MACOSX_SDK}/System/Library/Frameworks}"
     31    CPPFLAGS="${CPPFLAGS} ${ARCH} ${MACOSX_SDK_FRAMEWORKS}"
     32    CFLAGS="${CFLAGS} ${MACOSX_SDK_CFLAGS}"
     33    CXXFLAGS="${CXXFLAGS} ${MACOSX_SDK_CXXFLAGS}"
     34    OBJCFLAGS="${OBJCFLAGS} ${MACOSX_SDK_CFLAGS}"
     35    LDFLAGS="${ARCH} ${MACOSX_SDK_LDFLAGS} ${LDFLAGS}"
     36fi
     37
    1538
    1639dnl AC_PROG_EGREP only exists in autoconf 2.54+, so we use AC_EGREP_CPP right
     
    3861AC_CHECK_HEADERS(stdio.h pty.h sys/ioctl.h sys/ptrace.h sys/stat.h sys/syscall.h sys/user.h sys/wait.h linux/kdev_t.h linux/major.h security/pam_appl.h security/pam_misc.h)
    3962
     63if test $host_os != "darwin10.2.0"; then
    4064AC_CHECK_LIB(pam, pam_authenticate,
    4165 [PAM_LIBS="${PAM_LIBS} -lpam"
    4266  AC_DEFINE(USE_LOCK, 1, [Locking the PTY is supported])])
    4367AC_SUBST(PAM_LIBS)
     68else
     69AC_MSG_RESULT(Disabling lock support on OSX)
     70fi
    4471
    4572AC_CHECK_LIB(caca, caca_clear_dirty_rect_list,
     
    6895AC_DEFINE(_GNU_SOURCE, 1, [Use GNU extentions])
    6996
     97
    7098# Optimizations
    7199CFLAGS="${CFLAGS} -g -O2 -fno-strength-reduce -fomit-frame-pointer"
  • neercs/trunk/src/attach.c

    r3969 r3996  
    155155    if ((sock = socket(AF_UNIX, SOCK_DGRAM, 0)) < 0)
    156156    {
     157        debug("Failed to create socket\n");
    157158        perror("connect_server:socket");
    158159        return NULL;
     
    424425}
    425426
    426 int send_event(caca_event_t ev, struct screen_list *screen_list)
    427 {
    428     enum caca_event_type t;
    429 
    430     t = caca_get_event_type(&ev);
    431 
    432     if (t & CACA_EVENT_KEY_PRESS)
    433     {
    434         char buf[16];
    435         int bytes;
    436         bytes =
    437             snprintf(buf, sizeof(buf) - 1, "KEY %d",
    438                      caca_get_event_key_ch(&ev));
    439         buf[bytes] = '\0';
    440         debug("Sending key press to server: %s", buf);
    441         return write(screen_list->socket[SOCK_SERVER], buf, strlen(buf)) <= 0;
    442     }
    443     else if (t & CACA_EVENT_RESIZE)
    444     {
    445         char buf[32];
    446         int bytes;
    447         bytes = snprintf(buf, sizeof(buf) - 1, "RESIZE %10d %10d",
    448                          caca_get_event_resize_width(&ev),
    449                          caca_get_event_resize_height(&ev));
    450         buf[bytes] = '\0';
    451         debug("Sending resize to server: %s", buf);
    452         return write(screen_list->socket[SOCK_SERVER], buf, strlen(buf)) <= 0;
    453     }
    454     else if (t & CACA_EVENT_QUIT)
    455         return write(screen_list->socket[SOCK_SERVER], "QUIT",
    456                      strlen("QUIT")) <= 0;
    457 
    458     return 0;
    459 }
    460 
    461 int send_delay(struct screen_list *screen_list)
    462 {
    463     char buf[18];
    464     int bytes;
    465     bytes = snprintf(buf, sizeof(buf) - 1, "DELAY %10d", screen_list->delay);
    466     buf[bytes] = '\0';
    467     return write(screen_list->socket[SOCK_SERVER], buf, strlen(buf)) <= 0;
    468 }
  • neercs/trunk/src/client.c

    r3986 r3996  
    6262}
    6363
     64int send_event(caca_event_t ev, struct screen_list *screen_list)
     65{
     66   
     67    enum caca_event_type t;
     68   
     69    t = caca_get_event_type(&ev);
     70   
     71    if (t & CACA_EVENT_KEY_PRESS)
     72    {
     73        char buf[16];
     74        int bytes;
     75        bytes =
     76        snprintf(buf, sizeof(buf) - 1, "KEY %d",
     77                 caca_get_event_key_ch(&ev));
     78        buf[bytes] = '\0';
     79        debug("Sending key press to server: %s", buf);
     80        debug("Sending '%s', %d bytes\n", buf, strlen(buf));
     81        return write(screen_list->socket[SOCK_SERVER], buf, strlen(buf)+1) <= 0;
     82    }
     83    else if (t & CACA_EVENT_RESIZE)
     84    {
     85       
     86        char buf[32];
     87        int bytes;
     88        bytes = snprintf(buf, sizeof(buf) - 1, "RESIZE %10d %10d",
     89                         caca_get_event_resize_width(&ev),
     90                         caca_get_event_resize_height(&ev));
     91        buf[bytes] = '\0';
     92        debug("Sending '%s', %d bytes\n", buf, strlen(buf));
     93        return write(screen_list->socket[SOCK_SERVER], buf, strlen(buf)+1) <= 0;
     94    }
     95    else if (t & CACA_EVENT_QUIT)
     96        return write(screen_list->socket[SOCK_SERVER], "QUIT",
     97                     strlen("QUIT")) <= 0;
     98   
     99    return 0;
     100}
     101
     102int send_delay(struct screen_list *screen_list)
     103{
     104    debug("Sending DELAY\n");
     105    char buf[18];
     106    int bytes;
     107    bytes = snprintf(buf, sizeof(buf) - 1, "DELAY %10d", screen_list->delay);
     108    buf[bytes] = '\0';
     109    return write(screen_list->socket[SOCK_SERVER], buf, strlen(buf)) <= 0;
     110}
    64111
    65112
     
    90137        {
    91138            buf[n] = 0;
    92             debug("Received from server: %s", buf);
     139            debug("Received from server: '%s' (%d bytes)", buf, n);
    93140            if (!strncmp("DETACH", buf, 6))
    94141            {
  • neercs/trunk/src/effects.c

    r3969 r3996  
    200200                 strlen(PACKAGE_STRING)) / 2, y - 1, PACKAGE_STRING);
    201201    caca_printf(screen_list->cv, x, y++, "Copyright (c) 2006-2009");
    202     caca_printf(screen_list->cv, x, y++,
    203                 "              Sam Hocevar <sam@zoy.org>");
    204     caca_printf(screen_list->cv, x, y++,
    205                 "              Jean-Yves Lamoureux <jylam@lnxscene.org>");
    206     caca_printf(screen_list->cv, x, y++,
    207                 "              Pascal Terjan <pterjan@linuxfr.org>");
     202    caca_printf(screen_list->cv, x, y++, "              Sam Hocevar <sam@zoy.org>");
     203    caca_printf(screen_list->cv, x, y++, "              Jean-Yves Lamoureux <jylam@lnxscene.org>");
     204    caca_printf(screen_list->cv, x, y++, "              Pascal Terjan <pterjan@linuxfr.org>");
    208205    caca_printf(screen_list->cv, x, y++, "");
    209206    caca_printf(screen_list->cv, x, y++, "");
    210     caca_printf(screen_list->cv, x, y++,
    211                 "All shortcuts are in format 'ctrl-a-X' where X is :");
     207    caca_printf(screen_list->cv, x, y++, "All shortcuts are in format 'ctrl-a-X' where X is :");
    212208    caca_printf(screen_list->cv, x, y++, "n:\t Next window");
    213209    caca_printf(screen_list->cv, x, y++, "p:\t Previous window");
     
    216212    caca_printf(screen_list->cv, x, y++, "m:\t Thumbnails");
    217213    caca_printf(screen_list->cv, x, y++, "d:\t Detach");
    218     caca_printf(screen_list->cv, x, y++,
    219                 "k:\t Close window and kill associated process");
     214    caca_printf(screen_list->cv, x, y++, "k:\t Close window and kill associated process");
    220215    caca_printf(screen_list->cv, x, y++, "h:\t This help");
    221216    caca_printf(screen_list->cv, x, y++, "");
    222217    caca_printf(screen_list->cv, x, y++, "");
    223     caca_printf(screen_list->cv, x, y++,
    224                 "See http://caca.zoy.org/wiki/neercs for more informations");
     218    caca_printf(screen_list->cv, x, y++, "See http://caca.zoy.org/wiki/neercs for more informations");
    225219}
    226220
Note: See TracChangeset for help on using the changeset viewer.