#! /bin/bash /home/russ/bin/dscript import std.stdio; import std.c.process; import std.file; import std.c.stdio; import std.string; import std.c.stdlib; import std.system; extern(C) FILE *popen(char*,char*); extern(C) int wait(int*); extern(C) int waitpid(int,int*,int); int WEXITSTATUS(int status) { return (status & 0x0FF00) >> 8; } const int WNOHANG = 1; FILE *popen_d(char[] cmd,char[] mode) { return popen(toStringz(cmd),toStringz(mode)); } FILE *fopen_d(char[] file,char[] mode) { return fopen(toStringz(file),toStringz(mode)); } int system_d(char[] cmd) { return system(toStringz(cmd)); } void dump(FILE *from,FILE *to) { char c = fgetc(from); while(!feof(from)) { fputc(c, to); c = fgetc(from); }; } void flush_pending_child_stati() { int status; while(waitpid(-1, &status, WNOHANG) > 0) { ; } return; } char[] implode_args(char[][] args) { if(args.length == 0) return ""; char[] ret = "\""~args[0]~"\""; foreach(char[] arg; args[1..length]) { ret ~= " \""~arg~"\""; } return ret; } if(argv.length < 2 || argv[1].length == 0) { fwritefln(stderr, "dscript ERROR: No command given."); fwritefln(stderr, "dscript SYNTAX: ",argv[0],"