From 93a891e4933c95e7dddb09000c4e06c93903047d Mon Sep 17 00:00:00 2001 From: Elliot Nunn Date: Wed, 19 Sep 2018 18:12:03 +0800 Subject: [PATCH] wip builds --- .stamp/config.h | 0 .stamp/config.h.in | 0 .stamp/configure | 0 acconfig.h | 38 -------------------------------------- apple.h | 2 ++ block.c | 10 +++------- block.h | 2 ++ btree.c | 4 ---- btree.h | 2 ++ config.h | 4 +++- data.c | 4 ---- data.h | 2 ++ elliot-file-list.txt | 1 - file.c | 4 ---- file.h | 2 ++ hfs.c | 10 +++------- hfs.h | 2 ++ libhfs.h | 2 ++ low.c | 4 ---- low.h | 2 ++ main.c | 13 +++++++++++++ medium.c | 4 ---- medium.h | 2 ++ memcmp.c | 4 ---- node.c | 4 ---- node.h | 2 ++ os/unix.c => os.c | 19 ------------------- os.h | 2 ++ record.c | 4 ---- record.h | 2 ++ version.h | 2 ++ volume.c | 4 ---- volume.h | 2 ++ 33 files changed, 50 insertions(+), 109 deletions(-) delete mode 100644 .stamp/config.h delete mode 100644 .stamp/config.h.in delete mode 100644 .stamp/configure delete mode 100644 acconfig.h delete mode 100644 elliot-file-list.txt create mode 100644 main.c rename os/unix.c => os.c (90%) diff --git a/.stamp/config.h b/.stamp/config.h deleted file mode 100644 index e69de29..0000000 diff --git a/.stamp/config.h.in b/.stamp/config.h.in deleted file mode 100644 index e69de29..0000000 diff --git a/.stamp/configure b/.stamp/configure deleted file mode 100644 index e69de29..0000000 diff --git a/acconfig.h b/acconfig.h deleted file mode 100644 index a4e50ba..0000000 --- a/acconfig.h +++ /dev/null @@ -1,38 +0,0 @@ -/* - * libhfs - library for reading and writing Macintosh HFS volumes - * Copyright (C) 1996-1998 Robert Leslie - * - * 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., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * $Id: acconfig.h,v 1.5 1998/04/11 08:27:11 rob Exp $ - */ - -/***************************************************************************** - * Definitions selected automatically by `configure' * - *****************************************************************************/ -@TOP@ - -/* Define if you want to enable diagnostic debugging support. */ -#undef DEBUG - -@BOTTOM@ - -/***************************************************************************** - * End of automatically configured definitions * - *****************************************************************************/ - -# ifdef DEBUG -# include -# endif diff --git a/apple.h b/apple.h index eef34d6..6e48e0f 100644 --- a/apple.h +++ b/apple.h @@ -19,6 +19,8 @@ * $Id: apple.h,v 1.1 1998/04/11 08:27:11 rob Exp $ */ +#pragma once + typedef signed char Char; typedef unsigned char UChar; typedef signed char SignedByte; diff --git a/block.c b/block.c index 2a002fc..66bb443 100644 --- a/block.c +++ b/block.c @@ -19,10 +19,6 @@ * $Id: block.c,v 1.11 1998/11/02 22:08:52 rob Exp $ */ -# ifdef HAVE_CONFIG_H -# include "config.h" -# endif - # include # include # include @@ -267,11 +263,11 @@ fail: } /* - * NAME: compare() + * NAME: bcompare() * DESCRIPTION: comparison function for qsort of cache bucket pointers */ static -int compare(const bucket **b1, const bucket **b2) +int bcompare(const bucket **b1, const bucket **b2) { long diff; @@ -297,7 +293,7 @@ int dobuckets(hfsvol *vol, bucket **chain, unsigned int len, int result = 0; qsort(chain, len, sizeof(*chain), - (int (*)(const void *, const void *)) compare); + (int (*)(const void *, const void *)) bcompare); for (i = 0; i < len; i += count) { diff --git a/block.h b/block.h index fdbc099..55e90f5 100644 --- a/block.h +++ b/block.h @@ -19,6 +19,8 @@ * $Id: block.h,v 1.10 1998/11/02 22:08:53 rob Exp $ */ +#pragma once + int b_init(hfsvol *); int b_flush(hfsvol *); int b_finish(hfsvol *); diff --git a/btree.c b/btree.c index d7d1916..8988f35 100644 --- a/btree.c +++ b/btree.c @@ -19,10 +19,6 @@ * $Id: btree.c,v 1.10 1998/11/02 22:08:54 rob Exp $ */ -# ifdef HAVE_CONFIG_H -# include "config.h" -# endif - # include # include # include diff --git a/btree.h b/btree.h index b3775a1..465fef1 100644 --- a/btree.h +++ b/btree.h @@ -19,6 +19,8 @@ * $Id: btree.h,v 1.8 1998/11/02 22:08:55 rob Exp $ */ +#pragma once + int bt_getnode(node *, btree *, unsigned long); int bt_putnode(node *); diff --git a/config.h b/config.h index ef118a9..fae133c 100644 --- a/config.h +++ b/config.h @@ -21,6 +21,8 @@ * $Id: acconfig.h,v 1.5 1998/04/11 08:27:11 rob Exp $ */ +#pragma once + /***************************************************************************** * Definitions selected automatically by `configure' * *****************************************************************************/ @@ -32,7 +34,7 @@ /* #undef size_t */ /* Define if you have the ANSI C header files. */ -#define STDC_HEADERS 1 +//#define STDC_HEADERS 1 /* Define if your declares struct tm. */ /* #undef TM_IN_SYS_TIME */ diff --git a/data.c b/data.c index 0dee6bc..b84fad6 100644 --- a/data.c +++ b/data.c @@ -19,10 +19,6 @@ * $Id: data.c,v 1.7 1998/11/02 22:08:57 rob Exp $ */ -# ifdef HAVE_CONFIG_H -# include "config.h" -# endif - # include # include diff --git a/data.h b/data.h index fd38e75..6203ce7 100644 --- a/data.h +++ b/data.h @@ -19,6 +19,8 @@ * $Id: data.h,v 1.7 1998/11/02 22:08:58 rob Exp $ */ +#pragma once + extern const unsigned char hfs_charorder[]; signed char d_getsb(register const unsigned char *); diff --git a/elliot-file-list.txt b/elliot-file-list.txt deleted file mode 100644 index eb5e7b7..0000000 --- a/elliot-file-list.txt +++ /dev/null @@ -1 +0,0 @@ -block.c btree.c data.c file.c hfs.c low.c medium.c memcmp.c node.c os.c record.c version.c volume.c \ No newline at end of file diff --git a/file.c b/file.c index 3fcc435..a005be8 100644 --- a/file.c +++ b/file.c @@ -19,10 +19,6 @@ * $Id: file.c,v 1.9 1998/11/02 22:08:59 rob Exp $ */ -# ifdef HAVE_CONFIG_H -# include "config.h" -# endif - # include # include diff --git a/file.h b/file.h index 8bd66bb..4a44bca 100644 --- a/file.h +++ b/file.h @@ -19,6 +19,8 @@ * $Id: file.h,v 1.6 1998/04/11 08:27:12 rob Exp $ */ +#pragma once + enum { fkData = 0x00, fkRsrc = 0xff diff --git a/hfs.c b/hfs.c index f674cce..99b3e84 100644 --- a/hfs.c +++ b/hfs.c @@ -19,10 +19,6 @@ * $Id: hfs.c,v 1.15 1998/11/02 22:09:00 rob Exp $ */ -# ifdef HAVE_CONFIG_H -# include "config.h" -# endif - # include # include # include @@ -1535,11 +1531,11 @@ fail: } /* - * NAME: compare() + * NAME: hcompare() * DESCRIPTION: comparison function for qsort of blocks to be spared */ static -int compare(const unsigned int *n1, const unsigned int *n2) +int hcompare(const unsigned int *n1, const unsigned int *n2) { return *n1 - *n2; } @@ -1760,7 +1756,7 @@ int hfs_format(const char *path, int pnum, int mode, const char *vname, f_init(&bbfile, &vol, HFS_CNID_BADALLOC, "bad blocks"); qsort(badalloc, nbadblocks, sizeof(*badalloc), - (int (*)(const void *, const void *)) compare); + (int (*)(const void *, const void *)) hcompare); for (i = 0; i < nbadblocks; ++i) { diff --git a/hfs.h b/hfs.h index 90a5e9d..756af59 100644 --- a/hfs.h +++ b/hfs.h @@ -19,6 +19,8 @@ * $Id: hfs.h,v 1.11 1998/11/02 22:09:01 rob Exp $ */ +#pragma once + # include # define HFS_BLOCKSZ 512 diff --git a/libhfs.h b/libhfs.h index a8943cb..52ad1fd 100644 --- a/libhfs.h +++ b/libhfs.h @@ -19,6 +19,8 @@ * $Id: libhfs.h,v 1.7 1998/11/02 22:09:02 rob Exp $ */ +#pragma once + # include "hfs.h" # include "apple.h" diff --git a/low.c b/low.c index f5e2ad1..fe7999e 100644 --- a/low.c +++ b/low.c @@ -19,10 +19,6 @@ * $Id: low.c,v 1.8 1998/11/02 22:09:03 rob Exp $ */ -# ifdef HAVE_CONFIG_H -# include "config.h" -# endif - # include # include # include diff --git a/low.h b/low.h index 03db9bb..e92c906 100644 --- a/low.h +++ b/low.h @@ -19,6 +19,8 @@ * $Id: low.h,v 1.6 1998/04/11 08:27:13 rob Exp $ */ +#pragma once + # define HFS_DDR_SIGWORD 0x4552 # define HFS_PM_SIGWORD 0x504d diff --git a/main.c b/main.c new file mode 100644 index 0000000..0da7867 --- /dev/null +++ b/main.c @@ -0,0 +1,13 @@ +#include "block.c" +#include "btree.c" +#include "data.c" +#include "file.c" +#include "hfs.c" +#include "low.c" +#include "medium.c" +#include "memcmp.c" +#include "node.c" +#include "os.c" +#include "record.c" +#include "version.c" +#include "volume.c" diff --git a/medium.c b/medium.c index baa5a3c..cc0ecd0 100644 --- a/medium.c +++ b/medium.c @@ -19,10 +19,6 @@ * $Id: medium.c,v 1.4 1998/11/02 22:09:04 rob Exp $ */ -# ifdef HAVE_CONFIG_H -# include "config.h" -# endif - # include # include # include diff --git a/medium.h b/medium.h index 5580a9e..b644bf7 100644 --- a/medium.h +++ b/medium.h @@ -19,6 +19,8 @@ * $Id: medium.h,v 1.3 1998/04/11 08:27:13 rob Exp $ */ +#pragma once + /* * Partition Types: * diff --git a/memcmp.c b/memcmp.c index f1816e4..80aa87d 100644 --- a/memcmp.c +++ b/memcmp.c @@ -19,10 +19,6 @@ * $Id: memcmp.c,v 1.6 1998/04/11 16:22:48 rob Exp $ */ -# ifdef HAVE_CONFIG_H -# include "config.h" -# endif - # include /* diff --git a/node.c b/node.c index 90268e0..29ac54b 100644 --- a/node.c +++ b/node.c @@ -19,10 +19,6 @@ * $Id: node.c,v 1.9 1998/11/02 22:09:05 rob Exp $ */ -# ifdef HAVE_CONFIG_H -# include "config.h" -# endif - # include # include # include diff --git a/node.h b/node.h index 91287fd..37764ac 100644 --- a/node.h +++ b/node.h @@ -19,6 +19,8 @@ * $Id: node.h,v 1.7 1998/11/02 22:09:06 rob Exp $ */ +#pragma once + void n_init(node *, btree *, int, int); int n_new(node *); diff --git a/os/unix.c b/os.c similarity index 90% rename from os/unix.c rename to os.c index 736243d..e5fff0e 100644 --- a/os/unix.c +++ b/os.c @@ -19,27 +19,8 @@ * $Id: unix.c,v 1.8 1998/11/02 22:09:13 rob Exp $ */ -# ifdef HAVE_CONFIG_H -# include "config.h" -# endif - -# ifdef HAVE_FCNTL_H # include -# else -int open(const char *, int, ...); -int fcntl(int, int, ...); -# endif - -# ifdef HAVE_UNISTD_H # include -# else -int close(int); -off_t lseek(int, off_t, int); -ssize_t read(int, void *, size_t); -ssize_t write(int, const char *, size_t); -int stat(const char *, struct stat *); -int fstat(int, struct stat *); -# endif # include # include diff --git a/os.h b/os.h index 5747dde..b3606b7 100644 --- a/os.h +++ b/os.h @@ -19,6 +19,8 @@ * $Id: os.h,v 1.6 1998/09/15 19:21:05 rob Exp $ */ +#pragma once + int os_open(void **, const char *, int); int os_close(void **); diff --git a/record.c b/record.c index 6ad183c..c69456f 100644 --- a/record.c +++ b/record.c @@ -19,10 +19,6 @@ * $Id: record.c,v 1.9 1998/11/02 22:09:07 rob Exp $ */ -# ifdef HAVE_CONFIG_H -# include "config.h" -# endif - # include # include "libhfs.h" diff --git a/record.h b/record.h index 4959dc8..b6a1c0f 100644 --- a/record.h +++ b/record.h @@ -19,6 +19,8 @@ * $Id: record.h,v 1.7 1998/11/02 22:09:08 rob Exp $ */ +#pragma once + void r_packcatkey(const CatKeyRec *, byte *, unsigned int *); void r_unpackcatkey(const byte *, CatKeyRec *); diff --git a/version.h b/version.h index ae6a1d3..20a9f88 100644 --- a/version.h +++ b/version.h @@ -19,6 +19,8 @@ * $Id: version.h,v 1.6 1998/09/18 22:56:38 rob Exp $ */ +#pragma once + extern const char libhfs_rcsid[]; extern const char libhfs_version[]; diff --git a/volume.c b/volume.c index 37c41d7..cde069b 100644 --- a/volume.c +++ b/volume.c @@ -19,10 +19,6 @@ * $Id: volume.c,v 1.12 1998/11/02 22:09:10 rob Exp $ */ -# ifdef HAVE_CONFIG_H -# include "config.h" -# endif - # include # include # include diff --git a/volume.h b/volume.h index ae8a093..94c0403 100644 --- a/volume.h +++ b/volume.h @@ -19,6 +19,8 @@ * $Id: volume.h,v 1.7 1998/11/02 22:09:12 rob Exp $ */ +#pragma once + void v_init(hfsvol *, int); int v_open(hfsvol *, const char *, int);