This isn't my code; I'm working on getting a very old internet chat/file sharing client and server compiled for Linux - and while the server compiles fine, I'm running into errors compiling the client.
fh_lookup (const char *path)
{
struct hl_filelist_hdr *fh;
char const *p, *ent;
char *dirpath;
int len, flen, blen = 0;
u_int16_t fnlen;
struct cached_filelist *cfl;
ent = path;
len = strlen(path);
for (p = path + len - 1; p >= path; p--) {
if (*p == dir_char) {
ent = p+1;
while (p > path && *p == dir_char)
p--;
blen = (p+1) - path;
break;
}
}
dirpath = xmalloc(blen + 1);
memcpy(dirpath, path, blen);
dirpath[blen] = 0;
for (cfl = cfl_list->next; cfl; cfl = cfl->next)
if (!strcmp(cfl->path, dirpath))
break;
xfree(dirpath);
if (!cfl)
return 0;
for (fh = cfl->fh; (u_int32_t)((char *)fh - (char *)cfl->fh) <
cfl->fhlen;
(char *)fh += flen + SIZEOF_HL_DATA_HDR) {
L16NTOH(flen, &fh->len);
L16NTOH(fnlen, &fh->fnlen);
if (!memcmp(fh->fname, ent, fnlen))
return fh;
}
return fh;
}
When compiling, I get the error:
error: lvalue required as left operand of assignment
(char *)fh += flen + SIZEOF_HL_DATA_HDR) {
But I'm not entirely sure why. This error appears in for-loops throughout other files as well; So it might be old C styling, perhaps? I think the original code was written in 2003. I'm not sure. But any help to fix this would be greatly appreciated.