/***********************************************************************
* *
* This software is part of the ast package *
* Copyright (c) 2003-2011 AT&T Intellectual Property *
* and is licensed under the *
* Eclipse Public License, Version 1.0 *
* by AT&T Intellectual Property *
* *
* A copy of the License is available at *
* (with md5 checksum b35adb5213ca9657e911e9befb180842) *
* *
* Information and Software Systems Research *
* AT&T Research *
* Florham Park NJ *
* *
* Glenn Fowler <gsf@research.att.com> *
* *
***********************************************************************/
#pragma prototyped
/*
* keep track of --list dups
*/
#include "jcllib.h"
typedef struct Uniq_s
{
char* name;
char* value;
unsigned long count;
unsigned long flags;
int recfm;
} Uniq_t;
typedef struct State_s
{
} State_t;
/*
* return 1 if path is marked
* if dd!=0 then set dd->recfm and dd->lrecl if marked
*/
int
{
char* s;
char* e;
size_t n;
int f;
{
f = 0;
for (;;)
{
switch (*++s)
{
case 0:
break;
case '0': case '1': case '2': case '3': case '4':
case '5': case '6': case '7': case '8': case '9':
{
if (dd)
{
}
return 1;
}
break;
case 'A':
case 'a':
f |= JCL_RECFM_A;
continue;
case 'B':
case 'b':
f |= JCL_RECFM_B;
continue;
case 'D':
case 'd':
f |= JCL_RECFM_D;
continue;
case 'F':
case 'f':
f |= JCL_RECFM_F;
continue;
case 'M':
case 'm':
f |= JCL_RECFM_M;
continue;
case 'S':
case 's':
f |= JCL_RECFM_S;
continue;
case 'U':
case 'u':
f |= JCL_RECFM_U;
continue;
case 'V':
case 'v':
f |= JCL_RECFM_V;
continue;
default:
continue;
}
break;
}
}
return 0;
}
/*
* if size>0 then name is marked with %size
* and the marked name is returned
* marked names are global
*
* if size==0 then marked name, if any, is returned
* otherwise 0 returned and name is not marked
* recfm is JCL_RECFM_F or JCL_RECFM_V
*/
char*
{
register Uniq_t* u;
register char* s;
register size_t n;
int m;
return (char*)name;
{
if (!size)
return 0;
{
return 0;
}
}
{
{
(*disc->errorf)(NiL, disc, 2, "%s: inconsistent recfm %s", u->value, (recfm & JCL_RECFM_V) ? "v" : "f");
}
return u->value;
}
if (!size)
return 0;
n = 2 * (m + 1) + 8;
{
return 0;
}
sfsprintf(s, n, "%-.*s%%%s%I*u%s", m, name, (recfm & JCL_RECFM_V) ? "v" : "", sizeof(size), size, name + m);
return s;
}
static int
{
int n;
return n;
}
/*
* add name [value] to the uniq dict
*/
void
{
register Uniq_t* u;
register char* s;
register size_t n;
Uniq_t k;
{
{
return;
}
}
u->count++;
else
{
if (value)
{
return;
}
u->count = 1;
if (value)
}
}
/*
* add name=value to the diff dict
* return 1 if value is different from previous
*/
int
{
register Uniq_t* u;
register size_t n;
{
{
return -1;
}
}
{
u->count++;
return 0;
}
else
{
{
return -1;
}
u->count = 1;
}
if (n >= u->size)
{
{
return -1;
}
}
return 1;
}
/*
* list uniq name [value] with optional count
*/
int
{
register Uniq_t* u;
register int c;
register unsigned long m;
{
c = (flags & JCL_LISTCOUNTS) != 0;
if (!m || (u->flags & m))
{
if (u->value)
if (c)
}
}
{
return -1;
}
return 0;
}