diff options
author | Pixel <Pixel> | 2002-07-21 11:52:56 +0000 |
---|---|---|
committer | Pixel <Pixel> | 2002-07-21 11:52:56 +0000 |
commit | cbee971a2e8929924f63535d174637106620eae3 (patch) | |
tree | 6ea7249ad3996c6e750deb9814991e9005887449 /lib | |
parent | 6528f07c516efe4d3b344f01740067878d5d9a43 (diff) |
Prlorf
Diffstat (limited to 'lib')
-rwxr-xr-x | lib/Makefile | 7 | ||||
-rw-r--r-- | lib/fileutils.cpp | 74 | ||||
-rw-r--r-- | lib/generic.cpp | 56 |
3 files changed, 6 insertions, 131 deletions
diff --git a/lib/Makefile b/lib/Makefile index 5503701..9fbb4b3 100755 --- a/lib/Makefile +++ b/lib/Makefile @@ -3,9 +3,14 @@ CPPFLAGS=-Wall -g -O3 -mcpu=i686 -pedantic -pedantic-errors -Werror -I../includes CXX=g++ -TARGET = cdutils.o dteutils.o fileutils.o generic.o lzss.o yazedc.o +OBJECTS = cdutils.o dteutils.o lzss.o yazedc.o +TARGET = lib.a all: ${TARGET} +lib.a: ${OBJECTS} + ar -r lib.a ${OBJECTS} + ranlib lib.a + clean: rm -f *.o ${TARGET} compil.c diff --git a/lib/fileutils.cpp b/lib/fileutils.cpp deleted file mode 100644 index b04a414..0000000 --- a/lib/fileutils.cpp +++ /dev/null @@ -1,74 +0,0 @@ -/* - * PSX-Tools Bundle Pack - * Copyright (C) 2002 Nicolas "Pixel" Noble - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program 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 General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#include <string.h> -#include <stdio.h> -#include <string.h> -#include <stdlib.h> -#include <unistd.h> -#include "generic.h" - -unsigned long filesize(int f_iso) -{ - long curpos, length; - - curpos = lseek(f_iso, 0, SEEK_CUR); - length = lseek(f_iso, 0, SEEK_END); - lseek(f_iso, curpos, SEEK_SET); - return length; -} - -void copy(int s, int d, long size) { - long i; - unsigned char c; - long r; - - for (i = 0; (i < size) || (size < 0); i++) { - r = read(s, &c, 1); - if (r == 0) { - break; - } - write(d, &c, 1); - } -} - -unsigned long filesize(FILE * f_iso) -{ - long curpos, length; - - curpos = ftell(f_iso); - fseek(f_iso, 0, SEEK_END); - length = ftell(f_iso); - fseek(f_iso, curpos, SEEK_SET); - return length; -} - -void copy(FILE * s, FILE * d, long size) { - long i; - unsigned char c; - long r; - - for (i = 0; (i < size) || (size < 0); i++) { - r = fread(&c, 1, 1, s); - if (r == 0) { - break; - } - fwrite(&c, 1, 1, d); - } -} diff --git a/lib/generic.cpp b/lib/generic.cpp deleted file mode 100644 index d165d27..0000000 --- a/lib/generic.cpp +++ /dev/null @@ -1,56 +0,0 @@ -/* - * PSX-Tools Bundle Pack - * Copyright (C) 2002 Nicolas "Pixel" Noble - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program 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 General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#include <stdio.h> -#include <stdarg.h> - -char verbosity = 0; - -char * heads[] = {"EE", "--", "WW", "II"}; - -void printm(int level, char * m, ...) { - va_list ap; - - if (verbosity < level) { - return; - } - - if (level >= 0) { - fprintf(stderr, "(%s) ", heads[level]); - } - - va_start(ap, m); - vfprintf(stderr, m, ap); - va_end(ap); -} - -char ** split(char * s, char t) { - static char * p[100]; - int i; - - for (i = 1, p[0] = s; *s; s++) { - if (*s == t) { - *s = 0; - p[i++] = s + 1; - } - } - p[i] = 0; - - return p; -} |