home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / sources / x / volume19 / Jetedit / patch02 < prev    next >
Encoding:
Text File  |  1993-04-28  |  12.4 KB  |  381 lines

  1. Newsgroups: comp.sources.x
  2. From: duane@blacks.jpl.nasa.gov (Duane Clark)
  3. Subject: v19i086:  Jetedit - A Motif text editor, Patch02
  4. Message-ID: <1993Apr21.190712.13330@sparky.imd.sterling.com>
  5. X-Md4-Signature: d8dbc2f3ea6615a02ee38e0de38b1722
  6. Date: Wed, 21 Apr 1993 19:07:12 GMT
  7. Approved: chris@sparky.imd.sterling.com
  8.  
  9. Submitted-by: duane@blacks.jpl.nasa.gov (Duane Clark)
  10. Posting-number: Volume 19, Issue 86
  11. Archive-name: Jetedit/patch02
  12. Environment: X11, OSF/Motif
  13. Patch-To: Jetedit: Volume 19, Issue 80-84
  14.  
  15.  This patch updates jetedit1.21 to jetedit1.22. See below to determine 
  16.  the current version. To apply:
  17.  1) Copy this file as "je122.sh" to the directory containing the source
  18.   for jetedit.
  19.  2) Delete all this stuff down to the "cut here" line.
  20.  3) Type "sh je122.sh". This will create the patch file je122 and a copy
  21.   of these notes as NOTES122.
  22.  4) Type "patch < je122".
  23.  5) Recompile.
  24.  
  25.  You can determine the current version of jetedit by seeing if the file
  26.  patchlevel.h is included in the directory with the source. If it is, 
  27.  you have at least version 1.2. If not, you will have to get version 1.2
  28.  off the archives, or email me - duane@blacks.jpl.nasa.gov.
  29.  
  30.  Compare the contents of patchlevel.h to the following lines:
  31.  #define PATCHLEVEL 0    - Indicates jetedit1.2
  32.  #define PATCHLEVEL 1    - Indicates jetedit1.21
  33.  Beginning in version 1.22, patchlevel.h contains the line:
  34.  #define VERSION n.nn
  35.  
  36.  Changes in this version:
  37.  
  38.  In version 1.21, I neglected to credit a contributor, and no I don't
  39.  know why he capitalizes the last letter of his first name.
  40.  DaviD W. Sanderson (dws@ssec.wisc.edu)
  41.         "The Noah Webster of smileys is David Sanderson"
  42.                 - The Wall Street Journal, 15 Sep 1992
  43.  He suggested that perhaps I should be using <unistd.h> rather than 
  44.  <sys/unistd.h>.  He also did some fixes on my man page, on which he has
  45.  in the past done considerable work.  The corrected version is available
  46.  on request from duane@blacks.jpl.nasa.gov.
  47.  
  48.  Martin Wunderli <wunderli@inf.ethz.ch>
  49.  Pointed out a bug in the use of mktemp, which caused a crash on some 
  50.  systems anytime an attempt was made to save a file. I also added a
  51.  save failure warning dialog.
  52.  
  53.  I added the ability to remove the regular expressions code with a
  54.  define in the makefile, since several people were getting undefined
  55.  externals ("compile" and "step") and didn't want to figure out 
  56.  what library they needed. To disable the regular expressions, add the 
  57.  compile flag "-DNOREGEXP" to your makefile or Imakefile.
  58.  
  59.  
  60.  
  61. #---------------------------------- cut here ----------------------------------
  62. # This is a shell archive.  Remove anything before this line,
  63. # then unpack it by saving it in a file and typing "sh file".
  64. #
  65. # Wrapped by Duane Clark <duane@underdog> on Sun Apr 18 19:04:45 1993
  66. #
  67. # This archive contains:
  68. #    je122        NOTES122    
  69. #
  70. # Error checking via wc(1) will be performed.
  71. # Error checking via sum(1) will be performed.
  72.  
  73. LANG=""; export LANG
  74. PATH=/bin:/usr/bin:$PATH; export PATH
  75.  
  76. if sum -r </dev/null >/dev/null 2>&1
  77. then
  78.     sumopt='-r'
  79. else
  80.     sumopt=''
  81. fi
  82.  
  83. echo x - je122
  84. cat >je122 <<'@EOF'
  85. *** ../xm1.21/patchlevel.h    Sat Apr 17 17:54:28 1993
  86. --- patchlevel.h    Sat Apr 17 18:17:33 1993
  87. ***************
  88. *** 1 ****
  89. ! #define PATCHLEVEL 1
  90. --- 1,2 ----
  91. ! #define PATCHLEVEL 2
  92. ! #define VERSION 1.22
  93. *** ../xm1.21/xme.h    Sat Apr 17 17:54:29 1993
  94. --- xme.h    Sun Apr 18 17:14:52 1993
  95. ***************
  96. *** 112,117 ****
  97. --- 112,118 ----
  98.   WHERE Widget new_warning;        /* save changes warning dialog        */
  99.   WHERE Widget file_exists_dialog;    /* save duplicate file warning dialog    */
  100.   WHERE Widget save_as_dialog;        /* save as prompt dialog         */
  101. + WHERE Widget save_warning;        /* failed save warning dialog        */
  102.   WHERE Widget exists_as_dialog;        /* saveas duplicate file warning dialog    */
  103.   WHERE Widget file_mode_dialog;        /* no write permission dialog        */
  104.   WHERE Widget refused_dialog;        /* file access denied dialog        */
  105. *** ../xm1.21/xmedialg.c    Sat Apr 17 17:54:30 1993
  106. --- xmedialg.c    Sun Apr 18 17:47:34 1993
  107. ***************
  108. *** 23,28 ****
  109. --- 23,29 ----
  110.   #define DIALOG_F_MODE        312
  111.   #define DIALOG_EXISTS_AS    313
  112.   #define DIALOG_PREF        314
  113. + #define DIALOG_SWARNING        315
  114.   
  115.   extern char warningBits[];
  116.   
  117. ***************
  118. *** 257,265 ****
  119.           SaveFile();
  120.           break;  
  121.       
  122. -     case DIALOG_F_MODE:
  123. -         break;
  124. -     
  125.       case DIALOG_GOTO:
  126.           {
  127.           XmSelectionBoxCallbackStruct *scb =
  128. --- 258,263 ----
  129. ***************
  130. *** 271,278 ****
  131.           }
  132.           break;
  133.   
  134.       case DIALOG_HELP:
  135. !         /* no help at this time */
  136.           break;
  137.   
  138.       default:
  139. --- 269,277 ----
  140.           }
  141.           break;
  142.   
  143. +     case DIALOG_F_MODE:
  144.       case DIALOG_HELP:
  145. !     case DIALOG_SWARNING:
  146.           break;
  147.   
  148.       default:
  149. ***************
  150. *** 521,526 ****
  151. --- 520,545 ----
  152.       XtAddCallback (save_as_dialog, XmNokCallback,
  153.              (XtCallbackProc)DialogAcceptCB, (XtPointer)DIALOG_SAVE_AS);
  154.       button = XmSelectionBoxGetChild (save_as_dialog, XmDIALOG_HELP_BUTTON);
  155. +     XtUnmanageChild (button);
  156. +     ac = 0;
  157. +     XtSetArg(al[ac], XmNmessageString, XmStringCreateLtoR
  158. +            ("Unable to Save File!", charset));  ac++;
  159. +     XtSetArg(al[ac], XmNokLabelString,
  160. +          XmStringCreateLtoR("Bummer!", charset)); ac++;
  161. +     XtSetArg(al[ac], XmNdialogStyle, XmDIALOG_APPLICATION_MODAL); ac++;
  162. + #ifdef HARDCODE
  163. +     XtSetArg (al[ac], XmNtextFontList, fontlist);  ac++;
  164. + #endif
  165. +     XtSetArg (al[ac], XmNdialogTitle, 
  166. +         XmStringCreateLtoR("Save Warning", charset));  ac++;
  167. +     save_warning = XmCreateWarningDialog(menu_bar,
  168. +            "save_warning", al, ac);
  169. +     XtAddCallback (save_warning, XmNokCallback,
  170. +             (XtCallbackProc) DialogAcceptCB, (XtPointer) DIALOG_SWARNING);
  171. +     button = XmMessageBoxGetChild (save_warning, XmDIALOG_HELP_BUTTON);
  172. +     XtUnmanageChild (button);
  173. +     button = XmMessageBoxGetChild (save_warning, XmDIALOG_CANCEL_BUTTON);
  174.       XtUnmanageChild (button);
  175.   
  176.       ac = 0;
  177. *** ../xm1.21/xmefile.c    Sat Apr 17 17:54:31 1993
  178. --- xmefile.c    Sun Apr 18 17:45:16 1993
  179. ***************
  180. *** 99,104 ****
  181. --- 99,105 ----
  182.       char    pathname[60];
  183.       Arg     al[1];
  184.       unsigned int theLength;
  185. +     char    *tmpmask = "jeXXXXXX";
  186.       
  187.       sprintf (message_string, " Saved:  %s", thefile);
  188.       
  189. ***************
  190. *** 114,125 ****
  191.       }
  192.       
  193.       /* Create a temporary file name by changing /users/user/file_name
  194. !        to /users/user/xmeditXXXXXX. The result is in pathname. */
  195.       strcpy (pathname, thefile);
  196.       if ((tempname = strrchr (pathname, '/')) == NULL)
  197.           tempname = pathname;
  198.       else tempname = (char *)((long)tempname + 1);
  199. !     strcpy(tempname, mktemp("xmeditXXXXXX"));
  200.       
  201.       if ((tfd = open(pathname, O_WRONLY | O_CREAT, file_mode)) == -1) {
  202.           strcat (message_string, 
  203. --- 115,136 ----
  204.       }
  205.       
  206.       /* Create a temporary file name by changing /users/user/file_name
  207. !        to /users/user/jeXXXXXX. The result is in pathname. */
  208.       strcpy (pathname, thefile);
  209.       if ((tempname = strrchr (pathname, '/')) == NULL)
  210.           tempname = pathname;
  211.       else tempname = (char *)((long)tempname + 1);
  212. !     strcpy(tmpmask, "jeXXXXXX");
  213. !     if (!mktemp(tmpmask)) {
  214. !         strcat (message_string, 
  215. !             "   \7Warning: unable to create temp file %s.", pathname);
  216. !         XtSetArg(al[0], XmNlabelString, 
  217. !             XmStringCreateLtoR(message_string, charset));
  218. !         XtSetValues(message, al, 1);
  219. !         XtManageChild(save_warning);
  220. !         return(False);;
  221. !     }
  222. !     strcpy(tempname, tmpmask);
  223.       
  224.       if ((tfd = open(pathname, O_WRONLY | O_CREAT, file_mode)) == -1) {
  225.           strcat (message_string, 
  226. ***************
  227. *** 127,132 ****
  228. --- 138,144 ----
  229.           XtSetArg(al[0], XmNlabelString, 
  230.               XmStringCreateLtoR(message_string, charset));
  231.           XtSetValues(message, al, 1);
  232. +         XtManageChild(save_warning);
  233.           return(False);;
  234.       }
  235.       
  236. ***************
  237. *** 153,159 ****
  238.       if (rename(pathname, thefile) == 0) {
  239.           file_saved = True;
  240.       } else {
  241. !         strcat (message_string, "   \7Warning: unable to save file.");
  242.           XtSetArg(al[0], XmNlabelString, 
  243.               XmStringCreateLtoR(message_string, charset));
  244.           XtSetValues(message, al, 1);
  245. --- 165,172 ----
  246.       if (rename(pathname, thefile) == 0) {
  247.           file_saved = True;
  248.       } else {
  249. !         strcat (message_string, "   \7Warning: unable to rename file.");
  250. !         fprintf(stderr, "\n  Warning: File saved as %s\n", pathname);
  251.           XtSetArg(al[0], XmNlabelString, 
  252.               XmStringCreateLtoR(message_string, charset));
  253.           XtSetValues(message, al, 1);
  254. *** ../xm1.21/xmespec.c    Sat Apr 17 17:54:34 1993
  255. --- xmespec.c    Sat Apr 17 18:17:25 1993
  256. ***************
  257. *** 21,26 ****
  258. --- 21,27 ----
  259.   char    *seg_string;
  260.   char    *find_string;
  261.   #define EXPSIZE 4096
  262. + #ifndef NOREGEXP
  263.   #define INIT register char *sp = find_string; 
  264.   #define GETC() (*sp++)
  265.   #define PEEKC() (*sp)
  266. ***************
  267. *** 28,33 ****
  268. --- 29,35 ----
  269.   #define RETURN(c) return;
  270.   #define ERROR(c) fprintf (stderr, "\7")
  271.   #include <regexp.h>
  272. + #endif
  273.   
  274.   /* bits for exclamation point in dialog */
  275.   char warningBits[] = {
  276. ***************
  277. *** 249,254 ****
  278. --- 251,260 ----
  279.           
  280.       XtSetArg (al[0], XmNset, ®_exp);
  281.       XtGetValues (regular_exp, al, 1);
  282. + #ifdef NOREGEXP
  283. +     if (0) {
  284. +     }
  285. + #else
  286.       if (reg_exp) {
  287.           compile (find_string, expbuf, &expbuf[EXPSIZE], '\0');     
  288.           if (step (seg_string, expbuf)) {
  289. ***************
  290. *** 268,273 ****
  291. --- 274,280 ----
  292.               return (False);
  293.           }
  294.       }
  295. + #endif
  296.       else {
  297.           if ((found = strstr (seg_string, find_string)) != NULL) {
  298.               cursorPos = (XmTextPosition)((long)found + (long)cursorPos - (long)seg_string);
  299. @EOF
  300. set `sum $sumopt <je122`; if test $1 -ne 45395
  301. then
  302.     echo ERROR: je122 checksum is $1 should be 45395
  303. fi
  304. set `wc -lwc <je122`
  305. if test $1$2$3 != 2157456748
  306. then
  307.     echo ERROR: wc results of je122 are $* should be 215 745 6748
  308. fi
  309.  
  310. chmod 644 je122
  311.  
  312. echo x - NOTES122
  313. cat >NOTES122 <<'@EOF'
  314. This patch updates jetedit1.21 to jetedit1.22. See below to determine 
  315. the current version. To apply:
  316. 1) Copy this file as "je122.sh" to the directory containing the source
  317.  for jetedit.
  318. 2) Delete all this stuff down to the "cut here" line.
  319. 3) Type "sh je122.sh". This will create the patch file je122 and a copy
  320.  of these notes as NOTES122.
  321. 4) Type "patch < je122".
  322. 5) Recompile.
  323.  
  324. You can determine the current version of jetedit by seeing if the file
  325. patchlevel.h is included in the directory with the source. If it is, 
  326. you have at least version 1.2. If not, you will have to get version 1.2
  327. off the archives, or email me - duane@blacks.jpl.nasa.gov.
  328.  
  329. Compare the contents of patchlevel.h to the following lines:
  330. #define PATCHLEVEL 0    - Indicates jetedit1.2
  331. #define PATCHLEVEL 1    - Indicates jetedit1.21
  332. Beginning in version 1.22, patchlevel.h contains the line:
  333. #define VERSION n.nn
  334.  
  335. Changes in this version:
  336.  
  337. In version 1.21, I neglected to credit a contributor, and no I don't
  338. know why he capitalizes the last letter of his first name.
  339. DaviD W. Sanderson (dws@ssec.wisc.edu)
  340.         "The Noah Webster of smileys is David Sanderson"
  341.                 - The Wall Street Journal, 15 Sep 1992
  342. He suggested that perhaps I should be using <unistd.h> rather than 
  343. <sys/unistd.h>.  He also did some fixes on my man page, on which he has
  344. in the past done considerable work.  The corrected version is available
  345. on request from duane@blacks.jpl.nasa.gov.
  346.  
  347. Martin Wunderli <wunderli@inf.ethz.ch>
  348. Pointed out a bug in the use of mktemp, which caused a crash on some 
  349. systems anytime an attempt was made to save a file. I also added a
  350. save failure warning dialog.
  351.  
  352. I added the ability to remove the regular expressions code with a
  353. define in the makefile, since several people were getting undefined
  354. externals ("compile" and "step") and didn't want to figure out 
  355. what library they needed. To disable the regular expressions, add the 
  356. compile flag "-DNOREGEXP" to your makefile or Imakefile.
  357.  
  358.  
  359. @EOF
  360. set `sum $sumopt <NOTES122`; if test $1 -ne 27763
  361. then
  362.     echo ERROR: NOTES122 checksum is $1 should be 27763
  363. fi
  364. set `wc -lwc <NOTES122`
  365. if test $1$2$3 != 453211988
  366. then
  367.     echo ERROR: wc results of NOTES122 are $* should be 45 321 1988
  368. fi
  369.  
  370. chmod 644 NOTES122
  371.  
  372. exit 0
  373.  
  374. exit 0 # Just in case...
  375. -- 
  376.   // chris@IMD.Sterling.COM            | Send comp.sources.x submissions to:
  377. \X/  Amiga - The only way to fly!      |
  378.  "It's intuitively obvious to the most |    sources-x@imd.sterling.com
  379.   casual observer..."                  |
  380.