1 /*
2  *  CP/M Directory browsing
3  *
4  *  Stefano, 5 Jun 2013
5  *
6  *
7  *  $Id: dir_get_entry_name.c,v 1.1 2013-06-06 08:58:32 stefano Exp $
8  */
9 
10 #include <cpm.h>
11 
12 
13 char dest[20];	// temp filename buffer
14 
15 int i,j;
16 char * source;
17 
18 
patch_chars(int startpos,int endpos)19 patch_chars (int startpos, int endpos)
20 {
21 	for (i = startpos; i < endpos; i++)
22 	{
23 		if (source[i] == ' ') break;
24 		dest[j++] = source[i] & 0x7F;
25 	}
26 }
27 
dir_get_entry_name()28 char *dir_get_entry_name()
29 {
30 
31 	source = fc_dirbuf + fc_dirpos * 32;
32 	j = 0;
33 	i = 1;
34 
35 	patch_chars (1, 9);
36 
37 	if (source[9] != ' ')
38 		dest[j++] = '.';
39 
40 	patch_chars (9, 12);
41 
42 	dest[j] = '\0';
43 
44 	return dest;
45 }
46