home *** CD-ROM | disk | FTP | other *** search
- /* randjpeg.c
- * MACHINE: RISC OS 3.60
- * LANGUAGE: Acorn C v5.06
- * AUTHOR: Cy Booker <cy@cheepnis.demon.co.uk>
- * LICENCE: Freeware, copyright 1995
- */
-
- #include "main.h"
-
-
- #include <stdio.h>
- #include <stdlib.h>
- #include <time.h>
-
-
- #include "randfile.h"
- #include "process.h"
-
-
-
- /* +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
- */
-
- int main(
- int argc,
- char **argv) {
-
- char *file;
-
- if (argc != 4) {
- fprintf(stderr, "randjpeg: usage is randjpeg <path> <history-file> <sprite-file> (%d)\n", argc);
- return EXIT_FAILURE;
- }
- srand(time(NULL));
- file = rand_file(argv[1], argv[2]);
- if (!file) {
- fputs("randjpeg: no JPEG files found\n", stderr);
- return EXIT_FAILURE;
- }
- process(file, argv[3]);
- free(file);
- return EXIT_SUCCESS;
- }
-
-
-
- /* +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
- */
-
- extern void *xmalloc(
- size_t count) {
- void *ptr;
-
- ptr = malloc(count);
- if (ptr == NULL) {
- fprintf(stderr, "randjpeg: out of memory (need %u)\n", (unsigned int)count);
- exit(EXIT_FAILURE);
- }
- return ptr;
- }
-
-
-