GNU/Linux ◆ xterm-256color ◆ fish 148 views

here’s the source code for pararun:

I2luY2x1ZGUgPHVuaXN0ZC5oPgojaW5jbHVkZSA8c3RkaW8uaD4KI2luY2x1ZGUgPHN5cy93YWl0
Lmg+CgojZGVmaW5lIFBBUkFSVU5fTkFNRSBhcmd2WzBdCiNkZWZpbmUgRVhFQ1VUQUJMRSBhcmd2
WzFdCgppbnQgbWFpbihpbnQgYXJnYywgY2hhcioqIGFyZ3YpIHsKCWlmIChhcmdjIDwgMikgewoJ
CXByaW50ZigiVXNhZ2U6ICVzIC4vZXhlY3V0YWJsZSBmaWxlMSBmaWxlMiBmaWxlM1xuIiwgUEFS
QVJVTl9OQU1FKTsKCQlyZXR1cm4gMTsKCX0KCWlmIChhcmdjIDwgMykgewoJCXByaW50ZigiVXNh
Z2U6ICVzICVzIGZpbGUxIGZpbGUyIGZpbGUzXG4iLCBQQVJBUlVOX05BTUUsIEVYRUNVVEFCTEUp
OwoJCXJldHVybiAxOwoJfQoJZm9yIChpbnQgaSA9IDI7IGkgPCBhcmdjOyBpICs9IDEpIHsKCQlp
ZiAoZm9yaygpID09IDApIHsKCQkJZXhlY2xwKEVYRUNVVEFCTEUsIEVYRUNVVEFCTEUsIGFyZ3Zb
aV0sIE5VTEwpOwoJCQlicmVhazsKCQl9Cgl9CgoJZm9yIChpbnQgaSA9IDI7IGkgPCBhcmdjOyBp
ICs9IDEpIHsKCQl3YWl0KE5VTEwpOwoJfQoKCXJldHVybiAwOwp9Cg==

and the non-base64 version:

#include <unistd.h>
#include <stdio.h>
#include <sys/wait.h>

#define PARARUN_NAME argv[0]
#define EXECUTABLE argv[1]

int main(int argc, char** argv) {
	if (argc < 2) {
		printf("Usage: %s ./executable file1 file2 file3\n", PARARUN_NAME);
		return 1;
	}
	if (argc < 3) {
		printf("Usage: %s %s file1 file2 file3\n", PARARUN_NAME, EXECUTABLE);
		return 1;
	}
	for (int i = 2; i < argc; i += 1) {
		if (fork() == 0) {
			execlp(EXECUTABLE, EXECUTABLE, argv[i], NULL);
			break;
		}
	}

	for (int i = 2; i < argc; i += 1) {
		wait(NULL);
	}

	return 0;
}

More by darkgeem

Owega v5.7.5 showcase 08:26

by darkgeem

OpenChat v3.2.0 02:01

by darkgeem

openchat v1.1.0 demo 02:39

by darkgeem

See all