home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 22 gnu / 22-gnu.zip / gnusutil.zip / patches.os2 < prev    next >
Text File  |  1996-04-20  |  32KB  |  1,387 lines

  1. Only in new: README.OS2
  2. Only in new: patches.os2
  3. Only in new: config.h.os2
  4. Only in new: Makefile.os2
  5. Only in new/src: Makefile.os2
  6. Only in new/src: gnushutl.def
  7. Only in new/lib: Makefile.os2
  8. Only in new/lib: gnuregex.def
  9. Only in new/lib: gnushu.def
  10. Only in new/lib: utsname.c
  11. Only in new/lib: utsname.h
  12. diff -cbBwr orig/lib/basename.c new/lib/basename.c
  13. *** orig/lib/basename.c    Mon Sep 26 23:46:14 1994
  14. --- new/lib/basename.c    Sat Dec 17 00:09:10 1994
  15. ***************
  16. *** 37,41 ****
  17. --- 37,45 ----
  18.     char *base;
  19.   
  20.     base = rindex (name, '/');
  21. + #ifdef OS2
  22. +   if (!base)
  23. +     base = rindex (name, ':');
  24. + #endif
  25.     return base ? base + 1 : name;
  26.   }
  27. diff -cbBwr orig/lib/error.c new/lib/error.c
  28. *** orig/lib/error.c    Thu Oct 13 00:41:00 1994
  29. --- new/lib/error.c    Sat Dec 17 00:09:12 1994
  30. ***************
  31. *** 69,74 ****
  32. --- 69,85 ----
  33.   #define strerror private_strerror
  34.   #endif
  35.   
  36. + #ifdef __EMX__
  37. + char *program_name;
  38. + void set_program_name(char *name)
  39. + {
  40. +   program_name = name;
  41. + }
  42. + #endif
  43.   /* Print the program name and error message MESSAGE, which is a printf-style
  44.      format string with optional args.
  45.      If ERRNUM is nonzero, print its corresponding system error message.
  46. diff -cbBwr orig/lib/gethostname.c new/lib/gethostname.c
  47. *** orig/lib/gethostname.c    Mon Sep 26 23:25:26 1994
  48. --- new/lib/gethostname.c    Sat Dec 17 00:09:12 1994
  49. ***************
  50. *** 22,28 ****
  51.   #endif
  52.   
  53.   #ifdef HAVE_UNAME
  54. ! #include <sys/utsname.h>
  55.   #endif
  56.   
  57.   /* Put up to LEN chars of the host name into NAME.
  58. --- 22,28 ----
  59.   #endif
  60.   
  61.   #ifdef HAVE_UNAME
  62. ! #include <utsname.h>
  63.   #endif
  64.   
  65.   /* Put up to LEN chars of the host name into NAME.
  66. diff -cbBwr orig/lib/long-options.c new/lib/long-options.c
  67. *** orig/lib/long-options.c    Tue Sep 27 22:52:48 1994
  68. --- new/lib/long-options.c    Sat Dec 17 00:09:24 1994
  69. ***************
  70. *** 54,63 ****
  71.     opterr = 0;
  72.   
  73.     if (argc == 2
  74. !       && (c = getopt_long (argc, argv, "+", long_options, (int *) 0)) != EOF)
  75.       {
  76.         switch (c)
  77.       {
  78.       case 'h':
  79.         (*usage) (0);
  80.   
  81. --- 54,64 ----
  82.     opterr = 0;
  83.   
  84.     if (argc == 2
  85. !       && (c = getopt_long (argc, argv, "+?", long_options, (int *) 0)) != EOF)
  86.       {
  87.         switch (c)
  88.       {
  89. +     case '?':
  90.       case 'h':
  91.         (*usage) (0);
  92.   
  93. diff -cbBwr orig/lib/stime.c new/lib/stime.c
  94. *** orig/lib/stime.c    Tue Sep 27 22:54:18 1994
  95. --- new/lib/stime.c    Sat Dec 17 00:09:12 1994
  96. ***************
  97. *** 26,31 ****
  98. --- 26,33 ----
  99.   
  100.   /* Set the system time to *WHEN seconds past the start of 1970 GMT. */
  101.   
  102. + #ifndef OS2
  103.   int
  104.   stime (when)
  105.        time_t *when;
  106. ***************
  107. *** 36,38 ****
  108. --- 38,66 ----
  109.     tv.tv_usec = 0;
  110.     return settimeofday (&tv, (struct timezone *) 0);
  111.   }
  112. + #else
  113. + #include <os2.h>
  114. + int stime(time_t *newtime)
  115. + {
  116. +   struct tm *newtm = localtime(newtime);
  117. +   DATETIME dt;
  118. +   dt.hours   = newtm -> tm_hour;
  119. +   dt.minutes = newtm -> tm_min;
  120. +   dt.seconds = newtm -> tm_sec;
  121. +   dt.hundredths = 0;
  122. +   dt.day     = newtm -> tm_mday;
  123. +   dt.month   = newtm -> tm_mon + 1;
  124. +   dt.year    = newtm -> tm_year + 1900;
  125. +   dt.weekday = newtm -> tm_wday;
  126. +   dt.timezone = -1;
  127. +   return DosSetDateTime(&dt) ? -1 : 0;
  128. + }
  129. + #endif
  130. diff -cbBwr orig/lib/stripslash.c new/lib/stripslash.c
  131. *** orig/lib/stripslash.c    Mon Sep 26 23:42:18 1994
  132. --- new/lib/stripslash.c    Sat Dec 17 00:09:12 1994
  133. ***************
  134. *** 37,42 ****
  135. --- 37,48 ----
  136.   {
  137.     int last;
  138.   
  139. + #ifdef OS2
  140. +   for ( last = 0; path[last]; last++ )
  141. +     if ( path[last] == '\\' )
  142. +       path[last] = '/';
  143. + #endif
  144.     last = strlen (path) - 1;
  145.     while (last > 0 && path[last] == '/')
  146.       path[last--] = '\0';
  147. diff -cbBwr orig/lib/xgetcwd.c new/lib/xgetcwd.c
  148. *** orig/lib/xgetcwd.c    Tue Sep 27 15:02:46 1994
  149. --- new/lib/xgetcwd.c    Sat Dec 17 01:52:42 1994
  150. ***************
  151. *** 33,39 ****
  152. --- 33,44 ----
  153.   char *getwd ();
  154.   #define getcwd(buf, max) getwd (buf)
  155.   #else
  156. + #ifdef __EMX__
  157. + #include <stdlib.h>
  158. + #define getcwd _getcwd2
  159. + #else
  160.   char *getcwd ();
  161. + #endif
  162.   #endif
  163.   
  164.   /* Amount to increase buffer size by in each try. */
  165. diff -cbBwr orig/src/basename.c new/src/basename.c
  166. *** orig/src/basename.c    Fri Oct 21 06:59:40 1994
  167. --- new/src/basename.c    Sat Dec 17 00:11:10 1994
  168. ***************
  169. *** 51,56 ****
  170. --- 51,57 ----
  171.            program_name);
  172.     else
  173.       {
  174. +       print_version("basename");
  175.         printf ("\
  176.   Usage: %s PATH [SUFFIX]\n\
  177.     or:  %s OPTION\n\
  178. ***************
  179. *** 77,86 ****
  180.     parse_long_options (argc, argv, "basename", version_string, usage);
  181.   
  182.     if (argc == 1 || argc > 3)
  183. !     {
  184. !       error (0, 0, "too %s arguments", argc == 1 ? "few" : "many");
  185. !       usage (1);
  186. !     }
  187.   
  188.     strip_trailing_slashes (argv[1]);
  189.   
  190. --- 78,84 ----
  191.     parse_long_options (argc, argv, "basename", version_string, usage);
  192.   
  193.     if (argc == 1 || argc > 3)
  194. !     usage (0);
  195.   
  196.     strip_trailing_slashes (argv[1]);
  197.   
  198. diff -cbBwr orig/src/date.c new/src/date.c
  199. *** orig/src/date.c    Sat Oct 01 20:06:08 1994
  200. --- new/src/date.c    Sat Dec 17 00:12:12 1994
  201. ***************
  202. *** 156,162 ****
  203.   
  204.     program_name = argv[0];
  205.   
  206. !   while ((optc = getopt_long (argc, argv, "d:f:s:u", long_options, (int *) 0))
  207.        != EOF)
  208.       switch (optc)
  209.         {
  210. --- 156,162 ----
  211.   
  212.     program_name = argv[0];
  213.   
  214. !   while ((optc = getopt_long (argc, argv, "d:f:s:u?", long_options, (int *) 0))
  215.        != EOF)
  216.       switch (optc)
  217.         {
  218. ***************
  219. *** 177,183 ****
  220.       universal_time = 1;
  221.       break;
  222.         default:
  223. !     usage (1);
  224.         }
  225.   
  226.     if (show_version)
  227. --- 177,183 ----
  228.       universal_time = 1;
  229.       break;
  230.         default:
  231. !     usage (0);
  232.         }
  233.   
  234.     if (show_version)
  235. ***************
  236. *** 325,330 ****
  237. --- 325,331 ----
  238.            program_name);
  239.     else
  240.       {
  241. +       print_version("date");
  242.         printf ("\
  243.   Usage: %s [OPTION]... [+FORMAT]\n\
  244.     or:  %s [OPTION] [MMDDhhmm[[CC]YY][.ss]]\n\
  245. diff -cbBwr orig/src/dirname.c new/src/dirname.c
  246. *** orig/src/dirname.c    Fri Oct 21 06:59:42 1994
  247. --- new/src/dirname.c    Sat Dec 17 00:13:06 1994
  248. ***************
  249. *** 40,45 ****
  250. --- 40,46 ----
  251.            program_name);
  252.     else
  253.       {
  254. +       print_version("dirname");
  255.         printf ("\
  256.   Usage: %s PATH\n\
  257.     or:  %s OPTION\n\
  258. ***************
  259. *** 67,81 ****
  260.     parse_long_options (argc, argv, "dirname", version_string, usage);
  261.   
  262.     if (argc != 2)
  263. !     {
  264. !       error (0, 0, "too %s arguments", argc < 2 ? "few" : "many");
  265. !       usage (1);
  266. !     }
  267.   
  268.     path = argv[1];
  269.     strip_trailing_slashes (path);
  270.   
  271.     slash = rindex (path, '/');
  272.     if (slash == NULL)
  273.       path = (char *) ".";
  274.     else
  275. --- 68,83 ----
  276.     parse_long_options (argc, argv, "dirname", version_string, usage);
  277.   
  278.     if (argc != 2)
  279. !     usage (0);
  280.   
  281.     path = argv[1];
  282.     strip_trailing_slashes (path);
  283.   
  284.     slash = rindex (path, '/');
  285. + #ifdef OS2
  286. +   if (slash == NULL)
  287. +     slash = rindex (path, ':');
  288. + #endif
  289.     if (slash == NULL)
  290.       path = (char *) ".";
  291.     else
  292. diff -cbBwr orig/src/echo.c new/src/echo.c
  293. *** orig/src/echo.c    Sat Oct 01 04:41:10 1994
  294. --- new/src/echo.c    Sat Dec 17 00:09:14 1994
  295. ***************
  296. *** 72,77 ****
  297. --- 72,78 ----
  298.            program_name);
  299.     else
  300.       {
  301. +       print_version("echo");
  302.         printf ("Usage: %s [OPTION]... [STRING]...\n", program_name);
  303.         printf ("\
  304.   \n\
  305. ***************
  306. *** 118,123 ****
  307. --- 119,131 ----
  308.   #if defined (V9_ECHO) && defined (V9_DEFAULT)
  309.     do_v9 = 1;
  310.   #endif
  311. +   if (argc == 1)
  312. +     {
  313. +       print_version("echo");
  314. +       fprintf (stderr, "Usage: %s [-neE] string ...\n", argv[0]);
  315. +       exit (1);
  316. +     }
  317.   
  318.     --argc;
  319.     ++argv;
  320. diff -cbBwr orig/src/env.c new/src/env.c
  321. *** orig/src/env.c    Sat Oct 01 04:41:10 1994
  322. --- new/src/env.c    Sat Dec 17 00:09:14 1994
  323. ***************
  324. *** 123,129 ****
  325.   
  326.     program_name = argv[0];
  327.   
  328. !   while ((optc = getopt_long (argc, argv, "+iu:", longopts, (int *) 0)) != EOF)
  329.       {
  330.         switch (optc)
  331.       {
  332. --- 123,129 ----
  333.   
  334.     program_name = argv[0];
  335.   
  336. !   while ((optc = getopt_long (argc, argv, "+iu:?", longopts, (int *) 0)) != EOF)
  337.       {
  338.         switch (optc)
  339.       {
  340. ***************
  341. *** 135,141 ****
  342.       case 'u':
  343.         break;
  344.       default:
  345. !       usage (2);
  346.       }
  347.       }
  348.   
  349. --- 135,141 ----
  350.       case 'u':
  351.         break;
  352.       default:
  353. !       usage (0);
  354.       }
  355.       }
  356.   
  357. ***************
  358. *** 151,162 ****
  359.     if (optind != argc && !strcmp (argv[optind], "-"))
  360.       ignore_environment = 1;
  361.     
  362.     environ = dummy_environ;
  363.     environ[0] = NULL;
  364. !   if (!ignore_environment)
  365. !     for (; *envp; envp++)
  366. !       putenv (*envp);
  367.   
  368.     optind = 0;            /* Force GNU getopt to re-initialize. */
  369.     while ((optc = getopt_long (argc, argv, "+iu:", longopts, (int *) 0)) != EOF)
  370. --- 151,160 ----
  371.     if (optind != argc && !strcmp (argv[optind], "-"))
  372.       ignore_environment = 1;
  373.     
  374. +   if (ignore_environment) {
  375.     environ = dummy_environ;
  376.     environ[0] = NULL;
  377. !   }
  378.   
  379.     optind = 0;            /* Force GNU getopt to re-initialize. */
  380.     while ((optc = getopt_long (argc, argv, "+iu:", longopts, (int *) 0)) != EOF)
  381. ***************
  382. *** 190,195 ****
  383. --- 188,194 ----
  384.            program_name);
  385.     else
  386.       {
  387. +       print_version("env");
  388.         printf ("Usage: %s [OPTION]... [-] [NAME=VALUE]... [COMMAND [ARG]...]\n",
  389.             program_name);
  390.         printf ("\
  391. diff -cbBwr orig/src/expr.c new/src/expr.c
  392. *** orig/src/expr.c    Fri Oct 21 06:59:42 1994
  393. --- new/src/expr.c    Sat Dec 17 00:13:22 1994
  394. ***************
  395. *** 97,102 ****
  396. --- 97,103 ----
  397.            program_name);
  398.     else
  399.       {
  400. +       print_version("expr");
  401.         printf ("\
  402.   Usage: %s EXPRESSION\n\
  403.     or:  %s OPTION\n\
  404. ***************
  405. *** 162,171 ****
  406.     parse_long_options (argc, argv, "expr", version_string, usage);
  407.   
  408.     if (argc == 1)
  409. !     {
  410. !       error (0, 0, "too few arguments");
  411. !       usage (1);
  412. !     }
  413.   
  414.     args = argv + 1;
  415.   
  416. --- 163,169 ----
  417.     parse_long_options (argc, argv, "expr", version_string, usage);
  418.   
  419.     if (argc == 1)
  420. !     usage (0);
  421.   
  422.     args = argv + 1;
  423.   
  424. diff -cbBwr orig/src/hostname.c new/src/hostname.c
  425. *** orig/src/hostname.c    Sat Oct 01 04:41:12 1994
  426. --- new/src/hostname.c    Sat Dec 17 00:09:16 1994
  427. ***************
  428. *** 61,66 ****
  429. --- 61,67 ----
  430.            program_name);
  431.     else
  432.       {
  433. +       print_version("hostname");
  434.         printf ("\
  435.   Usage: %s [NAME]\n\
  436.     or:  %s OPTION\n\
  437. diff -cbBwr orig/src/id.c new/src/id.c
  438. *** orig/src/id.c    Tue Oct 11 03:47:00 1994
  439. --- new/src/id.c    Sat Dec 17 00:09:16 1994
  440. ***************
  441. *** 22,34 ****
  442. --- 22,37 ----
  443.   #include <stdio.h>
  444.   #include <getopt.h>
  445.   #include <sys/types.h>
  446. + #ifndef OS2
  447.   #include <pwd.h>
  448.   #include <grp.h>
  449. + #endif
  450.   #include <getopt.h>
  451.   
  452.   #include "version.h"
  453.   #include "system.h"
  454.   
  455. + #ifndef OS2
  456.   #ifdef _POSIX_VERSION
  457.   #include <limits.h>
  458.   #if !defined(NGROUPS_MAX) || NGROUPS_MAX < 1
  459. ***************
  460. *** 48,56 ****
  461. --- 50,61 ----
  462.   #define NGROUPS_MAX NGROUPS
  463.   #endif /* not NGROUPS_MAX and NGROUPS */
  464.   #endif /* not _POSIX_VERSION */
  465. + #endif /* not OS2 */
  466.   
  467.   char *xmalloc ();
  468. + #ifndef OS2
  469.   int getugroups ();
  470. + #endif
  471.   void error ();
  472.   
  473.   static void print_user ();
  474. ***************
  475. *** 111,117 ****
  476.   
  477.     program_name = argv[0];
  478.   
  479. !   while ((optc = getopt_long (argc, argv, "gnruG", longopts, (int *) 0))
  480.        != EOF)
  481.       {
  482.         switch (optc)
  483. --- 116,122 ----
  484.   
  485.     program_name = argv[0];
  486.   
  487. !   while ((optc = getopt_long (argc, argv, "gnruG?", longopts, (int *) 0))
  488.        != EOF)
  489.       {
  490.         switch (optc)
  491. ***************
  492. *** 134,140 ****
  493.         just_group_list = 1;
  494.         break;
  495.       default:
  496. !       usage (1);
  497.       }
  498.       }
  499.   
  500. --- 139,145 ----
  501.         just_group_list = 1;
  502.         break;
  503.       default:
  504. !       usage (0);
  505.       }
  506.       }
  507.   
  508. ***************
  509. *** 359,364 ****
  510. --- 364,370 ----
  511.            program_name);
  512.     else
  513.       {
  514. +       print_version("id");
  515.         printf ("Usage: %s [OPTION]... [USERNAME]\n", program_name);
  516.         printf ("\
  517.   \n\
  518. diff -cbBwr orig/src/logname.c new/src/logname.c
  519. *** orig/src/logname.c    Sat Oct 01 04:41:14 1994
  520. --- new/src/logname.c    Sat Dec 17 00:09:16 1994
  521. ***************
  522. *** 48,53 ****
  523. --- 48,54 ----
  524.            program_name);
  525.     else
  526.       {
  527. +       print_version("logname");
  528.         printf ("Usage: %s [OPTION]...\n", program_name);
  529.         printf ("\
  530.   \n\
  531. ***************
  532. *** 68,74 ****
  533.   
  534.     program_name = argv[0];
  535.   
  536. !   while ((c = getopt_long (argc, argv, "", long_options, (int *) 0)) != EOF)
  537.       {
  538.         switch (c)
  539.       {
  540. --- 69,75 ----
  541.   
  542.     program_name = argv[0];
  543.   
  544. !   while ((c = getopt_long (argc, argv, "?", long_options, (int *) 0)) != EOF)
  545.       {
  546.         switch (c)
  547.       {
  548. ***************
  549. *** 76,82 ****
  550.         break;
  551.   
  552.       default:
  553. !       usage (1);
  554.       }
  555.       }
  556.   
  557. --- 77,83 ----
  558.         break;
  559.   
  560.       default:
  561. !       usage (0);
  562.       }
  563.       }
  564.   
  565. diff -cbBwr orig/src/nice.c new/src/nice.c
  566. *** orig/src/nice.c    Sat Oct 01 04:41:16 1994
  567. --- new/src/nice.c    Sat Dec 17 00:19:22 1994
  568. ***************
  569. *** 18,23 ****
  570. --- 18,61 ----
  571.   /* David MacKenzie <djm@gnu.ai.mit.edu> */
  572.   
  573.   #include <config.h>
  574. + #ifdef OS2
  575. + #define NICE
  576. + #define INCL_NOPM
  577. + #define INCL_DOSPROCESS
  578. + #include <os2.h>
  579. + #include <errno.h>
  580. + #define PRIO_PROCESS 0
  581. + int class = PRTYC_NOCHANGE;
  582. + int adjustment;
  583. + char *current_class;
  584. + char *name[] = {"", "idle-time", "regular", "time-critical", "foreground-server"};
  585. + int getpriority(int x, int y)
  586. + {
  587. +   ULONG prio, class;
  588. +   PTIB ptib;
  589. +   PPIB ppib;
  590. +   DosGetInfoBlocks(&ptib, &ppib);
  591. +   prio = ptib -> tib_ptib2 -> tib2_ulpri;
  592. +   class = prio >> 8;
  593. +   current_class = name[class];
  594. +   return -(prio & 255);
  595. + }
  596. + int setpriority(int x, int y, int v)
  597. + {
  598. +   return DosSetPriority(PRTYS_PROCESSTREE, class, -adjustment, 0) ? -1 : 0;
  599. + }
  600. + #endif
  601.   #include <stdio.h>
  602.   
  603.   #define NDEBUG
  604. ***************
  605. *** 51,56 ****
  606. --- 89,100 ----
  607.   static struct option const longopts[] =
  608.   {
  609.     {"adjustment", required_argument, NULL, 'n'},
  610. + #ifdef OS2
  611. +   {"idle-time", no_argument, NULL, 'i'},
  612. +   {"regular", no_argument, NULL, 'r'},
  613. +   {"time-critical", no_argument, NULL, 't'},
  614. +   {"foreground-server", no_argument, NULL, 'f'},
  615. + #endif
  616.     {NULL, 0, NULL, 0}
  617.   };
  618.   
  619. ***************
  620. *** 60,66 ****
  621. --- 104,112 ----
  622.        char **argv;
  623.   {
  624.     int current_priority;
  625. + #ifndef OS2
  626.     int adjustment = 0;
  627. + #endif
  628.     int minusflag = 0;
  629.     int adjustment_given = 0;
  630.     int long_option_priority = 0;
  631. ***************
  632. *** 89,95 ****
  633. --- 135,145 ----
  634.         else
  635.       {
  636.         int optc;
  637. + #ifdef OS2
  638. +       while ((optc = getopt_long (argc, argv, "+0123456789n:irtf", longopts,
  639. + #else
  640.         while ((optc = getopt_long (argc, argv, "+0123456789n:", longopts,
  641. + #endif
  642.                         (int *) 0)) != EOF)
  643.           {
  644.             switch (optc)
  645. ***************
  646. *** 97,102 ****
  647. --- 147,167 ----
  648.           case '?':
  649.             usage (1);
  650.   
  651. + #ifdef OS2
  652. +         case 'i':
  653. +           class = PRTYC_IDLETIME;
  654. +           break;
  655. +         case 'r':
  656. +           class = PRTYC_REGULAR;
  657. +           break;
  658. +         case 't':
  659. +           class = PRTYC_TIMECRITICAL;
  660. +           break;
  661. +         case 'f':
  662. +           class = PRTYC_FOREGROUNDSERVER;
  663. +           break;
  664. + #endif
  665.           case 'n':
  666.             if (!isinteger (optarg))
  667.               error (1, 0, "invalid priority `%s'", optarg);
  668. ***************
  669. *** 142,148 ****
  670. --- 207,219 ----
  671.         current_priority = GET_PRIORITY ();
  672.         if (current_priority == -1 && errno != 0)
  673.       error (1, errno, "cannot get priority");
  674. + #ifdef OS2
  675. +       printf ("\ncurrent class: %s\ncurrent priority: %d\n",
  676. +               current_class, current_priority);
  677. +       usage (0);
  678. + #else
  679.         printf ("%d\n", current_priority);
  680. + #endif
  681.         exit (0);
  682.       }
  683.   
  684. ***************
  685. *** 190,196 ****
  686. --- 261,288 ----
  687.            program_name);
  688.     else
  689.       {
  690. +       print_version("nice");
  691.         printf ("Usage: %s [OPTION]... [COMMAND [ARG]...]\n", program_name);
  692. + #ifdef OS2
  693. +       printf ("\
  694. + \n\
  695. +   -ADJUST                   increment priority by ADJUST\n\
  696. +   -n, --adjustment=ADJUST   same as -ADJUST\n\
  697. + \n\
  698. +   -i, --idle-time        idle-time class\n\
  699. +   -r, --regular            regular class\n\
  700. +   -t, --time-critical        time-critical class\n\
  701. +   -f, --foreground-server   foreground-server class\n\
  702. + \n\
  703. + Note that this program follows the Unix style which is that\n\
  704. + negative adjustments increase the priority while positive\n\
  705. + adjustments decrease the priority. Normally, all OS/2 processes\n\
  706. + run at the lowest priority in their class already, so only\n\
  707. + negative values make sense unless priority has been increased\n\
  708. + previously, to allow a decrease later. Range of ADJUST goes from\n\
  709. + -31 to 31. With no COMMAND, print the current scheduling priority.\n\
  710. + ");
  711. + #else
  712.         printf ("\
  713.   \n\
  714.     -ADJUST                   increment priority by ADJUST first\n\
  715. ***************
  716. *** 201,206 ****
  717. --- 293,299 ----
  718.   With no COMMAND, print the current scheduling priority.  ADJUST is 10\n\
  719.   by default.  Range goes from -20 (highest priority) to 19 (lowest).\n\
  720.   ");
  721. + #endif
  722.       }
  723.     exit (status);
  724.   }
  725. diff -cbBwr orig/src/pathchk.c new/src/pathchk.c
  726. *** orig/src/pathchk.c    Fri Oct 21 06:59:44 1994
  727. --- new/src/pathchk.c    Sat Dec 17 00:13:36 1994
  728. ***************
  729. *** 151,160 ****
  730.       usage (0);
  731.   
  732.     if (optind == argc)
  733. !     {
  734. !       error (0, 0, "too few arguments");
  735. !       usage (1);
  736. !     }
  737.   
  738.     for (; optind < argc; ++optind)
  739.       exit_status |= validate_path (argv[optind], check_portability);
  740. --- 151,157 ----
  741.       usage (0);
  742.   
  743.     if (optind == argc)
  744. !     usage (0);
  745.   
  746.     for (; optind < argc; ++optind)
  747.       exit_status |= validate_path (argv[optind], check_portability);
  748. ***************
  749. *** 365,370 ****
  750. --- 362,368 ----
  751.            program_name);
  752.     else
  753.       {
  754. +       print_version("pathchk");
  755.         printf ("Usage: %s [OPTION]... PATH...\n", program_name);
  756.         printf ("\
  757.   \n\
  758. diff -cbBwr orig/src/printenv.c new/src/printenv.c
  759. *** orig/src/printenv.c    Sat Oct 01 04:41:18 1994
  760. --- new/src/printenv.c    Sat Dec 17 00:09:26 1994
  761. ***************
  762. *** 29,34 ****
  763. --- 29,35 ----
  764.   
  765.   #include <config.h>
  766.   #include <stdio.h>
  767. + #include <ctype.h>
  768.   #include <sys/types.h>
  769.   #include <getopt.h>
  770.   
  771. ***************
  772. *** 64,69 ****
  773. --- 65,71 ----
  774.            program_name);
  775.     else
  776.       {
  777. +       print_version("printenv");
  778.         printf ("Usage: %s [OPTION]... [VARIABLE]...\n", program_name);
  779.         printf ("\
  780.   \n\
  781. ***************
  782. *** 90,96 ****
  783.   
  784.     program_name = argv[0];
  785.   
  786. !   while ((c = getopt_long (argc, argv, "", long_options, (int *) 0)) != EOF)
  787.       {
  788.         switch (c)
  789.       {
  790. --- 92,98 ----
  791.   
  792.     program_name = argv[0];
  793.   
  794. !   while ((c = getopt_long (argc, argv, "?", long_options, (int *) 0)) != EOF)
  795.       {
  796.         switch (c)
  797.       {
  798. ***************
  799. *** 98,104 ****
  800.         break;
  801.   
  802.       default:
  803. !       usage (1);
  804.       }
  805.       }
  806.   
  807. --- 100,106 ----
  808.         break;
  809.   
  810.       default:
  811. !       usage (0);
  812.       }
  813.       }
  814.   
  815. ***************
  816. *** 125,132 ****
  817. --- 127,140 ----
  818.           {
  819.             ep = *env;
  820.             ap = argv[i];
  821. + #ifdef OS2
  822. +           while (*ep != '\0' && *ap != '\0' && tolower(*ep) == tolower(*ap))
  823. +             {
  824. +           ep++, ap++;
  825. + #else
  826.             while (*ep != '\0' && *ap != '\0' && *ep++ == *ap++)
  827.           {
  828. + #endif
  829.             if (*ep == '=' && *ap == '\0')
  830.               {
  831.                 puts (ep + 1);
  832. diff -cbBwr orig/src/printf.c new/src/printf.c
  833. *** orig/src/printf.c    Sat Oct 01 04:41:18 1994
  834. --- new/src/printf.c    Sat Dec 17 00:09:26 1994
  835. ***************
  836. *** 90,95 ****
  837. --- 90,96 ----
  838.            program_name);
  839.     else
  840.       {
  841. +       print_version("printf");
  842.         printf ("\
  843.   Usage: %s FORMAT [ARGUMENT]...\n\
  844.     or:  %s OPTION\n\
  845. ***************
  846. *** 139,148 ****
  847.     parse_long_options (argc, argv, "printf", version_string, usage);
  848.   
  849.     if (argc == 1)
  850. !     {
  851. !       fprintf (stderr, "Usage: %s format [argument...]\n", program_name);
  852. !       exit (1);
  853. !     }
  854.   
  855.     format = argv[1];
  856.     argc -= 2;
  857. --- 140,146 ----
  858.     parse_long_options (argc, argv, "printf", version_string, usage);
  859.   
  860.     if (argc == 1)
  861. !     usage (0);
  862.   
  863.     format = argv[1];
  864.     argc -= 2;
  865. ***************
  866. *** 301,306 ****
  867. --- 299,305 ----
  868.         if (esc_length == 0)
  869.       error (1, 0, "missing hexadecimal number in escape");
  870.         putchar (esc_value);
  871. +       --p;
  872.       }
  873.     else if (*p == '0')
  874.       {
  875. diff -cbBwr orig/src/pwd.c new/src/pwd.c
  876. *** orig/src/pwd.c    Sat Oct 01 04:41:20 1994
  877. --- new/src/pwd.c    Sat Dec 17 00:09:26 1994
  878. ***************
  879. *** 40,45 ****
  880. --- 40,46 ----
  881.            program_name);
  882.     else
  883.       {
  884. +       print_version("pwd");
  885.         printf ("Usage: %s [OPTION]\n", program_name);
  886.         printf ("\
  887.   \n\
  888. diff -cbBwr orig/src/sleep.c new/src/sleep.c
  889. *** orig/src/sleep.c    Fri Oct 21 06:59:44 1994
  890. --- new/src/sleep.c    Sat Dec 17 00:14:00 1994
  891. ***************
  892. *** 52,57 ****
  893. --- 52,58 ----
  894.            program_name);
  895.     else
  896.       {
  897. +       print_version("sleep");
  898.         printf ("Usage: %s [OPTION]... NUMBER[SUFFIX]\n", program_name);
  899.         printf ("\
  900.   \n\
  901. ***************
  902. *** 97,106 ****
  903.       usage (0);
  904.   
  905.     if (argc == 1)
  906. !     {
  907. !       error (0, 0, "too few arguments");
  908. !       usage (1);
  909. !     }
  910.   
  911.     for (i = 1; i < argc; i++)
  912.       seconds += argdecode (argv[i]);
  913. --- 98,104 ----
  914.       usage (0);
  915.   
  916.     if (argc == 1)
  917. !     usage (0);
  918.   
  919.     for (i = 1; i < argc; i++)
  920.       seconds += argdecode (argv[i]);
  921. diff -cbBwr orig/src/system.h new/src/system.h
  922. *** orig/src/system.h    Sat Oct 08 02:24:44 1994
  923. --- new/src/system.h    Sat Dec 17 01:41:20 1994
  924. ***************
  925. *** 15,22 ****
  926.      along with this program; if not, write to the Free Software
  927.      Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
  928.   
  929. ! /* Include sys/types.h before this file.  */
  930.   #include <sys/stat.h>
  931.   
  932.   #ifdef STAT_MACROS_BROKEN
  933. --- 15,21 ----
  934.      along with this program; if not, write to the Free Software
  935.      Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
  936.   
  937. ! #include <sys/types.h>
  938.   #include <sys/stat.h>
  939.   
  940.   #ifdef STAT_MACROS_BROKEN
  941. ***************
  942. *** 68,73 ****
  943. --- 67,112 ----
  944.   #include <unistd.h>
  945.   #endif
  946.   
  947. + #ifdef OS2
  948. + #include <process.h>
  949. + #include <stdlib.h>
  950. + #include <pwd.h>
  951. + #ifdef NICE
  952. + #define execvp(n, a)        {int rc = spawnvp(P_WAIT, n, a); if (rc != -1) exit(rc);}
  953. + #else
  954. + #define execvp(n, a)        spawnvp(P_OVERLAY, n, a)
  955. + #endif
  956. + #define PATH_MAX            260
  957. + #define NAME_MAX            256
  958. + #define getgid()            0
  959. + #define getuid()            0
  960. + #define getegid()           0
  961. + #define geteuid()           0
  962. + #define getpwnam(x)         (dummy_pw.pw_name = getlogin(), &dummy_pw)
  963. + #define getpwuid(x)         (dummy_pw.pw_name = getlogin(), &dummy_pw)
  964. + #define getgrgid(x)         (&dummy_gr)
  965. + #define getgroups(n,p)      (*p = 0, 1)
  966. + #define getugroups(n,p,u)   (*p = 0, 1)
  967. + #define getlogin()          (getenv("LOGNAME") ? getenv("LOGNAME") : "root")
  968. + struct group {
  969. +   char *gr_name;
  970. +   gid_t gr_uid;
  971. + };
  972. + static struct group dummy_gr = {"root", 0};
  973. + static struct passwd dummy_pw = {"root", 0, 0};
  974. + #define ttyname(arg)        (isatty(0) ? "con" : NULL)
  975. + #define main os2main
  976. + #else /* not OS2 */
  977.   #ifndef _POSIX_VERSION
  978.   char *getlogin ();
  979.   char *ttyname ();
  980. ***************
  981. *** 75,80 ****
  982. --- 114,121 ----
  983.   uid_t geteuid ();
  984.   #endif /* _POSIX_VERSION */
  985.   
  986. + #endif /* OS2 */
  987.   #if defined(STDC_HEADERS) || defined(HAVE_STRING_H)
  988.   #include <string.h>
  989.   #ifndef index
  990. ***************
  991. *** 115,120 ****
  992. --- 156,165 ----
  993.   #endif
  994.   
  995.   #include <ctype.h>
  996. + #include "version.h"
  997. + #define print_version(x) \
  998. +   fprintf(stderr, "\nGNU %s, %s\n\n", x, version_string + 4)
  999.   
  1000.   #if defined (STDC_HEADERS) || (!defined (isascii) && !defined (HAVE_ISASCII))
  1001.   #define ISASCII(c) 1
  1002. diff -cbBwr orig/src/tee.c new/src/tee.c
  1003. *** orig/src/tee.c    Sat Oct 01 04:41:24 1994
  1004. --- new/src/tee.c    Sat Dec 17 00:09:26 1994
  1005. ***************
  1006. *** 65,70 ****
  1007. --- 65,71 ----
  1008.            program_name);
  1009.     else
  1010.       {
  1011. +       print_version("tee");
  1012.         printf ("Usage: %s [OPTION]... [FILE]...\n", program_name);
  1013.         printf ("\
  1014.   \n\
  1015. ***************
  1016. *** 119,124 ****
  1017. --- 120,128 ----
  1018.     if (show_help)
  1019.       usage (0);
  1020.   
  1021. +   if (isatty(0))
  1022. +     usage(0);
  1023.     if (ignore_interrupts)
  1024.       {
  1025.   #ifdef _POSIX_SOURCE
  1026. ***************
  1027. *** 156,162 ****
  1028.   
  1029.     descriptors = (int *) xmalloc ((nfiles + 1) * sizeof (int));
  1030.   
  1031. !   mode = O_WRONLY | O_CREAT;
  1032.     if (append)
  1033.       mode |= O_APPEND;
  1034.     else
  1035. --- 160,171 ----
  1036.   
  1037.     descriptors = (int *) xmalloc ((nfiles + 1) * sizeof (int));
  1038.   
  1039. ! #ifdef OS2
  1040. !   setmode(0, O_BINARY);
  1041. !   setmode(1, O_BINARY);
  1042. ! #endif
  1043. !   mode = O_WRONLY | O_CREAT | O_BINARY;
  1044.     if (append)
  1045.       mode |= O_APPEND;
  1046.     else
  1047. diff -cbBwr orig/src/test.c new/src/test.c
  1048. *** orig/src/test.c    Sat Oct 01 05:27:38 1994
  1049. --- new/src/test.c    Sat Dec 17 00:16:04 1994
  1050. ***************
  1051. *** 57,63 ****
  1052.   #endif /* !_POSIX_VERSION */
  1053.   
  1054.   #include <errno.h>
  1055. ! #ifndef errno
  1056.   extern int errno;
  1057.   #endif
  1058.   
  1059. --- 57,63 ----
  1060.   #endif /* !_POSIX_VERSION */
  1061.   
  1062.   #include <errno.h>
  1063. ! #if !defined (errno) && !defined(OS2)
  1064.   extern int errno;
  1065.   #endif
  1066.   
  1067. ***************
  1068. *** 69,76 ****
  1069. --- 69,78 ----
  1070.   #  define member(c, s) ((c) ? (index ((s), (c)) ? 1 : 0) : 0)
  1071.   #endif /* !member */
  1072.   
  1073. + #ifndef OS2
  1074.   extern gid_t getgid (), getegid ();
  1075.   extern uid_t geteuid ();
  1076. + #endif
  1077.   
  1078.   #if !defined (R_OK)
  1079.   #define R_OK 4
  1080. ***************
  1081. *** 175,180 ****
  1082. --- 175,181 ----
  1083.     if (euid == -1)
  1084.       euid = geteuid ();
  1085.   
  1086. + #ifndef OS2
  1087.     if (euid == 0)
  1088.       {
  1089.         /* Root can read or write any file. */
  1090. ***************
  1091. *** 186,191 ****
  1092. --- 187,193 ----
  1093.         if (st.st_mode & S_IXUGO)
  1094.       return (0);
  1095.       }
  1096. + #endif
  1097.   
  1098.     if (st.st_uid == euid)        /* owner */
  1099.       mode <<= 6;
  1100. ***************
  1101. *** 734,740 ****
  1102. --- 736,746 ----
  1103.         if (test_stat (argv[pos - 1], &stat_buf) < 0)
  1104.       return (FALSE);
  1105.   
  1106. + #ifdef OS2
  1107. +         return 0;
  1108. + #else
  1109.         return (TRUE == (S_ISBLK (stat_buf.st_mode)));
  1110. + #endif
  1111.   
  1112.       case 'p':            /* File is a named pipe? */
  1113.         unary_advance ();
  1114. ***************
  1115. *** 983,988 ****
  1116. --- 989,995 ----
  1117.            program_name);
  1118.     else
  1119.       {
  1120. +       print_version("test");
  1121.         printf ("\
  1122.   Usage: %s EXPRESSION\n\
  1123.     or:  [ EXPRESSION ]\n\
  1124. ***************
  1125. *** 1101,1107 ****
  1126.     pos = 1;
  1127.   
  1128.     if (pos >= argc)
  1129. !     test_exit (SHELL_BOOLEAN (FALSE));
  1130.   
  1131.     parse_long_options (argc, argv, COMMAND_NAME, version_string, usage);
  1132.     value = posixtest ();
  1133. --- 1108,1114 ----
  1134.     pos = 1;
  1135.   
  1136.     if (pos >= argc)
  1137. !     usage(0);
  1138.   
  1139.     parse_long_options (argc, argv, COMMAND_NAME, version_string, usage);
  1140.     value = posixtest ();
  1141. diff -cbBwr orig/src/tty.c new/src/tty.c
  1142. *** orig/src/tty.c    Sat Oct 01 04:41:26 1994
  1143. --- new/src/tty.c    Sat Dec 17 00:09:28 1994
  1144. ***************
  1145. *** 66,72 ****
  1146.     program_name = argv[0];
  1147.     silent = 0;
  1148.   
  1149. !   while ((optc = getopt_long (argc, argv, "s", longopts, (int *) 0)) != EOF)
  1150.       {
  1151.         switch (optc)
  1152.       {
  1153. --- 66,72 ----
  1154.     program_name = argv[0];
  1155.     silent = 0;
  1156.   
  1157. !   while ((optc = getopt_long (argc, argv, "s?", longopts, (int *) 0)) != EOF)
  1158.       {
  1159.         switch (optc)
  1160.       {
  1161. ***************
  1162. *** 78,84 ****
  1163.         break;
  1164.   
  1165.       default:
  1166. !       usage (2);
  1167.       }
  1168.       }
  1169.   
  1170. --- 78,84 ----
  1171.         break;
  1172.   
  1173.       default:
  1174. !       usage (0);
  1175.       }
  1176.       }
  1177.   
  1178. ***************
  1179. *** 118,123 ****
  1180. --- 118,124 ----
  1181.            program_name);
  1182.     else
  1183.       {
  1184. +       print_version("tty");
  1185.         printf ("Usage: %s [OPTION]...\n", program_name);
  1186.         printf ("\
  1187.   \n\
  1188. diff -cbBwr orig/src/uname.c new/src/uname.c
  1189. *** orig/src/uname.c    Sat Oct 01 04:41:28 1994
  1190. --- new/src/uname.c    Sat Dec 17 00:09:28 1994
  1191. ***************
  1192. *** 31,37 ****
  1193. --- 31,41 ----
  1194.   #include <config.h>
  1195.   #include <stdio.h>
  1196.   #include <sys/types.h>
  1197. + #ifdef OS2
  1198. + #include <utsname.h>
  1199. + #else
  1200.   #include <sys/utsname.h>
  1201. + #endif
  1202.   #include <getopt.h>
  1203.   
  1204.   #include "system.h"
  1205. ***************
  1206. *** 93,99 ****
  1207.     program_name = argv[0];
  1208.     toprint = 0;
  1209.   
  1210. !   while ((c = getopt_long (argc, argv, "snrvma", long_options, (int *) 0))
  1211.        != EOF)
  1212.       {
  1213.         switch (c)
  1214. --- 97,103 ----
  1215.     program_name = argv[0];
  1216.     toprint = 0;
  1217.   
  1218. !   while ((c = getopt_long (argc, argv, "snrvma?", long_options, (int *) 0))
  1219.        != EOF)
  1220.       {
  1221.         switch (c)
  1222. ***************
  1223. *** 127,133 ****
  1224.         break;
  1225.   
  1226.       default:
  1227. !       usage (1);
  1228.       }
  1229.       }
  1230.   
  1231. --- 131,137 ----
  1232.         break;
  1233.   
  1234.       default:
  1235. !       usage (0);
  1236.       }
  1237.       }
  1238.   
  1239. ***************
  1240. *** 183,188 ****
  1241. --- 187,193 ----
  1242.            program_name);
  1243.     else
  1244.       {
  1245. +       print_version("uname");
  1246.         printf ("Usage: %s [OPTION]...\n", program_name);
  1247.         printf ("\
  1248.   \n\
  1249. diff -cbBwr orig/src/version.c new/src/version.c
  1250. *** orig/src/version.c    Sat Nov 05 15:22:38 1994
  1251. --- new/src/version.c    Sat Dec 17 00:09:28 1994
  1252. ***************
  1253. *** 1,3 ****
  1254. --- 1,18 ----
  1255.   #include <config.h>
  1256.   #include "version.h"
  1257.   const char *version_string = "GNU sh-utils 1.12";
  1258. + #ifdef __EMX__
  1259. + #undef main
  1260. + int main(int argc, char **argv)
  1261. + {
  1262. +   _wildcard(&argc, &argv);
  1263. +   _response(&argc, &argv);
  1264. +   set_program_name(argv[0]);
  1265. +   tzset();
  1266. +   return os2main(argc, argv);
  1267. + }
  1268. + #endif
  1269. diff -cbBwr orig/src/whoami.c new/src/whoami.c
  1270. *** orig/src/whoami.c    Sat Oct 01 04:41:30 1994
  1271. --- new/src/whoami.c    Sat Dec 17 00:09:28 1994
  1272. ***************
  1273. *** 52,57 ****
  1274. --- 52,58 ----
  1275.            program_name);
  1276.     else
  1277.       {
  1278. +       print_version("whoami");
  1279.         printf ("Usage: %s [OPTION]...\n", program_name);
  1280.         printf ("\
  1281.   \n\
  1282. ***************
  1283. *** 75,81 ****
  1284.   
  1285.     program_name = argv[0];
  1286.   
  1287. !   while ((c = getopt_long (argc, argv, "", long_options, (int *) 0)) != EOF)
  1288.       {
  1289.         switch (c)
  1290.       {
  1291. --- 76,82 ----
  1292.   
  1293.     program_name = argv[0];
  1294.   
  1295. !   while ((c = getopt_long (argc, argv, "?", long_options, (int *) 0)) != EOF)
  1296.       {
  1297.         switch (c)
  1298.       {
  1299. ***************
  1300. *** 83,89 ****
  1301.         break;
  1302.   
  1303.       default:
  1304. !       usage (1);
  1305.       }
  1306.       }
  1307.   
  1308. --- 84,90 ----
  1309.         break;
  1310.   
  1311.       default:
  1312. !       usage (0);
  1313.       }
  1314.       }
  1315.   
  1316. diff -cbBwr orig/src/yes.c new/src/yes.c
  1317. *** orig/src/yes.c    Sat Oct 01 04:41:30 1994
  1318. --- new/src/yes.c    Sat Dec 17 00:09:28 1994
  1319. ***************
  1320. *** 21,26 ****
  1321. --- 21,28 ----
  1322.   #include <stdio.h>
  1323.   #include <getopt.h>
  1324.   
  1325. + #include "system.h"
  1326. + #include "version.h"
  1327.   #include "long-options.h"
  1328.   #include "version.h"
  1329.   
  1330. ***************
  1331. *** 36,41 ****
  1332. --- 38,44 ----
  1333.            program_name);
  1334.     else
  1335.       {
  1336. +       print_version("yes");
  1337.         printf ("Usage: %s [OPTION]... [STRING]...\n", program_name);
  1338.         printf ("\
  1339.   \n\
  1340.