merged mainstream into crypto

This commit is contained in:
Vladimir 'phcoder' Serbinenko 2009-11-24 02:54:35 +01:00
commit 59f746dc5f
158 changed files with 45640 additions and 3018 deletions

View file

@ -30,6 +30,12 @@
# define DEV_CYGDRIVE_MAJOR 98
#endif
#ifdef __GNU__
#include <hurd.h>
#include <hurd/lookup.h>
#include <hurd/fs.h>
#endif
#include <grub/util/misc.h>
#include <grub/util/hostdisk.h>
#include <grub/util/getroot.h>
@ -378,8 +384,65 @@ find_cygwin_root_device (const char *path, dev_t dev)
char *
grub_guess_root_device (const char *dir)
{
struct stat st;
char *os_dev;
#ifdef __GNU__
file_t file;
mach_port_t *ports;
int *ints;
loff_t *offsets;
char *data;
error_t err;
mach_msg_type_number_t num_ports = 0, num_ints = 0, num_offsets = 0, data_len = 0;
size_t name_len;
file = file_name_lookup (dir, 0, 0);
if (file == MACH_PORT_NULL)
return 0;
err = file_get_storage_info (file,
&ports, &num_ports,
&ints, &num_ints,
&offsets, &num_offsets,
&data, &data_len);
if (num_ints < 1)
grub_util_error ("Storage info for `%s' does not include type", dir);
if (ints[0] != STORAGE_DEVICE)
grub_util_error ("Filesystem of `%s' is not stored on local disk", dir);
if (num_ints < 5)
grub_util_error ("Storage info for `%s' does not include name", dir);
name_len = ints[4];
if (name_len < data_len)
grub_util_error ("Bogus name length for storage info for `%s'", dir);
if (data[name_len - 1] != '\0')
grub_util_error ("Storage name for `%s' not NUL-terminated", dir);
os_dev = xmalloc (strlen ("/dev/") + data_len);
memcpy (os_dev, "/dev/", strlen ("/dev/"));
memcpy (os_dev + strlen ("/dev/"), data, data_len);
if (ports && num_ports > 0)
{
mach_msg_type_number_t i;
for (i = 0; i < num_ports; i++)
{
mach_port_t port = ports[i];
if (port != MACH_PORT_NULL)
mach_port_deallocate (mach_task_self(), port);
}
munmap ((caddr_t) ports, num_ports * sizeof (*ports));
}
if (ints && num_ints > 0)
munmap ((caddr_t) ints, num_ints * sizeof (*ints));
if (offsets && num_offsets > 0)
munmap ((caddr_t) offsets, num_offsets * sizeof (*offsets));
if (data && data_len > 0)
munmap (data, data_len);
mach_port_deallocate (mach_task_self (), file);
#else /* !__GNU__ */
struct stat st;
if (stat (dir, &st) < 0)
grub_util_error ("Cannot stat `%s'", dir);
@ -393,6 +456,7 @@ grub_guess_root_device (const char *dir)
/* This might be truly slow, but is there any better way? */
os_dev = find_root_device ("/dev", st.st_dev);
#endif
#endif /* !__GNU__ */
return os_dev;
}

View file

@ -31,9 +31,6 @@ target_cpu=@target_cpu@
platform=@platform@
pkglibdir=${libdir}/`echo ${PACKAGE_TARNAME}/${target_cpu}-${platform} | sed ${transform}`
# for make_system_path_relative_to_its_root()
. ${libdir}/grub/grub-mkconfig_lib
grub_setup=${sbindir}/`echo grub-setup | sed ${transform}`
if [ "${target_cpu}-${platform}" = "i386-pc" ] ; then
grub_mkimage=${bindir}/`echo grub-mkimage | sed ${transform}`
@ -144,6 +141,9 @@ for option in "$@"; do
esac
done
# for make_system_path_relative_to_its_root()
. ${libdir}/grub/grub-mkconfig_lib
if test "x$install_device" = x; then
echo "install_device not specified." 1>&2
usage

175
util/grub-mkrescue.in Normal file
View file

