home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / sources / misc / volume1 / 8709 / 2 / fnkey.c.diff < prev   
Encoding:
Text File  |  1987-09-08  |  1.6 KB  |  71 lines

  1. 38a39,40
  2. > #include <ctype.h>    /* only needed on some systems to include toupper(), */
  3. >             /* it can be commented out if compile problems arise */
  4. 42a45
  5. > int    quiet = 0;
  6. 46a50
  7. >     "hp150",
  8. 55c59,60
  9. <     int    i, fd, termok = 0;
  10. ---
  11. >     int    i, fd, args, file_ok = 0, termok = 0;
  12. 63,69c68,69
  13. <     if (termok != 1) {
  14. <         fprintf(stderr, "%s: Inadequate terminal type '%s'\n", argv[0], getenv("TERM"));
  15. <         exit(1);
  16. <     }
  17. <     if (argc == 2) {
  18. <         if (strcmp(argv[1], "-") == 0) {    /* hook stdin to fd */
  19. ---
  20. >     for (args = 1; args <= argc-1; args++) {
  21. >         if (strcmp(argv[args], "-") == 0) {    /* hook stdin to fd */
  22. 72c72,75
  23. <         } else {        /* open normal file */
  24. ---
  25. >             file_ok = 1;
  26. >         } else if (strcmp(argv[args], "-q") == 0) {    /* quiet mode */
  27. >             quiet = 1;
  28. >         } else {                /* open normal file */
  29. 73a77
  30. >             file_ok = 1;
  31. 75c79,87
  32. <     } else {
  33. ---
  34. >     }
  35. >     if (termok != 1) {
  36. >         if (quiet == 0)
  37. >             fprintf(stderr, "%s: Inadequate terminal type '%s'\n", argv[0], getenv("TERM"));
  38. >         exit(1);
  39. >     }
  40. >     if (file_ok == 0) {        /* open default file if needed */
  41. 77a90
  42. 79c92,93
  43. <         fprintf(stderr, "%s: Cannot open any source file\n", argv[0]);
  44. ---
  45. >         if (quiet == 0)
  46. >             fprintf(stderr, "%s: Cannot open any source file\n", argv[0]);
  47. 128a143
  48. >     int    i, j;
  49. 139a155,163
  50. >     i = 0;
  51. >     do {
  52. >         if (string[i] == '%') {
  53. >             for (j=strlen(string)+1; j != i; j--)
  54. >                 string[j] = string[j-1];
  55. >             i++;
  56. >         }
  57. >         i++;
  58. >     } while (i < strlen(string));
  59. 156c180,181
  60. <     fprintf(stderr, "%s: Invalid entry for key '%s'\n", pgname, k);
  61. ---
  62. >     if (quiet == 0)
  63. >         fprintf(stderr, "%s: Invalid entry for key '%s'\n", pgname, k);
  64. 275d299
  65.