Start coding un_attach

This commit is contained in:
Michiel Broek 2004-07-17 12:00:01 +00:00
parent ddbfa25b0f
commit d4177f9895
2 changed files with 26 additions and 6 deletions

View File

@ -57,7 +57,7 @@ int attach(faddr noden, char *ofile, int mode, char flavor, int fdn)
/*
* Check if we attach a file with the same name
*/
if ((fdn) && (un_attach(noden, flavor, ofile) == FALSE)) {
if ((fdn) && (un_attach(noden, ofile) == FALSE)) {
WriteError("attach: can't un_attach %s, %s", ofile, strerror(rc));
return FALSE;
}
@ -137,7 +137,7 @@ int attach(faddr noden, char *ofile, int mode, char flavor, int fdn)
/*
* Remove a file from the flofile, also search for a .tic file.
*/
int un_attach(faddr node, char flavor, char *filename)
int un_attach(faddr node, char *filename)
{
char *flofile, *buf;
FILE *fp;
@ -146,17 +146,37 @@ int un_attach(faddr node, char flavor, char *filename)
buf = calloc(PATH_MAX+3, sizeof(char));
flofile = calloc(PATH_MAX, sizeof(char));
sprintf(flofile, "%s", floname(&noden, flavor));
sprintf(flofile, "%s", floname(&node, 'h'));
if ((fp = fopen(flofile, "r+"))) {
while (fgets(buf, sizeof(buf -1), fp)) {
Striplf(buf);
Syslog('p', "hlo: \"%s\"", buf);
}
fclose(fp);
}
sprintf(flofile, "%s", floname(&node, 'c'));
if ((fp = fopen(flofile, "r+"))) {
while (fgets(buf, sizeof(buf -1), fp)) {
Striplf(buf);
Syslog('p', "clo: \"%s\"", buf);
}
fclose(fp);
}
sprintf(flofile, "%s", floname(&node, 'f'));
if ((fp = fopen(flofile, "r+"))) {
while (fgets(buf, sizeof(buf -1), fp)) {
Striplf(buf);
Syslog('p', "flo: \"%s\"", buf);
}
fclose(flofile);
fclose(fp);
}
free(flofile);
free(buf);

View File

@ -2115,7 +2115,7 @@ int le_int(int);
* From attach.c
*/
int attach(faddr, char *, int, char, int);
int un_attach(faddr, char, char *);
int un_attach(faddr, char *);