On Wed, 2003-03-26 at 16:27, Dave Lopata wrote:
> DEBUG: .
> DEBUG: ..
> DEBUG: 20
> DEBUG: 20
> DEBUG: 20
> DEBUG: 20
> DEBUG: 20
> DEBUG: 20
> DEBUG: 20
> DEBUG: 20
> DEBUG: 20
> DEBUG: cu
> 0 saved files were found!
So in the end, the above 12 entries are what are being returned from
dirent. This corresponds to ".", "..", the following 9 files (from your
previous email) and the "current_id.txt" file, only truncated at 2
characters:
-rw-r--r-- 1 dlopata family 50505 Mar 25 15:15 20030325143901.png
-rw-r--r-- 1 dlopata family 1030482 Mar 25 14:42 20030325143901.ps
-rw-r--r-- 1 dlopata family 5303 Mar 25 15:15 20030325143901-t.png
-rw-r--r-- 1 dlopata family 2460 Mar 25 14:39 20030325143938.png
-rw-r--r-- 1 dlopata family 301 Mar 25 14:39 20030325143938-t.png
-rw-r--r-- 1 dlopata family 8369 Mar 26 09:59 20030326095947.png
-rw-r--r-- 1 dlopata family 1667 Mar 26 09:59 20030326095947-t.png
-rw-r--r-- 1 dlopata family 11079 Mar 26 10:02 20030326100231.png
-rw-r--r-- 1 dlopata family 2413 Mar 26 10:02 20030326100231-t.png
Because the filenames are truncated by the time compare_dirents sees
them, I think the problem must be somewhere in here in tuxpaint.c, but I
can't see where:
#define MAX_FILES 256 /* Max. # of files in a dir. to worry about... */
...
#include <dirent.h>
...
DIR * d;
...
struct dirent * f;
...
struct dirent fs[MAX_FILES];
...
d = opendir(dirname);
...
f = readdir(d);
if (f != NULL)
{
memcpy(&(fs[num_files_in_dir]), f, sizeof(struct dirent));
num_files_in_dir++;
}
(I hope I didn't snip too much context.)
It looks like the memcpy should work. I don't see where the filename
would get truncated to 2 characters unless sizeof(struct dirent) doesn't
behave the way I think it should. Maybe some print statements thrown in
for sanity checking here would help?
I started taking a peek at the glibc /usr/include/dirent.h
Ben
> NOTRANS: Yes
> NOTRANS: No
> DEBUG: There are no saved files!
> NOTRANS: There are no saved files!
> DEBUG: There are no saved files!
> DEBUG: ...
> NOTRANS: There are no saved files!
> ORIGINAL: There are no saved files!
> UPPERCASE: There are no saved files!
> _______________________________________________
> Tuxpaint-dev mailing list
> [EMAIL PROTECTED]
> http://tux4kids.net/mailman/listinfo/tuxpaint-dev
--
Ben Armstrong <[EMAIL PROTECTED]>
_______________________________________________
Tuxpaint-dev mailing list
[EMAIL PROTECTED]
http://tux4kids.net/mailman/listinfo/tuxpaint-dev