Whee. Here 'tis. brkup. the utility to break up with your significant other. Now you can break up without the high cost of commercial break-up-letter generators, like the MS break-up-letter Wizard!

You can break up with anyone you like now. And it's totally free! All you have to do is copy-paste the code below into brkup.c and compile it with gcc -Wall -o brkup brkup.c! (GNU C library not included)


/* brkup - Break up with your significant other on stdout.
   Copyright (C) 2000 Cris van Pelt
   
   Distributed under the terms of the GPL. 
   See below for some #define's you'll have to ... well... define.
*/

/*
  TODO: SGML output.
*/

/*
  Example usage: 
    $ ./brkup -O1 -o "Gatesy" -P1 -p "Clinny" -r "two Bills is too much"
  This will let Gatesy dump Clinny, because two Bills is too much.

  Example for mass-dumpage:
    $ while true; do; ./brkup -O1 -o "Gatesy" -P1 -p `tail -1 -`; done
  Enter each name on the command-line, followed by RETURN, followed by
  ^D (CTRL-D, the EOF character). This will make it easy for Gatesy to
  dump Clinny, Joy, etc.
*/

/*
  Inspired by Noether. What he has to say about brkup:
  break up from the console! 
  combine with xargs and pipe to break up with multiple partners at once! 
  SGML output for easy conversion to your favourite format! 
  brkup is GPLed so you can break-up and support free software ! 

  I seriously hope that no-one would break-up with a significant other in 
  any way except face to face. 
-----
  John Freeman from YOU-NIX Magazine had the following to say about brkup:
  "It's great! I'm using brkup to break up with all my friends! I even
  broke up with my cat! Let me break up with you! Please, please!!!"
-----

  -- Of course, I'm making half of this up (you pick which half) just so
  you'll break up with your SO, and I'll have a chuckle.
*/

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>

#include <getopt.h>

/* Set these #def's to YOUR name and gender. As they are not likely
   to be changed soon (call me a conservative bastard, if you will),
   it should do no harm to hard code them in here. */

#define OWN_NAME "John S. Doe"
#define OWN_GENDER 1 /* Set to number of Y-chromosomes */

#define PACKAGE "brkup"
#define VERSION "0.1"

/* prototypes */
void exit_help();
void exit_version();
void print_usage(FILE *);

/* Name this program was called with. */
char *program_name;

int main(int argc, char *argv[])
{
    char *partner_name = NULL, *own_name = NULL, *reason = NULL;
    int partner_gender = -1, own_gender = -1;
    int i;

    struct option longopts[] = {
	{"version", 0, 0, 'v'},
	{"help", 0, 0, 'h'},
	{"partner-name", 1, 0, 'p'},
	{"partner-gender", 1, 0, 'P'},
	{"own-gender", 1, 0, 'o'},
	{"own-name", 1, 0, 'O'},
	{"reason", 1, 0, 'r'},
	{0, 0, 0, 0}
    };

    program_name = argv[0];

    while ((i = getopt_long(argc, argv, "p:P:o:O:r:vh", longopts, (int *) 0))
	   != EOF) {
	switch (i) {
	case 'p':
	    partner_name = (char *) malloc ((strlen(optarg)+1)*strlen(optarg));
	    strcpy(partner_name, optarg);
	    break;
	case 'P':
	    sscanf(optarg, "%d", &partner_gender);
	    break;
	case 'o':
	    own_name = (char *) malloc ((strlen(optarg)+1)*strlen(optarg));
	    strcpy(own_name, optarg);
	    break;
	case 'O':
	    sscanf(optarg, "%d", &own_gender);
	    break;
	case 'r':
	    reason = (char *) malloc ((strlen(optarg)+1)*strlen(optarg));
	    strcpy(reason, optarg);
	    break;
	case 'h':
	    exit_help();
	    break;
	case 'v':
	    exit_version();
	    break;
	case '?':
	    print_usage(stderr);
	    exit(EXIT_FAILURE);
	    break;
	}
    }
    
    if (own_gender < 0)
	own_gender = OWN_GENDER;
    if (!own_name)
	own_name = OWN_NAME;
	
    if ((partner_gender < 0) || (!partner_name)) {
	print_usage(stderr);
	fprintf(stderr, "%s: partner name or gender not specified.\n", program_name);
	exit(EXIT_FAILURE);
    }

    printf("Dear %s,\n\n\n", partner_name);
    printf("Although we have been together for quite a while now,\n");
    printf("I must inform you that there is another");
    if (partner_gender)
	printf(" man ");
    else
	printf(" woman ");
    printf("in my life.\n\n");
    printf("I had a great time with you, my dear %s, but it's over.\n", partner_name);
    printf("It just didn't seem to work out well because ");
    if (reason)
	printf("%s.\n", reason);
    else
	printf("there was no fire in\nour relationship anymore. ");
    printf("I hope we can still be friends.\n\n");
    printf("May you find many naked ");
    if (own_gender)
	printf("men");
    else
	printf("women");
    printf(" to throw tiny pickles at you.\n\n\n");
    printf("Sincerely,\n\n\n");
    printf("%s\n", own_name);
    
    return 0;
}

void exit_help()
{
	print_usage(stdout);

	printf("\nThe following options are available:\n");
	printf("--help,            ");
	printf("-h          This help.\n");
	printf("--version,         ");
	printf("-v          Version information.\n");
	printf("--own-gender,      ");
	printf("-O GENDER   Set own Y-chromosomes to GENDER.\n");
	printf("--own-name,        ");
	printf("-o NAME     Set own name to NAME.\n");
	printf("--partner-gender,  ");
	printf("-P GENDER   Set partner's Y-chromosomes to GENDER.\n");
	printf("--partner-name,    ");
	printf("-p NAME     Set partner's name to NAME.\n");
printf("\n\
Report bugs to: Cris van Pelt <tribbel@tribe.eu.org>\n");

	exit(EXIT_SUCCESS);
}

void exit_version()
{
	printf("\
%s %s - Break up with a significant other on stdout.\n\
Distributed under the terms of the GPL.\n\
\n\
THIS PACKAGE IS PROVIDED \"AS IS\" AND WITHOUT ANY EXPRESS OR\n\
IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED\n\
WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.\n\
\n\
This program is still in it's development stage. It may produce\n\
unwanted results.\
\n\
Copyright (C) 2000 Cris van Pelt <tribbel@tribe.eu.org>.\n", PACKAGE, VERSION);

	exit(EXIT_SUCCESS);
}

void print_usage(FILE * output)
{
	fprintf(output, "Usage: %s -p NAME -P GENDER [OPTIONS]\n", program_name);
}

Log in or register to write something here or to contact authors.