diff options
Diffstat (limited to 'unsupported/tandem')
-rw-r--r-- | unsupported/tandem/ChangeLog | 31 | ||||
-rwxr-xr-x | unsupported/tandem/compit | 1 | ||||
-rw-r--r-- | unsupported/tandem/config.h | 209 | ||||
-rw-r--r-- | unsupported/tandem/getid.c | 120 | ||||
-rw-r--r-- | unsupported/tandem/isatty.c | 22 | ||||
-rw-r--r-- | unsupported/tandem/popen.c | 128 | ||||
-rw-r--r-- | unsupported/tandem/popen.h | 20 | ||||
-rw-r--r-- | unsupported/tandem/ptchlvl.h | 1 | ||||
-rw-r--r-- | unsupported/tandem/strdup.c | 15 | ||||
-rw-r--r-- | unsupported/tandem/strnchk.c | 95 | ||||
-rw-r--r-- | unsupported/tandem/tmisc.c | 196 |
11 files changed, 838 insertions, 0 deletions
diff --git a/unsupported/tandem/ChangeLog b/unsupported/tandem/ChangeLog new file mode 100644 index 00000000..9447e874 --- /dev/null +++ b/unsupported/tandem/ChangeLog @@ -0,0 +1,31 @@ +Sun Jun 3 13:04:44 2001 Arnold D. Robbins <arnold@skeeve.com> + + * Release 3.1.0: Release tar file made. And there was + rejoicing. + +Sun Jan 28 15:50:02 2001 Eli Zaretskii <eliz@is.elta.co.il> + + * tmisc.c (os_restore_mode): New function + +Sun Dec 3 16:53:37 2000 Arnold D. Robbins <arnold@skeeve.com> + + * tmisc.c (os_setbinmode): new function. + +Tue Nov 7 14:09:14 2000 Arnold D. Robbins <arnold@skeeve.com> + + * tmisc.c (os_is_setuid): new function. + +Tue Jun 1 14:09:36 1999 Arnold D. Robbins <arnold@gnu.org> + + Sync with changes in 3.0.4 for non-Unix popen/pclose + * popen.h: add defines for popen and pclose. + * config.h: add define for HAVE_POPEN_H. + +Wed Jul 30 19:53:52 1997 Arnold D. Robbins <arnold@gnu.org> + + * Close-on-exec changes: + tmisc.c: (os_close_on_exec, os_isdir): new functions. + +Mon Jul 27 11:40:00 1997 Arnold D. Robbins <arnold@gnu.org> + + * Initial integration of Tandem stuff into gawk source tree. diff --git a/unsupported/tandem/compit b/unsupported/tandem/compit new file mode 100755 index 00000000..3bf1aea5 --- /dev/null +++ b/unsupported/tandem/compit @@ -0,0 +1 @@ +?TACL MACRO
#FRAME
#PUSH #INLINEPREFIX
#SET #INLINEPREFIX +
==
== Compile the bits
==
c /in allocac, out allocax/allocao; symbols,WIDE,define TANDEM,define HAVE_CONFIG_H,SSV0 "$system.system",SSV1 "[#defaults]"
c /in arrayc, out arrayx/arrayo; symbols,WIDE,define TANDEM,define HAVE_CONFIG_H,SSV0 "$system.system",SSV1 "[#defaults]"
c /in builtinc, out builtinx/builtino; symbols,WIDE,define TANDEM,define HAVE_CONFIG_H,SSV0 "$system.system",SSV1 "[#defaults]"
c /in dfac, out dfax/dfao; symbols,WIDE,define TANDEM,define HAVE_CONFIG_H,SSV0 "$system.system",SSV1 "[#defaults]"
c /in evalc, out evalx/evalo; symbols,WIDE,define TANDEM,define HAVE_CONFIG_H,SSV0 "$system.system",SSV1 "[#defaults]"
c /in fieldc, out fieldx/fieldo; symbols,WIDE,define TANDEM,define HAVE_CONFIG_H,SSV0 "$system.system",SSV1 "[#defaults]"
c /in gawkmisc, out gawkmisx/gawkmiso; symbols,WIDE,define TANDEM,define HAVE_CONFIG_H,SSV0 "$system.system",SSV1 "[#defaults]"
c /in getoptc, out getoptx/getopto; symbols,WIDE,define TANDEM,define HAVE_CONFIG_H,SSV0 "$system.system",SSV1 "[#defaults]"
c /in getopt1c, out getopt1x/getopt1o;symbols,WIDE,define TANDEM,define HAVE_CONFIG_H,SSV0 "$system.system",SSV1 "[#defaults]"
c /in ioc, out iox/ioo; symbols,WIDE,define TANDEM,define HAVE_CONFIG_H,SSV0 "$system.system",SSV1 "[#defaults]"
c /in isattyc, out isattyx/isattyo; symbols,WIDE,define TANDEM,define HAVE_CONFIG_H,SSV0 "$system.system",SSV1 "[#defaults]"
c /in mainc, out mainx/maino; symbols,WIDE,define TANDEM,define HAVE_CONFIG_H,SSV0 "$system.system",SSV1 "[#defaults]"
c /in missingc, out missingx/missingo; symbols,WIDE,define TANDEM,define HAVE_CONFIG_H,SSV0 "$system.system",SSV1 "[#defaults]"
c /in msgc, out msgx/msgo; symbols,WIDE,define TANDEM,define HAVE_CONFIG_H,SSV0 "$system.system",SSV1 "[#defaults]"
c /in nodec, out nodex/nodeo; symbols,WIDE,define TANDEM,define HAVE_CONFIG_H,SSV0 "$system.system",SSV1 "[#defaults]"
c /in popenc, out popenx/popeno; symbols,WIDE,define TANDEM,define HAVE_CONFIG_H,SSV0 "$system.system",SSV1 "[#defaults]"
c /in rec, out rex/reo; symbols,WIDE,define TANDEM,define HAVE_CONFIG_H,SSV0 "$system.system",SSV1 "[#defaults]"
c /in regexc, out regexx/regexo; symbols,WIDE,define TANDEM,define HAVE_CONFIG_H,SSV0 "$system.system",SSV1 "[#defaults]"
c /in awktabc, out tawktabx/tawktabo; symbols,WIDE,define TANDEM,define HAVE_CONFIG_H,SSV0 "$system.system",SSV1 "[#defaults]"
c /in versionc, out versionx/versiono; symbols,WIDE,define TANDEM,define HAVE_CONFIG_H,SSV0 "$system.system",SSV1 "[#defaults]"
==
== then bind them
==
bind/inline,out bindout/
+ select runnable object on
+ select check parameter off
+ select list * off
+ select fixups on
+ select search $system.system.cwide
+ add * from arrayo
+ add * from allocao
+ add * from builtino
+ add * from dfao
+ add * from evalo
+ add * from fieldo
+ add * from gawkmiso
+ add * from getopto
+ add * from getopt1o
+ add * from ioo
+ add * from isattyo
+ add * from maino
+ add * from missingo
+ add * from msgo
+ add * from nodeo
+ add * from popeno
+ add * from reo
+ add * from regexo
+ add * from tawktabo
+ add * from versiono
+ set heap 5000 pages
+ build awk
+ file awk
+ info unresolved *
+ list *
INLEOF
#UNFRAME
\ No newline at end of file diff --git a/unsupported/tandem/config.h b/unsupported/tandem/config.h new file mode 100644 index 00000000..c18ae485 --- /dev/null +++ b/unsupported/tandem/config.h @@ -0,0 +1,209 @@ +/* config.h. Generated automatically by configure. */ +/* configh.in. Generated automatically from configure.in by autoheader. */ +/* + * acconfig.h -- configuration definitions for gawk. + */ + +/* + * Copyright (C) 1995-1997 the Free Software Foundation, Inc. + * + * This file is part of GAWK, the GNU implementation of the + * AWK Progamming Language. + * + * GAWK 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 of the License, or + * (at your option) any later version. + * + * GAWK 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + */ + + +/* Define if on AIX 3. + System headers sometimes define this. + We just want to avoid a redefinition error message. */ +#ifndef _ALL_SOURCE +/* #undef _ALL_SOURCE */ +#endif + +/* Define if using alloca.c. */ +#define C_ALLOCA + +/* Define if type char is unsigned and you are not using gcc. */ +#ifndef __CHAR_UNSIGNED__ +#define __CHAR_UNSIGNED__ +#endif + +/* Define to empty if the keyword does not work. */ +/* #undef const */ + +/* Define to one of _getb67, GETB67, getb67 for Cray-2 and Cray-YMP systems. + This function is required for alloca.c support on those systems. */ +/* #undef CRAY_STACKSEG_END */ + +/* Define to the type of elements in the array set by `getgroups'. + Usually this is either `int' or `gid_t'. */ +#define GETGROUPS_T gid_t + +/* Define if the `getpgrp' function takes no argument. */ +#define GETPGRP_VOID 1 + +/* Define to `int' if <sys/types.h> doesn't define. */ +/* #undef gid_t */ + +/* Define if you have alloca, as a function or macro. */ +#undef HAVE_ALLOCA + +/* Define if you have <alloca.h> and it should be used (not on Ultrix). */ +#undef HAVE_ALLOCA_H + +/* Define if you don't have vprintf but do have _doprnt. */ +/* #undef HAVE_DOPRNT */ + +/* Define if your struct stat has st_blksize. */ +/* #define HAVE_ST_BLKSIZE 1 */ + +/* Define if you have <sys/wait.h> that is POSIX.1 compatible. */ +#define HAVE_SYS_WAIT_H 1 + +/* Define if your struct tm has tm_zone. */ +/* #undef HAVE_TM_ZONE */ + +/* Define if you don't have tm_zone but do have the external array + tzname. */ +#define HAVE_TZNAME 1 + +/* Define if you have the vprintf function. */ +#define HAVE_VPRINTF 1 + +/* Define if on MINIX. */ +/* #undef _MINIX */ + +/* Define to `int' if <sys/types.h> doesn't define. */ +/* #undef pid_t */ + +/* Define if the system does not provide POSIX.1 features except + with this defined. */ +/* #undef _POSIX_1_SOURCE */ + +/* Define if you need to in order for stat and other things to work. */ +/* #undef _POSIX_SOURCE */ + +/* Define as the return type of signal handlers (int or void). */ +#define RETSIGTYPE void + +/* Define to `unsigned' if <sys/types.h> doesn't define. */ +/* #undef size_t */ + +/* If using the C implementation of alloca, define if you know the + direction of stack growth for your system; otherwise it will be + automatically deduced at run-time. + STACK_DIRECTION > 0 => grows toward higher addresses + STACK_DIRECTION < 0 => grows toward lower addresses + STACK_DIRECTION = 0 => direction of growth unknown + */ +/* #undef STACK_DIRECTION */ + +/* Define if you have the ANSI C header files. */ +#define STDC_HEADERS 1 + +/* Define if you can safely include both <sys/time.h> and <time.h>. */ +#define TIME_WITH_SYS_TIME 1 + +/* Define if your <sys/time.h> declares struct tm. */ +/* #undef TM_IN_SYS_TIME */ + +/* Define to `int' if <sys/types.h> doesn't define. */ +/* #undef uid_t */ + +#define HAVE_STRINGIZE 1 /* can use ANSI # operator in cpp */ +#define REGEX_MALLOC 1 /* use malloc instead of alloca in regex.c */ +#define SPRINTF_RET int /* return type of sprintf */ +/* #undef BITOPS */ /* bitwise ops (undocumented feature) */ +/* #undef NONDECDATA */ /* non-decimal input data (undocumented feature) */ +/* #undef HAVE_MKTIME */ /* we have the mktime function */ + +/* Define if you have the fmod function. */ +#define HAVE_FMOD + +/* Define if you have the memcmp function. */ +#define HAVE_MEMCMP 1 + +/* Define if you have the memcpy function. */ +#define HAVE_MEMCPY 1 + +/* Define if you have the memset function. */ +#define HAVE_MEMSET 1 + +/* Define if you have the setlocale function. */ +#define HAVE_SETLOCALE 1 + +/* Define if you have the strchr function. */ +#define HAVE_STRCHR 1 + +/* Define if you have the strerror function. */ +#define HAVE_STRERROR 1 + +/* Define if you have the strftime function. */ +#define HAVE_STRFTIME 1 + +/* Define if you have the strncasecmp function. */ +/* Tandem doesn't have it but the file name is too long, so pretend here + and do it properly at the end of this file */ +#define HAVE_STRNCASECMP 1 + +/* Define if you have the strtod function. */ +#define HAVE_STRTOD 1 + +/* Define if you have the system function. */ +#define HAVE_SYSTEM 1 + +/* Define if you have the tzset function. */ +#define HAVE_TZSET 1 + +/* Define if you have the <fcntl.h> header file. */ +/* #undef HAVE_FCNTL_H */ + +/* Define if you have the <limits.h> header file. */ +/* #undef HAVE_LIMITS_H */ + +/* Define if you have the <locale.h> header file. */ +/* #undef HAVE_LOCALE_H */ + +/* Define if you have the <memory.h> header file. */ +#define HAVE_MEMORY_H 1 + +/* Define if you have the <signum.h> header file. */ +/* #undef HAVE_SIGNUM_H */ + +/* Define if you have the <stdarg.h> header file. */ +#define HAVE_STDARG_H 1 + +/* Define if you have the <string.h> header file. */ +#define HAVE_STRING_H 1 + +/* Define if you have the <strings.h> header file. */ +/* #undef HAVE_STRINGS_H */ + +/* Define if you have the <sys/param.h> header file. */ +#undef HAVE_SYS_PARAM_H 1 + +/* Define if you have the <sys/time.h> header file. */ +/* #undef HAVE_SYS_TIME_H */ + +/* Define if you have the <unistd.h> header file. */ +#undef HAVE_UNISTD_H 1 + +/* Define if you have the m library (-lm). */ +/* #undef HAVE_LIBM */ + +#define HAVE_POPEN_H 1 + +#include <custom.h> /* overrides for stuff autoconf can't deal with */ diff --git a/unsupported/tandem/getid.c b/unsupported/tandem/getid.c new file mode 100644 index 00000000..f933ac62 --- /dev/null +++ b/unsupported/tandem/getid.c @@ -0,0 +1,120 @@ +#if defined _MSC_VER || defined TANDEM + +#ifndef TANDEM +#ifdef OS2 +# define INCL_DOSPROCESS +# include <os2.h> +# if _MSC_VER == 510 +# define DosGetPID DosGetPid +# endif +#else +# include <process.h> +#endif + +#ifdef OS2 +int getpid(void) +{ + PIDINFO PidInfo; + + DosGetPID(&PidInfo); + return(PidInfo.pid); +} +#endif + +int getppid(void) +{ +#ifdef OS2 + PIDINFO PidInfo; + + DosGetPID(&PidInfo); + return(PidInfo.pidParent); +#else + return(0); +#endif +} + +#endif /* TANDEM */ +#ifdef TANDEM +unsigned int getuid (void) +{ + short cret; + short cwd,pwd; + + cret = PROCESS_GETINFO_(,,,,,,,,,,&cwd,&pwd); + return ((unsigned int) (cwd & 255)); +} + +unsigned int geteuid (void) +{ + short cret; + short cwd,pwd; + + cret = PROCESS_GETINFO_(,,,,,,,,,,&cwd,&pwd); + return ((unsigned int) (pwd & 255)); +} + +unsigned int getgid (void) +{ + short cret; + short cwd,pwd; + + cret = PROCESS_GETINFO_(,,,,,,,,,,&cwd,&pwd); + return ((unsigned int) ((cwd >> 8) & 255)); +} + +unsigned int getegid (void) +{ + short cret; + short cwd,pwd; + + cret = PROCESS_GETINFO_(,,,,,,,,,,&cwd,&pwd); + return ((unsigned int) ((pwd >> 8) & 255)); +} + +int getpid(void) +{ + return (0); +} + +int getppid(void) +{ + return (0); +} + +#else +unsigned int getuid (void) +{ + return (0); /* root! */ +} + + +unsigned int geteuid (void) +{ + return (0); +} + + +unsigned int getgid (void) +{ + return (0); +} + + +unsigned int getegid (void) +{ + return (0); +} + + +char *getlogin (void) +{ + return ("root"); +} + +#endif /* TANDEM */ +#endif + +int getpgrp(void) +{ + return (0); +} diff --git a/unsupported/tandem/isatty.c b/unsupported/tandem/isatty.c new file mode 100644 index 00000000..d73d7a34 --- /dev/null +++ b/unsupported/tandem/isatty.c @@ -0,0 +1,22 @@ +#include <cextdecs(FILE_GETINFO_)> +#include <stdioh> +#include <talh> + +int isatty(int fd) +{ + short cret,sfd,typ[5]; + sfd = (short) fd; + cret = FILE_GETINFO_(sfd,,,,,&typ[0]); + if(typ[0] == 6) + return (1); + else + return (0); +} +int dup(int fd) +{ + return (fd); +} +int dup2(int fd, int fd2) +{ + return (0); +} diff --git a/unsupported/tandem/popen.c b/unsupported/tandem/popen.c new file mode 100644 index 00000000..310225d3 --- /dev/null +++ b/unsupported/tandem/popen.c @@ -0,0 +1,128 @@ +#include "popen.h" +#include <stdlib.h> +#if !defined(TANDEM) +#include <io.h> +#else +#include "config.h" +#include <fcntl.h> +#endif +#include <string.h> +#if !defined(TANDEM) +#include <process.h> +#endif + +#ifdef OS2 +#ifdef _MSC_VER +#define popen(c,m) _popen(c,m) +#define pclose(f) _pclose(f) +#endif +#endif + +#ifndef _NFILE +#define _NFILE 40 +#endif + +static char template[] = "piXXXXXX"; +typedef enum { unopened = 0, reading, writing } pipemode; +static +struct { + char *command; + char *name; + pipemode pmode; +} pipes[_NFILE]; + +FILE * +os_popen( char *command, char *mode ) { + FILE *current; + char *name; + int cur; + pipemode curmode; + +#if defined(OS2) && (_MSC_VER != 510) + if (_osmode == OS2_MODE) + return(popen(command, mode)); +#endif + + /* + ** decide on mode. + */ + if(strcmp(mode,"r") == 0) + curmode = reading; + else if(strcmp(mode,"w") == 0) + curmode = writing; + else + return NULL; + /* + ** get a name to use. + */ + if((name = tempnam(".","pip"))==NULL) + return NULL; + /* + ** If we're reading, just call system to get a file filled with + ** output. + */ + if(curmode == reading) { + if ((cur = dup(fileno(stdout))) == -1) + return NULL; + if ((current = freopen(name, "w", stdout)) == NULL) + return NULL; + system(command); + if (dup2(cur, fileno(stdout)) == -1) + return NULL; + close(cur); + if((current = fopen(name,"r")) == NULL) + return NULL; + } else { + if((current = fopen(name,"w")) == NULL) + return NULL; + } + cur = fileno(current); + pipes[cur].name = name; + pipes[cur].pmode = curmode; + pipes[cur].command = strdup(command); + return current; +} + +int +os_pclose( FILE * current) { + int cur = fileno(current),rval; + +#if defined(OS2) && (_MSC_VER != 510) + if (_osmode == OS2_MODE) + return(pclose(current)); +#endif + + /* + ** check for an open file. + */ + if(pipes[cur].pmode == unopened) + return -1; + if(pipes[cur].pmode == reading) { + /* + ** input pipes are just files we're done with. + */ + rval = fclose(current); + unlink(pipes[cur].name); + } else { + /* + ** output pipes are temporary files we have + ** to cram down the throats of programs. + */ + char command[256]; + fclose(current); +#if defined(TANDEM) + sprintf(command,"%s /IN %s/",pipes[cur].command,pipes[cur].name); +#else + sprintf(command,"%s < %s",pipes[cur].command,pipes[cur].name); +#endif + rval = system(command); + unlink(pipes[cur].name); + } + /* + ** clean up current pipe. + */ + pipes[cur].pmode = unopened; + free(pipes[cur].name); + free(pipes[cur].command); + return rval; +} diff --git a/unsupported/tandem/popen.h b/unsupported/tandem/popen.h new file mode 100644 index 00000000..18605867 --- /dev/null +++ b/unsupported/tandem/popen.h @@ -0,0 +1,20 @@ +/* + +** popen.h -- prototypes for pipe functions + +*/ + +#if !defined(FILE) + +#include <stdio.h> + +#endif + + + +extern FILE *os_popen( char *, char * ); + +extern int os_pclose( FILE * ); + +#define popen os_popen +#define pclose os_close diff --git a/unsupported/tandem/ptchlvl.h b/unsupported/tandem/ptchlvl.h new file mode 100644 index 00000000..026f4a72 --- /dev/null +++ b/unsupported/tandem/ptchlvl.h @@ -0,0 +1 @@ +#define PATCHLEVEL 0 diff --git a/unsupported/tandem/strdup.c b/unsupported/tandem/strdup.c new file mode 100644 index 00000000..45f7676c --- /dev/null +++ b/unsupported/tandem/strdup.c @@ -0,0 +1,15 @@ +/* + * strdup --- duplicate a string + * + * We supply this routine for those systems that aren't standard yet. + */ + +char * +strdup (str) +register const char *str; +{ + char *p; + + p=(char *)malloc(strlen(str)+1); + return strcpy(p,str); +} diff --git a/unsupported/tandem/strnchk.c b/unsupported/tandem/strnchk.c new file mode 100644 index 00000000..faa79c4c --- /dev/null +++ b/unsupported/tandem/strnchk.c @@ -0,0 +1,95 @@ +/* + * Copyright (c) 1987 Regents of the University of California. + * All rights reserved. + * + * Redistribution and use in source and binary forms are permitted + * provided that the above copyright notice and this paragraph are + * duplicated in all such forms and that any documentation, + * advertising materials, and other materials related to such + * distribution and use acknowledge that the software was developed + * by the University of California, Berkeley. The name of the + * University may not be used to endorse or promote products derived + * from this software without specific prior written permission. + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED + * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. + */ + +#if defined(LIBC_SCCS) && !defined(lint) +static char sccsid[] = "@(#)strcasecmp.c 5.6 (Berkeley) 6/27/88"; +#endif /* LIBC_SCCS and not lint */ + +#ifdef atarist +#include <sys/types.h> +#else +#define u_char unsigned char +#endif + +/* + * This array is designed for mapping upper and lower case letter + * together for a case independent comparison. The mappings are + * based upon ascii character sequences. + */ +static u_char charmap[] = { + '\000', '\001', '\002', '\003', '\004', '\005', '\006', '\007', + '\010', '\011', '\012', '\013', '\014', '\015', '\016', '\017', + '\020', '\021', '\022', '\023', '\024', '\025', '\026', '\027', + '\030', '\031', '\032', '\033', '\034', '\035', '\036', '\037', + '\040', '\041', '\042', '\043', '\044', '\045', '\046', '\047', + '\050', '\051', '\052', '\053', '\054', '\055', '\056', '\057', + '\060', '\061', '\062', '\063', '\064', '\065', '\066', '\067', + '\070', '\071', '\072', '\073', '\074', '\075', '\076', '\077', + '\100', '\141', '\142', '\143', '\144', '\145', '\146', '\147', + '\150', '\151', '\152', '\153', '\154', '\155', '\156', '\157', + '\160', '\161', '\162', '\163', '\164', '\165', '\166', '\167', + '\170', '\171', '\172', '\133', '\134', '\135', '\136', '\137', + '\140', '\141', '\142', '\143', '\144', '\145', '\146', '\147', + '\150', '\151', '\152', '\153', '\154', '\155', '\156', '\157', + '\160', '\161', '\162', '\163', '\164', '\165', '\166', '\167', + '\170', '\171', '\172', '\173', '\174', '\175', '\176', '\177', + '\200', '\201', '\202', '\203', '\204', '\205', '\206', '\207', + '\210', '\211', '\212', '\213', '\214', '\215', '\216', '\217', + '\220', '\221', '\222', '\223', '\224', '\225', '\226', '\227', + '\230', '\231', '\232', '\233', '\234', '\235', '\236', '\237', + '\240', '\241', '\242', '\243', '\244', '\245', '\246', '\247', + '\250', '\251', '\252', '\253', '\254', '\255', '\256', '\257', + '\260', '\261', '\262', '\263', '\264', '\265', '\266', '\267', + '\270', '\271', '\272', '\273', '\274', '\275', '\276', '\277', + '\340', '\341', '\342', '\343', '\344', '\345', '\346', '\347', + '\350', '\351', '\352', '\353', '\354', '\355', '\356', '\357', + '\360', '\361', '\362', '\363', '\364', '\365', '\366', '\327', + '\370', '\371', '\372', '\373', '\374', '\375', '\376', '\337', + '\340', '\341', '\342', '\343', '\344', '\345', '\346', '\347', + '\350', '\351', '\352', '\353', '\354', '\355', '\356', '\357', + '\360', '\361', '\362', '\363', '\364', '\365', '\366', '\367', + '\370', '\371', '\372', '\373', '\374', '\375', '\376', '\377', +}; + +int +strcasecmp(s1, s2) + const char *s1, *s2; +{ + register u_char *cm = charmap, + *us1 = (u_char *)s1, + *us2 = (u_char *)s2; + + while (cm[*us1] == cm[*us2++]) + if (*us1++ == '\0') + return(0); + return(cm[*us1] - cm[*--us2]); +} + +int +strncasecmp(s1, s2, n) + const char *s1, *s2; + register size_t n; +{ + register u_char *cm = charmap, + *us1 = (u_char *)s1, + *us2 = (u_char *)s2; + + while ((long)(--n) >= 0 && cm[*us1] == cm[*us2++]) + if (*us1++ == '\0') + return(0); + return((long)n < 0 ? 0 : cm[*us1] - cm[*--us2]); +} diff --git a/unsupported/tandem/tmisc.c b/unsupported/tandem/tmisc.c new file mode 100644 index 00000000..a8db4da5 --- /dev/null +++ b/unsupported/tandem/tmisc.c @@ -0,0 +1,196 @@ + +/* os_close_on_exec --- set close on exec flag, print warning if fails */ + +void +os_close_on_exec(fd, name, what, dir) +int fd; +char *name, *what, *dir; +{ + /* no-op */ +} + +/* os_isdir --- is this an fd on a directory? */ + +#if ! defined(S_ISDIR) && defined(S_IFDIR) +#define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR) +#endif + +int +os_isdir(fd) +int fd; +{ + struct stat sbuf; + + return (fstat(fd, &sbuf) == 0 && S_ISDIR(sbuf.st_mode)); +} +/* + * gawkmisc.c --- miscellanious gawk routines that are OS specific. + */ + +/* + * Copyright (C) 1986, 1988, 1989, 1991 - 95 the Free Software Foundation, Inc. + * + * This file is part of GAWK, the GNU implementation of the + * AWK Progamming Language. + * + * GAWK 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 of the License, or + * (at your option) any later version. + * + * GAWK 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + */ + +char quote = '"'; +char envsep = ';'; +char *defpath = ""; + +/* gawk_name --- pull out the "gawk" part from how the OS called us */ + +char * +gawk_name(filespec) +const char *filespec; +{ + char *p, *q; + + p = (char *) filespec; /* Sloppy... */ + + if ((q = strrchr(p, '.')) != NULL) + p = q + 1; + return p; +} + +/* os_arg_fixup --- fixup the command line */ + +void +os_arg_fixup(argcp, argvp) +int *argcp; +char ***argvp; +{ + return; +} + +/* os_devopen --- open special per-OS devices */ + +int +os_devopen(name, flag) +const char *name; +int flag; +{ + /* no-op */ + return -1; +} + +/* optimal_bufsize --- determine optimal buffer size */ + +int +optimal_bufsize(fd, stb) +int fd; +struct stat *stb; +{ + /* + * TANDEM doesn't have a stat function. + * So we just return 4096 which is the Tandem disk block size. + */ + + /* set all members to zero. */ + + memset(stb, '\0', sizeof(struct stat)); + + /* set file size to arbitrary non-zero value. */ + stb->st_size = 1; + + return 4096; +} + +/* ispath --- return true if path has directory components */ + +int +ispath(file) +const char *file; +{ + for (; *file; file++) { + switch (*file) { + case '.': + return 1; + } + } + return 0; +} + +/* isdirpunct --- return true if char is a directory separator */ + +int +isdirpunct(c) +int c; +{ + return (strchr(".\\", c) != NULL); +} + +void +initstate(i, j, k) +unsigned i; +char * j; +int k; +{ +} + +void setstate(i) +char * i; +{ +} + +/* os_close_on_exec --- set close on exec flag, print warning if fails */ + +void +os_close_on_exec(fd, name, what, dir) +int fd; +char *name, *what, *dir; +{ + /* no-op */ +} + +/* os_isdir --- is this an fd on a directory? */ + +/* can't do this on tandem, so just assume it's not a directory */ + +int +os_isdir(fd) +int fd; +{ + return 0; +} + +/* os_is_setuid --- true if running setuid root */ + +int +os_is_setuid() +{ + return 0; +} + +/* os_setbinmode --- set binary mode on file */ + +int +os_setbinmode (fd, mode) +int fd, mode; +{ + return 0; +} + +/* os_restore_mode --- restore the original mode of the console device */ + +void +os_restore_mode (fd) +int fd; +{ + /* no-op */ + return; +} |