1*0Sstevel@tonic-gate /* 2*0Sstevel@tonic-gate * CDDL HEADER START 3*0Sstevel@tonic-gate * 4*0Sstevel@tonic-gate * The contents of this file are subject to the terms of the 5*0Sstevel@tonic-gate * Common Development and Distribution License, Version 1.0 only 6*0Sstevel@tonic-gate * (the "License"). You may not use this file except in compliance 7*0Sstevel@tonic-gate * with the License. 8*0Sstevel@tonic-gate * 9*0Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 10*0Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 11*0Sstevel@tonic-gate * See the License for the specific language governing permissions 12*0Sstevel@tonic-gate * and limitations under the License. 13*0Sstevel@tonic-gate * 14*0Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 15*0Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 16*0Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 17*0Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 18*0Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 19*0Sstevel@tonic-gate * 20*0Sstevel@tonic-gate * CDDL HEADER END 21*0Sstevel@tonic-gate */ 22*0Sstevel@tonic-gate /* 23*0Sstevel@tonic-gate * Copyright (c) 1995 by Sun Microsystems, Inc. 24*0Sstevel@tonic-gate * All rights reserved. 25*0Sstevel@tonic-gate */ 26*0Sstevel@tonic-gate 27*0Sstevel@tonic-gate #pragma ident "%Z%%M% %I% %E% SMI" 28*0Sstevel@tonic-gate 29*0Sstevel@tonic-gate #include <stdio.h> 30*0Sstevel@tonic-gate #include <limits.h> 31*0Sstevel@tonic-gate #include <stdlib.h> 32*0Sstevel@tonic-gate #include <string.h> 33*0Sstevel@tonic-gate #include <libgen.h> 34*0Sstevel@tonic-gate #include <libintl.h> 35*0Sstevel@tonic-gate #include <locale.h> 36*0Sstevel@tonic-gate #include <unistd.h> 37*0Sstevel@tonic-gate #include <sys/param.h> 38*0Sstevel@tonic-gate 39*0Sstevel@tonic-gate #include "genmsg.h" 40*0Sstevel@tonic-gate 41*0Sstevel@tonic-gate #define MSG_SUFFIX ".msg" 42*0Sstevel@tonic-gate #define NEW_SUFFIX ".new" 43*0Sstevel@tonic-gate 44*0Sstevel@tonic-gate #if !defined(TEXT_DOMAIN) 45*0Sstevel@tonic-gate #define TEXT_DOMAIN "genmsg" 46*0Sstevel@tonic-gate #endif 47*0Sstevel@tonic-gate 48*0Sstevel@tonic-gate /* 49*0Sstevel@tonic-gate * External functions. 50*0Sstevel@tonic-gate */ 51*0Sstevel@tonic-gate extern void write_msgfile(char *); /* from util.c */ 52*0Sstevel@tonic-gate extern int read_projfile(char *); /* from util.c */ 53*0Sstevel@tonic-gate extern void write_projfile(char *); /* from util.c */ 54*0Sstevel@tonic-gate extern void read_msgfile(char *); /* from util.c */ 55*0Sstevel@tonic-gate extern int is_writable(char *); /* from util.c */ 56*0Sstevel@tonic-gate extern int file_copy(char *, char *); /* from util.c */ 57*0Sstevel@tonic-gate extern void init_lex(void); /* from genmsg.l */ 58*0Sstevel@tonic-gate extern void init_linemsgid(void); /* from genmsg.l */ 59*0Sstevel@tonic-gate 60*0Sstevel@tonic-gate /* Program name. */ 61*0Sstevel@tonic-gate char *program; 62*0Sstevel@tonic-gate 63*0Sstevel@tonic-gate /* File pointer for auto-message-numbering. */ 64*0Sstevel@tonic-gate FILE *newfp = NULL; 65*0Sstevel@tonic-gate 66*0Sstevel@tonic-gate /* Input source file. */ 67*0Sstevel@tonic-gate char *srcfile; 68*0Sstevel@tonic-gate 69*0Sstevel@tonic-gate /* Tag for message comments. */ 70*0Sstevel@tonic-gate char *mctag = NULL; 71*0Sstevel@tonic-gate 72*0Sstevel@tonic-gate /* Tag for set number comments. */ 73*0Sstevel@tonic-gate char *sctag = NULL; 74*0Sstevel@tonic-gate 75*0Sstevel@tonic-gate /* Mode mask to define the genmsg tasks. */ 76*0Sstevel@tonic-gate Mode active_mode = NoMode; 77*0Sstevel@tonic-gate 78*0Sstevel@tonic-gate /* 79*0Sstevel@tonic-gate * This flag will be TRUE if a catgets() call is found 80*0Sstevel@tonic-gate * in the input file. 81*0Sstevel@tonic-gate */ 82*0Sstevel@tonic-gate int is_cat_found = FALSE; 83*0Sstevel@tonic-gate 84*0Sstevel@tonic-gate /* Suppress an error message if this flag is TRUE. */ 85*0Sstevel@tonic-gate int suppress_error = FALSE; 86*0Sstevel@tonic-gate 87*0Sstevel@tonic-gate /* Prefix and suffix of messages for testing. */ 88*0Sstevel@tonic-gate char *premsg = NULL; 89*0Sstevel@tonic-gate char *sufmsg = NULL; 90*0Sstevel@tonic-gate 91*0Sstevel@tonic-gate static void usage(void); 92*0Sstevel@tonic-gate static void validate_options(void); 93*0Sstevel@tonic-gate 94*0Sstevel@tonic-gate int 95*0Sstevel@tonic-gate main(int argc, char **argv) 96*0Sstevel@tonic-gate { 97*0Sstevel@tonic-gate int c; 98*0Sstevel@tonic-gate extern char *optarg; /* from getopt */ 99*0Sstevel@tonic-gate extern int optind; /* from getopt */ 100*0Sstevel@tonic-gate extern FILE *yyin; /* from lex */ 101*0Sstevel@tonic-gate extern int yyparse(void); 102*0Sstevel@tonic-gate char *msgfile = NULL; 103*0Sstevel@tonic-gate char *projfile = NULL; 104*0Sstevel@tonic-gate char *newprojfile = NULL; 105*0Sstevel@tonic-gate char *cpppath = NULL; 106*0Sstevel@tonic-gate int do_msgfile = FALSE; 107*0Sstevel@tonic-gate int tmpfd = -1; 108*0Sstevel@tonic-gate 109*0Sstevel@tonic-gate program = basename(argv[0]); 110*0Sstevel@tonic-gate 111*0Sstevel@tonic-gate (void) setlocale(LC_ALL, ""); 112*0Sstevel@tonic-gate (void) textdomain(TEXT_DOMAIN); 113*0Sstevel@tonic-gate 114*0Sstevel@tonic-gate while ((c = getopt(argc, argv, "arndfg:o:l:p:c:s:m:M:txvb")) != EOF) { 115*0Sstevel@tonic-gate switch (c) { 116*0Sstevel@tonic-gate case 'o': 117*0Sstevel@tonic-gate SetActiveMode(MessageMode); 118*0Sstevel@tonic-gate msgfile = optarg; 119*0Sstevel@tonic-gate break; 120*0Sstevel@tonic-gate case 'a': 121*0Sstevel@tonic-gate SetActiveMode(AppendMode); 122*0Sstevel@tonic-gate break; 123*0Sstevel@tonic-gate case 'l': 124*0Sstevel@tonic-gate projfile = optarg; 125*0Sstevel@tonic-gate SetActiveMode(AutoNumMode); 126*0Sstevel@tonic-gate break; 127*0Sstevel@tonic-gate case 'r': 128*0Sstevel@tonic-gate SetActiveMode(ReverseMode); 129*0Sstevel@tonic-gate break; 130*0Sstevel@tonic-gate case 'p': 131*0Sstevel@tonic-gate cpppath = optarg; 132*0Sstevel@tonic-gate SetActiveMode(PreProcessMode); 133*0Sstevel@tonic-gate break; 134*0Sstevel@tonic-gate case 'g': 135*0Sstevel@tonic-gate newprojfile = optarg; 136*0Sstevel@tonic-gate suppress_error = TRUE; 137*0Sstevel@tonic-gate SetActiveMode(ProjectMode); 138*0Sstevel@tonic-gate break; 139*0Sstevel@tonic-gate case 'c': 140*0Sstevel@tonic-gate mctag = optarg; 141*0Sstevel@tonic-gate SetActiveMode(MsgCommentMode); 142*0Sstevel@tonic-gate break; 143*0Sstevel@tonic-gate case 's': 144*0Sstevel@tonic-gate sctag = optarg; 145*0Sstevel@tonic-gate SetActiveMode(SetCommentMode); 146*0Sstevel@tonic-gate break; 147*0Sstevel@tonic-gate case 'b': 148*0Sstevel@tonic-gate SetActiveMode(BackCommentMode); 149*0Sstevel@tonic-gate break; 150*0Sstevel@tonic-gate case 'n': 151*0Sstevel@tonic-gate SetActiveMode(LineInfoMode); 152*0Sstevel@tonic-gate break; 153*0Sstevel@tonic-gate case 'm': 154*0Sstevel@tonic-gate premsg = optarg; 155*0Sstevel@tonic-gate SetActiveMode(PrefixMode); 156*0Sstevel@tonic-gate break; 157*0Sstevel@tonic-gate case 'M': 158*0Sstevel@tonic-gate sufmsg = optarg; 159*0Sstevel@tonic-gate SetActiveMode(SuffixMode); 160*0Sstevel@tonic-gate break; 161*0Sstevel@tonic-gate case 't': 162*0Sstevel@tonic-gate SetActiveMode(TripleMode); 163*0Sstevel@tonic-gate break; 164*0Sstevel@tonic-gate case 'd': 165*0Sstevel@tonic-gate SetActiveMode(DoubleLineMode); 166*0Sstevel@tonic-gate break; 167*0Sstevel@tonic-gate case 'f': 168*0Sstevel@tonic-gate SetActiveMode(OverwriteMode); 169*0Sstevel@tonic-gate break; 170*0Sstevel@tonic-gate case 'x': 171*0Sstevel@tonic-gate suppress_error = TRUE; 172*0Sstevel@tonic-gate SetActiveMode(NoErrorMode); 173*0Sstevel@tonic-gate break; 174*0Sstevel@tonic-gate case 'v': 175*0Sstevel@tonic-gate (void) printf("genmsg version %s\n", "%I%"); 176*0Sstevel@tonic-gate exit(EXIT_SUCCESS); 177*0Sstevel@tonic-gate break; 178*0Sstevel@tonic-gate default: 179*0Sstevel@tonic-gate usage(); 180*0Sstevel@tonic-gate break; 181*0Sstevel@tonic-gate } 182*0Sstevel@tonic-gate } 183*0Sstevel@tonic-gate 184*0Sstevel@tonic-gate if (optind >= argc) { 185*0Sstevel@tonic-gate usage(); 186*0Sstevel@tonic-gate } 187*0Sstevel@tonic-gate 188*0Sstevel@tonic-gate validate_options(); 189*0Sstevel@tonic-gate 190*0Sstevel@tonic-gate if (IsActiveMode(AutoNumMode)) { 191*0Sstevel@tonic-gate int len; 192*0Sstevel@tonic-gate char *tmp; 193*0Sstevel@tonic-gate if (read_projfile(projfile)) { 194*0Sstevel@tonic-gate tmp = basename(projfile); 195*0Sstevel@tonic-gate len = strlen(tmp); 196*0Sstevel@tonic-gate if ((newprojfile = malloc(len + sizeof (NEW_SUFFIX))) 197*0Sstevel@tonic-gate == NULL) { 198*0Sstevel@tonic-gate prg_err(gettext("fatal: out of memory")); 199*0Sstevel@tonic-gate exit(EXIT_FAILURE); 200*0Sstevel@tonic-gate } 201*0Sstevel@tonic-gate (void) sprintf(newprojfile, "%s%s", tmp, NEW_SUFFIX); 202*0Sstevel@tonic-gate } else { 203*0Sstevel@tonic-gate newprojfile = basename(projfile); 204*0Sstevel@tonic-gate } 205*0Sstevel@tonic-gate } 206*0Sstevel@tonic-gate 207*0Sstevel@tonic-gate if ((IsActiveMode(AutoNumMode) || IsActiveMode(ProjectMode)) && 208*0Sstevel@tonic-gate (is_writable(IsActiveMode(OverwriteMode) ? 209*0Sstevel@tonic-gate projfile : newprojfile) == FALSE)) { 210*0Sstevel@tonic-gate prg_err(gettext("cannot write \"%s\": permission denied"), 211*0Sstevel@tonic-gate IsActiveMode(OverwriteMode) ? projfile : newprojfile); 212*0Sstevel@tonic-gate exit(EXIT_FAILURE); 213*0Sstevel@tonic-gate } 214*0Sstevel@tonic-gate 215*0Sstevel@tonic-gate if (IsActiveMode(AppendMode) && msgfile) { 216*0Sstevel@tonic-gate read_msgfile(msgfile); 217*0Sstevel@tonic-gate } 218*0Sstevel@tonic-gate 219*0Sstevel@tonic-gate if (!msgfile) { 220*0Sstevel@tonic-gate char *tmp = basename(argv[optind]); 221*0Sstevel@tonic-gate int len = strlen(tmp); 222*0Sstevel@tonic-gate if ((msgfile = malloc(len + sizeof (MSG_SUFFIX))) 223*0Sstevel@tonic-gate == NULL) { 224*0Sstevel@tonic-gate prg_err(gettext("fatal: out of memory")); 225*0Sstevel@tonic-gate exit(EXIT_FAILURE); 226*0Sstevel@tonic-gate } 227*0Sstevel@tonic-gate (void) sprintf(msgfile, "%s%s", tmp, MSG_SUFFIX); 228*0Sstevel@tonic-gate } 229*0Sstevel@tonic-gate 230*0Sstevel@tonic-gate while (optind < argc) { 231*0Sstevel@tonic-gate is_cat_found = FALSE; 232*0Sstevel@tonic-gate srcfile = argv[optind]; 233*0Sstevel@tonic-gate 234*0Sstevel@tonic-gate if (IsActiveMode(AutoNumMode) || IsActiveMode(ReverseMode)) { 235*0Sstevel@tonic-gate init_linemsgid(); 236*0Sstevel@tonic-gate } 237*0Sstevel@tonic-gate 238*0Sstevel@tonic-gate if (IsActiveMode(PreProcessMode)) { 239*0Sstevel@tonic-gate char cmd[MAXPATHLEN]; 240*0Sstevel@tonic-gate (void) sprintf(cmd, "%s %s", cpppath, srcfile); 241*0Sstevel@tonic-gate if ((yyin = (FILE *) popen(cmd, "r")) == NULL) { 242*0Sstevel@tonic-gate prg_err( 243*0Sstevel@tonic-gate gettext("fatal: cannot execute \"%s\""), 244*0Sstevel@tonic-gate cpppath); 245*0Sstevel@tonic-gate exit(EXIT_FAILURE); 246*0Sstevel@tonic-gate } 247*0Sstevel@tonic-gate } else { 248*0Sstevel@tonic-gate if ((yyin = fopen(srcfile, "r")) == NULL) { 249*0Sstevel@tonic-gate prg_err(/* stupid cstyle */ 250*0Sstevel@tonic-gate gettext("cannot open \"%s\""), srcfile); 251*0Sstevel@tonic-gate goto end; 252*0Sstevel@tonic-gate } 253*0Sstevel@tonic-gate } 254*0Sstevel@tonic-gate 255*0Sstevel@tonic-gate init_lex(); 256*0Sstevel@tonic-gate yyparse(); 257*0Sstevel@tonic-gate 258*0Sstevel@tonic-gate if (IsActiveMode(PreProcessMode)) { 259*0Sstevel@tonic-gate if (pclose(yyin) != 0) { 260*0Sstevel@tonic-gate prg_err(gettext("\"%s\" failed for \"%s\""), 261*0Sstevel@tonic-gate cpppath, srcfile); 262*0Sstevel@tonic-gate goto end; 263*0Sstevel@tonic-gate } 264*0Sstevel@tonic-gate } 265*0Sstevel@tonic-gate 266*0Sstevel@tonic-gate if (is_cat_found == FALSE) { 267*0Sstevel@tonic-gate if (!IsActiveMode(PreProcessMode)) { 268*0Sstevel@tonic-gate (void) fclose(yyin); 269*0Sstevel@tonic-gate } 270*0Sstevel@tonic-gate goto end; 271*0Sstevel@tonic-gate } 272*0Sstevel@tonic-gate 273*0Sstevel@tonic-gate if (!do_msgfile) { 274*0Sstevel@tonic-gate do_msgfile = TRUE; 275*0Sstevel@tonic-gate } 276*0Sstevel@tonic-gate 277*0Sstevel@tonic-gate if (IsActiveMode(AutoNumMode) || IsActiveMode(ReverseMode)) { 278*0Sstevel@tonic-gate char *tmp = basename(srcfile); 279*0Sstevel@tonic-gate char newfile[MAXPATHLEN]; 280*0Sstevel@tonic-gate char tmpfile[32]; 281*0Sstevel@tonic-gate 282*0Sstevel@tonic-gate if (IsActiveMode(OverwriteMode)) { 283*0Sstevel@tonic-gate (void) sprintf(newfile, "%s", srcfile); 284*0Sstevel@tonic-gate } else { 285*0Sstevel@tonic-gate (void) sprintf(newfile, "%s%s", 286*0Sstevel@tonic-gate tmp, NEW_SUFFIX); 287*0Sstevel@tonic-gate } 288*0Sstevel@tonic-gate 289*0Sstevel@tonic-gate if (is_writable(newfile) == FALSE) { 290*0Sstevel@tonic-gate prg_err( 291*0Sstevel@tonic-gate gettext("cannot create \"%s\": permission denied"), 292*0Sstevel@tonic-gate newfile); 293*0Sstevel@tonic-gate goto end; 294*0Sstevel@tonic-gate } 295*0Sstevel@tonic-gate 296*0Sstevel@tonic-gate (void) sprintf(tmpfile, "%s", "/tmp/gensmg.XXXXXX"); 297*0Sstevel@tonic-gate if ((tmpfd = mkstemp(tmpfile)) == -1) { 298*0Sstevel@tonic-gate prg_err(/* stupid cstyle */ 299*0Sstevel@tonic-gate gettext("cannot create \"%s\""), tmpfile); 300*0Sstevel@tonic-gate if (!IsActiveMode(PreProcessMode)) { 301*0Sstevel@tonic-gate (void) fclose(yyin); 302*0Sstevel@tonic-gate } 303*0Sstevel@tonic-gate goto end; 304*0Sstevel@tonic-gate } 305*0Sstevel@tonic-gate (void) close(tmpfd); 306*0Sstevel@tonic-gate if ((newfp = fopen(tmpfile, "w")) == NULL) { 307*0Sstevel@tonic-gate prg_err(/* stupid cstyle */ 308*0Sstevel@tonic-gate gettext("cannot create \"%s\""), tmpfile); 309*0Sstevel@tonic-gate if (!IsActiveMode(PreProcessMode)) { 310*0Sstevel@tonic-gate (void) fclose(yyin); 311*0Sstevel@tonic-gate } 312*0Sstevel@tonic-gate (void) unlink(tmpfile); 313*0Sstevel@tonic-gate goto end; 314*0Sstevel@tonic-gate } 315*0Sstevel@tonic-gate 316*0Sstevel@tonic-gate if (IsActiveMode(PreProcessMode)) { 317*0Sstevel@tonic-gate if ((yyin = fopen(srcfile, "r")) == NULL) { 318*0Sstevel@tonic-gate prg_err(/* stupid cstyle */ 319*0Sstevel@tonic-gate gettext("cannot open \"%s\""), srcfile); 320*0Sstevel@tonic-gate (void) unlink(tmpfile); 321*0Sstevel@tonic-gate goto end; 322*0Sstevel@tonic-gate } 323*0Sstevel@tonic-gate } else { 324*0Sstevel@tonic-gate rewind(yyin); 325*0Sstevel@tonic-gate } 326*0Sstevel@tonic-gate 327*0Sstevel@tonic-gate SetActiveMode(ReplaceMode); 328*0Sstevel@tonic-gate init_lex(); 329*0Sstevel@tonic-gate yyparse(); 330*0Sstevel@tonic-gate ResetActiveMode(ReplaceMode); 331*0Sstevel@tonic-gate 332*0Sstevel@tonic-gate (void) fclose(newfp); 333*0Sstevel@tonic-gate newfp = NULL; 334*0Sstevel@tonic-gate 335*0Sstevel@tonic-gate (void) fclose(yyin); 336*0Sstevel@tonic-gate 337*0Sstevel@tonic-gate (void) file_copy(tmpfile, newfile); 338*0Sstevel@tonic-gate 339*0Sstevel@tonic-gate (void) unlink(tmpfile); 340*0Sstevel@tonic-gate 341*0Sstevel@tonic-gate goto end; 342*0Sstevel@tonic-gate } 343*0Sstevel@tonic-gate 344*0Sstevel@tonic-gate if (!IsActiveMode(PreProcessMode)) { 345*0Sstevel@tonic-gate (void) fclose(yyin); 346*0Sstevel@tonic-gate } 347*0Sstevel@tonic-gate 348*0Sstevel@tonic-gate end: 349*0Sstevel@tonic-gate optind++; 350*0Sstevel@tonic-gate } 351*0Sstevel@tonic-gate 352*0Sstevel@tonic-gate if (!do_msgfile) { /* no more business. */ 353*0Sstevel@tonic-gate return (EXIT_SUCCESS); 354*0Sstevel@tonic-gate } 355*0Sstevel@tonic-gate 356*0Sstevel@tonic-gate if (!IsActiveMode(ReverseMode) && !IsActiveMode(ProjectMode)) { 357*0Sstevel@tonic-gate write_msgfile(msgfile); 358*0Sstevel@tonic-gate } 359*0Sstevel@tonic-gate 360*0Sstevel@tonic-gate if (IsActiveMode(AutoNumMode) || IsActiveMode(ProjectMode)) { 361*0Sstevel@tonic-gate write_projfile(IsActiveMode(OverwriteMode) ? 362*0Sstevel@tonic-gate projfile : newprojfile); 363*0Sstevel@tonic-gate } 364*0Sstevel@tonic-gate return (EXIT_SUCCESS); 365*0Sstevel@tonic-gate } 366*0Sstevel@tonic-gate 367*0Sstevel@tonic-gate static void 368*0Sstevel@tonic-gate validate_options(void) 369*0Sstevel@tonic-gate { 370*0Sstevel@tonic-gate /* -r doesn't work with either -a or -l. */ 371*0Sstevel@tonic-gate if (IsActiveMode(ReverseMode) && 372*0Sstevel@tonic-gate (IsActiveMode(AutoNumMode) || IsActiveMode(AppendMode))) { 373*0Sstevel@tonic-gate usage(); 374*0Sstevel@tonic-gate } 375*0Sstevel@tonic-gate /* -b should be accompanied with -c, -s, -d, and -n. */ 376*0Sstevel@tonic-gate if (IsActiveMode(BackCommentMode) && 377*0Sstevel@tonic-gate (!IsActiveMode(MsgCommentMode) && 378*0Sstevel@tonic-gate !IsActiveMode(SetCommentMode) && 379*0Sstevel@tonic-gate !IsActiveMode(DoubleLineMode) && 380*0Sstevel@tonic-gate !IsActiveMode(LineInfoMode))) { 381*0Sstevel@tonic-gate usage(); 382*0Sstevel@tonic-gate } 383*0Sstevel@tonic-gate if (IsActiveMode(ProjectMode) && 384*0Sstevel@tonic-gate (IsActiveMode(AutoNumMode) || IsActiveMode(ReverseMode) || 385*0Sstevel@tonic-gate IsActiveMode(AppendMode) || IsActiveMode(MsgCommentMode) || 386*0Sstevel@tonic-gate IsActiveMode(LineInfoMode) || IsActiveMode(OverwriteMode) || 387*0Sstevel@tonic-gate IsActiveMode(PrefixMode) || IsActiveMode(SuffixMode) || 388*0Sstevel@tonic-gate IsActiveMode(TripleMode) || IsActiveMode(DoubleLineMode) || 389*0Sstevel@tonic-gate IsActiveMode(MessageMode) || IsActiveMode(NoErrorMode))) { 390*0Sstevel@tonic-gate usage(); 391*0Sstevel@tonic-gate } 392*0Sstevel@tonic-gate } 393*0Sstevel@tonic-gate 394*0Sstevel@tonic-gate static void 395*0Sstevel@tonic-gate usage(void) 396*0Sstevel@tonic-gate { 397*0Sstevel@tonic-gate (void) fprintf(stderr, 398*0Sstevel@tonic-gate gettext("Usage: %s [-o message-file] [-a] [-d] [-p preprocessor]\n" 399*0Sstevel@tonic-gate " [-s set-tag] [-c message-tag] [-b] [-n]\n" 400*0Sstevel@tonic-gate " [-l project-file] [-r] [-f] [-g project-file]\n" 401*0Sstevel@tonic-gate " [-m prefix] [-M suffix] [-t] [-x] files ...\n"), 402*0Sstevel@tonic-gate program); 403*0Sstevel@tonic-gate exit(EXIT_FAILURE); 404*0Sstevel@tonic-gate } 405