This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <errno.h> | |
#include <stdio.h> | |
#include <stdlib.h> | |
#include <string.h> | |
#include <zmq.h> | |
#define zcheck_err(eval, condition, fmt, args...) \ | |
((void)({ \ | |
errno = 0; \ | |
if (!(condition)) { \ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <czmq.h> | |
#include <errno.h> | |
#include <stdio.h> | |
#include <stdlib.h> | |
#include <zmq.h> | |
#define zcheck_err(eval, condition, fmt, args...) \ | |
((void)({ \ | |
errno = 0; \ | |
if (!(condition)) { \ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <czmq.h> | |
#include <stdio.h> | |
#include <stdlib.h> | |
#include <zmq.h> | |
#define zcheck_err(eval, condition, fmt, args...) \ | |
((void)({ \ | |
errno = 0; \ | |
if (!(condition)) { \ | |
fprintf(stderr, "%s: " fmt "%s%s\n", prog_name, ##args, errno ? ": " : "", errno ? zmq_strerror(errno) : ""); \ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# offsets.awk | |
# | |
# given a list of word offset pairs, accumulate offsets and print | |
# word [offset,...] pairs | |
# use with offsets.c | |
# no good way to shebang awk, so just do awk -f manually | |
{ | |
a[$1] = a[$1] (a[$1] ? "," : "") $2; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#ifndef ZERR_H | |
#define ZERR_H | |
#ifndef _GNU_SOURCE | |
#define _GNU_SOURCE // for program_invocation_name | |
#endif | |
#include <errno.h> | |
#include <stdio.h> | |
#include <stdlib.h> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <czmq.h> | |
#include <stdlib.h> | |
#include <zmq.h> | |
#include "zerr.h" | |
/* | |
* read message, switch first two frames (from and to), send it back out | |
* arg is the socket to which the message should be sent. For the front_end arg | |
* is back_end, and vice versa. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# | |
# Simulate add/remove events by writing directly | |
# into the uevent files. | |
if [ "$#" -ne 1 ] || [ "$1" != add ] && [ "$1" != remove ]; then | |
# warning: can't trust $0, better off just hard coding the name | |
# echo "usage: simevent add|remove" 1>&2 | |
printf "usage: %s add|remove\n" "${0##*/}" 1>&2 | |
exit 1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <stdlib.h> | |
#include <stdint.h> | |
#include <inttypes.h> | |
uintmax_t calls; | |
void print(int *chain, int len) | |
{ | |
for (int i = 0; i < len; i++) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <stdlib.h> | |
#include <string.h> | |
typedef struct Node Node; | |
struct Node { | |
Node *next; /* next Node in the chain */ | |
Node *first; /* Node we started the chain on */ | |
int pos; /* position in chain */ | |
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <errno.h> | |
#include <fcntl.h> | |
#include <stdio.h> | |
#include <stdlib.h> | |
#include <string.h> | |
#include <sys/stat.h> | |
#include <unistd.h> | |
#define x(s,d,...)if(s){o=errno;fputs(*v,stderr);fprintf(stderr,": "__VA_ARGS__\ | |
);errno=o;perror(0);d;} | |
#define l while |
OlderNewer