home *** CD-ROM | disk | FTP | other *** search
- *** cio.c.orig Wed May 29 06:51:16 1991
- --- cio.c Sun Feb 23 13:42:20 1992
- ***************
- *** 63,72 ****
- #include <sys/stat.h>
- #include <errno.h>
- #include <signal.h>
-
- ! /*--------------------------------------------------- externals ------------*/
- ! extern int errno; /* error code set by system library routines */
-
- extern FILE *fopen(); /* open a stream (should be in stdio.h) */
- extern FILE *popen(); /* open a pipe (should be in stdio.h) */
- extern char *getenv(); /* read an environment variable */
- --- 63,81 ----
- #include <sys/stat.h>
- #include <errno.h>
- #include <signal.h>
- + #include <fcntl.h>
-
- ! /* #ifdef OS2
- ! #define popen _popen
- ! #define pclose _pclose
- ! #endif */
- !
- ! #ifndef OS2
- ! #define stricmp strcmp
- ! #define strnicmp strncmp
- ! #endif
-
- + /*--------------------------------------------------- externals ------------*/
- extern FILE *fopen(); /* open a stream (should be in stdio.h) */
- extern FILE *popen(); /* open a pipe (should be in stdio.h) */
- extern char *getenv(); /* read an environment variable */
- ***************
- *** 188,199 ****
- register char *cp; /* used in string updates. */
-
- prognam = justname(argv[0]); /* program name */
- getdir(); /* go get the enviroment pointers. */
-
- /*
- * figure what the user wants us to be by reading program name
- */
- ! if (!strcmp("ciitest", prognam) || !strcmp("cootest", prognam))
- {
- getrcsdir(final, currentdir); /* setup variables. */
- /*
- --- 197,212 ----
- register char *cp; /* used in string updates. */
-
- prognam = justname(argv[0]); /* program name */
- + #ifdef OS2
- + if ( stricmp(prognam + 3, ".exe") == 0 )
- + prognam[3] = 0;
- + #endif
- getdir(); /* go get the enviroment pointers. */
-
- /*
- * figure what the user wants us to be by reading program name
- */
- ! if (!stricmp("ciitest", prognam) || !stricmp("cootest", prognam))
- {
- getrcsdir(final, currentdir); /* setup variables. */
- /*
- ***************
- *** 211,224 ****
- (void) printf("Final dir:%s:\n", final);
- return(0);
- }
- ! if (!strcmp("cii", prognam)) /* this is input.. */
- cii = TRUE; /* show we are inputs. */
- ! else if (strcmp("coo", prognam))/* it's not this either.. */
- {
- (void) printf("Just what did you think this program was, anyway??\n");
- return(-1);
- }
-
- if (!(user_id = geteuid())) /* we are a root process.. */
- {
- (void) umask(027); /* set general mask to private modes. */
- --- 224,238 ----
- (void) printf("Final dir:%s:\n", final);
- return(0);
- }
- ! if (!stricmp("cii", prognam)) /* this is input.. */
- cii = TRUE; /* show we are inputs. */
- ! else if (stricmp("coo", prognam))/* it's not this either.. */
- {
- (void) printf("Just what did you think this program was, anyway??\n");
- return(-1);
- }
-
- + #ifndef OS2
- if (!(user_id = geteuid())) /* we are a root process.. */
- {
- (void) umask(027); /* set general mask to private modes. */
- ***************
- *** 234,243 ****
- --- 248,271 ----
- }
- else
- real_user_id = user_id; /* else they should match. */
- + #else
- + real_user_id = 1; /* else they should match. */
- + #endif
-
- /* prepare for disasters */
- (void) signal(SIGINT, (int (*)()) sigcleanup);
- + #ifndef OS2
- (void) signal(SIGQUIT, (int (*)()) sigcleanup);
- + #else
- + (void) signal(SIGBREAK, (int (*)()) sigcleanup); /* OS/2 */
- + (void) signal(SIGTERM, (int (*)()) sigcleanup); /* signals */
- + #endif
- +
- + if ( argc <= 1 )
- + {
- + usage();
- + return(0);
- + }
-
- cp = cioopt;
- title[0] = '\0'; /* make sure no titles are required. */
- ***************
- *** 374,380 ****
- }
- for ( ; in < argc; in++)
- {
- ! (void) sprintf(entry, "%s/%s", currentdir, argv[in]);
- #ifdef DEBUG
- (void) printf("Processing %s\n", entry);
- #endif
- --- 402,411 ----
- }
- for ( ; in < argc; in++)
- {
- ! #ifdef OS2
- ! UnixFileName(argv[in]);
- ! #endif
- ! (void) sprintf(entry, "%s%s", currentdir, argv[in]);
- #ifdef DEBUG
- (void) printf("Processing %s\n", entry);
- #endif
- ***************
- *** 406,412 ****
- ;
- for ( ; in < argc; in++)
- {
- ! (void) sprintf(ep, "/%s", argv[in]);
- #ifdef DEBUG
- (void) printf("Processing %s\n", entry);
- #endif
- --- 437,446 ----
- ;
- for ( ; in < argc; in++)
- {
- ! #ifdef OS2
- ! UnixFileName(argv[in]);
- ! #endif
- ! (void) sprintf(ep, "%s", argv[in]);
- #ifdef DEBUG
- (void) printf("Processing %s\n", entry);
- #endif
- ***************
- *** 438,443 ****
- --- 472,479 ----
- FILE *pp;
- char *cmd, *entry;
-
- + if ( dir[strlen(dir) - 1] == '/' )
- + dir[strlen(dir) - 1] = 0;
- (void) sprintf(cmd = memalloc(strlen(dir) + 4), "ls %s", dir);
- pp = popen(cmd, "r");
- free(cmd);
- ***************
- *** 506,512 ****
- if (noexec)
- {
- (void) printf("Logfile entry bypassed.\n");
- ! (void) strcpy(logstr, " "); /* fake it */
- }
- else if (!getfinput(titlest, TYPE_LOG)) /* if we entered anything */
- {
- --- 542,548 ----
- if (noexec)
- {
- (void) printf("Logfile entry bypassed.\n");
- ! (void) strcpy(logstr, ""); /* fake it */
- }
- else if (!getfinput(titlest, TYPE_LOG)) /* if we entered anything */
- {
- ***************
- *** 570,576 ****
- if (access(final, 0)) /* it's not here... */
- if (!makedir(final)) /* so try and make it. */
- {
- ! (void) printf("Could not create directory :%s:\n", final);
- return(FALSE);
- }
- *st = '/'; /* restore the rest of the file name. */
- --- 606,612 ----
- if (access(final, 0)) /* it's not here... */
- if (!makedir(final)) /* so try and make it. */
- {
- ! (void) printf("Could not create directory: %s:\n", final);
- return(FALSE);
- }
- *st = '/'; /* restore the rest of the file name. */
- ***************
- *** 625,634 ****
- (void) printf("%s already exists. Overwrite? (yes) ", final);
- (void) strrd(cmdbuf, 20, stdin);
- (void) strlwr(cmdbuf);
- ! if (strncmp(cmdbuf, "yes", strlen(cmdbuf)))
- return(TRUE);
- }
- ! (void) sprintf(cmdbuf, "cp %s %s", filename, final); /* copy command */
- }
- else if (cii)
- {
- --- 661,670 ----
- (void) printf("%s already exists. Overwrite? (yes) ", final);
- (void) strrd(cmdbuf, 20, stdin);
- (void) strlwr(cmdbuf);
- ! if (strnicmp(cmdbuf, "yes", strlen(cmdbuf)))
- return(TRUE);
- }
- ! (void) sprintf(cmdbuf, "cp -p %s %s", filename, final); /* copy command */
- }
- else if (cii)
- {
- ***************
- *** 712,718 ****
- if (!*st)
- (void) strcpy(st, "yes");
- (void) strlwr(st);
- ! if (!strncmp(st, "yes", strlen(st))) {
- done = TRUE;
- (void) system(cmdbuf); /* do it. */
- }
- --- 748,754 ----
- if (!*st)
- (void) strcpy(st, "yes");
- (void) strlwr(st);
- ! if (!strnicmp(st, "yes", strlen(st))) {
- done = TRUE;
- (void) system(cmdbuf); /* do it. */
- }
- ***************
- *** 725,731 ****
- (void) printf("? Print this message\n");
- (void) printf("\n");
- }
- ! else if (!strncmp(st, "view", strlen(st)))
- {
- (void) printf("Not implemented yet!\n\n");
- }
- --- 761,767 ----
- (void) printf("? Print this message\n");
- (void) printf("\n");
- }
- ! else if (!strnicmp(st, "view", strlen(st)))
- {
- (void) printf("Not implemented yet!\n\n");
- }
- ***************
- *** 737,743 ****
- {
- #endif /* INTERACTIVE */
- if (verbose)
- ! (void) printf("%s command :%s:\n", prognam, cmdbuf);
- if (!noexec)
- {
- if (do_copy && !verbose)
- --- 773,779 ----
- {
- #endif /* INTERACTIVE */
- if (verbose)
- ! (void) printf("%s command: %s:\n", prognam, cmdbuf);
- if (!noexec)
- {
- if (do_copy && !verbose)
- ***************
- *** 749,765 ****
- #ifdef INTERACTIVE
- }
- #endif /* INTERACTIVE */
- if (updsrcdir) /* update source directory */
- {
- getsrcdir(final, filename);
- ! (void) sprintf(cmdbuf, "cp %s %s", filename, final);
- if (noexec) /* don't actual do it */
- (void) printf("%s\n", cmdbuf);
- else
- {
- if (verbose) /* speak, yo wise one! */
- ! (void) printf("%s command :%s:\n", prognam, cmdbuf);
- ! if (!strcmp(filename, final))
- (void) printf("Source and destination identical. Not updated.\n");
- else
- {
- --- 785,815 ----
- #ifdef INTERACTIVE
- }
- #endif /* INTERACTIVE */
- +
- if (updsrcdir) /* update source directory */
- {
- getsrcdir(final, filename);
- !
- ! if (st = strrchr(final, '/')) /* if this has a sub dir. */
- ! {
- ! *st = '\0'; /* terminate it at the directoy level. */
- ! if (access(final, 0)) /* it's not here... */
- ! if (!makedir(final)) /* so try and make it. */
- ! {
- ! (void) printf("Could not create directory: %s:\n", final);
- ! return(FALSE);
- ! }
- ! *st = '/'; /* restore the rest of the file name. */
- ! }
- !
- ! (void) sprintf(cmdbuf, "cp -p %s %s", filename, final);
- if (noexec) /* don't actual do it */
- (void) printf("%s\n", cmdbuf);
- else
- {
- if (verbose) /* speak, yo wise one! */
- ! (void) printf("%s command: %s:\n", prognam, cmdbuf);
- ! if (!stricmp(filename, final))
- (void) printf("Source and destination identical. Not updated.\n");
- else
- {
- ***************
- *** 852,874 ****
- char *header; /* header template file name. */
- } ftype[] = {
- #ifdef V_RCS
- ! { "c program", ".rcshead.c" }, /* FTYPE_C */
- ! { "assembler", ".rcshead.s" }, /* FTYPE_S */
- ! { "command", ".rcshead.sh" }, /* FTYPE_SH */
- ! { "roff, tbl", ".rcshead.roff" }, /* FTYPE_ROFF */
- ! { "fortran", ".rcshead.f" }, /* FTYPE_F */
- ! { 0, ".rcshead" }, /* FTYPE_DEFAULT */
- ! { 0, ".rcshead.mk" }, /* FTYPE_MK */
- ! { 0, ".rcshead.h" } }; /* FTYPE_H */
- ! #else
- ! { "c program", ".sccshead.c" }, /* FTYPE_C */
- ! { "assembler", ".sccshead.s" }, /* FTYPE_S */
- ! { "command", ".sccshead.sh" }, /* FTYPE_SH */
- ! { "roff, tbl", ".sccshead.roff"}, /* FTYPE_ROFF */
- ! { "fortran", ".sccshead.f" }, /* FTYPE_F */
- ! { 0, ".sccshead" }, /* FTYPE_DEFAULT */
- ! { 0, ".sccshead.mk" }, /* FTYPE_MK */
- ! { 0, ".sccshead.h" } }; /* FTYPE_H */
- #endif /* V_RCS */
- static struct _fext {
- char *name;
- --- 902,924 ----
- char *header; /* header template file name. */
- } ftype[] = {
- #ifdef V_RCS
- ! { "c program", "rcshead.c" }, /* FTYPE_C */
- ! { "assembler", "rcshead.s" }, /* FTYPE_S */
- ! { "command", "rcshead.sh" }, /* FTYPE_SH */
- ! { "roff, tbl", "rcshead.rof" }, /* FTYPE_ROFF */
- ! { "fortran", "rcshead.f" }, /* FTYPE_F */
- ! { 0, "rcshead" }, /* FTYPE_DEFAULT */
- ! { 0, "rcshead.mk" }, /* FTYPE_MK */
- ! { 0, "rcshead.h" } }; /* FTYPE_H */
- ! #else
- ! { "c program", "sccshead.c" }, /* FTYPE_C */
- ! { "assembler", "sccshead.s" }, /* FTYPE_S */
- ! { "command", "sccshead.sh" }, /* FTYPE_SH */
- ! { "roff, tbl", "sccshead.rof"}, /* FTYPE_ROFF */
- ! { "fortran", "sccshead.f" }, /* FTYPE_F */
- ! { 0, "sccshead" }, /* FTYPE_DEFAULT */
- ! { 0, "sccshead.mk" }, /* FTYPE_MK */
- ! { 0, "sccshead.h" } }; /* FTYPE_H */
- #endif /* V_RCS */
- static struct _fext {
- char *name;
- ***************
- *** 933,939 ****
- if (ext = strrchr(fname, '.'))
- {
- for (i = 0; fext[i].name; i++)
- ! if (!strcmp(ext, fext[i].name))
- ft = fext[i].type;
- }
- else
- --- 983,989 ----
- if (ext = strrchr(fname, '.'))
- {
- for (i = 0; fext[i].name; i++)
- ! if (!stricmp(ext, fext[i].name))
- ft = fext[i].type;
- }
- else
- ***************
- *** 946,952 ****
- }
- else if (ft == FTYPE_C) /* see if source or header */
- {
- ! if ((ext = strrchr(fname, '.')) && !strcmp(ext, ".h"))
- ft = FTYPE_H;
- }
- if (verbose) /* is this necessary */
- --- 996,1002 ----
- }
- else if (ft == FTYPE_C) /* see if source or header */
- {
- ! if ((ext = strrchr(fname, '.')) && !stricmp(ext, ".h"))
- ft = FTYPE_H;
- }
- if (verbose) /* is this necessary */
- ***************
- *** 965,971 ****
- strcpy(tempfile, t_name);
- ext = justname(tempfile); /* find end of path. */
- *ext = '\0'; /* and terminate path there. */
- ! (void) strcat(tempfile, "ciotmp._XXXXXX"); /* add tmp name */
- (void) mktemp(tempfile); /* generate temp file name */
- if (!(ofp = fopen(tempfile, "w"))) /* open temp file */
- {
- --- 1015,1021 ----
- strcpy(tempfile, t_name);
- ext = justname(tempfile); /* find end of path. */
- *ext = '\0'; /* and terminate path there. */
- ! (void) strcat(tempfile, "ctXXXXXX"); /* add tmp name */
- (void) mktemp(tempfile); /* generate temp file name */
- if (!(ofp = fopen(tempfile, "w"))) /* open temp file */
- {
- ***************
- *** 997,1007 ****
- --- 1047,1063 ----
- */
- if(!err && !unlink(t_name)) /* 'mv tempfile fname' */
- {
- + #ifndef OS2
- if(!link(tempfile, t_name)) /* 'cp tempfile t_name' */
- (void) unlink(tempfile); /* 'rm tempfile' */
- else
- (void) printf("Link of %s and %s failed after removing %s.\n%s not removed.\n",
- tempfile, t_name, t_name, tempfile);
- + #else
- + if(!rename(tempfile, t_name)) /* 'cp tempfile t_name' */
- + (void) printf("Rename of %s to %s failed after removing %s.\n%s not removed.\n",
- + tempfile, t_name, t_name, tempfile);
- + #endif
- }
- else
- {
- ***************
- *** 1024,1040 ****
- register char *st, *cp;
-
- if(!*newpath) return(FALSE); /* skip last directory attempt. */
- - cp = memalloc(strlen(newpath) + 24);
- - (void) sprintf(cp, "/bin/mkdir %s 2>/dev/null", newpath);
- - if(verbose)
- - (void) printf("calling mkdir: %s\n", cp);
- if (noexec)
- {
- ! (void) printf("%s\n", cp);
- ! free(cp);
- return(TRUE);
- }
- ! if (system(cp)) /* it failed.. */
- {
- (void) strcpy(cp, newpath); /* get current one. */
- st = strrchr(cp, '/'); /* remove one more layer.. */
- --- 1080,1096 ----
- register char *st, *cp;
-
- if(!*newpath) return(FALSE); /* skip last directory attempt. */
- if (noexec)
- {
- ! (void) printf("mkdir: %s\n", newpath);
- return(TRUE);
- }
- ! else if(verbose)
- ! (void) printf("mkdir: %s\n", newpath);
- !
- ! cp = memalloc(strlen(newpath) + 24);
- !
- ! if (mkdir(newpath)) /* it failed.. */
- {
- (void) strcpy(cp, newpath); /* get current one. */
- st = strrchr(cp, '/'); /* remove one more layer.. */
- ***************
- *** 1043,1055 ****
- {
- free(cp);
- return(FALSE);
- ! } /* ok, so.. it passed on back. Try this again. */
- ! else if(makedir(newpath) == FALSE)
- {
- free(cp);
- return(FALSE);
- }
- }
- free(cp);
- return(TRUE);
- }
- --- 1099,1113 ----
- {
- free(cp);
- return(FALSE);
- ! }
- ! /* ok, so.. it passed on back. Try this again. */
- ! if(mkdir(newpath))
- {
- free(cp);
- return(FALSE);
- }
- }
- +
- free(cp);
- return(TRUE);
- }
- ***************
- *** 1057,1062 ****
- --- 1115,1121 ----
- /*--------------------------------------------------- strstr() --------------
- / find a substring within a string
- /---------------------------------------------------------------------------*/
- + #ifndef OS2
- char *
- strstr(s1, s2)
- register char *s1, *s2;
- ***************
- *** 1084,1089 ****
- --- 1143,1149 ----
- *s = _tolower(*s);
- return(op);
- }
- + #endif
-
- /*--------------------------------------------------- asciifile() -----------
- / check if passed file is an ascii file using file(1) command
- ***************
- *** 1095,1100 ****
- --- 1155,1174 ----
- char cmdstr[256];
- register FILE *fp;
-
- + #ifdef OS2
- + int file, cnt, i;
- +
- + if ((file = open(fn, O_RDONLY|O_BINARY)) == -1)
- + return(FALSE);
- + cnt = read(file, cmdstr, sizeof(cmdstr)); /* get a block. */
- + close(file); /* and done. */
- +
- + for ( i = 0; i < cnt; i++ )
- + if ( cmdstr[i] == 0 || cmdstr[i] == 127 )
- + return(FALSE);
- +
- + return(TRUE);
- + #else /* OS2 */
- (void) sprintf(cmdstr, "file %s", fn);
- if (!(fp = popen(cmdstr, "r")))
- return(FALSE);
- ***************
- *** 1106,1111 ****
- --- 1180,1186 ----
- if (strstr(ftypestr, "text"))
- return(TRUE);
- return(FALSE);
- + #endif /* OS2 */
- }
-
- /*--------------------------------------------------- rcsfile() -------------
- ***************
- *** 1118,1123 ****
- --- 1193,1209 ----
- char cmdstr[256];
- register FILE *fp;
-
- + #ifdef OS2
- + if (!(fp = fopen(fn, "r")))
- + return(FALSE);
- + (void) strrd(ftypestr, 80, fp); /* get a line. */
- + (void) fclose(fp); /* and done. */
- + #ifdef DEBUG
- + (void) printf("%s\n", cmdstr);
- + #endif
- + if (strcmp(ftypestr, "head "))
- + return(TRUE);
- + #else /* OS2 */
- (void) sprintf(cmdstr, "file %s", fn);
- if (!(fp = popen(cmdstr, "r")))
- return(FALSE);
- ***************
- *** 1132,1137 ****
- --- 1218,1224 ----
- if (strstr(ftypestr, "sccs"))
- #endif
- return(TRUE);
- + #endif /* OS2 */
- return(FALSE);
- }
-
- ***************
- *** 1263,1268 ****
- --- 1350,1360 ----
- (void) fprintf(stderr, "Cannot get working dir.\n");
- exit(-1);
- }
- + #ifdef OS2
- + /* strcpy(currentdir, currentdir + 2); */
- + UnixFileName(currentdir);
- + #endif
- + strcat(currentdir, "/");
- s_currentdir = strlen(currentdir);
- }
-
- ***************
- *** 1280,1285 ****
- --- 1372,1381 ----
- register char *cp, *dp;
- register int was_slash = FALSE;
-
- + #ifdef OS2
- + UnixFileName(cs);
- + #endif
- +
- cp = dp = cs;
- while (isspace(*cp)) /* remove leading white spaces */
- cp++;
- ***************
- *** 1324,1333 ****
- {
- register char *cp = sdir;
-
- ! if(rcswrk && !strncmp(rcswrk, cp, s_rcswrk))
- cp += s_rcswrk;
- ! if(homedir && !strncmp(homedir, cp, s_homedir))
- cp += s_homedir;
- /*
- * build the final directory name
- */
- --- 1420,1435 ----
- {
- register char *cp = sdir;
-
- ! if(rcswrk && !strnicmp(rcswrk, cp, s_rcswrk))
- cp += s_rcswrk;
- ! if(homedir && !strnicmp(homedir, cp, s_homedir))
- cp += s_homedir;
- + #ifdef OS2
- + if(isalpha(cp[0]) && cp[1] == ':')
- + cp += 2;
- + #endif
- + if(cp[0] == '/')
- + cp++;
- /*
- * build the final directory name
- */
- ***************
- *** 1343,1350 ****
- {
- register char *cp = sdir;
-
- ! if (rcsdir && !strncmp(rcsdir, cp, s_rcsdir))
- cp += s_rcsdir;
- (void) sprintf(tdir, "%s%s", rcswrk ? rcswrk : homedir, cp);
- }
-
- --- 1445,1458 ----
- {
- register char *cp = sdir;
-
- ! if (rcsdir && !strnicmp(rcsdir, cp, s_rcsdir))
- cp += s_rcsdir;
- + #ifdef OS2
- + if(isalpha(cp[0]) && cp[1] == ':')
- + cp += 2;
- + #endif
- + if(cp[0] == '/')
- + cp++;
- (void) sprintf(tdir, "%s%s", rcswrk ? rcswrk : homedir, cp);
- }
-
- ***************
- *** 1357,1366 ****
- {
- register char *cp = sdir;
-
- ! if (rcsdir && !strncmp(rcsdir, cp, s_rcsdir))
- ! cp += s_rcsdir;
- ! if(homedir && !strncmp(homedir, cp, s_homedir))
- cp += s_homedir;
- (void) sprintf(tdir, "%s%s", srcdir ? srcdir : homedir, cp);
- }
-
- --- 1465,1480 ----
- {
- register char *cp = sdir;
-
- ! if (rcswrk && !strnicmp(rcswrk, cp, s_rcswrk))
- ! cp += s_rcswrk;
- ! if(homedir && !strnicmp(homedir, cp, s_homedir))
- cp += s_homedir;
- + #ifdef OS2
- + if(isalpha(cp[0]) && cp[1] == ':')
- + cp += 2;
- + #endif
- + if(cp[0] == '/')
- + cp++;
- (void) sprintf(tdir, "%s%s", srcdir ? srcdir : homedir, cp);
- }
-
- ***************
- *** 1375,1380 ****
- --- 1489,1495 ----
- int stat_loc;
-
- (void) strcpy(name, tmpnam(editfile));
- + #ifndef OS2
- if (fork())
- { /* parent just waits for the child to finish */
- (void) wait(&stat_loc);
- ***************
- *** 1383,1397 ****
- { /* child does his/her stuff */
- (void) signal(SIGINT, SIG_DFL);
- (void) signal(SIGQUIT, SIG_DFL);
- exit(child_getfinput(name, type) == TRUE ? 0 : -1);
- }
- return((stat_loc >> 8) & 0xff);
- }
-
- /*--------------------------------------------------- child_getfinput() -----
- / actual get title file.
- /---------------------------------------------------------------------------*/
- ! static int
- child_getfinput(name, type)
- char *name; /* buffer to put file name into. */
- int type; /* what data we want. */
- --- 1498,1517 ----
- { /* child does his/her stuff */
- (void) signal(SIGINT, SIG_DFL);
- (void) signal(SIGQUIT, SIG_DFL);
- + (void) signal(SIGBREAK, SIG_DFL);
- + (void) signal(SIGTERM, SIG_DFL);
- exit(child_getfinput(name, type) == TRUE ? 0 : -1);
- }
- return((stat_loc >> 8) & 0xff);
- + #else
- + return child_getfinput(name, type) == TRUE ? 0 : -1;
- + #endif
- }
-
- /*--------------------------------------------------- child_getfinput() -----
- / actual get title file.
- /---------------------------------------------------------------------------*/
- ! int
- child_getfinput(name, type)
- char *name; /* buffer to put file name into. */
- int type; /* what data we want. */
- ***************
- *** 1402,1408 ****
- --- 1522,1530 ----
- int c, done = FALSE;
- char buf[82]; /* just larger than input buffer. */
-
- + #ifndef OS2
- (void) setuid(real_user_id); /* user's real user id */
- + #endif
- if((fp = fopen(name, "w")) == NULL) /* failed open. */
- {
- (void) unlink(name); /* remove it. */
- ***************
- *** 1410,1416 ****
- (void) printf("Unable to create tmp file.\n");
- return(FALSE);
- }
- ! (void) printf("Enter %s message, <ret>.<ret> or Control-D to end:\n",
- input_type[type]);
- while (!done)
- {
- --- 1532,1538 ----
- (void) printf("Unable to create tmp file.\n");
- return(FALSE);
- }
- ! (void) printf("Enter %s message, <ret>.<ret> or Control-Z to end:\n",
- input_type[type]);
- while (!done)
- {
- ***************
- *** 1535,1540 ****
- --- 1657,1665 ----
- {
- register char *cp;
-
- + #ifdef OS2
- + UnixFileName(fpath);
- + #endif
- if (cp = strrchr(fpath, '/'))
- return(++cp);
-
- ***************
- *** 1617,1619 ****
- --- 1742,1755 ----
- }
-
- /*----------------------------- End of cio.c -------------------------------*/
- +
- + #ifdef OS2
- + UnixFileName(char *name)
- + {
- + /* strlwr(name); */
- + for ( ; *name; name++ )
- + if ( *name == '\\' )
- + *name = '/';
- + }
- + #endif
- +
-
-