home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 11 Util
/
11-Util.zip
/
shar349.zip
/
os2
/
patches.os2
< prev
next >
Wrap
Text File
|
1993-05-14
|
18KB
|
806 lines
Only in new: makefile.os2
Only in new: notes.os2
Only in new: readme.os2
Only in new: shar-emx.def
diff -c old/shar.c new/shar.c
*** old/shar.c Sat Feb 22 21:42:42 1992
--- new/shar.c Fri May 14 06:06:30 1993
***************
*** 176,209 ****
#define strrchr rindex
#endif
! #ifdef MSDOS
!
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include <stdarg.h>
#include <process.h>
! #include <direct.h>
#include <io.h>
/* We will use some GNUish MS-DOS stuff */
- #include <getopt.h>
#include <gnulib.h>
char *program_name;
- /* Unkown to MS-DOS */
- #define S_ISUID 0x00
- #define S_ISGID 0x00
- #define S_ISVTX 0x00
/* Nobody ever waits for MS-DOS ... */
#define wait(foo) (-1)
- #define who_where(buf) \
- { \
- char *user = getenv ("USER"); \
- strcpy (buf, user ? user : "anonymous@any.net"); \
- }
#define getcwd(buf, len) msdos_format_filename (getcwd (buf, len))
--- 176,217 ----
#define strrchr rindex
#endif
! #if MSDOS || OS2
#include <stdlib.h>
+ /* Unkown to MS-DOS */
+ #define S_ISUID 0x00
+ #define S_ISGID 0x00
+ #define S_ISVTX 0x00
+ #define who_where(buf) \
+ { \
+ char *user = getenv ("USER"); \
+ strcpy (buf, user ? user : "anonymous@any.net"); \
+ }
+
#include <string.h>
#include <errno.h>
#include <stdarg.h>
#include <process.h>
! #ifndef EMX
! # include <direct.h>
! #endif
#include <io.h>
+ #include <getopt.h>
+
+ #ifdef MSC
+ # define popen _popen
+ # define pclose _pclose
+ #endif
+ #ifdef MSDOS
/* We will use some GNUish MS-DOS stuff */
#include <gnulib.h>
char *program_name;
/* Nobody ever waits for MS-DOS ... */
#define wait(foo) (-1)
#define getcwd(buf, len) msdos_format_filename (getcwd (buf, len))
***************
*** 216,240 ****
extern char *_pipe_file (int n);
extern int filter_through_command (char *infile, char *outfile,
char *command, ...);
!
! /* From uuchar.c */
! extern void encode (FILE *in, FILE *out);
!
! extern void main (int argc, char **argv);
! static char *mode_map (unsigned short mode, char *mode_str);
! static void setTOUCH (void);
! static int walkdown (int (*rtn) (char *, char *), char *file, int filelen,
! char *rname);
! static int walktree (int (*rtn) (char *, char *), char *rootname);
! static int onecheck (char *file, char *rname);
! static int oneheader (char *file, char *rname);
! static int header (int argc, char **argv);
! static void gen_mkdir (char *path);
! static void gen_mkdir_script (char *path);
! static int shar (char *file, char *RstrName);
! static int helpuser (void);
! #else /* not MSDOS */
char *strchr();
char *strrchr();
--- 224,232 ----
extern char *_pipe_file (int n);
extern int filter_through_command (char *infile, char *outfile,
char *command, ...);
! #endif
! #else /* not (MSDOS || OS2) */
char *strchr();
char *strrchr();
***************
*** 246,253 ****
FILE *fdopen();
FILE *popen();
! #endif /* not MSDOS */
#define DELIM "SHAR_EOF"/* put after each file */
#define PREFIX1 'X' /* goes in front of each line */
#define PREFIX2 'Y' /* goes in front of each line if Delim[0] == PREFIX1 */
--- 238,272 ----
FILE *fdopen();
FILE *popen();
! #endif /* not (MSDOS || OS2) */
!
!
! #ifdef __STDC__
! # define _P(x) x
! # define VOID void
! #else
! # define _P(x) ()
! # define VOID
! #endif
+ #ifndef OS2
+ /* From uuchar.c */
+ extern VOID encode _P((FILE *in, FILE *out));
+ #endif
+ extern VOID main _P((int argc, char **argv));
+ static char *mode_map _P((unsigned short mode, char *mode_str));
+ static VOID setTOUCH _P((VOID));
+ static int walkdown (int (*rtn) (char *, char *), char *file, int filelen,
+ char *rname);
+ static int walktree _P((int (*rtn) (char *, char *), char *rootname));
+ static int onecheck _P((char *file, char *rname));
+ static int oneheader _P((char *file, char *rname));
+ static int header _P((int argc, char **argv));
+ static VOID gen_mkdir _P((char *path));
+ static VOID gen_mkdir_script _P((char *path));
+ static int shar _P((char *file, char *RstrName));
+ static int helpuser _P((VOID));
+
#define DELIM "SHAR_EOF"/* put after each file */
#define PREFIX1 'X' /* goes in front of each line */
#define PREFIX2 'Y' /* goes in front of each line if Delim[0] == PREFIX1 */
***************
*** 282,288 ****
#endif
FILE *fpout = stdout;
- int shar();
unsigned limit = 0;
int Split = 0; /* Split files in the middle */
long ftell();
--- 301,306 ----
***************
*** 295,301 ****
int filenum = 0; /* output file # */
struct stat fst; /* check file type, access */
! #ifdef MSDOS
void
main (int argc, char **argv)
#else
--- 313,319 ----
int filenum = 0; /* output file # */
struct stat fst; /* check file type, access */
! #ifdef __STDC__
void
main (int argc, char **argv)
#else
***************
*** 310,319 ****
--- 328,346 ----
extern int optind;
extern char *optarg;
+ #ifdef EMX
+ _wildcard (&argc, &argv);
+ #endif
+
#ifdef MSDOS
program_name = argv[0];
#endif
+
+ #ifdef _GETOPT_H
+ while((c = getopt(argc,argv,"+VmSvwd:BTCb:xXcfMpPFas:n:l:L:o:h")) != -1)
+ #else
while((c = getopt(argc,argv,"VmSvwd:BTCb:xXcfMpPFas:n:l:L:o:h")) != -1)
+ #endif
{
switch(c)
{
***************
*** 629,635 ****
{
if(Touch)
{
! fputs("if touch 2>&1 | fgrep 'amc' > /dev/null\n",fpout);
fputs(" then TOUCH=touch\n",fpout);
fputs(" else TOUCH=true\n",fpout);
fputs("fi\n",fpout);
--- 656,662 ----
{
if(Touch)
{
! fputs("if touch 2>&1 | grep acm > /dev/null\n",fpout);
fputs(" then TOUCH=touch\n",fpout);
fputs(" else TOUCH=true\n",fpout);
fputs("fi\n",fpout);
***************
*** 700,706 ****
#endif /* not MSDOS */
int
! #ifdef MSDOS
walkdown (int (*rtn)(char *, char *), char *file, int filelen, char *rname)
#else
walkdown(rtn,file,filelen,rname)
--- 727,733 ----
#endif /* not MSDOS */
int
! #ifdef __STDC__
walkdown (int (*rtn)(char *, char *), char *file, int filelen, char *rname)
#else
walkdown(rtn,file,filelen,rname)
***************
*** 762,768 ****
}
int
! #ifdef MSDOS
walktree (int (*rtn)(char *, char *), char *rootname)
#else
walktree(rtn,rootname) /* real walktree */
--- 789,795 ----
}
int
! #ifdef __STDC__
walktree (int (*rtn)(char *, char *), char *rootname)
#else
walktree(rtn,rootname) /* real walktree */
***************
*** 780,786 ****
return(1);
}
strcpy(file,rootname);
!
if(FileStrip)
{ /* use just the filename */
rname = file + filelen;
--- 807,816 ----
return(1);
}
strcpy(file,rootname);
! #ifdef OS2
! for (rname = file; *rname; rname++)
! if (*rname == '\\') *rname = '/';
! #endif
if(FileStrip)
{ /* use just the filename */
rname = file + filelen;
***************
*** 821,827 ****
return(0);
}
! #ifdef MSDOS
int
header (int argc, char **argv)
#else
--- 851,857 ----
return(0);
}
! #ifdef __STDC__
int
header (int argc, char **argv)
#else
***************
*** 830,836 ****
#endif
{
int i;
- FILE *fpsource; /* pipe temp */
char s128[128];
long now;
struct tm *utc;
--- 860,865 ----
***************
*** 886,901 ****
submitter);
! #ifdef MSDOS
/* Get current directory (w/ cosmetics) */
getcwd (s128, 127);
#else /* not MSDOS */
#if defined(SYS5)
if(!(fpsource = popen("/bin/pwd","r")))
return(-1);
fgets(s128,sizeof(s128),fpsource);
s128[strlen(s128) - 1] = 0;
fclose(fpsource);
#else
#if defined(BSD42) || defined(sun)
getwd(s128);
--- 915,933 ----
submitter);
! #if MSDOS || OS2
/* Get current directory (w/ cosmetics) */
getcwd (s128, 127);
#else /* not MSDOS */
#if defined(SYS5)
+ {
+ FILE *fpsource; /* pipe temp */
if(!(fpsource = popen("/bin/pwd","r")))
return(-1);
fgets(s128,sizeof(s128),fpsource);
s128[strlen(s128) - 1] = 0;
fclose(fpsource);
+ }
#else
#if defined(BSD42) || defined(sun)
getwd(s128);
***************
*** 1136,1143 ****
}
if(Binary)
- #ifdef MSDOS
{
FILE *outptr;
fflush (fpout);
--- 1168,1175 ----
}
if(Binary)
{
+ #ifdef MSDOS
FILE *outptr;
fflush (fpout);
***************
*** 1161,1168 ****
fpsource = freopen (pipe_file2, "r", fpsource);
filetype = (Compress ? "Compressed" : "Binary");
! }
#else /* not MSDOS */
{ /* fork a uuencode process */
static int pid,pipex[2];
--- 1193,1210 ----
fpsource = freopen (pipe_file2, "r", fpsource);
filetype = (Compress ? "Compressed" : "Binary");
!
#else /* not MSDOS */
+ #ifdef OS2
+ fflush(fpout);
+ filetype = (Compress ? "Compressed" : "Binary");
+ if ( Compress )
+ sprintf(line, "compress -b%d < \"%s\" | uuencode _shar_cmp_.tmp", CompressBits, file);
+ else
+ sprintf (line, "uuencode \"%s\" \"%s\"", file, RstrName);
+ fpsource = popen (line, "r");
+
+ #else
{ /* fork a uuencode process */
static int pid,pipex[2];
***************
*** 1186,1192 ****
--- 1228,1238 ----
if(Compress)
{
+ #ifdef OS2
+ sprintf(line, "compress -b%d < %s", CompressBits, file);
+ #else
sprintf(line, "compress -b%d < '%s'", CompressBits, file);
+ #endif
fpsource = popen(line, "r");
}
else
***************
*** 1205,1211 ****
--- 1251,1259 ----
exit(0);
}
}
+ #endif /* not OS2 */
#endif /* not MSDOS */
+ }
else
{
fpsource = fopen(file,"r");
***************
*** 1300,1307 ****
--- 1348,1357 ----
DeBug("Newfile, remaining %ld, ",remaining);
DeBug("limit still %d\n",limit);
+ #ifndef OS2 /* bugfix, not OS/2-specific */
if(line[strlen(line) - 1] != '\n')
fputc('\n',fpout);
+ #endif
fprintf(fpout,"%s\n",Delim);
***************
*** 1398,1409 ****
}
}
(void) fclose(fpsource);
while(wait((int *)0) >= 0)
;
!
if(line[strlen(line) - 1] != '\n')
fputc('\n',fpout);
fprintf(fpout,"%s\n",Delim);
if(split && Verbose)
--- 1448,1465 ----
}
}
+ #ifdef OS2
+ if (Binary)
+ pclose(fpsource);
+ else
+ #endif
(void) fclose(fpsource);
while(wait((int *)0) >= 0)
;
! #ifndef OS2 /* bugfix, not OS/2-specific */
if(line[strlen(line) - 1] != '\n')
fputc('\n',fpout);
+ #endif
fprintf(fpout,"%s\n",Delim);
if(split && Verbose)
***************
*** 1464,1470 ****
--- 1520,1530 ----
"wc", "-c", NULL);
if (pfp = fopen (pipe_file1, "r"))
#else
+ #ifdef OS2
+ sprintf(command,"%s \"%s\"",WC,file);
+ #else
sprintf(command,"%s '%s'",WC,file);
+ #endif
if((pfp = popen(command,"r")))
#endif
{
Only in new: shar.def
Only in new: shar.exe
diff -c old/unshar.c new/unshar.c
*** old/unshar.c Sat Feb 22 21:42:40 1992
--- new/unshar.c Fri May 14 05:54:48 1993
***************
*** 54,73 ****
#include <stdio.h>
#define EOL '\n'
! #ifdef MSDOS
!
! #define VOID void
!
#include <stdlib.h>
#include <string.h>
! #include <direct.h>
#include <errno.h>
#include <process.h>
#include <io.h>
-
#ifdef USE_GNU_GETOPT
! #include <getopt.h>
#endif
#include <gnulib.h>
char *program_name;
--- 54,77 ----
#include <stdio.h>
#define EOL '\n'
! #if OS2 || MSDOS
#include <stdlib.h>
#include <string.h>
! #ifndef EMX
! # include <direct.h>
! #endif
#include <errno.h>
#include <process.h>
#include <io.h>
#ifdef USE_GNU_GETOPT
! # include <getopt.h>
#endif
+ #define VOID void
+ #define USE_GETCWD
+ #endif
+
+
+ #ifdef MSDOS
#include <gnulib.h>
char *program_name;
***************
*** 81,99 ****
extern int filter_through_command (char *infile, char *outfile,
char *command, ...);
- extern void main (int argc, char **argv);
- static void process (char *name, FILE * in);
- static int position (char *fn, FILE * fil, long start);
- static int stlmatch (char *big, char *small);
- static int smatch (char *dat, char *pat, char **res);
- static void quit (int status, char *message);
-
- #define USE_GETCWD
#define getcwd(buf, len) msdos_format_filename (getcwd (buf, len))
#else /* not MSDOS */
! #define VOID
char *strchr();
#if (defined(pyr) || defined(sun) || defined(BSD42) || \
--- 85,101 ----
extern int filter_through_command (char *infile, char *outfile,
char *command, ...);
#define getcwd(buf, len) msdos_format_filename (getcwd (buf, len))
#else /* not MSDOS */
! #ifdef OS2
! #ifdef MSC
! # define popen _popen
! # define pclose _pclose
! #endif
!
! #else /* not (MSDOS || OS2) */
char *strchr();
#if (defined(pyr) || defined(sun) || defined(BSD42) || \
***************
*** 105,110 ****
--- 107,113 ----
#define USE_GETCWD
char *getcwd();
#endif
+ #endif
#endif /* not MSDOS */
***************
*** 111,116 ****
--- 114,132 ----
extern char *optarg;
extern int optind;
+ #ifdef __STDC__
+ # define _P(x) x
+ #else
+ # define _P(x) ()
+ #endif
+
+ static VOID process _P((char *name, FILE * in));
+ static int position _P((char *fn, FILE * fil, long start));
+ static int stlmatch _P((char *big, char *small));
+ static int smatch _P((char *dat, char *pat, char **res));
+ static VOID quit _P((int status, char *message));
+ static VOID usage _P((VOID));
+
int c_flag = 0;
int continue_reading = 0;
char *exit_string = "exit 0";
***************
*** 125,137 ****
int i,ch;
FILE *in;
char s1024[1024];
#ifdef MSDOS
program_name = argv[0];
#endif
! setbuf(stdout,NULL);
setbuf(stderr,NULL);
#ifdef USE_GETCWD
if(!getcwd(argvdir,sizeof(argvdir)))
--- 141,162 ----
int i,ch;
FILE *in;
char s1024[1024];
+ #ifdef OS2
+ char drive[_MAX_DRIVE], path[_MAX_PATH], *p;
+ #endif
+ #ifdef EMX
+ _wildcard (&argc, &argv);
+ #endif
+
#ifdef MSDOS
program_name = argv[0];
#endif
! #ifndef OS2
! setbuf(stdout,NULL); /* Does anyone really want these? */
setbuf(stderr,NULL);
+ #endif
#ifdef USE_GETCWD
if(!getcwd(argvdir,sizeof(argvdir)))
***************
*** 175,181 ****
exit_string_length = strlen(exit_string);
break;
default:
! quit(2,"Usage: unshar [-c] [-e | -E exit_line] [-d directory] [file ...]\n");
}
}
--- 200,206 ----
exit_string_length = strlen(exit_string);
break;
default:
! usage();
}
}
***************
*** 183,189 ****
{
for(i= optind; i < argc; ++i)
{
! if(argv[i][0] == '/') {
strcpy(s1024,argv[i]);
} else {
strcpy(s1024,argvdir);
--- 208,220 ----
{
for(i= optind; i < argc; ++i)
{
! #ifdef OS2
! _splitpath(argv[i], drive, NULL, NULL, NULL);
! if (*drive || argv[i][0] == '\\' ||
! #else
! if(
! #endif
! argv[i][0] == '/') {
strcpy(s1024,argv[i]);
} else {
strcpy(s1024,argvdir);
***************
*** 190,196 ****
--- 221,233 ----
strcat(s1024,"/");
strcat(s1024,argv[i]);
}
+ #ifdef OS2
+ while (p = strchr(s1024, '\\'))
+ *p = '/';
+ if(!(in = fopen(s1024,"rb")))
+ #else
if(!(in = fopen(s1024,"r")))
+ #endif
{
perror(s1024);
exit(1);
***************
*** 201,221 ****
}
else
{
sprintf(s1024,"/tmp/unsh.%05d",getpid());
unlink(s1024);
if(!(in = fopen(s1024,"w+")))
{
fprintf(stderr,"cannot open temp file '%s'\n",s1024);
exit(1);
}
unlink(s1024); /* don't try this with MSDOS, sports fans */
while(i = fread(s1024,1,sizeof(s1024),stdin))
fwrite(s1024,i,1,in);
rewind(in);
process("standard input",in);
fclose(in);
}
-
exit(0);
}
--- 238,276 ----
}
else
{
+ #ifdef OS2
+ if (isatty(fileno(stdin)))
+ usage();
+ if ((p = tempnam("/tmp", "unsh")) == NULL) {
+ fprintf(stderr,"cannot open temp file");
+ exit(1);
+ }
+ else {
+ strcpy(path, p);
+ strcpy(s1024, p);
+ }
+ #else
sprintf(s1024,"/tmp/unsh.%05d",getpid());
unlink(s1024);
+ #endif
if(!(in = fopen(s1024,"w+")))
{
fprintf(stderr,"cannot open temp file '%s'\n",s1024);
exit(1);
}
+ #ifndef OS2
unlink(s1024); /* don't try this with MSDOS, sports fans */
+ #endif
while(i = fread(s1024,1,sizeof(s1024),stdin))
fwrite(s1024,i,1,in);
rewind(in);
process("standard input",in);
fclose(in);
+ #ifdef OS2
+ unlink(path);
+ free(p);
+ #endif
}
exit(0);
}
***************
*** 238,244 ****
--- 293,303 ----
if ((shpr = fopen (pipe_file, "w")) == NULL)
error (1, 0, "pipe error: %s", pipe_file);
#else
+ #ifdef OS2
+ if(!(shpr = popen((c_flag ? "sh -s -c" : "sh"),"wb")))
+ #else
if(!(shpr = popen((c_flag ? "sh -s -c" : "sh"),"w")))
+ #endif
quit(1,"unshar: cannot open 'sh' process\n");
#endif
if (!continue_reading) {
***************
*** 459,464 ****
--- 518,536 ----
{
fprintf(stderr,message);
exit(status);
+ }
+
+ VOID
+ usage(VOID)
+ {
+ fprintf(stderr, "unshar 3.49\n\n");
+
+ fprintf(stderr, "Usage: unshar [-c] [-e | -E exit_line] [-d directory] [file ...]\n");
+ fprintf(stderr, "\t-c passed to sh\n");
+ fprintf(stderr, "\t-e \"exit 0\" separates files\n");
+ fprintf(stderr, "\t-E exit_line separates files (-e == -E \"exit 0\")\n");
+ fprintf(stderr, "\t-d change directory before unshar'ing\n");
+ quit(2,"");
}
#ifndef USE_GNU_GETOPT
Only in new: unshar.exe