1 /* vms.c -- target dependent functions for VMS
2 * This is free software; you can redistribute it and/or modify it under the
3 * terms of the GNU General Public License, see the file COPYING.
5 * This file was written by Karl-Jose Filler <pla_jfi@pki-nbg.philips.de>
6 * and updated by Jean-loup Gailly.
12 static char **vms_argv = NULL;
14 static int max_files = 10000;
21 vms_expand_args(old_argc, argv)
30 vms_argv = xmalloc((max_files+1)*sizeof(char*));
32 vms_argv[new_argc++] = **argv;
34 for (i=1; i < *old_argc; i++) {
35 if (*argv[0][i] == '-') { /* switches */
36 if (new_argc < max_files) {
37 vms_argv[new_argc++] = argv[0][i];
41 if (find_file_c(argv[0][i], buf, sizeof(buf), &context) & 1 != 1) {
46 if (new_argc < max_files) {
47 vms_argv[new_argc++] = argv[0][i];
50 p = xmalloc(strlen(buf)+1);
52 if (new_argc < max_files) {
53 vms_argv[new_argc++] = p;
55 while (find_file_c(argv[0][i], buf,
56 sizeof(buf), &context) & 1 == 1) {
57 p = xmalloc(strlen(buf)+1);
59 if (new_argc < max_files) {
60 vms_argv[new_argc++] = p;
66 if (new_argc <= max_files) {
68 vms_argv[new_argc] = NULL;
71 free(vms_argv); /* the expanded file names should also be freed ... */
73 max_files = new_argc + 1;
74 vms_expand_args(old_argc, argv);
78 int find_file_c(in,out,out_len,context)
84 struct Str_desc in_desc,out_desc;
89 in_desc.length = strlen(in);
92 out_desc.length = out_len;
94 status = lib$find_file(&in_desc,&out_desc,context);