lau@dsl.cis.upenn.edu (Yan Lau) (05/04/88)
In article <5060@cup.portal.com> Jinfu@cup.portal.com writes: > > >I need some help in using the DM pad editor (ce) with /usr/ucb/Mail. > > [shell script to invoke xdmc command deleted] >Jinfu@cup.portal.com Although I didn't think of using a shell script, I ran into the same problem when I wrote a simple program to open a window using pad calls. Sometimes it worked and sometimes it didn't. The problem is in case-sensitivity, Aegis doesn't recognize case whereas Unix does. The response from Apollo support was that this is a bug which should be fixed with SR10 which is to become more Unix-like. Yan. lau@wharton.upenn.edu
george@hyper.lap.upenn.edu (George Zipperlen) (05/05/88)
You CAN use the DM editor on files with upper case in the name, leading '.', etc. At least since SR9.5. My memory is vague with respect to SR9.2 and earlier, although I do recall problems with this at some point. You just have to quote the file name. There are problems with doing this from a shell script, unless you go through contortions like xdmc tdm; es 'ce @'' etc... On the off chance that someone will find it useful, I enclose a C program to invoke the DM editor. It is hereby placed in the public domain. It is provided asis, no warranty, etc. use as you see fit. I've tested it on the given problem - invoking DM editor from bezerkeley mail, and it worked for me. Disclaimer: we are running SR 9.7 now. ----CUT HERE--- /* dmedit: invoke display manager editor on file SYNTAX: dmedit path_name CODED: 4-May-1988 George Zipperlen NOTES: Sorry for the excess baggage with window parameters, font loading, etc. I wrote this program as a quick main around a function we already had. */ # define USAGE "path_name" # include "/sys/ins/base.ins.c" # include "/sys/ins/error.ins.c" # include "/sys/ins/ios.ins.c" # include "/sys/ins/pad.ins.c" # include <stdio.h> # include <ctype.h> # define null_str(s) (s[0] == '\0' ? 1 : 0) # define MAX_STRING_LEN 256 # define exit_ok 0 # define exit_error 1 # define exit_case_err 2 # define exit_list_err 3 typedef enum { read_mode, edit_mode, edit_wait_mode, list_mode, action_mode } file_mode_t; char * prog_name; void error_trace (msg) char msg[]; { fprintf (stderr, "\n%s: error in %s\n", prog_name, msg); } /* error_trace */ void error_check (msg, status) char msg[]; /* global inputs - prog_name */ status_$t status; { if (status.all != status_$ok) { error_trace (msg); error_$print (status); } /* if status ! ok */ } /* error_check */ void exit_prog (exit_flag, msg) int exit_flag; char msg[]; { if (exit_flag != exit_ok) { if (exit_flag == exit_case_err) fprintf (stderr, "\n%s: case_selector error in\n %s\n", prog_name, msg); else if (exit_flag == exit_list_err) fprintf (stderr, "\n%s: linked list error in %s\n", prog_name, msg); else error_trace (msg); } /* if exit_flag not ok */ exit (exit_flag); } /* exit_prog */ void case_error (format, val) char format[]; int val; { char message [MAX_STRING_LEN]; sprintf (message, format, val); exit_prog (exit_case_err, message); } /* case_error */ /* edit_file DESIGNED: 10-Jun-1985 George Zipperlen MODIFICATION LOG: 1-Apr-1987 George Zipperlen - Changes for SR9.5: dereference all formal array parameters passed to std_$call functions. 11-Nov-1986 George Zipperlen - Changes for SR9.2.3 replace STREAM calls with IOS calls 17-Mar-1985 George Zipperlen - optionally wait for edit_file to close (edit_wait_mode) 17-Dec-1985 George Zipperlen - edit access to files (file_mode parameter) DESCRIPTION: Open display manager window to a file for read or edit, optionally load given font. void edit_file (file_name, file_mode, window, new_font) char file_name []; file_mode_t file_mode; pad_$window_desc_t window; char new_font []; { static char old_font[MAX_STRING_LEN], dm_cmd[MAX_STRING_LEN]; ios_$id_t w_stream; pad_$type_t pad_type; boolean change_font; short fnw, fnh, fnl; status_$t status; switch (file_mode) { case read_mode: pad_type = pad_$read_edit; break; case edit_mode: case edit_wait_mode: pad_type = pad_$edit; break; default : case_error ("edit_file, mode = %d", file_mode); break; } change_font = ! null_str (new_font); if (change_font) { pad_$inq_font (stream_$stdout, fnw, fnh, old_font, 256, fnl, status); strcpy (dm_cmd, "FL "); strcat (dm_cmd, new_font); pad_$dm_cmd (stream_$stdout, dm_cmd, (short)strlen(dm_cmd), status); } pad_$create_window (*file_name, (short)strlen(file_name), pad_type, (short)1, window, w_stream, status); if (status.all == status_$ok) { pad_$pop_push_window (w_stream, 1, true, status); pad_$dm_cmd (stream_$stdout, "tn", 2, status); if (file_mode == edit_wait_mode) pad_$edit_wait (w_stream, status); } else { fprintf (stderr, "%s: error opening %s\n", prog_name, file_name); error_$print (status); } if (change_font) { strcpy (dm_cmd, "FL "); strncat (dm_cmd, old_font, fnl); pad_$dm_cmd (stream_$stdout, dm_cmd, (short)strlen(dm_cmd), status); } pad_$dm_cmd (stream_$stdout, "tn", 2, status); ios_$close (w_stream, status); } /* edit_file */ main (argc, argv) int argc; char *argv[]; { pad_$window_desc_t window; prog_name = argv[0]; window.top = 0; window.left = 0; window.width = 0; window.height = 0; /* 0 : use DM default window */ if (argc != 2) { fprintf (stderr, "%s: usage\n %s %s\n", prog_name, prog_name, USAGE); exit (1); } edit_file (argv[1], edit_wait_mode, window, ""); } /* main */ -------------------------------------------------------------------------------- George Zipperlen george@apollo.lap.upenn.edu Language Analysis Project (215)-898-1954 University of Pennsylvania Generic Disclaimer Philadelphia, Pa. 19103 Cute saying
Jinfu@cup.portal.com (05/08/88)
Well, I ended up writing a c program to fix this problem. Just a very short c program with some pad_$ calls, namely pad_$create_window, and pad_$edit_wait (not to return to shell until the pad is close). It handles case correctly (at least under Aegis 9.6). Only problem I have is occassionaly I got an error 'permission denied' so I have to use a shell script to call the program and passing the filename to it. When playing with the pad calls, I found an undocumented feature which allows you to load various fonts and use them to display a file if the file contains some unprintable characters. More on this later. Jinfu Chen Motorola, Inc. Jinfu@cup.portal.com ...sun!portal!cup.portal.com!jinfu
Jinfu@cup.portal.com (05/16/88)
This is a follow-up of my previous message about using DM ce in UNIX mail program. Several people sent me e-mails with some helpful information so I am posting them here as well. 1) The DM is not case sensitive under SR9.6/9.7. To defeat this, one can either use an undocumented environment variable, DOWNCASE. Put this line env DOWNCASE 'false' in your `node_data/startup.xxx file, or set it in a shell: $ DOWNCASE := 'false' $ export DOWNCASE will make the DM case sensitive(try this /com/sh to see real case-sensitive filename!) 2) Or quote the filename when passing it to the DM: ce 'Foobar'; 3) However, even with these helps, to use CE editor in UNIX mail still need to write a program to perform function similar to CE AND wait for the program to finish before returning to the shell. george@hyper.lap.upenn.edu posted a C program here to do this. In case anyone missing the posting, it is basically two pad calls: pad_$create_window /* open a DM pad for read mode or write mode */ pad_$edit_wait /* wait until the pad is close */ ----------------- Jinfu Chen jinfu@cup.portal.com ...sun!portal!cup.portal.com!jinfu