anlwrk.c revision 462be471126495414a94f9fa35e16c02dc462c04
/*
* 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.
*/
/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
/* All Rights Reserved */
#pragma ident "%Z%%M% %I% %E% SMI"
/*
This module contains routines that find C. files
in a system spool directory, return the next C. file
to process, and break up the C. line into arguments
for processing.
*/
#include "uucp.h"
#define BOOKMARK_PRE 'A'
#define CLEAN_RETURN(fp) {\
return(0); \
/* NOTREACHED */ \
}
/* C.princetN0026 - ('C' + '.') - "princet" */
#define LLEN 50
#define MAXRQST 250
static void insert();
static short Nnext; /* index of next C. file in Fptr list */
static short Nfiles = 0; /* Number of files in Filent */
/*
* read a line from the workfile (C.file)
* wvec -> address of array to return arguments (Output)
* wcount -> maximum # of arguments to return in wvec
* NOTE: wvec should be large enough to accept wcount + 1 pointers
* since NULL is inserted after last item.
* returns:
* 0 -> no more work in this file
* positive # -> number of arguments
*/
static int
{
int i;
static short acount;
int nargs; /* return value == # args in the line */
if (file[0] == '\0') {
errent("anlwrk",
"attempt made to use old workfile was thwarted", 0,
/* NOTREACHED */
}
/* this may not work, but we'll try it */
/* It will fail if the C. name is more than */
/* the standard 14 characters - if this is the */
/* tocorrupt will exit with ASSERT */
return(0);
}
acount = 0;
if (p_bookmark != NULL) {
/* get count of already completed work */
(void) fclose(p_bookmark);
if (i <= 0)
acount = 0;
/* skip lines which have already been processed */
for (i = 0; i < acount; i++) {
break;
}
}
}
*file = '\0';
/*NOTREACHED*/
}
/* sanity checks for C. file */
/* bad C. file - stash it */
*file = '\0';
/*NOTREACHED*/
}
if (p_bookmark == NULL)
else {
(void) fclose(p_bookmark);
}
acount++;
return(nargs);
}
/*
* Check the list of work files (C.sys).
* If it is empty or the present work is exhausted, it
* will call bldflst to generate a new list.
*
* If there are no more jobs in the current job grade,
* it will call findgrade to get the new job grade to process.
*
* file -> address of array to return full pathname in
* returns:
* 0 -> no more work (or some error)
* 1 -> there is work
*/
extern int
char *file;
{
char newspool[MAXFULLNAME];
char lockname[MAXFULLNAME];
if (Nfiles == 0) {
/* If Role is MASTER and JobGrade is null, then
* there is no work for the remote.
*
* In the case of uucico slave, the job grade
* to process should be determined before building
* the work list.
*/
return(0);
if (bldflst() != 0) {
Nfiles--;
Nnext++;
return(1);
}
} else {
}
return(0);
/* Make the new job grade directory the working directory
* and set RemSpool.
*/
bldflst();
}
Nfiles--;
Nnext++;
return(1);
}
/*
* build list of work files for given system using an insertion sort
* Nfiles, Nnext, RemSpool and Rmtname are global
*
* return:
* number of C. files in list - (Nfiles)
*/
static int
bldflst()
{
return(0);
continue;
continue;
}
}
return(Nfiles);
}
/*
* get work return
* file -> place to deposit file name
* wrkvec -> array to return arguments
* wcount -> max number of args for wrkvec
* returns:
* nargs -> number of arguments
* 0 -> no arguments - fail
*/
extern int
{
int nargs;
return(0);
}
return(nargs);
}
/*
* insert - insert file name in sorted list
* return - none
*/
static void
char *file;
{
int i, j;
char *p;
for (i = Nfiles; i>0; i--) {
break;
}
if (i == LLEN) /* if this is off the end get out */
return;
/* get p (pointer) to where the text of name will go */
/* put in text of last and decrement Nfiles for make hole */
else
/* make a hole for new entry */
for (j = Nfiles; j >i; j--)
Fptr[i] = p;
Nfiles++;
return;
}