home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / sources / misc / volume25 / pdksh / part09 < prev    next >
Encoding:
Text File  |  1991-11-12  |  8.8 KB  |  345 lines

  1. Newsgroups: comp.sources.misc
  2. From: sjg@zen.void.oz.au (Simon J. Gerraty)
  3. Subject:  v25i055:  pdksh - Public Domain Korn Shell, v4, Part09/09
  4. Message-ID: <1991Nov13.031251.16408@sparky.imd.sterling.com>
  5. X-Md4-Signature: b29fed1a1f5d8137b6f61cb94f217666
  6. Date: Wed, 13 Nov 1991 03:12:51 GMT
  7. Approved: kent@sparky.imd.sterling.com
  8.  
  9. Submitted-by: sjg@zen.void.oz.au (Simon J. Gerraty)
  10. Posting-number: Volume 25, Issue 55
  11. Archive-name: pdksh/part09
  12. Environment: UNIX
  13.  
  14. #! /bin/sh
  15. # into a shell via "sh file" or similar.  To overwrite existing files,
  16. # type "sh file -c".
  17. # The tool that generated this appeared in the comp.sources.unix newsgroup;
  18. # send mail to comp-sources-unix@uunet.uu.net if you want that tool.
  19. # Contents:  PATCHDATES std/posix/dirent.h std/posix/dup2.c
  20. #   std/posix/time.h std/stdc/memchr.c std/stdc/memcpy.c
  21. #   std/stdc/memset.c std/stdc/strcat.c std/stdc/strcpy.c
  22. #   std/stdc/strerror.c std/stdc/strlen.c
  23. # Wrapped by kent@sparky on Tue Nov 12 20:44:35 1991
  24. PATH=/bin:/usr/bin:/usr/ucb ; export PATH
  25. echo If this archive is complete, you will see the following message:
  26. echo '          "shar: End of archive 9 (of 9)."'
  27. if test -f 'PATCHDATES' -a "${1}" != "-c" ; then 
  28.   echo shar: Will not clobber existing file \"'PATCHDATES'\"
  29. else
  30.   echo shar: Extracting \"'PATCHDATES'\" \(37 characters\)
  31.   sed "s/^X//" >'PATCHDATES' <<'END_OF_FILE'
  32. XPD ksh Version 4
  33. X09-Nov-91
  34. X10-Nov-91
  35. END_OF_FILE
  36.   if test 37 -ne `wc -c <'PATCHDATES'`; then
  37.     echo shar: \"'PATCHDATES'\" unpacked with wrong size!
  38.   fi
  39.   # end of 'PATCHDATES'
  40. fi
  41. if test -f 'std/posix/dirent.h' -a "${1}" != "-c" ; then 
  42.   echo shar: Will not clobber existing file \"'std/posix/dirent.h'\"
  43. else
  44.   echo shar: Extracting \"'std/posix/dirent.h'\" \(87 characters\)
  45.   sed "s/^X//" >'std/posix/dirent.h' <<'END_OF_FILE'
  46. X/* <dirent.h> based on BSD <sys/dir.h> */
  47. X
  48. X#include <sys/dir.h>
  49. X#define dirent direct
  50. X
  51. END_OF_FILE
  52.   if test 87 -ne `wc -c <'std/posix/dirent.h'`; then
  53.     echo shar: \"'std/posix/dirent.h'\" unpacked with wrong size!
  54.   fi
  55.   # end of 'std/posix/dirent.h'
  56. fi
  57. if test -f 'std/posix/dup2.c' -a "${1}" != "-c" ; then 
  58.   echo shar: Will not clobber existing file \"'std/posix/dup2.c'\"
  59. else
  60.   echo shar: Extracting \"'std/posix/dup2.c'\" \(278 characters\)
  61.   sed "s/^X//" >'std/posix/dup2.c' <<'END_OF_FILE'
  62. X/*
  63. X * Cheap imitation of BSD dup2()
  64. X */
  65. X
  66. X#include <fcntl.h>
  67. X
  68. X#if _SYSV
  69. Xint
  70. Xdup2( oldd, newd )
  71. Xint    oldd, newd;
  72. X{
  73. X    int    fd;
  74. X
  75. X    if (fcntl( oldd, F_GETFL, 0 ) < 0)
  76. X        return( -1 );
  77. X
  78. X    (void) close( newd );
  79. X    fd = fcntl( oldd, F_DUPFD, newd );
  80. X
  81. X    return( (fd > newd) ? -1 : fd );
  82. X}
  83. X#endif
  84. END_OF_FILE
  85.   if test 278 -ne `wc -c <'std/posix/dup2.c'`; then
  86.     echo shar: \"'std/posix/dup2.c'\" unpacked with wrong size!
  87.   fi
  88.   # end of 'std/posix/dup2.c'
  89. fi
  90. if test -f 'std/posix/time.h' -a "${1}" != "-c" ; then 
  91.   echo shar: Will not clobber existing file \"'std/posix/time.h'\"
  92. else
  93.   echo shar: Extracting \"'std/posix/time.h'\" \(274 characters\)
  94.   sed "s/^X//" >'std/posix/time.h' <<'END_OF_FILE'
  95. X/*
  96. X * Replacement for BSD <sys/time.h>
  97. X * because Ultrix screws it up.
  98. X */
  99. X
  100. Xstruct timeval {
  101. X    long tv_sec;        /* time_t */
  102. X    long tv_usec;        /* microsex */
  103. X};
  104. X
  105. Xstruct timezone {
  106. X    int tz_minuteswest;    /* of Greenwinch */
  107. X    int tz_dsttime;        /* type of dst correction to apply */
  108. X};
  109. END_OF_FILE
  110.   if test 274 -ne `wc -c <'std/posix/time.h'`; then
  111.     echo shar: \"'std/posix/time.h'\" unpacked with wrong size!
  112.   fi
  113.   # end of 'std/posix/time.h'
  114. fi
  115. if test -f 'std/stdc/memchr.c' -a "${1}" != "-c" ; then 
  116.   echo shar: Will not clobber existing file \"'std/stdc/memchr.c'\"
  117. else
  118.   echo shar: Extracting \"'std/stdc/memchr.c'\" \(225 characters\)
  119.   sed "s/^X//" >'std/stdc/memchr.c' <<'END_OF_FILE'
  120. X/* $Header$ */
  121. X
  122. X#include <string.h>
  123. X
  124. XVoid *
  125. Xmemchr(ap, c, n)
  126. X    Const Void *ap;
  127. X    register int c;
  128. X    register size_t n;
  129. X{
  130. X    register char *p = ap;
  131. X
  132. X    if (n++ > 0)
  133. X        while (--n > 0)
  134. X            if (*p++ == c)
  135. X                return --p;
  136. X    return NULL;
  137. X}
  138. X
  139. END_OF_FILE
  140.   if test 225 -ne `wc -c <'std/stdc/memchr.c'`; then
  141.     echo shar: \"'std/stdc/memchr.c'\" unpacked with wrong size!
  142.   fi
  143.   # end of 'std/stdc/memchr.c'
  144. fi
  145. if test -f 'std/stdc/memcpy.c' -a "${1}" != "-c" ; then 
  146.   echo shar: Will not clobber existing file \"'std/stdc/memcpy.c'\"
  147. else
  148.   echo shar: Extracting \"'std/stdc/memcpy.c'\" \(228 characters\)
  149.   sed "s/^X//" >'std/stdc/memcpy.c' <<'END_OF_FILE'
  150. X/* $Header$ */
  151. X
  152. X#include <string.h>
  153. X
  154. XVoid *
  155. Xmemcpy(dap, sap, n)
  156. X    Void *dap;
  157. X    Const Void *sap;
  158. X    register size_t n;
  159. X{
  160. X    register char *dp = dap, *sp = (Void*) sap;
  161. X
  162. X    if (n++ > 0)
  163. X        while (--n > 0)
  164. X            *dp++ = *sp++;
  165. X    return dap;
  166. X}
  167. X
  168. END_OF_FILE
  169.   if test 228 -ne `wc -c <'std/stdc/memcpy.c'`; then
  170.     echo shar: \"'std/stdc/memcpy.c'\" unpacked with wrong size!
  171.   fi
  172.   # end of 'std/stdc/memcpy.c'
  173. fi
  174. if test -f 'std/stdc/memset.c' -a "${1}" != "-c" ; then 
  175.   echo shar: Will not clobber existing file \"'std/stdc/memset.c'\"
  176. else
  177.   echo shar: Extracting \"'std/stdc/memset.c'\" \(196 characters\)
  178.   sed "s/^X//" >'std/stdc/memset.c' <<'END_OF_FILE'
  179. X/* $Header$ */
  180. X
  181. X#include <string.h>
  182. X
  183. XVoid *
  184. Xmemset(ap, c, n)
  185. X    Void *ap;
  186. X    register int c;
  187. X    register size_t n;
  188. X{
  189. X    register char *p = ap;
  190. X
  191. X    if (n++ > 0)
  192. X        while (--n > 0)
  193. X            *p++ = c;
  194. X    return ap;
  195. X}
  196. X
  197. END_OF_FILE
  198.   if test 196 -ne `wc -c <'std/stdc/memset.c'`; then
  199.     echo shar: \"'std/stdc/memset.c'\" unpacked with wrong size!
  200.   fi
  201.   # end of 'std/stdc/memset.c'
  202. fi
  203. if test -f 'std/stdc/strcat.c' -a "${1}" != "-c" ; then 
  204.   echo shar: Will not clobber existing file \"'std/stdc/strcat.c'\"
  205. else
  206.   echo shar: Extracting \"'std/stdc/strcat.c'\" \(322 characters\)
  207.   sed "s/^X//" >'std/stdc/strcat.c' <<'END_OF_FILE'
  208. X#include <string.h>
  209. X
  210. X/*
  211. X * strcat - append string src to dst
  212. X */
  213. Xchar *                /* dst */
  214. Xstrcat(dst, src)
  215. Xchar *dst;
  216. XConst char *src;
  217. X{
  218. X    register char *dscan;
  219. X    register Const char *sscan;
  220. X
  221. X    for (dscan = dst; *dscan != '\0'; dscan++)
  222. X        continue;
  223. X    sscan = src;
  224. X    while ((*dscan++ = *sscan++) != '\0')
  225. X        continue;
  226. X    return(dst);
  227. X}
  228. END_OF_FILE
  229.   if test 322 -ne `wc -c <'std/stdc/strcat.c'`; then
  230.     echo shar: \"'std/stdc/strcat.c'\" unpacked with wrong size!
  231.   fi
  232.   # end of 'std/stdc/strcat.c'
  233. fi
  234. if test -f 'std/stdc/strcpy.c' -a "${1}" != "-c" ; then 
  235.   echo shar: Will not clobber existing file \"'std/stdc/strcpy.c'\"
  236. else
  237.   echo shar: Extracting \"'std/stdc/strcpy.c'\" \(278 characters\)
  238.   sed "s/^X//" >'std/stdc/strcpy.c' <<'END_OF_FILE'
  239. X#include <string.h>
  240. X
  241. X/*
  242. X * strcpy - copy string src to dst
  243. X */
  244. Xchar *                /* dst */
  245. Xstrcpy(dst, src)
  246. Xchar *dst;
  247. XConst char *src;
  248. X{
  249. X    register char *dscan;
  250. X    register Const char *sscan;
  251. X
  252. X    dscan = dst;
  253. X    sscan = src;
  254. X    while ((*dscan++ = *sscan++) != '\0')
  255. X        continue;
  256. X    return(dst);
  257. X}
  258. END_OF_FILE
  259.   if test 278 -ne `wc -c <'std/stdc/strcpy.c'`; then
  260.     echo shar: \"'std/stdc/strcpy.c'\" unpacked with wrong size!
  261.   fi
  262.   # end of 'std/stdc/strcpy.c'
  263. fi
  264. if test -f 'std/stdc/strerror.c' -a "${1}" != "-c" ; then 
  265.   echo shar: Will not clobber existing file \"'std/stdc/strerror.c'\"
  266. else
  267.   echo shar: Extracting \"'std/stdc/strerror.c'\" \(326 characters\)
  268.   sed "s/^X//" >'std/stdc/strerror.c' <<'END_OF_FILE'
  269. X#include <string.h>
  270. X
  271. X/*
  272. X * strerror - map error number to descriptive string
  273. X *
  274. X * This version is obviously somewhat Unix-specific.
  275. X */
  276. Xchar *
  277. Xstrerror(errno)
  278. Xint errno;
  279. X{
  280. X    extern int sys_nerr;
  281. X    extern char *sys_errlist[];
  282. X
  283. X    if (errno > 0 && errno < sys_nerr)
  284. X        return(sys_errlist[errno]);
  285. X    else
  286. X        return("unknown error");
  287. X}
  288. END_OF_FILE
  289.   if test 326 -ne `wc -c <'std/stdc/strerror.c'`; then
  290.     echo shar: \"'std/stdc/strerror.c'\" unpacked with wrong size!
  291.   fi
  292.   # end of 'std/stdc/strerror.c'
  293. fi
  294. if test -f 'std/stdc/strlen.c' -a "${1}" != "-c" ; then 
  295.   echo shar: Will not clobber existing file \"'std/stdc/strlen.c'\"
  296. else
  297.   echo shar: Extracting \"'std/stdc/strlen.c'\" \(241 characters\)
  298.   sed "s/^X//" >'std/stdc/strlen.c' <<'END_OF_FILE'
  299. X#include <string.h>
  300. X
  301. X/*
  302. X * strlen - length of string (not including NUL)
  303. X */
  304. Xsize_t
  305. Xstrlen(s)
  306. XConst char *s;
  307. X{
  308. X    register Const char *scan;
  309. X    register size_t count;
  310. X
  311. X    count = 0;
  312. X    scan = s;
  313. X    while (*scan++ != '\0')
  314. X        count++;
  315. X    return(count);
  316. X}
  317. END_OF_FILE
  318.   if test 241 -ne `wc -c <'std/stdc/strlen.c'`; then
  319.     echo shar: \"'std/stdc/strlen.c'\" unpacked with wrong size!
  320.   fi
  321.   # end of 'std/stdc/strlen.c'
  322. fi
  323. echo shar: End of archive 9 \(of 9\).
  324. cp /dev/null ark9isdone
  325. MISSING=""
  326. for I in 1 2 3 4 5 6 7 8 9 ; do
  327.     if test ! -f ark${I}isdone ; then
  328.     MISSING="${MISSING} ${I}"
  329.     fi
  330. done
  331. if test "${MISSING}" = "" ; then
  332.     echo You have unpacked all 9 archives.
  333.     rm -f ark[1-9]isdone ark[1-9][0-9]isdone
  334. else
  335.     echo You still must unpack the following archives:
  336.     echo "        " ${MISSING}
  337. fi
  338. exit 0
  339. exit 0 # Just in case...
  340. -- 
  341. Kent Landfield                   INTERNET: kent@sparky.IMD.Sterling.COM
  342. Sterling Software, IMD           UUCP:     uunet!sparky!kent
  343. Phone:    (402) 291-8300         FAX:      (402) 291-4362
  344. Please send comp.sources.misc-related mail to kent@uunet.uu.net.
  345.