Mercurial > emacs
view lib-src/=etags-vmslib.c @ 19860:c17fd465ea95 libc-970911 libc-970912 libc-970913 libc-970914 libc-970915 libc-970916 libc-970917 libc-970918 libc-970919 libc-970920 libc-970921 libc-970922 libc-970923 libc-970924 libc-970925 libc-970926 libc-970927 libc-970928 libc-970929 libc-970930 libc-971001 libc-971018 libc-971019 libc-971020 libc-971021 libc-971022 libc-971023 libc-971024 libc-971025 libc-971026 libc-971027 libc-971028 libc-971029 libc-971030 libc-971031 libc-971101 libc-971102 libc-971103 libc-971104 libc-971105 libc-971106 libc-971107 libc-971108 libc-971109 libc-971110 libc-971111 libc-971112 libc-971113 libc-971114 libc-971115 libc-971116 libc-971117 libc-971118 libc-971120 libc-971121 libc-971122 libc-971123 libc-971124 libc-971125 libc-971126 libc-971127 libc-971128 libc-971129 libc-971130 libc-971201 libc-971203 libc-971204 libc-971205 libc-971206 libc-971207 libc-971208 libc-971209 libc-971210 libc-971211 libc-971212 libc-971213 libc-971214 libc-971217 libc-971218 libc-971219 libc-971220 libc-971221 libc-971222 libc-971223 libc-971224 libc-971225 libc-971226 libc-971227 libc-971228 libc-971229 libc-971230 libc-971231 libc-980103 libc-980104 libc-980105 libc-980106 libc-980107 libc-980108 libc-980109 libc-980110 libc-980111 libc-980112 libc-980114 libc-980115 libc-980116 libc-980117 libc-980118 libc-980119 libc-980120 libc-980121 libc-980122 libc-980123 libc-980124 libc-980125 libc-980126 libc-980127 libc-980128
typos.
author | Jeff Law <law@redhat.com> |
---|---|
date | Wed, 10 Sep 1997 21:16:20 +0000 |
parents | 4df2f432697b |
children |
line wrap: on
line source
/* File name wild card expansion for VMS. This file is part of the etags program. Copyright (C) 1987 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include <stdio.h> typedef char tbool; /* This is a BUG! ANY arbitrary limit is a BUG! Won't someone please fix this? */ #define MAX_FILE_SPEC_LEN 255 typedef struct { short curlen; char body[MAX_FILE_SPEC_LEN + 1]; } vspec; #define EOS '\0' #define NO 0 #define YES 1 #define NULL 0 /* gfnames - return in successive calls the name of each file specified by all the remaining args in the command-line expanding wild cards and stepping over arguments when they have been processed completely */ char* gfnames(pac, pav, p_error) int *pac; char **pav[]; tbool *p_error; { static vspec filename = {MAX_FILE_SPEC_LEN, "\0"}; short fn_exp(); while (1) if (*pac == 0) { *p_error = NO; return(NULL); } else switch(fn_exp(&filename, **pav)) { case 1: *p_error = NO; return(filename.body); break; case 0: --*pac; ++*pav; break; default: *p_error = YES; return(filename.body); break; } } /* fn_exp - expand specification of list of file names returning in each successive call the next filename matching the input spec. The function expects that each in_spec passed to it will be processed to completion; in particular, up to and including the call following that in which the last matching name is returned, the function ignores the value of in_spec, and will only start processing a new spec with the following call. If an error occurs, on return out_spec contains the value of in_spec when the error occurred. With each successive filename returned in out_spec, the function's return value is one. When there are no more matching names the function returns zero. If on the first call no file matches in_spec, or there is any other error, -1 is returned. */ #include <rmsdef.h> #include <descrip.h> #define OUTSIZE MAX_FILE_SPEC_LEN short fn_exp(out, in) vspec *out; char *in; { static long context = 0; static struct dsc$descriptor_s o; static struct dsc$descriptor_s i; static tbool pass1 = YES; long status; short retval; if (pass1) { pass1 = NO; o.dsc$a_pointer = (char *) out; o.dsc$w_length = (short)OUTSIZE; i.dsc$a_pointer = in; i.dsc$w_length = (short)strlen(in); i.dsc$b_dtype = DSC$K_DTYPE_T; i.dsc$b_class = DSC$K_CLASS_S; o.dsc$b_dtype = DSC$K_DTYPE_VT; o.dsc$b_class = DSC$K_CLASS_VS; } if ( (status = lib$find_file(&i, &o, &context, 0, 0)) == RMS$_NORMAL) { out->body[out->curlen] = EOS; return(1); } else if (status == RMS$_NMF) retval = 0; else { strcpy(out->body, in); retval = -1; } lib$find_file_end(&context); pass1 = YES; return(retval); } #ifndef OLD /* Newer versions of VMS do provide `system'. */ system(cmd) char *cmd; { fprintf(stderr, "system() function not implemented under VMS\n"); } #endif #define VERSION_DELIM ';' char *massage_name(s) char *s; { char *start = s; for ( ; *s; s++) if (*s == VERSION_DELIM) { *s = EOS; break; } else *s = tolower(*s); return(start); }