profile.c 967 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. /** BEGIN COPYRIGHT BLOCK
  2. * Copyright 2001 Sun Microsystems, Inc.
  3. * Portions copyright 1999, 2001-2003 Netscape Communications Corporation.
  4. * All rights reserved.
  5. * END COPYRIGHT BLOCK **/
  6. #include "slapi-plugin.h"
  7. #include "repl.h"
  8. /* module: provide an interface to the profile file */
  9. static FILE *profile_fd=NULL;
  10. /* JCMREPL - Could build up in an AVL tree and dump out to disk at the end... */
  11. void profile_log(char *file,int line)
  12. {
  13. if (profile_fd==NULL)
  14. slapi_log_error(,"profile_log: profile file not open.");
  15. else
  16. {
  17. /* JCMREPL - Probably need a lock around here */
  18. fprintf(profile_fd,"%s %d\n",file,line);
  19. }
  20. }
  21. void profile_open()
  22. {
  23. char filename[MAX_FILENAME];
  24. strncpy(filename,CFG_rootpath,MAX_FILENAME);
  25. strcat(filename,CFG_profilefile);
  26. profile_fd= textfile_open(filename,"a");
  27. }
  28. void profile_close()
  29. {
  30. if (profile_fd==NULL)
  31. slapi_log_error(,"profile_close: profile file not open.");
  32. else
  33. textfile_close(profile_fd);
  34. }