/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (the "License"). You may not use this file except in compliance
* with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2004 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
/* All Rights Reserved */
#pragma ident "%Z%%M% %I% %E% SMI"
/*
* Create message files in a specific format.
* the gettxt message retrieval function must know the format of
* the data file created by this utility.
*
* FORMAT OF MESSAGE FILES
__________________________
| Number of messages |
--------------------------
| offset to the 1st mesg |
--------------------------
| offset to the 2nd mesg |
--------------------------
| offset to the 3rd mesg |
--------------------------
| . |
| . |
| . |
--------------------------
| offset to the nth mesg |
--------------------------
| message #1
--------------------------
| message #2
--------------------------
| message #3
--------------------------
.
.
.
--------------------------
| message #n
--------------------------
*
*/
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <signal.h>
#include <errno.h>
#include <libgen.h>
/*
* Definitions
*/
/*
* internal functions
*/
static char *syserr(void); /* Returns description of error */
static void usage(void); /* Displays valid invocations */
static int mymkdir(char *); /* Creates sub-directories */
static void clean(int); /* removes work file */
/*
* static variables
*/
int
int argc;
char *argv[];
{
int c; /* contains option letter */
* of the output file */
int i;
/* Initializations */
num_msgs = 0;
iflag = 0;
oflag = 0;
/* Get name of command */
++cmdname;
else
/* Check for invalid number of arguments */
usage();
/* Get command line options */
switch (c) {
case 'o':
oflag++;
break;
case 'i':
iflag++;
break;
case '?':
usage();
break;
}
}
/* Initialize pointers to input and output file names */
/* check for invalid invocations */
usage();
usage();
usage();
usage();
/* Construct a full-path to the output file */
if (localep) {
exit(1);
}
}
/* Check for overwrite error conditions */
if (! oflag) {
if (iflag) {
(void)fprintf(stderr, "%s: Message file \"%s\" already exists;\ndid not overwrite it\n", cmdname, pathoutp);
if (localep)
exit(1);
}
}
else
(void)fprintf(stderr, "%s: Message file \"%s\" already exists;\ndid not overwrite it\n", cmdname, ofilep);
if (localep)
exit(1);
}
}
/* Open input file */
exit(1);
}
/* Allocate buffer for input and work areas */
exit(1);
}
/* Open work file */
if (localep)
exit(1);
}
/* Search for C-escape sequences in input file and
* replace them by the appropriate characters.
* The modified lines are copied to the work area
* and written to the work file */
for(;;) {
if (localep)
exit(1);
}
break;
}
exit(1);
}
num_msgs++;
exit(1);
}
}
/* Open and stat the work file */
exit(1);
}
}
/* Find the size of the output message file
* and copy the control information and the messages
* to the output file */
exit(1);
}
if ( (fread(bufinp + sizeof(int) + num_msgs * sizeof(int), sizeof(*bufinp), buf.st_size, fp_outp)) != buf.st_size ) {
}
for(i = 2; i <= num_msgs; i++) {
}
if (iflag) {
if (mymkdir(localedirp) == 0) {
if (localep)
exit(1);
}
}
else
if (localep)
exit(1);
}
if (localep)
exit(1);
}
if (localep)
return (0);
}
/*
* syserr()
*
* Return a pointer to a system error message.
*/
static char *
syserr()
{
}
static void
usage()
{
cmdname);
exit(1);
}
static int
char *localdir;
{
char *dirp;
char *path;
return(0);
*path = '\0';
continue;
return(0);
}
}
return(1);
}
/* ARGSUSED */
static void
{
if (workp)
exit(1);
}