logger.c:

Did changes for the initial GNO version.  This includes:
	- prototyping;
	- changing the facility/priority value from an int to a
	  long (we need 32 bits for all the information);
	- stack checking code; and
	- after doing a freopen() of stdin, change it back to text mode.

Makefile, logger.rez, logger.desc:
	New files.
This commit is contained in:
gdr-ftp 1998-06-23 23:23:55 +00:00
parent 442d75ce87
commit c6c45722d8
4 changed files with 62 additions and 16 deletions

9
usr.bin/logger/Makefile Normal file
View File

@ -0,0 +1,9 @@
#
# $Id: Makefile,v 1.1 1998/06/23 23:23:52 gdr-ftp Exp $
#
PROG = logger
STACK = 1280 # highest observed: 900-some-odd bytes
BINDIR = /usr/bin
.INCLUDE: /src/gno/prog.mk

View File

@ -31,6 +31,7 @@
* SUCH DAMAGE.
*/
#ifndef __GNO__
#ifndef lint
static char copyright[] =
"@(#) Copyright (c) 1983, 1993\n\
@ -40,6 +41,7 @@ static char copyright[] =
#ifndef lint
static char sccsid[] = "@(#)logger.c 8.1 (Berkeley) 6/6/93";
#endif /* not lint */
#endif /* not __GNO__ */
#include <errno.h>
#include <unistd.h>
@ -47,12 +49,15 @@ static char sccsid[] = "@(#)logger.c 8.1 (Berkeley) 6/6/93";
#include <stdio.h>
#include <ctype.h>
#include <string.h>
#ifdef __GNO__
#include <gno/gno.h>
#endif
#define SYSLOG_NAMES
#include <syslog.h>
int decode __P((char *, CODE *));
int pencode __P((char *));
long decode __P((char *, CODE *));
long pencode __P((char *));
void usage __P((void));
/*
@ -62,13 +67,16 @@ void usage __P((void));
* log.
*/
int
main(argc, argv)
int argc;
char *argv[];
main(int argc, char **argv)
{
int ch, logflags, pri;
char *tag, buf[1024];
int ch, logflags;
long pri;
char *tag;
static char buf[1024];
#ifdef __GNO__
__REPORT_STACK();
#endif
tag = NULL;
pri = LOG_NOTICE;
logflags = 0;
@ -80,6 +88,10 @@ main(argc, argv)
optarg, strerror(errno));
exit(1);
}
#ifdef __appleiigs__
/* if we don't do this, then fgets() crashes */
fsettext(stdin);
#endif
break;
case 'i': /* log process id also */
logflags |= LOG_PID;
@ -135,12 +147,11 @@ main(argc, argv)
/*
* Decode a symbolic name to a numeric value
*/
int
pencode(s)
register char *s;
long
pencode(register char *s)
{
char *save;
int fac, lev;
long fac, lev;
for (save = s; *s && *s != '.'; ++s);
if (*s) {
@ -166,10 +177,8 @@ pencode(s)
return ((lev & LOG_PRIMASK) | (fac & LOG_FACMASK));
}
int
decode(name, codetab)
char *name;
CODE *codetab;
long
decode(char *name, CODE *codetab)
{
register CODE *c;
@ -184,7 +193,7 @@ decode(name, codetab)
}
void
usage()
usage(void)
{
(void)fprintf(stderr,
"logger: [-is] [-f file] [-p pri] [-t tag] [ message ... ]\n");

View File

@ -0,0 +1,9 @@
Name: logger
Version: 1.0 (23 Jun 98)
Shell: GNO
Author: Ported by Devin Reade.
Contact: gdr@trenco.gno.org
Where: /usr/bin
FTP: ftp.gno.org
Log messages to system log files via syslog(3) interface.

19
usr.bin/logger/logger.rez Normal file
View File

@ -0,0 +1,19 @@
/*
* $Id: logger.rez,v 1.1 1998/06/23 23:23:55 gdr-ftp Exp $
*/
#include "Types.Rez"
#include "/src/gno/build.tools/builddate.rez"
resource rVersion (0x1, purgeable3, nocrossbank) {
{ 1, 0, 0, /* version 1.0.0 */
release, /* development|alpha|beta|final|release */
0 /* non-final release number */
},
verUS,
"logger",
"Log messages to system log files.\n"
"Ported by Devin Reade for GNO v2.0.6\n"
BUILD_DATE
};