home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / sources / x / volume4 / xmtool / patch1 < prev    next >
Encoding:
Internet Message Format  |  1989-08-18  |  10.2 KB

  1. Path: uunet!island!argv
  2. From: argv@island.uu.net (Dan Heller)
  3. Newsgroups: comp.sources.x
  4. Subject: v04i094: xmtool, Patch1
  5. Message-ID: <1003@island.uu.net>
  6. Date: 18 Aug 89 03:02:16 GMT
  7. Organization: Island Graphics, Marin County, California
  8. Lines: 329
  9. Approved: island!argv@sun.com
  10.  
  11. Submitted-by: ames!mailrus!sharkey!oshima!chang (Peter Chang)
  12. Posting-number: Volume 4, Issue 94
  13. Archive-name: xmtool/patch1
  14. Patch-To: Volume 4, Issue 36 (June 30 1989)
  15.  
  16. #!/bin/sh
  17. # Patch for xmtool.v2
  18. # To extract, remove the header and type "sh filename"
  19. if `test ! -s ./README.v2`
  20. then
  21. echo "writing ./README.v2"
  22. cat > ./README.v2 << '\End\Of\File\'
  23. Features added:
  24.  
  25. 1. Added resource XtNinput for shell widgets.
  26.  
  27. 2. Added more functions to the status command.
  28.  
  29. 3. Automatically delete a message after it was saved.
  30.  
  31. 4. Handle the new line character that user inserts.
  32.  
  33. Send comments, flames, etc to chang@edsews.eds.com or
  34.  
  35. Peter Chang
  36. Electronic Data Systems Corporation
  37. 750 Tower Drive
  38. Troy, MI 48007-7019
  39. \End\Of\File\
  40. else
  41.   echo "will not overwrite ./README.v2"
  42. fi
  43. if `test ! -s ./xmtool.c.v2.patch`
  44. then
  45. echo "writing ./xmtool.c.v2.patch"
  46. cat > ./xmtool.c.v2.patch << '\End\Of\File\'
  47. *** xmtool.c.old    Mon Jul  3 14:07:18 1989
  48. --- xmtool.c    Thu Aug 17 11:12:16 1989
  49. ***************
  50. *** 248,254 ****
  51.       XtSetArg( arg[2], XtNfromVert, viewport3);
  52.       XtSetArg( arg[3], XtNwidth, 990);
  53.       XtSetArg( arg[4], XtNheight, 250);
  54. !     XtSetArg( arg[5], XtNbackground, stringToPixel(outer,"yellow"));
  55.       textw1 = XtCreateManagedWidget( NULL, asciiDiskWidgetClass, boxtextw1, arg, 6 );
  56.   }
  57.   void selectf()
  58. --- 248,254 ----
  59.       XtSetArg( arg[2], XtNfromVert, viewport3);
  60.       XtSetArg( arg[3], XtNwidth, 990);
  61.       XtSetArg( arg[4], XtNheight, 250);
  62. !     XtSetArg( arg[5], XtNbackground, stringToPixel(outer,"lightBlue"));
  63.       textw1 = XtCreateManagedWidget( NULL, asciiDiskWidgetClass, boxtextw1, arg, 6 );
  64.   }
  65.   void selectf()
  66. ***************
  67. *** 879,884 ****
  68. --- 879,885 ----
  69.       int i, j, fd, fp, len, num;
  70.       char msg[80];
  71.       char text[400], dirname[40];
  72. +     delBlank();
  73.       bzero(dirname, 40);
  74.       parsefname(dirname);
  75.       if ((i = stat(dirname, &stbuf)) != 0) {
  76. ***************
  77. *** 904,909 ****
  78. --- 905,919 ----
  79.         close(fd);
  80.         return;
  81.       }
  82. +     /* Check to see whether it is a valid file name */
  83. +     if ((fd = open(filename, 2)) < 0) {
  84. +        if ((fd = creat(filename, 0700)) < 0) {
  85. +       fprintf(stderr, "can't save to the file %s\n", filename);
  86. +       return;
  87. +        } else
  88. +           close(fd);
  89. +     } else
  90. +        close(fd);
  91.       if ((fp = creat(logf3, 0700)) < 0){
  92.          perror("open problem");
  93.          exit(-1);
  94. ***************
  95. *** 938,943 ****
  96. --- 948,954 ----
  97.       }
  98.       close(fp);
  99.       system(savecmd);
  100. +     delete();
  101.   }
  102.   void rplyf()
  103.   {
  104. ***************
  105. *** 1101,1106 ****
  106. --- 1112,1118 ----
  107.   
  108.       XtSetArg(arg[0], XtNwidth, 400);
  109.       XtSetArg(arg[1], XtNheight, 125);
  110. +     XtSetArg(arg[2], XtNinput, True);
  111.       tolevel = XtCreatePopupShell("Subject Cc",applicationShellWidgetClass,toplevel,
  112.           arg, 2);
  113.       XtSetArg(arg[0], XtNwidth, 400);
  114. ***************
  115. *** 1148,1153 ****
  116. --- 1160,1166 ----
  117.   {
  118.       char fname[38], fname1[45];
  119.       int i, fd;
  120. +     delBlank();
  121.       bzero(mailtcmd, 80);
  122.       if (filename[0] == '-' && filename[1] == '>'){
  123.          bzero(fname, 38);
  124. ***************
  125. *** 1247,1253 ****
  126. --- 1260,1353 ----
  127.   {
  128.   /* status for the commands save, reply to sender and reply to all*/
  129.       Arg arg[10];
  130. +     char text[400];
  131. +     int i, j, len, num, fd;
  132.       quithlp1();
  133. +     if ((fd = open(logf4, 1)) < 0) {
  134. +      perror("statusMailf: open problem");
  135. +      quitOnCond();
  136. +      exit(-1);
  137. +     }
  138. +     if (lseek(fd, 0L, 2) < 0){
  139. +      perror("statusMailf: lseek problem");
  140. +      quitOnCond();
  141. +      exit(-1);
  142. +     }
  143. +     if (write(fd, "Range and selected multiple messages information:\n", 50) != 50) {
  144. +      perror("statusMailf: write problem");
  145. +      exit(-1);
  146. +     }
  147. +     if (delete_sw) {
  148. +       if (lseek(fd, 0L, 2) < 0){
  149. +        perror("statusMailf: lseek problem");
  150. +        quitOnCond();
  151. +        exit(-1);
  152. +       }
  153. +       if (write(fd, "Range:\n", 6) != 6) {
  154. +        perror("statusMailf: write problem");
  155. +        exit(-1);
  156. +       }
  157. +       bzero(text, 20);
  158. +       sprintf(text, "%d - ", count);
  159. +       write(fd, text, strlen(text));
  160. +       bzero(text, 20);
  161. +       sprintf(text, "%d\n", countnew);
  162. +       write(fd, text, strlen(text));
  163. +     } else {
  164. +       if (lseek(fd, 0L, 2) < 0){
  165. +        perror("statusMailf: lseek problem");
  166. +        quitOnCond();
  167. +        exit(-1);
  168. +       }
  169. +       if (write(fd, "No range\n", 9) != 9) {
  170. +        perror("statusMailf: write problem");
  171. +        exit(-1);
  172. +       }
  173. +     }
  174. +     if (selectflag) {
  175. +       if (lseek(fd, 0L, 2) < 0){
  176. +        perror("statusMailf: lseek problem");
  177. +        quitOnCond();
  178. +        exit(-1);
  179. +       }
  180. +       if (write(fd, "Selected messages:\n", 19) != 19) {
  181. +        perror("statusMailf: write problem");
  182. +        exit(-1);
  183. +       }
  184. +       num = selectflag / 15;
  185. +       num++;
  186. +       for (j=0; j < num; j++){
  187. +        bzero(text, 400);
  188. +        sprintf(text, "%d", selectList[j*15]);
  189. +        for (i = 1; i <  umailmin(15,selectflag - j*15); i++){
  190. +         len = strlen(text);
  191. +         sprintf(&text[len], " %d", selectList[i+j*15]);
  192. +        }
  193. +        len = strlen(text);
  194. +        sprintf(&text[len], "\n");
  195. +        write(fd, text, strlen(text));
  196. +       }
  197. +     } else {
  198. +       if (lseek(fd, 0L, 2) < 0){
  199. +        perror("statusMailf: lseek problem");
  200. +        quitOnCond();
  201. +        exit(-1);
  202. +       }
  203. +       if (write(fd, "No selected multiple messages\n", 30) != 30) {
  204. +        perror("statusMailf: write problem");
  205. +        exit(-1);
  206. +       }
  207. +     }
  208. +     if (lseek(fd, 0L, 2) < 0){
  209. +      perror("statusMailf: lseek problem");
  210. +      quitOnCond();
  211. +      exit(-1);
  212. +     }
  213. +     if (write(fd, "End of range and selected multiple messages information\n", 56) != 56) {
  214. +      perror("statusMailf: write problem");
  215. +      exit(-1);
  216. +     }
  217. +     close(fd);
  218.       boxtextw1 = XtCreateManagedWidget(NULL, boxWidgetClass, viewport4, NULL, 0);
  219.       XtSetArg( arg[0], XtNfile, logf4);
  220.       XtSetArg( arg[1], XtNtextOptions, scrollVertical );
  221. ***************
  222. *** 1256,1262 ****
  223.       XtSetArg( arg[4], XtNy, y2);
  224.       XtSetArg( arg[5], XtNwidth, 990);
  225.       XtSetArg( arg[6], XtNheight, 250);
  226. !     XtSetArg( arg[7], XtNbackground, stringToPixel(outer,"yellow"));
  227.       textw1 = XtCreateManagedWidget( NULL, asciiDiskWidgetClass, boxtextw1, arg, 8 );
  228.   }
  229.   
  230. --- 1356,1362 ----
  231.       XtSetArg( arg[4], XtNy, y2);
  232.       XtSetArg( arg[5], XtNwidth, 990);
  233.       XtSetArg( arg[6], XtNheight, 250);
  234. !     XtSetArg( arg[7], XtNbackground, stringToPixel(outer,"lightBlue"));
  235.       textw1 = XtCreateManagedWidget( NULL, asciiDiskWidgetClass, boxtextw1, arg, 8 );
  236.   }
  237.   
  238. ***************
  239. *** 1388,1393 ****
  240. --- 1488,1494 ----
  241.   {
  242.       static XtCallbackRec callback[2];
  243.       Arg arg[10];
  244. +     int fd;
  245.       bzero(mailutildir, 80);
  246.       if (getenv("XMTOOLRESRC") != NULL)
  247.         strcpy(mailutildir, getenv("XMTOOLRESRC"));
  248. ***************
  249. *** 1408,1415 ****
  250.        perror("Can't change mode");
  251.        exit(-1);
  252.       }
  253. !     toplevel = XtInitialize( NULL, "xmtool", options, XtNumber(options),
  254.                    &argc, argv);
  255.   
  256.       appcontxt = XtCreateApplicationContext();
  257.       XtSetArg( arg[0], XtNwidth, 1000 );
  258. --- 1509,1523 ----
  259.        perror("Can't change mode");
  260.        exit(-1);
  261.       }
  262. !     if ((fd = creat(logf4, 0700)) < 0) {
  263. !      perror("createname: can't create file");
  264. !      exit(-1);
  265. !     }
  266. !     close(fd);
  267. !     toplevel = XtInitialize( argv[0], "XMtool", options, XtNumber(options),
  268.                    &argc, argv);
  269. +     XtSetArg ( arg[0], XtNinput, True);
  270. +     XtSetValues( toplevel, arg, 1);
  271.   
  272.       appcontxt = XtCreateApplicationContext();
  273.       XtSetArg( arg[0], XtNwidth, 1000 );
  274. ***************
  275. *** 1640,1646 ****
  276.       XtSetArg( arg[1], XtNtextOptions, scrollVertical );
  277.       XtSetArg( arg[2], XtNheight, 250);
  278.       XtSetArg( arg[3], XtNwidth, 990);
  279. !     XtSetArg( arg[4], XtNbackground, stringToPixel(outer,"yellow"));
  280.       textw1 = XtCreateManagedWidget( NULL, asciiDiskWidgetClass, boxtextw1, arg, 5 );
  281.       XtSetArg(arg[0], XtNx, &x2);
  282.       XtSetArg(arg[1], XtNy, &y2);
  283. --- 1748,1754 ----
  284.       XtSetArg( arg[1], XtNtextOptions, scrollVertical );
  285.       XtSetArg( arg[2], XtNheight, 250);
  286.       XtSetArg( arg[3], XtNwidth, 990);
  287. !     XtSetArg( arg[4], XtNbackground, stringToPixel(outer,"lightBlue"));
  288.       textw1 = XtCreateManagedWidget( NULL, asciiDiskWidgetClass, boxtextw1, arg, 5 );
  289.       XtSetArg(arg[0], XtNx, &x2);
  290.       XtSetArg(arg[1], XtNy, &y2);
  291. ***************
  292. *** 1910,1913 ****
  293. --- 2018,2039 ----
  294.   {
  295.       if (i < j) return i;
  296.       else return j;
  297. + }
  298. + delBlank()
  299. + {
  300. +     int i;
  301. +     char filename1[110];
  302. +     bzero(filename1, 110);
  303. +     strncpy(filename1, filename, 110);
  304. +     bzero(filename, 110);
  305. +     i = 0;
  306. +     while ((filename1[i] != '\0') && (filename1[i] != '\n') && (i < 110)){
  307. +       filename[i] = filename1[i];
  308. +       i++;
  309. +     }
  310. +     if (i == 110){
  311. +       fprintf(stderr, "save: index i of filename reaches 110\n");
  312. +       quitOnCond();
  313. +       exit(-1);
  314. +     }
  315.   }
  316. \End\Of\File\
  317. else
  318.   echo "will not overwrite ./xmtool.c.v2.patch"
  319. fi
  320. if `test ! -s ./statushlp`
  321. then
  322. echo "writing ./statushlp"
  323. cat > ./statushlp << '\End\Of\File\'
  324. ---------------------------------------------------------------------------------------------
  325. |001|001|plus|minus|range|set counter|view|delete|save|                                     | 
  326. ---------------------------------------------------------------------------------------------
  327. -------------------------------------------------------------------------------------------------------
  328. |001|incr|select|reply to sender|reply to all|edit|create|mail to list|status|clear status|update|help|
  329. -------------------------------------------------------------------------------------------------------
  330.                                                                          ^
  331.                                                                  |---status box
  332.  
  333. status: read the status file that contains possible outputs after you
  334.         select one of the three boxes: save, reply to sender, reply to all.
  335.     Also show the range of messages and list of selected messages.
  336. \End\Of\File\
  337. else
  338.   echo "will not overwrite ./statushlp"
  339. fi
  340.