/* omflibdl.c (emx+gcc) */

/* Mark a module of an OMFLIB as deleted.

Copyright (c) 1993 Eberhard Mattes

This file is part of the emx OMFLIB library.  This library is free
software; you can redistribute it and/or modify it under the terms of
the GNU Library General Public License as published by the Free
Software Foundation; either version 2 of the License, or (at your
option) any later version.  This library 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 Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free Software
Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.

As a special exception, programs written by Eberhard Mattes can use
this library without restrictions unless changed by someone else. */

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "omflib0.h"
#include "omflib.h"


int omflib_mark_deleted (struct omflib *p, const char *name, char *error)
{
  char buf[256];
  int (*compare)(const char *s1, const char *s2);
  int i;

  if (p->mod_count == -1 && omflib_make_mod_tab (p, error) != 0)
    return (-1);
  omflib_module_name (buf, name);
  compare = (p->flags & 1 ? strcmp : stricmp);
  for (i = 0; i < p->mod_count; ++i)
    if (compare (p->mod_tab[i].name, buf) == 0)
      {
        p->mod_tab[i].flags |= FLAG_DELETED;
        return (0);
      }
  strcpy (error, "Module not found: ");
  strcat (error, buf);
  return (0);
}
