dwm

personal fork of dwm (rnpnr branch)
git clone anongit@rnpnr.xyz:dwm.git
Log | Files | Refs | Feed | README | LICENSE

unity.c (1241B)


      1 /* See LICENSE file for copyright and license details. */
      2 #include <ctype.h>
      3 #include <errno.h>
      4 #include <locale.h>
      5 #include <signal.h>
      6 #include <stdarg.h>
      7 #include <stddef.h>
      8 #include <stdio.h>
      9 #include <stdlib.h>
     10 #include <string.h>
     11 #include <sys/types.h>
     12 #include <sys/wait.h>
     13 #include <unistd.h>
     14 
     15 #include <X11/Xatom.h>
     16 #include <X11/Xft/Xft.h>
     17 #include <X11/Xlib.h>
     18 #include <X11/Xproto.h>
     19 #include <X11/Xutil.h>
     20 #include <X11/cursorfont.h>
     21 #ifdef XINERAMA
     22 #include <X11/extensions/Xinerama.h>
     23 #endif /* XINERAMA */
     24 #include <X11/keysym.h>
     25 
     26 #define MAX(A, B)               ((A) > (B) ? (A) : (B))
     27 #define MIN(A, B)               ((A) < (B) ? (A) : (B))
     28 #define BETWEEN(X, A, B)        ((A) <= (X) && (X) <= (B))
     29 #define LENGTH(X)               (sizeof (X) / sizeof (X)[0])
     30 
     31 static void
     32 die(const char *fmt, ...)
     33 {
     34 	va_list ap;
     35 	int saved_errno;
     36 
     37 	saved_errno = errno;
     38 
     39 	va_start(ap, fmt);
     40 	vfprintf(stderr, fmt, ap);
     41 	va_end(ap);
     42 
     43 	if (fmt[0] && fmt[strlen(fmt)-1] == ':')
     44 		fprintf(stderr, " %s", strerror(saved_errno));
     45 	fputc('\n', stderr);
     46 
     47 	exit(1);
     48 }
     49 
     50 static void *
     51 ecalloc(size_t nmemb, size_t size)
     52 {
     53 	void *p;
     54 
     55 	if (!(p = calloc(nmemb, size)))
     56 		die("calloc:");
     57 	return p;
     58 }
     59 
     60 #include "drw.h"
     61 #include "drw.c"
     62 #include "dwm.c"