genfind.c revision 7c478bd95313f5f23a4c958a745db2134aa03244
/*
* 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 (c) 1984, 1986, 1987, 1988, 1989 AT&T */
/* All Rights Reserved */
/*
* Copyright (c) 1985 AT&T
* All Rights Reserved
*/
#ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.8 */
#include <pwd.h>
#include <stdio.h>
#include <string.h>
#include <time.h>
#include <values.h>
#include "wish.h"
#include "typetab.h" /* for ott masks ott_tab ott_entry() */
#include "partabdefs.h"
#include "var_arrays.h" /* for array_len() */
#include "sizes.h"
#ifndef TEST
#include "eval.h"
#else /* TEST */
#endif /* TEST */
extern char *Oasys;
static char any[] = "any";
#ifdef TEST
int argc;
char *argv[];
{
odftread();
exit(0);
}
#endif /* TEST */
/*
* usage: genfind path filename type owner age
*/
int argc;
char *argv[];
{
int min_days;
int max_days;
int do_traverse;
int origin;
int pathpos;
int namepos;
char *type;
char *dtype;
register int i;
register char *pattern;
char *myregcmp();
mess_temp("Arguments invalid");
return FAIL;
}
i = 1;
origin = 0;
origin = 1;
i++;
}
else
do_traverse = TRUE;
do_traverse = FALSE;
i++;
}
else
do_traverse = TRUE;
pathpos = i;
/* traverse assumes at least 1 extra byte available in path */
mess_temp("Path too long");
return FAIL;
}
mess_temp("Name invalid");
return FAIL;
}
namepos = ++i;
mess_temp("Owner invalid");
return FAIL;
}
}
else
uid = -1;
mess_temp("Age invalid");
return FAIL;
}
}
else
min_days = -1;
else
break;
}
traverse(path, pattern, uid, strCcmp(argv[namepos], any) ? argv[namepos] : NULL, min_days, max_days, argv[pathpos], do_traverse, outstr, type );
return SUCCESS;
}
static
char *path;
char *pattern;
int uid;
char *objtype;
int min_days;
int max_days;
char *prefix;
int do_traverse;
char *type;
{
register int i;
register int length;
register int ott_len;
register int numdays;
char *basename;
char *objname;
char *typename;
char *intobj;
long mask;
struct tm *t;
char *bsd_path_to_title();
char *regex();
/* check to see if enough space to put file names */
return;
return;
for (i = 0; i < ott_len; ++i) {
/* shorter names */
/* object's name not viewable or marked deleted */
continue;
/*
* these tests are performed in order of increasing
* computational cost
*/
continue;
if (do_traverse) {
} else
}
}
}
/* object is a directory and not deleted, search */
if (do_traverse)
return;
}
} /* end of for loop */
}
static int
char *s;
int origin;
int *mindays;
int *maxdays;
{
char *s1;
long strtol();
switch (*s) {
case '<':
*mindays = 0;
break;
case '>':
break;
default:
if (s1 == s)
return FAIL;
if (*s1 == '-')
else
break;
}
*mindays = 0;
return FAIL;
}
static char *
myregcmp(s)
char *s;
{
register char *p;
register char *q;
register int len;
static char special[] = "+.${}()";
char *regcmp();
char *strnsave();
char *_backslash();
(void) strcat(p, s);
(void) strcat(p, "$");
for (q = p; *q; q++)
switch (*q) {
case '*':
*q++ = '.';
break;
case '?':
*q = '.';
break;
case '\\':
if (!*++q)
q--;
break;
case '[':
if (q[1] == '!')
q[1] = '^';
break;
default:
break;
}
free(p);
return q;
}