On Sun, 24 Mar 2002 15:09, Lance Miller wrote:

> Any suggestions on this matter would be greatly appreciated!
> sprintf (tmp,"%s/%s",MAILSPOOL,myusername());

Instead of this you'd need to create a function that
takes MAILSPOOL and myusername() as input and spits out
the correct path, eg.

sprintf (tmp,"%s/%s",level5_homedir(MAILSPOOL,myusername()),myusername());


const char *level5_homedir(const char *mailspool, const char *username) {

  static char *res=NULL;
  int i, j=strlen(mailspool);

  if (res) free (res);
  res = (char *)malloc (j + 10 + 1);
  strcpy (res, mailspool);
  for (i=0; i<5 && i<strlen(username); i++) {
    res[j+2*i]=username[i];
    res[j+2*i+1]='/';
  }
  res[j+2*i]='\0';
  return res;
}


Never tried to compile this - just came to my mind.

-- 
MfG / Regards
Friedrich Lobenstock


Reply via email to