Merge pull request #3 from targetdisk/mane

Make hfsutils build again with modern GCC/Autotools
This commit is contained in:
JotaRandom
2025-09-19 05:25:49 -03:00
committed by GitHub
19 changed files with 221 additions and 5869 deletions
+40
View File
@@ -0,0 +1,40 @@
# Mac drippings
.DS_Store
# Autotools
.stamp
Makefile
configure
*~
autom4te.cache
confdefs.h
config.log
config.cache
config.h.in
config.h
config.status
# Compiled output
*.o
*.a
libhfs/os.c
hattrib
hcd
hcopy
hdel
hdir
hformat
hfsutil
hls
hmkdir
hmount
hpwd
hrename
hrmdir
humount
hvol
# Vim
*.swp
*.swo
Session.vim
+2 -2
View File
@@ -19,8 +19,8 @@ diffs or instructions to the address given in the `README' so they can
be considered for the next release. If at some point `config.cache'
contains results you don't want to keep, you may remove or edit it.
The file `configure.in' is used to create `configure' by a program
called `autoconf'. You only need `configure.in' if you want to change
The file `configure.ac' is used to create `configure' by a program
called `autoconf'. You only need `configure.ac' if you want to change
it or regenerate `configure' using a newer version of `autoconf'.
The simplest way to compile this package is:
+7 -4
View File
@@ -200,16 +200,19 @@ dist ::
Makefile: config.status
./config.status && touch .stamp/config.h
.stamp/config.h: config.status
.stamp:
mkdir $@
.stamp/config.h: .stamp config.status
./config.status && touch .stamp/config.h
config.status: .stamp/configure .stamp/config.h.in Makefile.in
config.status: .stamp .stamp/configure .stamp/config.h.in Makefile.in
./config.status --recheck
.stamp/configure: configure.in
.stamp/configure: .stamp configure.ac
autoconf && touch .stamp/configure
.stamp/config.h.in: configure.in acconfig.h
.stamp/config.h.in: .stamp configure.ac acconfig.h
autoheader && touch .stamp/config.h.in
###############################################################################
-132
View File
@@ -1,132 +0,0 @@
hfsutils - tools for reading and writing Macintosh HFS volumes
Copyright (C) 1996-1998 Robert Leslie
$Id: README,v 1.10 1998/09/08 18:51:51 rob Exp $
===============================================================================
NOTES ON THIS RELEASE
This release uses GNU autoconf to automatically configure the software
for installation and use on your system. This means you should not have
to modify any files by hand to get the software to compile -- if you do,
please let the author know so it can be fixed.
For general installation instructions, please read the `INSTALL' file.
There are a few special options you can give the `configure' program that
you should know about:
--with-tcl build the Tcl/Tk components
--with-tk build the Tk-based X interface `xhfs'
--disable-cli do not build or install the command-line utils
--enable-devlibs enable installation of the developer libraries
To build the Tcl tools `hfssh' and `hfs', you must use `--with-tcl'.
To build the X interface `xhfs', you must use `--with-tcl --with-tk'.
In order to build the Tcl tools you must have Tcl 7.6 or newer already
installed on your system. To build the X interface, you must have Tk 4.2
or newer installed as well.
If `configure' is unable to locate your Tcl or Tk installation, you will
have to give it a hint. It looks for the files `tclConfig.sh' and
`tkConfig.sh' (respectively) which contain all the details about your
configuration; these files were created when Tcl/Tk was installed on your
system.
To help `configure' find these files, you can specify a directory name on
the command line. For example:
./configure --with-tcl=/usr/share/tcl --with-tk=/usr/share/tk
When in doubt, wait and see if `configure' complains.
By default, the command-line utilities (hmount, hls, hcopy, etc.) are
always built and installed. If you don't want them, use `--disable-cli'.
If you want to install the developer libraries (libhfs.a, librsrc.a, and
associated header files) as well as the programs, use `--enable-devlibs'.
The libraries are not installed by default.
The `INSTALL' file contains the rest of the details you will need to
compile and install the software. Please read it!
===============================================================================
NOTES ON "SETUID" INSTALLATION
Although the author has made some effort to make the programs in this
package somewhat setuid-safe, none are intended to be installed in such a
manner, and you do so at your own risk!
Specifically, installing the programs setuid root is a bad idea, as it will
allow anyone to attempt to open (or format) any file as an HFS volume,
disregarding the normal UNIX file permission checks.
A better idea is to modify the permissions on the necessary device files to
allow access to appropriate users. For example, if you make your floppy
device group-writable to a special group of floppy users, then only those
users will be able to access an inserted floppy disk and nothing needs to
be made setuid.
Here is an example:
% ls -l /dev/fd0 /usr/local/bin/xhfs
brw-rw---- 1 root floppy 2, 0 Sep 17 13:51 /dev/fd0
-rwxr-xr-x 1 root staff 339874 Jan 17 20:18 /usr/local/bin/xhfs
% grep floppy /etc/group
floppy:*:25:rob,thigpen
This configuration permits users `rob' and `thigpen' read/write access to
the floppy device, without needing to make any programs setuid.
Another possibility is to make some of the programs in this package setgid
(NOT setuid) to a similar group which has access to the necessary devices.
This avoids the need to add specific users to a group, since it allows
anyone to access the devices using the utilities, while still maintaining
the integrity of the data on the devices since they are not world-writable.
(A world-writable device lends itself to the possibility that someone may
corrupt some portion of it by other means and render an HFS volume
unusable, whereas limiting access only through the utilities means the
volume is unlikely to be corrupted under normal usage -- although note that
since HFS itself does not provide any file permission structure, anyone may
still modify the HFS volume in any way. The only protection here is that
the modifications must be made in an HFS-compatible way, so that the
possibility of corruption is reduced.)
Here is another example:
% ls -l /dev/fd0 /usr/local/bin/xhfs
brw-rw---- 1 root floppy 2, 0 Sep 17 13:51 /dev/fd0
-rwxr-sr-x 1 root floppy 339874 Jan 17 20:18 /usr/local/bin/xhfs
% grep floppy /etc/group
floppy:*:25:
In this case, only setgid `floppy' programs (such as `/usr/local/bin/xhfs')
are permitted access to the floppy device.
To summarize: it is suggested that the utilities NOT be installed setuid or
setgid. It is possible to install the utilities setgid as described above,
but it is NOT recommended that the utilities be installed setuid root under
any circumstances.
===============================================================================
CONTACTING THE AUTHOR
Please see the `COPYRIGHT' file for copyright and warranty information.
Send comments, bug reports, suggestions, patches, etc. to:
* Robert Leslie <rob@mars.org>
See also the HFS Utilities home page on the Web:
* http://www.mars.org/home/rob/proj/hfs/
===============================================================================
+141
View File
@@ -0,0 +1,141 @@
# hfsutils
## tools for reading and writing Macintosh HFS volumes
Copyright (C) 1996-1998 Robert Leslie
<!--$Id: README,v 1.10 1998/09/08 18:51:51 rob Exp $-->
-------------------------------------------------------------------------------
## NOTES ON THIS RELEASE
This release uses GNU autoconf to automatically configure the software
for installation and use on your system. This means you should not have
to modify any files by hand to get the software to compile -- if you do,
please let the author know so it can be fixed.
For general installation instructions, please read the `INSTALL` file.
There are a few special options you can give the `configure` program that
you should know about:
```
--with-tcl build the Tcl/Tk components
--with-tk build the Tk-based X interface `xhfs`
--disable-cli do not build or install the command-line utils
--enable-devlibs enable installation of the developer libraries
```
To build the Tcl tools `hfssh` and `hfs`, you must use `--with-tcl`.
To build the X interface `xhfs`, you must use `--with-tcl --with-tk`.
In order to build the Tcl tools you must have Tcl 7.6 or newer already
installed on your system. To build the X interface, you must have Tk 4.2
or newer installed as well.
If `configure` is unable to locate your Tcl or Tk installation, you will
have to give it a hint. It looks for the files `tclConfig.sh` and
`tkConfig.sh` (respectively) which contain all the details about your
configuration; these files were created when Tcl/Tk was installed on your
system.
To help `configure` find these files, you can specify a directory name on
the command line. For example:
```
./configure --with-tcl=/usr/share/tcl --with-tk=/usr/share/tk
```
When in doubt, wait and see if `configure` complains.
By default, the command-line utilities (hmount, hls, hcopy, etc.) are
always built and installed. If you don't want them, use `--disable-cli`.
If you want to install the developer libraries (libhfs.a, librsrc.a, and
associated header files) as well as the programs, use `--enable-devlibs`.
The libraries are not installed by default.
The `INSTALL` file contains the rest of the details you will need to
compile and install the software. Please read it!
-------------------------------------------------------------------------------
## NOTES ON "SETUID" INSTALLATION
Although the author has made some effort to make the programs in this
package somewhat setuid-safe, none are intended to be installed in such a
manner, and you do so at your own risk!
Specifically, installing the programs setuid root is a bad idea, as it will
allow anyone to attempt to open (or format) any file as an HFS volume,
disregarding the normal UNIX file permission checks.
A better idea is to modify the permissions on the necessary device files to
allow access to appropriate users. For example, if you make your floppy
device group-writable to a special group of floppy users, then only those
users will be able to access an inserted floppy disk and nothing needs to
be made setuid.
Here is an example:
```
% ls -l /dev/fd0 /usr/local/bin/xhfs
brw-rw---- 1 root floppy 2, 0 Sep 17 13:51 /dev/fd0
-rwxr-xr-x 1 root staff 339874 Jan 17 20:18 /usr/local/bin/xhfs
% grep floppy /etc/group
floppy:*:25:rob,thigpen
```
This configuration permits users `rob` and `thigpen` read/write access to
the floppy device, without needing to make any programs setuid.
Another possibility is to make some of the programs in this package setgid
(NOT setuid) to a similar group which has access to the necessary devices.
This avoids the need to add specific users to a group, since it allows
anyone to access the devices using the utilities, while still maintaining
the integrity of the data on the devices since they are not world-writable.
(A world-writable device lends itself to the possibility that someone may
corrupt some portion of it by other means and render an HFS volume
unusable, whereas limiting access only through the utilities means the
volume is unlikely to be corrupted under normal usage -- although note that
since HFS itself does not provide any file permission structure, anyone may
still modify the HFS volume in any way. The only protection here is that
the modifications must be made in an HFS-compatible way, so that the
possibility of corruption is reduced.)
Here is another example:
```
% ls -l /dev/fd0 /usr/local/bin/xhfs
brw-rw---- 1 root floppy 2, 0 Sep 17 13:51 /dev/fd0
-rwxr-sr-x 1 root floppy 339874 Jan 17 20:18 /usr/local/bin/xhfs
% grep floppy /etc/group
floppy:*:25:
```
In this case, only setgid `floppy` programs (such as `/usr/local/bin/xhfs`)
are permitted access to the floppy device.
To summarize: it is suggested that the utilities NOT be installed setuid or
setgid. It is possible to install the utilities setgid as described above,
but it is NOT recommended that the utilities be installed setuid root under
any circumstances.
-------------------------------------------------------------------------------
## CONTACTING THE AUTHOR
Please see the `COPYRIGHT` file for copyright and warranty information.
Send comments, bug reports, suggestions, patches, etc. to:
* Robert Leslie <rob@mars.org>
See also the old HFS Utilities home page on the Web:
* [http://www.mars.org/home/rob/proj/hfs/](https://github.com/targetdisk/hfsutils)
-------------------------------------------------------------------------------
-95
View File
@@ -1,95 +0,0 @@
/* config.h.in. Generated automatically from configure.in by autoheader. */
/*
* hfsutils - tools 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:26:53 rob Exp $
*/
/*****************************************************************************
* Definitions selected automatically by `configure' *
*****************************************************************************/
/* Define to empty if the keyword does not work. */
#undef const
/* Define to `int' if <sys/types.h> doesn't define. */
#undef gid_t
/* Define to `unsigned' if <sys/types.h> doesn't define. */
#undef size_t
/* Define if you have the ANSI C header files. */
#undef STDC_HEADERS
/* Define to `int' if <sys/types.h> doesn't define. */
#undef uid_t
/* Define if you want to enable diagnostic debugging support. */
#undef DEBUG
/* Define if your system has sys_errlist[] and sys_nerr. */
#undef HAVE_SYS_ERRLIST
/* Define if you have the setreuid function. */
#undef HAVE_SETREUID
/* Define if you have the strdup function. */
#undef HAVE_STRDUP
/* Define if you have the strerror function. */
#undef HAVE_STRERROR
/* Define if you have the strstr function. */
#undef HAVE_STRSTR
/* Define if you have the strtol function. */
#undef HAVE_STRTOL
/* Define if you have the <fcntl.h> header file. */
#undef HAVE_FCNTL_H
/* Define if you have the <sys/ioctl.h> header file. */
#undef HAVE_SYS_IOCTL_H
/* Define if you have the <termios.h> header file. */
#undef HAVE_TERMIOS_H
/* Define if you have the <unistd.h> header file. */
#undef HAVE_UNISTD_H
/*****************************************************************************
* End of automatically configured definitions *
*****************************************************************************/
# ifndef HAVE_STRDUP
char *strdup(const char *);
# endif
# ifndef HAVE_STRERROR
char *strerror(int);
# endif
# ifndef HAVE_STRSTR
char *strstr(const char *, const char *);
# endif
# ifndef HAVE_STRTOL
long strtol(const char *, char **, int);
# endif
#define USE_INTERP_RESULT 1
Vendored
-2116
View File
File diff suppressed because it is too large Load Diff
+8 -9
View File
@@ -17,11 +17,12 @@ dnl You should have received a copy of the GNU General Public License
dnl along with this program; if not, write to the Free Software
dnl Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
dnl
dnl $Id: configure.in,v 1.10 1998/09/15 19:19:42 rob Exp $
dnl $Id: configure.ac,v 1.10 1998/09/15 19:19:42 rob Exp $
dnl
AC_INIT(libhfs/libhfs.h)
AC_CONFIG_HEADER(config.h)
AC_INIT
AC_CONFIG_SRCDIR([libhfs/libhfs.h])
AC_CONFIG_HEADERS([config.h])
AC_CONFIG_SUBDIRS(libhfs librsrc)
@@ -63,11 +64,8 @@ AC_PROG_CC
AC_PROG_INSTALL
AC_PROG_RANLIB
AC_PROG_GCC_TRADITIONAL
dnl Checks for header files.
AC_HEADER_STDC
AC_CHECK_HEADERS(unistd.h fcntl.h termios.h sys/ioctl.h)
dnl Checks for typedefs, structures, and compiler characteristics.
@@ -83,12 +81,12 @@ AC_REPLACE_FUNCS(strdup strerror strstr strtol)
AC_CHECK_FUNCS(setreuid)
AC_CACHE_CHECK(for sys_errlist, hfs_cv_decl_syserrlist, [
AC_TRY_LINK([], [
AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[
extern char *sys_errlist[];
extern int sys_nerr;
sys_errlist[sys_nerr - 1][0] = 0;
], hfs_cv_decl_syserrlist=yes, hfs_cv_decl_syserrlist=no)
]])],[hfs_cv_decl_syserrlist=yes],[hfs_cv_decl_syserrlist=no])
])
if test "$hfs_cv_decl_syserrlist" = yes
@@ -298,4 +296,5 @@ fi
dnl Create output files.
AC_OUTPUT(hfsck/Makefile linux/Makefile Makefile)
AC_CONFIG_FILES([hfsck/Makefile linux/Makefile Makefile])
AC_OUTPUT
+1
View File
@@ -24,6 +24,7 @@
# endif
# include <stdio.h>
# include <string.h>
# include "hfs.h"
# include "hcwd.h"
View File
+7 -4
View File
@@ -98,16 +98,19 @@ maintainer-clean :: distclean
Makefile: config.status
./config.status && touch .stamp/config.h
.stamp/config.h: config.status
.stamp:
mkdir $@
.stamp/config.h: .stamp config.status
./config.status && touch .stamp/config.h
config.status: .stamp/configure .stamp/config.h.in Makefile.in
config.status: .stamp .stamp/configure .stamp/config.h.in Makefile.in
./config.status --recheck
.stamp/configure: configure.in
.stamp/configure: .stamp configure.ac
autoconf && touch .stamp/configure
.stamp/config.h.in: configure.in acconfig.h
.stamp/config.h.in: .stamp configure.ac acconfig.h
autoheader && touch .stamp/config.h.in
###############################################################################
-57
View File
@@ -1,57 +0,0 @@
/* config.h.in. Generated automatically from configure.in by autoheader. */
/*
* 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' *
*****************************************************************************/
/* Define to empty if the keyword does not work. */
#undef const
/* Define to `unsigned' if <sys/types.h> doesn't define. */
#undef size_t
/* Define if you have the ANSI C header files. */
#undef STDC_HEADERS
/* Define if your <sys/time.h> declares struct tm. */
#undef TM_IN_SYS_TIME
/* Define if you want to enable diagnostic debugging support. */
#undef DEBUG
/* Define if you have the mktime function. */
#undef HAVE_MKTIME
/* Define if you have the <fcntl.h> header file. */
#undef HAVE_FCNTL_H
/* Define if you have the <unistd.h> header file. */
#undef HAVE_UNISTD_H
/*****************************************************************************
* End of automatically configured definitions *
*****************************************************************************/
# ifdef DEBUG
# include <stdio.h>
# endif
-1719
View File
File diff suppressed because it is too large Load Diff
+4 -6
View File
@@ -17,11 +17,11 @@ dnl You should have received a copy of the GNU General Public License
dnl along with this program; if not, write to the Free Software
dnl Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
dnl
dnl $Id: configure.in,v 1.5 1998/04/11 08:27:12 rob Exp $
dnl $Id: configure.ac,v 1.5 1998/04/11 08:27:12 rob Exp $
dnl
AC_INIT(libhfs.h)
AC_CONFIG_HEADER(config.h)
AC_CONFIG_HEADERS(config.h)
AC_ARG_ENABLE(debug,
[ --enable-debug enable diagnostic debugging support])
@@ -39,11 +39,8 @@ AC_PROG_INSTALL
AC_PROG_RANLIB
AC_PROG_LN_S
AC_PROG_GCC_TRADITIONAL
dnl Checks for header files.
AC_HEADER_STDC
AC_CHECK_HEADERS(unistd.h fcntl.h)
dnl Checks for typedefs, structures, and compiler characteristics.
@@ -60,4 +57,5 @@ AC_CHECK_FUNCS(mktime)
dnl Create output files.
AC_OUTPUT(Makefile)
AC_CONFIG_FILES([Makefile])
AC_OUTPUT
View File
+7 -4
View File
@@ -95,16 +95,19 @@ maintainer-clean :: distclean
Makefile: config.status
./config.status && touch .stamp/config.h
.stamp/config.h: config.status
.stamp:
mkdir $@
.stamp/config.h: .stamp config.status
./config.status && touch .stamp/config.h
config.status: .stamp/configure .stamp/config.h.in Makefile.in
config.status: .stamp .stamp/configure .stamp/config.h.in Makefile.in
./config.status --recheck
.stamp/configure: configure.in
.stamp/configure: .stamp configure.ac
autoconf && touch .stamp/configure
.stamp/config.h.in: configure.in acconfig.h
.stamp/config.h.in: .stamp configure.ac acconfig.h
autoheader && touch .stamp/config.h.in
###############################################################################
-53
View File
@@ -1,53 +0,0 @@
/* config.h.in. Generated automatically from configure.in by autoheader. */
/*
* librsrc - library for reading and writing Macintosh resources
* 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:18 rob Exp $
*/
/*****************************************************************************
* Definitions selected automatically by `configure' *
*****************************************************************************/
/* Define to empty if the keyword does not work. */
#undef const
/* Define to `unsigned' if <sys/types.h> doesn't define. */
#undef size_t
/* Define if you have the ANSI C header files. */
#undef STDC_HEADERS
/* Define if your <sys/time.h> declares struct tm. */
#undef TM_IN_SYS_TIME
/* Define if you want to enable diagnostic debugging support. */
#undef DEBUG
/* Define if you have the mktime function. */
#undef HAVE_MKTIME
/* Define if you have the <fcntl.h> header file. */
#undef HAVE_FCNTL_H
/* Define if you have the <unistd.h> header file. */
#undef HAVE_UNISTD_H
/*****************************************************************************
* End of automatically configured definitions *
*****************************************************************************/
-1662
View File
File diff suppressed because it is too large Load Diff
@@ -17,11 +17,11 @@ dnl You should have received a copy of the GNU General Public License
dnl along with this program; if not, write to the Free Software
dnl Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
dnl
dnl $Id: configure.in,v 1.5 1998/04/11 08:27:18 rob Exp $
dnl $Id: configure.ac,v 1.5 1998/04/11 08:27:18 rob Exp $
dnl
AC_INIT(librsrc.h)
AC_CONFIG_HEADER(config.h)
AC_CONFIG_HEADERS(config.h)
AC_ARG_ENABLE(debug,
[ --enable-debug enable diagnostic debugging support])
@@ -38,11 +38,8 @@ AC_PROG_CC
AC_PROG_INSTALL
AC_PROG_RANLIB
AC_PROG_GCC_TRADITIONAL
dnl Checks for header files.
AC_HEADER_STDC
AC_CHECK_HEADERS(unistd.h fcntl.h)
dnl Checks for typedefs, structures, and compiler characteristics.
@@ -59,4 +56,5 @@ AC_CHECK_FUNCS(mktime)
dnl Create output files.
AC_OUTPUT(Makefile)
AC_CONFIG_FILES([Makefile])
AC_OUTPUT