home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 11 Util
/
11-Util.zip
/
SHAR324X.ZIP
/
SHAR.DIF
< prev
next >
Wrap
Text File
|
1990-06-05
|
10KB
|
381 lines
diff -cbBw orig/shar.c shar.c
*** orig/shar.c Sun May 20 23:38:18 1990
--- shar.c Sun May 20 23:53:28 1990
***************
*** 120,125 ****
--- 120,128 ----
*/
#include <stdio.h>
+ #ifdef MSDOS
+ #include <stdlib.h>
+ #endif
#include <sys/types.h>
#include <time.h>
#include <sys/stat.h>
***************
*** 180,185 ****
--- 183,189 ----
#define DeBug(f,v) /* do nothing */
#endif
+ char *SHAR;
FILE *fpout = stdout;
char *Rname(); /* file restore name */
unsigned limit = 0;
***************
*** 204,209 ****
--- 208,217 ----
extern int optind;
extern char *optarg;
+ #ifdef MSDOS
+ putenv("_POSIX_OPTION_ORDER=TRUE"); /* for GNU getopt */
+ #endif
+
while((c = getopt(argc,argv,"VSvwd:btCxXcfMpPas:n:l:L:o:h")) != -1)
{
switch(c)
***************
*** 311,316 ****
--- 319,326 ----
}
}
+ SHAR = argv[0];
+
if(Vanilla)
{
fprintf(stderr,"Vanilla mode disabling years of progress :-)\n");
***************
*** 357,363 ****
if(optind >= argc)
{
- fprintf(stderr,"shar: No input files\n");
helpuser();
exit(1);
}
--- 367,372 ----
***************
*** 421,427 ****
--- 430,444 ----
continue;
}
}
+
+ #ifdef MSDOS
+ if ( *argv[optind] != 0 )
+ status += shar(argv[optind]);
+
+ optind++;
+ #else
status += shar(argv[optind++]);
+ #endif
}
/* delete the sequence file, if any */
***************
*** 555,562 ****
--- 572,583 ----
/* at this point I check to see that this is a regular file */
if(status != S_IFREG)
{ /* this is not a regular file */
+ #ifdef MSDOS
+ *argv[i] = 0;
+ #else
fprintf(stderr,"shar: %s is not a regular file\n",argv[i]);
return(1);
+ #endif
}
}
***************
*** 587,592 ****
--- 608,616 ----
fputs(submitter,fpout);
fputs("\n",fpout);
+ #if defined(MSDOS)
+ getcwd(s128, sizeof(s128));
+ #else
#if defined(SYS5)
if(!(fpsource = popen("/bin/pwd","r")))
return(-1);
***************
*** 600,605 ****
--- 624,630 ----
#include "Need_conditional_compile_fix"
#endif
#endif
+ #endif
fprintf(fpout,"# Source directory %s\n",s128);
fprintf(fpout,"#\n# existing files %s be overwritten\n",
***************
*** 636,641 ****
--- 661,670 ----
strcmp(argv[i],"-t") == 0 ||
strcmp(argv[i],"-C") == 0))
continue;
+ #ifdef MSDOS
+ if ( *argv[i] == 0 )
+ continue;
+ #endif
stat(argv[i],&fst);
fst.st_mode &= ~(07000); /* turn off setuid, setgid and sticky bits */
fprintf(fpout,"# %6ld %s %s\n",fst.st_size,
***************
*** 801,810 ****
if(Binary)
{ /* fork a uuencode process */
static int pid,pipex[2];
pipe(pipex);
- fflush(fpout);
if(pid = fork())
{ /* parent, create a file to read */
--- 830,869 ----
if(Binary)
{ /* fork a uuencode process */
+ fflush(fpout);
+ filetype = (Compress ? "Compressed" : "Binary");
+ #ifdef MSDOS
+ if ( Compress )
+ {
+ if ( _osmode == DOS_MODE )
+ {
+ char temp[128];
+
+ strcpy(temp, "~CXXXXXX");
+ Mktemp(temp);
+ sprintf (line, "compress <%s >%s", file, temp);
+ system(line);
+
+ sprintf (line, "uuencode %s shar3_cmp_.tmp", temp);
+ fpsource = popen (line, "r");
+
+ unlink(temp);
+ }
+ else
+ {
+ sprintf (line, "compress <%s | uuencode shar3_cmp_.tmp", file);
+ fpsource = popen (line, "r");
+ }
+ }
+ else
+ {
+ sprintf (line, "uuencode %s %s", file, file);
+ fpsource = popen (line, "r");
+ }
+ #else
static int pid,pipex[2];
pipe(pipex);
if(pid = fork())
{ /* parent, create a file to read */
***************
*** 815,821 ****
}
close(pipex[1]);
fpsource = fdopen(pipex[0],"r");
- filetype = (Compress ? "Compressed" : "Binary");
}
else
{ /* start writing the pipe with encodes */
--- 874,879 ----
***************
*** 839,844 ****
--- 897,903 ----
fclose(fpsource);
exit(0);
}
+ #endif
}
else
{
***************
*** 992,997 ****
--- 1051,1061 ----
}
}
+ #ifdef MSDOS
+ if ( Binary )
+ (void) pclose(fpsource);
+ else
+ #endif
(void) fclose(fpsource);
if(line[strlen(line) - 1] != '\n')
***************
*** 1067,1073 ****
}
else
{
! fprintf(stderr,"shar: Can't open %s (%s): ",file,filetype);
perror("");
return(1);
}
--- 1131,1137 ----
}
else
{
! fprintf(stderr,"shar: Can't open '%s' (%s): ",file,filetype);
perror("");
return(1);
}
***************
*** 1107,1113 ****
{
"-V produce \"vanilla\" shars demanding little of the unshar environment",
"-v verbose messages OFF while executing",
! "-w don't check with 'wc -c' after unpack",
"-n Name of archive (documentation)",
"-a Generate Submitted-by: & Archive-name: headers",
"-s override automatically determined submitter name",
--- 1171,1177 ----
{
" -V produce \"vanilla\" shars demanding little of the unshar environment",
" -v verbose messages OFF while executing",
! " -w don't check with \"wc -c\" after unpack",
" -n Name of archive (documentation)",
" -a Generate Submitted-by: & Archive-name: headers",
" -s override automatically determined submitter name",
***************
*** 1130,1136 ****
"-LXX limit output file size to XXk bytes (may split files)",
"-S read files to wrap from stdin, ignoring argument line",
"\nThe -S option reads filenames one per line from stdin; input",
! "format must be similar to 'find' output, except that if -p",
"is specified, -b, -t or -C may be used (on lines by themselves)",
"e.g., find . -type f -print | sort | shar -C -L50 -o /tmp/big",
"\nThe 'o' option is required if the 'l' or 'L' option is used",
--- 1194,1200 ----
" -LXX limit output file size to XXk bytes (may split files)",
" -S read files to wrap from stdin, ignoring argument line",
"\nThe -S option reads filenames one per line from stdin; input",
! "format must be similar to \"find\" output, except that if -p",
"is specified, -b, -t or -C may be used (on lines by themselves)",
"e.g., find . -type f -print | sort | shar -C -L50 -o /tmp/big",
"\nThe 'o' option is required if the 'l' or 'L' option is used",
***************
*** 1145,1154 ****
helpuser()
{ /* output a command format message */
register char **ptr;
! fprintf(stderr,
! "shar %s\nusage: shar [ options ] file [ file1 ... ] ]\n",revision);
for(ptr = helpinfo; *ptr; ptr++)
! fprintf(stderr,"%s\n",*ptr);
exit(1);
}
--- 1209,1220 ----
helpuser()
{ /* output a command format message */
register char **ptr;
!
! printf("\n%s %s\n\nUsage: %s [ options ] file [ file1 ... ] ]\n\n",
! SHAR,SHAR,revision);
!
for(ptr = helpinfo; *ptr; ptr++)
! printf("%s\n",*ptr);
exit(1);
}
diff -cbBw orig/whowhere.c whowhere.c
*** orig/whowhere.c Sun May 20 23:38:18 1990
--- whowhere.c Sun May 20 23:45:38 1990
***************
*** 11,17 ****
--- 11,21 ----
#include <stdio.h>
#include <sys/types.h>
+ #ifdef MSDOS
+ #include <stdlib.h>
+ #else
#include <pwd.h>
+ #endif
/* assume system v unless otherwise fixed */
#if (defined(pyr) || defined(vax) || defined(sequent)) && !defined(BSD42) && !defined(SYS5)
***************
*** 34,40 ****
--- 38,46 ----
#include <sys/time.h>
extern int errno;
#else
+ #ifndef MSDOS
#include <sys/utsname.h>
+ #endif
#include <time.h>
#endif /* system dependencies */
***************
*** 44,49 ****
--- 50,65 ----
char *
who_am_i()
{
+ #ifdef MSDOS
+ char *name;
+
+ if ( (name = getenv("USER")) != NULL )
+ return name;
+ else if ( (name = getenv("MAILNAME")) != NULL )
+ return name;
+ else
+ return "unknown";
+ #else
struct passwd *getpwuid();
struct passwd *passwd;
passwd = getpwuid(getuid());
***************
*** 51,57 ****
if(passwd == (struct passwd *)0)
return("???");
return(passwd->pw_name);
!
} /* end of who_am_i */
/*+-------------------------------------------------------------------------
--- 67,73 ----
if(passwd == (struct passwd *)0)
return("???");
return(passwd->pw_name);
! #endif
} /* end of who_am_i */
/*+-------------------------------------------------------------------------
***************
*** 60,65 ****
--- 76,86 ----
char *
where_am_i()
{
+ #ifdef MSDOS
+ return (_osmode == DOS_MODE) ? "MS-DOS" : "OS/2";
+ /* perhaps an OS/2 workstation provides an API for getting
+ the node name if the LAN Manager is installed. */
+ #else
#if defined(M_SYS5) /* SCO UNIX or XENIX */
FILE *fpsid = fopen("/etc/systemid","r");
static char s20[20];
***************
*** 80,85 ****
--- 101,107 ----
return(where_i_am);
#endif /* SYS5 */
#endif /* M_SYS5 */
+ #endif
} /* end of where_am_i */
/*+-------------------------------------------------------------------------
Only in .: wild.c