mountcd.c (schily-2021-08-14.tar.bz2) | : | mountcd.c (schily-2021-09-18.tar.bz2) | ||
---|---|---|---|---|
/* @(#)mountcd.c 1.12 09/07/11 Copyright 2005-2009 J. Schilling */ | /* @(#)mountcd.c 1.14 21/08/20 Copyright 2005-2021 J. Schilling */ | |||
#include <schily/mconfig.h> | #include <schily/mconfig.h> | |||
#ifndef lint | #ifndef lint | |||
static UConst char sccsid[] = | static UConst char sccsid[] = | |||
"@(#)mountcd.c 1.12 09/07/11 Copyright 2005-2009 J. Schilling"; | "@(#)mountcd.c 1.14 21/08/20 Copyright 2005-2021 J. Schilling"; | |||
#endif | #endif | |||
/* | /* | |||
* Mount the "right" CD medium from a list of devices, | * Mount the "right" CD medium from a list of devices, | |||
* use ISO-9660 volume ID to identify the correct device. | * use ISO-9660 volume ID to identify the correct device. | |||
* | * | |||
* Copyright (c) 2005-2009 J. Schilling | * Copyright (c) 2005-2021 J. Schilling | |||
*/ | */ | |||
/* | /* | |||
* The contents of this file are subject to the terms of the | * The contents of this file are subject to the terms of the | |||
* Common Development and Distribution License, Version 1.0 only | * Common Development and Distribution License, Version 1.0 only | |||
* (the "License"). You may not use this file except in compliance | * (the "License"). You may not use this file except in compliance | |||
* with the License. | * with the License. | |||
* | * | |||
* See the file CDDL.Schily.txt in this distribution for details. | * See the file CDDL.Schily.txt in this distribution for details. | |||
* A copy of the CDDL is also available via the Internet at | * A copy of the CDDL is also available via the Internet at | |||
* http://www.opensource.org/licenses/cddl1.txt | * http://www.opensource.org/licenses/cddl1.txt | |||
skipping to change at line 35 | skipping to change at line 35 | |||
*/ | */ | |||
#include <schily/stdio.h> | #include <schily/stdio.h> | |||
#include <schily/standard.h> | #include <schily/standard.h> | |||
#include <schily/unistd.h> | #include <schily/unistd.h> | |||
#include <schily/stdlib.h> | #include <schily/stdlib.h> | |||
#include <schily/fcntl.h> | #include <schily/fcntl.h> | |||
#include <schily/dirent.h> | #include <schily/dirent.h> | |||
#include <schily/string.h> | #include <schily/string.h> | |||
#include <schily/stat.h> | #include <schily/stat.h> | |||
#define GT_COMERR /* #define comerr gtcomerr */ | ||||
#define GT_ERROR /* #define error gterror */ | ||||
#include <schily/schily.h> | #include <schily/schily.h> | |||
#include <schily/errno.h> | #include <schily/errno.h> | |||
#include <schily/nlsdefs.h> | ||||
BOOL debug = FALSE; | BOOL debug = FALSE; | |||
LOCAL void usage __PR((int excode)); | LOCAL void usage __PR((int excode)); | |||
EXPORT int main __PR((int ac, char *av[])); | EXPORT int main __PR((int ac, char *av[])); | |||
LOCAL int trymount __PR((char *name, char *volid)); | LOCAL int trymount __PR((char *name, char *volid)); | |||
LOCAL void | LOCAL void | |||
usage(excode) | usage(excode) | |||
int excode; | int excode; | |||
skipping to change at line 75 | skipping to change at line 78 | |||
BOOL help = FALSE; | BOOL help = FALSE; | |||
BOOL pversion = FALSE; | BOOL pversion = FALSE; | |||
char *volid = NULL; | char *volid = NULL; | |||
DIR *dp; | DIR *dp; | |||
struct dirent *de; | struct dirent *de; | |||
char *p; | char *p; | |||
int i; | int i; | |||
save_args(ac, av); | save_args(ac, av); | |||
(void) setlocale(LC_ALL, ""); | ||||
#ifdef USE_NLS | ||||
#if !defined(TEXT_DOMAIN) /* Should be defined by cc -D */ | ||||
#define TEXT_DOMAIN "mountcd" /* Use this only if it weren't */ | ||||
#endif | ||||
{ char *dir; | ||||
dir = searchfileinpath("share/locale", F_OK, | ||||
SIP_ANY_FILE|SIP_NO_PATH, NULL); | ||||
if (dir) | ||||
(void) bindtextdomain(TEXT_DOMAIN, dir); | ||||
else | ||||
#if defined(PROTOTYPES) && defined(INS_BASE) | ||||
(void) bindtextdomain(TEXT_DOMAIN, INS_BASE "/share/locale"); | ||||
#else | ||||
(void) bindtextdomain(TEXT_DOMAIN, "/usr/share/locale"); | ||||
#endif | ||||
(void) textdomain(TEXT_DOMAIN); | ||||
} | ||||
#endif /* USE_NLS */ | ||||
cac--; cav++; | cac--; cav++; | |||
if (getallargs(&cac, &cav, options, &help, &pversion, &debug, &volid) < 0 ) { | if (getallargs(&cac, &cav, options, &help, &pversion, &debug, &volid) < 0 ) { | |||
errmsgno(EX_BAD, "Bad flag: %s.\n", cav[0]); | errmsgno(EX_BAD, "Bad flag: %s.\n", cav[0]); | |||
usage(EX_BAD); | usage(EX_BAD); | |||
} | } | |||
if (help) | if (help) | |||
usage(0); | usage(0); | |||
if (pversion) { | if (pversion) { | |||
printf("Mountcd release %s (%s-%s-%s) Copyright (C) 2005-2009 Jör | printf("Mountcd release %s (%s-%s-%s) Copyright (C) 2005-2021 %s\ | |||
g Schilling\n", | n", | |||
"1.12", HOST_CPU, HOST_VENDOR, HOST_OS); | "1.14", HOST_CPU, HOST_VENDOR, HOST_OS, | |||
_("Jörg Schilling")); | ||||
exit(0); | exit(0); | |||
} | } | |||
if (debug) { | if (debug) { | |||
error ("Looking for CD Volume ID '%s'.\n", | error ("Looking for CD Volume ID '%s'.\n", | |||
volid ? volid:"<NO-Volid specified>"); | volid ? volid:"<NO-Volid specified>"); | |||
} | } | |||
cac = ac; | cac = ac; | |||
cav = av; | cav = av; | |||
cac--; cav++; | cac--; cav++; | |||
for (i = 0; getfiles(&cac, &cav, options); cac--, cav++, i++) { | for (i = 0; getfiles(&cac, &cav, options); cac--, cav++, i++) { | |||
End of changes. 7 change blocks. | ||||
6 lines changed or deleted | 31 lines changed or added |