mirror of
https://github.com/freebsd/freebsd-src
synced 2024-10-15 21:05:08 +00:00
Add FBSDID. Spelling. Remove unused includes. Check more malloc failures.
This commit is contained in:
parent
d74e4cbc8f
commit
3a8d2936c6
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=93218
|
@ -1,5 +1,3 @@
|
||||||
/* $FreeBSD$ */
|
|
||||||
|
|
||||||
/***********************************************************
|
/***********************************************************
|
||||||
Copyright 1990, by Alfalfa Software Incorporated, Cambridge, Massachusetts.
|
Copyright 1990, by Alfalfa Software Incorporated, Cambridge, Massachusetts.
|
||||||
|
|
||||||
|
@ -32,7 +30,9 @@ up-to-date. Many thanks.
|
||||||
|
|
||||||
******************************************************************/
|
******************************************************************/
|
||||||
|
|
||||||
#include <sys/types.h>
|
#include <sys/cdefs.h>
|
||||||
|
__FBSDID("$FreeBSD$");
|
||||||
|
|
||||||
#include <sys/file.h>
|
#include <sys/file.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#include <err.h>
|
#include <err.h>
|
||||||
|
@ -46,7 +46,7 @@ up-to-date. Many thanks.
|
||||||
* The spec says the syntax is "gencat catfile msgfile...".
|
* The spec says the syntax is "gencat catfile msgfile...".
|
||||||
* We extend it to:
|
* We extend it to:
|
||||||
* gencat [-lang C|C++|ANSIC] catfile msgfile [-h <header-file>]...
|
* gencat [-lang C|C++|ANSIC] catfile msgfile [-h <header-file>]...
|
||||||
* Flags are order dependant, we'll take whatever lang was most recently chosen
|
* Flags are order dependent, we'll take whatever lang was most recently chosen
|
||||||
* and use it to generate the next header file. The header files are generated
|
* and use it to generate the next header file. The header files are generated
|
||||||
* at the point in the command line they are listed. Thus the sequence:
|
* at the point in the command line they are listed. Thus the sequence:
|
||||||
* gencat -lang C foo.cat foo.mcs -h foo.h -lang C++ bar.mcs -h bar.H
|
* gencat -lang C foo.cat foo.mcs -h foo.h -lang C++ bar.mcs -h bar.H
|
||||||
|
|
|
@ -54,7 +54,7 @@ up-to-date. Many thanks.
|
||||||
* My extension: If '#' is used instead of a number, the number
|
* My extension: If '#' is used instead of a number, the number
|
||||||
* is generated automatically. A # followed by anything is an empty message.
|
* is generated automatically. A # followed by anything is an empty message.
|
||||||
* $quote c
|
* $quote c
|
||||||
* Optional quote character which can suround message-text to
|
* Optional quote character which can surround message-text to
|
||||||
* show where spaces are.
|
* show where spaces are.
|
||||||
*
|
*
|
||||||
* Escape Characters
|
* Escape Characters
|
||||||
|
|
|
@ -1,5 +1,3 @@
|
||||||
/* $FreeBSD$ */
|
|
||||||
|
|
||||||
/***********************************************************
|
/***********************************************************
|
||||||
Copyright 1990, by Alfalfa Software Incorporated, Cambridge, Massachusetts.
|
Copyright 1990, by Alfalfa Software Incorporated, Cambridge, Massachusetts.
|
||||||
|
|
||||||
|
@ -32,10 +30,11 @@ up-to-date. Many thanks.
|
||||||
|
|
||||||
******************************************************************/
|
******************************************************************/
|
||||||
|
|
||||||
#include <sys/types.h>
|
#include <sys/cdefs.h>
|
||||||
#include <sys/file.h>
|
__FBSDID("$FreeBSD$");
|
||||||
#include <err.h>
|
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
|
#include <err.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
@ -112,6 +111,7 @@ getline(int fd)
|
||||||
}
|
}
|
||||||
if (cptr == cend) {
|
if (cptr == cend) {
|
||||||
cptr = curline = (char *) realloc(curline, curlen *= 2);
|
cptr = curline = (char *) realloc(curline, curlen *= 2);
|
||||||
|
if (!curline) nomem();
|
||||||
cend = curline + curlen;
|
cend = curline + curlen;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -169,6 +169,7 @@ getmsg(int fd, char *cptr, char quote)
|
||||||
if (clen > msglen) {
|
if (clen > msglen) {
|
||||||
if (msglen) msg = (char *) realloc(msg, clen);
|
if (msglen) msg = (char *) realloc(msg, clen);
|
||||||
else msg = (char *) malloc(clen);
|
else msg = (char *) malloc(clen);
|
||||||
|
if (!msg) nomem();
|
||||||
msglen = clen;
|
msglen = clen;
|
||||||
}
|
}
|
||||||
tptr = msg;
|
tptr = msg;
|
||||||
|
@ -192,6 +193,7 @@ getmsg(int fd, char *cptr, char quote)
|
||||||
msglen += strlen(cptr);
|
msglen += strlen(cptr);
|
||||||
i = tptr - msg;
|
i = tptr - msg;
|
||||||
msg = (char *) realloc(msg, msglen);
|
msg = (char *) realloc(msg, msglen);
|
||||||
|
if (!msg) nomem();
|
||||||
tptr = msg + i;
|
tptr = msg + i;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue