/*
 *  CPDIST.H
 */

/*
 * (c)Copyright 1992-93 by Tobias Ferber.
 *
 * This file is part of CPDIST.
 *
 * CPDIST is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published
 * by the Free Software Foundation; either version 1 of the License,
 * or (at your option) any later version.
 *
 * CPDIST is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with CPDIST; see the file COPYING.  If not, write to
 * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
 */

#ifndef CPDIST_H
#define CPDIST_H

#include <ctype.h>
#include <stdarg.h>
#include <stdio.h>

#include "version.h"

/* Please feel free to compile with the -DNO_PERROR */
#ifdef NO_PERROR
#define perror(s) do { printf("%s: I/O error detected.\n",s); } while(0)
#endif /* NO_PERROR */

#ifdef __MSDOS__
#define PSLASH            '\\'
#else /* !__MSDOS__ */
#define PSLASH            '/'
#endif /* __MSDOS__ */

/* please do not change the option prefix.  This is not supported (yet) */
#define OPTION_PREFIX     '-'
#define DEFAULT_DISTFILE  "Distfile"

#define MAXIMUM_PATHNAME_LENGTH 256

/* options */
#define OPT_REPLACEALL   (1)     /* don't ask before blowing it away */
#define OPT_CHECKEXISTS  (1<<1)  /* check existence of source files */
#define OPT_IGNOREERRORS (1<<2)  /* ignore syntax errors in distfiles */
#define OPT_KEEPGOING    (1<<3)  /* keep going in case of I/O errors */
#define OPT_DRYRUN       (1<<4)  /* just print, don't copy */
#define OPT_SILENT       (1<<5)  /* don't print filenames when copying */

#define CP_REPLACEALL    ((global_opts & OPT_REPLACEALL) == OPT_REPLACEALL)
#define CP_CHECKEXISTS   ((global_opts & OPT_CHECKEXISTS) == OPT_CHECKEXISTS)
#define CP_IGNOREERRORS  ((global_opts & OPT_IGNOREERRORS) == OPT_IGNOREERRORS)
#define CP_KEEPGOING     ((global_opts & OPT_KEEPGOING) == OPT_KEEPGOING)
#define CP_DRYRUN        ((global_opts & OPT_DRYRUN) == OPT_DRYRUN)
#define CP_SILENT        ((global_opts & OPT_SILENT) == OPT_SILENT)

#ifndef __P

#if defined (__STDC__) || defined(__cplusplus)
#define __P(protos) protos
#else /* !(__STDC__ || __cplusplus) */
#define __P(protos) ()
#endif /* __STDC__ || __cplusplus */

#endif /* !__P */

/* main.c */
extern unsigned long global_opts;  /* command-line options */
extern long global_buffersize;     /* size of our copy buffer */

/* msg.c */
extern FILE *ferr;
extern char *whoami;
extern void echo __P( (const char *, ...) );
extern void lerror __P( (int, const char *, ...) );

/* args.c */
extern char *convert_args __P( (char *) );
extern void display_args __P( (void) );

/* cpdist.c */
extern int prepare_distribution __P( (char *, char *) );

/* keys.c */
extern int ln_addnode __P( (char *) );
extern int ln_member __P( (char *) );
extern void ln_purge __P( (void) );

#endif /* !CPDIST_H */

