~ubuntu-branches/ubuntu/maverick/texinfo/maverick

« back to all changes in this revision

Viewing changes to info/tilde.c

  • Committer: Bazaar Package Importer
  • Author(s): Norbert Preining
  • Date: 2005-10-28 15:10:30 UTC
  • mto: (2.1.1 dapper) (3.1.4 hardy)
  • mto: This revision was merged to the branch mainline in revision 3.
  • Revision ID: james.westby@ubuntu.com-20051028151030-9nsf2s2k2z3fktjt
Tags: upstream-4.8
ImportĀ upstreamĀ versionĀ 4.8

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/* tilde.c -- tilde expansion code (~/foo := $HOME/foo).
2
 
   $Id: tilde.c,v 1.13 1999/03/03 22:42:21 karl Exp $
 
2
   $Id: tilde.c,v 1.3 2004/04/11 17:56:46 karl Exp $
3
3
 
4
 
   Copyright (C) 1988, 89, 90, 91, 92, 93, 96, 98, 99
5
 
   Free Software Foundation, Inc.
 
4
   Copyright (C) 1988, 1989, 1990, 1991, 1992, 1993, 1996, 1998, 1999,
 
5
   2002, 2004 Free Software Foundation, Inc.
6
6
 
7
7
   This program is free software; you can redistribute it and/or modify
8
8
   it under the terms of the GNU General Public License as published by
22
22
 
23
23
/* Include config.h before doing alloca.  */
24
24
#include "info.h"
 
25
#include "tilde.h"
25
26
 
26
27
#if defined (TEST) || defined (STATIC_MALLOC)
27
28
static void *xmalloc (), *xrealloc ();
59
60
   the tilde which starts the expansion.  Place the length of the text
60
61
   which identified this tilde starter in LEN, excluding the tilde itself. */
61
62
static int
62
 
tilde_find_prefix (string, len)
63
 
     char *string;
64
 
     int *len;
 
63
tilde_find_prefix (char *string, int *len)
65
64
{
66
65
  register int i, j, string_len;
67
66
  register char **prefixes = tilde_additional_prefixes;
92
91
/* Find the end of a tilde expansion in STRING, and return the index of
93
92
   the character which ends the tilde definition.  */
94
93
static int
95
 
tilde_find_suffix (string)
96
 
     char *string;
 
94
tilde_find_suffix (char *string)
97
95
{
98
96
  register int i, j, string_len;
99
97
  register char **suffixes = tilde_additional_suffixes;
116
114
 
117
115
/* Return a new string which is the result of tilde expanding STRING. */
118
116
char *
119
 
tilde_expand (string)
120
 
     char *string;
 
117
tilde_expand (char *string)
121
118
{
122
 
  char *result, *tilde_expand_word ();
 
119
  char *result;
123
120
  int result_size, result_index;
124
121
 
125
122
  result_size = result_index = 0;
179
176
/* Do the work of tilde expansion on FILENAME.  FILENAME starts with a
180
177
   tilde.  If there is no expansion, call tilde_expansion_failure_hook. */
181
178
char *
182
 
tilde_expand_word (filename)
183
 
     char *filename;
 
179
tilde_expand_word (char *filename)
184
180
{
185
181
  char *dirname = filename ? xstrdup (filename) : NULL;
186
182
 
236
232
                 expansion, then let them try. */
237
233
              if (tilde_expansion_failure_hook)
238
234
                {
239
 
                  char *expansion;
240
 
 
241
 
                  expansion = (*tilde_expansion_failure_hook) (username);
 
235
                  char *expansion = (*tilde_expansion_failure_hook) (username);
242
236
 
243
237
                  if (expansion)
244
238
                    {