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.
11 static char **vms_argv = NULL;
13 static int max_files = 10000;
20 vms_expand_args(old_argc, argv)
29 vms_argv = (char**)xmalloc((max_files+1)*sizeof(char*));
31 vms_argv[new_argc++] = **argv;
33 for (i=1; i < *old_argc; i++) {
34 if (*argv[0][i] == '-') { /* switches */
35 if (new_argc < max_files) {
36 vms_argv[new_argc++] = argv[0][i];
40 if (find_file_c(argv[0][i], buf, sizeof(buf), &context) & 1 != 1) {
45 if (new_argc < max_files) {
46 vms_argv[new_argc++] = argv[0][i];
49 p = (char*)xmalloc(strlen(buf)+1);
51 if (new_argc < max_files) {
52 vms_argv[new_argc++] = p;
54 while (find_file_c(argv[0][i], buf,
55 sizeof(buf), &context) & 1 == 1) {
56 p = (char*)xmalloc(strlen(buf)+1);
58 if (new_argc < max_files) {
59 vms_argv[new_argc++] = p;
65 if (new_argc <= max_files) {
67 vms_argv[new_argc] = NULL;
70 free(vms_argv); /* the expanded file names should also be freed ... */
72 max_files = new_argc + 1;
73 vms_expand_args(old_argc, argv);
77 int find_file_c(in,out,out_len,context)
83 struct Str_desc in_desc,out_desc;
88 in_desc.length = strlen(in);
91 out_desc.length = out_len;
93 status = lib$find_file(&in_desc,&out_desc,context);