FULL NAME:  The Mathematician

OCCUPATION: >CG<  Clan  Co-Founder  and your worst nightmare

LIKES:      The  Crotch,  washing  his  hands, coffee, nasal
            spray, good music, elegant -or surprising mathe-
            matical  proofs,  well  composed  program  code,
            uppers and peanut-butter.

DISLIKES:   Dirty hands,  germs,  cerebral  bleedings,  mind
            control,  diseases,  commercial television, you,
            sanity resistant people,  decaffeinated  coffee,
            Flash   sites,  action  movies,  sports,  mobile
            phones, Fantasy literature and  movies,  mangas,
            bad  music,  people  who use "Leetspeak", people
            who send him  MS-Office  files,  his  neighbors,
            religious  fanatics, object-oriented programming
            languages  and  anybody  who   disrespects   The
            Crotch.


MATH'S LOG - VARIOUS STUFF AND DEEP THOUGHTS



Fr Aug 8 2008 - Autograb

Recently, when I tried a QuakeII client named "Q2PRO", I realized
after starting it from the shell, that the console  commands  can
be typed in at the terminal. This is ideal for a tiny hack ...

The  following  piece  of  code will take care that you grab your
crotch continuously. It is a  good  replacement  for  the  CROTCH
GRABBER  SCRIPT, but unfortunately, it is only for users of Q2PRO
on a UNIX/Linux system. I could write pages, but the  codes  says
it all:


/********************************************************************
 * Autograb - A Q2PRO wrapper that keeps you grabbing your crotch.
 * Crotchyright (C) 2008 Math >CG<
 *
 * Compile:	gcc -o autograb autograb.c -lutil
 * Usage:	autograb [grabtime]
 * 'grabtime' is the number of seconds between two grabs.
 *
 ********************************************************************/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <err.h>
#include <sys/types.h>
#include <sys/select.h>
# include <termios.h>
#if defined(__FreeBSD__)
# include <sys/ioctl.h>
# include <libutil.h>
#elif defined(__OpenBSD__) || defined(__NetBSD__)
# include <util.h>
#else
# include <pty.h>
# include <utmp.h>
#endif
#include <errno.h>
#include <signal.h>
#include <sys/wait.h>
#include <sys/time.h>
#include <sys/resource.h>

#define GRAB		"wave 2\n"

void
sigchld(int sign)
{
	int stat;

	if (waitpid(-1, &stat, WNOHANG) > 0 && WIFEXITED(stat))
		exit(0);
}

main(int argc, char *argv[])
{
	int		tty, grabtime = argc > 1 ? atoi(argv[1]) : 1;
	FILE		*fp;
	time_t		t0;

	signal(SIGCHLD, sigchld);

	if ((fp = fdopen(dup(fileno(stderr)), "w")) == NULL)
		err(1, "fdopen()");
	switch (forkpty(&tty, NULL, NULL, NULL)) {
	case -1:
		err(1, "forkpty()");
	case  0:
		stderr = fp;
		execlp("q2pro", "q2pro", NULL);
		err(1, "execlp()");
	}
	for (t0 = time(NULL);; usleep(5000)) {
		if ((int)difftime(time(NULL), t0) < grabtime)
			continue;
		tcflush(tty, TCIOFLUSH);
		while (write(tty, GRAB, sizeof(GRAB) - 1) == -1)
			if (errno != EINTR)
				err(1, "write()");
		t0 = time(NULL);
	}
	return (0);
}


Fr Aug 15 2008 - Autograb Script

An alternative to Autograb is this Q2-config-script hack:

	alias lw "wait;wait;wait;wait;wait;wait;wait;wait;wait;wait"
	alias infgrab "wave 2;lw;lw;lw;lw;lw;infgrab"

The  disadvantages are that you won't be able to do anything (in-
cluding exiting the game) in Quake2forge (stock Quake2). In Q2PRO
you  can  do anything, but when a map change comes, it refuses to
load the next map while "infgrab" is running. How to fix this?

	kill <pid of q2pro> && \
        	(q2pro +connect <ip:port> [protocol]>&/dev/null)&

Sun Oct 12 2008 - Autograb v2

Here  is  version  2  of Autograb. "grabtime" is now expressed in
1/10 seconds for a more intensive crotch grabbing experience.  In
the  previous version, I noticed that Autograb "says" things like
"wwavave 2" when the system load is high. This was caused by  us-
ing "TCIOFLUSH" and is fixed now.


/*****************************************************************************
 * Autograb v2 - A Q2PRO wrapper that keeps you grabbing your crotch.
 * Crotchyright (C) 2008 Math >CG<
 *
 * Compile:     gcc -o autograb autograb.c -lutil
 * Usage:       autograb [grabtime]
 * 'grabtime' is the number of 1/10 seconds between two grabs.
 *
 *****************************************************************************/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <err.h>
#include <sys/types.h>
#include <sys/select.h>
# include <termios.h>
#if defined(__FreeBSD__)
# include <sys/ioctl.h>
# include <libutil.h>
#elif defined(__OpenBSD__) || defined(__NetBSD__)
# include <util.h>
#else
# include <pty.h>
# include <utmp.h>
#endif
#include <errno.h>
#include <signal.h>
#include <sys/wait.h>
#include <sys/time.h>
#include <sys/resource.h>

#define GRAB		"wave 2\n"

void
sigchld(int sign)
{
	int stat;

	if (waitpid(-1, &stat, WNOHANG) > 0 && WIFEXITED(stat))
		exit(0);
}

main(int argc, char *argv[])
{
	int		tty, grabtime = argc > 1 ? atoi(argv[1]) : 1;
	FILE		*fp;

	signal(SIGCHLD, sigchld);

	if ((fp = fdopen(dup(fileno(stderr)), "w")) == NULL)
		err(1, "fdopen()");
	switch (forkpty(&tty, NULL, NULL, NULL)) {
	case -1:
		err(1, "forkpty()");
	case  0:
		stderr = fp;
		execlp("q2pro", "q2pro", NULL);
		err(1, "execlp()");
	}
	for (;; usleep(grabtime * 100000)) {
		while (tcflush(tty, TCOFLUSH) == -1)
			if (errno != EINTR)
				err(1, "tcflush()");
		while (write(tty, GRAB, sizeof(GRAB) - 1) == -1)
			if (errno != EINTR)
				err(1, "write()");
	}
	return (0);
}


Wed Nov 25 2008 - CROTCH GRABBER Edition patches for r1q2, Quake2forge and Q2PRO 

Today  I wrote patches for r1q2, Quake2forge and Q2PRO, which ex-
tends these clients by Auto Crotch Grabbing.  The  speed  of  the
crotch  grabbing can be controled by setting the cvar "grabtime".
"grabtime" is the number of 1/10 seconds between two  grabs.  The
default is 6.

r1q2 CG-patch
Quake2forge CG-patch
Q2PRO CG-patch











 

 

[Home] [Join us] [FAQ] [Members] [Crotch News] [Contact Us] [Guestbook]