@ -0,0 +1,175 @@
#! /bin/sh -e
# Make GRUB rescue image
# Copyright (C) 1999,2000,2001,2002,2003,2004,2005,2006,2007,2008,2009 Free Software Foundation, Inc.
#
# GRUB 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 3 of the License, or
# (at your option) any later version.
#
# GRUB 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 GRUB. If not, see <http://www.gnu.org/licenses/>.
# Initialize some variables.
transform="@program_transform_name@"
prefix=@prefix@
exec_prefix=@exec_prefix@
bindir=@bindir@
libdir=@libdir@
PACKAGE_NAME=@PACKAGE_NAME@
PACKAGE_TARNAME=@PACKAGE_TARNAME@
PACKAGE_VERSION=@PACKAGE_VERSION@
target_cpu=@target_cpu@
native_platform=@platform@
coreboot_dir=${libdir}/$(echo ${PACKAGE_TARNAME} | sed ${transform})/${target_cpu}-coreboot
pc_dir=${libdir}/$(echo ${PACKAGE_TARNAME} | sed ${transform})/${target_cpu}-pc
# Usage: usage
# Print the usage.
usage () {
cat <<EOF
Usage: $0 [OPTION] SOURCE...
Make GRUB rescue image.
-h, --help print this message and exit
-v, --version print the version information and exit
--modules=MODULES pre-load specified modules MODULES
--output=FILE save output in FILE [required]
$0 generates a bootable rescue image with specified source files or directories.
Report bugs to <bug-grub@gnu.org>.
EOF
}
# Check the arguments.
for option in "$@"; do
case "$option" in
-h | --help)
usage
exit 0 ;;
-v | --version)
echo "$0 (GNU GRUB ${PACKAGE_VERSION})"
exit 0 ;;
--modules=*)
modules=`echo "$option" | sed 's/--modules=//'` ;;
--output=*)
output_image=`echo "$option" | sed 's/--output=//'` ;;
# Intentionally undocumented
--override-directory=*)
override_dir=`echo "${option}/" | sed 's/--override-directory=//'`
PATH=${override_dir}:$PATH
export PATH
;;
-*)
echo "Unrecognized option \`$option'" 1>&2
usage
exit 1
;;
*)
source="${source} ${option}" ;;
esac
done
if [ "x${output_image}" = x ] ; then
echo "output file must be given" >&2
usage
exit 1
fi
iso9660_dir=`mktemp -d`
mkdir -p ${iso9660_dir}/boot/grub
process_input_dir ()
{
input_dir="$1"
platform="$2"
mkdir -p ${iso9660_dir}/boot/grub/${target_cpu}-${platform}
for file in ${input_dir}/*.mod ${input_dir}/efiemu??.o \
${input_dir}/command.lst ${input_dir}/moddep.lst ${input_dir}/fs.lst \
${input_dir}/handler.lst ${input_dir}/parttool.lst; do
if test -f "$file"; then
cp -f "$file" ${iso9660_dir}/boot/grub/${target_cpu}-${platform}/
fi
done
}
if [ "${override_dir}" = "" ] ; then
if test -e "${coreboot_dir}" ; then
process_input_dir ${coreboot_dir} coreboot
fi
if test -e "${pc_dir}" ; then
process_input_dir ${pc_dir} pc
fi
else
process_input_dir ${override_dir} ${native_platform}
coreboot_dir=
pc_dir=
case "${native_platform}" in
coreboot) coreboot_dir=${override_dir} ;;
pc) pc_dir=${override_dir} ;;
esac
fi
# build coreboot core.img
if test -e "${coreboot_dir}" ; then
echo "Generates coreboot"
memdisk_img=`mktemp`
memdisk_dir=`mktemp -d`
mkdir -p ${memdisk_dir}/boot/grub
# obtain date-based UUID
iso_uuid=$(date +%Y-%m-%d-%H-%M-%S-00)
modules="$(cat ${coreboot_dir}/partmap.lst) ${modules}"
cat << EOF > ${memdisk_dir}/boot/grub/grub.cfg
search --fs-uuid --set ${iso_uuid}
set prefix=(\${root})/boot/grub/${target_cpu}-coreboot
EOF
(for i in ${modules} ; do
echo "insmod $i"
done ; \
echo "source /boot/grub/grub.cfg") \
> ${iso9660_dir}/boot/grub/i386-pc/grub.cfg
tar -C ${memdisk_dir} -cf ${memdisk_img} boot
rm -rf ${memdisk_dir}
grub-mkelfimage -d ${coreboot_dir}/ -m ${memdisk_img} -o ${iso9660_dir}/boot/multiboot.img \
memdisk tar search iso9660 configfile sh \
ata at_keyboard
rm -f ${memdisk_img}
grub_mkisofs_arguments="${grub_mkisofs_arguments} --modification-date=$(echo ${iso_uuid} | sed -e s/-//g)"
fi
# build eltorito core.img
if test -e "${pc_dir}" ; then
echo "Generates eltorito"
core_img=`mktemp`
grub-mkimage -d ${pc_dir}/ -o ${core_img} --prefix=/boot/grub/i386-pc \
memdisk tar search iso9660 configfile sh \
biosdisk
cat ${pc_dir}/cdboot.img ${core_img} > ${iso9660_dir}/boot/grub/i386-pc/eltorito.img
rm -f ${core_img}
modules="$(cat ${pc_dir}/partmap.lst) ${modules}"
(for i in ${modules} ; do
echo "insmod $i"
done ; \
echo "source /boot/grub/grub.cfg") \
> ${iso9660_dir}/boot/grub/i386-pc/grub.cfg
grub_mkisofs_arguments="${grub_mkisofs_arguments} -b boot/grub/i386-pc/eltorito.img -boot-info-table"
fi
# build iso image
grub-mkisofs ${grub_mkisofs_arguments} -o ${output_image} -r ${iso9660_dir} ${source}
rm -rf ${iso9660_dir}
exit 0

View file

@ -22,6 +22,8 @@ prefix=@prefix@
exec_prefix=@exec_prefix@
libdir=@libdir@
grub_prefix=`echo /boot/grub | sed ${transform}`
locale_dir=`echo /boot/grub/locale | sed ${transform}`
grub_lang=`echo $LANG | cut -d _ -f 1`
. ${libdir}/grub/grub-mkconfig_lib
@ -100,6 +102,15 @@ EOF
;;
esac
# Gettext variables and module
if [ "x${LANG}" != "xC" ] ; then
cat << EOF
set locale_dir=${locale_dir}
set lang=${grub_lang}
insmod gettext
EOF
fi
if [ "x${GRUB_HIDDEN_TIMEOUT}" != "x" ] ; then
if [ "x${GRUB_HIDDEN_TIMEOUT_QUIET}" = "xtrue" ] ; then
verbose=

View file

@ -18,9 +18,14 @@
prefix=@prefix@
exec_prefix=@exec_prefix@
bindir=@bindir@
libdir=@libdir@
. ${libdir}/grub/grub-mkconfig_lib
. ${bindir}/gettext.sh
export TEXTDOMAIN=@PACKAGE@
export TEXTDOMAINDIR=@LOCALEDIR@
case "${GRUB_DISTRIBUTOR}" in
Debian) OS="${GRUB_DISTRIBUTOR} GNU/kFreeBSD" ;;
*) OS="FreeBSD" ;;
@ -28,9 +33,12 @@ esac
kfreebsd_entry ()
{
cat << EOF
menuentry "$1" {
EOF
os="$1"
version="$2"
recovery="$3" # not used yet
args="$4" # not used yet
title="$(gettext "%s, with kFreeBSD %s")"
printf "menuentry \"${title}\" {" ${os} ${version}
if [ -z "${prepare_boot_cache}" ]; then
prepare_boot_cache="$(prepare_grub_to_access_device ${GRUB_DEVICE_BOOT} | sed -e "s/^/\t/")"
fi
@ -100,7 +108,7 @@ while [ "x$list" != "x" ] ; do
acpi_ko_rel_dirname=`make_system_path_relative_to_its_root $acpi_ko_dirname`
fi
kfreebsd_entry "${OS}, kFreeBSD ${version}"
kfreebsd_entry "${OS}" "${version}"
list=`echo $list | tr ' ' '\n' | grep -vx $kfreebsd | tr '\n' ' '`
done

View file

@ -18,9 +18,14 @@
prefix=@prefix@
exec_prefix=@exec_prefix@
bindir=@bindir@
libdir=@libdir@
. ${libdir}/grub/grub-mkconfig_lib
. ${bindir}/gettext.sh
export TEXTDOMAIN=@PACKAGE@
export TEXTDOMAINDIR=@LOCALEDIR@
if [ "x${GRUB_DISTRIBUTOR}" = "x" ] ; then
OS=GNU/Linux
else
@ -44,15 +49,22 @@ fi
linux_entry ()
{
cat << EOF
menuentry "$1" {
EOF
os="$1"
version="$2"
recovery="$3"
args="$4"
if ${recovery} ; then
title="$(gettext "%s, with Linux %s (recovery mode)")"
else
title="$(gettext "%s, with Linux %s")"
fi
printf "menuentry \"${title}\" {" ${os} ${version}
if [ -z "${prepare_boot_cache}" ]; then
prepare_boot_cache="$(prepare_grub_to_access_device ${GRUB_DEVICE_BOOT} | sed -e "s/^/\t/")"
fi
printf '%s\n' "${prepare_boot_cache}"
cat << EOF
linux ${rel_dirname}/${basename} root=${linux_root_device_thisversion} ro $2
linux ${rel_dirname}/${basename} root=${linux_root_device_thisversion} ro ${args}
EOF
if test -n "${initrd}" ; then
cat << EOF
@ -95,10 +107,10 @@ while [ "x$list" != "x" ] ; do
linux_root_device_thisversion=${GRUB_DEVICE}
fi
linux_entry "${OS}, with Linux ${version}" \
linux_entry "${OS}" "${version}" false \
"${GRUB_CMDLINE_LINUX} ${GRUB_CMDLINE_LINUX_DEFAULT}"
if [ "x${GRUB_DISABLE_LINUX_RECOVERY}" != "xtrue" ]; then
linux_entry "${OS}, with Linux ${version} (recovery mode)" \
linux_entry "${OS}" "${version}" true \
"single ${GRUB_CMDLINE_LINUX}"
fi

View file

@ -88,11 +88,16 @@ EOF
LLABEL="${LONGNAME}"
fi
if [ "${LROOT}" != "${LBOOT}" ]; then
LKERNEL="${LKERNEL#/boot}"
LINITRD="${LINITRD#/boot}"
fi
cat << EOF
menuentry "${LLABEL} (on ${DEVICE})" {
EOF
if [ -z "${prepare_boot_cache}" ]; then
prepare_boot_cache="$(prepare_grub_to_access_device ${DEVICE} | sed -e "s/^/\t/")"
prepare_boot_cache="$(prepare_grub_to_access_device ${LBOOT} | sed -e "s/^/\t/")"
fi
printf '%s\n' "${prepare_boot_cache}"
cat << EOF

View file

@ -25,6 +25,7 @@
#include <grub/util/misc.h>
#include <grub/util/hostdisk.h>
#include <grub/misc.h>
#include <grub/i18n.h>
#include <stdio.h>
#include <stdlib.h>
@ -127,7 +128,7 @@ find_grub_drive (const char *name)
if (name)
{
for (i = 0; i < sizeof (map) / sizeof (map[0]); i++)
for (i = 0; i < ARRAY_SIZE (map); i++)
if (map[i].drive && ! strcmp (map[i].drive, name))
return i;
}
@ -565,7 +566,10 @@ read_device_map (const char *dev_map)
fp = fopen (dev_map, "r");
if (! fp)
grub_util_error ("Cannot open `%s'", dev_map);
{
grub_util_info (_("Cannot open `%s'"), dev_map);
return;
}
while (fgets (buf, sizeof (buf), fp))
{
@ -670,34 +674,27 @@ grub_util_biosdisk_fini (void)
static char *
make_device_name (int drive, int dos_part, int bsd_part)
{
int len = strlen(map[drive].drive);
char *p;
char *ret;
char *dos_part_str = NULL;
char *bsd_part_str = NULL;
if (dos_part >= 0)
{
/* Add in char length of dos_part+1 */
int tmp = dos_part + 1;
len++;
while ((tmp /= 10) != 0)
len++;
}
if (bsd_part >= 0)
len += 2;
/* Length to alloc is: char length of map[drive].drive, plus
* char length of (dos_part+1) or of bsd_part, plus
* 2 for the comma and a null/end of string (\0)
*/
p = xmalloc (len + 2);
sprintf (p, "%s", map[drive].drive);
if (dos_part >= 0)
sprintf (p + strlen (p), ",%d", dos_part + 1);
asprintf (&dos_part_str, ",%d", dos_part + 1);
if (bsd_part >= 0)
sprintf (p + strlen (p), ",%c", bsd_part + 'a');
asprintf (&bsd_part_str, ",%c", dos_part + 'a');
return p;
asprintf (&ret, "%s%s%s", map[drive].drive,
dos_part_str ? : "",
bsd_part_str ? : "");
if (dos_part_str)
free (dos_part_str);
if (bsd_part_str)
free (bsd_part_str);
return ret;
}
static char *
@ -706,7 +703,7 @@ convert_system_partition_to_system_disk (const char *os_dev)
#if defined(__linux__)
char *path = xmalloc (PATH_MAX);
if (! realpath (os_dev, path))
return 0;
return NULL;
if (strncmp ("/dev/", path, 5) == 0)
{
@ -876,22 +873,29 @@ device_is_wholedisk (const char *os_dev)
static int
find_system_device (const char *os_dev)
{
int i;
unsigned int i;
char *os_disk;
os_disk = convert_system_partition_to_system_disk (os_dev);
if (! os_disk)
return -1;
for (i = 0; i < (int) (sizeof (map) / sizeof (map[0])); i++)
if (map[i].device && strcmp (map[i].device, os_disk) == 0)
for (i = 0; i < ARRAY_SIZE (map); i++)
if (! map[i].device)
break;
else if (strcmp (map[i].device, os_disk) == 0)
{
free (os_disk);
return i;
}
free (os_disk);
return -1;
if (i == ARRAY_SIZE (map))
grub_util_error (_("device count exceeds limit"));
map[i].device = os_disk;
map[i].drive = xstrdup (os_disk);
return i;
}
char *

View file

@ -1,7 +1,7 @@
#! /bin/sh -e
# Make GRUB rescue image
# Copyright (C) 1999,2000,2001,2002,2003,2004,2005,2006,2007,2008,2009 Free Software Foundation, Inc.
# Make GRUB rescue floppy
# Copyright (C) 1999,2000,2001,2002,2003,2004,2005,2006,2007,2008 Free Software Foundation, Inc.
#
# GRUB is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@ -30,26 +30,19 @@ target_cpu=@target_cpu@
platform=@platform@
pkglibdir=${libdir}/`echo ${PACKAGE_TARNAME}/${target_cpu}-${platform} | sed ${transform}`
grub_mkimage=${bindir}/`echo grub-mkelfimage | sed ${transform}`
grub_mkisofs=${bindir}/`echo grub-mkisofs | sed ${transform}`
# Usage: usage
# Print the usage.
usage () {
cat <<EOF
Usage: $0 [OPTION] output_image
Make GRUB rescue image.
Make GRUB rescue floppy.
-h, --help print this message and exit
-v, --version print the version information and exit
--modules=MODULES pre-load specified modules MODULES
--overlay=DIR overlay directory DIR in the memdisk image
(may be specified multiple times)
--pkglibdir=DIR use images from directory DIR instead of ${pkglibdir}
--grub-mkimage=FILE use FILE as grub-mkimage
--grub-mkisofs=FILE use FILE as grub-mkisofs
--output=FILE save output in FILE
$0 generates a bootable rescue image.
$0 generates a bootable rescue floppy.
Report bugs to <bug-grub@gnu.org>.
EOF
@ -68,14 +61,8 @@ for option in "$@"; do
exit 0 ;;
--modules=*)
modules=`echo "$option" | sed 's/--modules=//'` ;;
--overlay=*)
overlay=${overlay}${overlay:+ }`echo "$option" | sed 's/--overlay=//'` ;;
--pkglibdir=*)
input_dir=`echo "$option" | sed 's/--pkglibdir=//'` ;;
--grub-mkimage=*)
grub_mkimage=`echo "$option" | sed 's/--grub-mkimage=//'` ;;
--grub-mkisofs=*)
grub_mkisofs=`echo "$option" | sed 's/--grub-mkisofs=//'` ;;
--output=*)
output_image=`echo "$option" | sed 's/--output=//'` ;;
-*)
echo "Unrecognized option \`$option'" 1>&2
usage
@ -96,53 +83,34 @@ if test "x$output_image" = x; then
exit 1
fi
memdisk_dir=`mktemp -d`
iso9660_dir=`mktemp -d`
mkdir -p ${memdisk_dir}/boot/grub ${iso9660_dir}/boot/grub
aux_dir=`mktemp -d`
mkdir -p ${aux_dir}/boot/grub
for file in ${input_dir}/*.mod ${input_dir}/efiemu??.o \
${input_dir}/command.lst ${input_dir}/moddep.lst ${input_dir}/fs.lst \
${input_dir}/handler.lst ${input_dir}/parttool.lst; do
if test -f "$file"; then
cp -f "$file" ${iso9660_dir}/boot/grub/
cp -f "$file" ${aux_dir}/boot/grub/
fi
done
# obtain date-based UUID
iso_uuid=$(date +%Y-%m-%d-%H-%M-%S-00)
# first-stage grub.cfg
cat << EOF >> ${memdisk_dir}/boot/grub/grub.cfg
search --fs-uuid --set ${iso_uuid}
set prefix=(\${root})/boot/grub
source /boot/grub/grub.cfg
EOF
modules="$(cat ${input_dir}/partmap.lst) ${modules}"
for i in ${modules} ; do
echo "insmod $i"
done > ${aux_dir}/boot/grub/grub.cfg
# build memdisk
memdisk_img=`mktemp`
tar -C ${memdisk_dir} -cf ${memdisk_img} boot
rm -rf ${memdisk_dir}
tar -C ${aux_dir} -cf ${memdisk_img} boot
rm -rf ${aux_dir}
# build core.img
mkdir -p ${iso9660_dir}/boot/grub
${grub_mkimage} -d ${input_dir}/ -m ${memdisk_img} -o ${iso9660_dir}/boot/multiboot.img \
at_keyboard memdisk tar ata search iso9660 configfile sh
core_img=`mktemp`
grub-mkimage -d ${input_dir}/ -m ${memdisk_img} -o ${core_img} memdisk tar biosdisk
rm -f ${memdisk_img}
for d in ${overlay}; do
echo "Overlaying $d"
cp -dpR "${d}"/* "${iso9660_dir}"/
done
# second-stage grub.cfg
modules="`cat ${input_dir}/partmap.lst` ${modules}"
for i in ${modules} ; do
echo "insmod $i"
done > ${iso9660_dir}/boot/grub/grub.cfg
# build iso image
${grub_mkisofs} \
--modification-date=$(echo ${iso_uuid} | sed -e s/-//g) \
-o ${output_image} -r -J ${iso9660_dir}
# build floppy image
cat ${input_dir}/boot.img ${core_img} /dev/zero | dd bs=1024 count=1440 > ${output_image}
rm -f ${core_img}
exit 0

View file

@ -22,6 +22,7 @@
#include <grub/machine/boot.h>
#include <grub/machine/kernel.h>
#include <grub/machine/memory.h>
#include <grub/i18n.h>
#include <grub/kernel.h>
#include <grub/disk.h>
#include <grub/util/misc.h>
@ -36,6 +37,8 @@
#define _GNU_SOURCE 1
#include <getopt.h>
#include "progname.h"
#ifdef ENABLE_LZMA
#include <grub/lib/LzmaEnc.h>
@ -59,7 +62,7 @@ compress_kernel (char *kernel_img, size_t kernel_size,
props.numThreads = 1;
if (kernel_size < GRUB_KERNEL_MACHINE_RAW_SIZE)
grub_util_error ("the core image is too small");
grub_util_error (_("the core image is too small"));
*core_img = xmalloc (kernel_size);
memcpy (*core_img, kernel_img, GRUB_KERNEL_MACHINE_RAW_SIZE);
@ -71,7 +74,7 @@ compress_kernel (char *kernel_img, size_t kernel_size,
kernel_size - GRUB_KERNEL_MACHINE_RAW_SIZE,
&props, out_props, &out_props_size,
0, NULL, &g_Alloc, &g_Alloc) != SZ_OK)
grub_util_error ("cannot compress the kernel image");
grub_util_error (_("cannot compress the kernel image"));
*core_size += GRUB_KERNEL_MACHINE_RAW_SIZE;
}
@ -132,7 +135,7 @@ generate_image (const char *dir, char *prefix, FILE *out, char *mods[],
grub_util_load_image (kernel_path, kernel_img);
if (GRUB_KERNEL_MACHINE_PREFIX + strlen (prefix) + 1 > GRUB_KERNEL_MACHINE_DATA_END)
grub_util_error ("prefix too long");
grub_util_error (_("prefix is too long"));
strcpy (kernel_img + GRUB_KERNEL_MACHINE_PREFIX, prefix);
/* Fill in the grub_module_info structure. */
@ -200,12 +203,12 @@ generate_image (const char *dir, char *prefix, FILE *out, char *mods[],
unsigned num;
num = ((core_size + GRUB_DISK_SECTOR_SIZE - 1) >> GRUB_DISK_SECTOR_BITS);
if (num > 0xffff)
grub_util_error ("the core image is too big");
grub_util_error (_("the core image is too big"));
boot_path = grub_util_get_path (dir, "diskboot.img");
boot_size = grub_util_get_image_size (boot_path);
if (boot_size != GRUB_DISK_SECTOR_SIZE)
grub_util_error ("diskboot.img is not one sector size");
grub_util_error (_("diskboot.img size must be %u bytes"), GRUB_DISK_SECTOR_SIZE);
boot_img = grub_util_read_image (boot_path);
@ -278,7 +281,7 @@ generate_image (const char *dir, char *prefix, FILE *out, char *mods[],
#ifdef GRUB_MACHINE_PCBIOS
if (GRUB_KERNEL_MACHINE_LINK_ADDR + core_size > GRUB_MEMORY_MACHINE_UPPER)
grub_util_error ("Core image is too big (%p > %p)\n",
grub_util_error (_("Core image is too big (%p > %p)\n"),
GRUB_KERNEL_MACHINE_LINK_ADDR + core_size, GRUB_MEMORY_MACHINE_UPPER);
#endif
@ -315,9 +318,9 @@ static void
usage (int status)
{
if (status)
fprintf (stderr, "Try ``grub-mkimage --help'' for more information.\n");
fprintf (stderr, _("Try ``%s --help'' for more information.\n"), program_name);
else
printf ("\
printf (_("\
Usage: grub-mkimage [OPTION]... [MODULES]\n\
\n\
Make a bootable image of GRUB.\n\
@ -332,7 +335,7 @@ Make a bootable image of GRUB.\n\
-v, --verbose print verbose messages\n\
\n\
Report bugs to <%s>.\n\
", GRUB_LIBDIR, DEFAULT_DIRECTORY, PACKAGE_BUGREPORT);
"), GRUB_LIBDIR, DEFAULT_DIRECTORY, PACKAGE_BUGREPORT);
exit (status);
}
@ -347,7 +350,10 @@ main (int argc, char *argv[])
char *config = NULL;
FILE *fp = stdout;
progname = "grub-mkimage";
set_program_name (argv[0]);
setlocale (LC_ALL, "");
bindtextdomain (PACKAGE, LOCALEDIR);
textdomain (PACKAGE);
while (1)
{
@ -420,7 +426,7 @@ main (int argc, char *argv[])
{
fp = fopen (output, "wb");
if (! fp)
grub_util_error ("cannot open %s", output);
grub_util_error (_("cannot open %s"), output);
free (output);
}

View file

@ -1,180 +0,0 @@
#! /bin/sh -e
# Make GRUB rescue image
# Copyright (C) 1999,2000,2001,2002,2003,2004,2005,2006,2007,2008 Free Software Foundation, Inc.
#
# GRUB 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 3 of the License, or
# (at your option) any later version.
#
# GRUB 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 GRUB. If not, see <http://www.gnu.org/licenses/>.
# Initialize some variables.
transform="@program_transform_name@"
prefix=@prefix@
exec_prefix=@exec_prefix@
bindir=@bindir@
libdir=@libdir@
PACKAGE_NAME=@PACKAGE_NAME@
PACKAGE_TARNAME=@PACKAGE_TARNAME@
PACKAGE_VERSION=@PACKAGE_VERSION@
target_cpu=@target_cpu@
platform=@platform@
pkglibdir=${libdir}/`echo ${PACKAGE_TARNAME}/${target_cpu}-${platform} | sed ${transform}`
grub_mkimage=${bindir}/`echo grub-mkimage | sed ${transform}`
# Usage: usage
# Print the usage.
usage () {
cat <<EOF
Usage: $0 [OPTION] output_image
Make GRUB rescue image.
-h, --help print this message and exit
-v, --version print the version information and exit
--modules=MODULES pre-load specified modules MODULES
--overlay=DIR overlay directory DIR in the memdisk image
(may be specified multiple times)
--pkglibdir=DIR use images from directory DIR instead of ${pkglibdir}
--grub-mkimage=FILE use FILE as grub-mkimage
--image-type=TYPE select floppy or cdrom (default)
--emulation=TYPE select El Torito boot emulation type floppy
or none (default) (cdrom only)
$0 generates a bootable rescue image of the specified type.
Report bugs to <bug-grub@gnu.org>.
EOF
}
image_type=cdrom
input_dir=${pkglibdir}
emulation=none
# Check the arguments.
for option in "$@"; do
case "$option" in
-h | --help)
usage
exit 0 ;;
-v | --version)
echo "$0 (GNU GRUB ${PACKAGE_VERSION})"
exit 0 ;;
--modules=*)
modules=`echo "$option" | sed 's/--modules=//'` ;;
--overlay=*)
overlay=${overlay}${overlay:+ }`echo "$option" | sed 's/--overlay=//'` ;;
--pkglibdir=*)
input_dir=`echo "$option" | sed 's/--pkglibdir=//'` ;;
--grub-mkimage=*)
grub_mkimage=`echo "$option" | sed 's/--grub-mkimage=//'` ;;
--image-type=*)
image_type=`echo "$option" | sed 's/--image-type=//'`
case "$image_type" in
floppy|cdrom) ;;
*)
echo "Unknown image type \`$image_type'" 1>&2
exit 1 ;;
esac ;;
--emulation=*)
emulation=`echo "$option" | sed 's/--emulation=//'`
case "$emulation" in
floppy|none) ;;
*)
echo "Unknown emulation type \`$emulation'" 1>&2
exit 1 ;;
esac ;;
-*)
echo "Unrecognized option \`$option'" 1>&2
usage
exit 1
;;
*)
if test "x$output_image" != x; then
echo "Unrecognized option \`$option'" 1>&2
usage
exit 1
fi
output_image="${option}" ;;
esac
done
if test "x$output_image" = x; then
usage
exit 1
fi
aux_dir=`mktemp -d`
mkdir -p ${aux_dir}/boot/grub
for file in ${input_dir}/*.mod ${input_dir}/efiemu??.o \
${input_dir}/command.lst ${input_dir}/moddep.lst ${input_dir}/fs.lst \
${input_dir}/handler.lst ${input_dir}/parttool.lst; do
if test -f "$file"; then
cp -f "$file" ${aux_dir}/boot/grub/
fi
done
modules="biosdisk `cat ${input_dir}/partmap.lst` ${modules}"
for i in ${modules} ; do
echo "insmod $i"
done > ${aux_dir}/boot/grub/grub.cfg
for d in ${overlay}; do
echo "Overlaying $d"
cp -dpR "${d}"/* "${aux_dir}"/
done
if [ "x${image_type}" = xfloppy -o "x${emulation}" = xfloppy ] ; then
# build memdisk
memdisk_img=`mktemp`
tar -C ${aux_dir} -cf ${memdisk_img} boot
rm -rf ${aux_dir}
# build core.img
core_img=`mktemp`
${grub_mkimage} -d ${input_dir}/ -m ${memdisk_img} -o ${core_img} memdisk tar
rm -f ${memdisk_img}
# build floppy image
if [ "x${image_type}" = xcdrom ] ; then
floppy_dir=`mktemp -d`
floppy_img=${floppy_dir}/grub_floppy.img
else
floppy_img=${output_image}
fi
cat ${input_dir}/boot.img ${core_img} /dev/zero | dd bs=1024 count=1440 > ${floppy_img}
rm -f ${core_img}
if [ "x${image_type}" = xcdrom ] ; then
# build iso image
genisoimage -b grub_floppy.img \
-o ${output_image} -r -J ${floppy_dir}
rm -rf ${floppy_dir}
fi
else
# build core.img
core_img=`mktemp`
${grub_mkimage} -d ${input_dir}/ -o ${core_img} biosdisk iso9660
# build grub_eltorito image
cat ${input_dir}/cdboot.img ${core_img} > ${aux_dir}/boot/grub/grub_eltorito
rm -f ${core_img}
# build iso image
genisoimage -b boot/grub/grub_eltorito \
-no-emul-boot -boot-load-size 4 -boot-info-table \
-o ${output_image} -r -J ${aux_dir}
rm -rf ${aux_dir}
fi
exit 0

View file

@ -1,7 +1,7 @@
/* grub-setup.c - make GRUB usable */
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 1999,2000,2001,2002,2003,2004,2005,2006,2007,2008 Free Software Foundation, Inc.
* Copyright (C) 1999,2000,2001,2002,2003,2004,2005,2006,2007,2008,2009 Free Software Foundation, Inc.
*
* GRUB is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -32,8 +32,10 @@
#include <grub/machine/boot.h>
#include <grub/machine/kernel.h>
#include <grub/term.h>
#include <grub/i18n.h>
#include <grub/util/raid.h>
#include <grub/util/lvm.h>
#include <grub/util/getroot.h>
static const grub_gpt_part_type_t grub_gpt_partition_type_bios_boot = GRUB_GPT_PARTITION_TYPE_BIOS_BOOT;
@ -46,7 +48,7 @@ static const grub_gpt_part_type_t grub_gpt_partition_type_bios_boot = GRUB_GPT_P
#include <sys/types.h>
#include <sys/stat.h>
#include <dirent.h>
#include <grub/util/getroot.h>
#include "progname.h"
#define _GNU_SOURCE 1
#include <getopt.h>
@ -161,7 +163,7 @@ setup (const char *dir,
sector, offset, length);
if (offset != 0 || length != GRUB_DISK_SECTOR_SIZE)
grub_util_error ("The first sector of the core file is not sector-aligned");
grub_util_error (_("The first sector of the core file is not sector-aligned"));
first_sector = sector;
}
@ -175,7 +177,7 @@ setup (const char *dir,
sector, offset, length, (unsigned) current_segment);
if (offset != 0 || last_length != GRUB_DISK_SECTOR_SIZE)
grub_util_error ("Non-sector-aligned data is found in the core file");
grub_util_error (_("Non-sector-aligned data is found in the core file"));
if (block != first_block
&& (grub_le_to_cpu64 (prev->start)
@ -189,7 +191,7 @@ setup (const char *dir,
block--;
if (block->len)
grub_util_error ("The sectors of the core file are too fragmented");
grub_util_error (_("The sectors of the core file are too fragmented"));
}
last_length = length;
@ -200,7 +202,7 @@ setup (const char *dir,
boot_path = grub_util_get_path (dir, boot_file);
boot_size = grub_util_get_image_size (boot_path);
if (boot_size != GRUB_DISK_SECTOR_SIZE)
grub_util_error ("The size of `%s' is not %d",
grub_util_error (_("The size of `%s' is not %u"),
boot_path, GRUB_DISK_SECTOR_SIZE);
boot_img = grub_util_read_image (boot_path);
free (boot_path);
@ -217,9 +219,9 @@ setup (const char *dir,
core_sectors = ((core_size + GRUB_DISK_SECTOR_SIZE - 1)
>> GRUB_DISK_SECTOR_BITS);
if (core_size < GRUB_DISK_SECTOR_SIZE)
grub_util_error ("The size of `%s' is too small", core_path);
grub_util_error (_("The size of `%s' is too small"), core_path);
else if (core_size > 0xFFFF * GRUB_DISK_SECTOR_SIZE)
grub_util_error ("The size of `%s' is too large", core_path);
grub_util_error (_("The size of `%s' is too large"), core_path);
core_img = grub_util_read_image (core_path);
@ -256,15 +258,15 @@ setup (const char *dir,
grub_fs_t fs;
fs = grub_fs_probe (dest_dev);
if (! fs)
grub_util_error ("Unable to identify a filesystem in %s; safety check can't be performed.",
grub_util_error (_("Unable to identify a filesystem in %s; safety check can't be performed"),
dest_dev->disk->name);
if (! fs->reserved_first_sector)
grub_util_error ("%s appears to contain a %s filesystem which isn't known to "
"reserve space for DOS-style boot. Installing GRUB there could "
"result in FILESYSTEM DESTRUCTION if valuable data is overwritten "
"by grub-setup (--skip-fs-probe disables this "
"check, use at your own risk).", dest_dev->disk->name, fs->name);
grub_util_error (_("%s appears to contain a %s filesystem which isn't known to "
"reserve space for DOS-style boot. Installing GRUB there could "
"result in FILESYSTEM DESTRUCTION if valuable data is overwritten "
"by grub-setup (--skip-fs-probe disables this "
"check, use at your own risk)"), dest_dev->disk->name, fs->name);
}
/* Copy the possible DOS BPB. */
@ -309,7 +311,7 @@ setup (const char *dir,
bsd_part = -1;
}
else
grub_util_error ("No PC style partitions found");
grub_util_error (_("No DOS-style partitions found"));
}
else
dos_part = bsd_part = -1;
@ -325,13 +327,13 @@ setup (const char *dir,
if (! dest_dev->disk->has_partitions)
{
grub_util_warn ("Attempting to install GRUB to a partitionless disk. This is a BAD idea.");
grub_util_warn (_("Attempting to install GRUB to a partitionless disk. This is a BAD idea."));
goto unable_to_embed;
}
if (dest_dev->disk->partition)
{
grub_util_warn ("Attempting to install GRUB to a partition instead of the MBR. This is a BAD idea.");
grub_util_warn (_("Attempting to install GRUB to a partition instead of the MBR. This is a BAD idea."));
goto unable_to_embed;
}
@ -350,7 +352,7 @@ setup (const char *dir,
if (! dest_partmap)
{
grub_util_warn ("Attempting to install GRUB to a partitionless disk. This is a BAD idea.");
grub_util_warn (_("Attempting to install GRUB to a partitionless disk. This is a BAD idea."));
goto unable_to_embed;
}
@ -360,25 +362,23 @@ setup (const char *dir,
if (embed_region.end == embed_region.start)
{
if (! strcmp (dest_partmap, "part_msdos"))
grub_util_warn ("This msdos-style partition label has no post-MBR gap; embedding won't be possible!");
grub_util_warn (_("This msdos-style partition label has no post-MBR gap; embedding won't be possible!"));
else
grub_util_warn ("This GPT partition label has no BIOS Boot Partition; embedding won't be possible!");
grub_util_warn (_("This GPT partition label has no BIOS Boot Partition; embedding won't be possible!"));
goto unable_to_embed;
}
if ((unsigned long) core_sectors > embed_region.end - embed_region.start)
{
if (core_sectors > 62)
grub_util_warn ("Your core.img is unusually large. It won't fit in the embedding area.");
else if (embed_region.end - embed_region.start < 62)
grub_util_warn ("Your embedding area is unusually small. core.img won't fit in it.");
else
grub_util_warn ("Embedding area is too small for core.img.");
grub_util_warn (_("Your core.img is unusually large. It won't fit in the embedding area."));
else /* embed_region.end - embed_region.start < 62 */
grub_util_warn (_("Your embedding area is unusually small. core.img won't fit in it."));
goto unable_to_embed;
}
grub_util_info ("will embed the core image at sector 0x%llx", embed_region.start);
grub_util_info ("the core image will be embedded at sector 0x%llx", embed_region.start);
*install_dos_part = grub_cpu_to_le32 (dos_part);
*install_bsd_part = grub_cpu_to_le32 (bsd_part);
@ -415,14 +415,14 @@ setup (const char *dir,
unable_to_embed:
if (must_embed)
grub_util_error ("Embedding is not possible, but this is required when "
"the root device is on a RAID array or LVM volume.");
grub_util_error (_("Embedding is not possible, but this is required when "
"the root device is on a RAID array or LVM volume."));
grub_util_warn ("Embedding is not possible. GRUB can only be installed in this "
"setup by using blocklists. However, blocklists are UNRELIABLE and "
"its use is discouraged.");
grub_util_warn (_("Embedding is not possible. GRUB can only be installed in this "
"setup by using blocklists. However, blocklists are UNRELIABLE and "
"its use is discouraged."));
if (! force)
grub_util_error ("If you really want blocklists, use --force.");
grub_util_error (_("If you really want blocklists, use --force."));
/* Make sure that GRUB reads the identical image as the OS. */
tmp_img = xmalloc (core_size);
@ -436,8 +436,9 @@ unable_to_embed:
for (i = 0; i < MAX_TRIES; i++)
{
grub_util_info ("attempting to read the core image `%s' from GRUB%s",
core_path_dev, (i == 0) ? "" : " again");
grub_util_info ((i == 0) ? _("attempting to read the core image `%s' from GRUB")
: _("attempting to read the core image `%s' from GRUB again"),
core_path_dev);
grub_disk_cache_invalidate_all ();
@ -494,7 +495,7 @@ unable_to_embed:
}
if (i == MAX_TRIES)
grub_util_error ("Cannot read `%s' correctly", core_path_dev);
grub_util_error (_("Cannot read `%s' correctly"), core_path_dev);
/* Clean out the blocklists. */
block = first_block;
@ -507,7 +508,7 @@ unable_to_embed:
block--;
if ((char *) block <= core_img)
grub_util_error ("No terminator in the core image");
grub_util_error (_("No terminator in the core image"));
}
/* Now read the core image to determine where the sectors are. */
@ -518,13 +519,13 @@ unable_to_embed:
file->read_hook = save_first_sector;
if (grub_file_read (file, tmp_img, GRUB_DISK_SECTOR_SIZE)
!= GRUB_DISK_SECTOR_SIZE)
grub_util_error ("Failed to read the first sector of the core image");
grub_util_error (_("Failed to read the first sector of the core image"));
block = first_block;
file->read_hook = save_blocklists;
if (grub_file_read (file, tmp_img, core_size - GRUB_DISK_SECTOR_SIZE)
!= (grub_ssize_t) core_size - GRUB_DISK_SECTOR_SIZE)
grub_util_error ("Failed to read the rest sectors of the core image");
grub_util_error (_("Failed to read the rest sectors of the core image"));
grub_file_close (file);
@ -543,7 +544,7 @@ unable_to_embed:
grub_util_info ("opening the core image `%s'", core_path);
fp = fopen (core_path, "r+b");
if (! fp)
grub_util_error ("Cannot open `%s'", core_path);
grub_util_error (_("Cannot open `%s'"), core_path);
grub_util_write_image (core_img, GRUB_DISK_SECTOR_SIZE * 2, fp);
fclose (fp);
@ -583,9 +584,9 @@ static void
usage (int status)
{
if (status)
fprintf (stderr, "Try ``grub-setup --help'' for more information.\n");
fprintf (stderr, _("Try ``%s --help'' for more information.\n"), program_name);
else
printf ("\
printf (_("\
Usage: grub-setup [OPTION]... DEVICE\n\
\n\
Set up images to boot from DEVICE.\n\
@ -603,7 +604,7 @@ DEVICE must be a GRUB device (e.g. ``(hd0,1)'').\n\
-v, --verbose print verbose messages\n\
\n\
Report bugs to <%s>.\n\
",
"),
DEFAULT_BOOT_FILE, DEFAULT_CORE_FILE, DEFAULT_DIRECTORY,
DEFAULT_DEVICE_MAP, PACKAGE_BUGREPORT);
@ -633,7 +634,10 @@ main (int argc, char *argv[])
char *dest_dev;
int must_embed = 0, force = 0, fs_probe = 1;
progname = "grub-setup";
set_program_name (argv[0]);
setlocale (LC_ALL, "");
bindtextdomain (PACKAGE, LOCALEDIR);
textdomain (PACKAGE);
/* Check for options. */
while (1)
@ -712,13 +716,13 @@ main (int argc, char *argv[])
/* Obtain DEST_DEV. */
if (optind >= argc)
{
fprintf (stderr, "No device is specified.\n");
fprintf (stderr, _("No device is specified.\n"));
usage (1);
}
if (optind + 1 != argc)
{
fprintf (stderr, "Unknown extra argument `%s'.\n", argv[optind + 1]);
fprintf (stderr, _("Unknown extra argument `%s'.\n"), argv[optind + 1]);
usage (1);
}
@ -735,7 +739,7 @@ main (int argc, char *argv[])
dest_dev = grub_util_get_grub_dev (argv[optind]);
if (! dest_dev)
{
fprintf (stderr, "Invalid device `%s'.\n", argv[optind]);
fprintf (stderr, _("Invalid device `%s'.\n"), argv[optind]);
usage (1);
}
}
@ -748,7 +752,7 @@ main (int argc, char *argv[])
char *tmp = get_device_name (root_dev);
if (! tmp)
grub_util_error ("Invalid root device `%s'", root_dev);
grub_util_error (_("Invalid root device `%s'"), root_dev);
tmp = xstrdup (tmp);
free (root_dev);
@ -761,7 +765,7 @@ main (int argc, char *argv[])
{
grub_util_info ("guessing the root device failed, because of `%s'",
grub_errmsg);
grub_util_error ("Cannot guess the root device. Specify the option ``--root-device''.");
grub_util_error (_("Cannot guess the root device. Specify the option ``--root-device''."));
}
}

286
util/import_gcry.py Normal file
View file

@ -0,0 +1,286 @@
#*
#* GRUB -- GRand Unified Bootloader
#* Copyright (C) 2009 Free Software Foundation, Inc.
#*
#* GRUB 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 3 of the License, or
#* (at your option) any later version.
#*
#* GRUB 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 GRUB. If not, see <http://www.gnu.org/licenses/>.
#*
import re
import sys
import os
import datetime
if len (sys.argv) < 3:
print ("Usage: %s SOURCE DESTINATION" % sys.argv[0])
exit (0)
indir = sys.argv[1]
outdir = sys.argv[2]
basedir = os.path.join (outdir, "lib/libgcrypt-grub")
try:
os.makedirs (basedir)
except:
print ("WARNING: %s already exists" % basedir)
cipher_dir_in = os.path.join (indir, "cipher")
cipher_dir_out = os.path.join (basedir, "cipher")
try:
os.makedirs (cipher_dir_out)
except:
print ("WARNING: %s already exists" % cipher_dir_out)
cipher_files = os.listdir (cipher_dir_in)
conf = open (os.path.join (outdir, "conf", "gcry.rmk"), "w")
conf.write ("# -*- makefile -*-\n\n")
chlog = ""
# Strictly speaking CRC32/CRC24 work on bytes so this value should be 1
# But libgcrypt uses 64. Let's keep the value for compatibility. Since
# noone uses CRC24/CRC32 for HMAC this is no problem
mdblocksizes = {"_gcry_digest_spec_crc32" : 64,
"_gcry_digest_spec_crc32_rfc1510" : 64,
"_gcry_digest_spec_crc24_rfc2440" : 64,
"_gcry_digest_spec_md4" : 64,
"_gcry_digest_spec_md5" : 64,
"_gcry_digest_spec_rmd160" : 64,
"_gcry_digest_spec_sha1" : 64,
"_gcry_digest_spec_sha224" : 64,
"_gcry_digest_spec_sha256" : 64,
"_gcry_digest_spec_sha384" : 128,
"_gcry_digest_spec_sha512" : 128,
"_gcry_digest_spec_tiger" : 64,
"_gcry_digest_spec_whirlpool" : 64}
for cipher_file in cipher_files:
infile = os.path.join (cipher_dir_in, cipher_file)
outfile = os.path.join (cipher_dir_out, cipher_file)
if cipher_file == "ChangeLog":
continue
chlognew = " * %s" % cipher_file
nch = False
if re.match (".*\.[ch]$", cipher_file):
isc = re.match (".*\.c$", cipher_file)
f = open (infile, "r")
fw = open (outfile, "w")
fw.write ("/* This file was automatically imported with \n")
fw.write (" import_gcry.py. Please don't modify it */\n");
ciphernames = []
mdnames = []
hold = False
skip = False
skip2 = False
ismd = False
iscomma = False
for line in f:
if skip:
if line[0] == "}":
skip = False
continue
if skip2:
if not re.search (" *};", line) is None:
skip2 = False
continue
if ismd:
if not re.search (" *};", line) is None:
if not mdblocksizes.has_key (mdname):
print ("ERROR: Unknown digest blocksize: %s\n" % mdname)
exit (1)
if not iscomma:
fw.write (" ,\n")
fw.write (" .blocksize = %s\n" % mdblocksizes [mdname])
ismd = False
iscomma = not re.search (",$", line) is None
if hold:
hold = False
# We're optimising for size.
if not re.match ("(run_selftests|selftest|_gcry_aes_c.._..c|_gcry_[a-z0-9]*_hash_buffer)", line) is None:
skip = True
fname = re.match ("[a-zA-Z0-9_]*", line).group ()
chmsg = "(%s): Removed." % fname
if nch:
chlognew = "%s\n %s" % (chlognew, chmsg)
else:
chlognew = "%s %s" % (chlognew, chmsg)
nch = True
continue
else:
fw.write (holdline)
m = re.match ("#include <.*>", line)
if not m is None:
chmsg = "Removed including of %s" % \
m.group () [len ("#include <"):len (m.group ()) - 1]
if nch:
chlognew = "%s\n %s" % (chlognew, chmsg)
else:
chlognew = "%s: %s" % (chlognew, chmsg)
nch = True
continue
m = re.match ("gcry_cipher_spec_t", line)
if isc and not m is None:
ciphername = line [len ("gcry_cipher_spec_t"):].strip ()
ciphername = re.match("[a-zA-Z0-9_]*",ciphername).group ()
ciphernames.append (ciphername)
m = re.match ("gcry_md_spec_t", line)
if isc and not m is None:
assert (not ismd)
mdname = line [len ("gcry_md_spec_t"):].strip ()
mdname = re.match("[a-zA-Z0-9_]*",mdname).group ()
mdnames.append (mdname)
ismd = True
m = re.match ("static const char \*selftest.*;$", line)
if not m is None:
fname = line[len ("static const char \*"):]
fname = re.match ("[a-zA-Z0-9_]*", fname).group ()
chmsg = "(%s): Removed declaration." % fname
if nch:
chlognew = "%s\n %s" % (chlognew, chmsg)
else:
chlognew = "%s %s" % (chlognew, chmsg)
nch = True
continue
m = re.match ("(static const char( |)\*|static gpg_err_code_t|void)$", line)
if not m is None:
hold = True
holdline = line
continue
m = re.match ("cipher_extra_spec_t", line)
if isc and not m is None:
skip2 = True
fname = line[len ("cipher_extra_spec_t "):]
fname = re.match ("[a-zA-Z0-9_]*", fname).group ()
chmsg = "(%s): Removed." % fname
if nch:
chlognew = "%s\n %s" % (chlognew, chmsg)
else:
chlognew = "%s %s" % (chlognew, chmsg)
nch = True
continue
m = re.match ("md_extra_spec_t", line)
if isc and not m is None:
skip2 = True
fname = line[len ("md_extra_spec_t "):]
fname = re.match ("[a-zA-Z0-9_]*", fname).group ()
chmsg = "(%s): Removed." % fname
if nch:
chlognew = "%s\n %s" % (chlognew, chmsg)
else:
chlognew = "%s %s" % (chlognew, chmsg)
nch = True
continue
fw.write (line)
if len (ciphernames) > 0 or len (mdnames) > 0:
modname = cipher_file [0:len(cipher_file) - 2]
if re.match (".*-glue$", modname):
modfiles = "lib/libgcrypt-grub/cipher/%s lib/libgcrypt-grub/cipher/%s" \
% (cipher_file, cipher_file.replace ("-glue.c", ".c"))
modname = modname.replace ("-glue", "")
else:
modfiles = "lib/libgcrypt-grub/cipher/%s" % cipher_file
modname = "gcry_%s" % modname
chmsg = "(GRUB_MOD_INIT(%s)): New function\n" % modname
if nch:
chlognew = "%s\n %s" % (chlognew, chmsg)
else:
chlognew = "%s%s" % (chlognew, chmsg)
nch = True
fw.write ("\n\nGRUB_MOD_INIT(%s)\n" % modname)
fw.write ("{\n")
for ciphername in ciphernames:
chmsg = "Register cipher %s" % ciphername
chlognew = "%s\n %s" % (chlognew, chmsg)
fw.write (" grub_cipher_register (&%s);\n" % ciphername)
for mdname in mdnames:
chmsg = "Register digest %s" % mdname
chlognew = "%s\n %s" % (chlognew, chmsg)
fw.write (" grub_md_register (&%s);\n" % mdname)
fw.write ("}")
chmsg = "(GRUB_MOD_FINI(%s)): New function\n" % modname
chlognew = "%s\n %s" % (chlognew, chmsg)
fw.write ("\n\nGRUB_MOD_FINI(%s)\n" % modname)
fw.write ("{\n")
for ciphername in ciphernames:
chmsg = "Unregister cipher %s" % ciphername
chlognew = "%s\n %s" % (chlognew, chmsg)
fw.write (" grub_cipher_unregister (&%s);\n" % ciphername)
for mdname in mdnames:
chmsg = "Unregister MD %s" % mdname
chlognew = "%s\n %s" % (chlognew, chmsg)
fw.write (" grub_md_unregister (&%s);\n" % mdname)
fw.write ("}\n")
conf.write ("pkglib_MODULES += %s.mod\n" % modname)
conf.write ("%s_mod_SOURCES = %s\n" %\
(modname, modfiles))
conf.write ("%s_mod_CFLAGS = $(COMMON_CFLAGS) -Wno-missing-field-initializers -Wno-error\n" % modname)
conf.write ("%s_mod_LDFLAGS = $(COMMON_LDFLAGS)\n\n" % modname)
elif isc and cipher_file != "camellia.c":
print ("WARNING: C file isn't a module: %s" % cipher_file)
f.close ()
fw.close ()
if nch:
chlog = "%s%s\n" % (chlog, chlognew)
continue
if re.match ("(Manifest|Makefile\.am)$", cipher_file):
chlog = "%s%sRemoved\n" % (chlog, chlognew)
continue
# Autogenerated files. Not even worth mentionning in ChangeLog
if re.match ("Makefile\.in$", cipher_file):
chlog = "%s%sRemoved\n" % (chlog, chlognew)
continue
chlog = "%s%sSkipped unknown file\n" % (chlog, chlognew)
print ("WARNING: unknown file %s" % cipher_file)
outfile = os.path.join (cipher_dir_out, "types.h")
fw=open (outfile, "w")
fw.write ("#include <grub/types.h>\n")
fw.write ("#include <grub/cipher_wrap.h>\n")
chlog = "%s * types.h: New file.\n" % chlog
fw.close ()
outfile = os.path.join (cipher_dir_out, "memory.h")
fw=open (outfile, "w")
fw.write ("#include <grub/cipher_wrap.h>\n")
chlog = "%s * memory.h: New file.\n" % chlog
fw.close ()
outfile = os.path.join (cipher_dir_out, "cipher.h")
fw=open (outfile, "w")
fw.write ("#include <grub/crypto.h>\n")
fw.write ("#include <grub/cipher_wrap.h>\n")
chlog = "%s * cipher.h: Likewise.\n" % chlog
fw.close ()
outfile = os.path.join (cipher_dir_out, "g10lib.h")
fw=open (outfile, "w")
fw.write ("#include <grub/cipher_wrap.h>\n")
chlog = "%s * g10lib.h: Likewise.\n" % chlog
fw.close ()
infile = os.path.join (cipher_dir_in, "ChangeLog")
outfile = os.path.join (cipher_dir_out, "ChangeLog")
f=open (infile, "r")
fw=open (outfile, "w")
dt = datetime.date.today ()
fw.write ("%04d-%02d-%02d Automatic import tool\n" % \
(dt.year,dt.month, dt.day))
fw.write ("\n")
fw.write (" Imported ciphers to GRUB\n")
fw.write ("\n")
fw.write (chlog)
fw.write ("\n")
for line in f:
fw.write (line)
f.close ()
fw.close ()

View file

@ -36,8 +36,6 @@
#include <grub/mm.h>
#include <grub/term.h>
#include <grub/time.h>
#include <grub/machine/time.h>
#include <grub/machine/machine.h>
/* Include malloc.h, only if memalign is available. It is known that
memalign is declared in malloc.h in all systems, if present. */

View file

@ -6,9 +6,14 @@
Copyright 1996 RedHat Software, Incorporated
Copyright (C) 2009 Free Software Foundation, Inc.
Boot Info Table generation based on code from genisoimage.c
(from cdrkit 1.1.9), which was originally licensed under GPLv2+.
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, or (at your option)
the Free Software Foundation; either version 3, or (at your option)
any later version.
This program is distributed in the hope that it will be useful,
@ -17,18 +22,17 @@
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. */
along with this program; if not, see <http://www.gnu.org/licenses/>.
*/
static char rcsid[] ="$Id: eltorito.c,v 1.13 1999/03/02 03:41:25 eric Exp $";
#include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <fcntl.h>
#include <stdlib.h>
#include <errno.h>
#include "config.h"
#include "mkisofs.h"
@ -53,8 +57,7 @@ static int tvd_write __PR((FILE * outfile));
*/
void FDECL1(init_boot_catalog, const char *, path)
{
int bcat;
FILE *bcat;
char * bootpath; /* filename of boot catalog */
char * buf;
struct stat statbuf;
@ -90,11 +93,11 @@ void FDECL1(init_boot_catalog, const char *, path)
}
else
{
fprintf(stderr, "A boot catalog exists and appears corrupted.\n");
fprintf(stderr, "Please check the following file: %s.\n",bootpath);
fprintf(stderr, "This file must be removed before a bootable CD can be done.\n");
free(bootpath);
exit(1);
fprintf (stderr, _("A boot catalog exists and appears corrupted.\n"));
fprintf (stderr, _("Please check the following file: %s.\n"), bootpath);
fprintf (stderr, _("This file must be removed before a bootable CD can be done.\n"));
free (bootpath);
exit (1);
}
}
@ -102,23 +105,22 @@ void FDECL1(init_boot_catalog, const char *, path)
* file does not exist, so we create it
* make it one CD sector long
*/
bcat = open(bootpath, O_WRONLY | O_CREAT | O_BINARY, S_IROTH | S_IRGRP | S_IRWXU );
if (bcat == -1)
{
fprintf(stderr, "Error creating boot catalog, exiting...\n");
perror("");
exit(1);
}
bcat = fopen (bootpath, "wb");
if (bcat == NULL)
error (1, errno, _("Error creating boot catalog (%s)"), bootpath);
buf = (char *) e_malloc( 2048 );
write(bcat, buf, 2048);
close(bcat);
if (fwrite (buf, 1, 2048, bcat) != 2048)
error (1, errno, _("Error writing to boot catalog (%s)"), bootpath);
fclose (bcat);
chmod (bootpath, S_IROTH | S_IRGRP | S_IRWXU);
free(bootpath);
} /* init_boot_catalog(... */
void FDECL1(get_torito_desc, struct eltorito_boot_descriptor *, boot_desc)
{
int bootcat;
FILE *bootcat;
int checksum;
unsigned char * checksum_ptr;
struct directory_entry * de;
@ -139,8 +141,8 @@ void FDECL1(get_torito_desc, struct eltorito_boot_descriptor *, boot_desc)
de2 = search_tree_file(root, boot_catalog);
if (!de2)
{
fprintf(stderr,"Uh oh, I cant find the boot catalog!\n");
exit(1);
fprintf (stderr, _("Boot catalog cannot be found!\n"));
exit (1);
}
set_731(boot_desc->bootcat_ptr,
@ -153,8 +155,8 @@ void FDECL1(get_torito_desc, struct eltorito_boot_descriptor *, boot_desc)
de=search_tree_file(root, boot_image);
if (!de)
{
fprintf(stderr,"Uh oh, I cant find the boot image!\n");
exit(1);
fprintf (stderr, _("Boot image cannot be found!\n"));
exit (1);
}
/*
@ -216,32 +218,37 @@ void FDECL1(get_torito_desc, struct eltorito_boot_descriptor *, boot_desc)
* assume 512 bytes/sector on a bootable floppy
*/
nsectors = ((de->size + 511) & ~(511))/512;
fprintf(stderr, "\nSize of boot image is %d sectors -> ", nsectors);
/*
* choose size of emulated floppy based on boot image size
*/
if (nsectors == 2880 )
{
fprintf (stderr, _("\nSize of boot image is %d sectors"), nsectors);
fprintf (stderr, " -> ");
if (! use_eltorito_emul_floppy)
{
default_desc.boot_media[0] = EL_TORITO_MEDIA_NOEMUL;
fprintf (stderr, _("No emulation\n"));
}
else if (nsectors == 2880 )
/*
* choose size of emulated floppy based on boot image size
*/
{
default_desc.boot_media[0] = EL_TORITO_MEDIA_144FLOP;
fprintf(stderr, "Emulating a 1.44 meg floppy\n");
}
fprintf (stderr, _("Emulating a 1.44 meg floppy\n"));
}
else if (nsectors == 5760 )
{
{
default_desc.boot_media[0] = EL_TORITO_MEDIA_288FLOP;
fprintf(stderr,"Emulating a 2.88 meg floppy\n");
}
fprintf (stderr, _("Emulating a 2.88 meg floppy\n"));
}
else if (nsectors == 2400 )
{
{
default_desc.boot_media[0] = EL_TORITO_MEDIA_12FLOP;
fprintf(stderr,"Emulating a 1.2 meg floppy\n");
}
fprintf (stderr, _("Emulating a 1.2 meg floppy\n"));
}
else
{
fprintf(stderr,"\nError - boot image is not the an allowable size.\n");
exit(1);
}
{
fprintf (stderr, _("\nError - boot image is not the an allowable size.\n"));
exit (1);
}
/*
* FOR NOW LOAD 1 SECTOR, JUST LIKE FLOPPY BOOT!!!
@ -257,20 +264,66 @@ void FDECL1(get_torito_desc, struct eltorito_boot_descriptor *, boot_desc)
/*
* now write it to disk
*/
bootcat = open(de2->whole_name, O_RDWR | O_BINARY);
if (bootcat == -1)
{
fprintf(stderr,"Error opening boot catalog for update.\n");
perror("");
exit(1);
}
bootcat = fopen (de2->whole_name, "r+b");
if (bootcat == NULL)
error (1, errno, _("Error opening boot catalog for update"));
/*
* write out
*/
write(bootcat, &valid_desc, 32);
write(bootcat, &default_desc, 32);
close(bootcat);
if (fwrite (&valid_desc, 1, 32, bootcat) != 32)
error (1, errno, _("Error writing to boot catalog"));
if (fwrite (&default_desc, 1, 32, bootcat) != 32)
error (1, errno, _("Error writing to boot catalog"));
fclose (bootcat);
/* If the user has asked for it, patch the boot image */
if (use_boot_info_table)
{
FILE *bootimage;
uint32_t bi_checksum;
unsigned int total_len;
static char csum_buffer[SECTOR_SIZE];
int len;
struct eltorito_boot_info bi_table;
bootimage = fopen (de->whole_name, "r+b");
if (bootimage == NULL)
error (1, errno, _("Error opening boot image file '%s' for update"),
de->whole_name);
/* Compute checksum of boot image, sans 64 bytes */
total_len = 0;
bi_checksum = 0;
while ((len = fread (csum_buffer, 1, SECTOR_SIZE, bootimage)) > 0)
{
if (total_len & 3)
error (1, 0, _("Odd alignment at non-end-of-file in boot image '%s'"),
de->whole_name);
if (total_len < 64)
memset (csum_buffer, 0, 64 - total_len);
if (len < SECTOR_SIZE)
memset (csum_buffer + len, 0, SECTOR_SIZE - len);
for (i = 0; i < SECTOR_SIZE; i += 4)
bi_checksum += get_731 (&csum_buffer[i]);
total_len += len;
}
if (total_len != de->size)
error (1, 0, _("Boot image file '%s' changed unexpectedly"),
de->whole_name);
/* End of file, set position to byte 8 */
fseeko (bootimage, (off_t) 8, SEEK_SET);
memset (&bi_table, 0, sizeof (bi_table));
/* Is it always safe to assume PVD is at session_start+16? */
set_731 (bi_table.pvd_addr, session_start + 16);
set_731 (bi_table.file_addr, de->starting_block);
set_731 (bi_table.file_length, de->size);
set_731 (bi_table.file_checksum, bi_checksum);
if (fwrite (&bi_table, 1, sizeof (bi_table), bootimage) != sizeof (bi_table))
error (1, errno, _("Error writing to boot image (%s)"), bootimage);
fclose (bootimage);
}
} /* get_torito_desc(... */
/*

View file

@ -1,230 +0,0 @@
/* Copyright (C) 1991, 1992, 1993 Free Software Foundation, Inc.
NOTE: The canonical source of this file is maintained with the GNU C Library.
Bugs can be reported to bug-glibc@prep.ai.mit.edu.
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, 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, 675 Mass Ave, Cambridge, MA 02139, USA. */
static char rcsid[] ="$Id: fnmatch.c,v 1.4 1999/03/02 03:41:25 eric Exp $";
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <errno.h>
#include <fnmatch.h>
#ifndef __STDC__
#define const
#endif
#ifndef FNM_FILE_NAME
#define FNM_FILE_NAME FNM_PATHNAME /* Preferred GNU name. */
#endif
#ifndef FNM_LEADING_DIR
#define FNM_LEADING_DIR (1 << 3) /* Ignore `/...' after a match. */
#endif
#ifndef FNM_CASEFOLD
#define FNM_CASEFOLD (1 << 4) /* Compare without regard to case. */
#endif
#include <ctype.h>
#if defined (STDC_HEADERS) || !defined (isascii)
#define ISASCII(c) 1
#else
#define ISASCII(c) isascii(c)
#endif
#define ISUPPER(c) (ISASCII (c) && isupper (c))
/* Comment out all this code if we are using the GNU C Library, and are not
actually compiling the library itself. This code is part of the GNU C
Library, but also included in many other GNU distributions. Compiling
and linking in this code is a waste when using the GNU C library
(especially if it is a shared library). Rather than having every GNU
program understand `configure --with-gnu-libc' and omit the object files,
it is simpler to just do this in the source for each such file. */
#if defined (_LIBC) || !defined (__GNU_LIBRARY__)
#if !defined(__GNU_LIBRARY__) && !defined(STDC_HEADERS)
extern int errno;
#endif
/* Match STRING against the filename pattern PATTERN, returning zero if
it matches, nonzero if not. */
int
fnmatch (pattern, string, flags)
const char *pattern;
const char *string;
int flags;
{
register const char *p = pattern, *n = string;
register char c;
/* Note that this evalutes C many times. */
#define FOLD(c) ((flags & FNM_CASEFOLD) && ISUPPER (c) ? tolower (c) : (c))
while ((c = *p++) != '\0')
{
c = FOLD ((unsigned char)c);
switch (c)
{
case '?':
if (*n == '\0')
return FNM_NOMATCH;
else if ((flags & FNM_FILE_NAME) && *n == '/')
return FNM_NOMATCH;
else if ((flags & FNM_PERIOD) && *n == '.' &&
(n == string || ((flags & FNM_FILE_NAME) && n[-1] == '/')))
return FNM_NOMATCH;
break;
case '\\':
if (!(flags & FNM_NOESCAPE))
{
c = *p++;
c = FOLD ((unsigned char )c);
}
if (FOLD ((unsigned char )*n) != c)
return FNM_NOMATCH;
break;
case '*':
if ((flags & FNM_PERIOD) && *n == '.' &&
(n == string || ((flags & FNM_FILE_NAME) && n[-1] == '/')))
return FNM_NOMATCH;
for (c = *p++; c == '?' || c == '*'; c = *p++, ++n)
if (((flags & FNM_FILE_NAME) && *n == '/') ||
(c == '?' && *n == '\0'))
return FNM_NOMATCH;
if (c == '\0')
return 0;
{
char c1 = (!(flags & FNM_NOESCAPE) && c == '\\') ? *p : c;
c1 = FOLD ((unsigned char )c1);
for (--p; *n != '\0'; ++n)
if ((c == '[' || FOLD ((unsigned char )*n) == c1) &&
fnmatch (p, n, flags & ~FNM_PERIOD) == 0)
return 0;
return FNM_NOMATCH;
}
case '[':
{
/* Nonzero if the sense of the character class is inverted. */
register int not;
if (*n == '\0')
return FNM_NOMATCH;
if ((flags & FNM_PERIOD) && *n == '.' &&
(n == string || ((flags & FNM_FILE_NAME) && n[-1] == '/')))
return FNM_NOMATCH;
not = (*p == '!' || *p == '^');
if (not)
++p;
c = *p++;
for (;;)
{
register char cstart = c, cend = c;
if (!(flags & FNM_NOESCAPE) && c == '\\')
cstart = cend = *p++;
cstart = cend = FOLD ((unsigned char)cstart);
if (c == '\0')
/* [ (unterminated) loses. */
return FNM_NOMATCH;
c = *p++;
c = FOLD ((unsigned char)c);
if ((flags & FNM_FILE_NAME) && c == '/')
/* [/] can never match. */
return FNM_NOMATCH;
if (c == '-' && *p != ']')
{
cend = *p++;
if (!(flags & FNM_NOESCAPE) && cend == '\\')
cend = *p++;
if (cend == '\0')
return FNM_NOMATCH;
cend = FOLD ((unsigned char)cend);
c = *p++;
}
if (FOLD ((unsigned char)*n) >= cstart && FOLD ((unsigned char)*n) <= cend)
goto matched;
if (c == ']')
break;
}
if (!not)
return FNM_NOMATCH;
break;
matched:;
/* Skip the rest of the [...] that already matched. */
while (c != ']')
{
if (c == '\0')
/* [... (unterminated) loses. */
return FNM_NOMATCH;
c = *p++;
if (!(flags & FNM_NOESCAPE) && c == '\\')
/* XXX 1003.2d11 is unclear if this is right. */
++p;
}
if (not)
return FNM_NOMATCH;
}
break;
default:
if (c != FOLD ((unsigned char)*n))
return FNM_NOMATCH;
}
++n;
}
if (*n == '\0')
return 0;
if ((flags & FNM_LEADING_DIR) && *n == '/')
/* The FNM_LEADING_DIR flag says that "foo*" matches "foobar/frobozz". */
return 0;
return FNM_NOMATCH;
}
#endif /* _LIBC or not __GNU_LIBRARY__. */

View file

@ -1,762 +0,0 @@
/* Getopt for GNU.
NOTE: getopt is now part of the C library, so if you don't know what
"Keep this file name-space clean" means, talk to roland@gnu.ai.mit.edu
before changing it!
Copyright (C) 1987, 88, 89, 90, 91, 92, 93, 94, 95, 2009
Free Software Foundation, Inc.
This file is part of the libiberty library. This library 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 3, or (at your option)
any later version.
This library 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 GNU CC; see the file COPYING. If not, write to
the Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
As a special exception, if you link this library with files
compiled with a GNU compiler to produce an executable, this does not cause
the resulting executable to be covered by the GNU General Public License.
This exception does not however invalidate any other reasons why
the executable file might be covered by the GNU General Public License. */
/* This tells Alpha OSF/1 not to define a getopt prototype in <stdio.h>.
Ditto for AIX 3.2 and <stdlib.h>. */
#ifndef _NO_PROTO
#define _NO_PROTO
#endif
#ifdef HAVE_CONFIG_H
#if defined (emacs) || defined (CONFIG_BROKETS)
/* We use <config.h> instead of "config.h" so that a compilation
using -I. -I$srcdir will use ./config.h rather than $srcdir/config.h
(which it would do because it found this file in $srcdir). */
#include <config.h>
#else
#include "config.h"
#endif
#endif
#ifndef __STDC__
/* This is a separate conditional since some stdc systems
reject `defined (const)'. */
#ifndef const
#define const
#endif
#endif
#include <stdio.h>
#include <assert.h>
/* Comment out all this code if we are using the GNU C Library, and are not
actually compiling the library itself. This code is part of the GNU C
Library, but also included in many other GNU distributions. Compiling
and linking in this code is a waste when using the GNU C library
(especially if it is a shared library). Rather than having every GNU
program understand `configure --with-gnu-libc' and omit the object files,
it is simpler to just do this in the source for each such file. */
/* Many versions of the Linux C library include older, broken versions
of these routines, which will break the linker's command-line
parsing. */
#if defined (_LIBC) || !defined (__GNU_LIBRARY__) || defined (__linux__)
/* This needs to come after some library #include
to get __GNU_LIBRARY__ defined. */
#ifdef __GNU_LIBRARY__
/* Don't include stdlib.h for non-GNU C libraries because some of them
contain conflicting prototypes for getopt. */
#include <stdlib.h>
#endif /* GNU C library. */
/* This version of `getopt' appears to the caller like standard Unix `getopt'
but it behaves differently for the user, since it allows the user
to intersperse the options with the other arguments.
As `getopt' works, it permutes the elements of ARGV so that,
when it is done, all the options precede everything else. Thus
all application programs are extended to handle flexible argument order.
Setting the environment variable POSIXLY_CORRECT disables permutation.
Then the behavior is completely standard.
GNU application programs can use a third alternative mode in which
they can distinguish the relative order of options and other arguments. */
#include "getopt.h"
/* For communication from `getopt' to the caller.
When `getopt' finds an option that takes an argument,
the argument value is returned here.
Also, when `ordering' is RETURN_IN_ORDER,
each non-option ARGV-element is returned here. */
char *optarg = NULL;
/* Index in ARGV of the next element to be scanned.
This is used for communication to and from the caller
and for communication between successive calls to `getopt'.
On entry to `getopt', zero means this is the first call; initialize.
When `getopt' returns EOF, this is the index of the first of the
non-option elements that the caller should itself scan.
Otherwise, `optind' communicates from one call to the next
how much of ARGV has been scanned so far. */
/* XXX 1003.2 says this must be 1 before any call. */
int optind = 0;
/* The next char to be scanned in the option-element
in which the last option character we returned was found.
This allows us to pick up the scan where we left off.
If this is zero, or a null string, it means resume the scan
by advancing to the next ARGV-element. */
static char *nextchar;
/* Callers store zero here to inhibit the error message
for unrecognized options. */
int opterr = 1;
/* Set to an option character which was unrecognized.
This must be initialized on some systems to avoid linking in the
system's own getopt implementation. */
int optopt = '?';
/* Describe how to deal with options that follow non-option ARGV-elements.
If the caller did not specify anything,
the default is REQUIRE_ORDER if the environment variable
POSIXLY_CORRECT is defined, PERMUTE otherwise.
REQUIRE_ORDER means don't recognize them as options;
stop option processing when the first non-option is seen.
This is what Unix does.
This mode of operation is selected by either setting the environment
variable POSIXLY_CORRECT, or using `+' as the first character
of the list of option characters.
PERMUTE is the default. We permute the contents of ARGV as we scan,
so that eventually all the non-options are at the end. This allows options
to be given in any order, even with programs that were not written to
expect this.
RETURN_IN_ORDER is an option available to programs that were written
to expect options and other ARGV-elements in any order and that care about
the ordering of the two. We describe each non-option ARGV-element
as if it were the argument of an option with character code 1.
Using `-' as the first character of the list of option characters
selects this mode of operation.
The special argument `--' forces an end of option-scanning regardless
of the value of `ordering'. In the case of RETURN_IN_ORDER, only
`--' can cause `getopt' to return EOF with `optind' != ARGC. */
static enum
{
REQUIRE_ORDER, PERMUTE, RETURN_IN_ORDER
} ordering;
#ifdef __GNU_LIBRARY__
/* We want to avoid inclusion of string.h with non-GNU libraries
because there are many ways it can cause trouble.
On some systems, it contains special magic macros that don't work
in GCC. */
#include <string.h>
#define my_index strchr
#else
/* Avoid depending on library functions or files
whose names are inconsistent. */
char *getenv ();
static char *
my_index (str, chr)
const char *str;
int chr;
{
while (*str)
{
if (*str == chr)
return (char *) str;
str++;
}
return 0;
}
/* If using GCC, we can safely declare strlen this way.
If not using GCC, it is ok not to declare it. */
#ifdef __GNUC__
/* Note that Motorola Delta 68k R3V7 comes with GCC but not stddef.h.
That was relevant to code that was here before. */
#ifndef __STDC__
/* gcc with -traditional declares the built-in strlen to return int,
and has done so at least since version 2.4.5. -- rms. */
extern int strlen (const char *);
#endif /* not __STDC__ */
#endif /* __GNUC__ */
#endif /* not __GNU_LIBRARY__ */
/* Handle permutation of arguments. */
/* Describe the part of ARGV that contains non-options that have
been skipped. `first_nonopt' is the index in ARGV of the first of them;
`last_nonopt' is the index after the last of them. */
static int first_nonopt;
static int last_nonopt;
/* Exchange two adjacent subsequences of ARGV.
One subsequence is elements [first_nonopt,last_nonopt)
which contains all the non-options that have been skipped so far.
The other is elements [last_nonopt,optind), which contains all
the options processed since those non-options were skipped.
`first_nonopt' and `last_nonopt' are relocated so that they describe
the new indices of the non-options in ARGV after they are moved. */
static void
exchange (argv)
char **argv;
{
int bottom = first_nonopt;
int middle = last_nonopt;
int top = optind;
char *tem;
/* Exchange the shorter segment with the far end of the longer segment.
That puts the shorter segment into the right place.
It leaves the longer segment in the right place overall,
but it consists of two parts that need to be swapped next. */
while (top > middle && middle > bottom)
{
if (top - middle > middle - bottom)
{
/* Bottom segment is the short one. */
int len = middle - bottom;
register int i;
/* Swap it with the top part of the top segment. */
for (i = 0; i < len; i++)
{
tem = argv[bottom + i];
argv[bottom + i] = argv[top - (middle - bottom) + i];
argv[top - (middle - bottom) + i] = tem;
}
/* Exclude the moved bottom segment from further swapping. */
top -= len;
}
else
{
/* Top segment is the short one. */
int len = top - middle;
register int i;
/* Swap it with the bottom part of the bottom segment. */
for (i = 0; i < len; i++)
{
tem = argv[bottom + i];
argv[bottom + i] = argv[middle + i];
argv[middle + i] = tem;
}
/* Exclude the moved top segment from further swapping. */
bottom += len;
}
}
/* Update records for the slots the non-options now occupy. */
first_nonopt += (optind - last_nonopt);
last_nonopt = optind;
}
/* Initialize the internal data when the first call is made. */
static const char *
_getopt_initialize (optstring)
const char *optstring;
{
/* Start processing options with ARGV-element 1 (since ARGV-element 0
is the program name); the sequence of previously skipped
non-option ARGV-elements is empty. */
first_nonopt = last_nonopt = optind = 1;
nextchar = NULL;
/* Determine how to handle the ordering of options and nonoptions. */
if (optstring[0] == '-')
{
ordering = RETURN_IN_ORDER;
++optstring;
}
else if (optstring[0] == '+')
{
ordering = REQUIRE_ORDER;
++optstring;
}
else if (getenv ("POSIXLY_CORRECT") != NULL)
ordering = REQUIRE_ORDER;
else
ordering = PERMUTE;
return optstring;
}
/* Scan elements of ARGV (whose length is ARGC) for option characters
given in OPTSTRING.
If an element of ARGV starts with '-', and is not exactly "-" or "--",
then it is an option element. The characters of this element
(aside from the initial '-') are option characters. If `getopt'
is called repeatedly, it returns successively each of the option characters
from each of the option elements.
If `getopt' finds another option character, it returns that character,
updating `optind' and `nextchar' so that the next call to `getopt' can
resume the scan with the following option character or ARGV-element.
If there are no more option characters, `getopt' returns `EOF'.
Then `optind' is the index in ARGV of the first ARGV-element
that is not an option. (The ARGV-elements have been permuted
so that those that are not options now come last.)
OPTSTRING is a string containing the legitimate option characters.
If an option character is seen that is not listed in OPTSTRING,
return '?' after printing an error message. If you set `opterr' to
zero, the error message is suppressed but we still return '?'.
If a char in OPTSTRING is followed by a colon, that means it wants an arg,
so the following text in the same ARGV-element, or the text of the following
ARGV-element, is returned in `optarg'. Two colons mean an option that
wants an optional arg; if there is text in the current ARGV-element,
it is returned in `optarg', otherwise `optarg' is set to zero.
If OPTSTRING starts with `-' or `+', it requests different methods of
handling the non-option ARGV-elements.
See the comments about RETURN_IN_ORDER and REQUIRE_ORDER, above.
Long-named options begin with `--' instead of `-'.
Their names may be abbreviated as long as the abbreviation is unique
or is an exact match for some defined option. If they have an
argument, it follows the option name in the same ARGV-element, separated
from the option name by a `=', or else the in next ARGV-element.
When `getopt' finds a long-named option, it returns 0 if that option's
`flag' field is nonzero, the value of the option's `val' field
if the `flag' field is zero.
The elements of ARGV aren't really const, because we permute them.
But we pretend they're const in the prototype to be compatible
with other systems.
LONGOPTS is a vector of `struct option' terminated by an
element containing a name which is zero.
LONGIND returns the index in LONGOPT of the long-named option found.
It is only valid when a long-named option has been found by the most
recent call.
If LONG_ONLY is nonzero, '-' as well as '--' can introduce
long-named options. */
int
_getopt_internal (argc, argv, optstring, longopts, longind, long_only)
int argc;
char *const *argv;
const char *optstring;
const struct option *longopts;
int *longind;
int long_only;
{
optarg = NULL;
if (optind == 0)
optstring = _getopt_initialize (optstring);
if (argc == 0)
return EOF;
if (nextchar == NULL || *nextchar == '\0')
{
/* Advance to the next ARGV-element. */
if (ordering == PERMUTE)
{
/* If we have just processed some options following some non-options,
exchange them so that the options come first. */
if (first_nonopt != last_nonopt && last_nonopt != optind)
exchange ((char **) argv);
else if (last_nonopt != optind)
first_nonopt = optind;
/* Skip any additional non-options
and extend the range of non-options previously skipped. */
while (optind < argc
&& (argv[optind][0] != '-' || argv[optind][1] == '\0'))
optind++;
last_nonopt = optind;
}
/* The special ARGV-element `--' means premature end of options.
Skip it like a null option,
then exchange with previous non-options as if it were an option,
then skip everything else like a non-option. */
if (optind != argc && !strcmp (argv[optind], "--"))
{
optind++;
if (first_nonopt != last_nonopt && last_nonopt != optind)
exchange ((char **) argv);
else if (first_nonopt == last_nonopt)
first_nonopt = optind;
last_nonopt = argc;
optind = argc;
}
/* If we have done all the ARGV-elements, stop the scan
and back over any non-options that we skipped and permuted. */
if (optind == argc)
{
/* Set the next-arg-index to point at the non-options
that we previously skipped, so the caller will digest them. */
if (first_nonopt != last_nonopt)
optind = first_nonopt;
return EOF;
}
/* If we have come to a non-option and did not permute it,
either stop the scan or describe it to the caller and pass it by. */
if ((argv[optind][0] != '-' || argv[optind][1] == '\0'))
{
if (ordering == REQUIRE_ORDER)
return EOF;
optarg = argv[optind++];
return 1;
}
/* We have found another option-ARGV-element.
Skip the initial punctuation. */
nextchar = (argv[optind] + 1
+ (longopts != NULL && argv[optind][1] == '-'));
}
/* Decode the current option-ARGV-element. */
/* Check whether the ARGV-element is a long option.
If long_only and the ARGV-element has the form "-f", where f is
a valid short option, don't consider it an abbreviated form of
a long option that starts with f. Otherwise there would be no
way to give the -f short option.
On the other hand, if there's a long option "fubar" and
the ARGV-element is "-fu", do consider that an abbreviation of
the long option, just like "--fu", and not "-f" with arg "u".
This distinction seems to be the most useful approach. */
if (longopts != NULL
&& (argv[optind][1] == '-'
|| (long_only && (argv[optind][2] || !my_index (optstring, argv[optind][1])))))
{
char *nameend;
const struct option *p;
const struct option *pfound = NULL;
int exact = 0;
int ambig = 0;
int indfound;
int option_index;
for (nameend = nextchar; *nameend && *nameend != '='; nameend++)
/* Do nothing. */ ;
/* Test all long options for either exact match
or abbreviated matches. */
for (p = longopts, option_index = 0; p->name; p++, option_index++)
if (!strncmp (p->name, nextchar, nameend - nextchar))
{
assert (nameend > nextchar);
if (nameend == strlen (p->name) + nextchar)
{
/* Exact match found. */
pfound = p;
indfound = option_index;
exact = 1;
break;
}
else if (pfound == NULL)
{
/* First nonexact match found. */
pfound = p;
indfound = option_index;
}
else
/* Second or later nonexact match found. */
ambig = 1;
}
if (ambig && !exact)
{
if (opterr)
fprintf (stderr, "%s: option `%s' is ambiguous\n",
argv[0], argv[optind]);
nextchar += strlen (nextchar);
optind++;
return '?';
}
if (pfound != NULL)
{
option_index = indfound;
optind++;
if (*nameend)
{
/* Don't test has_arg with >, because some C compilers don't
allow it to be used on enums. */
if (pfound->has_arg)
optarg = nameend + 1;
else
{
if (opterr)
{
if (argv[optind - 1][1] == '-')
/* --option */
fprintf (stderr,
"%s: option `--%s' doesn't allow an argument\n",
argv[0], pfound->name);
else
/* +option or -option */
fprintf (stderr,
"%s: option `%c%s' doesn't allow an argument\n",
argv[0], argv[optind - 1][0], pfound->name);
}
nextchar += strlen (nextchar);
return '?';
}
}
else if (pfound->has_arg == 1)
{
if (optind < argc)
optarg = argv[optind++];
else
{
if (opterr)
fprintf (stderr, "%s: option `%s' requires an argument\n",
argv[0], argv[optind - 1]);
nextchar += strlen (nextchar);
return optstring[0] == ':' ? ':' : '?';
}
}
nextchar += strlen (nextchar);
if (longind != NULL)
*longind = option_index;
if (pfound->flag)
{
*(pfound->flag) = pfound->val;
return 0;
}
return pfound->val;
}
/* Can't find it as a long option. If this is not getopt_long_only,
or the option starts with '--' or is not a valid short
option, then it's an error.
Otherwise interpret it as a short option. */
if (!long_only || argv[optind][1] == '-'
|| my_index (optstring, *nextchar) == NULL)
{
if (opterr)
{
if (argv[optind][1] == '-')
/* --option */
fprintf (stderr, "%s: unrecognized option `--%s'\n",
argv[0], nextchar);
else
/* +option or -option */
fprintf (stderr, "%s: unrecognized option `%c%s'\n",
argv[0], argv[optind][0], nextchar);
}
nextchar = (char *) "";
optind++;
return '?';
}
}
/* Look at and handle the next short option-character. */
{
char c = *nextchar++;
char *temp = my_index (optstring, c);
/* Increment `optind' when we start to process its last character. */
if (*nextchar == '\0')
++optind;
if (temp == NULL || c == ':')
{
if (opterr)
{
/* 1003.2 specifies the format of this message. */
fprintf (stderr, "%s: illegal option -- %c\n", argv[0], c);
}
optopt = c;
return '?';
}
if (temp[1] == ':')
{
if (temp[2] == ':')
{
/* This is an option that accepts an argument optionally. */
if (*nextchar != '\0')
{
optarg = nextchar;
optind++;
}
else
optarg = NULL;
nextchar = NULL;
}
else
{
/* This is an option that requires an argument. */
if (*nextchar != '\0')
{
optarg = nextchar;
/* If we end this ARGV-element by taking the rest as an arg,
we must advance to the next element now. */
optind++;
}
else if (optind == argc)
{
if (opterr)
{
/* 1003.2 specifies the format of this message. */
fprintf (stderr, "%s: option requires an argument -- %c\n",
argv[0], c);
}
optopt = c;
if (optstring[0] == ':')
c = ':';
else
c = '?';
}
else
/* We already incremented `optind' once;
increment it again when taking next ARGV-elt as argument. */
optarg = argv[optind++];
nextchar = NULL;
}
}
return c;
}
}
int
getopt (argc, argv, optstring)
int argc;
char *const *argv;
const char *optstring;
{
return _getopt_internal (argc, argv, optstring,
(const struct option *) 0,
(int *) 0,
0);
}
#endif /* _LIBC or not __GNU_LIBRARY__. */
#ifdef TEST
/* Compile with -DTEST to make an executable for use in testing
the above definition of `getopt'. */
int
main (argc, argv)
int argc;
char **argv;
{
int c;
int digit_optind = 0;
while (1)
{
int this_option_optind = optind ? optind : 1;
c = getopt (argc, argv, "abc:d:0123456789");
if (c == EOF)
break;
switch (c)
{
case '0':
case '1':
case '2':
case '3':
case '4':
case '5':
case '6':
case '7':
case '8':
case '9':
if (digit_optind != 0 && digit_optind != this_option_optind)
printf ("digits occur in two different argv-elements.\n");
digit_optind = this_option_optind;
printf ("option %c\n", c);
break;
case 'a':
printf ("option a\n");
break;
case 'b':
printf ("option b\n");
break;
case 'c':
printf ("option c with value `%s'\n", optarg);
break;
case '?':
break;
default:
printf ("?? getopt returned character code 0%o ??\n", c);
}
}
if (optind < argc)
{
printf ("non-option ARGV-elements: ");
while (optind < argc)
printf ("%s ", argv[optind++]);
printf ("\n");
}
exit (0);
}
#endif /* TEST */

View file

@ -1,190 +0,0 @@
/* getopt_long and getopt_long_only entry points for GNU getopt.
Copyright (C) 1987, 88, 89, 90, 91, 92, 1993
Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public License
as published by the Free Software Foundation; either version 2, 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 Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this program; if not, write to the Free Software
Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#ifdef HAVE_CONFIG_H
#if defined (emacs) || defined (CONFIG_BROKETS)
/* We use <config.h> instead of "config.h" so that a compilation
using -I. -I$srcdir will use ./config.h rather than $srcdir/config.h
(which it would do because it found this file in $srcdir). */
#include <config.h>
#else
#include "config.h"
#endif
#endif
#include "getopt.h"
#ifndef __STDC__
/* This is a separate conditional since some stdc systems
reject `defined (const)'. */
#ifndef const
#define const
#endif
#endif
#include <stdio.h>
/* Comment out all this code if we are using the GNU C Library, and are not
actually compiling the library itself. This code is part of the GNU C
Library, but also included in many other GNU distributions. Compiling
and linking in this code is a waste when using the GNU C library
(especially if it is a shared library). Rather than having every GNU
program understand `configure --with-gnu-libc' and omit the object files,
it is simpler to just do this in the source for each such file. */
/* Many versions of the Linux C library include older, broken versions
of these routines, which will break the linker's command-line
parsing. */
#if defined (_LIBC) || !defined (__GNU_LIBRARY__) || defined (__linux__)
/* This needs to come after some library #include
to get __GNU_LIBRARY__ defined. */
#ifdef __GNU_LIBRARY__
#include <stdlib.h>
#else
char *getenv ();
#endif
#ifndef NULL
#define NULL 0
#endif
int
getopt_long (argc, argv, options, long_options, opt_index)
int argc;
char *const *argv;
const char *options;
const struct option *long_options;
int *opt_index;
{
return _getopt_internal (argc, argv, options, long_options, opt_index, 0);
}
/* Like getopt_long, but '-' as well as '--' can indicate a long option.
If an option that starts with '-' (not '--') doesn't match a long option,
but does match a short option, it is parsed as a short option
instead. */
int
getopt_long_only (argc, argv, options, long_options, opt_index)
int argc;
char *const *argv;
const char *options;
const struct option *long_options;
int *opt_index;
{
return _getopt_internal (argc, argv, options, long_options, opt_index, 1);
}
#endif /* _LIBC or not __GNU_LIBRARY__. */
#ifdef TEST
#include <stdio.h>
int
main (argc, argv)
int argc;
char **argv;
{
int c;
int digit_optind = 0;
while (1)
{
int this_option_optind = optind ? optind : 1;
int option_index = 0;
static struct option long_options[] =
{
{"add", 1, 0, 0},
{"append", 0, 0, 0},
{"delete", 1, 0, 0},
{"verbose", 0, 0, 0},
{"create", 0, 0, 0},
{"file", 1, 0, 0},
{0, 0, 0, 0}
};
c = getopt_long (argc, argv, "abc:d:0123456789",
long_options, &option_index);
if (c == EOF)
break;
switch (c)
{
case 0:
printf ("option %s", long_options[option_index].name);
if (optarg)
printf (" with arg %s", optarg);
printf ("\n");
break;
case '0':
case '1':
case '2':
case '3':
case '4':
case '5':
case '6':
case '7':
case '8':
case '9':
if (digit_optind != 0 && digit_optind != this_option_optind)
printf ("digits occur in two different argv-elements.\n");
digit_optind = this_option_optind;
printf ("option %c\n", c);
break;
case 'a':
printf ("option a\n");
break;
case 'b':
printf ("option b\n");
break;
case 'c':
printf ("option c with value `%s'\n", optarg);
break;
case 'd':
printf ("option d with value `%s'\n", optarg);
break;
case '?':
break;
default:
printf ("?? getopt returned character code 0%o ??\n", c);
}
}
if (optind < argc)
{
printf ("non-option ARGV-elements: ");
while (optind < argc)
printf ("%s ", argv[optind++]);
printf ("\n");
}
exit (0);
}
#endif /* TEST */

View file

@ -19,8 +19,6 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
static char rcsid[] ="$Id: hash.c,v 1.4 1997/12/06 21:05:04 eric Exp $";
#include <stdlib.h>
#include "config.h"
#include "mkisofs.h"

View file

@ -6,9 +6,11 @@
Copyright 1993 Yggdrasil Computing, Incorporated
Copyright (C) 2009 Free Software Foundation, Inc.
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, or (at your option)
the Free Software Foundation; either version 3, or (at your option)
any later version.
This program is distributed in the hope that it will be useful,
@ -17,8 +19,8 @@
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. */
along with this program; if not, see <http://www.gnu.org/licenses/>.
*/
/*
* $Id: iso9660.h,v 1.2 1997/05/17 15:46:44 eric Exp $
@ -129,6 +131,20 @@ struct eltorito_defaultboot_entry {
char pad2 [ISODCL ( 13, 32)];
};
/* El Torito boot information table */
struct eltorito_boot_info
{
/* Address of Primary Volume Descriptor. */
char pvd_addr[ISODCL (1, 4)];
/* Boot file address. */
char file_addr[ISODCL (5, 8)];
/* Boot file length. */
char file_length[ISODCL (9, 12)];
/* Boot file checksum. */
char file_checksum[ISODCL (13, 16)];
char dummy[ISODCL (17, 56)];
};
/* We use this to help us look up the parent inode numbers. */

View file

@ -3,9 +3,11 @@
Copyright 1997 Eric Youngdale.
Copyright (C) 2009 Free Software Foundation, Inc.
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, or (at your option)
the Free Software Foundation; either version 3, or (at your option)
any later version.
This program is distributed in the hope that it will be useful,
@ -14,11 +16,8 @@
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. */
static char rcsid[] ="$Id: joliet.c,v 1.14 1999/03/07 17:41:19 eric Exp $";
along with this program; if not, see <http://www.gnu.org/licenses/>.
*/
/*
* Joliet extensions for ISO9660. These are spottily documented by
@ -74,6 +73,7 @@ static char rcsid[] ="$Id: joliet.c,v 1.14 1999/03/07 17:41:19 eric Exp $";
#include "mkisofs.h"
#include "iso9660.h"
#include <stdint.h>
#include <stdlib.h>
#include <time.h>
@ -107,12 +107,12 @@ static void FDECL3(convert_to_unicode, unsigned char *, buffer, int, size, char
*/
if( source == NULL )
{
tmpbuf = (u_char *) e_malloc(size);
tmpbuf = (uint8_t *) e_malloc(size);
memcpy( tmpbuf, buffer, size);
}
else
{
tmpbuf = (u_char *)source;
tmpbuf = (uint8_t *)source;
}
/*
@ -237,15 +237,15 @@ static void FDECL1(get_joliet_vol_desc, struct iso_primary_descriptor *, jvol_de
* just be really lazy and do a char -> short conversion. We probably
* will want to filter any characters >= 0x80.
*/
convert_to_unicode((u_char *)jvol_desc->system_id, sizeof(jvol_desc->system_id), NULL);
convert_to_unicode((u_char *)jvol_desc->volume_id, sizeof(jvol_desc->volume_id), NULL);
convert_to_unicode((u_char *)jvol_desc->volume_set_id, sizeof(jvol_desc->volume_set_id), NULL);
convert_to_unicode((u_char *)jvol_desc->publisher_id, sizeof(jvol_desc->publisher_id), NULL);
convert_to_unicode((u_char *)jvol_desc->preparer_id, sizeof(jvol_desc->preparer_id), NULL);
convert_to_unicode((u_char *)jvol_desc->application_id, sizeof(jvol_desc->application_id), NULL);
convert_to_unicode((u_char *)jvol_desc->copyright_file_id, sizeof(jvol_desc->copyright_file_id), NULL);
convert_to_unicode((u_char *)jvol_desc->abstract_file_id, sizeof(jvol_desc->abstract_file_id), NULL);
convert_to_unicode((u_char *)jvol_desc->bibliographic_file_id, sizeof(jvol_desc->bibliographic_file_id), NULL);
convert_to_unicode((uint8_t *)jvol_desc->system_id, sizeof(jvol_desc->system_id), NULL);
convert_to_unicode((uint8_t *)jvol_desc->volume_id, sizeof(jvol_desc->volume_id), NULL);
convert_to_unicode((uint8_t *)jvol_desc->volume_set_id, sizeof(jvol_desc->volume_set_id), NULL);
convert_to_unicode((uint8_t *)jvol_desc->publisher_id, sizeof(jvol_desc->publisher_id), NULL);
convert_to_unicode((uint8_t *)jvol_desc->preparer_id, sizeof(jvol_desc->preparer_id), NULL);
convert_to_unicode((uint8_t *)jvol_desc->application_id, sizeof(jvol_desc->application_id), NULL);
convert_to_unicode((uint8_t *)jvol_desc->copyright_file_id, sizeof(jvol_desc->copyright_file_id), NULL);
convert_to_unicode((uint8_t *)jvol_desc->abstract_file_id, sizeof(jvol_desc->abstract_file_id), NULL);
convert_to_unicode((uint8_t *)jvol_desc->bibliographic_file_id, sizeof(jvol_desc->bibliographic_file_id), NULL);
}
@ -356,9 +356,9 @@ static int generate_joliet_path_tables()
if( next_jpath_index > 0xffff )
{
fprintf(stderr, "Unable to generate sane path tables - too many directories (%d)\n",
next_jpath_index);
exit(1);
fprintf (stderr, _("Unable to generate sane path tables - too many directories (%d)\n"),
next_jpath_index);
exit (1);
}
/*
* Now start filling in the path tables. Start with root directory
@ -395,8 +395,8 @@ static int generate_joliet_path_tables()
dpnt = jpathlist[j];
if(!dpnt)
{
fprintf(stderr,"Entry %d not in path tables\n", j);
exit(1);
fprintf (stderr, _("Entry %d not in path tables\n"), j);
exit (1);
}
npnt = dpnt->de_name;
@ -409,8 +409,8 @@ static int generate_joliet_path_tables()
de = dpnt->self;
if(!de)
{
fprintf(stderr,"Fatal goof - directory has amnesia\n");
exit(1);
fprintf (stderr, _("Fatal goof - directory has amnesia\n"));
exit (1);
}
namelen = joliet_strlen(de->name);
@ -459,9 +459,9 @@ static int generate_joliet_path_tables()
}
else
{
convert_to_unicode((u_char *)jpath_table_l + jpath_table_index,
convert_to_unicode((uint8_t *)jpath_table_l + jpath_table_index,
namelen, de->name);
convert_to_unicode((u_char *)jpath_table_m + jpath_table_index,
convert_to_unicode((uint8_t *)jpath_table_m + jpath_table_index,
namelen, de->name);
jpath_table_index += namelen;
}
@ -475,7 +475,7 @@ static int generate_joliet_path_tables()
free(jpathlist);
if(jpath_table_index != jpath_table_size)
{
fprintf(stderr,"Joliet path table lengths do not match %d %d\n",
fprintf(stderr, _("Joliet path table lengths do not match %d %d\n"),
jpath_table_index,
jpath_table_size);
}
@ -527,8 +527,8 @@ static void FDECL2(generate_one_joliet_directory, struct directory *, dpnt, FILE
/*
* We got trouble.
*/
fprintf(stderr, "Unable to locate relocated directory\n");
exit(1);
fprintf (stderr, _("Unable to locate relocated directory\n"));
exit (1);
}
}
else
@ -602,7 +602,8 @@ static void FDECL2(generate_one_joliet_directory, struct directory *, dpnt, FILE
finddir = finddir->next;
if(!finddir)
{
fprintf(stderr,"Fatal goof - unable to find directory location\n"); exit(1);
fprintf (stderr, _("Fatal goof - unable to find directory location\n"));
exit (1);
}
}
set_733((char *) jrec.extent, finddir->jextent);
@ -634,7 +635,7 @@ static void FDECL2(generate_one_joliet_directory, struct directory *, dpnt, FILE
}
else
{
convert_to_unicode((u_char *)directory_buffer + dir_index,
convert_to_unicode((uint8_t *)directory_buffer + dir_index,
cvt_len,
s_entry1->name);
dir_index += cvt_len;
@ -650,8 +651,8 @@ static void FDECL2(generate_one_joliet_directory, struct directory *, dpnt, FILE
if(dpnt->jsize != dir_index)
{
fprintf(stderr,"Unexpected joliet directory length %d %d %s\n",dpnt->jsize,
dir_index, dpnt->de_name);
fprintf (stderr, _("Unexpected joliet directory length %d %d %s\n"),
dpnt->jsize, dir_index, dpnt->de_name);
}
xfwrite(directory_buffer, 1, total_size, outfile);

View file

@ -1,147 +1,76 @@
/*
* 27-Mar-96: Jan-Piet Mens <jpm@mens.de>
* added 'match' option (-m) to specify regular expressions NOT to be included
* in the CD image.
* Copyright (C) 2009 Free Software Foundation, Inc.
*
* 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 3 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, see <http://www.gnu.org/licenses/>.
*/
static char rcsid[] ="$Id: match.c,v 1.3 1999/03/02 03:41:25 eric Exp $";
#include "config.h"
#include <prototyp.h>
#include <stdio.h>
#ifndef VMS
#ifdef HAVE_MALLOC_H
#include <malloc.h>
#else
#include <stdlib.h>
#endif
#endif
#include <string.h>
#include "fnmatch.h"
#include "match.h"
#define MAXMATCH 1000
static char *mat[MAXMATCH];
void add_match(fn)
char * fn;
struct pattern
{
register int i;
char *str;
struct pattern *next;
};
for (i=0; mat[i] && i<MAXMATCH; i++);
if (i == MAXMATCH) {
fprintf(stderr,"Can't exclude RE '%s' - too many entries in table\n",fn);
return;
}
static struct pattern *patlist = NULL;
static struct pattern *i_patlist = NULL; /* ISO9660/RR */
static struct pattern *j_patlist = NULL; /* Joliet */
mat[i] = (char *) malloc(strlen(fn)+1);
if (! mat[i]) {
fprintf(stderr,"Can't allocate memory for excluded filename\n");
return;
}
strcpy(mat[i],fn);
#define DECL_ADD_MATCH(function, list) \
void \
function (char *pattern) \
{ \
struct pattern *new; \
new = malloc (sizeof (*new)); \
new->str = strdup (pattern); \
new->next = list; \
list = new; \
}
int matches(fn)
char * fn;
{
/* very dumb search method ... */
register int i;
DECL_ADD_MATCH (add_match, patlist)
DECL_ADD_MATCH (i_add_match, i_patlist)
DECL_ADD_MATCH (j_add_match, j_patlist)
for (i=0; mat[i] && i<MAXMATCH; i++) {
if (fnmatch(mat[i], fn, FNM_FILE_NAME) != FNM_NOMATCH) {
return 1; /* found -> excluded filenmae */
}
}
return 0; /* not found -> not excluded */
#define DECL_MATCHES(function, list) \
int \
function (char *str) \
{ \
struct pattern *i; \
for (i = list; i != NULL; i = i->next) \
if (fnmatch (i->str, str, FNM_FILE_NAME) != FNM_NOMATCH) \
return 1; \
return 0; \
}
/* ISO9660/RR hide */
DECL_MATCHES (matches, patlist)
DECL_MATCHES (i_matches, i_patlist)
DECL_MATCHES (j_matches, j_patlist)
static char *i_mat[MAXMATCH];
void i_add_match(fn)
char * fn;
int
i_ishidden()
{
register int i;
for (i=0; i_mat[i] && i<MAXMATCH; i++);
if (i == MAXMATCH) {
fprintf(stderr,"Can't exclude RE '%s' - too many entries in table\n",fn);
return;
}
i_mat[i] = (char *) malloc(strlen(fn)+1);
if (! i_mat[i]) {
fprintf(stderr,"Can't allocate memory for excluded filename\n");
return;
}
strcpy(i_mat[i],fn);
return (i_patlist != NULL);
}
int i_matches(fn)
char * fn;
{
/* very dumb search method ... */
register int i;
for (i=0; i_mat[i] && i<MAXMATCH; i++) {
if (fnmatch(i_mat[i], fn, FNM_FILE_NAME) != FNM_NOMATCH) {
return 1; /* found -> excluded filenmae */
}
}
return 0; /* not found -> not excluded */
}
int i_ishidden()
{
return (i_mat[0] != NULL);
}
/* Joliet hide */
static char *j_mat[MAXMATCH];
void j_add_match(fn)
char * fn;
{
register int i;
for (i=0; j_mat[i] && i<MAXMATCH; i++);
if (i == MAXMATCH) {
fprintf(stderr,"Can't exclude RE '%s' - too many entries in table\n",fn);
return;
}
j_mat[i] = (char *) malloc(strlen(fn)+1);
if (! j_mat[i]) {
fprintf(stderr,"Can't allocate memory for excluded filename\n");
return;
}
strcpy(j_mat[i],fn);
}
int j_matches(fn)
char * fn;
{
/* very dumb search method ... */
register int i;
for (i=0; j_mat[i] && i<MAXMATCH; i++) {
if (fnmatch(j_mat[i], fn, FNM_FILE_NAME) != FNM_NOMATCH) {
return 1; /* found -> excluded filenmae */
}
}
return 0; /* not found -> not excluded */
}
int j_ishidden()
{
return (j_mat[0] != NULL);
return (j_patlist != NULL);
}

View file

@ -1,22 +1,29 @@
/*
* 27th March 1996. Added by Jan-Piet Mens for matching regular expressions
* in paths.
*
* Copyright (C) 2009 Free Software Foundation, Inc.
*
* 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 3 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, see <http://www.gnu.org/licenses/>.
*/
/*
* $Id: match.h,v 1.2 1999/03/02 03:41:25 eric Exp $
*/
#include "config.h"
#include "fnmatch.h"
extern void add_match (char *);
extern void i_add_match (char *);
extern void j_add_match (char *);
void add_match __PR((char *fn));
int matches __PR((char *fn));
extern int matches (char *);
extern int i_matches (char *);
extern int j_matches (char *);
void i_add_match __PR((char *fn));
int i_matches __PR((char *fn));
int i_ishidden __PR((void));
void j_add_match __PR((char *fn));
int j_matches __PR((char *fn));
int j_ishidden __PR((void));
extern int i_ishidden ();
extern int j_ishidden ();

View file

@ -20,9 +20,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, see <http://www.gnu.org/licenses/>.
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
static char rcsid[] ="$Id: mkisofs.c,v 1.32 1999/03/07 21:48:49 eric Exp $";
*/
#include <errno.h>
#include "config.h"
@ -66,11 +64,13 @@ struct directory * root = NULL;
static char version_string[] = "mkisofs 1.12b5";
#include "progname.h"
char * outfile;
FILE * discimage;
unsigned int next_extent = 0;
unsigned int last_extent = 0;
unsigned int session_start = 0;
uint64_t next_extent = 0;
uint64_t last_extent = 0;
uint64_t session_start = 0;
unsigned int path_table_size = 0;
unsigned int path_table[4] = {0,};
unsigned int path_blocks = 0;
@ -89,6 +89,8 @@ int extension_record_size = 0;
/* These variables are associated with command line options */
int use_eltorito = 0;
int use_eltorito_emul_floppy = 0;
int use_boot_info_table = 0;
int use_RockRidge = 0;
int use_Joliet = 0;
int verbose = 1;
@ -189,100 +191,116 @@ struct ld_option
#define OPTION_EXPIR_DATE 168
#define OPTION_EFFEC_DATE 169
#define OPTION_BOOT_INFO_TABLE 170
#define OPTION_NO_EMUL_BOOT 171
#define OPTION_ELTORITO_EMUL_FLOPPY 172
#define OPTION_VERSION 173
static const struct ld_option ld_options[] =
{
{ {"all-files", no_argument, NULL, 'a'},
'a', NULL, "Process all files (don't skip backup files)", ONE_DASH },
'a', NULL, N_("Process all files (don't skip backup files)"), ONE_DASH },
{ {"abstract", required_argument, NULL, OPTION_ABSTRACT},
'\0', "FILE", "Set Abstract filename" , ONE_DASH },
'\0', "FILE", N_("Set Abstract filename"), ONE_DASH },
{ {"appid", required_argument, NULL, 'A'},
'A', "ID", "Set Application ID" , ONE_DASH },
'A', "ID", N_("Set Application ID"), ONE_DASH },
{ {"biblio", required_argument, NULL, OPTION_BIBLIO},
'\0', "FILE", "Set Bibliographic filename" , ONE_DASH },
'\0', "FILE", N_("Set Bibliographic filename"), ONE_DASH },
{ {"copyright", required_argument, NULL, OPTION_COPYRIGHT},
'\0', "FILE", "Set Copyright filename" , ONE_DASH },
'\0', "FILE", N_("Set Copyright filename"), ONE_DASH },
{ {"eltorito-boot", required_argument, NULL, 'b'},
'b', "FILE", "Set El Torito boot image name" , ONE_DASH },
'b', "FILE", N_("Set El Torito boot image name"), ONE_DASH },
{ {"eltorito-catalog", required_argument, NULL, 'c'},
'c', "FILE", "Set El Torito boot catalog name" , ONE_DASH },
'c', "FILE", N_("Set El Torito boot catalog name"), ONE_DASH },
{ {"boot-info-table", no_argument, NULL, OPTION_BOOT_INFO_TABLE },
'\0', NULL, N_("Patch Boot Info Table in El Torito boot image"), ONE_DASH },
{ {"no-emul-boot", no_argument, NULL, OPTION_NO_EMUL_BOOT },
'\0', NULL, N_("Dummy option for backward compatibility"), ONE_DASH },
{ {"eltorito-emul-floppy", no_argument, NULL, OPTION_ELTORITO_EMUL_FLOPPY },
'\0', NULL, N_("Enable floppy drive emulation for El Torito"), TWO_DASHES },
{ {"cdwrite-params", required_argument, NULL, 'C'},
'C', "PARAMS", "Magic paramters from cdrecord" , ONE_DASH },
'C', "PARAMS", N_("Magic parameters from cdrecord"), ONE_DASH },
{ {"omit-period", no_argument, NULL, 'd'},
'd', NULL, "Omit trailing periods from filenames", ONE_DASH },
'd', NULL, N_("Omit trailing periods from filenames"), ONE_DASH },
{ {"disable-deep-relocation", no_argument, NULL, 'D'},
'D', NULL, "Disable deep directory relocation", ONE_DASH },
'D', NULL, N_("Disable deep directory relocation"), ONE_DASH },
{ {"follow-links", no_argument, NULL, 'f'},
'f', NULL, "Follow symbolic links", ONE_DASH },
'f', NULL, N_("Follow symbolic links"), ONE_DASH },
{ {"help", no_argument, NULL, OPTION_HELP},
'\0', NULL, "Print option help", ONE_DASH },
'\0', NULL, N_("Print option help"), ONE_DASH },
{ {"help", no_argument, NULL, OPTION_HELP},
'\0', NULL, N_("Print option help"), TWO_DASHES },
{ {"version", no_argument, NULL, OPTION_VERSION},
'\0', NULL, N_("Print version information and exit"), TWO_DASHES },
{ {"hide", required_argument, NULL, OPTION_I_HIDE},
'\0', "GLOBFILE", "Hide ISO9660/RR file" , ONE_DASH },
'\0', "GLOBFILE", N_("Hide ISO9660/RR file"), ONE_DASH },
{ {"hide-joliet", required_argument, NULL, OPTION_J_HIDE},
'\0', "GLOBFILE", "Hide Joliet file" , ONE_DASH },
'\0', "GLOBFILE", N_("Hide Joliet file"), ONE_DASH },
{ {NULL, required_argument, NULL, 'i'},
'i', "ADD_FILES", "No longer supported" , TWO_DASHES },
'i', "ADD_FILES", N_("No longer supported"), TWO_DASHES },
{ {"joliet", no_argument, NULL, 'J'},
'J', NULL, "Generate Joliet directory information", ONE_DASH },
'J', NULL, N_("Generate Joliet directory information"), ONE_DASH },
{ {"full-iso9660-filenames", no_argument, NULL, 'l'},
'l', NULL, "Allow full 32 character filenames for iso9660 names", ONE_DASH },
'l', NULL, N_("Allow full 32 character filenames for iso9660 names"), ONE_DASH },
{ {"allow-leading-dots", no_argument, NULL, 'L'},
'L', NULL, "Allow iso9660 filenames to start with '.'", ONE_DASH },
'L', NULL, N_("Allow iso9660 filenames to start with '.'"), ONE_DASH },
{ {"log-file", required_argument, NULL, OPTION_LOG_FILE},
'\0', "LOG_FILE", "Re-direct messages to LOG_FILE", ONE_DASH },
'\0', "LOG_FILE", N_("Re-direct messages to LOG_FILE"), ONE_DASH },
{ {"exclude", required_argument, NULL, 'm'},
'm', "GLOBFILE", "Exclude file name" , ONE_DASH },
'm', "GLOBFILE", N_("Exclude file name"), ONE_DASH },
{ {"prev-session", required_argument, NULL, 'M'},
'M', "FILE", "Set path to previous session to merge" , ONE_DASH },
'M', "FILE", N_("Set path to previous session to merge"), ONE_DASH },
{ {"omit-version-number", no_argument, NULL, 'N'},
'N', NULL, "Omit version number from iso9660 filename", ONE_DASH },
'N', NULL, N_("Omit version number from iso9660 filename"), ONE_DASH },
{ {"no-split-symlink-components", no_argument, NULL, 0},
0, NULL, "Inhibit splitting symlink components" , ONE_DASH },
0, NULL, N_("Inhibit splitting symlink components"), ONE_DASH },
{ {"no-split-symlink-fields", no_argument, NULL, 0},
0, NULL, "Inhibit splitting symlink fields" , ONE_DASH },
0, NULL, N_("Inhibit splitting symlink fields"), ONE_DASH },
{ {"output", required_argument, NULL, 'o'},
'o', "FILE", "Set output file name" , ONE_DASH },
'o', "FILE", N_("Set output file name"), ONE_DASH },
{ {"preparer", required_argument, NULL, 'p'},
'p', "PREP", "Set Volume preparer" , ONE_DASH },
'p', "PREP", N_("Set Volume preparer"), ONE_DASH },
{ {"print-size", no_argument, NULL, OPTION_PRINT_SIZE},
'\0', NULL, "Print estimated filesystem size and exit", ONE_DASH },
'\0', NULL, N_("Print estimated filesystem size and exit"), ONE_DASH },
{ {"publisher", required_argument, NULL, 'P'},
'P', "PUB", "Set Volume publisher" , ONE_DASH },
'P', "PUB", N_("Set Volume publisher"), ONE_DASH },
{ {"quiet", no_argument, NULL, OPTION_QUIET},
'\0', NULL, "Run quietly", ONE_DASH },
'\0', NULL, N_("Run quietly"), ONE_DASH },
{ {"rational-rock", no_argument, NULL, 'r'},
'r', NULL, "Generate rationalized Rock Ridge directory information", ONE_DASH },
'r', NULL, N_("Generate rationalized Rock Ridge directory information"), ONE_DASH },
{ {"rock", no_argument, NULL, 'R'},
'R', NULL, "Generate Rock Ridge directory information", ONE_DASH },
'R', NULL, N_("Generate Rock Ridge directory information"), ONE_DASH },
{ {"split-output", no_argument, NULL, OPTION_SPLIT_OUTPUT},
'\0', NULL, "Split output into files of approx. 1GB size", ONE_DASH },
'\0', NULL, N_("Split output into files of approx. 1GB size"), ONE_DASH },
{ {"sysid", required_argument, NULL, OPTION_SYSID},
'\0', "ID", "Set System ID" , ONE_DASH },
'\0', "ID", N_("Set System ID"), ONE_DASH },
{ {"translation-table", no_argument, NULL, 'T'},
'T', NULL, "Generate translation tables for systems that don't understand long filenames", ONE_DASH },
'T', NULL, N_("Generate translation tables for systems that don't understand long filenames"), ONE_DASH },
{ {"verbose", no_argument, NULL, 'v'},
'v', NULL, "Verbose", ONE_DASH },
'v', NULL, N_("Verbose"), ONE_DASH },
{ {"volid", required_argument, NULL, 'V'},
'V', "ID", "Set Volume ID" , ONE_DASH },
'V', "ID", N_("Set Volume ID"), ONE_DASH },
{ {"volset", required_argument, NULL, OPTION_VOLSET},
'\0', "ID", "Set Volume set ID" , ONE_DASH },
'\0', "ID", N_("Set Volume set ID"), ONE_DASH },
{ {"volset-size", required_argument, NULL, OPTION_VOLSET_SIZE},
'\0', "#", "Set Volume set size" , ONE_DASH },
'\0', "#", N_("Set Volume set size"), ONE_DASH },
{ {"volset-seqno", required_argument, NULL, OPTION_VOLSET_SEQ_NUM},
'\0', "#", "Set Volume set sequence number" , ONE_DASH },
'\0', "#", N_("Set Volume set sequence number"), ONE_DASH },
{ {"old-exclude", required_argument, NULL, 'x'},
'x', "FILE", "Exclude file name(depreciated)" , ONE_DASH },
'x', "FILE", N_("Exclude file name (deprecated)"), ONE_DASH },
#ifdef ERIC_neverdef
{ {"transparent-compression", no_argument, NULL, 'z'},
'z', NULL, "Enable transparent compression of files", ONE_DASH },
#endif
{ {"creation-date", required_argument, NULL, OPTION_CREAT_DATE },
'\0', NULL, "Override creation date", TWO_DASHES },
'\0', NULL, N_("Override creation date"), TWO_DASHES },
{ {"modification-date", required_argument, NULL, OPTION_MODIF_DATE },
'\0', NULL, "Override modification date", TWO_DASHES },
'\0', NULL, N_("Override modification date"), TWO_DASHES },
{ {"expiration-date", required_argument, NULL, OPTION_EXPIR_DATE },
'\0', NULL, "Override expiration date", TWO_DASHES },
'\0', NULL, N_("Override expiration date"), TWO_DASHES },
{ {"effective-date", required_argument, NULL, OPTION_EFFEC_DATE },
'\0', NULL, "Override effective date", TWO_DASHES },
'\0', NULL, N_("Override effective date"), TWO_DASHES },
};
#define OPTION_COUNT (sizeof ld_options / sizeof ld_options[0])
@ -352,7 +370,7 @@ void FDECL1(read_rcfile, char *, appname)
return;
if ( verbose > 0 )
{
fprintf(stderr, "Using \"%s\"\n", filename);
fprintf (stderr, _("Using \"%s\"\n"), filename);
}
/* OK, we got it. Now read in the lines and parse them */
@ -380,7 +398,7 @@ void FDECL1(read_rcfile, char *, appname)
}
if (name == pnt)
{
fprintf(stderr, "%s:%d: name required\n", filename, linum);
fprintf(stderr, _("%s:%d: name required\n"), filename, linum);
continue;
}
name_end = pnt;
@ -390,7 +408,7 @@ void FDECL1(read_rcfile, char *, appname)
/* silently ignore errors in the rc file. */
if (*pnt != '=')
{
fprintf(stderr, "%s:%d: equals sign required\n", filename, linum);
fprintf (stderr, _("%s:%d: equals sign required\n"), filename, linum);
continue;
}
/* Skip pas the = sign, and any white space following it */
@ -424,8 +442,8 @@ void FDECL1(read_rcfile, char *, appname)
}
if (rco->tag == NULL)
{
fprintf(stderr, "%s:%d: field name \"%s\" unknown\n", filename, linum,
name);
fprintf (stderr, _("%s:%d: field name \"%s\" unknown\n"), filename, linum,
name);
}
}
if (ferror(rcfile))
@ -450,23 +468,12 @@ int goof = 0;
#endif
void usage(){
const char * program_name = "mkisofs";
#if 0
fprintf(stderr,"Usage:\n");
fprintf(stderr,
"mkisofs [-o outfile] [-R] [-V volid] [-v] [-a] \
[-T]\n [-l] [-d] [-V] [-D] [-L] [-p preparer]"
"[-P publisher] [ -A app_id ] [-z] \n \
[-b boot_image_name] [-c boot_catalog-name] \
[-x path -x path ...] path\n");
#endif
unsigned int i;
/* const char **targets, **pp;*/
fprintf (stderr, "Usage: %s [options] file...\n", program_name);
printf (_("Usage: %s [options] file...\n"), program_name);
fprintf (stderr, "Options:\n");
printf (_("Options:\n"));
for (i = 0; i < OPTION_COUNT; i++)
{
if (ld_options[i].doc != NULL)
@ -475,7 +482,7 @@ void usage(){
int len;
unsigned int j;
fprintf (stderr, " ");
printf (" ");
comma = FALSE;
len = 2;
@ -486,16 +493,16 @@ void usage(){
if (ld_options[j].shortopt != '\0'
&& ld_options[j].control != NO_HELP)
{
fprintf (stderr, "%s-%c", comma ? ", " : "", ld_options[j].shortopt);
printf ("%s-%c", comma ? ", " : "", ld_options[j].shortopt);
len += (comma ? 2 : 0) + 2;
if (ld_options[j].arg != NULL)
{
if (ld_options[j].opt.has_arg != optional_argument)
{
fprintf (stderr, " ");
putchar (' ');
++len;
}
fprintf (stderr, "%s", ld_options[j].arg);
printf ("%s", ld_options[j].arg);
len += strlen (ld_options[j].arg);
}
comma = TRUE;
@ -510,7 +517,7 @@ void usage(){
if (ld_options[j].opt.name != NULL
&& ld_options[j].control != NO_HELP)
{
fprintf (stderr, "%s-%s%s",
printf ("%s-%s%s",
comma ? ", " : "",
ld_options[j].control == TWO_DASHES ? "-" : "",
ld_options[j].opt.name);
@ -520,7 +527,7 @@ void usage(){
+ strlen (ld_options[j].opt.name));
if (ld_options[j].arg != NULL)
{
fprintf (stderr, " %s", ld_options[j].arg);
printf (" %s", ld_options[j].arg);
len += 1 + strlen (ld_options[j].arg);
}
comma = TRUE;
@ -531,14 +538,14 @@ void usage(){
if (len >= 30)
{
fprintf (stderr, "\n");
printf ("\n");
len = 0;
}
for (; len < 30; len++)
fputc (' ', stderr);
putchar (' ');
fprintf (stderr, "%s\n", ld_options[i].doc);
printf ("%s\n", gettext (ld_options[i].doc));
}
}
exit(1);
@ -625,6 +632,11 @@ int FDECL2(main, int, argc, char **, argv){
int c;
char *log_file = 0;
set_program_name (argv[0]);
setlocale (LC_ALL, "");
bindtextdomain (PACKAGE, LOCALEDIR);
textdomain (PACKAGE);
if (argc < 2)
usage();
@ -691,7 +703,7 @@ int FDECL2(main, int, argc, char **, argv){
cdwrite_data = optarg;
break;
case 'i':
fprintf(stderr, "-i option no longer supported.\n");
fprintf (stderr, _("-i option no longer supported.\n"));
exit(1);
break;
case 'J':
@ -703,46 +715,61 @@ int FDECL2(main, int, argc, char **, argv){
case 'b':
use_eltorito++;
boot_image = optarg; /* pathname of the boot image on cd */
if (boot_image == NULL) {
fprintf(stderr,"Required boot image pathname missing\n");
exit(1);
}
if (boot_image == NULL)
{
fprintf (stderr, _("Required boot image pathname missing\n"));
exit (1);
}
break;
case 'c':
use_eltorito++;
boot_catalog = optarg; /* pathname of the boot image on cd */
if (boot_catalog == NULL) {
fprintf(stderr,"Required boot catalog pathname missing\n");
exit(1);
}
if (boot_catalog == NULL)
{
fprintf (stderr, _("Required boot catalog pathname missing\n"));
exit (1);
}
break;
case OPTION_BOOT_INFO_TABLE:
use_boot_info_table = 1;
break;
case OPTION_NO_EMUL_BOOT:
fprintf (stderr, _("Ignoring -no-emul-boot (no-emulation is the default behaviour)\n"));
break;
case OPTION_ELTORITO_EMUL_FLOPPY:
use_eltorito_emul_floppy = 1;
break;
case OPTION_ABSTRACT:
abstract = optarg;
if(strlen(abstract) > 37) {
fprintf(stderr,"Abstract filename string too long\n");
exit(1);
};
if(strlen(abstract) > 37)
{
fprintf (stderr, _("Abstract filename string too long\n"));
exit (1);
};
break;
case 'A':
appid = optarg;
if(strlen(appid) > 128) {
fprintf(stderr,"Application-id string too long\n");
exit(1);
};
if(strlen(appid) > 128)
{
fprintf (stderr, _("Application-id string too long\n"));
exit (1);
};
break;
case OPTION_BIBLIO:
biblio = optarg;
if(strlen(biblio) > 37) {
fprintf(stderr,"Bibliographic filename string too long\n");
exit(1);
};
if(strlen(biblio) > 37)
{
fprintf (stderr, _("Bibliographic filename string too long\n"));
exit (1);
};
break;
case OPTION_COPYRIGHT:
copyright = optarg;
if(strlen(copyright) > 37) {
fprintf(stderr,"Copyright filename string too long\n");
exit(1);
};
if(strlen(copyright) > 37)
{
fprintf (stderr, _("Copyright filename string too long\n"));
exit (1);
};
break;
case 'd':
omit_period++;
@ -773,20 +800,22 @@ int FDECL2(main, int, argc, char **, argv){
break;
case 'p':
preparer = optarg;
if(strlen(preparer) > 128) {
fprintf(stderr,"Preparer string too long\n");
exit(1);
};
if(strlen(preparer) > 128)
{
fprintf (stderr, _("Preparer string too long\n"));
exit (1);
};
break;
case OPTION_PRINT_SIZE:
print_size++;
break;
case 'P':
publisher = optarg;
if(strlen(publisher) > 128) {
fprintf(stderr,"Publisher string too long\n");
exit(1);
};
if(strlen(publisher) > 128)
{
fprintf (stderr, _("Publisher string too long\n"));
exit (1);
};
break;
case OPTION_QUIET:
verbose = 0;
@ -803,48 +832,47 @@ int FDECL2(main, int, argc, char **, argv){
break;
case OPTION_SYSID:
system_id = optarg;
if(strlen(system_id) > 32) {
fprintf(stderr,"System ID string too long\n");
exit(1);
};
if(strlen(system_id) > 32)
{
fprintf (stderr, _("System ID string too long\n"));
exit (1);
};
break;
case 'T':
generate_tables++;
break;
case 'V':
volume_id = optarg;
if(strlen(volume_id) > 32) {
fprintf(stderr,"Volume ID string too long\n");
exit(1);
};
if(strlen(volume_id) > 32)
{
fprintf (stderr, _("Volume ID string too long\n"));
exit (1);
};
break;
case OPTION_VOLSET:
volset_id = optarg;
if(strlen(volset_id) > 128) {
fprintf(stderr,"Volume set ID string too long\n");
exit(1);
};
if(strlen(volset_id) > 128)
{
fprintf (stderr, _("Volume set ID string too long\n"));
exit (1);
};
break;
case OPTION_VOLSET_SIZE:
volume_set_size = atoi(optarg);
break;
case OPTION_VOLSET_SEQ_NUM:
volume_sequence_number = atoi(optarg);
if (volume_sequence_number > volume_set_size) {
fprintf(stderr,"Volume set sequence number too big\n");
exit(1);
}
if (volume_sequence_number > volume_set_size)
{
fprintf (stderr, _("Volume set sequence number too big\n"));
exit (1);
}
break;
case 'v':
verbose++;
break;
case 'z':
#ifdef VMS
fprintf(stderr,"Transparent compression not supported with VMS\n");
exit(1);
#else
transparent_compression++;
#endif
break;
case 'x':
case 'm':
@ -865,6 +893,10 @@ int FDECL2(main, int, argc, char **, argv){
usage ();
exit (0);
break;
case OPTION_VERSION:
printf ("%s (%s %s)\n", program_name, PACKAGE_NAME, PACKAGE_VERSION);
exit (0);
break;
case OPTION_NOSPLIT_SL_COMPONENT:
split_SL_component = 0;
break;
@ -872,37 +904,41 @@ int FDECL2(main, int, argc, char **, argv){
split_SL_field = 0;
break;
case OPTION_CREAT_DATE:
if (strlen (optarg) != 16) {
fprintf (stderr, "date string must be 16 characters.\n");
exit (1);
}
if (strlen (optarg) != 16)
{
fprintf (stderr, _("date string must be 16 characters.\n"));
exit (1);
}
if (creation_date)
free(creation_date);
creation_date = strdup(optarg);
break;
case OPTION_MODIF_DATE:
if (strlen (optarg) != 16) {
fprintf (stderr, "date string must be 16 characters.\n");
exit (1);
}
if (strlen (optarg) != 16)
{
fprintf (stderr, _("date string must be 16 characters.\n"));
exit (1);
}
if (modification_date)
free(modification_date);
modification_date = strdup(optarg);
break;
case OPTION_EXPIR_DATE:
if (strlen (optarg) != 16) {
fprintf (stderr, "date string must be 16 characters.\n");
exit (1);
}
if (strlen (optarg) != 16)
{
fprintf (stderr, _("date string must be 16 characters.\n"));
exit (1);
}
if (expiration_date)
free(expiration_date);
expiration_date = strdup(optarg);
break;
case OPTION_EFFEC_DATE:
if (strlen (optarg) != 16) {
fprintf (stderr, "date string must be 16 characters.\n");
exit (1);
}
if (strlen (optarg) != 16)
{
fprintf (stderr, _("date string must be 16 characters.\n"));
exit (1);
}
if (effective_date)
free(effective_date);
effective_date = strdup(optarg);
@ -919,11 +955,11 @@ parse_input_files:
int resource;
struct rlimit rlp;
if (getrlimit(RLIMIT_DATA,&rlp) == -1)
perror("Warning: getrlimit");
perror (_("Warning: getrlimit"));
else {
rlp.rlim_cur=33554432;
if (setrlimit(RLIMIT_DATA,&rlp) == -1)
perror("Warning: setrlimit");
perror (_("Warning: setrlimit"));
}
}
#endif
@ -939,13 +975,13 @@ parse_input_files:
if(cdwrite_data == NULL && merge_image != NULL)
{
fprintf(stderr,"Multisession usage bug: Must specify -C if -M is used.\n");
exit(0);
fprintf (stderr, _("Multisession usage bug: Must specify -C if -M is used.\n"));
exit (0);
}
if(cdwrite_data != NULL && merge_image == NULL)
{
fprintf(stderr,"Warning: -C specified without -M: old session data will not be merged.\n");
fprintf (stderr, _("Warning: -C specified without -M: old session data will not be merged.\n"));
}
/* The first step is to scan the directory tree, and take some notes */
@ -983,21 +1019,17 @@ parse_input_files:
int i;
/* open log file - test that we can open OK */
if ((lfp = fopen(log_file, "w")) == NULL) {
fprintf(stderr,"can't open logfile: %s\n", log_file);
exit (1);
}
if ((lfp = fopen(log_file, "w")) == NULL)
error (1, errno, _("can't open logfile: %s"), log_file);
fclose(lfp);
/* redirect all stderr message to log_file */
fprintf(stderr, "re-directing all messages to %s\n", log_file);
fprintf (stderr, _("re-directing all messages to %s\n"), log_file);
fflush(stderr);
/* associate stderr with the log file */
if (freopen(log_file, "w", stderr) == NULL) {
fprintf(stderr,"can't open logfile: %s\n", log_file);
exit (1);
}
if (freopen(log_file, "w", stderr) == NULL)
error (1, errno, _("can't open logfile: %s\n"), log_file);
if(verbose > 1) {
for (i=0;i<argc;i++)
fprintf(stderr,"%s ", argv[i]);
@ -1038,9 +1070,8 @@ parse_input_files:
/*
* Complain and die.
*/
fprintf(stderr,"Unable to open previous session image %s\n",
merge_image);
exit(1);
error (1, 0, _("Unable to open previous session image %s\n"),
merge_image);
}
memcpy(&de.isorec.extent, mrootp->extent, 8);
@ -1150,8 +1181,7 @@ parse_input_files:
* This is a fatal error - the user won't be getting what
* they want if we were to proceed.
*/
fprintf(stderr, "Invalid node - %s\n", node);
exit(1);
error (1, 0, _("Invalid node - %s\n"), node);
}
else
{
@ -1213,10 +1243,7 @@ parse_input_files:
}
if (goof)
{
fprintf(stderr, "Joliet tree sort failed.\n");
exit(1);
}
error (1, 0, _("Joliet tree sort failed.\n"));
/*
* Fix a couple of things in the root directory so that everything
@ -1230,17 +1257,12 @@ parse_input_files:
*/
if (print_size){
discimage = fopen("/dev/null", "wb");
if (!discimage){
fprintf(stderr,"Unable to open /dev/null\n");
exit(1);
}
if (!discimage)
error (1, errno, _("Unable to open /dev/null\n"));
} else if (outfile){
discimage = fopen(outfile, "wb");
if (!discimage){
fprintf(stderr,"Unable to open disc image file\n");
exit(1);
};
if (!discimage)
error (1, errno, _("Unable to open disc image file\n"));
} else {
discimage = stdout;
@ -1362,10 +1384,10 @@ parse_input_files:
if( verbose > 0 )
{
#ifdef HAVE_SBRK
fprintf(stderr,"Max brk space used %x\n",
(unsigned int)(((unsigned long)sbrk(0)) - mem_start));
fprintf (stderr, _("Max brk space used %x\n"),
(unsigned int)(((unsigned long)sbrk(0)) - mem_start));
#endif
fprintf(stderr,"%d extents written (%d Mb)\n", last_extent, last_extent >> 9);
fprintf (stderr, _("%llu extents written (%llu MiB)\n"), last_extent, last_extent >> 9);
}
#ifdef VMS
@ -1378,10 +1400,8 @@ parse_input_files:
void *
FDECL1(e_malloc, size_t, size)
{
void* pt = 0;
if( (size > 0) && ((pt=malloc(size))==NULL) ) {
fprintf(stderr, "Not enough memory\n");
exit (1);
}
void* pt = 0;
if( (size > 0) && ((pt = malloc (size)) == NULL))
error (1, errno, "malloc");
return pt;
}

View file

@ -19,14 +19,21 @@
You should have received a copy of the GNU General Public License
along with this program; if not, see <http://www.gnu.org/licenses/>.
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
*/
/*
* $Id: mkisofs.h,v 1.20 1999/03/02 04:16:41 eric Exp $
*/
#include <stdio.h>
#include <stdint.h>
#include <prototyp.h>
#include <sys/stat.h>
#include <locale.h>
#include <libintl.h>
#define _(str) gettext(str)
#define N_(str) str
/* This symbol is used to indicate that we do not have things like
symlinks, devices, and so forth available. Just files and dirs */
@ -48,6 +55,38 @@
#define NON_UNIXFS
#endif /* _WIN32 */
#ifndef S_IROTH
#define S_IROTH 0
#endif
#ifndef S_IRGRP
#define S_IRGRP 0
#endif
#ifndef HAVE_GETUID
static inline int
getuid ()
{
return 0;
}
#endif
#ifndef HAVE_GETGID
static inline int
getgid ()
{
return 0;
}
#endif
#ifndef HAVE_LSTAT
static inline int
lstat (const char *filename, struct stat *buf)
{
return stat (filename, buf);
}
#endif
#include <string.h>
#include <sys/types.h>
#include <sys/stat.h>
@ -126,8 +165,8 @@ struct directory_entry{
struct directory_entry * next;
struct directory_entry * jnext;
struct iso_directory_record isorec;
unsigned int starting_block;
unsigned int size;
uint64_t starting_block;
uint64_t size;
unsigned short priority;
unsigned char jreclen; /* Joliet record len */
char * name;
@ -233,21 +272,13 @@ struct directory{
unsigned short dir_nlink;
};
struct deferred{
struct deferred * next;
unsigned int starting_block;
char * name;
struct directory * filedir;
unsigned int flags;
};
extern int goof;
extern struct directory * root;
extern struct directory * reloc_dir;
extern unsigned int next_extent;
extern unsigned int last_extent;
extern unsigned int last_extent_written;
extern unsigned int session_start;
extern uint64_t next_extent;
extern uint64_t last_extent;
extern uint64_t last_extent_written;
extern uint64_t session_start;
extern unsigned int path_table_size;
extern unsigned int path_table[4];
@ -265,6 +296,8 @@ extern struct iso_directory_record root_record;
extern struct iso_directory_record jroot_record;
extern int use_eltorito;
extern int use_eltorito_emul_floppy;
extern int use_boot_info_table;
extern int use_RockRidge;
extern int use_Joliet;
extern int rationalize;
@ -309,6 +342,7 @@ extern void DECL(init_boot_catalog, (const char * path ));
extern void DECL(get_torito_desc, (struct eltorito_boot_descriptor * path ));
/* write.c */
extern int DECL(get_731,(char *));
extern int DECL(get_733,(char *));
extern int DECL(isonum_733,(unsigned char *));
extern void DECL(set_723,(char *, unsigned int));
@ -320,7 +354,7 @@ extern void DECL(generate_one_directory,(struct directory *, FILE*));
extern void DECL(memcpy_max, (char *, char *, int));
extern int DECL(oneblock_size, (int starting_extent));
extern struct iso_primary_descriptor vol_desc;
extern void DECL(xfwrite, (void * buffer, int count, int size, FILE * file));
extern void DECL(xfwrite, (void * buffer, uint64_t count, uint64_t size, FILE * file));
extern void DECL(set_732, (char * pnt, unsigned int i));
extern void DECL(set_722, (char * pnt, unsigned int i));
extern void DECL(outputlist_insert, (struct output_fragment * frag));

View file

@ -4,9 +4,11 @@
*
* Written by Eric Youngdale (1996).
*
* Copyright (C) 2009 Free Software Foundation, Inc.
*
* 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, or (at your option)
* the Free Software Foundation; either version 3, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
@ -15,12 +17,9 @@
* 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.
* along with this program; if not, see <http://www.gnu.org/licenses/>.
*/
static char rcsid[] ="$Id: multi.c,v 1.14 1999/03/02 04:16:41 eric Exp $";
#include <stdlib.h>
#include <string.h>
#include <time.h>
@ -158,10 +157,8 @@ readsecs(startsecno, buffer, sectorcount)
{
int f = fileno(in_image);
if (lseek(f, (off_t)startsecno * SECTOR_SIZE, 0) == (off_t)-1) {
fprintf(stderr," Seek error on old image\n");
exit(10);
}
if (lseek(f, (off_t)startsecno * SECTOR_SIZE, 0) == (off_t)-1)
error (10, errno, _("Seek error on old image\n"));
return (read(f, buffer, sectorcount * SECTOR_SIZE));
}
#endif
@ -179,7 +176,7 @@ FDECL3(parse_rr, unsigned char *, pnt, int, len, struct directory_entry *,dpnt)
while(len >= 4){
if(pnt[3] != 1) {
fprintf(stderr,"**BAD RRVERSION");
fprintf (stderr, _("**Bad RR version attribute"));
return -1;
};
if(strncmp((char *) pnt, "NM", 2) == 0) {
@ -250,7 +247,7 @@ FDECL4(check_rr_dates, struct directory_entry *, dpnt,
*/
while(len >= 4){
if(pnt[3] != 1) {
fprintf(stderr,"**BAD RRVERSION");
fprintf (stderr, _("**Bad RR version attribute"));
return -1;
};
@ -546,9 +543,9 @@ FDECL2(read_merging_directory, struct iso_directory_record *, mrootp,
* Warn the user that iso (8.3) names were used because neither
* Rock Ridge (-R) nor TRANS.TBL (-T) name translations were found.
*/
fprintf(stderr,"Warning: Neither Rock Ridge (-R) nor TRANS.TBL (-T) \n");
fprintf(stderr,"name translations were found on previous session.\n");
fprintf(stderr,"ISO (8.3) file names have been used instead.\n");
fprintf (stderr, _("Warning: Neither Rock Ridge (-R) nor TRANS.TBL (-T) "
"name translations were found on previous session. "
"ISO (8.3) file names have been used instead.\n"));
warning_given = 1;
}
@ -764,10 +761,7 @@ struct iso_directory_record * FDECL1(merge_isofs, char *, path)
{
if (readsecs(file_addr/SECTOR_SIZE, &buffer,
sizeof(buffer)/SECTOR_SIZE) != sizeof(buffer))
{
fprintf(stderr," Read error on old image %s\n", path);
exit(10);
}
error (10, errno, _("Read error on old image %s\n"), path);
vdp = (struct iso_volume_descriptor *)buffer;
@ -928,7 +922,7 @@ void FDECL3(merge_remaining_entries, struct directory *, this_dir,
{
if( strcmp(s_entry->name, "<translation table>") == 0)
{
fprintf(stderr,"Should never get here\n");
fprintf (stderr, "Should never get here\n");
set_733(s_entry->isorec.extent, ttbl_extent);
return;
}
@ -1087,20 +1081,14 @@ FDECL1(get_session_start, int *, file_addr)
#else
if( cdwrite_data == NULL )
{
fprintf(stderr,"Special parameters for cdwrite not specified with -C\n");
exit(1);
}
error (1, 0, _("Special parameters for cdwrite not specified with -C\n"));
/*
* Next try and find the ',' in there which delimits the two numbers.
*/
pnt = strchr(cdwrite_data, ',');
if( pnt == NULL )
{
fprintf(stderr, "Malformed cdwrite parameters\n");
exit(1);
}
error (1, 0, _("Malformed cdwrite parameters\n"));
*pnt = '\0';
if (file_addr != NULL) {

View file

@ -21,8 +21,6 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
static char rcsid[] ="$Id: name.c,v 1.11 1999/03/02 03:41:26 eric Exp $";
#include "config.h"
#include "mkisofs.h"
@ -213,7 +211,7 @@ int FDECL3(iso9660_file_length,
}
if(current_length < 30)
{
if( *pnt < 0 )
if( !isascii (*pnt))
{
*result++ = '_';
}
@ -281,7 +279,7 @@ int FDECL3(iso9660_file_length,
switch (*pnt)
{
default:
if( *pnt < 0 )
if( !isascii (*pnt) )
{
*result++ = '_';
}

View file

@ -19,9 +19,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, see <http://www.gnu.org/licenses/>.
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
static char rcsid[] ="$Id: rock.c,v 1.8 1999/03/02 03:41:26 eric Exp $";
*/
#include <stdlib.h>
@ -45,6 +43,7 @@ static char rcsid[] ="$Id: rock.c,v 1.8 1999/03/02 03:41:26 eric Exp $";
#include "mkisofs.h"
#include "iso9660.h"
#include <string.h>
#include <errno.h>
#ifdef DOESNT_WORK
@ -307,7 +306,7 @@ int deep_opt;
* the symbolic link won't fit into one SL System Use Field
* print an error message and continue with splited one
*/
fprintf(stderr,"symbolic link ``%s'' to long for one SL System Use Field, splitting", cpnt);
fprintf(stderr, _("symbolic link ``%s'' to long for one SL System Use Field, splitting"), cpnt);
}
if(MAYBE_ADD_CE_ENTRY(SL_SIZE + sl_bytes)) add_CE_entry();
}
@ -480,7 +479,8 @@ int deep_opt;
OK_flag = 1;
zipfile = fopen(whole_name, "rb");
fread(header, 1, sizeof(header), zipfile);
if (fread (header, 1, sizeof (header), zipfile) != sizeof(header))
error (1, errno, "fread");
/* Check some magic numbers from gzip. */
if(header[0] != 0x1f || header[1] != 0x8b || header[2] != 8) OK_flag = 0;
@ -514,7 +514,7 @@ int deep_opt;
zipfile = fopen(checkname, "rb");
if(zipfile) {
OK_flag = 0;
fprintf(stderr,"Unable to insert transparent compressed file - name conflict\n");
fprintf (stderr, _("Unable to insert transparent compressed file - name conflict\n"));
fclose(zipfile);
}
@ -587,10 +587,8 @@ char * FDECL4(generate_rr_extension_record, char *, id, char *, descriptor,
memcpy(Rock + lipnt, source, len_src);
lipnt += len_src;
if(lipnt > SECTOR_SIZE) {
fprintf(stderr,"Extension record too long\n");
exit(1);
};
if(lipnt > SECTOR_SIZE)
error (1, 0, _("Extension record too long\n"));
pnt = (char *) e_malloc(SECTOR_SIZE);
memset(pnt, 0, SECTOR_SIZE);
memcpy(pnt, Rock, lipnt);

View file

@ -6,9 +6,11 @@
Copyright 1993 Yggdrasil Computing, Incorporated
Copyright (C) 2009 Free Software Foundation, Inc.
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, or (at your option)
the Free Software Foundation; either version 3, or (at your option)
any later version.
This program is distributed in the hope that it will be useful,
@ -17,10 +19,8 @@
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. */
static char rcsid[] ="$Id: tree.c,v 1.29 1999/03/07 17:41:19 eric Exp $";
along with this program; if not, see <http://www.gnu.org/licenses/>.
*/
/* ADD_FILES changes made by Ross Biro biro@yggdrasil.com 2/23/95 */
@ -141,6 +141,10 @@ FDECL2(stat_filter, char *, path, struct stat *, st)
int result = stat(path, st);
if (result >= 0 && rationalize)
stat_fix(st);
if ((unsigned) st->st_size > UINT32_MAX)
result = -1;
return result;
}
@ -150,6 +154,10 @@ FDECL2(lstat_filter, char *, path, struct stat *, st)
int result = lstat(path, st);
if (result >= 0 && rationalize)
stat_fix(st);
if ((unsigned) st->st_size > UINT32_MAX)
result = -1;
return result;
}
@ -215,10 +223,7 @@ static int FDECL1(sort_n_finish, struct directory *, this_dir)
}
if(s_entry1 == s_entry)
{
fprintf(stderr,"Fatal goof\n");
exit(1);
}
error (1, 0, _("Fatal goof\n"));
/*
* OK, handle the conflicts. Try substitute names until we come
@ -276,8 +281,7 @@ static int FDECL1(sort_n_finish, struct directory *, this_dir)
/*
* If we fell off the bottom here, we were in real trouble.
*/
fprintf(stderr,"Unable to generate unique name for file %s\n", s_entry->name);
exit(1);
error (1, 0, _("Unable to generate unique name for file %s\n"), s_entry->name);
got_valid_name:
/*
@ -288,9 +292,9 @@ got_valid_name:
{
if( verbose > 0 )
{
fprintf(stderr,"Using %s for %s%s%s (%s)\n", newname,
this_dir->whole_name, SPATH_SEPARATOR,
s_entry->name, s_entry1->name);
fprintf (stderr, _("Using %s for %s%s%s (%s)\n"), newname,
this_dir->whole_name, SPATH_SEPARATOR,
s_entry->name, s_entry1->name);
}
s_entry->isorec.name_len[0] = strlen(newname);
new_reclen = sizeof(struct iso_directory_record) -
@ -310,7 +314,7 @@ got_valid_name:
delete_file_hash(s_entry1);
if( verbose > 0 )
{
fprintf(stderr,"Using %s for %s%s%s (%s)\n", newname,
fprintf(stderr, _("Using %s for %s%s%s (%s)\n"), newname,
this_dir->whole_name, SPATH_SEPARATOR,
s_entry1->name, s_entry->name);
}
@ -434,19 +438,16 @@ got_valid_name:
if (new_reclen & 1) new_reclen++;
if(new_reclen > 0xff)
{
fprintf(stderr,"Fatal error - RR overflow for file %s\n",
s_entry->name);
exit(1);
}
error (1, 0, _("Fatal error - RR overflow for file %s\n"),
s_entry->name);
s_entry->isorec.length[0] = new_reclen;
}
status = sort_directory(&this_dir->contents);
if( status > 0 )
{
fprintf(stderr, "Unable to sort directory %s\n",
this_dir->whole_name);
fprintf (stderr, _("Unable to sort directory %s\n"),
this_dir->whole_name);
}
/*
@ -475,12 +476,9 @@ got_valid_name:
s_entry->table = NULL;
}
if(count != tablesize)
{
fprintf(stderr,"Translation table size mismatch %d %d\n",
count, tablesize);
exit(1);
}
if(count != tablesize)
error (1, 0, _("Translation table size mismatch %d %d\n"),
count, tablesize);
}
/*
@ -744,10 +742,8 @@ void finish_cl_pl_entries(){
if(d_entry->self == s_entry) break;
d_entry = d_entry->next;
};
if(!d_entry){
fprintf(stderr,"Unable to locate directory parent\n");
exit(1);
};
if(!d_entry)
error (1, 0, _("Unable to locate directory parent\n"));
/* First fix the PL pointer in the directory in the rr_reloc dir */
s_entry1 = d_entry->contents->next;
@ -797,7 +793,7 @@ FDECL3(scan_directory_tree,struct directory *, this_dir,
if (verbose > 1)
{
fprintf(stderr, "Scanning %s\n", path);
fprintf (stderr, _("Scanning %s\n"), path);
}
current_dir = opendir(path);
@ -812,7 +808,7 @@ FDECL3(scan_directory_tree,struct directory *, this_dir,
if(!current_dir || !d_entry)
{
fprintf(stderr,"Unable to open directory %s\n", path);
fprintf (stderr, _("Unable to open directory %s\n"), path);
de->isorec.flags[0] &= ~2; /* Mark as not a directory */
if(current_dir) closedir(current_dir);
return 0;
@ -857,16 +853,14 @@ FDECL3(scan_directory_tree,struct directory *, this_dir,
{
if( verbose > 0 )
{
fprintf(stderr, "Ignoring file %s\n", d_entry->d_name);
fprintf (stderr, _("Ignoring file %s\n"), d_entry->d_name);
}
continue;
}
}
if(strlen(path)+strlen(d_entry->d_name) + 2 > sizeof(whole_path)){
fprintf(stderr, "Overflow of stat buffer\n");
exit(1);
};
if(strlen(path)+strlen(d_entry->d_name) + 2 > sizeof(whole_path))
error (1, 0, _("Overflow of stat buffer\n"));
/* Generate the complete ASCII path for this file */
strcpy(whole_path, path);
@ -879,7 +873,7 @@ FDECL3(scan_directory_tree,struct directory *, this_dir,
/** Should we exclude this file ? */
if (matches(d_entry->d_name) || matches(whole_path)) {
if (verbose > 1) {
fprintf(stderr, "Excluded by match: %s\n", whole_path);
fprintf (stderr, _("Excluded by match: %s\n"), whole_path);
}
continue;
}
@ -894,7 +888,7 @@ FDECL3(scan_directory_tree,struct directory *, this_dir,
*/
if (verbose > 1)
{
fprintf(stderr, "Excluded: %s\n",whole_path);
fprintf (stderr, _("Excluded: %s\n"), whole_path);
}
continue;
}
@ -964,7 +958,7 @@ FDECL3(insert_file_entry,struct directory *, this_dir,
* This means that the file doesn't exist, or isn't accessible.
* Sometimes this is because of NFS permissions problems.
*/
fprintf(stderr, "Non-existant or inaccessible: %s\n",whole_path);
fprintf (stderr, _("Non-existant or inaccessible: %s\n"),whole_path);
return 0;
}
@ -999,15 +993,15 @@ FDECL3(insert_file_entry,struct directory *, this_dir,
} else {
if(follow_links)
{
fprintf(stderr,
"Unable to stat file %s - ignoring and continuing.\n",
whole_path);
fprintf (stderr,
_("Unable to stat file %s - ignoring and continuing.\n"),
whole_path);
}
else
{
fprintf(stderr,
"Symlink %s ignored - continuing.\n",
whole_path);
fprintf (stderr,
_("Symlink %s ignored - continuing.\n"),
whole_path);
return 0; /* Non Rock Ridge discs - ignore all symlinks */
}
}
@ -1031,8 +1025,8 @@ FDECL3(insert_file_entry,struct directory *, this_dir,
{
if(!use_RockRidge)
{
fprintf(stderr, "Already cached directory seen (%s)\n",
whole_path);
fprintf (stderr, _("Already cached directory seen (%s)\n"),
whole_path);
return 0;
}
statbuf.st_size = 0;
@ -1070,19 +1064,11 @@ FDECL3(insert_file_entry,struct directory *, this_dir,
{
add_directory_hash(statbuf.st_dev, STAT_INODE(statbuf));
}
#ifdef VMS
if(!S_ISDIR(lstatbuf.st_mode) && (statbuf.st_fab_rfm != FAB$C_FIX &&
statbuf.st_fab_rfm != FAB$C_STMLF)) {
fprintf(stderr,"Warning - file %s has an unsupported VMS record"
" format (%d)\n",
whole_path, statbuf.st_fab_rfm);
}
#endif
if(S_ISREG(lstatbuf.st_mode) && (status = access(whole_path, R_OK)))
{
fprintf(stderr, "File %s is not readable (errno = %d) - ignoring\n",
whole_path, errno);
fprintf (stderr, _("File %s is not readable (%s) - ignoring\n"),
whole_path, strerror (errno));
return 0;
}
@ -1093,12 +1079,10 @@ FDECL3(insert_file_entry,struct directory *, this_dir,
&& strcmp(short_name, ".")
&& strcmp(short_name, "..") )
{
if(find_directory_hash(statbuf.st_dev, STAT_INODE(statbuf))) {
fprintf(stderr,"Directory loop - fatal goof (%s %lx %lu).\n",
whole_path, (unsigned long) statbuf.st_dev,
(unsigned long) STAT_INODE(statbuf));
exit(1);
}
if(find_directory_hash(statbuf.st_dev, STAT_INODE(statbuf)))
error (1, 0, _("Directory loop - fatal goof (%s %lx %lu).\n"),
whole_path, (unsigned long) statbuf.st_dev,
(unsigned long) STAT_INODE(statbuf));
add_directory_hash(statbuf.st_dev, STAT_INODE(statbuf));
}
@ -1106,8 +1090,8 @@ FDECL3(insert_file_entry,struct directory *, this_dir,
!S_ISFIFO(lstatbuf.st_mode) && !S_ISSOCK(lstatbuf.st_mode)
&& !S_ISLNK(lstatbuf.st_mode) && !S_ISREG(lstatbuf.st_mode) &&
!S_ISDIR(lstatbuf.st_mode)) {
fprintf(stderr,"Unknown file type %s - ignoring and continuing.\n",
whole_path);
fprintf (stderr, _("Unknown file type %s - ignoring and continuing.\n"),
whole_path);
return 0;
}
@ -1115,9 +1099,9 @@ FDECL3(insert_file_entry,struct directory *, this_dir,
if(status)
{
fprintf(stderr,
"Unable to stat file %s - ignoring and continuing.\n",
whole_path);
fprintf (stderr,
_("Unable to stat file %s - ignoring and continuing.\n"),
whole_path);
return 0;
}
@ -1192,7 +1176,7 @@ FDECL3(insert_file_entry,struct directory *, this_dir,
else if (strcmp(short_name,".") && strcmp(short_name,"..")) {
if (i_matches(short_name) || i_matches(whole_path)) {
if (verbose > 1) {
fprintf(stderr, "Hidden from ISO9660 tree: %s\n", whole_path);
fprintf (stderr, _("Hidden from ISO9660 tree: %s\n"), whole_path);
}
s_entry->de_flags |= INHIBIT_ISO9660_ENTRY;
}
@ -1204,7 +1188,7 @@ FDECL3(insert_file_entry,struct directory *, this_dir,
else if (strcmp(short_name,".") && strcmp(short_name,"..")) {
if (j_matches(short_name) || j_matches(whole_path)) {
if (verbose > 1) {
fprintf(stderr, "Hidden from Joliet tree: %s\n", whole_path);
fprintf (stderr, _("Hidden from Joliet tree: %s\n"), whole_path);
}
s_entry->de_flags |= INHIBIT_JOLIET_ENTRY;
}
@ -1613,10 +1597,7 @@ struct directory * FDECL4(find_or_create_directory, struct directory *, parent,
fprintf(stderr,"%s(%d) ", path, dpnt->depth);
#endif
if(parent->depth > RR_relocation_depth)
{
fprintf(stderr,"Directories too deep %s\n", path);
exit(1);
}
error (1, 0, _("Directories too deep %s\n"), path);
dpnt->parent = parent;
dpnt->depth = parent->depth + 1;
@ -1648,10 +1629,7 @@ static void FDECL2(delete_directory, struct directory *, parent, struct director
struct directory * tdir;
if( child->contents != NULL )
{
fprintf(stderr, "Unable to delete non-empty directory\n");
exit(1);
}
error (1, 0, _("Unable to delete non-empty directory\n"));
free(child->whole_name);
child->whole_name = NULL;
@ -1674,10 +1652,7 @@ static void FDECL2(delete_directory, struct directory *, parent, struct director
}
}
if( tdir == NULL )
{
fprintf(stderr, "Unable to locate child directory in parent list\n");
exit(1);
}
error (1, 0, _("Unable to locate child directory in parent list\n"));
}
free(child);
return;
@ -1794,8 +1769,8 @@ struct directory_entry * FDECL2(search_tree_file, struct directory *,
if( (p1=strchr(subdir, '/')) == subdir )
{
fprintf(stderr,"call to search_tree_file with an absolute path, stripping\n");
fprintf(stderr,"initial path separator. Hope this was intended...\n");
fprintf (stderr, _("call to search_tree_file with an absolute path, stripping\n"));
fprintf (stderr, _("initial path separator. Hope this was intended...\n"));
memmove(subdir, subdir+1, strlen(subdir)-1);
p1 = strchr(subdir, '/');
}
@ -1863,7 +1838,7 @@ struct directory_entry * FDECL2(search_tree_file, struct directory *,
*/
return (NULL);
}
fprintf(stderr,"We cant get here in search_tree_file :-/ \n");
fprintf (stderr, "We cant get here in search_tree_file :-/ \n");
}
void init_fstatbuf()

View file

@ -19,9 +19,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, see <http://www.gnu.org/licenses/>.
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
static char rcsid[] ="$Id: write.c,v 1.21 1999/03/07 17:41:19 eric Exp $";
*/
#include <string.h>
#include <stdlib.h>
@ -111,6 +109,14 @@ void FDECL2(set_732, char *, pnt, unsigned int, i)
pnt[0] = (i >> 24) & 0xff;
}
int FDECL1(get_731, char *, p)
{
return ((p[0] & 0xff)
| ((p[1] & 0xff) << 8)
| ((p[2] & 0xff) << 16)
| ((p[3] & 0xff) << 24));
}
int FDECL1(get_733, char *, p)
{
return ((p[0] & 0xff)
@ -127,7 +133,7 @@ void FDECL2(set_733, char *, pnt, unsigned int, i)
pnt[4] = pnt[3] = (i >> 24) & 0xff;
}
void FDECL4(xfwrite, void *, buffer, int, count, int, size, FILE *, file)
void FDECL4(xfwrite, void *, buffer, uint64_t, count, uint64_t, size, FILE *, file)
{
/*
* This is a hack that could be made better. XXXIs this the only place?
@ -148,21 +154,16 @@ void FDECL4(xfwrite, void *, buffer, int, count, int, size, FILE *, file)
unlink(outfile);
sprintf(nbuf, "%s_%02d", outfile, idx++);
file = freopen(nbuf, "wb", file);
if (file == NULL) {
fprintf(stderr, "Cannot open '%s'.\n", nbuf);
exit(1);
}
if (file == NULL)
error (1, errno, _("Cannot open '%s'"), nbuf);
}
while(count)
{
int got = fwrite(buffer,size,count,file);
size_t got = fwrite (buffer, size, count, file);
if(got<=0)
{
fprintf(stderr,"cannot fwrite %d*%d\n",size,count);
exit(1);
}
if (got != count)
error (1, errno, _("cannot fwrite %llu*%llu\n"), size, count);
count-=got,*(char**)&buffer+=size*got;
}
}
@ -171,14 +172,14 @@ struct deferred_write
{
struct deferred_write * next;
char * table;
unsigned int extent;
unsigned int size;
uint64_t extent;
uint64_t size;
char * name;
};
static struct deferred_write * dw_head = NULL, * dw_tail = NULL;
unsigned int last_extent_written =0;
uint64_t last_extent_written = 0;
static unsigned int path_table_index;
static time_t begun;
@ -235,23 +236,16 @@ static int FDECL1(assign_directory_addresses, struct directory *, node)
}
static void FDECL3(write_one_file, char *, filename,
unsigned int, size, FILE *, outfile)
uint64_t, size, FILE *, outfile)
{
char buffer[SECTOR_SIZE * NSECT];
FILE * infile;
int remain;
unsigned int use;
int64_t remain;
size_t use;
if ((infile = fopen(filename, "rb")) == NULL)
{
#if defined(sun) || defined(_AUX_SOURCE)
fprintf(stderr, "cannot open %s: (%d)\n", filename, errno);
#else
fprintf(stderr, "cannot open %s: %s\n", filename, strerror(errno));
#endif
exit(1);
}
error (1, errno, _("cannot open %s\n"), filename);
remain = size;
while(remain > 0)
@ -260,10 +254,7 @@ static void FDECL3(write_one_file, char *, filename,
use = ROUND_UP(use); /* Round up to nearest sector boundary */
memset(buffer, 0, use);
if (fread(buffer, 1, use, infile) == 0)
{
fprintf(stderr,"cannot read from %s\n",filename);
exit(1);
}
error (1, errno, _("cannot read %llu bytes from %s"), use, filename);
xfwrite(buffer, 1, use, outfile);
last_extent_written += use/SECTOR_SIZE;
#if 0
@ -281,8 +272,8 @@ static void FDECL3(write_one_file, char *, filename,
time(&now);
frac = last_extent_written / (double)last_extent;
the_end = begun + (now - begun) / frac;
fprintf(stderr, "%6.2f%% done, estimate finish %s",
frac * 100., ctime(&the_end));
fprintf (stderr, _("%6.2f%% done, estimate finish %s"),
frac * 100., ctime(&the_end));
}
#endif
remain -= use;
@ -298,12 +289,10 @@ static void FDECL1(write_files, FILE *, outfile)
{
if(dwpnt->table)
{
xfwrite(dwpnt->table, 1, ROUND_UP(dwpnt->size), outfile);
last_extent_written += ROUND_UP(dwpnt->size) / SECTOR_SIZE;
table_size += dwpnt->size;
/* fprintf(stderr,"Size %d ", dwpnt->size); */
free(dwpnt->table);
}
write_one_file (dwpnt->table, dwpnt->size, outfile);
table_size += dwpnt->size;
free (dwpnt->table);
}
else
{
@ -550,8 +539,8 @@ static void FDECL1(assign_file_addresses, struct directory *, dpnt)
{
if(verbose > 2)
{
fprintf(stderr, "Cache hit for %s%s%s\n",s_entry->filedir->de_name,
SPATH_SEPARATOR, s_entry->name);
fprintf (stderr, _("Cache hit for %s%s%s\n"), s_entry->filedir->de_name,
SPATH_SEPARATOR, s_entry->name);
}
set_733((char *) s_entry->isorec.extent, s_hash->starting_block);
set_733((char *) s_entry->isorec.size, s_hash->size);
@ -572,10 +561,8 @@ static void FDECL1(assign_file_addresses, struct directory *, dpnt)
{
if(finddir->self == s_entry) break;
finddir = finddir->next;
if(!finddir)
{
fprintf(stderr,"Fatal goof\n"); exit(1);
}
if (!finddir)
error (1, 0, _("Fatal goof\n"));
}
set_733((char *) s_entry->isorec.extent, finddir->extent);
s_entry->starting_block = finddir->extent;
@ -673,15 +660,15 @@ static void FDECL1(assign_file_addresses, struct directory *, dpnt)
last_extent += ROUND_UP(s_entry->size) >> 11;
if(verbose > 2)
{
fprintf(stderr,"%d %d %s\n", s_entry->starting_block,
fprintf(stderr,"%llu %llu %s\n", s_entry->starting_block,
last_extent-1, whole_path);
}
#ifdef DBG_ISO
if((ROUND_UP(s_entry->size) >> 11) > 500)
{
fprintf(stderr,"Warning: large file %s\n", whole_path);
fprintf(stderr,"Starting block is %d\n", s_entry->starting_block);
fprintf(stderr,"Reported file size is %d extents\n", s_entry->size);
fprintf (stderr, "Warning: large file %s\n", whole_path);
fprintf (stderr, "Starting block is %d\n", s_entry->starting_block);
fprintf (stderr, "Reported file size is %d extents\n", s_entry->size);
}
#endif
@ -906,8 +893,8 @@ void FDECL2(generate_one_directory, struct directory *, dpnt, FILE *, outfile)
if(dpnt->size != dir_index)
{
fprintf(stderr,"Unexpected directory length %d %d %s\n",dpnt->size,
dir_index, dpnt->de_name);
fprintf (stderr, _("Unexpected directory length %d %d %s\n"), dpnt->size,
dir_index, dpnt->de_name);
}
xfwrite(directory_buffer, 1, total_size, outfile);
@ -918,8 +905,8 @@ void FDECL2(generate_one_directory, struct directory *, dpnt, FILE *, outfile)
{
if(ce_index != dpnt->ce_bytes)
{
fprintf(stderr,"Continuation entry record length mismatch (%d %d).\n",
ce_index, dpnt->ce_bytes);
fprintf (stderr, _("Continuation entry record length mismatch (%d %d).\n"),
ce_index, dpnt->ce_bytes);
}
xfwrite(ce_buffer, 1, ce_size, outfile);
last_extent_written += ce_size >> 11;
@ -991,9 +978,8 @@ static int generate_path_tables()
*/
if( next_path_index > 0xffff )
{
fprintf(stderr, "Unable to generate sane path tables - too many directories (%d)\n",
next_path_index);
exit(1);
error (1, 0, _("Unable to generate sane path tables - too many directories (%d)\n"),
next_path_index);
}
path_table_index = 0;
@ -1028,8 +1014,7 @@ static int generate_path_tables()
dpnt = pathlist[j];
if(!dpnt)
{
fprintf(stderr,"Entry %d not in path tables\n", j);
exit(1);
error (1, 0, _("Entry %d not in path tables\n"), j);
}
npnt = dpnt->de_name;
@ -1049,8 +1034,7 @@ static int generate_path_tables()
de = dpnt->self;
if(!de)
{
fprintf(stderr,"Fatal goof\n");
exit(1);
error (1, 0, _("Fatal goof\n"));
}
@ -1085,9 +1069,9 @@ static int generate_path_tables()
free(pathlist);
if(path_table_index != path_table_size)
{
fprintf(stderr,"Path table lengths do not match %d %d\n",
path_table_index,
path_table_size);
fprintf (stderr, _("Path table lengths do not match %d %d\n"),
path_table_index,
path_table_size);
}
return 0;
} /* generate_path_tables(... */
@ -1131,18 +1115,18 @@ static int FDECL1(file_write, FILE *, outfile)
if( print_size > 0 )
{
fprintf(stderr,"Total extents scheduled to be written = %d\n",
last_extent - session_start);
exit(0);
fprintf (stderr, _("Total extents scheduled to be written = %llu\n"),
last_extent - session_start);
exit (0);
}
if( verbose > 2 )
{
#ifdef DBG_ISO
fprintf(stderr,"Total directory extents being written = %d\n", last_extent);
fprintf(stderr,"Total directory extents being written = %llu\n", last_extent);
#endif
fprintf(stderr,"Total extents scheduled to be written = %d\n",
last_extent - session_start);
fprintf (stderr, _("Total extents scheduled to be written = %llu\n"),
last_extent - session_start);
}
/*
@ -1158,8 +1142,8 @@ static int FDECL1(file_write, FILE *, outfile)
return 0;
}
fprintf(stderr,"Total extents actually written = %d\n",
last_extent_written - session_start);
fprintf (stderr, _("Total extents actually written = %llu\n"),
last_extent_written - session_start);
/*
* Hard links throw us off here
@ -1167,14 +1151,14 @@ static int FDECL1(file_write, FILE *, outfile)
assert (last_extent > session_start);
if(should_write + session_start != last_extent)
{
fprintf(stderr,"Number of extents written not what was predicted. Please fix.\n");
fprintf(stderr,"Predicted = %d, written = %d\n", should_write, last_extent);
fprintf (stderr, _("Number of extents written different than what was predicted. Please fix.\n"));
fprintf (stderr, _("Predicted = %d, written = %llu\n"), should_write, last_extent);
}
fprintf(stderr,"Total translation table size: %d\n", table_size);
fprintf(stderr,"Total rockridge attributes bytes: %d\n", rockridge_size);
fprintf(stderr,"Total directory bytes: %d\n", total_dir_size);
fprintf(stderr,"Path table size(bytes): %d\n", path_table_size);
fprintf (stderr, _("Total translation table size: %d\n"), table_size);
fprintf (stderr, _("Total rockridge attributes bytes: %d\n"), rockridge_size);
fprintf (stderr, _("Total directory bytes: %d\n"), total_dir_size);
fprintf (stderr, _("Path table size(bytes): %d\n"), path_table_size);
#ifdef DEBUG
fprintf(stderr, "next extent, last_extent, last_extent_written %d %d %d\n",

View file

@ -61,7 +61,7 @@ for option in "$@"; do
usage
exit 0 ;;
-v | --version)
echo "grub-install (GNU GRUB ${PACKAGE_VERSION})"
echo "grub-mkrescue (GNU GRUB ${PACKAGE_VERSION})"
exit 0 ;;
--modules=*)
modules=`echo "$option" | sed 's/--modules=//'` ;;