/* gcc -Wall -pedantic `pkg-config --cflags --libs x11` -o test-xreply test-xreply.c */ #include #include #define NR_OF_ATOMS 100 int main() { Display *display = NULL; int i = 0; const int alphabet_size = 'z' - 'a' + 1; char names[NR_OF_ATOMS][3]; Atom atoms[NR_OF_ATOMS]; char *xnames[NR_OF_ATOMS]; display = XOpenDisplay(NULL); if (!display) return 2; /* Create a lot of atom names: aa, ..., az, ba, ..., bz, ... */ for (i = 0; i < NR_OF_ATOMS; ++i) { names[i][0] = 'a' + ((i / alphabet_size) % alphabet_size); names[i][1] = 'a' + (i % alphabet_size); names[i][2] = '\0'; xnames[i] = names[i]; } /* Create the atoms. */ if (!XInternAtoms(display, xnames, NR_OF_ATOMS, False, atoms)) return 2; XCloseDisplay(display); return 0; }