2
* Copyright (C) 2001 Ken Steen.
4
* This program is free software; you can redistribute it and/or modify
5
* it under the terms of the GNU General Public License as published by
6
* the Free Software Foundation; either version 2 of the License, or
7
* (at your option) any later version.
9
* This program is distributed in the hope that it will be useful,
10
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
* GNU General Public License for more details.
14
* You should have received a copy of the GNU General Public License
15
* along with this program; if not, write to the Free Software
16
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
26
char valid_registers[] = {'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i',
27
'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x',
28
'y', 'z', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M',
29
'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z'};
32
is_valid_register(int key)
36
for (x = 0; x < strlen(valid_registers); x++)
38
if (key == (int)valid_registers[x])
46
check_for_duplicate_file_names(int pos, char *file)
50
for (z = 0; z < reg[pos].num_files; z++)
52
if (!strcmp(file, reg[pos].files[z]))
59
append_to_register(int key, char *file)
63
if (access(file, F_OK))
66
for (i = 0; i < NUM_REGISTERS; i++)
68
if (reg[i].name == key)
70
if (check_for_duplicate_file_names(i, file))
73
reg[i].files = (char **)realloc(reg[i].files,
74
reg[i].num_files * sizeof(char *));
75
reg[i].files[reg[i].num_files - 1] = strdup(file);
83
clear_register(int key)
87
for (i = 0; i < NUM_REGISTERS; i++)
89
if (reg[i].name == key)
91
int y = reg[i].num_files;
95
my_free(reg[i].files[y]);