/* calculate MegaBytes from disk-blocks*/ /* blocks_to_mb number number can be a decimal,octal, or hexdecimal number. Conversion is to "long long" (64bit) . Output to decimal string in DCL symbol MB. Utility needed because DCL can't handle the number of blocks in the terabyte disk area. */ #ifdef __vms #include #include #include #include #include #include #include #include #include starlet long long cvtnum_ll ( char * ); /* Util library routine */ int main (int argc, char **argv) { char svalue[24]; long long x; $DESCRIPTOR(symbol_value_desc,svalue); $DESCRIPTOR(symbol_name_desc,"MB"); if (1 < argc) { errno=0; x = cvtnum_ll (argv[1]); if (errno) {perror("cvtnum error:"); sys$exit(vaxc$errno);} else { /* VMS disk-blocks are 512 bytes, so the equivalent in Megabytes is blocks/2048. */ /* x = (x+48) / 2048; */ x = ceill( (long double)x/2048.); sprintf(svalue,"%lld",x); symbol_value_desc.dsc$w_length = strlen(svalue); (void) LIB$SET_SYMBOL(&symbol_name_desc,&symbol_value_desc,0); } } return 0; } #endif