Changeset 2455 for neercs


Ignore:
Timestamp:
Jun 19, 2008, 1:36:52 AM (12 years ago)
Author:
Sam Hocevar
Message:
  • Do not build grab.c conditionally; instead, make grab_process() and create_pty_grab() return an error if the feature isn't available.
Location:
neercs/trunk
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • neercs/trunk/configure.ac

    r2454 r2455  
    4646esac
    4747
    48 AM_CONDITIONAL(USE_GRAB, test "$grab" = "yes")
    4948if test "$grab" = "yes"; then
    5049  AC_DEFINE(USE_GRAB, 1, [Grabbing processes is supported])
  • neercs/trunk/src/Makefile.am

    r2447 r2455  
    22bin_PROGRAMS = neercs
    33
    4 
    5 if USE_GRAB
    6 grab_c=grab.c
    7 endif
    8 
    9 neercs_SOURCES = neercs.h $(grab_c) mygetopt.c recurrent.c main.c screens.c term.c effects.c wm.c screensaver.c
     4neercs_SOURCES = neercs.h mygetopt.c recurrent.c main.c screens.c term.c \
     5                 grab.c effects.c wm.c screensaver.c
    106neercs_CFLAGS = @CACA_CFLAGS@
    117neercs_LDADD = @CACA_LIBS@ @UTIL_LIBS@
  • neercs/trunk/src/grab.c

    r2452 r2455  
    77#include <unistd.h>
    88
    9 #include <sys/ioctl.h>
    10 #include <sys/ptrace.h>
    11 #include <sys/stat.h>
    12 #include <sys/syscall.h>
    13 #include <sys/user.h>
    14 #include <sys/wait.h>
    15 
    16 #include <linux/kdev_t.h>
    17 #include <linux/major.h>
     9#if defined USE_GRAB
     10#   include <sys/ioctl.h>
     11#   include <sys/ptrace.h>
     12#   include <sys/stat.h>
     13#   include <sys/syscall.h>
     14#   include <sys/user.h>
     15#   include <sys/wait.h>
     16
     17#   include <linux/kdev_t.h>
     18#   include <linux/major.h>
     19#endif
    1820
    1921#include "neercs.h"
    2022
     23#if defined USE_GRAB
    2124static int memcpy_from_target(pid_t pid, void* dest, void* src, size_t n)
    2225{
     
    220223    return 0;
    221224}
     225#endif
    222226
    223227int grab_process(pid_t pid, char *ptyname, int ptyfd)
    224228{
     229#if defined USE_GRAB
    225230    int i, fd = 0, mode, ret;
    226231    char fdstr[1024];
     
    288293
    289294    return 0;
    290 }
     295#else
     296    return -1;
     297#endif
     298}
     299
  • neercs/trunk/src/main.c

    r2453 r2455  
    139139        int option_index = 0;
    140140        static struct myoption long_options[] =
    141             {
    142 #ifdef USE_GRAB
    143                 { "pid",         1, NULL, 'P' },
     141        {
     142#if defined USE_GRAB
     143            { "pid",         1, NULL, 'P' },
    144144#endif
    145                 { "help",        0, NULL, 'h' },
    146                 { "version",     0, NULL, 'v' },
    147             };
     145            { "help",        0, NULL, 'h' },
     146            { "version",     0, NULL, 'v' },
     147        };
     148#if defined USE_GRAB
    148149        int c = mygetopt(argc, argv, "P:hv", long_options, &option_index);
     150#else
     151        int c = mygetopt(argc, argv, "hv", long_options, &option_index);
     152#endif
    149153        if(c == -1)
    150154            break;
     
    152156        switch(c)
    153157        {
    154 #ifdef USE_GRAB
    155158        case 'P': /* --pid */
    156159            add_screen(screen_list,create_screen_grab(w, h, atoi(myoptarg)));
    157160            s+=2;
    158161            break;
    159 #endif
    160162        case 'h': /* --help */
    161163            //   usage(argc, argv);
  • neercs/trunk/src/neercs.h

    r2453 r2455  
    9999
    100100int create_pty(char *cmd, unsigned int w, unsigned int h, int *cpid);
    101 #ifdef USE_GRAB
    102101int create_pty_grab(pid_t pid, unsigned int w, unsigned int h);
    103102int grab_process(pid_t pid, char *ptyname, int ptyfd);
    104 #endif
    105103
    106104long int import_term(struct screen_list *screen_list, struct screen *sc, void const *data, unsigned int size);
     
    116114/* Screens management */
    117115struct screen* create_screen(int w, int h, char *command);
    118 #ifdef USE_GRAB
    119116struct screen* create_screen_grab(int w, int h, int pid);
    120 #endif
    121117int destroy_screen(struct screen *s);
    122118int add_screen(struct screen_list *list, struct screen *s);
  • neercs/trunk/src/screens.c

    r2448 r2455  
    3030#include "neercs.h"
    3131
    32 #ifdef USE_GRAB
    3332struct screen* create_screen_grab(int w, int h, int pid)
    3433{
     
    5857    return s;
    5958}
    60 #endif
    6159
    6260struct screen* create_screen(int w, int h, char *command)
  • neercs/trunk/src/term.c

    r2453 r2455  
    578578}
    579579
    580 #ifdef USE_GRAB
    581580int create_pty_grab(pid_t pid, unsigned int w, unsigned int h)
    582581{
     
    597596    return fdm;
    598597}
    599 #endif
    600598
    601599int set_tty_size(int fd, unsigned int w, unsigned int h)
Note: See TracChangeset for help on using the changeset viewer.