home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Mega CD-ROM 1
/
megacd_rom_1.zip
/
megacd_rom_1
/
MAGAZINE
/
DDJMAG
/
DDJ9104.ZIP
/
MORROW.ZIP
/
UTIL.C
< prev
next >
Wrap
C/C++ Source or Header
|
1989-09-03
|
794b
|
78 lines
/***
* GASystem
* Mike Morrow
* September 1989
***/
/**
* Utilities
**/
#include <ctype.h>
#include <stdio.h>
#include "util.h"
#if __STDC__
#include <stdlib.h>
#endif
#ifndef randnum
/**
* Generate a random number between [0, x - 1]
**/
int randnum(x)
int x;
{
#ifdef unix
return (int) (random() % x);
#else
return (int) (rand() % x);
#endif
}
#endif
char *eatblanks(s)
char *s;
{
while(isspace(*s)) s++;
return s;
}
void fatal(s)
char *s;
{
fprintf(stderr, "Fatal error: %s\n", s);
exit(1);
}
void warning(s)
char *s;
{
fprintf(stderr, "Warning: %s\n", s);
fflush(stderr);
}
void strupper(s)
char *s;
{
while(*s)
{
if(islower(*s))
*s = toupper(*s);
s++;
}
}