uucp.patch 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350
  1. --- uucp-1.06.1.orig/contrib/uurate.c
  2. +++ uucp-1.06.1/contrib/uurate.c
  3. @@ -302,6 +307,7 @@
  4. int sent, called = IN;
  5. int report = 0; /* if <= 0 give msg that no report was avail. */
  6. int junk;
  7. + extern int getopt();
  8. /* --------------------------------------------------------------------
  9. * P r o l o g
  10. @@ -980,7 +986,7 @@
  11. if (cur->next == NULL) /* totals line reached ? */
  12. hdrprt('s',1); /* print the separator line */
  13. - printf("%-8s %4d %4d %9s %9s %9s %9s %9s %5.0f %5.0f\n",
  14. + printf("%-8s %4ld %4ld %9s %9s %9s %8s %8s %5.0f %5.0f\n",
  15. cur->Hostname, rf, sf,
  16. t1, t2, t3, t4, t5,
  17. ir, or);
  18. @@ -1028,7 +1034,7 @@
  19. hdrprt('p',0); /* print the header line(s) */
  20. hdr_done = TRUE;
  21. }
  22. - printf("%-8s %3s %4d %4d %5d %4d %10d %7d %10d\n",
  23. + printf("%-8s %3s %4ld %4ld %5ld %4ld %10ld %7ld %10ld\n",
  24. type == NULL ? " ":cur->Hostname,
  25. prot->type,
  26. prot->pr_psizemin,
  27. @@ -1072,7 +1078,7 @@
  28. hdrprt('p',1); /* print the header line(s) */
  29. hdr_done = TRUE;
  30. }
  31. - printf("%-8s %3s %11d %11d %11d %11d\n",
  32. + printf("%-8s %3s %11ld %11ld %11ld %11ld\n",
  33. type == NULL ? " ":cur->Hostname,
  34. prot->type,
  35. prot->pr_eheader,
  36. @@ -1747,13 +1753,13 @@
  37. puts("\nCompact summary:");
  38. puts("----------------");
  39. puts("\
  40. -Name of + Files + +------- Bytes/1000 --------+ +------ Time -----+ + Avg CPS +\n\
  41. -site in out inbound outbound total inbound outbound in out\n\
  42. --------- ---- ---- --------- --------- --------- --------- --------- ----- -----");
  43. +Name of + Files + +------- Bytes/1000 --------+ +----- Time ----+ + Avg CPS +\n\
  44. +site in out inbound outbound total inbound outbound in out\n\
  45. +-------- ---- ---- --------- --------- --------- -------- -------- ----- -----");
  46. }
  47. else
  48. puts("\
  49. ---------------------------------------------------------------------------------");
  50. +------------------------------------------------------------------------------");
  51. break;
  52. --- uucp-1.06.1.orig/system.h
  53. +++ uucp-1.06.1/system.h
  54. @@ -303,7 +303,8 @@
  55. will allow all grades from 'A' to 'Z' and 'a' to 'd'). This
  56. function should return FALSE on error. */
  57. extern boolean fsysdep_get_work_init P((const struct uuconf_system *qsys,
  58. - int bgrade));
  59. + int bgrade,
  60. + boolean unlimited));
  61. /* Get the next command to be executed for a remote system. The
  62. bgrade argument will be the same as for fsysdep_get_work_init;
  63. --- uucp-1.06.1.orig/trans.c
  64. +++ uucp-1.06.1/trans.c
  65. @@ -511,7 +511,7 @@
  66. if (bgrade == '\0')
  67. return TRUE;
  68. - if (! fsysdep_get_work_init (qsys, bgrade))
  69. + if (! fsysdep_get_work_init (qsys, bgrade, FALSE))
  70. return FALSE;
  71. while (TRUE)
  72. @@ -670,7 +670,8 @@
  73. fhangup = FALSE;
  74. if (qdaemon->fhangup_requested
  75. - && qTsend == NULL)
  76. + && qTsend == NULL
  77. + && (qTreceive == NULL || qdaemon->cchans > 1))
  78. {
  79. /* The remote system has requested that we transfer
  80. control by sending CYM after receiving a file. */
  81. --- uucp-1.06.1.orig/uucico.c
  82. +++ uucp-1.06.1/uucico.c
  83. @@ -126,6 +126,9 @@
  84. struct sconnection *qconn;
  85. };
  86. +/* min. grade set on commandline */
  87. +static char cmdlgrade = '\0';
  88. +
  89. /* Local functions. */
  90. static void uusage P((void));
  91. @@ -176,6 +179,7 @@
  92. { "nodetach", no_argument, NULL, 'D' },
  93. { "loop", no_argument, NULL, 'e' },
  94. { "force", no_argument, NULL, 'f'},
  95. + { "grade", required_argument, NULL, 'g'},
  96. { "stdin", required_argument, NULL, 'i' },
  97. { "prompt", no_argument, NULL, 'l' },
  98. { "port", required_argument, NULL, 'p' },
  99. @@ -250,9 +254,9 @@
  100. ++zProgram;
  101. #if COHERENT_C_OPTION
  102. - zopts = "c:CDefi:I:lp:qr:s:S:u:x:X:vwz";
  103. + zopts = "c:CDefg:i:I:lp:qr:s:S:u:x:X:vwz";
  104. #else
  105. - zopts = "cCDefi:I:lp:qr:s:S:u:x:X:vwz";
  106. + zopts = "cCDefg:i:I:lp:qr:s:S:u:x:X:vwz";
  107. #endif
  108. while ((iopt = getopt_long (argc, argv, zopts,
  109. @@ -293,6 +297,14 @@
  110. failed call. */
  111. fforce = TRUE;
  112. break;
  113. +
  114. + case 'g':
  115. + /* Force a grade */
  116. + if (isalpha(optarg[0]))
  117. + cmdlgrade = optarg[0];
  118. + else
  119. + fprintf (stderr, "%s: invalid grade \n", zProgram);
  120. + break;
  121. case 'i':
  122. /* Type of port to use for standard input. Only TLI is
  123. @@ -794,6 +806,7 @@
  124. printf ("Usage: %s [options]\n", zProgram);
  125. printf (" -s,-S,--system system: Call system (-S implies -f)\n");
  126. printf (" -f,--force: Force call despite system status\n");
  127. + printf (" -g,--grade: limit outgoing call to a given grade\n");
  128. printf (" -r state: 1 for master, 0 for slave (default)\n");
  129. printf (" --master: Act as master\n");
  130. printf (" --slave: Act as slave (default)\n");
  131. @@ -940,6 +953,9 @@
  132. if (! qsys->uuconf_fcall || qsys->uuconf_qtimegrade == NULL)
  133. continue;
  134. + if (qport && strcmp (qsys->uuconf_zport,qport->uuconf_zname))
  135. + continue;
  136. +
  137. fnevertime = FALSE;
  138. /* Make sure this is a legal time to call. */
  139. @@ -1331,12 +1347,18 @@
  140. boolean fret;
  141. /* Determine the grade we should request of the other system. A
  142. - '\0' means that no restrictions have been made. */
  143. - if (! ftimespan_match (qsys->uuconf_qcalltimegrade, &ival,
  144. - (int *) NULL))
  145. - bgrade = '\0';
  146. + '\0' means that no restrictions have been made.
  147. + If a grade is set on the command line, the calltimegrade-value
  148. + is overwritten. */
  149. +
  150. + if (cmdlgrade != '\0')
  151. + bgrade = cmdlgrade;
  152. else
  153. - bgrade = (char) ival;
  154. + if (! ftimespan_match (qsys->uuconf_qcalltimegrade, &ival,
  155. + (int *) NULL))
  156. + bgrade = '\0';
  157. + else
  158. + bgrade = (char) ival;
  159. /* Determine the name we will call ourselves. */
  160. if (qsys->uuconf_zlocalname != NULL)
  161. --- uucp-1.06.1.orig/uustat.c
  162. +++ uucp-1.06.1/uustat.c
  163. @@ -933,7 +933,7 @@
  164. {
  165. boolean fret;
  166. - if (! fsysdep_get_work_init (qsys, UUCONF_GRADE_LOW))
  167. + if (! fsysdep_get_work_init (qsys, UUCONF_GRADE_LOW, TRUE))
  168. return FALSE;
  169. while (TRUE)
  170. @@ -2166,7 +2166,7 @@
  171. char *zid;
  172. boolean fret;
  173. - if (! fsysdep_get_work_init (qsys, UUCONF_GRADE_LOW))
  174. + if (! fsysdep_get_work_init (qsys, UUCONF_GRADE_LOW, TRUE))
  175. return FALSE;
  176. cwork = 0;
  177. --- uucp-1.06.1.orig/uuxqt.c
  178. +++ uucp-1.06.1/uuxqt.c
  179. @@ -928,6 +928,44 @@
  180. don't permit multiple arguments. */
  181. for (i = 1; azQargs[i] != NULL; i++)
  182. {
  183. + if (azQargs[i][0] == '-' && azQargs[i][1] == '-')
  184. + {
  185. + char *zopts = azQargs[i] + 2;
  186. +
  187. + /* The -g, -n, and -s options take an argument. */
  188. + if (!strncmp(zopts, "grade", 5) && zopts[5] != '=')
  189. + {
  190. + if (azQargs[i+1] != NULL)
  191. + ++i;
  192. + }
  193. + if (!(strncmp(zopts, "notify", 6)
  194. + && strncmp(zopts, "status", 6)) && zopts[6] != '=')
  195. + {
  196. + if (azQargs[i+1] != NULL)
  197. + ++i;
  198. + }
  199. +
  200. + /* The -I, -u and -x options are not permitted. */
  201. + if (!strncmp(zopts, "config", 6))
  202. + {
  203. + if (zopts[6] != '=' && azQargs[i+1] != NULL)
  204. + ++i;
  205. + azQargs[i] = zbufcpy ("--nouucico");
  206. + }
  207. + if (!strncmp(zopts, "user", 4))
  208. + {
  209. + if (zopts[4] != '=' && azQargs[i+1] != NULL)
  210. + ++i;
  211. + azQargs[i] = zbufcpy ("--nouucico");
  212. + }
  213. + if (!strncmp(zopts, "debug", 5))
  214. + {
  215. + if (zopts[5] != '=' && azQargs[i+1] != NULL)
  216. + ++i;
  217. + azQargs[i] = zbufcpy ("--nouucico");
  218. + }
  219. + }
  220. + else
  221. if (azQargs[i][0] == '-')
  222. {
  223. char *zopts;
  224. --- uucp-1.06.1.orig/unix/lock.c
  225. +++ uucp-1.06.1/unix/lock.c
  226. @@ -425,7 +425,9 @@
  227. {
  228. (void) close (o);
  229. o = -1;
  230. - (void) remove (zpath);
  231. + if (remove (zpath) < 0 && errno == EPERM)
  232. + break;
  233. + sleep(1);
  234. fret = TRUE;
  235. continue;
  236. }
  237. --- uucp-1.06.1.orig/unix/serial.c
  238. +++ uucp-1.06.1/unix/serial.c
  239. @@ -920,6 +920,12 @@
  240. #ifdef B115200
  241. { B115200, 115200 },
  242. #endif
  243. +#ifdef B230400
  244. + { B230400, 230400 },
  245. +#endif
  246. +#ifdef B460800
  247. + { B460800, 460800 },
  248. +#endif
  249. { B0, 0 }
  250. };
  251. @@ -2371,8 +2377,17 @@
  252. else
  253. csleepchars = MAX_INPUT - 10;
  254. +#ifndef BUG
  255. + if (q->ibaud) {
  256. + isleep = (int) (((long) csleepchars * 10000L) / q->ibaud);
  257. + isleep -= 10;
  258. + } else {
  259. + isleep = 1000; /* I hope, a second is right... */
  260. + }
  261. +#else
  262. isleep = (int) (((long) csleepchars * 10000L) / q->ibaud);
  263. isleep -= 10;
  264. +#endif
  265. if (isleep > 10)
  266. {
  267. @@ -2773,9 +2788,20 @@
  268. / baud bits/sec)
  269. * 10 bits/byte)
  270. */
  271. +#ifndef BUG
  272. + if (q->ibaud) {
  273. + stime.tv_sec = (long) 10240 / q->ibaud;
  274. + stime.tv_usec = ((((long) 1024000000 / q->ibaud) * (long) 10)
  275. + % (long) 1000000);
  276. + } else {
  277. + stime.tv_sec = 1;
  278. + stime.tv_usec = 0;
  279. + }
  280. +#else
  281. stime.tv_sec = (long) 10240 / q->ibaud;
  282. stime.tv_usec = ((((long) 1024000000 / q->ibaud) * (long) 10)
  283. % (long) 1000000);
  284. +#endif
  285. imask = 1 << q->o;
  286. if (imask == 0)
  287. @@ -2846,7 +2872,14 @@
  288. we don't need to use the catch stuff, since we know
  289. that HAVE_RESTARTABLE_SYSCALLS is 0. */
  290. usset_signal (SIGALRM, usalarm, TRUE, (boolean *) NULL);
  291. +#ifndef BUG
  292. + if (q->ibaud)
  293. + alarm ((int) ((long) 10240 / q->ibaud) + 1);
  294. + else
  295. + alarm (1);
  296. +#else
  297. alarm ((int) ((long) 10240 / q->ibaud) + 1);
  298. +#endif
  299. /* There is a race condition here: on a severely loaded
  300. system, we could get the alarm before we start the
  301. --- uucp-1.06.1.orig/unix/work.c
  302. +++ uucp-1.06.1/unix/work.c
  303. @@ -282,9 +282,10 @@
  304. #define CWORKFILES (10)
  305. boolean
  306. -fsysdep_get_work_init (qsys, bgrade)
  307. +fsysdep_get_work_init (qsys, bgrade, unlimited)
  308. const struct uuconf_system *qsys;
  309. int bgrade;
  310. + boolean unlimited;
  311. {
  312. char *zdir;
  313. DIR *qdir;
  314. @@ -398,7 +399,7 @@
  315. asSwork_files[cSwork_files].zfile = zname;
  316. asSwork_files[cSwork_files].bgrade = bfilegrade;
  317. ++cSwork_files;
  318. - if (cSwork_files - chad > COMMANDS_PER_SCAN)
  319. + if (!unlimited && (cSwork_files - chad > COMMANDS_PER_SCAN))
  320. break;
  321. }
  322. }