1/* -*- buffer-read-only: t -*- vi: set ro: 2 * 3 * DO NOT EDIT THIS FILE (uudecode-opts.c) 4 * 5 * It has been AutoGen-ed 6 * From the definitions uudecode-opts.def 7 * and the template file options 8 * 9 * Generated from AutoOpts 41:1:16 templates. 10 * 11 * AutoOpts is a copyrighted work. This source file is not encumbered 12 * by AutoOpts licensing, but is provided under the licensing terms chosen 13 * by the uudecode author or copyright holder. AutoOpts is 14 * licensed under the terms of the LGPL. The redistributable library 15 * (``libopts'') is licensed under the terms of either the LGPL or, at the 16 * users discretion, the BSD license. See the AutoOpts and/or libopts sources 17 * for details. 18 * 19 * The uudecode program is copyrighted and licensed 20 * under the following terms: 21 * 22 * Copyright (C) 1994-2015 Free Software Foundation, Inc., all rights reserved. 23 * This is free software. It is licensed for use, modification and 24 * redistribution under the terms of the GNU General Public License, 25 * version 3 or later <http://gnu.org/licenses/gpl.html> 26 * 27 * uudecode is free software: you can redistribute it and/or modify it 28 * under the terms of the GNU General Public License as published by the 29 * Free Software Foundation, either version 3 of the License, or 30 * (at your option) any later version. 31 * 32 * uudecode is distributed in the hope that it will be useful, but 33 * WITHOUT ANY WARRANTY; without even the implied warranty of 34 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 35 * See the GNU General Public License for more details. 36 * 37 * You should have received a copy of the GNU General Public License along 38 * with this program. If not, see <http://www.gnu.org/licenses/>. 39 */ 40 41#ifndef __doxygen__ 42#define OPTION_CODE_COMPILE 1 43#include "uudecode-opts.h" 44#include <sys/types.h> 45 46#include <limits.h> 47#include <stdio.h> 48#include <stdlib.h> 49 50#ifdef __cplusplus 51extern "C" { 52#endif 53extern FILE * option_usage_fp; 54#define zCopyright (uudecode_opt_strs+0) 55#define zLicenseDescrip (uudecode_opt_strs+294) 56 57/* 58 * global included definitions 59 */ 60char const * const program_name = "uudecode"; 61 62#include <error.h> 63#include <errno.h> 64#include <string.h> 65 66#ifndef NULL 67# define NULL 0 68#endif 69 70/** 71 * static const strings for uudecode options 72 */ 73static char const uudecode_opt_strs[4760] = 74/* 0 */ "uudecode (GNU sharutils) 4.15.2\n" 75 "Copyright (C) 1994-2015 Free Software Foundation, Inc., all rights reserved.\n" 76 "This is free software. It is licensed for use, modification and\n" 77 "redistribution under the terms of the GNU General Public License,\n" 78 "version 3 or later <http://gnu.org/licenses/gpl.html>\n\0" 79/* 294 */ "uudecode is free software: you can redistribute it and/or modify it under\n" 80 "the terms of the GNU General Public License as published by the Free\n" 81 "Software Foundation, either version 3 of the License, or (at your option)\n" 82 "any later version.\n\n" 83 "uudecode is distributed in the hope that it will be useful, but WITHOUT ANY\n" 84 "WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS\n" 85 "FOR A PARTICULAR PURPOSE. See the GNU General Public License for more\n" 86 "details.\n\n" 87 "You should have received a copy of the GNU General Public License along\n" 88 "with this program. If not, see <http://www.gnu.org/licenses/>.\n\0" 89/* 899 */ "direct output to file\0" 90/* 921 */ "OUTPUT_FILE\0" 91/* 933 */ "output-file\0" 92/* 945 */ "ignore fchmod(3P) errors\0" 93/* 970 */ "IGNORE_CHMOD\0" 94/* 983 */ "ignore-chmod\0" 95/* 996 */ "display extended usage information and exit\0" 96/* 1040 */ "help\0" 97/* 1045 */ "extended usage information passed thru pager\0" 98/* 1090 */ "more-help\0" 99/* 1100 */ "output version information and exit\0" 100/* 1136 */ "version\0" 101/* 1144 */ "save the option state to a config file\0" 102/* 1183 */ "save-opts\0" 103/* 1193 */ "load options from a config file\0" 104/* 1225 */ "LOAD_OPTS\0" 105/* 1235 */ "no-load-opts\0" 106/* 1248 */ "no\0" 107/* 1251 */ "UUDECODE\0" 108/* 1260 */ "uudecode (GNU sharutils) - decode an encoded file\n" 109 "Usage: %s [ -<flag> [<val>] | --<name>[{=| }<val>] ]... [<file>...]\n\0" 110/* 1380 */ "$HOME\0" 111/* 1386 */ ".sharrc\0" 112/* 1394 */ "bug-gnu-utils@gnu.org\0" 113/* 1416 */ "If no 'file'(s) are provided, then standard input is decoded.\n\0" 114/* 1479 */ "'uudecode' transforms uuencoded files into their original form.\n\n" 115 "The encoded file(s) may be specified on the command line, or one may be\n" 116 "read from standard input. The output file name is specified in the encoded\n" 117 "file, but may be overridden with the '-o' option. It will have the mode of\n" 118 "the original file, except that setuid and execute bits are not retained. If\n" 119 "the output file is specified to be '/dev/stdout' or '-', the result will be\n" 120 "written to standard output. If there are multiple input files and the\n" 121 "second or subsquent file specifies standard output, the decoded data will\n" 122 "be written to the same file as the previous output. Don't do that.\n\n" 123 "'uudecode' ignores any leading and trailing lines. It looks for a line\n" 124 "that starts with \"'begin'\" and proceeds until the end-of-encoding marker is\n" 125 "found. The program determines from the header line of the encoded file\n" 126 "which of the two supported encoding schemes was used and whether or not the\n" 127 "output file name has been encoded with base64 encoding. See 'uuencode(5)'.\n\0" 128/* 2508 */ "uudecode (GNU sharutils) 4.15.2\0" 129/* 2540 */ "uudecode (GNU sharutils) - decode an encoded file\n" 130 "Usage: uudecode [ -<flag> [<val>] | --<name>[{=| }<val>] ]... [<file>...]\n\n" 131 " -o, --output-file=str direct output to file\n" 132 " -c, --ignore-chmod ignore fchmod(3P) errors\n" 133 " -v, --version[=MODE] output version information and exit\n" 134 " -h, --help display extended usage information and exit\n" 135 " -!, --more-help extended usage information passed thru pager\n" 136 " -R, --save-opts[=FILE] save the option state to a config file FILE\n" 137 " -r, --load-opts=FILE load options from the config file FILE\n" 138 " - disabled with '--no-load-opts'\n" 139 " - may appear multiple times\n\n" 140 "Options are specified by doubled hyphens and their name or by a single\n" 141 "hyphen and the flag character.\n" 142 "If no 'file'(s) are provided, then standard input is decoded.\n\n" 143 "The following option preset mechanisms are supported:\n" 144 " - reading file $HOME/.sharrc\n\n" 145 "'uudecode' transforms uuencoded files into their original form.\n\n" 146 "The encoded file(s) may be specified on the command line, or one may be\n" 147 "read from standard input. The output file name is specified in the encoded\n" 148 "file, but may be overridden with the '-o' option. It will have the mode of\n" 149 "the original file, except that setuid and execute bits are not retained. If\n" 150 "the output file is specified to be '/dev/stdout' or '-', the result will be\n" 151 "written to standard output. If there are multiple input files and the\n" 152 "second or subsquent file specifies standard output, the decoded data will\n" 153 "be written to the same file as the previous output. Don't do that.\n\n" 154 "'uudecode' ignores any leading and trailing lines. It looks for a line\n" 155 "that starts with \"'begin'\" and proceeds until the end-of-encoding marker is\n" 156 "found. The program determines from the header line of the encoded file\n" 157 "which of the two supported encoding schemes was used and whether or not the\n" 158 "output file name has been encoded with base64 encoding. See 'uuencode(5)'.\n\n" 159 "Please send bug reports to: <bug-gnu-utils@gnu.org>\n\0" 160/* 4590 */ "uudecode (GNU sharutils) - decode an encoded file\n" 161 "Usage: uudecode [ -<flag> [<val>] | --<name>[{=| }<val>] ]... [<file>...]\n" 162 "Try 'uudecode --help' for more information.\n"; 163 164/** 165 * output-file option description: 166 */ 167/** Descriptive text for the output-file option */ 168#define OUTPUT_FILE_DESC (uudecode_opt_strs+899) 169/** Upper-cased name for the output-file option */ 170#define OUTPUT_FILE_NAME (uudecode_opt_strs+921) 171/** Name string for the output-file option */ 172#define OUTPUT_FILE_name (uudecode_opt_strs+933) 173/** Compiled in flag settings for the output-file option */ 174#define OUTPUT_FILE_FLAGS (OPTST_DISABLED \ 175 | OPTST_SET_ARGTYPE(OPARG_TYPE_STRING)) 176 177/** 178 * ignore-chmod option description: 179 */ 180/** Descriptive text for the ignore-chmod option */ 181#define IGNORE_CHMOD_DESC (uudecode_opt_strs+945) 182/** Upper-cased name for the ignore-chmod option */ 183#define IGNORE_CHMOD_NAME (uudecode_opt_strs+970) 184/** Name string for the ignore-chmod option */ 185#define IGNORE_CHMOD_name (uudecode_opt_strs+983) 186/** Compiled in flag settings for the ignore-chmod option */ 187#define IGNORE_CHMOD_FLAGS (OPTST_DISABLED) 188 189/* 190 * Help/More_Help/Version option descriptions: 191 */ 192#define HELP_DESC (uudecode_opt_strs+996) 193#define HELP_name (uudecode_opt_strs+1040) 194#ifdef HAVE_WORKING_FORK 195#define MORE_HELP_DESC (uudecode_opt_strs+1045) 196#define MORE_HELP_name (uudecode_opt_strs+1090) 197#define MORE_HELP_FLAGS (OPTST_IMM | OPTST_NO_INIT) 198#else 199#define MORE_HELP_DESC HELP_DESC 200#define MORE_HELP_name HELP_name 201#define MORE_HELP_FLAGS (OPTST_OMITTED | OPTST_NO_INIT) 202#endif 203#ifdef NO_OPTIONAL_OPT_ARGS 204# define VER_FLAGS (OPTST_IMM | OPTST_NO_INIT) 205#else 206# define VER_FLAGS (OPTST_SET_ARGTYPE(OPARG_TYPE_STRING) | \ 207 OPTST_ARG_OPTIONAL | OPTST_IMM | OPTST_NO_INIT) 208#endif 209#define VER_DESC (uudecode_opt_strs+1100) 210#define VER_name (uudecode_opt_strs+1136) 211#define SAVE_OPTS_DESC (uudecode_opt_strs+1144) 212#define SAVE_OPTS_name (uudecode_opt_strs+1183) 213#define LOAD_OPTS_DESC (uudecode_opt_strs+1193) 214#define LOAD_OPTS_NAME (uudecode_opt_strs+1225) 215#define NO_LOAD_OPTS_name (uudecode_opt_strs+1235) 216#define LOAD_OPTS_pfx (uudecode_opt_strs+1248) 217#define LOAD_OPTS_name (NO_LOAD_OPTS_name + 3) 218/** 219 * Declare option callback procedures 220 */ 221extern tOptProc 222 optionBooleanVal, optionNestedVal, optionNumericVal, 223 optionPagedUsage, optionPrintVersion, optionResetOpt, 224 optionStackArg, optionTimeDate, optionTimeVal, 225 optionUnstackArg, optionVendorOption; 226static tOptProc 227 doOptOutput_File, doUsageOpt; 228#define VER_PROC optionPrintVersion 229 230/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ 231/** 232 * Define the uudecode Option Descriptions. 233 * This is an array of OPTION_CT entries, one for each 234 * option that the uudecode program responds to. 235 */ 236static tOptDesc optDesc[OPTION_CT] = { 237 { /* entry idx, value */ 0, VALUE_OPT_OUTPUT_FILE, 238 /* equiv idx, value */ 0, VALUE_OPT_OUTPUT_FILE, 239 /* equivalenced to */ NO_EQUIVALENT, 240 /* min, max, act ct */ 0, 1, 0, 241 /* opt state flags */ OUTPUT_FILE_FLAGS, 0, 242 /* last opt argumnt */ { NULL }, /* --output-file */ 243 /* arg list/cookie */ NULL, 244 /* must/cannot opts */ NULL, NULL, 245 /* option proc */ doOptOutput_File, 246 /* desc, NAME, name */ OUTPUT_FILE_DESC, OUTPUT_FILE_NAME, OUTPUT_FILE_name, 247 /* disablement strs */ NULL, NULL }, 248 249 { /* entry idx, value */ 1, VALUE_OPT_IGNORE_CHMOD, 250 /* equiv idx, value */ 1, VALUE_OPT_IGNORE_CHMOD, 251 /* equivalenced to */ NO_EQUIVALENT, 252 /* min, max, act ct */ 0, 1, 0, 253 /* opt state flags */ IGNORE_CHMOD_FLAGS, 0, 254 /* last opt argumnt */ { NULL }, /* --ignore-chmod */ 255 /* arg list/cookie */ NULL, 256 /* must/cannot opts */ NULL, NULL, 257 /* option proc */ NULL, 258 /* desc, NAME, name */ IGNORE_CHMOD_DESC, IGNORE_CHMOD_NAME, IGNORE_CHMOD_name, 259 /* disablement strs */ NULL, NULL }, 260 261 { /* entry idx, value */ INDEX_OPT_VERSION, VALUE_OPT_VERSION, 262 /* equiv idx value */ NO_EQUIVALENT, VALUE_OPT_VERSION, 263 /* equivalenced to */ NO_EQUIVALENT, 264 /* min, max, act ct */ 0, 1, 0, 265 /* opt state flags */ VER_FLAGS, AOUSE_VERSION, 266 /* last opt argumnt */ { NULL }, 267 /* arg list/cookie */ NULL, 268 /* must/cannot opts */ NULL, NULL, 269 /* option proc */ VER_PROC, 270 /* desc, NAME, name */ VER_DESC, NULL, VER_name, 271 /* disablement strs */ NULL, NULL }, 272 273 274 275 { /* entry idx, value */ INDEX_OPT_HELP, VALUE_OPT_HELP, 276 /* equiv idx value */ NO_EQUIVALENT, VALUE_OPT_HELP, 277 /* equivalenced to */ NO_EQUIVALENT, 278 /* min, max, act ct */ 0, 1, 0, 279 /* opt state flags */ OPTST_IMM | OPTST_NO_INIT, AOUSE_HELP, 280 /* last opt argumnt */ { NULL }, 281 /* arg list/cookie */ NULL, 282 /* must/cannot opts */ NULL, NULL, 283 /* option proc */ doUsageOpt, 284 /* desc, NAME, name */ HELP_DESC, NULL, HELP_name, 285 /* disablement strs */ NULL, NULL }, 286 287 { /* entry idx, value */ INDEX_OPT_MORE_HELP, VALUE_OPT_MORE_HELP, 288 /* equiv idx value */ NO_EQUIVALENT, VALUE_OPT_MORE_HELP, 289 /* equivalenced to */ NO_EQUIVALENT, 290 /* min, max, act ct */ 0, 1, 0, 291 /* opt state flags */ MORE_HELP_FLAGS, AOUSE_MORE_HELP, 292 /* last opt argumnt */ { NULL }, 293 /* arg list/cookie */ NULL, 294 /* must/cannot opts */ NULL, NULL, 295 /* option proc */ optionPagedUsage, 296 /* desc, NAME, name */ MORE_HELP_DESC, NULL, MORE_HELP_name, 297 /* disablement strs */ NULL, NULL }, 298 299 { /* entry idx, value */ INDEX_OPT_SAVE_OPTS, VALUE_OPT_SAVE_OPTS, 300 /* equiv idx value */ NO_EQUIVALENT, VALUE_OPT_SAVE_OPTS, 301 /* equivalenced to */ NO_EQUIVALENT, 302 /* min, max, act ct */ 0, 1, 0, 303 /* opt state flags */ OPTST_SET_ARGTYPE(OPARG_TYPE_STRING) 304 | OPTST_ARG_OPTIONAL | OPTST_NO_INIT, AOUSE_SAVE_OPTS, 305 /* last opt argumnt */ { NULL }, 306 /* arg list/cookie */ NULL, 307 /* must/cannot opts */ NULL, NULL, 308 /* option proc */ NULL, 309 /* desc, NAME, name */ SAVE_OPTS_DESC, NULL, SAVE_OPTS_name, 310 /* disablement strs */ NULL, NULL }, 311 312 { /* entry idx, value */ INDEX_OPT_LOAD_OPTS, VALUE_OPT_LOAD_OPTS, 313 /* equiv idx value */ NO_EQUIVALENT, VALUE_OPT_LOAD_OPTS, 314 /* equivalenced to */ NO_EQUIVALENT, 315 /* min, max, act ct */ 0, NOLIMIT, 0, 316 /* opt state flags */ OPTST_SET_ARGTYPE(OPARG_TYPE_STRING) 317 | OPTST_DISABLE_IMM, AOUSE_LOAD_OPTS, 318 /* last opt argumnt */ { NULL }, 319 /* arg list/cookie */ NULL, 320 /* must/cannot opts */ NULL, NULL, 321 /* option proc */ optionLoadOpt, 322 /* desc, NAME, name */ LOAD_OPTS_DESC, LOAD_OPTS_NAME, LOAD_OPTS_name, 323 /* disablement strs */ NO_LOAD_OPTS_name, LOAD_OPTS_pfx } 324}; 325 326 327/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ 328/** Reference to the upper cased version of uudecode. */ 329#define zPROGNAME (uudecode_opt_strs+1251) 330/** Reference to the title line for uudecode usage. */ 331#define zUsageTitle (uudecode_opt_strs+1260) 332/** uudecode configuration file name. */ 333#define zRcName (uudecode_opt_strs+1386) 334/** Directories to search for uudecode config files. */ 335static char const * const apzHomeList[2] = { 336 uudecode_opt_strs+1380, 337 NULL }; 338/** The uudecode program bug email address. */ 339#define zBugsAddr (uudecode_opt_strs+1394) 340/** Clarification/explanation of what uudecode does. */ 341#define zExplain (uudecode_opt_strs+1416) 342/** Extra detail explaining what uudecode does. */ 343#define zDetail (uudecode_opt_strs+1479) 344/** The full version string for uudecode. */ 345#define zFullVersion (uudecode_opt_strs+2508) 346/* extracted from optcode.tlib near line 364 */ 347 348#if defined(ENABLE_NLS) 349# define OPTPROC_BASE OPTPROC_TRANSLATE 350 static tOptionXlateProc translate_option_strings; 351#else 352# define OPTPROC_BASE OPTPROC_NONE 353# define translate_option_strings NULL 354#endif /* ENABLE_NLS */ 355 356#define uudecode_full_usage (uudecode_opt_strs+2540) 357#define uudecode_short_usage (uudecode_opt_strs+4590) 358 359#endif /* not defined __doxygen__ */ 360 361/* 362 * Create the static procedure(s) declared above. 363 */ 364/** 365 * The callout function that invokes the optionUsage function. 366 * 367 * @param[in] opts the AutoOpts option description structure 368 * @param[in] od the descriptor for the "help" (usage) option. 369 * @noreturn 370 */ 371static void 372doUsageOpt(tOptions * opts, tOptDesc * od) 373{ 374 int ex_code; 375 ex_code = UUDECODE_EXIT_SUCCESS; 376 optionUsage(&uudecodeOptions, ex_code); 377 /* NOTREACHED */ 378 exit(1); 379 (void)opts; 380 (void)od; 381} 382 383/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ 384/** 385 * Code to handle the output-file option. 386 * If specified, decoded data are written to this file. When multiple 387 * inputs are specified on the command line, this option cannot be 388 * specified. All decoded data must be written to the file name 389 * encoded in the data. 390 * @param[in] pOptions the uudecode options data structure 391 * @param[in,out] pOptDesc the option descriptor for this option. 392 */ 393static void 394doOptOutput_File(tOptions* pOptions, tOptDesc* pOptDesc) 395{ 396 /* 397 * Be sure the flag-code[0] handles special values for the options pointer 398 * viz. (poptions <= OPTPROC_EMIT_LIMIT) *and also* the special flag bit 399 * ((poptdesc->fOptState & OPTST_RESET) != 0) telling the option to 400 * reset its state. 401 */ 402 /* extracted from uudecode-opts.def, line 61 */ 403 FILE * fp; 404 switch (*pOptDesc->optArg.argString) 405 { 406 case '-': 407 if (pOptDesc->optArg.argString[1] == '\0') 408 return; 409 break; 410 411 case '/': 412 if (strcmp (pOptDesc->optArg.argString + 1, "dev/stdout") == 0) 413 return; 414 415 default: 416 break; 417 } 418 fp = freopen (pOptDesc->optArg.argString, "w", stdout); 419 if (fp != stdout) 420 fserr (UUDECODE_EXIT_NO_OUTPUT, "freopen-ing for stdout", 421 pOptDesc->optArg.argString); 422 (void)pOptions; 423} 424/* extracted from optmain.tlib near line 1250 */ 425 426/** 427 * Print a usage message with a format and va_list argument. 428 * The optionUsage function is then invoked to print 429 * the error usage text (somewhat abbreviated) and then exit. 430 * 431 * @param[in] fmt the message format string 432 * @param[in] ap the var-arg list. 433 * @noreturn 434 */ 435void 436vusage_message(char const * fmt, va_list ap) 437{ 438 char const * er_leader = _("uudecode usage error:\n"); 439 fputs(er_leader, stderr); 440 vfprintf(stderr, fmt, ap); 441 optionUsage(&uudecodeOptions, UUDECODE_EXIT_USAGE_ERROR); 442 /* NOTREACHED */ 443 exit(1); 444} 445 446/** 447 * Print a usage message with a format and a variable argument list. 448 * vusage_message() is called to do the work. 449 * 450 * @param[in] fmt the message format string 451 * @param[in] ... the argument list for the message 452 * @noreturn 453 */ 454void 455usage_message(char const * fmt, ...) 456{ 457 va_list ap; 458 va_start(ap, fmt); 459 vusage_message(fmt, ap); 460 /* NOTREACHED */ 461 va_end(ap); 462} 463 464/** 465 * Print a fatal error message and die, \a va_list style. 466 * 467 * @param[in] exit_code the value to call exit(3) with 468 * @param[in] fmt the death rattle message 469 * @param[in] ap the argument list for the message 470 * @noreturn 471 */ 472void 473vdie(int exit_code, char const * fmt, va_list ap) 474{ 475 char const * die_leader = _("uudecode fatal error:\n"); 476 fputs(die_leader, stderr); 477 vfprintf(stderr, fmt, ap); 478 fflush(stderr); 479 exit(exit_code); 480 /* NOTREACHED */ 481} 482 483/** 484 * Print a fatal error message and die, var-arg style. 485 * 486 * @param[in] exit_code the value to call exit(3) with 487 * @param[in] fmt the death rattle message 488 * @param[in] ... the list of arguments for the message 489 * @noreturn 490 */ 491void 492die(int exit_code, char const * fmt, ...) 493{ 494 va_list ap; 495 va_start(ap, fmt); 496 vdie(exit_code, fmt, ap); 497 /* NOTREACHED */ 498 va_end(ap); 499} 500 501/** 502 * Print a file system error fatal error message and die. 503 * 504 * @param[in] exit_code the value to call exit(3) with. 505 * @param[in] op the operation that failed. 506 * @param[in] fname the file name the operation was on. 507 * @noreturn 508 */ 509void 510fserr(int exit_code, char const * op, char const * fname) 511{ 512 char const * fserr_fmt = _("fserr %d (%s) performing '%s' on %s\n"); 513 die(exit_code, fserr_fmt, errno, strerror(errno), op, fname); 514 /* NOTREACHED */ 515} 516 517/** 518 * The directory containing the data associated with uudecode. 519 */ 520#ifndef PKGDATADIR 521# define PKGDATADIR "" 522#endif 523 524/** 525 * Information about the person or institution that packaged uudecode 526 * for the current distribution. 527 */ 528#ifndef WITH_PACKAGER 529# define uudecode_packager_info NULL 530#else 531/** Packager information for uudecode. */ 532static char const uudecode_packager_info[] = 533 "Packaged by " WITH_PACKAGER 534 535# ifdef WITH_PACKAGER_VERSION 536 " ("WITH_PACKAGER_VERSION")" 537# endif 538 539# ifdef WITH_PACKAGER_BUG_REPORTS 540 "\nReport uudecode bugs to " WITH_PACKAGER_BUG_REPORTS 541# endif 542 "\n"; 543#endif 544#ifndef __doxygen__ 545 546#endif /* __doxygen__ */ 547/** 548 * The option definitions for uudecode. The one structure that 549 * binds them all. 550 */ 551tOptions uudecodeOptions = { 552 OPTIONS_STRUCT_VERSION, 553 0, NULL, /* original argc + argv */ 554 ( OPTPROC_BASE 555 + OPTPROC_ERRSTOP 556 + OPTPROC_SHORTOPT 557 + OPTPROC_LONGOPT 558 + OPTPROC_NO_REQ_OPT 559 + OPTPROC_GNUUSAGE 560 + OPTPROC_MISUSE ), 561 0, NULL, /* current option index, current option */ 562 NULL, NULL, zPROGNAME, 563 zRcName, zCopyright, zLicenseDescrip, 564 zFullVersion, apzHomeList, zUsageTitle, 565 zExplain, zDetail, optDesc, 566 zBugsAddr, /* address to send bugs to */ 567 NULL, NULL, /* extensions/saved state */ 568 optionUsage, /* usage procedure */ 569 translate_option_strings, /* translation procedure */ 570 /* 571 * Indexes to special options 572 */ 573 { INDEX_OPT_MORE_HELP, /* more-help option index */ 574 INDEX_OPT_SAVE_OPTS, /* save option index */ 575 NO_EQUIVALENT, /* '-#' option index */ 576 NO_EQUIVALENT /* index of default opt */ 577 }, 578 7 /* full option count */, 2 /* user option count */, 579 uudecode_full_usage, uudecode_short_usage, 580 NULL, NULL, 581 PKGDATADIR, uudecode_packager_info 582}; 583 584#if ENABLE_NLS 585/** 586 * This code is designed to translate translatable option text for the 587 * uudecode program. These translations happen upon entry 588 * to optionProcess(). 589 */ 590#include <stdio.h> 591#include <stdlib.h> 592#include <string.h> 593#include <unistd.h> 594#ifdef HAVE_DCGETTEXT 595# include <gettext.h> 596#endif 597#include <autoopts/usage-txt.h> 598 599static char * AO_gettext(char const * pz); 600static void coerce_it(void ** s); 601 602/** 603 * AutoGen specific wrapper function for gettext. It relies on the macro _() 604 * to convert from English to the target language, then strdup-duplicates the 605 * result string. It tries the "libopts" domain first, then whatever has been 606 * set via the \a textdomain(3) call. 607 * 608 * @param[in] pz the input text used as a lookup key. 609 * @returns the translated text (if there is one), 610 * or the original text (if not). 611 */ 612static char * 613AO_gettext(char const * pz) 614{ 615 char * res; 616 if (pz == NULL) 617 return NULL; 618#ifdef HAVE_DCGETTEXT 619 /* 620 * While processing the option_xlateable_txt data, try to use the 621 * "libopts" domain. Once we switch to the option descriptor data, 622 * do *not* use that domain. 623 */ 624 if (option_xlateable_txt.field_ct != 0) { 625 res = dgettext("libopts", pz); 626 if (res == pz) 627 res = (char *)VOIDP(_(pz)); 628 } else 629 res = (char *)VOIDP(_(pz)); 630#else 631 res = (char *)VOIDP(_(pz)); 632#endif 633 if (res == pz) 634 return res; 635 res = strdup(res); 636 if (res == NULL) { 637 fputs(_("No memory for duping translated strings\n"), stderr); 638 exit(UUDECODE_EXIT_NO_MEM); 639 } 640 return res; 641} 642 643/** 644 * All the pointers we use are marked "* const", but they are stored in 645 * writable memory. Coerce the mutability and set the pointer. 646 */ 647static void coerce_it(void ** s) { *s = AO_gettext(*s); 648} 649 650/** 651 * Translate all the translatable strings in the uudecodeOptions 652 * structure defined above. This is done only once. 653 */ 654static void 655translate_option_strings(void) 656{ 657 tOptions * const opts = &uudecodeOptions; 658 659 /* 660 * Guard against re-translation. It won't work. The strings will have 661 * been changed by the first pass through this code. One shot only. 662 */ 663 if (option_xlateable_txt.field_ct != 0) { 664 /* 665 * Do the translations. The first pointer follows the field count 666 * field. The field count field is the size of a pointer. 667 */ 668 char ** ppz = (char**)VOIDP(&(option_xlateable_txt)); 669 int ix = option_xlateable_txt.field_ct; 670 671 do { 672 ppz++; /* skip over field_ct */ 673 *ppz = AO_gettext(*ppz); 674 } while (--ix > 0); 675 /* prevent re-translation and disable "libopts" domain lookup */ 676 option_xlateable_txt.field_ct = 0; 677 678 coerce_it(VOIDP(&(opts->pzCopyright))); 679 coerce_it(VOIDP(&(opts->pzCopyNotice))); 680 coerce_it(VOIDP(&(opts->pzFullVersion))); 681 } 682} 683#endif /* ENABLE_NLS */ 684 685#ifdef DO_NOT_COMPILE_THIS_CODE_IT_IS_FOR_GETTEXT 686/** I18N function strictly for xgettext. Do not compile. */ 687static void bogus_function(void) { 688 /* TRANSLATORS: 689 690 The following dummy function was crated solely so that xgettext can 691 extract the correct strings. These strings are actually referenced 692 by a field name in the uudecodeOptions structure noted in the 693 comments below. The literal text is defined in uudecode_opt_strs. 694 695 NOTE: the strings below are segmented with respect to the source string 696 uudecode_opt_strs. The strings above are handed off for translation 697 at run time a paragraph at a time. Consequently, they are presented here 698 for translation a paragraph at a time. 699 700 ALSO: often the description for an option will reference another option 701 by name. These are set off with apostrophe quotes (I hope). Do not 702 translate option names. 703 */ 704 /* referenced via uudecodeOptions.pzCopyright */ 705 puts(_("uudecode (GNU sharutils) 4.15.2\n\ 706Copyright (C) 1994-2015 Free Software Foundation, Inc., all rights reserved.\n\ 707This is free software. It is licensed for use, modification and\n\ 708redistribution under the terms of the GNU General Public License,\n\ 709version 3 or later <http://gnu.org/licenses/gpl.html>\n")); 710 711 /* referenced via uudecodeOptions.pzCopyNotice */ 712 puts(_("uudecode is free software: you can redistribute it and/or modify it under\n\ 713the terms of the GNU General Public License as published by the Free\n\ 714Software Foundation, either version 3 of the License, or (at your option)\n\ 715any later version.\n\n")); 716 puts(_("uudecode is distributed in the hope that it will be useful, but WITHOUT ANY\n\ 717WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS\n\ 718FOR A PARTICULAR PURPOSE. See the GNU General Public License for more\n\ 719details.\n\n")); 720 puts(_("You should have received a copy of the GNU General Public License along\n\ 721with this program. If not, see <http://www.gnu.org/licenses/>.\n")); 722 723 /* referenced via uudecodeOptions.pzUsageTitle */ 724 puts(_("uudecode (GNU sharutils) - decode an encoded file\n\ 725Usage: %s [ -<flag> [<val>] | --<name>[{=| }<val>] ]... [<file>...]\n")); 726 727 /* referenced via uudecodeOptions.pzExplain */ 728 puts(_("If no 'file'(s) are provided, then standard input is decoded.\n")); 729 730 /* referenced via uudecodeOptions.pzDetail */ 731 puts(_("'uudecode' transforms uuencoded files into their original form.\n\n")); 732 puts(_("The encoded file(s) may be specified on the command line, or one may be\n\ 733read from standard input. The output file name is specified in the encoded\n\ 734file, but may be overridden with the '-o' option. It will have the mode of\n\ 735the original file, except that setuid and execute bits are not retained. If\n\ 736the output file is specified to be '/dev/stdout' or '-', the result will be\n\ 737written to standard output. If there are multiple input files and the\n\ 738second or subsquent file specifies standard output, the decoded data will\n\ 739be written to the same file as the previous output. Don't do that.\n\n")); 740 puts(_("'uudecode' ignores any leading and trailing lines. It looks for a line\n\ 741that starts with \"'begin'\" and proceeds until the end-of-encoding marker is\n\ 742found. The program determines from the header line of the encoded file\n\ 743which of the two supported encoding schemes was used and whether or not the\n\ 744output file name has been encoded with base64 encoding. See 'uuencode(5)'.\n")); 745 746 /* referenced via uudecodeOptions.pzFullVersion */ 747 puts(_("uudecode (GNU sharutils) 4.15.2")); 748 749 /* referenced via uudecodeOptions.pzFullUsage */ 750 puts(_("uudecode (GNU sharutils) - decode an encoded file\n\ 751Usage: uudecode [ -<flag> [<val>] | --<name>[{=| }<val>] ]... [<file>...]\n\n")); 752 puts(_(" -o, --output-file=str direct output to file\n")); 753 puts(_(" -c, --ignore-chmod ignore fchmod(3P) errors\n")); 754 puts(_(" -v, --version[=MODE] output version information and exit\n")); 755 puts(_(" -h, --help display extended usage information and exit\n")); 756 puts(_(" -!, --more-help extended usage information passed thru pager\n")); 757 puts(_(" -R, --save-opts[=FILE] save the option state to a config file FILE\n")); 758 puts(_(" -r, --load-opts=FILE load options from the config file FILE\n\ 759 - disabled with '--no-load-opts'\n\ 760 - may appear multiple times\n\n")); 761 puts(_("Options are specified by doubled hyphens and their name or by a single\n\ 762hyphen and the flag character.\n\ 763If no 'file'(s) are provided, then standard input is decoded.\n\n")); 764 puts(_("The following option preset mechanisms are supported:\n")); 765 puts(_(" - reading file $HOME/.sharrc\n\n\ 766'uudecode' transforms uuencoded files into their original form.\n\n")); 767 puts(_("The encoded file(s) may be specified on the command line, or one may be\n\ 768read from standard input. The output file name is specified in the encoded\n\ 769file, but may be overridden with the '-o' option. It will have the mode of\n\ 770the original file, except that setuid and execute bits are not retained. If\n\ 771the output file is specified to be '/dev/stdout' or '-', the result will be\n\ 772written to standard output. If there are multiple input files and the\n\ 773second or subsquent file specifies standard output, the decoded data will\n\ 774be written to the same file as the previous output. Don't do that.\n\n")); 775 puts(_("'uudecode' ignores any leading and trailing lines. It looks for a line\n\ 776that starts with \"'begin'\" and proceeds until the end-of-encoding marker is\n\ 777found. The program determines from the header line of the encoded file\n\ 778which of the two supported encoding schemes was used and whether or not the\n\ 779output file name has been encoded with base64 encoding. See 'uuencode(5)'.\n\n")); 780 puts(_("Please send bug reports to: <bug-gnu-utils@gnu.org>\n")); 781 782 /* referenced via uudecodeOptions.pzShortUsage */ 783 puts(_("uudecode (GNU sharutils) - decode an encoded file\n\ 784Usage: uudecode [ -<flag> [<val>] | --<name>[{=| }<val>] ]... [<file>...]\n\ 785Try 'uudecode --help' for more information.\n")); 786 /* LIBOPTS-MESSAGES: */ 787#line 67 "../autoopts.c" 788 puts(_("allocation of %d bytes failed\n")); 789#line 93 "../autoopts.c" 790 puts(_("allocation of %d bytes failed\n")); 791#line 53 "../init.c" 792 puts(_("AutoOpts function called without option descriptor\n")); 793#line 86 "../init.c" 794 puts(_("\tThis exceeds the compiled library version: ")); 795#line 84 "../init.c" 796 puts(_("Automated Options Processing Error!\n" 797 "\t%s called AutoOpts function with structure version %d:%d:%d.\n")); 798#line 80 "../autoopts.c" 799 puts(_("realloc of %d bytes at 0x%p failed\n")); 800#line 88 "../init.c" 801 puts(_("\tThis is less than the minimum library version: ")); 802#line 121 "../version.c" 803 puts(_("Automated Options version %s\n" 804 "\tCopyright (C) 1999-2014 by Bruce Korb - all rights reserved\n")); 805#line 87 "../makeshell.c" 806 puts(_("(AutoOpts bug): %s.\n")); 807#line 90 "../reset.c" 808 puts(_("optionResetOpt() called, but reset-option not configured")); 809#line 292 "../usage.c" 810 puts(_("could not locate the 'help' option")); 811#line 336 "../autoopts.c" 812 puts(_("optionProcess() was called with invalid data")); 813#line 748 "../usage.c" 814 puts(_("invalid argument type specified")); 815#line 598 "../find.c" 816 puts(_("defaulted to option with optional arg")); 817#line 76 "../alias.c" 818 puts(_("aliasing option is out of range.")); 819#line 234 "../enum.c" 820 puts(_("%s error: the keyword '%s' is ambiguous for %s\n")); 821#line 108 "../find.c" 822 puts(_(" The following options match:\n")); 823#line 293 "../find.c" 824 puts(_("%s: ambiguous option name: %s (matches %d options)\n")); 825#line 161 "../check.c" 826 puts(_("%s: Command line arguments required\n")); 827#line 43 "../alias.c" 828 puts(_("%d %s%s options allowed\n")); 829#line 94 "../makeshell.c" 830 puts(_("%s error %d (%s) calling %s for '%s'\n")); 831#line 306 "../makeshell.c" 832 puts(_("interprocess pipe")); 833#line 168 "../version.c" 834 puts(_("error: version option argument '%c' invalid. Use:\n" 835 "\t'v' - version only\n" 836 "\t'c' - version and copyright\n" 837 "\t'n' - version and full copyright notice\n")); 838#line 58 "../check.c" 839 puts(_("%s error: the '%s' and '%s' options conflict\n")); 840#line 217 "../find.c" 841 puts(_("%s: The '%s' option has been disabled.")); 842#line 430 "../find.c" 843 puts(_("%s: The '%s' option has been disabled.")); 844#line 38 "../alias.c" 845 puts(_("-equivalence")); 846#line 469 "../find.c" 847 puts(_("%s: illegal option -- %c\n")); 848#line 110 "../reset.c" 849 puts(_("%s: illegal option -- %c\n")); 850#line 271 "../find.c" 851 puts(_("%s: illegal option -- %s\n")); 852#line 755 "../find.c" 853 puts(_("%s: illegal option -- %s\n")); 854#line 118 "../reset.c" 855 puts(_("%s: illegal option -- %s\n")); 856#line 335 "../find.c" 857 puts(_("%s: unknown vendor extension option -- %s\n")); 858#line 159 "../enum.c" 859 puts(_(" or an integer from %d through %d\n")); 860#line 169 "../enum.c" 861 puts(_(" or an integer from %d through %d\n")); 862#line 747 "../usage.c" 863 puts(_("%s error: invalid option descriptor for %s\n")); 864#line 1081 "../usage.c" 865 puts(_("%s error: invalid option descriptor for %s\n")); 866#line 385 "../find.c" 867 puts(_("%s: invalid option name: %s\n")); 868#line 527 "../find.c" 869 puts(_("%s: The '%s' option requires an argument.\n")); 870#line 156 "../autoopts.c" 871 puts(_("(AutoOpts bug): Equivalenced option '%s' was equivalenced to both\n" 872 "\t'%s' and '%s'.")); 873#line 94 "../check.c" 874 puts(_("%s error: The %s option is required\n")); 875#line 632 "../find.c" 876 puts(_("%s: The '%s' option cannot have an argument.\n")); 877#line 151 "../check.c" 878 puts(_("%s: Command line arguments are not allowed.\n")); 879#line 535 "../save.c" 880 puts(_("error %d (%s) creating %s\n")); 881#line 234 "../enum.c" 882 puts(_("%s error: '%s' does not match any %s keywords.\n")); 883#line 93 "../reset.c" 884 puts(_("%s error: The '%s' option requires an argument.\n")); 885#line 184 "../save.c" 886 puts(_("error %d (%s) stat-ing %s\n")); 887#line 238 "../save.c" 888 puts(_("error %d (%s) stat-ing %s\n")); 889#line 143 "../restore.c" 890 puts(_("%s error: no saved option state\n")); 891#line 231 "../autoopts.c" 892 puts(_("'%s' is not a command line option.\n")); 893#line 111 "../time.c" 894 puts(_("%s error: '%s' is not a recognizable date/time.\n")); 895#line 132 "../save.c" 896 puts(_("'%s' not defined\n")); 897#line 50 "../time.c" 898 puts(_("%s error: '%s' is not a recognizable time duration.\n")); 899#line 92 "../check.c" 900 puts(_("%s error: The %s option must appear %d times.\n")); 901#line 164 "../numeric.c" 902 puts(_("%s error: '%s' is not a recognizable number.\n")); 903#line 200 "../enum.c" 904 puts(_("%s error: %s exceeds %s keyword count\n")); 905#line 330 "../usage.c" 906 puts(_("Try '%s %s' for more information.\n")); 907#line 45 "../alias.c" 908 puts(_("one %s%s option allowed\n")); 909#line 208 "../makeshell.c" 910 puts(_("standard output")); 911#line 943 "../makeshell.c" 912 puts(_("standard output")); 913#line 274 "../usage.c" 914 puts(_("standard output")); 915#line 415 "../usage.c" 916 puts(_("standard output")); 917#line 625 "../usage.c" 918 puts(_("standard output")); 919#line 175 "../version.c" 920 puts(_("standard output")); 921#line 274 "../usage.c" 922 puts(_("standard error")); 923#line 415 "../usage.c" 924 puts(_("standard error")); 925#line 625 "../usage.c" 926 puts(_("standard error")); 927#line 175 "../version.c" 928 puts(_("standard error")); 929#line 208 "../makeshell.c" 930 puts(_("write")); 931#line 943 "../makeshell.c" 932 puts(_("write")); 933#line 273 "../usage.c" 934 puts(_("write")); 935#line 414 "../usage.c" 936 puts(_("write")); 937#line 624 "../usage.c" 938 puts(_("write")); 939#line 174 "../version.c" 940 puts(_("write")); 941#line 60 "../numeric.c" 942 puts(_("%s error: %s option value %ld is out of range.\n")); 943#line 44 "../check.c" 944 puts(_("%s error: %s option requires the %s option\n")); 945#line 131 "../save.c" 946 puts(_("%s warning: cannot save options - %s not regular file\n")); 947#line 183 "../save.c" 948 puts(_("%s warning: cannot save options - %s not regular file\n")); 949#line 237 "../save.c" 950 puts(_("%s warning: cannot save options - %s not regular file\n")); 951#line 256 "../save.c" 952 puts(_("%s warning: cannot save options - %s not regular file\n")); 953#line 534 "../save.c" 954 puts(_("%s warning: cannot save options - %s not regular file\n")); 955 /* END-LIBOPTS-MESSAGES */ 956} 957#endif /* uncompilable code */ 958#ifdef __cplusplus 959} 960#endif 961/* uudecode-opts.c ends here */ 962