~ubuntu-branches/ubuntu/vivid/curl/vivid

« back to all changes in this revision

Viewing changes to src/os-specific.c

Tags: 7.20.0-1
* Package is orphaned.
* New upstream release.
* Switch to dpkg-source 3.0 (quilt) format (closes: #538547).
* Fixed build error with binutils-gold (closes: #554296). 

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