~ubuntu-branches/ubuntu/natty/curl/natty-security

« back to all changes in this revision

Viewing changes to src/os-specific.c

  • Committer: Bazaar Package Importer
  • Author(s): Bhavani Shankar
  • Date: 2010-06-20 13:56:28 UTC
  • mfrom: (3.4.7 sid)
  • Revision ID: james.westby@ubuntu.com-20100620135628-e30tp9jldq6hq985
Tags: 7.21.0-1ubuntu1
* Merge from debian unstable.  Remaining changes: LP: #596334
  - Keep build deps in main:
    - Drop build dependencies: stunnel, libssh2-1-dev
    - Add build-dependency on openssh-server
    - Drop libssh2-1-dev from libcurl4-openssl-dev's Depends.

Show diffs side-by-side

added added

removed removed

Lines of Context:
18
18
 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
19
19
 * KIND, either express or implied.
20
20
 *
21
 
 * $Id: os-specific.c,v 1.2 2009-06-10 18:02:11 yangtse Exp $
22
21
 ***************************************************************************/
23
22
#include "setup.h"
24
23
 
109
108
  decc$exit(vms_code);
110
109
}
111
110
 
 
111
#if defined(__DECC) && !defined(__VAX) && \
 
112
    defined(__CRTL_VER) && (__CRTL_VER >= 70301000)
 
113
 
 
114
/*
 
115
 * 2004-09-19 SMS.
 
116
 *
 
117
 * decc_init()
 
118
 *
 
119
 * On non-VAX systems, use LIB$INITIALIZE to set a collection of C
 
120
 * RTL features without using the DECC$* logical name method, nor
 
121
 * requiring the user to define the corresponding logical names.
 
122
 */
 
123
 
 
124
#include <unixlib.h>
 
125
 
 
126
/* Structure to hold a DECC$* feature name and its desired value. */
 
127
typedef struct {
 
128
  char *name;
 
129
  int value;
 
130
} decc_feat_t;
 
131
 
 
132
/* Array of DECC$* feature names and their desired values. */
 
133
static decc_feat_t decc_feat_array[] = {
 
134
  /* Preserve command-line case with SET PROCESS/PARSE_STYLE=EXTENDED */
 
135
  { "DECC$ARGV_PARSE_STYLE", 1 },
 
136
  /* Preserve case for file names on ODS5 disks. */
 
137
  { "DECC$EFS_CASE_PRESERVE", 1 },
 
138
  /* Enable multiple dots (and most characters) in ODS5 file names,
 
139
     while preserving VMS-ness of ";version". */
 
140
  { "DECC$EFS_CHARSET", 1 },
 
141
  /* List terminator. */
 
142
  { (char *)NULL, 0 }
 
143
};
 
144
 
 
145
/* Flag to sense if decc_init() was called. */
 
146
static int decc_init_done = -1;
 
147
 
 
148
/* LIB$INITIALIZE initialization function. */
 
149
static void decc_init(void)
 
150
{
 
151
  int feat_index;
 
152
  int feat_value;
 
153
  int feat_value_max;
 
154
  int feat_value_min;
 
155
  int i;
 
156
  int sts;
 
157
 
 
158
  /* Set the global flag to indicate that LIB$INITIALIZE worked. */
 
159
  decc_init_done = 1;
 
160
 
 
161
  /* Loop through all items in the decc_feat_array[]. */
 
162
  for(i = 0; decc_feat_array[i].name != NULL; i++) {
 
163
 
 
164
    /* Get the feature index. */
 
165
    feat_index = decc$feature_get_index( decc_feat_array[i].name);
 
166
 
 
167
    if(feat_index >= 0) {
 
168
      /* Valid item.  Collect its properties. */
 
169
      feat_value = decc$feature_get_value( feat_index, 1);
 
170
      feat_value_min = decc$feature_get_value( feat_index, 2);
 
171
      feat_value_max = decc$feature_get_value( feat_index, 3);
 
172
 
 
173
      if((decc_feat_array[i].value >= feat_value_min) &&
 
174
         (decc_feat_array[i].value <= feat_value_max)) {
 
175
        /* Valid value.  Set it if necessary. */
 
176
        if(feat_value != decc_feat_array[i].value) {
 
177
          sts = decc$feature_set_value( feat_index, 1,
 
178
                                        decc_feat_array[i].value);
 
179
        }
 
180
      }
 
181
      else {
 
182
        /* Invalid DECC feature value. */
 
183
        printf(" INVALID DECC FEATURE VALUE, %d: %d <= %s <= %d.\n",
 
184
               feat_value,
 
185
               feat_value_min, decc_feat_array[i].name, feat_value_max);
 
186
      }
 
187
    }
 
188
    else {
 
189
      /* Invalid DECC feature name. */
 
190
      printf(" UNKNOWN DECC FEATURE: %s.\n", decc_feat_array[i].name);
 
191
    }
 
192
 
 
193
  }
 
194
}
 
195
 
 
196
/* Get "decc_init()" into a valid, loaded LIB$INITIALIZE PSECT. */
 
197
 
 
198
#pragma nostandard
 
199
 
 
200
/* Establish the LIB$INITIALIZE PSECTs, with proper alignment and
 
201
   other attributes.  Note that "nopic" is significant only on VAX. */
 
202
#pragma extern_model save
 
203
#pragma extern_model strict_refdef "LIB$INITIALIZ" 2, nopic, nowrt
 
204
const int spare[8] = {0};
 
205
#pragma extern_model strict_refdef "LIB$INITIALIZE" 2, nopic, nowrt
 
206
void (*const x_decc_init)() = decc_init;
 
207
#pragma extern_model restore
 
208
 
 
209
/* Fake reference to ensure loading the LIB$INITIALIZE PSECT. */
 
210
#pragma extern_model save
 
211
int LIB$INITIALIZE(void);
 
212
#pragma extern_model strict_refdef
 
213
int dmy_lib$initialize = (int) LIB$INITIALIZE;
 
214
#pragma extern_model restore
 
215
 
 
216
#pragma standard
 
217
 
 
218
#endif /* __DECC && !__VAX && __CRTL_VER && __CRTL_VER >= 70301000 */
 
219
 
112
220
#endif /* __VMS */
113
221