/* * Copyright (c) 1983-2013 Trevor Wishart and Composers Desktop Project Ltd * http://www.trevorwishart.co.uk * http://www.composersdesktop.com * This file is part of the CDP System. The CDP System is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The CDP System is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the CDP System; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ #include #include #include #include #include #include char errstr[2400]; #define MONO (1) #define STEREO (2) #define ENDOFSTR ('\0') #define LEAVESPACE (10*1024) void splice_multiline_string(char *str,char *prefix); const char* cdp_version = "7.1.0"; /*RWD Jan 2014 updated getdrivefreespace(), corrected INFO output format for unsigned long */ /************************************ CHECK_AVAILABLE_DISKSPACE ********************************/ int main(int argc,char *argv[]) { double srate, secs, mins, hrs; unsigned int outsamps = 0, orig_outsamps; int m, k, kk, spacecnt; char temp[800]; unsigned int freespace = getdrivefreespace(/*"temp"*/".") - LEAVESPACE; unsigned int start = hz1000(); if((argc==2) && strcmp(argv[1],"--version")==0) { fprintf(stdout,"%s\n",cdp_version); fflush(stdout); return 0; } //start = hz1000(); if(argc!=2) { fprintf(stdout,"ERROR: Cannot run this process.\n"); fflush(stdout); //TW UPDATE while(!(hz1000() - start)) ; return 1; } if(sscanf(argv[1],"%lf",&srate)!=1) { fprintf(stdout,"ERROR: Cannot read sample rate.\n"); fflush(stdout); //TW UPDATE while(!(hz1000() - start)) ; return 1; } sprintf(errstr,"AVAILABLE DISK SPACE\n"); sprintf(temp,"%u",freespace); strcat(errstr,temp); spacecnt = 13 - strlen(temp); for(k=0;k 0.0) { sprintf(temp,"%.0lf",hrs); strcat(errstr,temp); spacecnt = 3 - strlen(temp); for(k=0;k 0.0) { sprintf(temp,"%.0lf",mins); strcat(errstr,temp); spacecnt = 3 - strlen(temp); for(k=0;k