~ubuntu-branches/ubuntu/natty/ntp/natty

« back to all changes in this revision

Viewing changes to libopts/genshell.c

  • Committer: Bazaar Package Importer
  • Author(s): Chuck Short
  • Date: 2010-11-30 11:14:31 UTC
  • mfrom: (4.1.7 squeeze)
  • Revision ID: james.westby@ubuntu.com-20101130111431-7r00o0ck9qzwmm9f
Tags: 1:4.2.6.p2+dfsg-1ubuntu1
* Merge from debian unstable, remaining changes are:
  + debian/ntp.conf, debian/ntpdate.default: Change default server to
    ntp.ubuntu.com.
  + debian/ntpdate.ifup: Stop ntp before running ntpdate when an interface
    comes up, then start again afterwards.
  + debian/ntp.init, debian/rules: Only stop when entering single user mode.
  + Add enforcing AppArmor profile (LP: #382905):
    - debian/control: add Conflicts/Replaces on apparmor-profiles <
      2.3.1+1403-0ubuntu10 (since we are now shipping usr.sbin.ntpd) and
      apparmor < 2.3.1+1403-0ubuntu10 (since we are now shipping tunables/ntpd)
    - debian/control: add Suggests on apparmor
    - debian/ntp.dirs: add apparmor directories
    - debian/ntp.preinst: force complain on certain upgrades
    - debian/ntp.postinst: reload apparmor profile
    - debian/ntp.postrm: remove the force-complain file
    - add debian/apparmor-profile*
    - debian/rules: install apparmor-profile and apparmor-profile.tunable
    - debian/README.Debian: add note on AppArmor
  + debian/{control,rules}: add and enable hardened build for PIE
    (Debian bug 542721).
  + debian/apparmor-profile: adjust location of drift files (LP: #456308)
  + debian/rules, debian/ntp.dirs, debian/source_ntp.py: Add apport hook.

Show diffs side-by-side

added added

removed removed

Lines of Context:
2
2
 *  
3
3
 *  DO NOT EDIT THIS FILE   (genshell.c)
4
4
 *  
5
 
 *  It has been AutoGen-ed  Saturday May  5, 2007 at 12:02:35 PM PDT
 
5
 *  It has been AutoGen-ed  November  8, 2009 at 08:41:09 AM by AutoGen 5.9.10pre13
6
6
 *  From the definitions    genshell.def
7
7
 *  and the template file   options
8
8
 *
9
 
 * Generated from AutoOpts 29:0:4 templates.
 
9
 * Generated from AutoOpts @AO_CURRENT@:@AO_REVISION@:@AO_AGE@ templates.
10
10
 */
11
11
 
12
12
/*
20
20
 *
21
21
 * This source file is copyrighted and licensed under the following terms:
22
22
 *
23
 
 * genshellopt copyright 1999-2007 Bruce Korb - all rights reserved
 
23
 * genshellopt copyright (c) 1999-2009 Bruce Korb - all rights reserved
24
24
 *
25
 
 * genshellopt is free software; you can redistribute it and/or
26
 
 * modify it under the terms of the GNU Lesser General Public
27
 
 * License as published by the Free Software Foundation; either
28
 
 * version 2.1 of the License, or (at your option) any later version.
29
 
 * 
30
 
 * genshellopt is distributed in the hope that it will be useful,
31
 
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
32
 
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
33
 
 * Lesser General Public License for more details.
34
 
 * 
35
 
 * You should have received a copy of the GNU Lesser General Public
36
 
 * License along with genshellopt.  If not, write to:
37
 
 *      The Free Software Foundation, Inc.,
38
 
 *      51 Franklin Street, Fifth Floor
39
 
 *      Boston, MA  02110-1301, USA.
 
25
 * genshellopt is free software: you can redistribute it and/or modify it
 
26
 * under the terms of the GNU General Public License as published by the
 
27
 * Free Software Foundation, either version 3 of the License, or
 
28
 * (at your option) any later version.
 
29
 * 
 
30
 * genshellopt is distributed in the hope that it will be useful, but
 
31
 * WITHOUT ANY WARRANTY; without even the implied warranty of
 
32
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 
33
 * See the GNU General Public License for more details.
 
34
 * 
 
35
 * You should have received a copy of the GNU General Public License along
 
36
 * with this program.  If not, see <http://www.gnu.org/licenses/>.
40
37
 */
41
38
 
42
 
 
 
39
#include <sys/types.h>
43
40
#include <limits.h>
 
41
#include <stdio.h>
 
42
#include <stdlib.h>
44
43
 
45
44
#define OPTION_CODE_COMPILE 1
46
45
#include "genshell.h"
48
47
#ifdef  __cplusplus
49
48
extern "C" {
50
49
#endif
 
50
 
 
51
/* TRANSLATORS: choose the translation for option names wisely because you
 
52
                cannot ever change your mind. */
51
53
tSCC zCopyright[] =
52
 
       "genshellopt copyright (c) 1999-2007 Bruce Korb, all rights reserved";
53
 
tSCC zCopyrightNotice[] =
54
 
       "genshellopt is free software; you can redistribute it and/or\n\
55
 
modify it under the terms of the GNU Lesser General Public\n\
56
 
License as published by the Free Software Foundation; either\n\
57
 
version 2.1 of the License, or (at your option) any later version.\n\n\
58
 
genshellopt is distributed in the hope that it will be useful,\n\
59
 
but WITHOUT ANY WARRANTY; without even the implied warranty of\n\
60
 
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n\
61
 
Lesser General Public License for more details.\n\n\
62
 
You should have received a copy of the GNU Lesser General Public\n\
63
 
License along with genshellopt.  If not, write to:\n\
64
 
\tThe Free Software Foundation, Inc.,\n\
65
 
\t51 Franklin Street, Fifth Floor\n\
66
 
\tBoston, MA  02110-1301, USA.";
 
54
       "genshellopt copyright (c) 1999-2009 Bruce Korb, all rights reserved";
 
55
tSCC zCopyrightNotice[610] =
 
56
"genshellopt is free software: you can redistribute it and/or modify it under\n\
 
57
the terms of the GNU General Public License as published by the Free Software\n\
 
58
Foundation, either version 3 of the License, or (at your option) any later\n\
 
59
version.\n\n\
 
60
genshellopt is distributed in the hope that it will be useful, but WITHOUT ANY\n\
 
61
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A\n\
 
62
PARTICULAR PURPOSE.  See the GNU General Public License for more details.\n\n\
 
63
You should have received a copy of the GNU General Public License along with\n\
 
64
this program.  If not, see <http://www.gnu.org/licenses/>.";
 
65
 
67
66
extern tUsageProc genshelloptUsage;
68
67
 
69
68
#ifndef NULL
75
74
#ifndef EXIT_FAILURE
76
75
#  define  EXIT_FAILURE 1
77
76
#endif
 
77
 
78
78
/*
79
79
 *  Script option description:
80
80
 */
100
100
/*
101
101
 *  Help/More_Help/Version option descriptions:
102
102
 */
103
 
tSCC zHelpText[]       = "Display usage information and exit";
104
 
tSCC zHelp_Name[]      = "help";
105
 
 
106
 
tSCC zMore_HelpText[]  = "Extended usage information passed thru pager";
107
 
tSCC zMore_Help_Name[] = "more-help";
108
 
 
109
 
tSCC zVersionText[]    = "Output version information and exit";
110
 
tSCC zVersion_Name[]   = "version";
 
103
tSCC zHelpText[]          = "Display extended usage information and exit";
 
104
tSCC zHelp_Name[]         = "help";
 
105
#ifdef HAVE_WORKING_FORK
 
106
#define OPTST_MORE_HELP_FLAGS   (OPTST_IMM | OPTST_NO_INIT)
 
107
tSCC zMore_Help_Name[]    = "more-help";
 
108
tSCC zMore_HelpText[]     = "Extended usage information passed thru pager";
 
109
#else
 
110
#define OPTST_MORE_HELP_FLAGS   (OPTST_OMITTED | OPTST_NO_INIT)
 
111
#define zMore_Help_Name   NULL
 
112
#define zMore_HelpText    NULL
 
113
#endif
 
114
#ifdef NO_OPTIONAL_OPT_ARGS
 
115
#  define OPTST_VERSION_FLAGS   OPTST_IMM | OPTST_NO_INIT
 
116
#else
 
117
#  define OPTST_VERSION_FLAGS   OPTST_SET_ARGTYPE(OPARG_TYPE_STRING) | \
 
118
                                OPTST_ARG_OPTIONAL | OPTST_IMM | OPTST_NO_INIT
 
119
#endif
 
120
 
 
121
tSCC zVersionText[]       = "Output version information and exit";
 
122
tSCC zVersion_Name[]      = "version";
111
123
/*
112
124
 *  Declare option callback procedures
113
125
 */
145
157
     /* desc, NAME, name */ zShellText, zShell_NAME, zShell_Name,
146
158
     /* disablement strs */ zNotShell_Name, zNotShell_Pfx },
147
159
 
148
 
#ifdef NO_OPTIONAL_OPT_ARGS
149
 
#  define VERSION_OPT_FLAGS     OPTST_IMM | OPTST_NO_INIT
150
 
#else
151
 
#  define VERSION_OPT_FLAGS     OPTST_SET_ARGTYPE(OPARG_TYPE_STRING) | \
152
 
                                OPTST_ARG_OPTIONAL | OPTST_IMM | OPTST_NO_INIT
153
 
#endif
154
 
 
155
160
  {  /* entry idx, value */ INDEX_OPT_VERSION, VALUE_OPT_VERSION,
156
161
     /* equiv idx value  */ NO_EQUIVALENT, 0,
157
162
     /* equivalenced to  */ NO_EQUIVALENT,
158
163
     /* min, max, act ct */ 0, 1, 0,
159
 
     /* opt state flags  */ VERSION_OPT_FLAGS, 0,
 
164
     /* opt state flags  */ OPTST_VERSION_FLAGS, 0,
160
165
     /* last opt argumnt */ { NULL },
161
166
     /* arg list/cookie  */ NULL,
162
167
     /* must/cannot opts */ NULL, NULL,
164
169
     /* desc, NAME, name */ zVersionText, NULL, zVersion_Name,
165
170
     /* disablement strs */ NULL, NULL },
166
171
 
167
 
#undef VERSION_OPT_FLAGS
168
172
 
169
173
 
170
174
  {  /* entry idx, value */ INDEX_OPT_HELP, VALUE_OPT_HELP,
183
187
     /* equiv idx value  */ NO_EQUIVALENT, 0,
184
188
     /* equivalenced to  */ NO_EQUIVALENT,
185
189
     /* min, max, act ct */ 0, 1, 0,
186
 
     /* opt state flags  */ OPTST_IMM | OPTST_NO_INIT, 0,
 
190
     /* opt state flags  */ OPTST_MORE_HELP_FLAGS, 0,
187
191
     /* last opt argumnt */ { NULL },
188
192
     /* arg list/cookie  */ NULL,
189
193
     /* must/cannot opts */ NULL,  NULL,
213
217
text, the second line of the file through the ending tag will be replaced\n\
214
218
by the newly generated text.  The first `#!' line will be regenerated.\n";
215
219
tSCC    zFullVersion[] = GENSHELLOPT_FULL_VERSION;
216
 
/* extracted from optcode.tpl near line 408 */
 
220
/* extracted from optcode.tpl near line 495 */
217
221
 
218
222
#if defined(ENABLE_NLS)
219
223
# define OPTPROC_BASE OPTPROC_TRANSLATE
223
227
# define translate_option_strings NULL
224
228
#endif /* ENABLE_NLS */
225
229
 
 
230
 
 
231
#define genshellopt_full_usage NULL
 
232
#define genshellopt_short_usage NULL
226
233
tOptions genshelloptOptions = {
227
234
    OPTIONS_STRUCT_VERSION,
228
235
    0, NULL,                    /* original argc + argv    */
245
252
    /*
246
253
     *  Indexes to special options
247
254
     */
248
 
    { INDEX_OPT_MORE_HELP,
249
 
       0 /* no option state saving */,
250
 
      NO_EQUIVALENT /* index of '-#' option */,
 
255
    { INDEX_OPT_MORE_HELP, /* more-help option index */
 
256
      NO_EQUIVALENT, /* save option index */
 
257
      NO_EQUIVALENT, /* '-#' option index */
251
258
      NO_EQUIVALENT /* index of default opt */
252
259
    },
253
 
    5 /* full option count */, 2 /* user option count */
 
260
    5 /* full option count */, 2 /* user option count */,
 
261
    genshellopt_full_usage, genshellopt_short_usage,
 
262
    NULL, NULL
254
263
};
255
264
 
256
265
/*
261
270
    tOptions*   pOptions,
262
271
    tOptDesc*   pOptDesc )
263
272
{
 
273
    (void)pOptions;
264
274
    USAGE( EXIT_SUCCESS );
265
275
}
266
 
/* extracted from optcode.tpl near line 514 */
 
276
/* extracted from optcode.tpl near line 627 */
267
277
 
268
278
#if ENABLE_NLS
269
279
#include <stdio.h>
306
316
     *  Guard against re-translation.  It won't work.  The strings will have
307
317
     *  been changed by the first pass through this code.  One shot only.
308
318
     */
309
 
    if (option_usage_text.field_ct == 0)
310
 
        return;
311
 
    /*
312
 
     *  Do the translations.  The first pointer follows the field count field.
313
 
     *  The field count field is the size of a pointer.
314
 
     */
315
 
    {
316
 
        char** ppz = (char**)(void*)&(option_usage_text);
317
 
        int    ix  = option_usage_text.field_ct;
 
319
    if (option_usage_text.field_ct != 0) {
 
320
 
 
321
        /*
 
322
         *  Do the translations.  The first pointer follows the field count
 
323
         *  field.  The field count field is the size of a pointer.
 
324
         */
 
325
        tOptDesc* pOD = genshelloptOptions.pOptDesc;
 
326
        char**    ppz = (char**)(void*)&(option_usage_text);
 
327
        int       ix  = option_usage_text.field_ct;
318
328
 
319
329
        do {
320
330
            ppz++;
321
331
            *ppz = AO_gettext(*ppz);
322
332
        } while (--ix > 0);
 
333
 
 
334
        COERSION(pzCopyright);
 
335
        COERSION(pzCopyNotice);
 
336
        COERSION(pzFullVersion);
 
337
        COERSION(pzUsageTitle);
 
338
        COERSION(pzExplain);
 
339
        COERSION(pzDetail);
 
340
        option_usage_text.field_ct = 0;
 
341
 
 
342
        for (ix = genshelloptOptions.optCt; ix > 0; ix--, pOD++)
 
343
            coerce_it((void*)&(pOD->pzText));
323
344
    }
324
 
    option_usage_text.field_ct = 0;
325
345
 
326
 
    {
 
346
    if ((genshelloptOptions.fOptSet & OPTPROC_NXLAT_OPT_CFG) == 0) {
327
347
        tOptDesc* pOD = genshelloptOptions.pOptDesc;
328
 
        int       ix  = genshelloptOptions.optCt;
 
348
        int       ix;
329
349
 
330
 
        for (;;) {
331
 
            pOD->pzText           = AO_gettext(pOD->pzText);
332
 
            pOD->pz_NAME          = AO_gettext(pOD->pz_NAME);
333
 
            pOD->pz_Name          = AO_gettext(pOD->pz_Name);
334
 
            pOD->pz_DisableName   = AO_gettext(pOD->pz_DisableName);
335
 
            pOD->pz_DisablePfx    = AO_gettext(pOD->pz_DisablePfx);
336
 
            if (--ix <= 0)
337
 
                break;
338
 
            pOD++;
 
350
        for (ix = genshelloptOptions.optCt; ix > 0; ix--, pOD++) {
 
351
            coerce_it((void*)&(pOD->pz_Name));
 
352
            coerce_it((void*)&(pOD->pz_DisableName));
 
353
            coerce_it((void*)&(pOD->pz_DisablePfx));
339
354
        }
 
355
        /* prevent re-translation */
 
356
        genshelloptOptions.fOptSet |= OPTPROC_NXLAT_OPT_CFG | OPTPROC_NXLAT_OPT;
340
357
    }
341
 
    COERSION(pzCopyright);
342
 
    COERSION(pzCopyNotice);
343
 
    COERSION(pzFullVersion);
344
 
    COERSION(pzUsageTitle);
345
 
    COERSION(pzExplain);
346
 
    COERSION(pzDetail);
347
358
}
348
359
 
349
360
#endif /* ENABLE_NLS */