summary refs log tree commit diff stats
path: root/compiler/semdestruct.nim
Commit message (Collapse)AuthorAgeFilesLines
* fixes #2420; negative indexing for slicing is obsolete (breaking change!)Araq2015-03-281-16/+17
|
* Fix typosFederico Ceratto2015-02-151-1/+1
|
* Nimrod renamed to NimAraq2014-08-281-1/+1
|
* progress on deepCopyAraq2014-08-011-2/+1
|
* handle nested case objects in destructor generationZahary Karadjov2014-02-151-36/+31
|
* disable internalError so that nimbuild compiles againAraq2014-01-251-1/+4
|
* fixed #597Zahary Karadjov2014-01-021-27/+53
|
* case consistency part 4Araq2013-12-271-5/+5
|
* case consistency part 1Araq2013-12-271-3/+3
|
* get rid of the SymTab* procs in astalgoZahary Karadjov2013-05-121-1/+1
|
* completed expr/stmt unificationAraq2013-05-031-0/+213
color: #22bb22; background-color: #f0fff0 } /* Literal.String.Other */ .highlight .sr { color: #008800; background-color: #fff0ff } /* Literal.String.Regex */ .highlight .s1 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Single */ .highlight .ss { color: #aa6600; background-color: #fff0f0 } /* Literal.String.Symbol */ .highlight .bp { color: #003388 } /* Name.Builtin.Pseudo */ .highlight .fm { color: #0066bb; font-weight: bold } /* Name.Function.Magic */ .highlight .vc { color: #336699 } /* Name.Variable.Class */ .highlight .vg { color: #dd7700 } /* Name.Variable.Global */ .highlight .vi { color: #3333bb } /* Name.Variable.Instance */ .highlight .vm { color: #336699 } /* Name.Variable.Magic */ .highlight .il { color: #0000DD; font-weight: bold } /* Literal.Number.Integer.Long */
/*
 * (C)opyright MMVI Anselm R. Garbe <garbeam at gmail dot com>
 * See LICENSE file for license details.
 */
#include "dwm.h"

#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include <sys/wait.h>
#include <unistd.h>

/* static */

static void
bad_malloc(unsigned int size)
{
	fprintf(stderr, "fatal: could not malloc() %d bytes\n",
			(int) size);
	exit(EXIT_FAILURE);
}

/* extern */

void *
emallocz(unsigned int size)
{
	void *res = calloc(1, size);
	if(!res)
		bad_malloc(size);
	return res;
}

void
eprint(const char *errstr, ...) {
	va_list ap;
	va_start(ap, errstr);
	vfprintf(stderr, errstr, ap);
	va_end(ap);
	exit(EXIT_FAILURE);
}

void
spawn(Arg *arg)
{
	char **argv = (char **)arg->argv;
	if(!argv || !argv[0])
		return;
	if(fork() == 0) {
		if(fork() == 0) {
			if(dpy)
				close(ConnectionNumber(dpy));
			setsid();
			execvp(argv[0], argv);
			fprintf(stderr, "dwm: execvp %s", argv[0]);
			perror(" failed");
		}
		exit(EXIT_FAILURE);
	}
	wait(0);
}