aewl

diff util.c @ 32:082c75b937b5

removed unnecessary crap
author Anselm R. Garbe <garbeam@wmii.de>
date Thu, 13 Jul 2006 01:30:55 +0200
parents 2e0fb4130bfb
children e90449e03167
line diff
     1.1 --- a/util.c	Thu Jul 13 01:04:38 2006 +0200
     1.2 +++ b/util.c	Thu Jul 13 01:30:55 2006 +0200
     1.3 @@ -11,7 +11,7 @@
     1.4  #include <sys/wait.h>
     1.5  #include <unistd.h>
     1.6  
     1.7 -#include "util.h"
     1.8 +#include "wm.h"
     1.9  
    1.10  void
    1.11  error(char *errstr, ...) {
    1.12 @@ -60,20 +60,13 @@
    1.13  char *
    1.14  estrdup(const char *str)
    1.15  {
    1.16 -	void *res = strdup(str);
    1.17 +	char *res = strdup(str);
    1.18  	if(!res)
    1.19  		bad_malloc(strlen(str));
    1.20  	return res;
    1.21  }
    1.22  
    1.23  void
    1.24 -failed_assert(char *a, char *file, int line)
    1.25 -{
    1.26 -	fprintf(stderr, "Assertion \"%s\" failed at %s:%d\n", a, file, line);
    1.27 -	abort();
    1.28 -}
    1.29 -
    1.30 -void
    1.31  swap(void **p1, void **p2)
    1.32  {
    1.33  	void *tmp = *p1;
    1.34 @@ -99,43 +92,3 @@
    1.35  	}
    1.36  	wait(0);
    1.37  }
    1.38 -
    1.39 -void
    1.40 -pipe_spawn(char *buf, unsigned int len, Display *dpy, char *argv[])
    1.41 -{
    1.42 -	unsigned int l, n;
    1.43 -	int pfd[2];
    1.44 -
    1.45 -	if(!argv || !argv[0])
    1.46 -		return;
    1.47 -
    1.48 -	if(pipe(pfd) == -1) {
    1.49 -		perror("pipe");
    1.50 -		exit(1);
    1.51 -	}
    1.52 -
    1.53 -	if(fork() == 0) {
    1.54 -		if(dpy)
    1.55 -			close(ConnectionNumber(dpy));
    1.56 -		setsid();
    1.57 -		dup2(pfd[1], STDOUT_FILENO);
    1.58 -		close(pfd[0]);
    1.59 -		close(pfd[1]);
    1.60 -		execvp(argv[0], argv);
    1.61 -		fprintf(stderr, "gridwm: execvp %s", argv[0]);
    1.62 -		perror(" failed");
    1.63 -	}
    1.64 -	else {
    1.65 -		l = n = 0;
    1.66 -		close(pfd[1]);
    1.67 -		while(n < len) {
    1.68 -			if((l = read(pfd[0], buf + n, len - n)) < 1)
    1.69 -				break;
    1.70 -			n += l;
    1.71 -		}
    1.72 -		while(l > n);
    1.73 -		close(pfd[0]);
    1.74 -		buf[n < len ? n : len - 1] = 0;
    1.75 -	}
    1.76 -	wait(0);
    1.77 -}