/*
 *  This file is part of DVS, a simple distributed versioning system
 *  See http://www.cs.colorado.edu/~carzanig/dvs/
 *
 *  Author: Antonio Carzaniga <carzanig@cs.colorado.edu>
 *
 *  Copyright (C) 1998-2002 University of Colorado
 *
 *  This program 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 2
 *  of the License, or (at your option) any later version.
 *
 *  This program 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 this program; if not, write to the Free Software
 *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307,
 *  USA, or send email to carzanig@cs.colorado.edu.
 *
 *
 *  $Id: misclib.h,v 1.11 2002/05/01 17:36:29 carzanig Exp $
 */
#ifndef _MISCLIB_H
#define _MISCLIB_H

extern const char *nucm_err[];
extern t_server nucmserver;

#define NUCMERROR nucm_err[NdbErrno]

extern const char *Empty;
extern const char *Cwd;
extern const char *DotDot;

extern int commit_change(const char *pathname, char *newversion);
extern int commit_change_replace(const char *pathname);
extern int abort_change(const char *pathname, int force);
extern int add_new_artifact(const char *pathname);
extern int open_artifact(char *pathname, int force);
extern int initiate_change(const char *pathname);
extern char *resolve_last(char *pathname);
extern int is_in_current_collection(const char *pathname);
extern int ask_question(int deflt, const char *format,...);
extern int check_non_dvs(const char *pathname);
extern int please_wait_is_quiet;
extern void please_wait();
extern void wipe_please_wait();
extern int patched_nc_close(const char *filename, 
			    const char *pcwd, 
			    int forced);
extern int not_dot_or_dotdot(const char *path);

#define RESOLVE(path,operation) \
 ((operation) >= 0 || \
  (NdbErrno == NdbUnknown && local_path(path) \
  && printf(M_Trying, path, nucmserver.host, nucmserver.port, path) \
  && attach_server_x(path, &nucmserver) != NULL && (operation) >= 0))

#endif

