home *** CD-ROM | disk | FTP | other *** search
/ Skunkware 5 / Skunkware 5.iso / src / Tools / vtcl / doc / TildeSubst.3 < prev    next >
Encoding:
Text File  |  1995-07-10  |  3.8 KB  |  93 lines

  1. '\"
  2. '\" Copyright (c) 1989-1993 The Regents of the University of California.
  3. '\" All rights reserved.
  4. '\"
  5. '\" Permission is hereby granted, without written agreement and without
  6. '\" license or royalty fees, to use, copy, modify, and distribute this
  7. '\" documentation for any purpose, provided that the above copyright
  8. '\" notice and the following two paragraphs appear in all copies.
  9. '\"
  10. '\" IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY
  11. '\" FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
  12. '\" ARISING OUT OF THE USE OF THIS DOCUMENTATION, EVEN IF THE UNIVERSITY OF
  13. '\" CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  14. '\"
  15. '\" THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
  16. '\" INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
  17. '\" AND FITNESS FOR A PARTICULAR PURPOSE.  THE SOFTWARE PROVIDED HEREUNDER IS
  18. '\" ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO
  19. '\" PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
  20. '\" 
  21. '\" $Header: /user6/ouster/tcl/man/RCS/TildeSubst.3,v 1.10 93/04/08 14:00:43 ouster Exp $ SPRITE (Berkeley)
  22. '\" 
  23. '\"----------------------------------------------------------------------------
  24. '\"    @(#) TildeSubst.3 26.1 93/10/22 SCOINC
  25. '\"
  26. '\"     Copyright (C) The Santa Cruz Operation, 1992-1993.
  27. '\"     This Module contains Proprietary Information of
  28. '\"    The Santa Cruz Operation, and should be treated as Confidential.
  29. '\"----------------------------------------------------------------------------
  30. .so ../man.macros
  31. .HS Tcl_TildeSubst tclc 7.0
  32. .BS
  33. .SH NAME
  34. Tcl_TildeSubst \- replace tilde with home directory in a file name
  35. .SH SYNOPSIS
  36. .nf
  37. \fB#include <tcl.h>\fR
  38. .sp
  39. char *
  40. .VS
  41. \fBTcl_TildeSubst\fR(\fIinterp\fR, \fIname\fR, \fIbufferPtr)
  42. .VE
  43. .SH ARGUMENTS
  44. .AS Tcl_DString *bufferPtr
  45. .AP Tcl_Interp *interp in
  46. Interpreter in which to report an error, if any.
  47. .AP char *name in
  48. File name, which may start with a ``~''.
  49. .AP Tcl_DString *bufferPtr
  50. .VS
  51. If needed, this dynamic string is used to store the new file name.
  52. At the time of the call it should be uninitialized or empty.  The
  53. caller must eventually call \fBTcl_DStringFree\fR to free up
  54. anything stored here.
  55. .VE
  56. .BE
  57.  
  58. .SH DESCRIPTION
  59. .PP
  60. This utility procedure does tilde substition.  If \fIname\fR doesn't
  61. start with a ``~'' character, then the procedure returns \fIname\fR.
  62. If \fIname\fR does start with a tilde, then \fBTcl_TildeSubst\fR
  63. returns a new string identical to \fIname\fR except that the first
  64. element of \fIname\fR is replaced with the location of the home
  65. directory for the given user.  The substitution is carried out in
  66. the same way that it would be done by \fIcsh\fR.  If the tilde is
  67. followed immediately by a slash, then the \fB$HOME\fR environment
  68. variable is substituted.  Otherwise the characters between the
  69. tilde and the next slash are taken as a user name, which is
  70. looked up in the password file;  the user's home directory is
  71. retrieved from the password file and substituted.
  72. .PP
  73. If
  74. .VS
  75. \fBTcl_TildeSubst\fR has to do tilde substitution then it uses
  76. the dynamic string at \fI*bufferPtr\fR to hold the new string it
  77. generates.  After \fBTcl_TildeSubst\fR returns, the caller must
  78. eventually invoke \fBTcl_DStringFree\fR to free up any information
  79. placed in \fI*bufferPtr\fR.  The caller need not know whether or
  80. not \fBTcl_TildeSubst\fR actually used the string;  \fBTcl_TildeSubst\fR
  81. initializes \fI*bufferPtr\fR even if it doesn't use it, so the call to
  82. \fBTcl_DStringFree\fR will be safe in either case.
  83. .VE
  84. .PP
  85. If an error occurs (e.g. because there was no user by the given
  86. name) then NULL is returned and an error message will be left
  87. at \fIinterp->result\fR.  It is assumed that \fIinterp->result\fR
  88. has been initialized in the standard way when \fBTcl_TildeSubst\fR
  89. is invoked.
  90.  
  91. .SH KEYWORDS
  92. file name, home directory, tilde, user
  93.