argv@island.uu.net (Dan Heller) (08/18/89)
Submitted-by: ames!mailrus!sharkey!oshima!chang (Peter Chang) Posting-number: Volume 4, Issue 94 Archive-name: xmtool/patch1 Patch-To: Volume 4, Issue 36 (June 30 1989) #!/bin/sh # Patch for xmtool.v2 # To extract, remove the header and type "sh filename" if `test ! -s ./README.v2` then echo "writing ./README.v2" cat > ./README.v2 << '\End\Of\File\' Features added: 1. Added resource XtNinput for shell widgets. 2. Added more functions to the status command. 3. Automatically delete a message after it was saved. 4. Handle the new line character that user inserts. Send comments, flames, etc to chang@edsews.eds.com or Peter Chang Electronic Data Systems Corporation 750 Tower Drive Troy, MI 48007-7019 \End\Of\File\ else echo "will not overwrite ./README.v2" fi if `test ! -s ./xmtool.c.v2.patch` then echo "writing ./xmtool.c.v2.patch" cat > ./xmtool.c.v2.patch << '\End\Of\File\' *** xmtool.c.old Mon Jul 3 14:07:18 1989 --- xmtool.c Thu Aug 17 11:12:16 1989 *************** *** 248,254 **** XtSetArg( arg[2], XtNfromVert, viewport3); XtSetArg( arg[3], XtNwidth, 990); XtSetArg( arg[4], XtNheight, 250); ! XtSetArg( arg[5], XtNbackground, stringToPixel(outer,"yellow")); textw1 = XtCreateManagedWidget( NULL, asciiDiskWidgetClass, boxtextw1, arg, 6 ); } void selectf() --- 248,254 ---- XtSetArg( arg[2], XtNfromVert, viewport3); XtSetArg( arg[3], XtNwidth, 990); XtSetArg( arg[4], XtNheight, 250); ! XtSetArg( arg[5], XtNbackground, stringToPixel(outer,"lightBlue")); textw1 = XtCreateManagedWidget( NULL, asciiDiskWidgetClass, boxtextw1, arg, 6 ); } void selectf() *************** *** 879,884 **** --- 879,885 ---- int i, j, fd, fp, len, num; char msg[80]; char text[400], dirname[40]; + delBlank(); bzero(dirname, 40); parsefname(dirname); if ((i = stat(dirname, &stbuf)) != 0) { *************** *** 904,909 **** --- 905,919 ---- close(fd); return; } + /* Check to see whether it is a valid file name */ + if ((fd = open(filename, 2)) < 0) { + if ((fd = creat(filename, 0700)) < 0) { + fprintf(stderr, "can't save to the file %s\n", filename); + return; + } else + close(fd); + } else + close(fd); if ((fp = creat(logf3, 0700)) < 0){ perror("open problem"); exit(-1); *************** *** 938,943 **** --- 948,954 ---- } close(fp); system(savecmd); + delete(); } void rplyf() { *************** *** 1101,1106 **** --- 1112,1118 ---- XtSetArg(arg[0], XtNwidth, 400); XtSetArg(arg[1], XtNheight, 125); + XtSetArg(arg[2], XtNinput, True); tolevel = XtCreatePopupShell("Subject Cc",applicationShellWidgetClass,toplevel, arg, 2); XtSetArg(arg[0], XtNwidth, 400); *************** *** 1148,1153 **** --- 1160,1166 ---- { char fname[38], fname1[45]; int i, fd; + delBlank(); bzero(mailtcmd, 80); if (filename[0] == '-' && filename[1] == '>'){ bzero(fname, 38); *************** *** 1247,1253 **** --- 1260,1353 ---- { /* status for the commands save, reply to sender and reply to all*/ Arg arg[10]; + char text[400]; + int i, j, len, num, fd; quithlp1(); + if ((fd = open(logf4, 1)) < 0) { + perror("statusMailf: open problem"); + quitOnCond(); + exit(-1); + } + if (lseek(fd, 0L, 2) < 0){ + perror("statusMailf: lseek problem"); + quitOnCond(); + exit(-1); + } + if (write(fd, "Range and selected multiple messages information:\n", 50) != 50) { + perror("statusMailf: write problem"); + exit(-1); + } + if (delete_sw) { + if (lseek(fd, 0L, 2) < 0){ + perror("statusMailf: lseek problem"); + quitOnCond(); + exit(-1); + } + if (write(fd, "Range:\n", 6) != 6) { + perror("statusMailf: write problem"); + exit(-1); + } + bzero(text, 20); + sprintf(text, "%d - ", count); + write(fd, text, strlen(text)); + bzero(text, 20); + sprintf(text, "%d\n", countnew); + write(fd, text, strlen(text)); + } else { + if (lseek(fd, 0L, 2) < 0){ + perror("statusMailf: lseek problem"); + quitOnCond(); + exit(-1); + } + if (write(fd, "No range\n", 9) != 9) { + perror("statusMailf: write problem"); + exit(-1); + } + } + if (selectflag) { + if (lseek(fd, 0L, 2) < 0){ + perror("statusMailf: lseek problem"); + quitOnCond(); + exit(-1); + } + if (write(fd, "Selected messages:\n", 19) != 19) { + perror("statusMailf: write problem"); + exit(-1); + } + num = selectflag / 15; + num++; + for (j=0; j < num; j++){ + bzero(text, 400); + sprintf(text, "%d", selectList[j*15]); + for (i = 1; i < umailmin(15,selectflag - j*15); i++){ + len = strlen(text); + sprintf(&text[len], " %d", selectList[i+j*15]); + } + len = strlen(text); + sprintf(&text[len], "\n"); + write(fd, text, strlen(text)); + } + } else { + if (lseek(fd, 0L, 2) < 0){ + perror("statusMailf: lseek problem"); + quitOnCond(); + exit(-1); + } + if (write(fd, "No selected multiple messages\n", 30) != 30) { + perror("statusMailf: write problem"); + exit(-1); + } + } + if (lseek(fd, 0L, 2) < 0){ + perror("statusMailf: lseek problem"); + quitOnCond(); + exit(-1); + } + if (write(fd, "End of range and selected multiple messages information\n", 56) != 56) { + perror("statusMailf: write problem"); + exit(-1); + } + close(fd); boxtextw1 = XtCreateManagedWidget(NULL, boxWidgetClass, viewport4, NULL, 0); XtSetArg( arg[0], XtNfile, logf4); XtSetArg( arg[1], XtNtextOptions, scrollVertical ); *************** *** 1256,1262 **** XtSetArg( arg[4], XtNy, y2); XtSetArg( arg[5], XtNwidth, 990); XtSetArg( arg[6], XtNheight, 250); ! XtSetArg( arg[7], XtNbackground, stringToPixel(outer,"yellow")); textw1 = XtCreateManagedWidget( NULL, asciiDiskWidgetClass, boxtextw1, arg, 8 ); } --- 1356,1362 ---- XtSetArg( arg[4], XtNy, y2); XtSetArg( arg[5], XtNwidth, 990); XtSetArg( arg[6], XtNheight, 250); ! XtSetArg( arg[7], XtNbackground, stringToPixel(outer,"lightBlue")); textw1 = XtCreateManagedWidget( NULL, asciiDiskWidgetClass, boxtextw1, arg, 8 ); } *************** *** 1388,1393 **** --- 1488,1494 ---- { static XtCallbackRec callback[2]; Arg arg[10]; + int fd; bzero(mailutildir, 80); if (getenv("XMTOOLRESRC") != NULL) strcpy(mailutildir, getenv("XMTOOLRESRC")); *************** *** 1408,1415 **** perror("Can't change mode"); exit(-1); } ! toplevel = XtInitialize( NULL, "xmtool", options, XtNumber(options), &argc, argv); appcontxt = XtCreateApplicationContext(); XtSetArg( arg[0], XtNwidth, 1000 ); --- 1509,1523 ---- perror("Can't change mode"); exit(-1); } ! if ((fd = creat(logf4, 0700)) < 0) { ! perror("createname: can't create file"); ! exit(-1); ! } ! close(fd); ! toplevel = XtInitialize( argv[0], "XMtool", options, XtNumber(options), &argc, argv); + XtSetArg ( arg[0], XtNinput, True); + XtSetValues( toplevel, arg, 1); appcontxt = XtCreateApplicationContext(); XtSetArg( arg[0], XtNwidth, 1000 ); *************** *** 1640,1646 **** XtSetArg( arg[1], XtNtextOptions, scrollVertical ); XtSetArg( arg[2], XtNheight, 250); XtSetArg( arg[3], XtNwidth, 990); ! XtSetArg( arg[4], XtNbackground, stringToPixel(outer,"yellow")); textw1 = XtCreateManagedWidget( NULL, asciiDiskWidgetClass, boxtextw1, arg, 5 ); XtSetArg(arg[0], XtNx, &x2); XtSetArg(arg[1], XtNy, &y2); --- 1748,1754 ---- XtSetArg( arg[1], XtNtextOptions, scrollVertical ); XtSetArg( arg[2], XtNheight, 250); XtSetArg( arg[3], XtNwidth, 990); ! XtSetArg( arg[4], XtNbackground, stringToPixel(outer,"lightBlue")); textw1 = XtCreateManagedWidget( NULL, asciiDiskWidgetClass, boxtextw1, arg, 5 ); XtSetArg(arg[0], XtNx, &x2); XtSetArg(arg[1], XtNy, &y2); *************** *** 1910,1913 **** --- 2018,2039 ---- { if (i < j) return i; else return j; + } + delBlank() + { + int i; + char filename1[110]; + bzero(filename1, 110); + strncpy(filename1, filename, 110); + bzero(filename, 110); + i = 0; + while ((filename1[i] != '\0') && (filename1[i] != '\n') && (i < 110)){ + filename[i] = filename1[i]; + i++; + } + if (i == 110){ + fprintf(stderr, "save: index i of filename reaches 110\n"); + quitOnCond(); + exit(-1); + } } \End\Of\File\ else echo "will not overwrite ./xmtool.c.v2.patch" fi if `test ! -s ./statushlp` then echo "writing ./statushlp" cat > ./statushlp << '\End\Of\File\' --------------------------------------------------------------------------------------------- |001|001|plus|minus|range|set counter|view|delete|save| | --------------------------------------------------------------------------------------------- ------------------------------------------------------------------------------------------------------- |001|incr|select|reply to sender|reply to all|edit|create|mail to list|status|clear status|update|help| ------------------------------------------------------------------------------------------------------- ^ |---status box status: read the status file that contains possible outputs after you select one of the three boxes: save, reply to sender, reply to all. Also show the range of messages and list of selected messages. \End\Of\File\ else echo "will not overwrite ./statushlp" fi