label.c (schily-2021-08-14.tar.bz2) | : | label.c (schily-2021-09-18.tar.bz2) | ||
---|---|---|---|---|
/* @(#)label.c 1.34 15/12/23 Copyright 1988-2011 J. Schilling */ | /* @(#)label.c 1.35 21/08/20 Copyright 1988-2021 J. Schilling */ | |||
#include <schily/mconfig.h> | #include <schily/mconfig.h> | |||
#ifndef lint | #ifndef lint | |||
static UConst char sccsid[] = | static UConst char sccsid[] = | |||
"@(#)label.c 1.34 15/12/23 Copyright 1988-2011 J. Schilling"; | "@(#)label.c 1.35 21/08/20 Copyright 1988-2021 J. Schilling"; | |||
#endif | #endif | |||
/* | /* | |||
* Copyright (c) 1988-2011 J. Schilling | * Copyright (c) 1988-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 | |||
* | * | |||
* When distributing Covered Code, include this CDDL HEADER in each | * When distributing Covered Code, include this CDDL HEADER in each | |||
* file and include the License file CDDL.Schily.txt from this distribution. | * file and include the License file CDDL.Schily.txt from this distribution. | |||
*/ | */ | |||
#include <schily/stdio.h> | #include <schily/stdio.h> | |||
#include <schily/stdlib.h> | #include <schily/stdlib.h> | |||
#include <schily/standard.h> | #include <schily/standard.h> | |||
#include <schily/param.h> /* Include various defs needed with some OS */ | #include <schily/param.h> /* Include various defs needed with some OS */ | |||
#include <schily/ioctl.h> | #include <schily/ioctl.h> | |||
#define GT_COMERR /* #define comerr gtcomerr */ | ||||
#define GT_ERROR /* #define error gterror */ | ||||
#include <schily/schily.h> | #include <schily/schily.h> | |||
#include <schily/nlsdefs.h> | ||||
#include "dsklabel.h" | #include "dsklabel.h" | |||
#include "fmt.h" | #include "fmt.h" | |||
struct disk cur_disk; | struct disk cur_disk; | |||
struct dk_label x_label; | struct dk_label x_label; | |||
struct dk_label *d_label = &x_label; | struct dk_label *d_label = &x_label; | |||
char *disknm; | char *disknm; | |||
char opt[] = "help,version,print,p,Prpart,P,set,s,if*,lproto*,of*,lname*,f*"; | char opt[] = "help,version,print,p,Prpart,P,set,s,if*,lproto*,of*,lname*,f*"; | |||
skipping to change at line 86 | skipping to change at line 89 | |||
{ | { | |||
BOOL help = FALSE; | BOOL help = FALSE; | |||
BOOL prversion = FALSE; | BOOL prversion = FALSE; | |||
int print = 0; | int print = 0; | |||
int Prpart = 0; | int Prpart = 0; | |||
int set = 0; | int set = 0; | |||
int cac = ac; | int cac = ac; | |||
char *const *cav= av; | char *const *cav= av; | |||
SCSI scg; | SCSI scg; | |||
save_args(ac, av); | ||||
(void) setlocale(LC_ALL, ""); | ||||
#ifdef USE_NLS | ||||
#if !defined(TEXT_DOMAIN) /* Should be defined by cc -D */ | ||||
#define TEXT_DOMAIN "p" /* 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 */ | ||||
disk_null(&cur_disk, TRUE); | disk_null(&cur_disk, TRUE); | |||
cac--; | cac--; | |||
cav++; | cav++; | |||
if (getallargs(&cac, &cav, opt, &help, &prversion, | if (getallargs(&cac, &cav, opt, &help, &prversion, | |||
&print, &print, | &print, &print, | |||
&Prpart, &Prpart, | &Prpart, &Prpart, | |||
&set, &set, | &set, &set, | |||
&Lproto, &Lproto, | &Lproto, &Lproto, | |||
&Lname, &Lname, | &Lname, &Lname, | |||
&disknm) < 0) { | &disknm) < 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 (prversion) { | if (prversion) { | |||
printf("Label release %s (%s-%s-%s) Copyright (C) 1988-2011 Jörg | gtprintf("Label release %s (%s-%s-%s) Copyright (C) 1988-2021 %s\ | |||
Schilling\n", | n", | |||
"1.34", | "1.35", | |||
HOST_CPU, HOST_VENDOR, HOST_OS); | HOST_CPU, HOST_VENDOR, HOST_OS, | |||
_("Jörg Schilling")); | ||||
exit(0); | exit(0); | |||
} | } | |||
if (disknm) | if (disknm) | |||
Lname = Lproto = disknm; | Lname = Lproto = disknm; | |||
if (print || Prpart || set) { | if (print || Prpart || set) { | |||
if (readlabel(Lproto, d_label)) { | if (readlabel(Lproto, d_label)) { | |||
cur_disk.labelread = 0; | cur_disk.labelread = 0; | |||
End of changes. 7 change blocks. | ||||
7 lines changed or deleted | 34 lines changed or added |