| 1 |
– |
/* Copyright (c) 1994 Regents of the University of California */ |
| 2 |
– |
|
| 1 |
|
#ifndef lint |
| 2 |
< |
static char SCCSid[] = "$SunId$ LBL"; |
| 2 |
> |
static const char RCSid[] = "$Id$"; |
| 3 |
|
#endif |
| 6 |
– |
|
| 4 |
|
/* |
| 5 |
|
* Header file for tracking hierarchical object names |
| 6 |
|
*/ |
| 7 |
|
|
| 8 |
|
#include <stdio.h> |
| 9 |
+ |
#include <stdlib.h> |
| 10 |
|
#include <string.h> |
| 11 |
|
#include "parser.h" |
| 12 |
|
|
| 16 |
|
|
| 17 |
|
static int obj_maxname; /* allocated list size */ |
| 18 |
|
|
| 19 |
< |
#define ALLOC_INC 16 /* list increment */ |
| 19 |
> |
#define ALLOC_INC 16 /* list increment ( > 1 ) */ |
| 20 |
|
|
| 21 |
|
|
| 22 |
|
int |
| 26 |
|
{ |
| 27 |
|
if (ac == 1) { /* just pop top object */ |
| 28 |
|
if (obj_nnames < 1) |
| 29 |
< |
return(MG_OK); /* should be error? */ |
| 29 |
> |
return(MG_ECNTXT); |
| 30 |
|
free((MEM_PTR)obj_name[--obj_nnames]); |
| 31 |
|
obj_name[obj_nnames] = NULL; |
| 32 |
|
return(MG_OK); |
| 33 |
|
} |
| 34 |
|
if (ac != 2) |
| 35 |
|
return(MG_EARGC); |
| 36 |
< |
if (obj_nnames >= obj_maxname) { /* enlarge array */ |
| 36 |
> |
if (!isname(av[1])) |
| 37 |
> |
return(MG_EILL); |
| 38 |
> |
if (obj_nnames >= obj_maxname-1) { /* enlarge array */ |
| 39 |
|
if (!obj_maxname) |
| 40 |
|
obj_name = (char **)malloc( |
| 41 |
|
(obj_maxname=ALLOC_INC)*sizeof(char *)); |