nisls.c revision 49e7ca4919cec3229f6fab9730bafc7cf24dab23
/*
* 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 2005 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
/*
* nisls.c
*
* Simple "ls" utility for nis directories.
*/
#include <stdio.h>
#include <stdlib.h>
#include <strings.h>
int (*)(nis_name, nis_object *, void *), void *);
static char **nl = 0;
static void
char *name;
{
if (nl == 0)
nlsize += 1024;
}
}
static char *
nlpop()
{
if (nllen == 0)
return (0);
}
#define F_LONG 1
#define F_RECURSE 2
#define F_MTIME 4
#define F_GROUP 8
#define F_DIR 16
static int flags = 0;
static int
char *tab;
void *udata;
{
char fname[NIS_MAXNAMELEN];
char *tms;
if (udata)
else
switch (et) {
case NIS_BOGUS_OBJ:
printf("* ");
break;
case NIS_DIRECTORY_OBJ:
printf("D ");
break;
case NIS_GROUP_OBJ:
printf("G ");
break;
case NIS_TABLE_OBJ:
printf("T ");
break;
case NIS_ENTRY_OBJ:
printf("E ");
break;
case NIS_LINK_OBJ:
printf("L ");
break;
case NIS_PRIVATE_OBJ:
printf("P ");
break;
default:
break;
}
else
else
}
return (0);
}
static void
usage()
{
printf("usage: nisls [-LMlmgdR] [name ...]\n");
exit(1);
}
int
{
int c;
char *name;
char fname[NIS_MAXNAMELEN];
int error = 0;
switch (c) {
case 'L':
break;
case 'M':
break;
case 'l':
break;
case 'm':
break;
case 'g':
break;
case 'd':
break;
case 'R':
break;
default:
usage();
}
/*
* push all of the names to ls onto a stack (in reverse order)
*/
/*
* keep popping names off the stack and ls'ing them. if we're
* recursive, then subdirectories will get pushed on in ls_obj.
*/
/*
* Hack to get around non replicated root object bug.
*/
ls_obj, 0);
"can't list directory");
error = 1;
}
if (nllen)
printf("\n");
goto loop;
error = 1;
goto loop;
}
goto loop;
}
sizeof (fname));
error = 1;
}
if (nllen)
printf("\n");
loop:
}
return (error);
}