Minor cleanup

This commit is contained in:
gwr 1995-10-13 18:10:06 +00:00
parent 078eb0a7f7
commit cba18d24c6
12 changed files with 49 additions and 56 deletions

View File

@ -1,5 +1,5 @@
# $NetBSD: Makefile,v 1.1.1.1 1995/10/08 23:08:46 gwr Exp $
# $NetBSD: Makefile,v 1.2 1995/10/13 18:10:06 gwr Exp $
SUBDIR= dd ftp init libpw rsh ssh tftp tls
SUBDIR= libhack init_s ssh tls x_dd x_ifconfig
.include <bsd.subdir.mk>

View File

@ -1,6 +1,7 @@
# $NetBSD: Makefile.inc,v 1.1.1.1 1995/10/08 23:08:46 gwr Exp $
# $NetBSD: Makefile.inc,v 1.2 1995/10/13 18:10:07 gwr Exp $
# utils one might want in a crunched binary
BSDSRCDIR?= /usr/src
LDSTATIC= -static
install:

View File

@ -5,7 +5,6 @@ Subject: New ramdisk, tiny shell, etc.
As part of my efforts to build a RAM-disk root kernel for the
sun3 port, I've developed some things that others may want:
(Also, please see my questions at the end.)
New RAM-disk: [ see sys/dev/ramdisk.c ]
@ -34,7 +33,7 @@ init_s: (built with -DLETS_GET_SMALL)
libhack: small implementation of some libc functions
* Needs only /etc/passwd (not pwd.db, spwd.db)
* Reduces size of an m68k crunched binary about 64K
* Reduces size of an m68k crunched binary by about 64K
x_dd: built with -DNO_CONV (no conv=* options)

View File

@ -1,4 +1,4 @@
# $NetBSD: Makefile,v 1.1.1.1 1995/10/08 23:08:47 gwr Exp $
# $NetBSD: Makefile,v 1.2 1995/10/13 18:10:17 gwr Exp $
# Build a "small init" (i.e. for boot media)
PROG= init
@ -8,7 +8,7 @@ NOMAN=
DPADD= ${LIBUTIL}
LDADD= -lutil
SRCDIR=/usr/src/sbin/init
SRCDIR= ${BSDSRCDIR}/sbin/init
CFLAGS+= -DLETS_GET_SMALL -I${SRCDIR}
.PATH: ${SRCDIR}

View File

@ -1,4 +1,4 @@
# $NetBSD: Makefile,v 1.1.1.1 1995/10/08 23:08:48 gwr Exp $
# $NetBSD: Makefile,v 1.2 1995/10/13 18:10:19 gwr Exp $
#
# Stubs to kill off some things from libc:
# This save space on a boot system.
@ -12,4 +12,8 @@ NOPROFILE=
all: libhack.a
tpwent: getpwent.c
$(CC) -g -o $@.o -DTEST_MAIN -c getpwent.c
$(CC) -o $@ $@.o
.include <bsd.lib.mk>

View File

@ -1,4 +1,4 @@
# $NetBSD: Makefile.inc,v 1.1.1.1 1995/10/08 23:08:48 gwr Exp $
# $NetBSD: Makefile.inc,v 1.2 1995/10/13 18:10:20 gwr Exp $
# Include this fragment to build libhack.o
# It is .o and not .a to make sure these are the
# objects you get (and not the ones in libc.a)
@ -19,3 +19,7 @@ getgrent.o : ${HACKSRC}/getgrent.c
getnetgr.o : ${HACKSRC}/getnetgr.c
$(CC) -c ${HACKSRC}/getnetgr.c
yplib.o : ${HACKSRC}/yplib.c
$(CC) -c ${HACKSRC}/yplib.c

View File

