#ifdef ournix #include "ournix.h" #endif char sccsID[] = "@(#) zerofile.c V1.4 Copyright Julian H. Stacey, Munich, 31st January 1989.\n"; /* creates a file with bland boring data to occupy remaining space on disk */ #ifdef ns32000 #define BSD #endif #include #if ( MSDOS || __OpenBSD__ ) #include /* for O_RDONLY */ #endif #include #include #ifdef BSD #include #endif #if ( defined i386 || defined __FreeBSD__ /* allow for FreeBSD amd64 */ ) /* Find std includes with: cp /dev/null ~/tmp/tmp.c ; cc -E -dM ~/tmp/tmp.c */ #include /* for O_RDONLY */ #endif char zerofile[] = "zerofile" ; #define SIZE 32 char buffer[SIZE] ; char **ARGV ; main(argv,argc) char **argv ; int argc ; { int zero_fd ; int count ; char *p_c ; ARGV = argv ; #ifdef VSL /* { */ #include "../../include/vsl.h" #endif /* } */ if ((zero_fd = open(zerofile, O_WRONLY | O_CREAT | #ifdef MSDOS O_BINARY | #endif O_TRUNC , S_IREAD | S_IWRITE)) == -1) { fprintf(stderr,"%s: Cant open %s.\n",*argv,zerofile); exit(1); } #define PAD_CHAR 'X' for (count = SIZE - 2 ; count--;buffer[count] = PAD_CHAR ) ; (void) sprintf(buffer, "AAZZ: repeat length %d.\r\n",(int)SIZE) ; for ( p_c = buffer ; *++p_c != '\0' ; ) ; *p_c = PAD_CHAR ; buffer[SIZE - 2] = '\r'; buffer[SIZE - 1] = '\n'; while (write(zero_fd,buffer,SIZE) == SIZE) ; if (close(zero_fd) ) { perror(*ARGV) ; exit(1) ; } exit(0); }