Esempio n. 1
0
EXPORT(sqInt) primitiveSetDisplayName(void) {
    extern char *displayName;
    sqInt name;
    static char nameBuffer[501];
    char * namePtr;


	/* Do not allow this if running in secure mode */

	if ((sandboxSecurity()) == 1) {
		interpreterProxy->pop(2);
		interpreterProxy->pushInteger(-1);
	} else {
		name = interpreterProxy->stackObjectValue(0);
		if (name == (interpreterProxy->nilObject())) {
			displayName = 0;
		} else {
			namePtr = transientCStringFromString(name);
			strncpy(nameBuffer, namePtr, 500);
			nameBuffer[500] = 0;
			displayName = nameBuffer;
		}
		interpreterProxy->pop(1);
	}
	return null;
}
Esempio n. 2
0
EXPORT(sqInt) primitiveCanConnectToDisplay(void) {
    Display *d;
    sqInt name;
    char * namePtr;


	/* Do not allow this if running in secure mode */

	if ((sandboxSecurity()) == 1) {
		interpreterProxy->pop(2);
		interpreterProxy->push(interpreterProxy->falseObject());
	} else {
		name = interpreterProxy->stackObjectValue(0);
		namePtr = transientCStringFromString(name);
		d = XOpenDisplay(namePtr);
		if (d == 0) {

			/* Failed to make connection to server, answer false */

			interpreterProxy->pop(2);
			interpreterProxy->push(interpreterProxy->falseObject());
		} else {

			/* Successfully opened connection; close it and answer true */

			XCloseDisplay(d);
			interpreterProxy->pop(2);
			interpreterProxy->push(interpreterProxy->trueObject());
		}
	}
	return null;
}
Esempio n. 3
0
EXPORT(sqInt) primitiveCanConnectToDisplay(void) {
    sqInt name;
    char * namePtr;
    Display *d;

	if ((sandboxSecurity()) == 1) {
		interpreterProxy->pop(2);
		interpreterProxy->push(interpreterProxy->falseObject());
	} else {
		name = interpreterProxy->stackObjectValue(0);
		namePtr = transientCStringFromString(name);
		d = XOpenDisplay(namePtr);
		if (d == 0) {
			interpreterProxy->pop(2);
			interpreterProxy->push(interpreterProxy->falseObject());
		} else {
			XCloseDisplay(d);
			interpreterProxy->pop(2);
			interpreterProxy->push(interpreterProxy->trueObject());
		}
	}
}
Esempio n. 4
0
EXPORT(sqInt) primitiveOpenDisplay(void) {
	if (!((sandboxSecurity()) == 1)) {
		openXDisplay();
	}
}
Esempio n. 5
0
EXPORT(sqInt) primitiveKillDisplay(void) {
	if (!((sandboxSecurity()) == 1)) {
		disconnectXDisplay();
	}
}
Esempio n. 6
0
EXPORT(sqInt) primitiveDisconnectDisplay(void) {
	if (!((sandboxSecurity()) == 1)) {
		forgetXDisplay();
	}
}