@ -1,4 +1,4 @@
/* $NetBSD: getgrent.c,v 1.1.1.1 1995/10/08 23:08:48 gwr Exp $ */
/* $NetBSD: getgrent.c,v 1.2 1995/10/13 18:10:23 gwr Exp $ */
/*
* Copyright (c) 1989, 1993
@ -34,6 +34,10 @@
* SUCH DAMAGE.
*/
/*
* Copied from: lib/libc/gen/getgrent.c
* and then gutted, leaving only /etc/group support.
*/
#include <sys/types.h>
#include <stdio.h>
@ -41,7 +45,6 @@
#include <string.h>
#include <grp.h>
static FILE *_gr_fp;
static struct group _gr_group;
static int _gr_stayopen;
@ -52,7 +55,6 @@ static char *members[MAXGRP];
#define MAXLINELENGTH 1024
static char line[MAXLINELENGTH];
struct group *
getgrent()
{

View File

@ -1,4 +1,4 @@
/* $NetBSD: gethost.c,v 1.1.1.1 1995/10/08 23:08:48 gwr Exp $ */
/* $NetBSD: gethost.c,v 1.2 1995/10/13 18:10:25 gwr Exp $ */
/*-
* Copyright (c) 1985, 1988, 1993
@ -53,6 +53,10 @@
* --Copyright--
*/
/*
* Copied from: lib/libc/net/gethostnamadr.c
* and then gutted, leaving only /etc/hosts support.
*/
#include <sys/param.h>
#include <sys/socket.h>
@ -66,13 +70,11 @@
#include <errno.h>
#include <string.h>
#define MAXALIASES 35
#define MAXADDRS 35
static char *h_addr_ptrs[MAXADDRS + 1];
static struct hostent host;
static char *host_aliases[MAXALIASES];
static char hostbuf[BUFSIZ+1];
@ -88,7 +90,6 @@ static int stayopen = 0;
extern int h_errno;
struct hostent *
gethostbyname(name)
const char *name;
@ -96,8 +97,6 @@ gethostbyname(name)
register const char *cp;
int n, i;
extern struct hostent *_gethtbyname();
register struct hostent *hp;
char lookups[MAXDNSLUS];
/*
* disallow names consisting only of digits/dots, unless
@ -141,11 +140,9 @@ gethostbyaddr(addr, len, type)
int len, type;
{
int n, i;
register struct hostent *hp;
char qbuf[MAXDNAME];
extern struct hostent *_gethtbyaddr();
char lookups[MAXDNSLUS];
if (type != AF_INET)
return ((struct hostent *) NULL);
(void)sprintf(qbuf, "%u.%u.%u.%u.in-addr.arpa",

View File

@ -1,18 +1,21 @@
/* $NetBSD: getnetgr.c,v 1.1.1.1 1995/10/08 23:08:48 gwr Exp $ */
/* $NetBSD: getnetgr.c,v 1.2 1995/10/13 18:10:26 gwr Exp $ */
/*
* Just stub these out, so it looks like
* we are not in any any netgroups.
*/
void
endnetgrent()
{
}
void
setnetgrent(ng)
const char *ng;
{
}
int
getnetgrent(host, user, domain)
const char **host;
@ -22,7 +25,6 @@ getnetgrent(host, user, domain)
return 0;
}
int
innetgr(grp, host, user, domain)
const char *grp, *host, *user, *domain;

View File

@ -1,4 +1,4 @@
/* $NetBSD: getpwent.c,v 1.1.1.1 1995/10/08 23:08:48 gwr Exp $ */
/* $NetBSD: getpwent.c,v 1.2 1995/10/13 18:10:27 gwr Exp $ */
/*
* Copyright (c) 1995 Gordon W. Ross
@ -54,8 +54,8 @@ static struct passwd pw_ent;
struct passwd *
getpwent()
{
register char *p;
char *fv[MAXFIELD];
char *p;
int fc;
/* Open passwd file if not already. */
@ -65,8 +65,8 @@ getpwent()
if (pw_fp == NULL)
return PWNULL;
/* Read the next line... */
readnext:
/* Read the next line... */
if (fgets(pw_line, sizeof(pw_line), pw_fp) == NULL)
return PWNULL;
@ -74,29 +74,11 @@ readnext:
p = pw_line;
fc = 0;
while (fc < MAXFIELD) {
/* end of line? */
if (*p == '\n') {
*p = '\0';
fv[fc] = strsep(&p, ":\n");
if (fv[fc] == NULL)
break;
}
if (*p == '\0')
break;
/* save start of field */
fv[fc++] = p;
/* find end of field */
while (*p) {
if (*p == '\n') {
*p = '\0';
goto eol;
}
if (*p == ':') {
*p++ = '\0';
break;
}
p++;
}
fc++;
}
eol:
/* Need at least 0..5 */
if (fc < 6)
@ -104,7 +86,7 @@ readnext:
while (fc < MAXFIELD)
fv[fc++] = "";
/* Build the pw entrt... */
/* Build the pw entry... */
pw_ent.pw_name = fv[0];
pw_ent.pw_passwd = fv[1];
pw_ent.pw_uid = atoi(fv[2]);
@ -136,8 +118,10 @@ setpwent()
void
endpwent()
{
if (pw_fp)
if (pw_fp) {
fclose(pw_fp);
pw_fp = NULL;
}
}
struct passwd *
@ -174,7 +158,7 @@ getpwuid(uid)
main() {
struct passwd *pw;
printf("name, password, uid, gid, comment, dir, shell\n");
printf("#name, password, uid, gid, comment, dir, shell\n");
while ((pw = getpwent()) != NULL) {
printf("%s:%s:", pw->pw_name, pw->pw_passwd);

View File

@ -1,10 +1,10 @@
# $NetBSD: Makefile,v 1.1.1.1 1995/10/08 23:08:47 gwr Exp $
# $NetBSD: Makefile,v 1.2 1995/10/13 18:10:29 gwr Exp $
# Build a smaller dd (i.e. for boot media)
PROG= dd
NOMAN=
SRCDIR=/usr/src/bin/dd
SRCDIR= ${BSDSRCDIR}/bin/dd
SRCS= args.c conv.c dd.c misc.c position.c
# SRCS+= conv_tab.c (not used)

View File

@ -1,10 +1,10 @@
# $NetBSD: Makefile,v 1.1.1.1 1995/10/08 23:08:47 gwr Exp $
# $NetBSD: Makefile,v 1.2 1995/10/13 18:10:31 gwr Exp $
# Build a smaller ifconfig (i.e. for boot media)
PROG= ifconfig
NOMAN=
SRCDIR=/usr/src/sbin/ifconfig
SRCDIR= ${BSDSRCDIR}/sbin/ifconfig
CFLAGS+= -DINET_ONLY -I${SRCDIR}
.PATH: ${SRCDIR}