summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Price <dp@eng.sun.com>2010-07-06 17:09:50 -0700
committerDan Price <dp@eng.sun.com>2010-07-06 17:09:50 -0700
commitdbfe038179f8f9013fb3ed57447316a24e77e93f (patch)
tree7bc476c9e353c55b11751768c23d9a0bf02d0848
parentb971bb4ce38136221d2db4e0e30f25745c11eb9f (diff)
downloadillumos-gate-dbfe038179f8f9013fb3ed57447316a24e77e93f.tar.gz
6955670 PSARC 2010/192 EOF FMLI
-rw-r--r--usr/src/cmd/Makefile1
-rw-r--r--usr/src/cmd/fmli/Makefile52
-rw-r--r--usr/src/cmd/fmli/form/Makefile55
-rw-r--r--usr/src/cmd/fmli/form/fcheck.c153
-rw-r--r--usr/src/cmd/fmli/form/fclose.c67
-rw-r--r--usr/src/cmd/fmli/form/fctl.c153
-rw-r--r--usr/src/cmd/fmli/form/fcurrent.c72
-rw-r--r--usr/src/cmd/fmli/form/fcustom.c69
-rw-r--r--usr/src/cmd/fmli/form/fdefault.c211
-rw-r--r--usr/src/cmd/fmli/form/frefresh.c98
-rw-r--r--usr/src/cmd/fmli/inc.flg32
-rw-r--r--usr/src/cmd/fmli/inc/actrec.h99
-rw-r--r--usr/src/cmd/fmli/inc/attrs.h42
-rw-r--r--usr/src/cmd/fmli/inc/but.h57
-rw-r--r--usr/src/cmd/fmli/inc/color_pair.h81
-rw-r--r--usr/src/cmd/fmli/inc/ctl.h69
-rw-r--r--usr/src/cmd/fmli/inc/detabdefs.h64
-rw-r--r--usr/src/cmd/fmli/inc/eval.h83
-rw-r--r--usr/src/cmd/fmli/inc/exception.h45
-rw-r--r--usr/src/cmd/fmli/inc/form.h65
-rw-r--r--usr/src/cmd/fmli/inc/ifuncdefs.h163
-rw-r--r--usr/src/cmd/fmli/inc/interrupt.h48
-rw-r--r--usr/src/cmd/fmli/inc/io.h88
-rw-r--r--usr/src/cmd/fmli/inc/mail.h51
-rw-r--r--usr/src/cmd/fmli/inc/menu.h60
-rw-r--r--usr/src/cmd/fmli/inc/menudefs.h42
-rw-r--r--usr/src/cmd/fmli/inc/mess.h39
-rw-r--r--usr/src/cmd/fmli/inc/message.h37
-rw-r--r--usr/src/cmd/fmli/inc/mio.h85
-rw-r--r--usr/src/cmd/fmli/inc/moremacros.h48
-rw-r--r--usr/src/cmd/fmli/inc/obj.h66
-rw-r--r--usr/src/cmd/fmli/inc/optabdefs.h79
-rw-r--r--usr/src/cmd/fmli/inc/parse.h131
-rw-r--r--usr/src/cmd/fmli/inc/partabdefs.h70
-rw-r--r--usr/src/cmd/fmli/inc/procdefs.h39
-rw-r--r--usr/src/cmd/fmli/inc/retcds.h39
-rw-r--r--usr/src/cmd/fmli/inc/retcodes.h37
-rw-r--r--usr/src/cmd/fmli/inc/sizes.h47
-rw-r--r--usr/src/cmd/fmli/inc/slk.h41
-rw-r--r--usr/src/cmd/fmli/inc/smdef.h127
-rw-r--r--usr/src/cmd/fmli/inc/terror.h69
-rw-r--r--usr/src/cmd/fmli/inc/token.h203
-rw-r--r--usr/src/cmd/fmli/inc/typetab.h164
-rw-r--r--usr/src/cmd/fmli/inc/var_arrays.h84
-rw-r--r--usr/src/cmd/fmli/inc/vt.h64
-rw-r--r--usr/src/cmd/fmli/inc/vtdefs.h57
-rw-r--r--usr/src/cmd/fmli/inc/windefs.h139
-rw-r--r--usr/src/cmd/fmli/inc/winp.h90
-rw-r--r--usr/src/cmd/fmli/inc/wish.h78
-rw-r--r--usr/src/cmd/fmli/menu/Makefile55
-rw-r--r--usr/src/cmd/fmli/menu/mclose.c50
-rw-r--r--usr/src/cmd/fmli/menu/mctl.c155
-rw-r--r--usr/src/cmd/fmli/menu/mcurrent.c267
-rw-r--r--usr/src/cmd/fmli/menu/mcustom.c84
-rw-r--r--usr/src/cmd/fmli/menu/mdefault.c500
-rw-r--r--usr/src/cmd/fmli/menu/mfolder.c281
-rw-r--r--usr/src/cmd/fmli/menu/mreshape.c77
-rw-r--r--usr/src/cmd/fmli/menu/stmenu.c603
-rw-r--r--usr/src/cmd/fmli/oeu/Makefile60
-rw-r--r--usr/src/cmd/fmli/oeu/genparse.c180
-rw-r--r--usr/src/cmd/fmli/oeu/oeu.c301
-rw-r--r--usr/src/cmd/fmli/oeu/rm_atob.c187
-rw-r--r--usr/src/cmd/fmli/oh/Makefile63
-rw-r--r--usr/src/cmd/fmli/oh/action.c95
-rw-r--r--usr/src/cmd/fmli/oh/alias.c187
-rw-r--r--usr/src/cmd/fmli/oh/cmd.c707
-rw-r--r--usr/src/cmd/fmli/oh/detab.c39
-rw-r--r--usr/src/cmd/fmli/oh/detect.c620
-rw-r--r--usr/src/cmd/fmli/oh/dispfuncs.c118
-rw-r--r--usr/src/cmd/fmli/oh/evstr.c293
-rw-r--r--usr/src/cmd/fmli/oh/externoot.c48
-rw-r--r--usr/src/cmd/fmli/oh/fm_mn_par.c372
-rw-r--r--usr/src/cmd/fmli/oh/fm_mn_par.h93
-rw-r--r--usr/src/cmd/fmli/oh/getval.c311
-rw-r--r--usr/src/cmd/fmli/oh/helptext.c244
-rw-r--r--usr/src/cmd/fmli/oh/if_ascii.c181
-rw-r--r--usr/src/cmd/fmli/oh/if_dir.c680
-rw-r--r--usr/src/cmd/fmli/oh/if_exec.c44
-rw-r--r--usr/src/cmd/fmli/oh/if_form.c1857
-rw-r--r--usr/src/cmd/fmli/oh/if_help.c694
-rw-r--r--usr/src/cmd/fmli/oh/if_init.c622
-rw-r--r--usr/src/cmd/fmli/oh/if_menu.c816
-rw-r--r--usr/src/cmd/fmli/oh/ifuncs.c524
-rw-r--r--usr/src/cmd/fmli/oh/interrupt.c65
-rw-r--r--usr/src/cmd/fmli/oh/is_objtype.c51
-rw-r--r--usr/src/cmd/fmli/oh/misc.c99
-rw-r--r--usr/src/cmd/fmli/oh/namecheck.c259
-rw-r--r--usr/src/cmd/fmli/oh/nextpart.c62
-rw-r--r--usr/src/cmd/fmli/oh/obj_to_opt.c75
-rw-r--r--usr/src/cmd/fmli/oh/obj_to_par.c88
-rw-r--r--usr/src/cmd/fmli/oh/objform.h43
-rw-r--r--usr/src/cmd/fmli/oh/objhelp.h38
-rw-r--r--usr/src/cmd/fmli/oh/objmenu.h39
-rw-r--r--usr/src/cmd/fmli/oh/odftread.c289
-rw-r--r--usr/src/cmd/fmli/oh/odikey.c203
-rw-r--r--usr/src/cmd/fmli/oh/oh_init.c120
-rw-r--r--usr/src/cmd/fmli/oh/ootpart.c150
-rw-r--r--usr/src/cmd/fmli/oh/ootread.c364
-rw-r--r--usr/src/cmd/fmli/oh/opt_rename.c84
-rw-r--r--usr/src/cmd/fmli/oh/optab.c251
-rw-r--r--usr/src/cmd/fmli/oh/optabfuncs.c85
-rw-r--r--usr/src/cmd/fmli/oh/ott_mv.c244
-rw-r--r--usr/src/cmd/fmli/oh/partab.c82
-rw-r--r--usr/src/cmd/fmli/oh/partabfunc.c150
-rw-r--r--usr/src/cmd/fmli/oh/path_to_vp.c72
-rw-r--r--usr/src/cmd/fmli/oh/pathfstype.c58
-rw-r--r--usr/src/cmd/fmli/oh/pathott.c78
-rw-r--r--usr/src/cmd/fmli/oh/pathtitle.c103
-rw-r--r--usr/src/cmd/fmli/oh/scram.c425
-rw-r--r--usr/src/cmd/fmli/oh/slk.c762
-rw-r--r--usr/src/cmd/fmli/oh/suffuncs.c76
-rw-r--r--usr/src/cmd/fmli/oh/typefuncs.c258
-rw-r--r--usr/src/cmd/fmli/oh/typetab.c1145
-rw-r--r--usr/src/cmd/fmli/proc/Makefile55
-rw-r--r--usr/src/cmd/fmli/proc/list.c80
-rw-r--r--usr/src/cmd/fmli/proc/open.c136
-rw-r--r--usr/src/cmd/fmli/proc/pclose.c80
-rw-r--r--usr/src/cmd/fmli/proc/pctl.c76
-rw-r--r--usr/src/cmd/fmli/proc/pcurrent.c188
-rw-r--r--usr/src/cmd/fmli/proc/pdefault.c116
-rw-r--r--usr/src/cmd/fmli/proc/pnoncur.c53
-rw-r--r--usr/src/cmd/fmli/proc/proc.h50
-rw-r--r--usr/src/cmd/fmli/proc/suspend.c84
-rw-r--r--usr/src/cmd/fmli/qued/Makefile57
-rw-r--r--usr/src/cmd/fmli/qued/acs_io.c227
-rw-r--r--usr/src/cmd/fmli/qued/arrows.c94
-rw-r--r--usr/src/cmd/fmli/qued/copyfield.c121
-rw-r--r--usr/src/cmd/fmli/qued/editmulti.c109
-rw-r--r--usr/src/cmd/fmli/qued/editsingle.c197
-rw-r--r--usr/src/cmd/fmli/qued/fclear.c71
-rw-r--r--usr/src/cmd/fmli/qued/fgo.c48
-rw-r--r--usr/src/cmd/fmli/qued/fmacs.h70
-rw-r--r--usr/src/cmd/fmli/qued/fput.c155
-rw-r--r--usr/src/cmd/fmli/qued/fread.c69
-rw-r--r--usr/src/cmd/fmli/qued/fstream.c73
-rw-r--r--usr/src/cmd/fmli/qued/getfield.c189
-rw-r--r--usr/src/cmd/fmli/qued/initfield.c155
-rw-r--r--usr/src/cmd/fmli/qued/mfuncs.c138
-rw-r--r--usr/src/cmd/fmli/qued/multiline.c241
-rw-r--r--usr/src/cmd/fmli/qued/putfield.c117
-rw-r--r--usr/src/cmd/fmli/qued/scrollbuf.c207
-rw-r--r--usr/src/cmd/fmli/qued/setfield.c61
-rw-r--r--usr/src/cmd/fmli/qued/sfuncs.c93
-rw-r--r--usr/src/cmd/fmli/qued/singleline.c188
-rw-r--r--usr/src/cmd/fmli/qued/vfuncs.c278
-rw-r--r--usr/src/cmd/fmli/qued/wrap.c156
-rw-r--r--usr/src/cmd/fmli/sys/Makefile62
-rw-r--r--usr/src/cmd/fmli/sys/actrec.c684
-rw-r--r--usr/src/cmd/fmli/sys/ar_mfuncs.c104
-rw-r--r--usr/src/cmd/fmli/sys/backslash.c117
-rw-r--r--usr/src/cmd/fmli/sys/chgenv.c121
-rw-r--r--usr/src/cmd/fmli/sys/chgepenv.c47
-rw-r--r--usr/src/cmd/fmli/sys/compile.c544
-rw-r--r--usr/src/cmd/fmli/sys/coproc.c394
-rw-r--r--usr/src/cmd/fmli/sys/copyfile.c166
-rw-r--r--usr/src/cmd/fmli/sys/cut.c241
-rw-r--r--usr/src/cmd/fmli/sys/estrtok.c54
-rw-r--r--usr/src/cmd/fmli/sys/eval.c713
-rw-r--r--usr/src/cmd/fmli/sys/evalstr.c51
-rw-r--r--usr/src/cmd/fmli/sys/evfuncs.c887
-rw-r--r--usr/src/cmd/fmli/sys/exit.c69
-rw-r--r--usr/src/cmd/fmli/sys/expand.c217
-rw-r--r--usr/src/cmd/fmli/sys/expr.c439
-rw-r--r--usr/src/cmd/fmli/sys/filename.c47
-rw-r--r--usr/src/cmd/fmli/sys/genfind.c359
-rw-r--r--usr/src/cmd/fmli/sys/getaltenv.c77
-rw-r--r--usr/src/cmd/fmli/sys/getepenv.c97
-rw-r--r--usr/src/cmd/fmli/sys/grep.c380
-rw-r--r--usr/src/cmd/fmli/sys/io.c388
-rw-r--r--usr/src/cmd/fmli/sys/itoa.c59
-rw-r--r--usr/src/cmd/fmli/sys/memshift.c59
-rw-r--r--usr/src/cmd/fmli/sys/mencmds.c787
-rw-r--r--usr/src/cmd/fmli/sys/nstrcat.c60
-rw-r--r--usr/src/cmd/fmli/sys/onexit.c43
-rw-r--r--usr/src/cmd/fmli/sys/parent.c72
-rw-r--r--usr/src/cmd/fmli/sys/putaltenv.c137
-rw-r--r--usr/src/cmd/fmli/sys/readfile.c97
-rw-r--r--usr/src/cmd/fmli/sys/scrclean.c46
-rw-r--r--usr/src/cmd/fmli/sys/spawn.c203
-rw-r--r--usr/src/cmd/fmli/sys/strCcmp.c72
-rw-r--r--usr/src/cmd/fmli/sys/strappend.c68
-rw-r--r--usr/src/cmd/fmli/sys/stream.c47
-rw-r--r--usr/src/cmd/fmli/sys/strsave.c59
-rw-r--r--usr/src/cmd/fmli/sys/tempfiles.c291
-rw-r--r--usr/src/cmd/fmli/sys/terrmess.c117
-rw-r--r--usr/src/cmd/fmli/sys/terror.c170
-rw-r--r--usr/src/cmd/fmli/sys/test.c304
-rw-r--r--usr/src/cmd/fmli/sys/test.h736
-rw-r--r--usr/src/cmd/fmli/sys/varappend.c50
-rw-r--r--usr/src/cmd/fmli/sys/varchkapnd.c48
-rw-r--r--usr/src/cmd/fmli/sys/varcreate.c61
-rw-r--r--usr/src/cmd/fmli/sys/vardelete.c56
-rw-r--r--usr/src/cmd/fmli/sys/vargrow.c60
-rw-r--r--usr/src/cmd/fmli/sys/varinsert.c56
-rw-r--r--usr/src/cmd/fmli/sys/varshrink.c55
-rw-r--r--usr/src/cmd/fmli/sys/watch.c66
-rw-r--r--usr/src/cmd/fmli/vt/Makefile60
-rw-r--r--usr/src/cmd/fmli/vt/fits.c55
-rw-r--r--usr/src/cmd/fmli/vt/hide.c149
-rw-r--r--usr/src/cmd/fmli/vt/highlight.c111
-rw-r--r--usr/src/cmd/fmli/vt/indicator.c54
-rw-r--r--usr/src/cmd/fmli/vt/lp.c45
-rw-r--r--usr/src/cmd/fmli/vt/makebox.c116
-rw-r--r--usr/src/cmd/fmli/vt/message.c183
-rw-r--r--usr/src/cmd/fmli/vt/move.c61
-rw-r--r--usr/src/cmd/fmli/vt/offscreen.c49
-rw-r--r--usr/src/cmd/fmli/vt/physical.c453
-rw-r--r--usr/src/cmd/fmli/vt/redraw.c43
-rw-r--r--usr/src/cmd/fmli/vt/showdate.c92
-rw-r--r--usr/src/cmd/fmli/vt/showmail.c75
-rw-r--r--usr/src/cmd/fmli/vt/system.c51
-rw-r--r--usr/src/cmd/fmli/vt/vclose.c59
-rw-r--r--usr/src/cmd/fmli/vt/vcolor.c223
-rw-r--r--usr/src/cmd/fmli/vt/vcreate.c396
-rw-r--r--usr/src/cmd/fmli/vt/vctl.c184
-rw-r--r--usr/src/cmd/fmli/vt/vcurrent.c192
-rw-r--r--usr/src/cmd/fmli/vt/vdebug.c49
-rw-r--r--usr/src/cmd/fmli/vt/vflush.c255
-rw-r--r--usr/src/cmd/fmli/vt/vfork.c67
-rw-r--r--usr/src/cmd/fmli/vt/vinit.c177
-rw-r--r--usr/src/cmd/fmli/vt/vmark.c62
-rw-r--r--usr/src/cmd/fmli/vt/vreshape.c93
-rw-r--r--usr/src/cmd/fmli/vt/wclrwin.c46
-rw-r--r--usr/src/cmd/fmli/vt/wdelchar.c52
-rw-r--r--usr/src/cmd/fmli/vt/wgetchar.c45
-rw-r--r--usr/src/cmd/fmli/vt/wgo.c57
-rw-r--r--usr/src/cmd/fmli/vt/winprintf.c53
-rw-r--r--usr/src/cmd/fmli/vt/winputs.c262
-rw-r--r--usr/src/cmd/fmli/vt/winschar.c54
-rw-r--r--usr/src/cmd/fmli/vt/working.c62
-rw-r--r--usr/src/cmd/fmli/vt/wputchar.c217
-rw-r--r--usr/src/cmd/fmli/vt/wreadchar.c56
-rw-r--r--usr/src/cmd/fmli/vt/wscrollwin.c71
-rw-r--r--usr/src/cmd/fmli/wish/Makefile56
-rw-r--r--usr/src/cmd/fmli/wish/browse.c210
-rw-r--r--usr/src/cmd/fmli/wish/display.c61
-rw-r--r--usr/src/cmd/fmli/wish/error.c53
-rw-r--r--usr/src/cmd/fmli/wish/flush.c39
-rw-r--r--usr/src/cmd/fmli/wish/getstring.c197
-rw-r--r--usr/src/cmd/fmli/wish/global.c627
-rw-r--r--usr/src/cmd/fmli/wish/mudge.c250
-rw-r--r--usr/src/cmd/fmli/wish/objop.c296
-rw-r--r--usr/src/cmd/fmli/wish/stubs.c99
-rw-r--r--usr/src/cmd/fmli/wish/virtual.c228
-rw-r--r--usr/src/cmd/fmli/wish/wdwcreate.c109
-rw-r--r--usr/src/cmd/fmli/wish/wdwlist.c110
-rw-r--r--usr/src/cmd/fmli/wish/wdwmgmt.c229
-rw-r--r--usr/src/cmd/fmli/xx/Makefile65
-rw-r--r--usr/src/cmd/fmli/xx/main.c590
-rw-r--r--usr/src/cmd/fmli/xx/mapfile-intf46
-rw-r--r--usr/src/cmd/fmli/xx/vsig.c70
-rw-r--r--usr/src/cmd/man/src/man.c7
-rw-r--r--usr/src/pkg/manifests/SUNWcs.mf1
-rw-r--r--usr/src/pkg/manifests/system-extended-system-utilities.mf1
254 files changed, 3 insertions, 42918 deletions
diff --git a/usr/src/cmd/Makefile b/usr/src/cmd/Makefile
index a497a58dfe..0f60386f21 100644
--- a/usr/src/cmd/Makefile
+++ b/usr/src/cmd/Makefile
@@ -158,7 +158,6 @@ COMMON_SUBDIRS= \
flowadm \
flowstat \
fm \
- fmli \
fmt \
fmthard \
fmtmsg \
diff --git a/usr/src/cmd/fmli/Makefile b/usr/src/cmd/fmli/Makefile
deleted file mode 100644
index 4b464e2f64..0000000000
--- a/usr/src/cmd/fmli/Makefile
+++ /dev/null
@@ -1,52 +0,0 @@
-#
-# CDDL HEADER START
-#
-# The contents of this file are subject to the terms of the
-# Common Development and Distribution License, Version 1.0 only
-# (the "License"). You may not use this file except in compliance
-# with the License.
-#
-# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
-# or http://www.opensolaris.org/os/licensing.
-# See the License for the specific language governing permissions
-# and limitations under the License.
-#
-# When distributing Covered Code, include this CDDL HEADER in each
-# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
-# If applicable, add the following below this CDDL HEADER, with the
-# fields enclosed by brackets "[]" replaced with your own identifying
-# information: Portions Copyright [yyyy] [name of copyright owner]
-#
-# CDDL HEADER END
-#
-#
-# Copyright 2004 Sun Microsystems, Inc. All rights reserved.
-# Use is subject to license terms.
-#
-# ident "%Z%%M% %I% %E% SMI"
-#
-
-# include global definitions
-include ../../Makefile.master
-
-SUBDIRS = form menu oeu oh proc qued sys vt wish xx
-
-all := TARGET = all
-install := TARGET = install
-clean := TARGET = clean
-clobber := TARGET = clobber
-lint := TARGET = lint
-
-.KEEP_STATE:
-
-all: $(SUBDIRS)
-
-install clean clobber: $(SUBDIRS)
-
-$(SUBDIRS): FRC
- @cd $@; pwd; $(MAKE) $(TARGET)
-
-lint:
- @ $(ECHO) "usr/src/cmd/fmli is not lint-clean: skipping"
-
-FRC:
diff --git a/usr/src/cmd/fmli/form/Makefile b/usr/src/cmd/fmli/form/Makefile
deleted file mode 100644
index 72c5141696..0000000000
--- a/usr/src/cmd/fmli/form/Makefile
+++ /dev/null
@@ -1,55 +0,0 @@
-#
-# CDDL HEADER START
-#
-# The contents of this file are subject to the terms of the
-# Common Development and Distribution License, Version 1.0 only
-# (the "License"). You may not use this file except in compliance
-# with the License.
-#
-# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
-# or http://www.opensolaris.org/os/licensing.
-# See the License for the specific language governing permissions
-# and limitations under the License.
-#
-# When distributing Covered Code, include this CDDL HEADER in each
-# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
-# If applicable, add the following below this CDDL HEADER, with the
-# fields enclosed by brackets "[]" replaced with your own identifying
-# information: Portions Copyright [yyyy] [name of copyright owner]
-#
-# CDDL HEADER END
-#
-#
-# Copyright 2004 Sun Microsystems, Inc. All rights reserved.
-# Use is subject to license terms.
-#
-# ident "%Z%%M% %I% %E% SMI"
-#
-# cmd/fmli/form/Makefile
-#
-LIBRARY = libform.a
-
-OBJECTS = fcheck.o fclose.o fctl.o fcurrent.o fcustom.o fdefault.o \
- frefresh.o
-
-# include library definitions
-include ../../../lib/Makefile.lib
-
-C99MODE= $(C99_DISABLE)
-
-# Specifically request the construction of a static library.
-# This library is not installed in the proto area.
-LIBS = $(LIBRARY)
-
-# inc must be first.
-CPPFLAGS = -I../inc $(CPPFLAGS.master)
-
-.KEEP_STATE:
-
-all: $(LIBS)
-
-install: all
- @echo "$(LIBRARY) is not installed."
-
-# include library targets
-include ../../../lib/Makefile.targ
diff --git a/usr/src/cmd/fmli/form/fcheck.c b/usr/src/cmd/fmli/form/fcheck.c
deleted file mode 100644
index 7efd8f4396..0000000000
--- a/usr/src/cmd/fmli/form/fcheck.c
+++ /dev/null
@@ -1,153 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/*
- * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-#include <stdio.h>
-#include <curses.h>
-#include "wish.h"
-#include "token.h"
-#include "winp.h"
-#include "form.h"
-
-/*
- * A field definition may contain:
- *
- * 1) a field name only
- * 2) a field only
- * 3) both a field name and a field
- *
- * The following macros are useful in determining which is the case
- */
-#define HAS_NAME(x) ((x->nrow >= 0) && (x->ncol >= 0))
-#define HAS_FIELD(x) ((x->cols > 0) && (x->rows > 0) && \
- (x->frow >= 0) && (x->fcol >= 0))
-
-/*
- * CHECKFFIELD will handle setting/resetting field values depending
- * on the current/previous state of the field value
- */
-int
-checkffield(fptr, pffld)
-struct form *fptr; /* pointer to the form structure */
-register formfield *pffld; /* how the field "should" be displayed */
-{
- register ifield *fld; /* how the field "is" displayed */
- ifield *newfield();
-
- if (!(*(pffld->ptr))) {
- /*
- * this is the first time ... initialize the field
- */
- *(pffld->ptr) = (char *) newfield(pffld->frow, pffld->fcol,
- pffld->rows, pffld->cols, pffld->flags);
- if (!(pffld->flags & I_NOSHOW)) {
- /*
- * if "show=true" then display the field name
- * as well as the field itself.
- */
- if (HAS_NAME(pffld)) {
- wgo(pffld->nrow, pffld->ncol);
- winputs(pffld->name, NULL);
- }
- if (HAS_FIELD(pffld))
- putfield((ifield *) *(pffld->ptr), pffld->value);
- }
- return (0);
- }
- else if (pffld->flags & I_NOSHOW) {
- /*
- * field is a "show=false" field
- */
- fld = (ifield *) *(pffld->ptr);
- if (!(fld->flags & I_NOSHOW)) {
- /*
- * if field was recently a "show=true" field ...
- * then remove the field name and the field value
- */
- if (HAS_NAME(pffld)) {
-
- char tbuf[BUFSIZ];
-
- sprintf(tbuf, "%*s", strlen(pffld->name), " ");
- wgo(pffld->nrow, pffld->ncol);
- winputs(tbuf, NULL);
- }
- if (HAS_FIELD(fld))
- hidefield(fld);
- }
- }
- else {
- /*
- * field is a "show=true" field
- */
- fld = (ifield *) *(pffld->ptr);
-
- /*
- * Only redisplay the field name if the field HAS
- * a name AND:
- *
- * 1) the form is all dirty OR
- * 2) the field was previously "show=false"
- */
- if (HAS_NAME(pffld) && ((fptr->flags & FORM_ALLDIRTY) ||
- (fld->flags & I_NOSHOW))) {
- wgo(pffld->nrow, pffld->ncol);
- winputs(pffld->name, NULL);
- }
- /*
- * Only redisplay the field value if there IS a field AND:
- *
- * 1) the field went from active to inactive or vice versa OR
- * 2) the form is all dirty OR
- * 3) the new field value is different from
- * the old field value OR
- * 4) the field was previously "show=false"
- */
- if (HAS_FIELD(pffld)) {
- if ((fld->flags & I_FILL) ^ (pffld->flags & I_FILL)) {
- setfieldflags(*(pffld->ptr), pffld->flags);
- putfield(fld, pffld->value);
- }
- else if ((fptr->flags & FORM_ALLDIRTY) ||
- ((fld->value == NULL) || (pffld->value == NULL)) ||
- (strcmp(fld->value, pffld->value) != 0) ||
- (fld->flags & I_NOSHOW)) {
- putfield(fld, pffld->value);
- }
- }
- }
-
- /*
- * update field flags if necessary ....
- */
- if (((ifield *) *(pffld->ptr))->flags != pffld->flags)
- setfieldflags(*(pffld->ptr), pffld->flags);
- return (0);
-}
diff --git a/usr/src/cmd/fmli/form/fclose.c b/usr/src/cmd/fmli/form/fclose.c
deleted file mode 100644
index 20774a928a..0000000000
--- a/usr/src/cmd/fmli/form/fclose.c
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-/*
- * Copyright (c) 1986 AT&T
- * All Rights Reserved
- */
-#ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.5 */
-
-#include <stdio.h>
-#include <curses.h>
-#include "wish.h"
-#include "token.h"
-#include "winp.h"
-#include "form.h"
-#include "vtdefs.h"
-#include "var_arrays.h"
-
-int
-form_close(fid)
-form_id fid;
-{
- register int i;
- register char *argptr;
- register struct form *fptr;
- formfield ff, (*disp)();
-
- if (fid < 0 || !(FORM_array[fid].flags & FORM_USED)) {
-#ifdef _DEBUG
- _debug(stderr, "form_close(%d) - bad form number\n", fid);
-#endif
- return(FAIL);
- }
- fptr = &FORM_array[fid];
- disp = fptr->display;
- argptr = fptr->argptr;
- for (i = 0, ff = (*disp)(0, argptr); ff.name != NULL; ff = (*disp)(++i, argptr))
- if (*(ff.ptr))
- endfield(*(ff.ptr));
- if (FORM_curid == fid)
- FORM_curid = -1;
- fptr->flags = 0;
- vt_close(fptr->vid); /* close the window associated with the form */
- return(SUCCESS);
-}
diff --git a/usr/src/cmd/fmli/form/fctl.c b/usr/src/cmd/fmli/form/fctl.c
deleted file mode 100644
index 0ff206bc60..0000000000
--- a/usr/src/cmd/fmli/form/fctl.c
+++ /dev/null
@@ -1,153 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-
-/*
- * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-#include <stdio.h>
-#include <stdarg.h>
-#include <curses.h>
-#include "wish.h"
-#include "ctl.h"
-#include "token.h"
-#include "winp.h"
-#include "form.h"
-#include "vtdefs.h"
-
-int
-form_ctl(form_id fid, unsigned cmd, ...)
-{
- register struct form *f;
- register int retval;
- va_list args;
-
-#ifdef _DEBUG
- if (fid < 0) {
- if ((fid = FORM_curid) < 0)
- _debug(stderr, "NO CURRENT FORM!\n");
- }
-#endif
- f = &FORM_array[fid];
- retval = SUCCESS;
- va_start(args, cmd);
- switch (cmd) {
- case CTSETDIRTY:
- if (fid == FORM_curid)
- form_refresh(fid); /* refresh now */
- else
- f->flags |= FORM_DIRTY; /* refresh when made current */
- break;
- case CTSETPOS:
- {
- formfield ffld;
-
- f->curfldnum = va_arg(args, int);
- ffld = (*(f->display))(f->curfldnum, f->argptr);
- checkffield(f, &ffld);
- gotofield(*(ffld.ptr), va_arg(args, int), va_arg(args, int));
- }
- break;
- case CTSETPAGE:
- {
- int doclear, curpage, lastpage, line;
-
- doclear = va_arg(args, int);
- curpage = va_arg(args, int);
- lastpage = va_arg(args, int);
- f->flags |= FORM_ALLDIRTY;
- line = 0;
- if (curpage > 1)
- line |= VT_UPPARROW;
- if (curpage < lastpage)
- line |= VT_DNPARROW;
- if (doclear) {
- wgo(0, 0);
- wclrwin();
- vt_ctl(f->vid, CTSETPARROWS, line);
- retval = form_refresh(fid); /* abs */
- }
- else {
- vt_ctl(f->vid, CTSETPARROWS, line);
- }
- break;
- }
- case CTGETARG:
- {
- char **strptr;
-
- strptr = va_arg(args, char **);
- if (*strptr == NULL)
- *strptr = (char *) getfield(NULL, NULL);
- else
- (void) getfield(NULL, *strptr);
- }
- break;
- case CTGETWDW:
- retval = vt_ctl(f->vid, CTGETWDW);
- break;
- case CTGETITLE:
- retval = vt_ctl(f->vid, CTGETITLE, va_arg(args, char *));
- break;
- case CTGETVT:
- retval = f->vid;
- break;
- case CTGETPARMS:
- *(va_arg(args, int *)) = f->rows;
- *(va_arg(args, int *)) = f->cols;
- break;
- case CTSETPARMS:
- f->rows = va_arg(args, int);
- f->cols = va_arg(args, int);
- f->flags |= FORM_DIRTY;
- break;
- case CTSETSHAPE:
- {
- int srow, scol, rows, cols;
-
- srow = va_arg(args, int);
- scol = va_arg(args, int);
- rows = va_arg(args, int);
- cols = va_arg(args, int);
- if (srow >= 0)
- _form_reshape(fid, srow, scol, rows, cols);
- }
- break;
- case CTCLEARWIN:
- vt_ctl(f->vid, CTCLEARWIN, 0);
- break;
- default:
-#ifdef _DEBUG
- _debug(stderr, "form_ctl(%d, %d, ...) unknown command\n", fid, cmd);
-#endif
- retval = FAIL;
- break;
- }
- va_end(args);
- return retval;
-}
diff --git a/usr/src/cmd/fmli/form/fcurrent.c b/usr/src/cmd/fmli/form/fcurrent.c
deleted file mode 100644
index 73cea6e384..0000000000
--- a/usr/src/cmd/fmli/form/fcurrent.c
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-/*
- * Copyright (c) 1985 AT&T
- * All Rights Reserved
- */
-#ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.4 */
-
-#include <curses.h>
-#include "wish.h"
-#include "token.h"
-#include "winp.h"
-#include "form.h"
-#include "vtdefs.h"
-
-form_id FORM_curid = -1;
-struct form *FORM_array;
-
-/*
- * makes the given form current and old form noncurrent
- */
-int
-form_current(fid)
-form_id fid;
-{
-
- register struct form *f;
-
- if (fid != FORM_curid) /* if changing to different form.. abs k13 */
- form_noncurrent();
-
- FORM_curid = fid;
- f = &FORM_array[FORM_curid];
- vt_current(f->vid);
- if (f->flags & (FORM_DIRTY | FORM_ALLDIRTY))
- form_refresh(fid);
- return(SUCCESS);
-}
-
-/*
- * makes current form noncurrent
- */
-int
-form_noncurrent()
-{
- if (FORM_curid >= 0)
- FORM_array[FORM_curid].flags |= FORM_DIRTY;
- return(SUCCESS);
-}
diff --git a/usr/src/cmd/fmli/form/fcustom.c b/usr/src/cmd/fmli/form/fcustom.c
deleted file mode 100644
index a027e4c5a0..0000000000
--- a/usr/src/cmd/fmli/form/fcustom.c
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-/*
- * Copyright (c) 1985 AT&T
- * All Rights Reserved
- */
-#ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.5 */
-
-#include <stdio.h>
-#include <curses.h>
-#include "wish.h"
-#include "token.h"
-#include "winp.h"
-#include "form.h"
-#include "var_arrays.h"
-
-form_id
-form_custom(vid, flags, rows, cols, disp, ptr)
-vt_id vid;
-unsigned flags;
-int rows, cols;
-formfield (*disp)();
-char *ptr;
-{
- register int num;
- register struct form *f;
-
- /* find a free form structure */
- for (f = FORM_array, num = array_len(FORM_array); num > 0; f++, num--)
- if (!(f->flags & FORM_USED))
- break;
- if (num <= 0) {
- var_append(struct form, FORM_array, NULL);
- f = &FORM_array[array_len(FORM_array) - 1];
- }
- /* set up f */
- f->display = disp;
- f->argptr = ptr;
- f->flags = FORM_USED | FORM_DIRTY;
- f->vid = vid;
- f->curfldnum = 0;
- f->rows = rows;
- f->cols = cols;
-
- return(f - FORM_array);
-}
diff --git a/usr/src/cmd/fmli/form/fdefault.c b/usr/src/cmd/fmli/form/fdefault.c
deleted file mode 100644
index 5cb27df973..0000000000
--- a/usr/src/cmd/fmli/form/fdefault.c
+++ /dev/null
@@ -1,211 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-
-/*
- * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-/* Copyright (c) 1984, 1985, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-#include <stdio.h>
-#include <curses.h>
-#include "wish.h"
-#include "terror.h"
-#include "token.h"
-#include "winp.h"
-#include "form.h"
-#include "vtdefs.h"
-#include "ctl.h"
-
-static void getformsize();
-
-form_id
-form_default(title, flags, startrow, startcol, disp, ptr)
-char *title;
-unsigned flags;
-int startrow;
-int startcol;
-formfield (*disp)();
-char *ptr;
-{
- vt_id vid;
- int maxheight, maxlength;
-
- getformsize(disp, ptr, title, &maxheight, &maxlength);
- if (maxheight == 0)
- return((form_id) FAIL);
- if ((vid = vt_create(title, flags, startrow, startcol, maxheight, maxlength + 1)) < 0)
- /* just try to put the window anywhere */
- vid = vt_create(title, flags, VT_UNDEFINED, VT_UNDEFINED, maxheight, maxlength + 1);
- if (vid == VT_UNDEFINED) {
- mess_temp("Object can not be displayed, frame may be too large for the screen");
- return((form_id) FAIL);
- }
- return(form_custom(vid, flags, maxheight, maxlength, disp, ptr));
-}
-
-form_id
-form_reinit(fid, flags, disp, arg)
-form_id fid;
-unsigned flags;
-formfield (*disp)();
-char *arg;
-{
- char *s;
- register form_id currfid;
- register vt_id savevid, newvid, formvid;
- struct form *f;
- int formrows, formcols, retval, num;
-
- f = &FORM_array[fid];
- currfid = FORM_curid;
- formvid = f->vid;
- savevid = vt_current(formvid);
-
- vt_ctl(VT_UNDEFINED, CTGETITLE, &s);
- num = vt_ctl(VT_UNDEFINED, CTGETWDW);
- getformsize(disp, arg, s, &formrows, &formcols);
- if ((newvid = vt_create(s, flags | VT_COVERCUR, VT_UNDEFINED, VT_UNDEFINED, formrows, formcols)) == VT_UNDEFINED) {
-
- /*
- * try putting the VT anywhere
- */
- newvid = vt_create(s, flags, VT_UNDEFINED, VT_UNDEFINED, formrows, formcols);
- }
- if (newvid != VT_UNDEFINED) {
- vt_close(formvid);
- f->flags |= FORM_ALLDIRTY;
- f->vid = newvid;
- f->rows = formrows;
- f->cols = formcols;
- vt_current(newvid); /* moved from after vt_ctl() abs */
- vt_ctl(VT_UNDEFINED, CTSETWDW, num);
- retval = SUCCESS;
- }
- else
- {
- retval = FAIL;
- form_noncurrent();
- if (formvid != savevid) /* the corrupted form was'nt current.. */
- vt_current(savevid); /* so make the old frame current again */
- return(retval);
- }
-
- form_current(fid);
- if (savevid != formvid) {
- form_noncurrent();
- if (currfid >= 0)
- form_current(currfid);
- else
- vt_current(savevid);
- }
-
- return(retval);
-}
-
-
-/* _form_reshape really reshapes text objects */
-int
-_form_reshape(fid, srow, scol, rows, cols)
-int fid;
-int srow;
-int scol;
-unsigned rows;
-unsigned cols;
-{
- int numrows, numcols;
- int header_rows;
- struct form *f;
- register char *argptr;
-
- formfield ff, (*disp)();
-
- /*****
- mess_temp("Cannot reshape Forms or Text Objects");
- return FAIL;
- *****/
-
- f = &FORM_array[fid];
- if (rows < 4 /* f->rows */ || cols < 5 /* f->cols */) {
- mess_temp("Too small, try again");
- return FAIL;
- }
- vt_reshape(f->vid, srow, scol, rows, cols);
- vt_ctl(f->vid, CTGETSIZ, &numrows, &numcols);
- /*
- f->rows = numrows;
- f->cols = numcols;
- */
- f->flags |= (FORM_DIRTY | FORM_ALLDIRTY);
-
- /* Text object stuff */
- disp = f->display;
- argptr = f->argptr;
- ff = (*disp)(0, argptr); /* header field */
- if (*(ff.ptr)) {
- endfield((ifield *) *(ff.ptr));
- *(ff.ptr) = (char *) newfield(ff.frow, ff.fcol,
- rows - 2 , cols - 2, ff.flags);
- header_rows = ff.rows;
- ff.cols = cols - 2;
- putfield((ifield *) *(ff.ptr), ff.value);
- }
-
- ff = (*disp)(1, argptr); /* text field */
- if (*(ff.ptr)) {
- endfield((ifield *) *(ff.ptr));
- *(ff.ptr) = (char *) newfield(ff.frow, ff.fcol,
- rows - 2 - header_rows , cols - 2, ff.flags);
- ff.rows = rows - 2 - header_rows;
- ff.cols = cols - 2;
- putfield((ifield *) *(ff.ptr), ff.value);
- }
- form_current(fid);
- return SUCCESS;
-}
-
-static void
-getformsize(disp, ptr, title, formrows, formcols)
-formfield (*disp)();
-char *ptr;
-char *title;
-int *formrows;
-int *formcols;
-{
- register int i, maxrows, maxcols;
- formfield ff;
-
- i = maxrows = maxcols = 0;
- for (ff = (*disp)(0, ptr); ff.name != NULL; ff = (*disp)(++i, ptr)) {
- maxrows = max(maxrows, max(ff.frow + ff.rows, ff.nrow + 1));
- maxcols = max(maxcols, max(ff.fcol + ff.cols, ff.ncol + strlen(ff.name)));
- }
- if (maxcols < (i = strlen(title) + 3))
- maxcols = i;
- *formrows = maxrows;
- *formcols = maxcols;
-}
diff --git a/usr/src/cmd/fmli/form/frefresh.c b/usr/src/cmd/fmli/form/frefresh.c
deleted file mode 100644
index 16e69cd24b..0000000000
--- a/usr/src/cmd/fmli/form/frefresh.c
+++ /dev/null
@@ -1,98 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-
-/*
- * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-/* Copyright (c) 1984, 1985, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-#include <stdio.h>
-#include <curses.h>
-#include "wish.h"
-#include "token.h"
-#include "winp.h"
-#include "form.h"
-#include "attrs.h"
-
-int
-form_refresh(fid)
-form_id fid;
-{
- register int i, maxrows, maxcols;
- register char *argptr;
- struct ifield *curfld = NULL;
- int curmaxrows, curmaxcols;
- formfield ff, (*disp)();
- struct form *fptr;
- vt_id oldvid;
- int retval; /* abs */
-
- fptr = &FORM_array[fid];
- oldvid = vt_current(fptr->vid);
- disp = fptr->display;
- argptr = fptr->argptr;
- curmaxrows = fptr->rows;
- curmaxcols = fptr->cols;
- maxrows = maxcols = 0;
-
- ff = (*disp)(0, argptr);
- for (i = 0; ff.name != NULL; ff = (*disp)(++i, argptr)) {
- /*
- * For all fields that are visible on the current page ...
- * display/hide/update the field as appropriate
- * (see fcheck.c)
- *
- * ... also, determine the size of the entire form.
- */
- checkffield(fptr, &ff);
- maxrows = max(maxrows, max(ff.frow + ff.rows, ff.nrow + 1));
- maxcols = max(maxcols, max(ff.fcol + ff.cols, ff.ncol + strlen(ff.name)));
- if (i == (fptr->curfldnum))
- curfld = (struct ifield *) *(ff.ptr);
- }
- if (maxrows > curmaxrows || maxcols > curmaxcols) {
- /*
- * If the form should grow in size then reinitialize
- * the form altogether.
- */
- retval = form_reinit(fid, fptr->flags, disp, argptr);
- fptr->flags &= ~(FORM_DIRTY | FORM_ALLDIRTY);
- return(retval); /* abs */
- }
- else {
- /*
- * clear dirty bits ... set/reset the form to the
- * previously current field ... make the "oldvid"
- * current again.
- */
- fptr->flags &= ~(FORM_DIRTY | FORM_ALLDIRTY);
- gotofield(curfld, 0, 0);
- (void) vt_current(oldvid);
- return(SUCCESS); /* abs */
- }
-}
diff --git a/usr/src/cmd/fmli/inc.flg b/usr/src/cmd/fmli/inc.flg
deleted file mode 100644
index 2b44c46815..0000000000
--- a/usr/src/cmd/fmli/inc.flg
+++ /dev/null
@@ -1,32 +0,0 @@
-#!/bin/sh
-#
-# CDDL HEADER START
-#
-# The contents of this file are subject to the terms of the
-# Common Development and Distribution License, Version 1.0 only
-# (the "License"). You may not use this file except in compliance
-# with the License.
-#
-# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
-# or http://www.opensolaris.org/os/licensing.
-# See the License for the specific language governing permissions
-# and limitations under the License.
-#
-# When distributing Covered Code, include this CDDL HEADER in each
-# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
-# If applicable, add the following below this CDDL HEADER, with the
-# fields enclosed by brackets "[]" replaced with your own identifying
-# information: Portions Copyright [yyyy] [name of copyright owner]
-#
-# CDDL HEADER END
-#
-
-#
-# Copyright 1993 Sun Microsystems, Inc. All rights reserved.
-# Use is subject to license terms.
-#
-#ident "%Z%%M% %I% %E% SMI"
-
-
-echo_file usr/src/lib/Makefile.lib
-echo_file usr/src/lib/Makefile.targ
diff --git a/usr/src/cmd/fmli/inc/actrec.h b/usr/src/cmd/fmli/inc/actrec.h
deleted file mode 100644
index 5fea767914..0000000000
--- a/usr/src/cmd/fmli/inc/actrec.h
+++ /dev/null
@@ -1,99 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-/*
- * Copyright (c) 1985 AT&T
- * All Rights Reserved
- *
- */
-
-#ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.8 */
-
-/* indices for the fcntbl[] array */
-
-#define AR_CLOSE (0) /* prepare this record for destruction */
-#define AR_NONCUR (1) /* make this record noncurrent */
-#define AR_CURRENT (2) /* make this record current */
-#define AR_REREAD (3) /* reread this record */
-#define AR_CTL (4) /* change something about this record */
-#define AR_ODSH (5) /* handle tokens */
-#define AR_REINIT (6) /* init during checkworld */
-#define AR_HELP (7) /* help function */
-#define AR_TEMP_CUR (8) /* make this record temporarily current */
-#define AR_NUMFCN (9)
-
-
-struct actrec {
- char *path;
- int serial;
- int id; /* menu, form, process */
- int flags;
- int lifetime;
- char *interrupt; /* abs */
- char *oninterrupt; /* abs */
- struct slk *slks;
- struct actrec *prevrec;
- struct actrec *nextrec;
- struct actrec *backup;
-
- /* object dependent fields */
-
- char *odptr; /* any structure you want */
- int (*fcntbl[AR_NUMFCN])(); /* any functions you want */
-};
-
-/* lifetimes */
-
-#define AR_SHORTERM (1)
-#define AR_HELPTERM (2)
-#define AR_LONGTERM (3)
-#define AR_PERMANENT (4)
-#define AR_IMMORTAL (5)
-#define AR_INITIAL (6)
-#define AR_CLOSING (7) /* abs k17 */
-
-/* flags */
-
-#define AR_SKIP (1) /* don't stop here on prev/next wdw */
-#define AR_ALTSLKS (2) /* use alternate slks by default */
-#define AR_NORESHAPE (4) /* can't do frm-mgmt "reshape" */
-
-/* macros for calling activation functions */
-
-#define arf_close(X,Y) (*(X->fcntbl[AR_CLOSE]))(Y)
-#define arf_current(X,Y) (*(X->fcntbl[AR_CURRENT]))(Y)
-#define arf_temp_current(X,Y) (*(X->fcntbl[AR_TEMP_CUR]))(Y)
-#define arf_noncur(X,Y) (*(X->fcntbl[AR_NONCUR]))(Y, TRUE)
-#define arf_reread(X,Y) (*(X->fcntbl[AR_REREAD]))(Y)
-#define arf_reinit(X,Y) (*(X->fcntbl[AR_REINIT]))(Y)
-#define arf_odsh(X,Y) (*(X->fcntbl[AR_ODSH]))(X, Y)
-#define arf_help(X,Y) (*(X->fcntbl[AR_HELP]))(Y)
-
-/* Definitions of standard menu functions */
-
-extern int AR_MEN_CLOSE(), AR_MEN_CURRENT(), AR_MEN_NONCUR(), AR_MEN_CTL(),
- AR_NOHELP(), AR_NOP();
-
-extern token AR_MEN_ODSH();
diff --git a/usr/src/cmd/fmli/inc/attrs.h b/usr/src/cmd/fmli/inc/attrs.h
deleted file mode 100644
index ffe213536c..0000000000
--- a/usr/src/cmd/fmli/inc/attrs.h
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-/*
- * Copyright (c) 1985 AT&T
- * All Rights Reserved
- *
- */
-
-#ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.3 */
-
-extern chtype Attr_normal; /* normal video */
-extern chtype Attr_hide; /* border of non-current window */
-extern chtype Attr_highlight; /* border of current window */
-extern chtype Attr_select; /* attribute of "selector bar" */
-extern chtype Attr_show; /* something visible (errors, etc) */
-extern chtype Attr_visible; /* most annoying thing terminal can do */
-extern chtype Attr_underline; /* attribute of underline */
-extern chtype Attr_mark; /* attribute of "marked" items */
-
diff --git a/usr/src/cmd/fmli/inc/but.h b/usr/src/cmd/fmli/inc/but.h
deleted file mode 100644
index f7537898d7..0000000000
--- a/usr/src/cmd/fmli/inc/but.h
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-/*
- * Copyright (c) 1985 AT&T
- * All Rights Reserved
- */
-
-#ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.1 */
-
-#include "mio.h"
-
-#define ANY 99 /* same as in io.h, but don't want to include it all */
-
-#define RESTART (LBUT)
-#define DONE (LBUT-1)
-#define MORE (LBUT-2)
-#define PRE (LBUT-3)
-#define BUT1 (FBUT)
-#define BUT2 (FBUT+1)
-#define BUT3 (FBUT+2)
-#define BUT4 (FBUT+3)
-#define BUT5 (FBUT+4)
-#define BUT6 (FBUT+5)
-#define BUT7 (FBUT+6)
-#define BUT1R (LBUT-6)
-#define BUT2R (LBUT-5)
-#define BUT3R (LBUT-4)
-#define BUT4R (LBUT-3)
-#define BUT5R (LBUT-2)
-#define BUT6R (LBUT-1)
-#define BUT7R (LBUT)
-
-#define LABLEN_1 (11)
-#define LABLEN_2 (14)
diff --git a/usr/src/cmd/fmli/inc/color_pair.h b/usr/src/cmd/fmli/inc/color_pair.h
deleted file mode 100644
index 53fd760232..0000000000
--- a/usr/src/cmd/fmli/inc/color_pair.h
+++ /dev/null
@@ -1,81 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-/*
- * Copyright (c) 1986 AT&T
- * All Rights Reserved
- */
-#ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.7 */
-
-/*
- * NOTE:
- *
- * If the terminal does not support more than 7 color pairs
- * then pairs 8 and greater will be ignored
- * (The hp color terminal is one such terminal that only supports 7
- * color pairs)
- */
-
-/* definable color pairs */
-#define NUMDEFPAIRS 11
-
-#define WINDOW_PAIR 1
-#define ACTIVE_TITLE_PAIR 2
-#define INACTIVE_TITLE_PAIR 3
-#define ACTIVE_BORD_PAIR 4
-#define INACTIVE_BORD_PAIR 5
-#define BANNER_PAIR 6
-#define BAR_PAIR 7
-#define SLK_PAIR 8
-#define ACTIVE_SCROLL_PAIR 9
-#define INACTIVE_SCROLL_PAIR 10
-#define FIELD_PAIR 11
-
-/* number of default colors and maximum total colors */
-#define NUMDEFCOLORS 8
-#define MAXCOLORS 64
-#define MAXCOLPAIRS 64
-
-extern int Color_terminal; /* is the terminal a color terminal */
-extern int Border_colors_differ; /* do active/inactive border colors differ? */
-extern int Pair_set[MAXCOLPAIRS]; /* is color pair set ? */
-
-/*
- * If the color pair is greater than the number of COLOR_PAIRS ...
- * or the color pair is not set by the application ...
- * then expand to JUST the video attribute ...
- * else expand to JUST the color attribute ...
- */
-#define CHK_PAIR(vid, col) \
- ((col > COLOR_PAIRS) || !Pair_set[col] ? vid : COLOR_PAIR(col))
-
-/*
- * If the terminal is a color device ...
- * AND there are more color pairs then 7 ...
- * then expand to CHK_PAIR(vid, col) ...
- * else expand to vid
- */
-#define COL_ATTR(vid, col) \
- ((Color_terminal == TRUE) && COLOR_PAIRS >= 7 ? CHK_PAIR(vid, col) :vid)
diff --git a/usr/src/cmd/fmli/inc/ctl.h b/usr/src/cmd/fmli/inc/ctl.h
deleted file mode 100644
index c09391a586..0000000000
--- a/usr/src/cmd/fmli/inc/ctl.h
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-/*
- * Copyright (c) 1985 AT&T
- * All Rights Reserved
- *
- */
-
-#ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.8 */
-
-#define CTGETVT 1
-#define CTGETPID 2
-#define CTSETPID 3
-#define CTGETPOS 4
-#define CTSETPOS 5
-#define CTGETSIZ 6
-#define CTSETSIZ 7
-#define CTGETSTRT 8
-#define CTSETSTRT 9
-#define CTSETLIM 10
-#define CTGETCUR 11
-#define CTGETWDW 12
-#define CTSETWDW 13
-#define CTGETITLE 14
-#define CTSETITLE 15
-#define CTGETARG 16
-#define CTSETARG 17
-#define CTSETATTR 18
-#define CTSETPARROWS 19
-#define CTSETSARROWS 20
-#define CTHIDE 21
-#define CTSETDIRTY 22
-#define CTSETLIFE 23
-#define CTISDEST 24
-#define CTGETPARMS 25
-#define CTSETPARMS 26
-#define CTSETSHAPE 27
-#define CTSETPAGE 28
-#define CTGETLIST 29
-#define CTGETINTR 30
-#define CTSETINTR 31
-#define CTGETONINTR 32
-#define CTSETONINTR 33
-#define CTSETMSG 34
-#define CTCLEARWIN 35
-#define CTGETDESCRIPTION 36
diff --git a/usr/src/cmd/fmli/inc/detabdefs.h b/usr/src/cmd/fmli/inc/detabdefs.h
deleted file mode 100644
index 6f8780a400..0000000000
--- a/usr/src/cmd/fmli/inc/detabdefs.h
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-/*
- * Copyright (c) 1985 AT&T
- * All Rights Reserved
- */
-
-#ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.1 */
-
-/* Note: this file created with tabstops set to 4.
- *
- * Definitions for the Object Detection Function Table (ODFT, pronounced
- * "oddfoot"). On of these will exist per system, and it defines a set
- * of functions which can be used to detect objects on the system.
- */
-
-#define MAXMAGIC 256 /* max num of magic numbers detectable*/
-#define MAXODFT 50 /* max detect functions */
-
-#define IDF_ZLASC 0
-#define IDF_ASC 1
-#define IDF_PCTRANS 2
-#define IDF_TRANS 3
-#define IDF_CORE 4
-#define IDF_ARCH 5
-#define IDF_ENCRYPT 6
-/* 7 is not used now */
-#define IDF_UNKNOWN 8
-#define IDF_MAIL_IN 9
-#define IDF_MAIL_OUT 10
-
-struct odft_entry {
- char objtype[OTYPESIZ]; /* the object this detects */
- char *defodi; /* default odi */
- long defmask; /* addition to the mask when detected*/
- int func_type; /* what kind of function */
- int intern_func; /* index into internal function table*/
- char *extern_func; /* name of a unix program to detect */
- long *magic_offset; /* offset into file of magic number*/
- char *magic_bytes; /* byte of the magic number */
-};
diff --git a/usr/src/cmd/fmli/inc/eval.h b/usr/src/cmd/fmli/inc/eval.h
deleted file mode 100644
index e441cee474..0000000000
--- a/usr/src/cmd/fmli/inc/eval.h
+++ /dev/null
@@ -1,83 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-/*
- * Copyright (c) 1986 AT&T
- * All Rights Reserved
- *
- */
-
-#ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.3 */
-
-#define EV_TOKEN 0x20
-#define EV_GROUP 0x40
-#define EV_USE_STRING 0x80
-#define EV_USE_FP 0x100
-#define EV_READONLY 0x200
-#define EV_APPEND 0x400
-#ifndef EV_SQUIG /* must match EV_SQUIG in oh/fm_mn_par.h */
-#define EV_SQUIG 0x8000 /* set when {} are special in a descriptor */
-#endif /* careful.. flag is flipped in eval() */
-
-typedef struct io_struct {
- int flags;
- union {
- FILE *fp;
- struct {
- char *val;
- int count;
- int pos;
- } str;
- } mu;
- struct io_struct *next;
-} IOSTRUCT;
-
-int eval();
-int io_close();
-IOSTRUCT *io_open();
-char *io_string();
-char *io_ret_string();
-
-/* eval TOKENS (see spchars in eval.c) */
-#define ET_EOF 0
-#define ET_WORD 1
-#define ET_DQUOTE 2
-#define ET_SQUOTE 3
-#define ET_BSLASH 4
-#define ET_BQUOTE 5
-#define ET_DOLLAR 6
-#define ET_NEWLINE 7
-#define ET_SPACE 8
-#define ET_TAB 9
-#define ET_OSQUIG 10
-#define ET_CSQUIG 11
-#define ET_PIPE 12
-#define ET_AMPERSAND 13
-#define ET_SEMI 14
-#define ET_LTHAN 15
-#define ET_GTHAN 16
-#define ET_TWO 17
-
-#define DOUBLE 32 /* must be a power of 2 > largest TOKEN above */
diff --git a/usr/src/cmd/fmli/inc/exception.h b/usr/src/cmd/fmli/inc/exception.h
deleted file mode 100644
index c1c0d3583b..0000000000
--- a/usr/src/cmd/fmli/inc/exception.h
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-/*
- * Copyright (c) 1985 AT&T
- * All Rights Reserved
- */
-
-#ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.3 */
-
-/* include in .c file not in header file abs 9/13/88
-#include <termio.h>
-#define _SYS_TERMIO_H
-*/
-extern struct termio Echo;
-extern struct termio Noecho;
-extern int Echoit;
-
-#define echo() (Echoit = TRUE)
-#define noecho() (Echoit = FALSE)
-#define restore_tty() (Echo.c_cflag ? ioctl(0, TCSETAW, &Echo) : -1)
-
-#define LCKPREFIX ".L"
diff --git a/usr/src/cmd/fmli/inc/form.h b/usr/src/cmd/fmli/inc/form.h
deleted file mode 100644
index 2bc071cdaa..0000000000
--- a/usr/src/cmd/fmli/inc/form.h
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-/*
- * Copyright (c) 1985 AT&T
- * All Rights Reserved
- *
- */
-
-#ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.4 */
-
-typedef struct {
- char *name; /* contents of "name" descriptor */
- char *value; /* contents of "value" descriptor */
- int frow; /* contents of "frow" descriptor */
- int fcol; /* contents of "fcol" descriptor */
- int nrow; /* contents of "nrow" descriptor */
- int ncol; /* contents of "ncol" descriptor */
- int rows; /* contents of "rows" descriptor */
- int cols; /* contents of "cols" descriptor */
- int flags; /* flags set according to the values of
- "field related" boolean descriptors
- (scroll, edit, etc. see winp.h) */
- char **ptr; /* object dependent pointer to low
- level field structure (ifield) */
-} formfield;
-
-struct form {
- formfield (*display)(); /* display function of object */
- char * argptr; /* (object dependent) arg passed "display" */
- vt_id vid; /* virtual terminal number */
- int curfldnum; /* current field num */
- int flags; /* misc. flags (listed below) */
- int rows; /* number of rows in form */
- int cols; /* number of columns in form */
-};
-
-#define FORM_USED 1
-#define FORM_DIRTY 2 /* contents of form changed */
-#define FORM_ALLDIRTY 4 /* form has been reshaped or moved */
-
-extern form_id FORM_curid;
-extern struct form *FORM_array;
diff --git a/usr/src/cmd/fmli/inc/ifuncdefs.h b/usr/src/cmd/fmli/inc/ifuncdefs.h
deleted file mode 100644
index 07d708c056..0000000000
--- a/usr/src/cmd/fmli/inc/ifuncdefs.h
+++ /dev/null
@@ -1,163 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-/*
- * Copyright (c) 1985 AT&T
- * All Rights Reserved
- */
-
-#ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.1 */
-
-/** This include file contains the indices of the internal object functions
- ** in the table of object functions. It could also be used to make an
- ** externally defined oot more readable, since many of the internal functions
- ** could be used in such a table.
- **/
-
-/* general operations which pertain to most objects */
-
-#define IF_VI 0 /* viewing init function */
-#define IF_SH 1 /* selection handler */
-#define IF_CP 2 /* copy */
-#define IF_RN 3 /* rename */
-#define IF_MV 4 /* move */
-#define IF_SC 5 /* scramble */
-#define IF_UNSC 6 /* unscramble */
-#define IF_RM 7 /* remove */
-#define IF_ML 8 /* mail */
-#define IF_VF 9 /* view full screen */
-#define IF_UNRM 10 /* undelete */
-#define IF_SP 11 /* check spelling */
-
-/* read only functions */
-#define IF_CPOF 16 /* copy to office files */
-/* install functions */
-#define IF_INST 18 /* install for news/info */
-
-/* operations pertaining to directories */
-
-#define IF_DED 21 /* directory open */
-#define IF_DVI 22 /* directory viewing init */
-#define IF_DSH 23 /* directory selection handler */
-#define IF_DEX 24 /* directory exit function */
-#define IF_DCR 25 /* directory creation function */
-#define IF_DRM 26 /* directory deletion function */
-#define IF_DRN 27 /* directory rename function */
-#define IF_DUNRM 28 /* directory undelete function */
-#define IF_DCRDIR 29 /* directory create for browse */
-#define IF_DPL 30 /* directory place it here function */
-#define IF_DSEL 31 /* directory selection for browsing */
-#define IF_DBU 32 /* directory backup for browsing */
-#define IF_DMV 33 /* directory move */
-#define IF_DCP 34 /* directory copy */
-
-/* operations which are specific to mail directories */
-
-#define IF_MDVI 37 /* mail directory viewing init */
-#define IF_MDSH 38 /* mail directory selection handler */
-#define IF_MDEX 39 /* mail directory exit function */
-
-/* operations which are specific to ascii files */
-
-#define IF_AEX 43 /* ascii exit */
-#define IF_ACV 44 /* ascii convert for viewing*/
-#define IF_APR 45 /* ascii print */
-#define IF_AED 46 /* ascii edit */
-
-/* operations which are specific to MAIL_IN objects */
-
-#define IF_MICV 50 /* mail_in convert to viewable */
-#define IF_MIVI 51 /* mail_in view init */
-#define IF_MISH 52 /* mail_in selection handler */
-#define IF_MIEX 53 /* mail_in exit function */
-#define IF_MISAVE 54 /* mail_in save */
-#define IF_MIFILE 55 /* mail_in file a message */
-#define IF_MIPRINT 56 /* mail_in print */
-#define IF_MIREPLY 57 /* mail_in reply */
-#define IF_MIFORWARD 58 /* mail_in annotate and forward */
-#define IF_MIDIAL 59 /* mail_in dial number */
-#define IF_MIRESEND 60 /* mail_in resend message */
-
-/* operations which are specific to XED_5.028 objects */
-
-#define IF_XEX 64 /* exit function */
-#define IF_XCV 65 /* convert for viewing */
-#define IF_XED 66 /* edit */
-#define IF_XPR 67 /* print */
-
-/* operations which are specific to Structured Files */
-
-#define IF_SEX 71 /* exit function */
-#define IF_SCV 72 /* convert for viewing */
-#define IF_SED 73 /* edit (modify) */
-#define IF_SPR 74 /* print */
-
-/* operations which are specific to MAIL_OUT objects */
-
-#define IF_MOVI 78
-#define IF_MOEX 79
-#define IF_MOCV 80
-#define IF_MOSUBJ 81
-#define IF_MOADDR 82
-#define IF_MOSEND 83
-#define IF_MOSA 84
-#define IF_MOSR 85
-#define IF_MOPRINT 86
-#define IF_MOEDIT 87
-#define IF_MOSPELL 88
-#define IF_MOBROWSE 89
-#define IF_MOBCC 90
-
-/* operations which are specific to Unknown objects */
-
-#define IF_UCV 91 /* unknown convert to viewing*/
-#define IF_UEX 92 /* unknown object exit function */
-
-/* operations which are specific to executables */
-
-#define IF_EED 93
-#define IF_EXVI 94
-
-/* operations specific to form objects */
-
-#define IF_FRMOPEN 96
-
-/* operations specific to menu objects */
-
-#define IF_MENOPEN 97
-#define IF_MENVI 98
-#define IF_MENSH 99
-
-/* operations specific to text objects */
-
-#define IF_HLPOPEN 100
-
-/* operations specific to ultracalc */
-
-#define IF_ULED 101
-
-#define IF_BADFUNC 104
-
-#define MAX_IFUNCS 105 /* maximum number of internal functions */
diff --git a/usr/src/cmd/fmli/inc/interrupt.h b/usr/src/cmd/fmli/inc/interrupt.h
deleted file mode 100644
index 63ba9a712b..0000000000
--- a/usr/src/cmd/fmli/inc/interrupt.h
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-/* defines and data structures for interrupt feature */
-/*
- * Copyright (c) 1988 AT&T
- * All Rights Reserved
- */
-#ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.1 */
-
-
-#define DEF_ONINTR "`message Operation interrupted!`NOP"
-
-#ifndef TYPE_BOOL
-/* curses.h also does a typedef bool */
-#ifndef _CURSES_H
-#define TYPE_BOOL
-typedef char bool;
-#endif
-#endif
-
-extern struct {
- bool interrupt;
- char *oninterrupt;
- bool skip_eval;
-} Cur_intr;
diff --git a/usr/src/cmd/fmli/inc/io.h b/usr/src/cmd/fmli/inc/io.h
deleted file mode 100644
index cbcddeb671..0000000000
--- a/usr/src/cmd/fmli/inc/io.h
+++ /dev/null
@@ -1,88 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-/*
- * Copyright (c) 1985 AT&T
- * All Rights Reserved
- */
-
-#ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.3 */
-
-/*#include <stdio.h>*/
-#include "mio.h"
-#include "mess.h"
-
-#define STR_SIZE 512
-#define ANY 99
-#define DV 87 /* dummy var for exit code */
-
-#ifndef YES
-#define YES 1
-#endif
-
-#ifndef NO
-#define NO 0
-#endif
-
-#define FILENO 7
-#define FILECOUNT 10
-#define ISDIR 99
-#define ISFILE 88
-#define RESTART LBUT
-#define DONE LBUT-1
-#define MORE LBUT-2
-#define PRE LBUT-3
-#define BUT1 FBUT
-#define BUT2 FBUT+1
-#define BUT3 FBUT+2
-#define BUT4 FBUT+3
-#define BUT5 FBUT+4
-#define BUT1R LBUT-6
-#define BUT2R LBUT-5
-#define BUT3R LBUT-4
-#define CRYPT 70
-#define RECRYPT 90
-#define REG 64
-#define FULL 65
-#define STRUCT 66
-#define BOTTOMLEVEL 4
-#define GCOUNT 9
-
-#define PROCESS 0
-#define THROW_OUT -1
-#define EDIT -2
-#define MAXPGS 102
-
-
-#define NOTSET 0
-#define ENDDOC 1
-#define ASCII 2
-
-char *ctime();
-
-#ifndef MAIL
-#define NEWS 16
-#define MAIL 17
-#endif
diff --git a/usr/src/cmd/fmli/inc/mail.h b/usr/src/cmd/fmli/inc/mail.h
deleted file mode 100644
index 31848fc954..0000000000
--- a/usr/src/cmd/fmli/inc/mail.h
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-/*
- * Copyright (c) 1985 AT&T
- * All Rights Reserved
- */
-
-#ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.1 */
-
-/* Structures and constants for sendmail.c (and maybe readmail.c) */
-
-#define ADDRESS 'T' /* label types */
-#define ALIASES 'A'
-#define DIRECT 'D'
-
-#define DONE_ADDR FBUT+7
-#define DONE_VERIFY FBUT+8
-
-#define NOTFOUND -1
-#define FOUND 0
-
-#define BINMAIL 0 /* codes for which mailer to use */
-#define POST 1
-
-#define EM 0 /* return codes for input format */
-#define NAME 1
-#define PAPER 2
-#define XED 0
diff --git a/usr/src/cmd/fmli/inc/menu.h b/usr/src/cmd/fmli/inc/menu.h
deleted file mode 100644
index acfc05ab46..0000000000
--- a/usr/src/cmd/fmli/inc/menu.h
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-/*
- * Copyright (c) 1986 AT&T
- * All Rights Reserved
- *
- */
-
-#ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.1 */
-
-struct menu {
- struct menu_line (*disp)();
- char *arg;
- vt_id vid;
- int flags;
- int index; /* current item */
- int hcols; /* # of chars highlighted */
- int topline; /* top line displayed */
- int number; /* number of items */
- /* max length of highlight and description parts */
- int hwidth;
- int dwidth;
- /* multi-column parameters */
- int ncols;
-};
-
-#define MENU_DIRTY 1
-#define MENU_USED 2
-#define MENU_CENTER 4
-#define MENU_NONUMBER 8
-#define MENU_MSELECT 16
-#define MENU_TRUNC 32 /* no room for description; show elipses */
-#define ALL_MNU_FLAGS 63
-#define MENU_ALL 1000 /* max number of chars to highlight on line */
-
-extern struct menu *MNU_array;
-extern menu_id MNU_curid;
diff --git a/usr/src/cmd/fmli/inc/menudefs.h b/usr/src/cmd/fmli/inc/menudefs.h
deleted file mode 100644
index af2ad23ece..0000000000
--- a/usr/src/cmd/fmli/inc/menudefs.h
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-/*
- * Copyright (c) 1985 AT&T
- * All Rights Reserved
- *
- */
-#ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.3 */
-
-#define MENU_UNDEFINED (-1)
-#define MENU_MRK (1)
-#define MENU_INACT (2)
-
-struct menu_line {
- char *highlight;
- char *lininfo;
- char *description;
- short flags;
-};
diff --git a/usr/src/cmd/fmli/inc/mess.h b/usr/src/cmd/fmli/inc/mess.h
deleted file mode 100644
index ff3e9d4a33..0000000000
--- a/usr/src/cmd/fmli/inc/mess.h
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-/*
- * Copyright (c) 1985 AT&T
- * All Rights Reserved
- */
-
-#ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.1 */
-
-#define MYMWH 1
-#define MYDWC 2
-#define GPROB 3
-
-#define INEPIC 0
-#define INSHELL 1
-#define INBACK 2
diff --git a/usr/src/cmd/fmli/inc/message.h b/usr/src/cmd/fmli/inc/message.h
deleted file mode 100644
index 0fc123f2fb..0000000000
--- a/usr/src/cmd/fmli/inc/message.h
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-/*
- * Copyright (c) 1985 AT&T
- * All Rights Reserved
- *
- */
-
-#ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.4 */
-
-extern int Mess_lock;
-#define mess_lock() (Mess_lock++)
-#define mess_unlock() (Mess_lock = 0)
-#define MESSIZ (256) /* that should be wider than any screen */
diff --git a/usr/src/cmd/fmli/inc/mio.h b/usr/src/cmd/fmli/inc/mio.h
deleted file mode 100644
index 7d075baac3..0000000000
--- a/usr/src/cmd/fmli/inc/mio.h
+++ /dev/null
@@ -1,85 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-/*
- * Copyright (c) 1985 AT&T
- * All Rights Reserved
- */
-
-#ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.2 */
-
-#ifndef CONT
-/* compatibility w/ getok */
-union tok
-{
- char *s;
- int b;
-};
-#endif
-
-
-#define CONT -1
-#define BACK -2
-#define BPAINT -3
-
-#define CBUT 0 /* for wcntrl only */
-#define STR 1
-#define ABUT 2 /* button reports */
-#define VBUT 4
-#define SBUT 6
-#define CMD_KEY 8 /* only for objhandler */
-#define SCREPAINT 15
-
-/* flags (to be or'ed with window) */
-#define CCP 01000 /* current cursor position */
-#define INV 02000 /* inverse video */
-
-/* windows for wprintf */
-#define FBUT 0
-#define LBUT 13
-#define TTL 15
-/* NOTE: MAIL and NEWS are BUTTON numbers, MAIL_WIN and NEWS_WIN are WINDOW
- numbers - if they are ever changed to not coincide, some poor soul had
- better go through all the code and change all the MAIL and NEWS's to
- MAIL_WIN and NEWS_WIN as appropriate */
-#define MAIL_WIN 17
-#define MAIL 17
-#define NEWS_WIN 16
-#define NEWS 16
-#define DWH 18
-#define MWH 19
-#define CLBUT 20
-#define CRBUT 21
-#define DWC (DWH | CCP)
-#define MWC (MWH | CCP)
-
-#define BBUT0 16
-#define BBUT1 17
-/* modes for enhancement of display */
-#define BONW 7
-#define WONB 0
-#define MESS_PGLAB 0
-#define MESS_LAB 1
-#define MESS_WAIT 2
diff --git a/usr/src/cmd/fmli/inc/moremacros.h b/usr/src/cmd/fmli/inc/moremacros.h
deleted file mode 100644
index b6d3493dc0..0000000000
--- a/usr/src/cmd/fmli/inc/moremacros.h
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-/****************************************************************************
-*
-* MACRO's replacing 1 line functions
-*
-****************************************************************************/
-
-#ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.3 */
-
-extern char *strnsave();
-#define strsave(s) ((s) ? strnsave(s, strlen(s)) : NULL )
-
-extern struct actrec *AR_cur;
-#define ar_get_current() AR_cur
-
-extern char **Altenv;
-extern char *getaltenv();
-extern void copyaltenv();
-extern int delaltenv();
-extern int putaltenv();
-#define getAltenv(name) getaltenv(Altenv, name)
-#define copyAltenv(an_env) copyaltenv(an_env, &Altenv)
-#define delAltenv(name) delaltenv(&Altenv, name)
-#define putAltenv(str) putaltenv(&Altenv, str)
diff --git a/usr/src/cmd/fmli/inc/obj.h b/usr/src/cmd/fmli/inc/obj.h
deleted file mode 100644
index 2eca7627e6..0000000000
--- a/usr/src/cmd/fmli/inc/obj.h
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-/*
- * Copyright (c) 1985 AT&T
- * All Rights Reserved
- */
-
-#ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.1 */
-
-#define ON 1
-#define OFF 0
-/* the following are the defines for the hard-coded columns of the OOT */
-#define OF_VI 0 /* view init function */
-#define OF_SH 1 /* selection handler function */
-#define OF_EX 2 /* exit function */
-#define OF_MV 3 /* make viewable function */
-#define OF_OPEN 4 /* default action (open) */
-
-#define PROMPT (-4)
-#define REINIT (-5)
-#define BACKUP 3
-#define REPAINT 4
-#define OBJECT 5
-#define REREAD 6
-#define NOPAINT 7
-#define NOOBJECT 8
-
-#define MAX_LABELS 12
-
-#define SAME_OBJECT 1
-#define DIFF_OBJECT 2
-#define FILE_PARENT 3
-#define DIR_PARENT 4
-
-/* flags for make_object */
-#define NOFORCE (0x1)
-#define FORCE (0x2)
-#define PARENT (0x4)
-
-struct label {
- struct operation *oper;
- int number;
-};
diff --git a/usr/src/cmd/fmli/inc/optabdefs.h b/usr/src/cmd/fmli/inc/optabdefs.h
deleted file mode 100644
index bca96cf594..0000000000
--- a/usr/src/cmd/fmli/inc/optabdefs.h
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-/*
- * Copyright (c) 1985 AT&T
- * All Rights Reserved
- */
-
-#ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.1 */
-
-/* Note: this file created with tabstops set to 4.
- *
- * Definitions for the Object Operations Table (OOT). One exists
- * per system, and it defines all the available object operations by
- * OEH number.
- */
-
-#define OPERNAMESIZ 15 /* size of an operation's name */
-
-#define MAX_TYPES 12 /* maximum number of object types in-core */
-#define MAX_OPERS 22 /* maximum number of operations per object */
-
-#define NOBUT -1 /* function not on a label */
-
-/* The following defines are for the func_type field */
-
-#define F_NOP 0x01 /* no operation required */
-#define F_ILL 0x02 /* illegal operation */
-#define F_NULL 0x03 /* null operation, end of operations */
-#define F_INT 0x04 /* internal operation */
-#define F_SHELL 0x05 /* fork with shell */
-#define F_EXEC 0x06 /* fork with no shell */
-#define F_PARTS 0x07 /* internal parts function (for heuristics) */
-#define F_DPARTS 0x08 /* internal directory parts function (ditto) */
-#define F_MAGIC 0x09 /* magic number detection (ditto) */
-
-/* the following defines are for the op_type field */
-
-#define OP_SNG 0x01 /* single argument */
-#define OP_NEW 0x02 /* new object name */
-#define OP_BUT 0x04 /* last label the user selected */
-#define OP_DIR 0x08 /* existing directory name */
-#define OP_OLD 0x10 /* existing file */
-#define OP_CUR 0x20 /* existing item in CURRENT dir */
-
-struct operation {
- char *opername; /* operation name */
- int but; /* label it goes on */
- int func_type; /* kind of function */
- int intern_func; /* internal function index */
- char *extern_func; /* external function name */
- int op_type; /* operation type */
- bool multiple; /* true/false value */
- long all_mask; /* function available only if all present*/
- long none_mask; /* function available only if none present*/
- char *perms; /* permissions */
-};
diff --git a/usr/src/cmd/fmli/inc/parse.h b/usr/src/cmd/fmli/inc/parse.h
deleted file mode 100644
index 17a1cee33c..0000000000
--- a/usr/src/cmd/fmli/inc/parse.h
+++ /dev/null
@@ -1,131 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-/*
- * Copyright (c) 1985 AT&T
- * All Rights Reserved
- */
-
-#ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.1 */
-
-#ifndef MALLOC
-#include <malloc.h>
-#endif
-
-#define MAXATTS 10
-#define dumpstr(a, b) fputs((b) ? (b) : "", (a)); fputs("\n", (a))
-#define nicestr(a) (a) ? (a) : ""
-#define LOWER(a) (isupper(a) ? _tolower(a) : (a))
-#define readnum(fp, num, buf) fgets((buf), STR_SIZE, (fp)); *(num) = atol(buf)
-#define readsave(fp, str, buf) *(str) = fgets((buf), STR_SIZE, (fp)); buf[strlen(buf) - 1] = '\0'; *(str) && *(buf) ? (*(str) = strsave(buf)) : (*(str) = NULL)
-#define readput(fp, str) fgets((str), STR_SIZE, (fp)); (str)[strlen((str)) - 1] = '\0'
-#define dumpnum(fp, num) fprintf((fp), "%d\n", (num))
-#define FREE 0
-#define NOFREE 1
-#define REPLY 1
-#define ATTHEAD 1
-#define STATHEAD 2
-#define MAILHEAD 4
-#define CONHEAD 8
-#define NOFUNCS 4
-#define STACK_SIZE 5
-#define DATESIZE 32
-#define ADDON 0
-#define FILL 1
-#define INBOX "/IN_BOX"
-#undef STR_SIZE
-#define STR_SIZE 256
-#define ADDRSIZE 50
-#define WORD 1
-#define KEYWORD 2
-#define NOTKEY 4
-#define PDONE 3
-#define SOMETHING 1
-#define RECEIPT 2
-#define BUSINESS 4
-#define URGENT 8
-#define PRIORITY 16
-#define SKIP 1
-#define NOSKIP 2
-#define STATUS 1
-#define READ_HEADER 0
-#define NUM_CHECK 1
-#define UNPACK 2
-#define OEH_BAD 0x01
-#define PART_BAD 0x02
-#define OBJ_UNK 0x04
-#define ENC_BAD 0x08
-#define OEH_NOT 0x10
-#define OBJ_OEU 0x20
-
-struct oeh {
- char *num;
- char *type;
- char *name;
- char *encrytest;
- int count;
- char *file;
-};
-
-struct addr {
- char info[STR_SIZE];
- char addr[ADDRSIZE];
- int mask;
- struct addr *next;
-};
-
-struct ucmfhead {
- char *file;
- int status;
- struct addr *ufrom;
- struct addr *from;
- struct addr *cc;
- long conlen;
- char *phone;
- char *contype;
- int defopt;
- char *enc;
- char *date;
- char *expire;
- char *import;
- char *kwd;
- int curatt;
- int mset;
- char *mts;
- struct addr *bcc;
- char *origdate;
- char *subj;
- struct addr *replyto;
- char *replyid;
- struct addr *sender;
- char *sens;
- int noatts;
- int flags;
- struct oeh *atts[MAXATTS];
- struct addr *to;
-};
-#define RP_SET 1
-#define RP_UNSET 2
-#define RP_USE 3
diff --git a/usr/src/cmd/fmli/inc/partabdefs.h b/usr/src/cmd/fmli/inc/partabdefs.h
deleted file mode 100644
index 5cf5a375ef..0000000000
--- a/usr/src/cmd/fmli/inc/partabdefs.h
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-/*
- * Copyright (c) 1985 AT&T
- * All Rights Reserved
- */
-
-#ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.2 */
-
-/* Note: this file created with tabstops set to 4.
- *
- * Definitions for the Object Parts Table (OPT). One of these tables
- * will exist per system, and defines the different parts of different
- * objects.
- */
-
-#define PNAMESIZ (256) /* size of a part name should = FILE_NAME_SIZ */
-#define MAXOBJPARTS 11 /* max parts a single object can have */
-#define MAXPARTS (24+MAXOBJPARTS) /* max number of parts for all objects */
-
-#define PRT_FILE 0x01 /* the part is a file */
-#define PRT_DIR 0x02 /* the part is a directory */
-#define PRT_OPT 0x04 /* the part is optional */
-#define PRT_BIN 0x08 /* the part is binary */
-#define PRT_OEU 0x10 /* the part is an oeu */
-
-struct one_part {
- char part_name[PNAMESIZ]; /* registered part name*/
- char part_template[PNAMESIZ]; /* template for the name */
- int part_flags; /* physical part characteristics */
-};
-
-struct opt_entry {
- char objtype[OTYPESIZ]; /* object type name */
- char objdisp[OTYPESIZ]; /* display name for the object */
- long int_class; /* internal Telesystem class */
- char *oeu; /* registered oeu name */
- char *objformat; /* registered format name */
- char *objapp; /* registered creating application */
- char *objprod; /* registered product id */
- char *objclass; /* registered object classification */
- int part_offset; /* first part in Parts list */
- int numparts; /* number of parts used */
- int info_type; /* type of the info_func program, if any*/
- int info_int; /* index of the internal info func */
- char *info_ext; /* characters of the external info func */
-};
diff --git a/usr/src/cmd/fmli/inc/procdefs.h b/usr/src/cmd/fmli/inc/procdefs.h
deleted file mode 100644
index 848ae33c14..0000000000
--- a/usr/src/cmd/fmli/inc/procdefs.h
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-/*
- * Copyright (c) 1985 AT&T
- * All Rights Reserved
- */
-
-#ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.1 */
-
-typedef int proc_id;
-
-/* arguments for the flags field of the process open calls */
-
-#define PR_NOPROMPT (1) /* never prompt the user on proc termination */
-#define PR_ERRPROMPT (2) /* only prompt if nonzero exit code from proc */
-#define PR_CLOSING (4) /* process must end */
diff --git a/usr/src/cmd/fmli/inc/retcds.h b/usr/src/cmd/fmli/inc/retcds.h
deleted file mode 100644
index 04f905a71f..0000000000
--- a/usr/src/cmd/fmli/inc/retcds.h
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-/*
- * Copyright (c) 1985 AT&T
- * All Rights Reserved
- */
-
-#ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.1 */
-
-#define R_OK 0
-#define R_BROKEN 42
-#define R_ERR 0377
-#define R_RESTART 17
-#define R_RMAIL 19
-#define R_RNEWS 23
-#define R_NOPAINT 29
diff --git a/usr/src/cmd/fmli/inc/retcodes.h b/usr/src/cmd/fmli/inc/retcodes.h
deleted file mode 100644
index 8249ce026d..0000000000
--- a/usr/src/cmd/fmli/inc/retcodes.h
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-/*
- * Copyright (c) 1985 AT&T
- * All Rights Reserved
- *
- */
-
-#ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.2 */
-
-#define R_OK 0
-#define R_ERR 1
-/* exit code 2 used by sys/expr.c:yyerror() should become a define */
-#define R_BAD_CHILD 3
diff --git a/usr/src/cmd/fmli/inc/sizes.h b/usr/src/cmd/fmli/inc/sizes.h
deleted file mode 100644
index acef988a00..0000000000
--- a/usr/src/cmd/fmli/inc/sizes.h
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-/*
- * Copyright (c) 1985 AT&T
- * All Rights Reserved
- */
-#ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.2 */
-
-#ifndef _CURSES_H
- extern int COLS;
-#endif
-#define RESERVED_LINES (3) /* banner + message + command lines */
-#define FIXED_TITLE (6) /* max overhead for frame no. + border */
-#define FIXED_COLS (4) /* overhead for frame border + margin */
-#define MAX_TITLE (COLS - FIXED_TITLE) /* longest frame title */
-#define MESS_COLS (COLS - 1) /* longest message line */
-#define FILE_NAME_SIZ (256) /* length +1 of longest file name */
-#define PATHSIZ (1024) /* length +1 of longest UNIX path name */
-#define MAX_WIDTH (256) /* the widest screen possibly supported *
- * used for allocating string buffers *
- * that are then limited by the real *
- * screen width or other constraints. */
-#define TRUNCATE_STR ("...") /* str to indicate desc. was truncated */
-#define LEN_TRUNC_STR (3) /* length of above string, TRUNCATE_STR */
diff --git a/usr/src/cmd/fmli/inc/slk.h b/usr/src/cmd/fmli/inc/slk.h
deleted file mode 100644
index 0a38b8e4a9..0000000000
--- a/usr/src/cmd/fmli/inc/slk.h
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-/*
- * Copyright (c) 1985 AT&T
- * All Rights Reserved
- */
-
-#ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.3 */
-
-struct slk {
- char *label;
- token tok;
- char *tokstr;
- char *intr;
- char *onintr;
-};
-
-#define MAX_SLK 16
diff --git a/usr/src/cmd/fmli/inc/smdef.h b/usr/src/cmd/fmli/inc/smdef.h
deleted file mode 100644
index a96608fc0c..0000000000
--- a/usr/src/cmd/fmli/inc/smdef.h
+++ /dev/null
@@ -1,127 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-/*
- * Copyright (c) 1985 AT&T
- * All Rights Reserved
- */
-
-#ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.6 */
-
-struct atom {
- struct atom *next;
- char *address;
- char *info;
-};
-
-struct supalias {
- int spec;
- int where;
- char *lname;
- char *fname;
- struct atom *atom_list;
- struct supalias *next;
- struct supalias *pre;
-};
-
-#define ATOM struct atom
-#define SEPARATOR ':'
-#define SEMI ';'
-#define MAXADDRS 1024
-
-#ifndef TYPE_BOOL
-/* curses.h also does a typedef bool */
-#ifndef _CURSES_H
-#define TYPE_BOOL
-typedef char bool;
-#endif
-#endif
-
-#ifndef TRUE
-#define TRUE 1
-#define FALSE 0
-#endif
-#define SUBJECT 1
-#define ADDRS 2
-#define NOSTORE 4
-#define EDITED 8
-#define CALL 16
-#define READIN 32
-#define AUTOSEND 64
-
-#define alloc(Q) (Q *) calloc(1, sizeof(Q))
-
-#define SEPLINE ":::::::::::::::::::::::::::::::::::::::::::::::"
-/*#define EPICSEND 1*/
-/*#define POSTSEND 0*/
-#define TO 1 /* TO field */
-#define CC 2 /* CC field */
-#define BEGIN 1
-#define NEXT 2
-#define PRV 3
-#define PNUM 4
-/*#define EMPFAIL -1*/
-#define CALLMEMO 0
-#define SENDMAIL 1
-#define CALENDAR 2
-#define FIND 3
-#define REPLY 1
-#define RET_RECEIPT 2
-#define MAXSUB 300
-#define MAXATTS 10
-struct msg_head { /* message header structure */
- char *filename;
- char *linkname;
- FILE *fp;
- struct supalias to[1];
- struct supalias cc[1];
- struct supalias bc[1];
- char subj[MAXSUB];
- char *msg_type;
- struct oeh atts[MAXATTS];
- int noatts;
- char *phone;
- char *mark;
- char *caller;
- int rec;
- char *mailto;
- char *paperto;
- char *replyid;
- time_t send_time; /* EFT abs k16 */
- int flag;
- int attlen;
- int annot;
-};
-/* "No send" codes */
-#define NS_ADDR 0
-#define NS_ATTACH 1
-#define NS_MSG 2
-#define NS_GEN 3
-struct addrlist {
- char *name;
- char *line2;
- char *address;
- bool pick_flg;
-};
diff --git a/usr/src/cmd/fmli/inc/terror.h b/usr/src/cmd/fmli/inc/terror.h
deleted file mode 100644
index 54ca9f4551..0000000000
--- a/usr/src/cmd/fmli/inc/terror.h
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-/*
- * Copyright (c) 1985 AT&T
- * All Rights Reserved
- *
- */
-
-#ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.3 */
-
-extern char nil[];
-
-#define warn(what, name) _terror(0, what, name, __FILE__, __LINE__, FALSE)
-#define error(what, name) _terror(TERR_LOG, what, name, __FILE__, __LINE__, FALSE)
-#define child_error(what, name) _terror(TERR_LOG, what, name, __FILE__, __LINE__, TRUE)
-#define fatal(what, name) _terror(TERR_LOG | TERR_EXIT, what, name, __FILE__, __LINE__, FALSE)
-#define child_fatal(what, name) _terror(TERR_LOG | TERR_EXIT, what, name, __FILE__, __LINE__, TRUE)
-
-#define TERR_CONT 0
-#define TERR_LOG 1
-#define TERR_EXIT 2
-
-#define TERRLOG "/tmp/TERRLOG"
-
-/*
- * These values are indices into the What array in terrmess.c
- * If you want to add a new error, the procedure is as follows:
- * add the message for it to the end of the What array.
- * add a define for it to this group of defines.
- * add one to the value of TS_NERRS in this file.
- */
-#define NONE 0
-#define NOFORK 0
-#define NOMEM 0
-#define NOPEN 1
-#define BADARGS 2
-#define MUNGED 3
-#define MISSING 4
-#define SWERR 5
-#define NOEXEC 6
-#define LINK 7
-#define VALID 8
-#define NOT_UPDATED 9
-#define FRAME_NOPEN 10
-
-#define TS_NERRS 11
diff --git a/usr/src/cmd/fmli/inc/token.h b/usr/src/cmd/fmli/inc/token.h
deleted file mode 100644
index 7eb4af3602..0000000000
--- a/usr/src/cmd/fmli/inc/token.h
+++ /dev/null
@@ -1,203 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-/*
- * Copyright (c) 1985 AT&T
- * All Rights Reserved
- *
- */
-
-#ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.7 */
-
-typedef long token;
-
-extern token _cmd_to_tok();
-
-#define cmd_to_tok(a) _cmd_to_tok(a, TRUE, TRUE)
-#define mencmd_to_tok(a) _cmd_to_tok(a, FALSE, FALSE)
-
-/* Funny "characters" enabled for various special function keys for input */
-/* This list is created from caps and curses.ed. Do not edit it! */
-#define TOK_BREAK 0401 /* break key (unreliable) */
-#define TOK_DOWN 0402 /* Sent by terminal down arrow key */
-#define TOK_UP 0403 /* Sent by terminal up arrow key */
-#define TOK_LEFT 0404 /* Sent by terminal left arrow key */
-#define TOK_RIGHT 0405 /* Sent by terminal right arrow key */
-#define TOK_HOME 0406 /* Sent by home key. */
-#define TOK_BACKSPACE 0407 /* Sent by backspace key */
-#define TOK_F0 0410 /* function key f0. */
-#define TOK_F(n) (KEY_F0+(n)) /* Space for 64 function keys is reserved. */
-#define TOK_DL 0510 /* Sent by delete line key. */
-#define TOK_IL 0511 /* Sent by insert line. */
-#define TOK_DC 0512 /* Sent by delete character key. */
-#define TOK_IC 0513 /* Sent by ins char/enter ins mode key. */
-#define TOK_EIC 0514 /* Sent by rmir or smir in insert mode. */
-#define TOK_CLEAR 0515 /* Sent by clear screen or erase key. */
-#define TOK_EOS 0516 /* Sent by clear-to-end-of-screen key. */
-#define TOK_EOL 0517 /* Sent by clear-to-end-of-line key. */
-#define TOK_SF 0520 /* Sent by scroll-forward/down key */
-#define TOK_SR 0521 /* Sent by scroll-backward/up key */
-#define TOK_NPAGE 0522 /* Sent by next-page key */
-#define TOK_PPAGE 0523 /* Sent by previous-page key */
-#define TOK_STAB 0524 /* Sent by set-tab key */
-#define TOK_CTAB 0525 /* Sent by clear-tab key */
-#define TOK_CATAB 0526 /* Sent by clear-all-tabs key. */
-#define TOK_ENTER 0527 /* Enter/send (unreliable) */
-#define TOK_SRESET 0530 /* soft (partial) reset (unreliable) */
-#define TOK_RESET 0531 /* reset or hard reset (unreliable) */
-#define TOK_PRINT 0532 /* print or copy */
-#define TOK_LL 0533 /* Sent by home-down key */
- /* The keypad is arranged like this: */
- /* a1 up a3 */
- /* left b2 right */
- /* c1 down c3 */
-#define TOK_A1 0534 /* Upper left of keypad */
-#define TOK_A3 0535 /* Upper right of keypad */
-#define TOK_B2 0536 /* Center of keypad */
-#define TOK_C1 0537 /* Lower left of keypad */
-#define TOK_C3 0540 /* Lower right of keypad */
-#define TOK_BTAB 0541 /* Back tab key */
-#define TOK_BEG 0542 /* beg(inning) key */
-#define TOK_CANCEL 0543 /* cancel key */
-#define TOK_CLOSE 0544 /* close key */
-#define TOK_COMMAND 0545 /* cmd (command) key */
-#define TOK_COPY 0546 /* copy key */
-#define TOK_CREATE 0547 /* create key */
-#define TOK_END 0550 /* end key */
-#define TOK_EXIT 0551 /* exit key */
-#define TOK_FIND 0552 /* find key */
-#define TOK_HELP 0553 /* help key */
-#define TOK_MARK 0554 /* mark key */
-#define TOK_MESSAGE 0555 /* message key */
-#define TOK_MOVE 0556 /* move key */
-#define TOK_NEXT 0557 /* next object key */
-#define TOK_OPEN 0560 /* open key */
-#define TOK_OPTIONS 0561 /* options key */
-#define TOK_PREVIOUS 0562 /* previous object key */
-#define TOK_REDO 0563 /* redo key */
-#define TOK_REFERENCE 0564 /* ref(erence) key */
-#define TOK_REFRESH 0565 /* refresh key */
-#define TOK_REPLACE 0566 /* replace key */
-#define TOK_RESTART 0567 /* restart key */
-#define TOK_RESUME 0570 /* resume key */
-#define TOK_SAVE 0571 /* save key */
-#define TOK_SBEG 0572 /* shifted beginning key */
-#define TOK_SCANCEL 0573 /* shifted cancel key */
-#define TOK_SCOMMAND 0574 /* shifted command key */
-#define TOK_SCOPY 0575 /* shifted copy key */
-#define TOK_SCREATE 0576 /* shifted create key */
-#define TOK_SDC 0577 /* shifted delete char key */
-#define TOK_SDL 0600 /* shifted delete line key */
-#define TOK_SELECT 0601 /* select key */
-#define TOK_SEND 0602 /* shifted end key */
-#define TOK_SEOL 0603 /* shifted clear line key */
-#define TOK_SEXIT 0604 /* shifted exit key */
-#define TOK_SFIND 0605 /* shifted find key */
-#define TOK_SHELP 0606 /* shifted help key */
-#define TOK_SHOME 0607 /* shifted home key */
-#define TOK_SIC 0610 /* shifted input key */
-#define TOK_SLEFT 0611 /* shifted left arrow key */
-#define TOK_SMESSAGE 0612 /* shifted message key */
-#define TOK_SMOVE 0613 /* shifted move key */
-#define TOK_SNEXT 0614 /* shifted next key */
-#define TOK_SOPTIONS 0615 /* shifted options key */
-#define TOK_SPREVIOUS 0616 /* shifted prev key */
-#define TOK_SPRINT 0617 /* shifted print key */
-#define TOK_SREDO 0620 /* shifted redo key */
-#define TOK_SREPLACE 0621 /* shifted replace key */
-#define TOK_SRIGHT 0622 /* shifted right arrow */
-#define TOK_SRSUME 0623 /* shifted resume key */
-#define TOK_SSAVE 0624 /* shifted save key */
-#define TOK_SSUSPEND 0625 /* shifted suspend key */
-#define TOK_SUNDO 0626 /* shifted undo key */
-#define TOK_SUSPEND 0627 /* suspend key */
-#define TOK_UNDO 0630 /* undo key */
-#define TOK_MOUSE 0631 /* Mouse event has occured */
-
-/* use these for redefining the slks */
-
-#define TOK_SLK1 0700
-#define TOK_SLK2 0701
-#define TOK_SLK3 0702
-#define TOK_SLK4 0703
-#define TOK_SLK5 0704
-#define TOK_SLK6 0705
-#define TOK_SLK7 0706
-#define TOK_SLK8 0707
-#define TOK_SLK9 0710
-#define TOK_SLK10 0711
-#define TOK_SLK11 0712
-#define TOK_SLK12 0713
-#define TOK_SLK13 0714
-#define TOK_SLK14 0715
-#define TOK_SLK15 0716
-#define TOK_SLK16 0717
-#define TOK_TOGSLK 0720
-
-/* FMLI TOKENS */
-
-#define TOK_TAB 011
-#define TOK_RETURN 015
-#define TOK_ERASE 0177
-#define TOK_NOP 0721
-#define TOK_CMD 0722 /* brings up commands menu */
-#define TOK_SCRAMBLE 0723
-#define TOK_UNSCRAMBLE 0724
-#define TOK_LOGOUT 0725
-#define TOK_SECURITY 0726
-#define TOK_ORGANIZE 0727
-#define TOK_WDWMGMT 0730 /* brings up wdw-mgmt menu */
-#define TOK_SHOW_PATH 0731
-#define TOK_GOTO 0732
-#define TOK_DELETE TOK_DL
-#define TOK_DISPLAY 0734
-#define TOK_TIME 0735
-#define TOK_UNIX 0736
-#define TOK_BADCHAR 0737
-#define TOK_LFULL 0740 /* editor line full */
-#define TOK_WRAP 0741 /* editor word wrap */
-#define TOK_FUNCTION 0742
-#define TOK_PREV_WDW 0743
-#define TOK_NEXT_WDW 0744
-#define TOK_MENCMD 0745
-#define TOK_CLEANUP 0746
-#define TOK_UNK_CMD 0747
-#define TOK_PRINTCHAR 0750
-#define TOK_CHECKWORLD 0751
-#define TOK_NUNIQUE 0752
-#define TOK_UNDELETE 0753
-#define TOK_REREAD 0754
-#define TOK_DEBUG 0755
-#define TOK_SET 0756
-#define TOK_RUN 0757
-#define TOK_OBJOP 0760
-#define TOK_RELEASE 0761 /* release command */
-#define TOK_DONE 0762 /* done key */
-#define TOK_BPRESSED 0763 /* button pressed */
-#define TOK_BRELEASED 0764 /* button released */
-
-/* flags to be OR'ed in with token */
-#define TOK_HASARGS (0100000) /* token has arguments */
-#define TOK_ERROR (0200000) /* tok is bad */
diff --git a/usr/src/cmd/fmli/inc/typetab.h b/usr/src/cmd/fmli/inc/typetab.h
deleted file mode 100644
index b02564cc05..0000000000
--- a/usr/src/cmd/fmli/inc/typetab.h
+++ /dev/null
@@ -1,164 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-/*
- * Copyright (c) 1985 AT&T
- * All Rights Reserved
- */
-
-#ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.4 */
-
-/* Note: this file created with tabstops set to 4.
- *
- * Definitions for the Object Type Table (OTT). One of these tables
- * will exist in each Telesystem directory, and will containt information
- * about all the objects in that directory.
- */
-
-#define ONAMESIZ (256) /* should be FILE_NAME_SIZ */
-#define DNAMESIZ (256) /* maximum size of an object's display name*/
-#define OTYPESIZ (15) /* maximum size of an object type's name */
-#define DISPSIZ (25) /* maximum size of an object type's display */
-#define OTTNIL (-1) /* end of a next_part link */
-
-#define MAX_PRINCIPALS (12) /* maximum number of multiple principals */
-
-/* the following defines give the currently implemented object mask bytes
- * for internal use. The VAR explicitly has control over the low eight bits
- * of the mask, while all the other bits are under Telesystem control.
- */
-
-#define NOMASK (0x0L) /* no mask */
-#define M_VAR1 (0x0001L) /* VAR mask #1 */
-#define M_VAR2 (0x0002L) /* VAR mask #2 */
-#define M_VAR3 (0x0004L) /* VAR mask #3 */
-#define M_VAR4 (0x0008L) /* VAR mask #4 */
-#define M_VAR5 (0x0010L) /* VAR mask #5 */
-#define M_VAR6 (0x0020L) /* VAR mask #6 */
-#define M_VAR7 (0x0040L) /* VAR mask #7 */
-#define M_VAR8 (0x0080L) /* VAR mask #8 */
-
-#define M_DL (0x0100L) /* deleted */
-#define M_EN (0x0200L) /* encrypted */
-#define M_OB1 (0x0400L) /* Object dependent mask #1 */
-#define M_OB2 (0x0800L) /* Object dependent mask #2 */
-#define M_OB3 (0x1000L) /* Object dependent mask #3 */
-#define M_OB4 (0x2000L) /* Object dependent mask #4 */
-#define M_WB (0x4000L) /* waste basket mode */
-#define M_RO (0x8000L) /* read only */
-#define M_ZL (0x10000L) /* zero length */
-#define M_IN (0x20000L) /* install functions */
-#define M_OB5 (0x40000L) /* the people cry out for more masks */
-
-#define M_VF (M_OB2) /* view full screen mode */
-#define M_NAR (M_OB3) /* narrow screen object */
-#define M_BR (M_OB4) /* browse-only */
-
-/* the high byte of the mask specifies the object classifications */
-
-#define NOCLASS (0x0L)
-#define CL_DIR (0x1000000L) /* class directory */
-#define CL_MAIL (0x2000000L) /* class mail */
-#define CL_DOC (0x4000000L) /* class document */
-#define CL_NDIR (0x8000000L) /* class not directory (for fmask) */
-#define CL_OEU (0x10000000L) /* class stored as oeu's */
-#define CL_DYN (0x20000000L) /* dynamic - always reread */
-#define CL_FMLI (0x40000000L) /* generic FMLI object */
-
-#define STATIC_FMASKS (M_BR | M_WB | M_IN | CL_DIR | CL_NDIR) /* fmasks that should not change to children calls */
-
-#define O_FAIL -1
-#define O_OK 0
-
-/* the following defines are for the modes field of the ott */
-
-#define OTT_SALPHA 0x1 /* keep it sorted alphabetically */
-#define OTT_SMTIME 0x2 /* sort it by mod time */
-#define OTT_DOBJ 0x4 /* display the object name on line 2 */
-#define OTT_DMTIME 0x8 /* display mod time on line 2 */
-#define OTT_DODI 0x10 /* display object dependent info */
-#define OTT_DMAIL 0x20 /* display for electronic mail */
-#define OTT_DALL 0x40 /* display dot files */
-#define OTT_LOCKED 0x80 /* the internal ott is locked into the table */
-#define OTT_DLOCKED 0x100 /* the disk version of the ott is locked */
-#define OTT_ACTIVE 0x200 /* this ott is in use */
-#define OTT_DIRTY 0x400 /* ott has changed since being written */
-#define OTT_SOBJ 0x800 /* sort by object type */
-#define OTT_SREV 0x1000 /* reverse the sense of the sort */
-#define OTT_DMARK 0x2000 /* display a mark next to names of dirs and execs*/
-
-#define SORTMODES (OTT_SALPHA|OTT_SMTIME|OTT_SOBJ|OTT_SREV)
-#define DISMODES (OTT_DOBJ|OTT_DMTIME|OTT_DODI|OTT_DMAIL|OTT_DMARK)
-
-/* defines for the prefs field of the ott, tells what came from the .pref file*/
-
-#define PREF_SORT 1
-#define PREF_DIS 2
-
-#define OTT_ENTRIES 40 /*init # ott_entries to malloc */
-
-#ifndef WISH
-#define MAX_OTT 6 /* maximum number of ott's we will keep */
-#else
-#define MAX_OTT 18
-#endif
-
-struct ott_entry {
- char name[ONAMESIZ]; /* actual UNIX file name for object */
- char *dirpath; /* directory where this object lives*/
- char *dname; /* display name for this object */
- char *display; /* user viewable display string */
- char *objtype; /* unique name for type of object */
- int next_part; /* index into ott of the next part */
- long objmask; /* mask bytes for functions */
- char *odi; /* object dependent information */
- time_t mtime; /* modification time for object. EFT k16*/
-};
-
-struct ott_tab {
- struct ott_entry *ott; /* table of otts (malloc'ed) */
- long fmask; /* pref'ed fmask, only read in dvi() */
- int *parents; /* pointers to each parent (malloc'ed) */
- int curpage; /* current page we are on */
- int numpages; /* number of pages */
- int modes; /* method of sorting or displaying */
- long amask, nmask; /* all/none display masks */
- int prefs; /* tells which preferences are external */
- char *path; /* unix path to this ott's directory */
- time_t ott_mtime; /* mod time of the ott. EFT abs k16 */
- time_t dir_mtime; /* mod time of the unix directory. EFT k16 */
- long last_used; /* higher numbers = more recently used.k16 */
- int priority; /* swapping priority */
-};
-
-struct prininfo {
- char *name;
- char *home;
- char *logid;
-};
-
-/* some function definitions for convenience */
-
-struct ott_tab *ott_get(), *ott_synch();
diff --git a/usr/src/cmd/fmli/inc/var_arrays.h b/usr/src/cmd/fmli/inc/var_arrays.h
deleted file mode 100644
index b637ad22bf..0000000000
--- a/usr/src/cmd/fmli/inc/var_arrays.h
+++ /dev/null
@@ -1,84 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-/*
- * Copyright (c) 1985 AT&T
- * All Rights Reserved
- *
- */
-
-#ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.2 */
-
-struct v_array {
- unsigned short tot_used; /* number of elements used */
- unsigned short tot_left; /* number of elements unused */
- unsigned short ele_size; /* size of an element */
- unsigned short step_size; /* size to increment by */
-};
-
-#define v_header(X) (&((struct v_array *)(X))[-1])
-#define v_body(X) (&((struct v_array *)(X))[1])
-
-/*
- * free the space used by a v_array
- */
-#define array_destroy(X) if (X) free(v_header(X))
-
-/*
- * the length of a v_array to zero without actually freeing any space
- * this is useful for a v_array which is to be emptied and filled up again
- */
-#define array_trunc(X) (v_header(X)->tot_used += v_header(X)->tot_used, v_header(X)->tot_used = 0)
-
-/*
- * returns the number of elements actually stored in the v_array
- */
-#define array_len(X) ((X) ? v_header(X)->tot_used : 0)
-
-/*
- * this allows the caller to specify the granularity with which
- * space is allocated for a v_array, based on how close the original
- * estimate of the array's size should be
- * Initially, the step size for incrementing a v_array's size is set
- * to the maximum of 10% of the initially allocated size and 16
- * (the size of a v_array header structure)
- */
-#define array_ctl(X, Y) (v_header(X)->step_size = (Y))
-
-/*
- * slightly easier to use versions of array_append and array_delete
- */
-#define var_append(T, A, E) ((A) = (T *) array_check_append(sizeof(T), (struct v_array *) (A), (E)))
-/* #define var_append(T, A, E) ((A) = (T *) array_append(((A) == NULL) ? array_create(sizeof(T), 8) : (struct v_array *) (A), (E))) */
-#define var_delete(T, A, I) ((A) = (T *) array_delete((struct v_array *) (A), (I)))
-
-#define ptr_to_ele(X, Y) ((char *) v_body(X) + (Y) * (X)->ele_size)
-
-extern struct v_array *array_create();
-extern struct v_array *array_delete();
-extern struct v_array *array_append();
-extern struct v_array *array_insert();
-extern struct v_array *array_shrink();
-extern struct v_array *array_grow();
diff --git a/usr/src/cmd/fmli/inc/vt.h b/usr/src/cmd/fmli/inc/vt.h
deleted file mode 100644
index 8c298ac8f0..0000000000
--- a/usr/src/cmd/fmli/inc/vt.h
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-/*
- * Copyright (c) 1985 AT&T
- * All Rights Reserved
- *
- */
-
-#ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.9 */
-
-struct vt {
- char *title;
- WINDOW *win;
- WINDOW *subwin;
- vt_id next;
- vt_id prev;
- int number;
- int flags;
-};
-/* les */
-#define WORK_LEN 7
-#define DATE_LEN 48
-
-#define VT_USED 01
-#define VT_DIRTY 02 /* contents of window changed */
-#define VT_BDIRTY 04 /* border of window changed */
-#define VT_TDIRTY 010 /* title of window changed */
-#define VT_SADIRTY 020 /* scroll "arrows" for window changed */
-#define VT_PADIRTY 040 /* page "arrows" for window changed */
-
-#define VT_ANYDIRTY (VT_DIRTY | VT_BDIRTY | VT_TDIRTY | VT_PADIRTY | VT_SADIRTY)
-
-extern vt_id VT_front;
-extern vt_id VT_back;
-extern vt_id VT_curid;
-extern struct vt *VT_array;
-
-/* attribute array abs: indirection removed.
-extern chtype Attr_list[];
-#define highlights(x) ((chtype) Attr_list[x])
-*/
diff --git a/usr/src/cmd/fmli/inc/vtdefs.h b/usr/src/cmd/fmli/inc/vtdefs.h
deleted file mode 100644
index 291e2b9ba6..0000000000
--- a/usr/src/cmd/fmli/inc/vtdefs.h
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-/*
- * Copyright (c) 1985 AT&T
- * All Rights Reserved
- *
- */
-
-#ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.2 */
-
-/* see vt.h for previous "VT_" defines !!! */
-#define VT_UPSARROW 0100
-#define VT_DNSARROW 0200
-#define VT_UPPARROW 0400
-#define VT_DNPARROW 01000
-#define VT_NONUMBER 16384
-#define VT_NOBORDER 32768
-
-#define VT_UNDEFINED ((vt_id) -1)
-
-/* indicates cost function to use when creating a new vt */
-#define VT_NOOVERLAP 0
-#define VT_CENTER 1
-#define VT_COVERCUR 2
-#define VT_NOCOVERCUR 3
-#define NUMCOSTS 4
-#define VT_COSTS 3 /* AND off the COST part of the flags */
-
-#define STATUS_WIN 0
-#define CMD_WIN 1
-#define MESS_WIN 2
-
-/* "funny" characters */
-#define MENU_MARKER '\1' /* RIGHT ARROW */
diff --git a/usr/src/cmd/fmli/inc/windefs.h b/usr/src/cmd/fmli/inc/windefs.h
deleted file mode 100644
index 126d5520f7..0000000000
--- a/usr/src/cmd/fmli/inc/windefs.h
+++ /dev/null
@@ -1,139 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-/*
- * Copyright (c) 1985 AT&T
- * All Rights Reserved
- */
-
-#ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.3 */
-
-#define TOTAL_WINDOWS 20
-
-/* types of screen definitions */
-#define NOTSET 3
-#define SMALL 0
-#define FULL 1
-#define LARGE 2
-
-/*
- * Various display modes
- */
-#define VT_VIDEO 0xff80
-#define VT_CHAR 0x7f
-
-/*
- * CHAR attributes
- */
-#define VT_NORMAL 0
-#define VT_STANDOUT 0x80
-#define VT_UNDER 0x100
-#define VT_REVV 0x200
-#define VT_BLINK 0x400
-#define VT_HALF 0x800
-#define VT_BOLD 0x1000
-#define VT_INVISIBLE 0x2000
-#define VT_ISGRAPH 0x4000
-#define VT_PROTECT 0x8000
-
-#define CURS_TO_END 0
-#define BEG_TO_CURS 1
-#define BEG_TO_END 2
-
-/*** #define CTL(x) ('x' & 037) unused abs 9/14/88 */
-
-/* Returns for cursor pad and mouse */
-#define _NKEYS 27
-#define K_HOME 0200
-#define K_UP 0201
-#define K_DOWN 0202
-#define K_RIGHT 0203
-#define K_LEFT 0204
-#define K_F0 0205
-#define K_F1 0206
-#define K_F2 0207
-#define K_F3 0210
-#define K_F4 0211
-#define K_F5 0212
-#define K_F6 0213
-#define K_F7 0214
-#define K_F8 0215
-#define K_F9 0216
-#define K_FA 0217
-#define K_BOTTOM 0220
-#define K_BTAB 0221
-#define K_MOUSE 0222
-#define K_MOUSE2 0223
-#define K_FTAB 0224
-#define K_TAB 0225
-#define K_NULL 0226
-#define K_ESC 0227
-#define K_HELP 0230
-#define K_EOL 0231
-#define K_EOF 0232
-
-/*
- * returns from meta_getc()
- */
-
-#define TS_KEYS (K_HOME + _NKEYS)
-
-/* Phone responses */
-#define RET_OH TS_KEYS
-#define RET_BUSY (TS_KEYS + 1)
-#define RET_RING (TS_KEYS + 2)
-#define RET_NOTONE (TS_KEYS + 3)
-
-/* Function Keys */
-#define RET_FL1 (TS_KEYS + 4)
-#define RET_FL8 (TS_KEYS + 11)
-#define RET_PAINT (TS_KEYS + 11)
-#define RET_FR1 (TS_KEYS + 12)
-#define RET_FR8 (TS_KEYS + 19)
-#define RET_MKEY (TS_KEYS + 19)
-#define RET_CMD (TS_KEYS + 20)
-#define NUMFUNCS 21
-
-/* returns other than from termdeps */
-#define RET_LEFT (TS_KEYS + 21)
-#define RET_RIGHT (TS_KEYS + 22)
-#define RET_UP (TS_KEYS + 23)
-#define RET_DOWN (TS_KEYS + 24)
-#define RET_INSERT (TS_KEYS + 25)
-#define RET_TAB (TS_KEYS + 26)
-#define RET_NEWLINE (TS_KEYS + 27)
-#define RET_RETURN (TS_KEYS + 28)
-#define RET_KILL (TS_KEYS + 29)
-#define RET_LINSERT (TS_KEYS + 30)
-#define RET_QUIT (TS_KEYS + 31)
-#define RET_XED (TS_KEYS + 32)
-#define RET_EXIT (TS_KEYS + 33)
-#define RET_ERASE (TS_KEYS + 34)
-#define RET_RLABS (TS_KEYS + 35)
-#define RET_LLABS (TS_KEYS + 36)
-
-/* returns from get_input() */
-#define STRING (TS_KEYS + TS_NKEYS + NUMFUNCS)
-#define KWD (STRING + 1) /* return from command inside of objhandler */
diff --git a/usr/src/cmd/fmli/inc/winp.h b/usr/src/cmd/fmli/inc/winp.h
deleted file mode 100644
index 7e1f6e9bc2..0000000000
--- a/usr/src/cmd/fmli/inc/winp.h
+++ /dev/null
@@ -1,90 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-/*
- * Copyright (c) 1985 AT&T
- * All Rights Reserved
- *
- */
-
-#ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.10 */
-
-#define MAXSUBS 5
-
-/* For possible "undo" operation enhancement
-typedef struct _lastop {
- token tok;
- int oprow;
- int opcol;
- int count;
- char *str;
-} undo;
-*/
-
-typedef struct _inp {
- int frow; /* first row of field within window */
- int fcol; /* first column of field within window */
- int rows; /* number of rows in field */
- int cols; /* number of cols in field */
- int currow; /* current row within field */
- int curcol; /* current column within field */
- int flags; /* see field flags below */
- chtype fieldattr; /* highlight attribute (i.e., underlined) */
- chtype lastattr; /* attribute of last char written from value *
- * string so broken writes can continue ok */
- int currtype; /* used to indicate proper (sub)stream */
- chtype *scrollbuf; /* buffer of scrolled lines */
- unsigned buffoffset; /* 1st (leftmost) char visible in field is *
- * at scrollbuf + buffoffset */
- unsigned buffsize; /* number of chars that fit in scroll buffer */
- unsigned bufflast; /* number of valid chars/line in scroll buffer */
- char *value; /* present field value (since last sync) */
- char *valptr; /* current offset into the value string; *
- * used primarily for scrolling fields to *
- * point to that part of the value string *
- * that has not been part of the visible *
- * scroll window, (i.e., not yet part of *
- * scrollbuf) */
-} ifield;
-
-/* field flags */
-#define I_NOEDIT 0x0001
-#define I_CHANGED 0x0002
-#define I_NOPAGE 0x0004
-#define I_STRIPLEAD 0x0008
-#define I_INSERT 0x0010
-#define I_FULLWIN 0x0020
-#define I_WRAP 0x0040
-#define I_BLANK 0x0080
-#define I_FANCY 0x0100 /* probably unused */
-#define I_SCROLL 0x0200
-#define I_FILL 0x0400
-#define I_INVISIBLE 0x0800
-#define I_NOSHOW 0x1000
-#define I_TEXT 0x2000 /* a text objext */
-#define I_AUTOADV 0x4000 /* autoadvance enabled */
-#define I_CHANGEABLE ~(I_CHANGED)
-
-extern ifield *Cfld; /* current field */
diff --git a/usr/src/cmd/fmli/inc/wish.h b/usr/src/cmd/fmli/inc/wish.h
deleted file mode 100644
index 3c434f02d9..0000000000
--- a/usr/src/cmd/fmli/inc/wish.h
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-/*
- * Copyright (c) 1985 AT&T
- * All Rights Reserved
- *
- */
-
-#ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.7 */
-
-#include <malloc.h>
-
-#define MALLOC
-
-/* abs: shut lint up.
-char *calloc();
-*/
-#ifndef TRUE
-#define TRUE (1)
-#define FALSE (0)
-#endif
-#define UNDEFINED (-1)
-
-#ifndef TYPE_BOOL
-/* curses.h also does a typedef bool */
-#ifndef _CURSES_H
-#define TYPE_BOOL
-typedef char bool;
-#endif
-#endif
-
-#define FAIL (-1)
-#define SUCCESS (0)
-
-/* abs reverse order of args to calloc()
-#define new(X) ((X *) ((_tmp_ptr = calloc(sizeof(X), 1)) == NULL ? (char *) fatal(NOMEM, nil) : _tmp_ptr))
-*/
-#define new(X) ((X *) ((_tmp_ptr = calloc(1, sizeof(X))) == NULL ? (char *) fatal(NOMEM, nil) : _tmp_ptr))
-#define _debug0 (!(_Debug & 1)) ? 0 : fprintf
-#define _debug1 (!(_Debug & 2)) ? 0 : fprintf
-#define _debug2 (!(_Debug & 4)) ? 0 : fprintf
-#define _debug3 (!(_Debug & 8)) ? 0 : fprintf
-#define _debug4 (!(_Debug & 16)) ? 0 : fprintf
-#define _debug5 (!(_Debug & 32)) ? 0 : fprintf
-#define _debug _debug5
-#define max(A, B) ((A) > (B) ? (A) : (B))
-#define min(A, B) ((A) < (B) ? (A) : (B))
-
-extern int _Debug;
-extern char nil[];
-extern char *_tmp_ptr;
-
-typedef int vt_id;
-typedef int menu_id;
-typedef int form_id;
diff --git a/usr/src/cmd/fmli/menu/Makefile b/usr/src/cmd/fmli/menu/Makefile
deleted file mode 100644
index ec9b255fdb..0000000000
--- a/usr/src/cmd/fmli/menu/Makefile
+++ /dev/null
@@ -1,55 +0,0 @@
-#
-# CDDL HEADER START
-#
-# The contents of this file are subject to the terms of the
-# Common Development and Distribution License, Version 1.0 only
-# (the "License"). You may not use this file except in compliance
-# with the License.
-#
-# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
-# or http://www.opensolaris.org/os/licensing.
-# See the License for the specific language governing permissions
-# and limitations under the License.
-#
-# When distributing Covered Code, include this CDDL HEADER in each
-# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
-# If applicable, add the following below this CDDL HEADER, with the
-# fields enclosed by brackets "[]" replaced with your own identifying
-# information: Portions Copyright [yyyy] [name of copyright owner]
-#
-# CDDL HEADER END
-#
-#
-# Copyright 2004 Sun Microsystems, Inc. All rights reserved.
-# Use is subject to license terms.
-#
-# ident "%Z%%M% %I% %E% SMI"
-#
-# cmd/fmli/menu/Makefile
-#
-LIBRARY = libmenu.a
-
-OBJECTS = mclose.o mctl.o mcurrent.o mcustom.o mfolder.o mdefault.o \
- mreshape.o stmenu.o
-
-# include library definitions
-include ../../../lib/Makefile.lib
-
-C99MODE= $(C99_DISABLE)
-
-# Specifically request the construction of a static library.
-# This library is not installed in the proto area.
-LIBS = $(LIBRARY)
-
-# inc must be first.
-CPPFLAGS = -I../inc $(CPPFLAGS.master)
-
-.KEEP_STATE:
-
-all: $(LIBS)
-
-install: all
- @echo "$(LIBRARY) is not installed."
-
-# include library targets
-include ../../../lib/Makefile.targ
diff --git a/usr/src/cmd/fmli/menu/mclose.c b/usr/src/cmd/fmli/menu/mclose.c
deleted file mode 100644
index 49b6419607..0000000000
--- a/usr/src/cmd/fmli/menu/mclose.c
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-/*
- * Copyright (c) 1986 AT&T
- * All Rights Reserved
- */
-
-#ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.1 */
-
-#include <stdio.h>
-#include "wish.h"
-#include "menu.h"
-#include "var_arrays.h"
-
-void
-menu_close(mid)
-menu_id mid;
-{
- register struct menu *m;
-
- if (MNU_curid == mid)
- MNU_curid = -1;
- _menu_cleanup();
- m = &MNU_array[mid];
- vt_close(m->vid);
- m->flags = 0;
-}
diff --git a/usr/src/cmd/fmli/menu/mctl.c b/usr/src/cmd/fmli/menu/mctl.c
deleted file mode 100644
index 6d408cb01c..0000000000
--- a/usr/src/cmd/fmli/menu/mctl.c
+++ /dev/null
@@ -1,155 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-
-/*
- * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-#include <stdio.h>
-#include <stdarg.h>
-#include "wish.h"
-#include "ctl.h"
-#include "menu.h"
-#include "menudefs.h"
-
-int
-menu_ctl(menu_id mid, unsigned cmd, ...)
-{
- register int retval;
- register struct menu *m;
- struct menu_line men;
- va_list args;
-
- retval = SUCCESS;
- if (mid < 0)
- mid = MNU_curid;
- m = &MNU_array[mid];
- va_start(args, cmd);
- switch (cmd)
- {
- case CTGETCUR:
- retval = MNU_curid;
- break;
- case CTGETPOS:
- *(va_arg(args, int *)) = m->index;
- break;
- case CTSETPOS:
- menu_index(m, va_arg(args, int), MENU_ALL);
- break;
- case CTSETATTR:
- m->flags |= MENU_MSELECT;
- break;
- case CTGETITLE:
- case CTSETITLE:
- retval = vt_ctl(m->vid, cmd, va_arg(args, char **));
- break;
- case CTGETWDW:
- retval = vt_ctl(m->vid, cmd);
- break;
- case CTGETVT:
- retval = m->vid;
- break;
- case CTGETSIZ:
- retval = m->number;
- break;
- case CTSETARG:
- m->arg = va_arg(args, char *);
- break;
- case CTSETDIRTY:
- m->flags |= MENU_DIRTY;
- break;
- case CTGETPARMS:
- *(va_arg(args, int *)) = m->topline;
- *(va_arg(args, int *)) = m->index;
- break;
- case CTSETPARMS:
- {
- int rows, cols;
-
- m->topline = va_arg(args, int);
- m->index = va_arg(args, int);
- m->flags |= MENU_DIRTY;
- vt_ctl(m->vid, CTGETSIZ, &rows, &cols);
- if (m->index >= m->number)
- m->index = m->number - 1;
- }
- break;
- case CTGETLIST:
- {
- int itemnum;
- char *item;
-
- itemnum = va_arg(args, int);
- item = (char *) menu_list(m, itemnum);
- *(va_arg(args, char **)) = item;
-
- }
- break;
- case CTSETSHAPE:
- {
- int srow, scol, rows, cols;
-
- srow = va_arg(args, int);
- scol = va_arg(args, int);
- rows = va_arg(args, int);
- cols = va_arg(args, int);
- if (srow >= 0)
- _menu_reshape(m, srow, scol, rows, cols);
- }
- break;
- case CTSETSTRT:
- vt_current(m->vid); /* abs k15 */
- menu_index(m, 0, MENU_ALL);
- /*
- * This code determines the first menu item reached
- * when the menu is updated.
- *
- * Do not match inactive menu items.
- */
- men = (*m->disp)(m->index, m->arg);
- while (men.flags & MENU_INACT) {
- if (m->index < m->number - 1) {
- menu_index(m, m->index + 1, MENU_ALL);
- men = (*m->disp)(m->index, m->arg);
- }
- else {
- menu_index(m, 0, MENU_ALL);
- men = (*m->disp)(m->index, m->arg);
- }
- }
- break;
- default:
-#ifdef _DEBUG
- _debug(stderr, "menu_ctl(%d, %d, ...) unknown command\n", mid, cmd);
-#endif
- retval = FAIL;
- break;
- }
- va_end(args);
- return retval;
-}
diff --git a/usr/src/cmd/fmli/menu/mcurrent.c b/usr/src/cmd/fmli/menu/mcurrent.c
deleted file mode 100644
index c93af3782e..0000000000
--- a/usr/src/cmd/fmli/menu/mcurrent.c
+++ /dev/null
@@ -1,267 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License (the "License").
- * You may not use this file except in compliance with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/*
- * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-#include <stdio.h>
-#include <curses.h>
-#include "wish.h"
-#include "menu.h"
-#include "menudefs.h"
-#include "vtdefs.h"
-#include "attrs.h"
-#include "ctl.h"
-#include "color_pair.h"
-#include "sizes.h"
-
-#define menu_pos(m, i, r, c, dr, dc) ((m->ncols > 1) ? (dc = i / r, dr = i % r) : (dc = 0, dr = i - m->topline))
-#define NULLSTR ""
-
-menu_id MNU_curid = -1;
-void menu_index();
-
-int
-menu_current(mid)
-menu_id mid;
-{
- register struct menu *m;
- struct menu_line men;
-
- m = &MNU_array[mid];
- vt_current(m->vid);
- menu_index(m, m->index, m->hcols);
- /*
- * This code determines the first menu item reached
- * when the menu is first drawn.
- *
- * Do not match inactive menu items.
- */
- men = (*m->disp)(m->index, m->arg);
- while (men.flags & MENU_INACT) {
- if (m->index < m->number - 1) {
- menu_index(m, m->index + 1, MENU_ALL);
- men = (*m->disp)(m->index, m->arg);
- }
- else {
- menu_index(m, 0, MENU_ALL);
- men = (*m->disp)(m->index, m->arg);
- }
- }
- MNU_curid = mid;
- return SUCCESS;
-}
-
-int
-menu_noncurrent()
-{
- register struct menu *m;
-
- if (MNU_curid < 0)
- return FAIL;
- m = &MNU_array[MNU_curid];
- menu_index(m, m->index, -1);
- m->hcols = MENU_ALL;
- _menu_cleanup();
- MNU_curid = -1;
- return SUCCESS;
-}
-
-static void menu_show();
-
-void
-menu_index(m, newindex, hcols)
-register struct menu *m;
-int newindex;
-int hcols;
-{
- register int col;
- register int line;
- int cwidth;
- int huse;
- int duse;
- int destrow;
- int destcol;
- int rows;
- int cols;
- int scol;
- int sind;
- struct menu_line ml;
-
- vt_ctl(m->vid, CTGETSIZ, &rows, &cols);
- huse = min(m->hwidth, cwidth = (cols - 1) / m->ncols);
- huse = min(huse, cols - 2);
- if (m->dwidth)
- duse = max(0, cwidth - huse - 3);
- else
- duse = 0;
- /* remove old indicator (if any) */
- if (m->hcols >= 0 && m->index != newindex && m->index >= 0) {
- menu_pos(m, m->index, rows, cols, destrow, destcol);
- ml = (*m->disp)(m->index, m->arg);
- wgo(destrow, destcol * cwidth);
- menu_show(m, &ml, huse, duse, 0);
- }
- m->index = newindex;
- menu_pos(m, m->index, rows, cols, destrow, destcol);
- if ((m->flags & MENU_DIRTY) || destrow < -1 || destrow > rows) {
- /* desired index is far away - redraw menu with it in center */
- wgo(0, 0);
- wclrwin();
- m->topline = min(m->number - rows, m->index - rows / 2);
- if (m->ncols > 1 || m->index < (rows / 2))
- m->topline = 0;
- scol = 0;
- sind = m->topline;
- for (col = 0; col < m->ncols; col++) {
- for (line = 0; line < rows; line++) {
- ml = (*m->disp)(line + sind, m->arg);
- if (ml.highlight == NULL)
- break;
- wgo(line, scol);
- menu_show(m, &ml, huse, duse, 0);
- }
- scol += cwidth;
- sind += rows;
- }
- m->flags &= ~MENU_DIRTY;
- menu_pos(m, m->index, rows, cols, destrow, destcol);
- }
- else if (destrow == rows) {
- wscrollwin(1);
- m->topline++;
- destrow--;
- }
- else if (destrow == -1) {
- wscrollwin(-1);
- m->topline--;
- destrow++;
- }
- if (m->index >= 0) {
- ml = (*m->disp)(m->index, m->arg);
- wgo(destrow, destcol * cwidth);
- menu_show(m, &ml, huse, duse, hcols);
- m->hcols = hcols;
- }
- /* update arrows */
- if (m->ncols == 1) {
- line = 0;
- if (m->topline)
- line |= VT_UPPARROW;
- if (m->topline + rows < m->number)
- line |= VT_DNPARROW;
- vt_ctl(m->vid, CTSETPARROWS, line);
- }
-}
-
-static void
-menu_show(m, ml, len1, len2, high)
-register struct menu *m;
-register struct menu_line *ml;
-int len1;
-register int len2;
-int high;
-{
- register char *s, ch;
- chtype theattr;
- register int tot;
- int r = 0;
- int c = 0;
- int vt_width, vt_height, row, col;
-
- vt_ctl(m->vid, CTGETPOS, &row, &col);
- if (ml->flags & MENU_MRK)
- ch = '*';
- else
- ch = (high ? MENU_MARKER : ' '); /* really MENU_SELECTOR */
- wputchar(ch, Attr_normal, NULL);
- s = ml->highlight;
- if (s == NULL)
- s = NULLSTR;
- /*
- * If a menu item is inactive, set the attributes to dim.
- */
- if (ml->flags & MENU_INACT)
- theattr = A_DIM;
- else
- theattr = Attr_normal;
- tot = min(len1, strlen(s));
- if (high > 0) {
- vt_ctl(m->vid, CTSETATTR, Attr_select, BAR_PAIR);
- r = min(high, tot);
- for ( ; r > 0; r--, tot--, len1--)
- wputchar(*s++, theattr, NULL);
- vt_ctl(m->vid, CTGETPOS, &r, &c);
- vt_ctl(m->vid, CTSETATTR, Attr_normal, WINDOW_PAIR);
- }
- for ( ; tot-- > 0; len1--)
- wputchar(*s++, theattr, NULL);
- vt_ctl(m->vid, CTSETATTR, Attr_normal, WINDOW_PAIR);
- while (len1-- > 0)
- wputchar(' ', Attr_normal, NULL);
- if (m->flags & MENU_TRUNC)
- {
- vt_ctl(m->vid, CTGETSIZ, &vt_height, &vt_width);
- wgo(row, vt_width - LEN_TRUNC_STR -1);
- winputs(TRUNCATE_STR, NULL);
- len2 -= LEN_TRUNC_STR;
- }
- else
- {
- s = ml->description;
- if (s == NULL)
- s = NULLSTR;
- if (s && len2 > 0) {
- winputs(" - ", NULL);
- for (tot = min(len2, strlen(s)); tot > 0; tot--, len2--)
- wputchar(*s++, Attr_normal, NULL);
- }
- }
- while (len2-- > 0)
- wputchar(' ', Attr_normal, NULL);
- if (high)
- wgo(r, c);
-}
-
-
-/*
- * returns the "translated" menu item name (lininfo) or the
- * actual menu item name if the translated name is not provided.
- */
-char *
-menu_list(m, i)
-struct menu *m;
-int i;
-{
- struct menu_line ml;
-
- ml = (*m->disp)(i, m->arg);
- if (!(ml.flags & MENU_MRK))
- return(NULL);
- if (ml.lininfo && *(ml.lininfo) != '\0')
- return(ml.lininfo);
- else
- return(ml.highlight);
-}
diff --git a/usr/src/cmd/fmli/menu/mcustom.c b/usr/src/cmd/fmli/menu/mcustom.c
deleted file mode 100644
index 2b21cb8277..0000000000
--- a/usr/src/cmd/fmli/menu/mcustom.c
+++ /dev/null
@@ -1,84 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-/*
- * Copyright (c) 1986 AT&T
- * All Rights Reserved
- */
-
-#ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.1 */
-
-#include <stdio.h>
-#include "wish.h"
-#include "menu.h"
-#include "menudefs.h"
-#include "vtdefs.h"
-#include "var_arrays.h"
-#include "ctl.h"
-
-struct menu *MNU_array;
-
-menu_id
-menu_custom(vid, flags, mcols, hcols, dcols, total, disp, arg)
-vt_id vid;
-unsigned flags;
-unsigned mcols;
-unsigned hcols;
-unsigned dcols;
-unsigned total;
-struct menu_line (*disp)();
-char *arg;
-{
- register int i;
- int cols;
- int dummy;
- register struct menu *m;
-
- vt_ctl(vid, CTGETSIZ, &dummy, &cols);
- /* find a free menu structure */
- for (m = MNU_array, i = array_len(MNU_array); i > 0; m++, i--)
- if (!(m->flags & MENU_USED))
- break;
- if (i <= 0) {
- var_append(struct menu, MNU_array, NULL);
- m = &MNU_array[array_len(MNU_array) - 1];
- }
- /* set up m */
- /* "givens" */
- m->vid = vid;
- m->flags = (MENU_DIRTY | MENU_USED | (flags & ALL_MNU_FLAGS));
- m->hwidth = hcols;
- m->dwidth = dcols;
- m->number = total;
- m->disp = disp;
- m->arg = arg;
- m->index = 0;
- m->hcols = MENU_ALL;
- m->topline = -2; /* to force complete repaint */
- if (mcols < 1)
- mcols = 1;
- m->ncols = mcols;
- return m - MNU_array;
-}
diff --git a/usr/src/cmd/fmli/menu/mdefault.c b/usr/src/cmd/fmli/menu/mdefault.c
deleted file mode 100644
index 4b4f596c73..0000000000
--- a/usr/src/cmd/fmli/menu/mdefault.c
+++ /dev/null
@@ -1,500 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-/*
- * Copyright (c) 1986 AT&T
- * All Rights Reserved
- */
-
-#ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.22 */
-
-#include <stdio.h>
-#include "wish.h"
-#include "menu.h"
-#include "menudefs.h"
-#include "vtdefs.h"
-#include "terror.h"
-#include "ctl.h"
-#include "sizes.h"
-
-char *shrink_descriptor();
-
-#define MAX_MITEMS 10
-
-menu_id
-menu_make(num, title, flags, startrow, startcol, menurows, menucols, disp, arg)
-int num; /* menu number */
-char *title; /* menu title */
-unsigned flags; /* menu/vt flags */
-int startrow; /* start row for the menu frame */
-int startcol; /* start column for the menu frame */
-int menurows; /* default menu rows */
-int menucols; /* default menu cols */
-struct menu_line (*disp)();
-char *arg;
-{
- register int total; /* total items */
- register int itemwidth; /* width of longest item */
- register int descwidth; /* width of longest description */
- register int menuwidth; /* width of the menu */
- int cols_specified; /* are number of cols specified? */
- int rows_specified; /* are number of rows specified? */
- struct menu_line ml; /* item offset into menu */
- vt_id vid; /* vt identifier of new frame */
- int probrows, probcols, probwidth; /* tmp vars */
- int oitemwidth, chop, i_num; /* tmp vars */
- int mflags = flags; /* menu flags (as opposed to vt flags) */
- bool has_description = FALSE;
-
- /*
- * Determine ITEMWIDTH and DESCRIPTION WIDTH
- * as well as the TOTAL number of items
- */
- itemwidth = descwidth = 0;
- ml = (*disp)(0, arg);
- for (total = 0; ml.highlight; ml = (*disp)(++total, arg))
- {
- ml.highlight = shrink_descriptor(ml.highlight, FIXED_COLS);
- itemwidth = max(itemwidth, strlen(ml.highlight));
- if ((ml.description != NULL) && (*(ml.description) != '\0')) {
- has_description = TRUE;
- } /* no description */
- }
- if (!total)
- return((menu_id) FAIL); /* empty menu */
-
- /* an item which fits may still need truncation to show that description
- * didn't fit. - 4 becaue of " - " and min 1 char of description
- */
- if (has_description && (itemwidth >= COLS - FIXED_COLS - 4) )
- {
- mflags |= MENU_TRUNC;
- descwidth = 1;
- }
- else /* full name fits, truncate description if needed */
- {
- for (i_num = 0; i_num < total; i_num++)
- {
- ml = (*disp)(i_num, arg);
- if (ml.description)
- {
- /* the "3" below is for the " - " separator */
-
- ml.description = shrink_descriptor(ml.description,
- FIXED_COLS + itemwidth + 3 -1);
- descwidth = max(descwidth, strlen(ml.description));
- }
- }
- }
-
- rows_specified = (menurows > 0 ? TRUE : FALSE);
- cols_specified = (menucols > 0 ? TRUE : FALSE);
-
- if (descwidth) {
- /*
- * If ANY item has a description, then stay single column,
- *
- * width = longest highlight +
- * longest description +
- * 3 (for the " - ") +
- * 2 (for space between text and sides)
- *
- */
- if (rows_specified) {
- /*
- * actual rows = min(specified rows,
- * fittable rows,
- * needed rows);
- */
- for ( ; !fits(flags, menurows, 1); menurows--)
- ;
- if (menurows > total)
- menurows = total;
- }
- else {
- /*
- * actual rows = min(MAX_MITEMS, needed rows);
- */
- menurows = min(total, MAX_MITEMS);
- }
- menucols = 1;
- menuwidth = itemwidth + descwidth + 5;
-
- /*
- * if the description is too long, then truncate
- */
- for ( ; !fits(flags, menurows, menuwidth); menuwidth--)
- ;
-
- }
- else if (rows_specified && !cols_specified) {
- /*
- * determine probable rows, then probable columns
- *
- * probable rows = min(specified rows, "fittable" rows)
- */
- for (probrows = menurows; !fits(flags, probrows, 1); probrows--)
- ;
- probcols = (total / probrows) + (total % probrows ? 1 : 0);
- probwidth = 1 + probcols * (1 + itemwidth);
-
- /*
- * determine actual rows and columns
- */
- if (!fits(flags, probrows, probwidth)) {
- /*
- * menu not displayable in multi-columns ...
- *
- * actual rows = probable rows
- * actual cols = 1
- *
- * truncate the menu if necessary
- */
- menurows = probrows;
- menucols = 1;
- menuwidth = 2 + itemwidth;
- for (; !fits(flags, 1, menuwidth); )
- menuwidth--;
- }
- else {
- /*
- * actual rows = probable cols == 1 ?
- * min(specified rows, fittable rows) :
- * probable rows
- * actual cols = probable cols
- */
- if (probcols == 1) {
- for ( ; !fits(flags, menurows, 1); menurows--)
- ;
- }
- else
- menurows = probrows;
- menucols = probcols;
- menuwidth = probwidth;
- }
-
- /*
- * Eliminate white-space from unused rows
- */
- if (menurows > total)
- menurows = total;
- }
- else if (cols_specified && !rows_specified) {
- /*
- * determine probable columns, then probable rows
- *
- * If necessary, truncate the length of each
- * column until the menu fits
- */
- probcols = menucols;
- probwidth = 1 + probcols * (1 + itemwidth);
- oitemwidth = itemwidth;
- while (!fits(flags, 1, probwidth)) {
- itemwidth--;
- probwidth = 1 + probcols * (1 + itemwidth);
- if (itemwidth <= 0) {
- /*
- * give up ...
- * default to single column and
- * truncate the menu if necessary.
- */
- probcols = 1;
- itemwidth = oitemwidth;
- probwidth = 2 + itemwidth;
- for (; !fits(flags, 1, probwidth); )
- probwidth--;
- break;
- }
- }
- probrows = (total / probcols) + (total % probcols ? 1 : 0);
-
- /*
- * determine actual rows and columns
- */
- if (!fits(flags, probrows, probwidth)) {
- /*
- * menu too big ...
- *
- * actual cols = 1
- * actual rows = min(MAX_MITEMS, total)
- */
- menucols = 1;
- menuwidth = 2 + itemwidth;
- for (; !fits(flags, 1, menuwidth); )
- menuwidth--;
- menurows = min(MAX_MITEMS, total);
- }
- else {
- menucols = probcols;
- menuwidth = probwidth;
- menurows = probrows;
- }
-
- /*
- * Eliminate white-space from unused columns ...
- * First compute the number of columns to chop and
- * then subtract it from menucols
- */
- if (menucols > 1) {
- chop = ((menurows * menucols) - total) / menurows;
- if (chop) {
- menucols -= chop;
- menuwidth = 1 + menucols * (1 + itemwidth);
- }
- }
- }
- else if (rows_specified && cols_specified) {
- /*
- * determine probable columns, then probable rows
- *
- * If necessary, truncate the length of each
- * column until the menu fits
- */
- probcols = menucols;
- probwidth = 1 + probcols * (1 + itemwidth);
- oitemwidth = itemwidth;
- while (!fits(flags, 1, probwidth)) {
- itemwidth--;
- probwidth = 1 + probcols * (1 + itemwidth);
- if (itemwidth <= 0) {
- /*
- * give up ...
- * default to single column and
- * truncate the menu if necessary.
- */
- probcols = 1;
- itemwidth = oitemwidth;
- probwidth = 2 + itemwidth;
- for (; !fits(flags, 1, probwidth); )
- probwidth--;
- break;
- }
- }
- probrows = (total / probcols) + (total % probcols ? 1 : 0);
-
- /*
- * determine actual rows and columns
- */
- if (!fits(flags, probrows, probwidth)) {
- /*
- * Menu can't be displayed in multi-columns ...
- *
- * actual cols = 1;
- * actual rows = min(specified rows, fittable rows);
- */
- menucols = 1;
- menuwidth = 2 + itemwidth;
- for (; !fits(flags, 1, menuwidth); )
- menuwidth--;
- for ( ; !fits(flags, menurows, 1); menurows--)
- ;
- }
- else {
- /*
- * actual rows = probable cols == 1 ?
- * min(specified rows, fittable rows) :
- * probable rows
- * actual cols = probable cols
- */
- if (probcols == 1) {
- for ( ; !fits(flags, menurows, 1); menurows--)
- ;
- }
- else
- menurows = probrows;
- menucols = probcols;
- menuwidth = probwidth;
- }
-
- /*
- * Eliminate white-space from unused columns ...
- * First compute the number of columns to chop and
- * then subtract it from menucols
- */
- if (menucols > 1) {
- chop = ((menurows * menucols) - total) / menurows;
- if (chop) {
- menucols -= chop;
- menuwidth = 1 + menucols * (1 + itemwidth);
- }
- }
- }
- else {
- /*
- * ROWS and COLUMNS are not specified so churn away ...
- */
- if (total <= MAX_MITEMS) {
- /*
- * use single column ... truncate menu if necessary
- */
- menurows = min(total, MAX_MITEMS);
- menucols = 1;
- menuwidth = itemwidth + 2; /* 1 column */
- while (!fits(flags, 1, menuwidth))
- menuwidth--; /* truncate until it fits */
- }
- else {
- /*
- * 1) make menu at least as wide as the title,
- *
- * 2) make its aspect as close to 1:3
- * (height:width) as possible).
- *
- * These are arbitrarily pleasing values.
- *
- */
- menucols = 1;
- menuwidth = itemwidth + 2;
- menurows = MAX_MITEMS;
-
- while (fits(flags, menurows, menuwidth)) {
- if ((menurows * 3 <= menuwidth) &&
- (menuwidth >= strlen(title) + 3))
- break;
- menucols++;
- menuwidth = 1 + menucols * (1 + itemwidth);
- menurows = (total + menucols - 1) / menucols;
- }
- if (!fits(flags, menurows, menuwidth)) {
- /*
- * try "backing-off" one column and
- * recomputing rows.
- */
- menucols = max(menucols - 1, 1);
- menuwidth = 1 + menucols * (1 + itemwidth);
- menurows = (total + menucols - 1) / menucols;
-
- if (!fits(flags, menurows, menuwidth)) {
- /*
- * if all else fails ... resort to
- * single column.
- */
- menucols = 1;
- menuwidth = itemwidth + 2;
- menurows = min(total, MAX_MITEMS);
- while (!fits(flags, 1, menuwidth))
- menuwidth--;
- }
- }
- if (menucols == 1)
- menurows = min(menurows, MAX_MITEMS);
- }
- }
-
- /*
- * Make sure the menu VT (frame) can house the title
- * vt_create adds the border cols hence FIXED_TITLE - 2
- */
-
- menuwidth = max(menuwidth, strlen(title) + FIXED_TITLE - 2); /* abs f16 */
-
-
- /*
- * Create a VT (frame) to house the menu
- */
- if ((vid = vt_create(title, flags, startrow, startcol, menurows,
- menuwidth)) == VT_UNDEFINED)
- {
-
- /*
- * try putting the VT anywhere
- */
- vid = vt_create(title, flags, VT_UNDEFINED, VT_UNDEFINED,
- menurows, menuwidth);
- }
- /*
- * If the menu still can't be displayed then return FAIL
- */
- if (vid == VT_UNDEFINED) {
- mess_temp("Object can not be displayed, frame may be too large for the screen");
- return((menu_id) FAIL);
- }
-
- if (num >= 0)
- vt_ctl(vid, CTSETWDW, num);
- return(menu_custom(vid, mflags, menucols, itemwidth, descwidth, total, disp, arg));
-}
-
-
-menu_id
-menu_reinit(mid, flags, menurows, menucols, disp, arg)
-menu_id mid;
-unsigned flags;
-int menurows;
-int menucols;
-struct menu_line (*disp)();
-char *arg;
-{
- char *s;
- register menu_id newmid;
- register vt_id oldvid;
- register menu_id oldmid;
- int top, line;
-
- oldmid = MNU_curid;
- oldvid = vt_current(MNU_array[mid].vid);
- vt_ctl(VT_UNDEFINED, CTGETITLE, &s);
- newmid = menu_make(vt_ctl(VT_UNDEFINED, CTGETWDW), s,
- flags | VT_COVERCUR, VT_UNDEFINED, VT_UNDEFINED,
- menurows, menucols, disp, arg);
- menu_ctl(mid, CTGETPARMS, &top, &line);
- menu_close(mid);
- menu_ctl(newmid, CTSETPARMS, top, line);
- menu_current(newmid);
- if (MNU_array[mid].vid != oldvid) {
- menu_noncurrent();
- if (oldmid >= 0)
- menu_current(oldmid);
- else
- vt_current(oldvid);
- }
- return newmid;
-}
-
-
-/* shrink_descriptor truncates the provided string so it will fit in a
-** window thats the screen width minus reserved_col wide. The
-** end of the string is replaced with TRUNCATE_STR to show that
-** the string was truncated.
-** RETURN VALUE: Pointer to the truncated string.
-** SIDE AFFECTS: The string parameter is itself may be modified.
-** this routine does not make a copy before truncation.
-** If called with the result of a multi_eval, the
-** cur field of the attribute will be modified, affecting
-** future multi_evals if the descriptor is not
-** EVAL_ALWAYS
-*/
-char *
-shrink_descriptor(str, reserved_cols)
-char *str;
-int reserved_cols;
-{
- int max_len;
-
- max_len = COLS - reserved_cols; /* longest string desired */
- if (strlen(str) > max_len && max_len >= LEN_TRUNC_STR)
- strcpy((str + max_len - LEN_TRUNC_STR), TRUNCATE_STR);
- return(str);
-}
diff --git a/usr/src/cmd/fmli/menu/mfolder.c b/usr/src/cmd/fmli/menu/mfolder.c
deleted file mode 100644
index d07f92da2a..0000000000
--- a/usr/src/cmd/fmli/menu/mfolder.c
+++ /dev/null
@@ -1,281 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-/*
- * Copyright (c) 1986 AT&T
- * All Rights Reserved
- */
-
-#ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.2 */
-
-#include <stdio.h>
-#include "wish.h"
-#include "menu.h"
-#include "menudefs.h"
-#include "vtdefs.h"
-#include "terror.h"
-#include "ctl.h"
-#include "sizes.h"
-
-/*
- * This is a special version of menu_make ( called folder_make ) and
- * menu_reinit ( called folder_reinit ) that are used soley for
- * file folder display. Lots of assumptions are made, like that
- * rows is always specified as 18.
- */
-
-menu_id
-folder_make(num, title, flags, startrow, startcol, menurows, menucols, disp, arg)
-int num; /* menu number */
-char *title; /* menu title */
-unsigned flags; /* menu/vt flags */
-int startrow; /* start row for the menu frame */
-int startcol; /* start column for the menu frame */
-int menurows; /* default menu rows */
-int menucols; /* default menu cols */
-struct menu_line (*disp)();
-char *arg;
-{
- register int total; /* total items */
- register int itemwidth; /* width of longest item */
- register int descwidth; /* width of longest description */
- register int menuwidth; /* width of the menu */
- struct menu_line ml; /* item offset into menu */
- vt_id vid; /* vt identifier of new frame */
- int probrows, probcols, probwidth; /* tmp vars */
- int i_num; /* tmp var */
- int mflags = flags; /* menu flags (as opposed to vt flags) */
- char *shrink_folder();
- bool has_description = FALSE;
-
- menurows = 18;
- menucols = 0;
-
- /*
- * Determine ITEMWIDTH and DESCRIPTION WIDTH
- * as well as the TOTAL number of items
- */
- itemwidth = descwidth = 0;
- ml = (*disp)(0, arg);
- for (total = 0; ml.highlight; ml = (*disp)(++total, arg)) {
- itemwidth = max(itemwidth, strlen(ml.highlight));
- if (ml.description) {
- has_description = TRUE;
- descwidth = max(descwidth, strlen(ml.description));
- }
- }
-
- if (!total)
- return((menu_id) FAIL); /* empty menu */
-
-
- if (has_description) {
-/*
- * Now truncate the highlite so that the entire description fits
- * we only truncate the highlight if there was a description.
- * If there is no description, we have already truncated the
- * highlite in the dir_disp.
- */
-
- itemwidth = 0;
-
- for (i_num = 0; i_num < total; i_num++) {
- ml = (*disp)(i_num, arg);
- ml.highlight = shrink_folder(ml.highlight,
- ( COLS - FIXED_COLS - descwidth - 3 ));
- itemwidth = max(itemwidth, strlen(ml.highlight));
- }
- /*
- * If ANY item has a description, then stay single column,
- *
- * width = longest highlight +
- * longest description +
- * 3 (for the " - ") +
- * 2 (for space between text and sides)
- *
- */
- /*
- * actual rows = min(specified rows,
- * fittable rows,
- * needed rows);
- */
- for ( ; !fits(flags, menurows, 1); menurows--)
- ;
- if (menurows > total)
- menurows = total;
- menucols = 1;
- menuwidth = itemwidth + descwidth + 5;
-
- /*
- * if the description is too long, then truncate
- */
- for ( ; !fits(flags, menurows, menuwidth); menuwidth--)
- ;
-
- }
- else {
- /*
- * determine probable rows, then probable columns
- *
- * probable rows = min(specified rows, "fittable" rows)
- */
- for (probrows = menurows; !fits(flags, probrows, 1); probrows--)
- ;
- probcols = (total / probrows) + (total % probrows ? 1 : 0);
- probwidth = 1 + probcols * (1 + itemwidth);
-
- /*
- * determine actual rows and columns
- */
- if (!fits(flags, probrows, probwidth)) {
- /*
- * menu not displayable in multi-columns ...
- *
- * actual rows = probable rows
- * actual cols = 1
- *
- * truncate the menu if necessary
- */
- menurows = probrows;
- menucols = 1;
- menuwidth = 2 + itemwidth;
- for (; !fits(flags, 1, menuwidth); )
- menuwidth--;
- }
- else {
- /*
- * actual rows = probable cols == 1 ?
- * min(specified rows, fittable rows) :
- * probable rows
- * actual cols = probable cols
- */
- if (probcols == 1) {
- for ( ; !fits(flags, menurows, 1); menurows--)
- ;
- }
- else
- menurows = probrows;
- menucols = probcols;
- menuwidth = probwidth;
- }
-
- /*
- * Eliminate white-space from unused rows
- */
- if (menurows > total)
- menurows = total;
- }
-
- /*
- * Make sure the menu VT (frame) can house the title
- * vt_create adds the border cols hence FIXED_TITLE - 2
- */
- /* made it FIXED_TITLE -3 to min. testing impact. -2 is better in longterm */
- menuwidth = max(menuwidth, strlen(title) + FIXED_TITLE - 3);
-
-
- /*
- * Create a VT (frame) to house the menu
- */
- if ((vid = vt_create(title, flags, startrow, startcol, menurows,
- menuwidth)) == VT_UNDEFINED)
- {
-
- /*
- * try putting the VT anywhere
- */
- vid = vt_create(title, flags, VT_UNDEFINED, VT_UNDEFINED,
- menurows, menuwidth);
- }
- /*
- * If the menu still can't be displayed then return FAIL
- */
- if (vid == VT_UNDEFINED) {
- mess_temp("Object can not be displayed, frame may be too large for the screen");
- return((menu_id) FAIL);
- }
-
- if (num >= 0)
- vt_ctl(vid, CTSETWDW, num);
- return(menu_custom(vid, mflags, menucols, itemwidth, descwidth, total, disp, arg));
-}
-
-
-menu_id
-folder_reinit(mid, flags, menurows, menucols, disp, arg)
-menu_id mid;
-unsigned flags;
-int menurows;
-int menucols;
-struct menu_line (*disp)();
-char *arg;
-{
- char *s;
- register menu_id newmid;
- register vt_id oldvid;
- register menu_id oldmid;
- int top, line;
-
- oldmid = MNU_curid;
- oldvid = vt_current(MNU_array[mid].vid);
- vt_ctl(VT_UNDEFINED, CTGETITLE, &s);
- newmid = folder_make(vt_ctl(VT_UNDEFINED, CTGETWDW), s,
- flags | VT_COVERCUR, VT_UNDEFINED, VT_UNDEFINED,
- menurows, menucols, disp, arg);
- menu_ctl(mid, CTGETPARMS, &top, &line);
- menu_close(mid);
- menu_ctl(newmid, CTSETPARMS, top, line);
- menu_current(newmid);
- if (MNU_array[mid].vid != oldvid) {
- menu_noncurrent();
- if (oldmid >= 0)
- menu_current(oldmid);
- else
- vt_current(oldvid);
- }
- return newmid;
-}
-
-/* shrink_folder truncates the provided string so it will fit in a
-** window thats the screen width minus reserved_col wide. The
-** end of the string is replaced with TRUNCATE_STR to show that
-** the string was truncated.
-** RETURN VALUE: Pointer to the truncated string.
-** SIDE AFFECTS: The string parameter is itself may be modified.
-** this routine does not make a copy before truncation.
-** If called with the result of a multi_eval, the
-** cur field of the attribute will be modified, affecting
-** future multi_evals if the descriptor is not
-** EVAL_ALWAYS
-*/
-char *
-shrink_folder(str, max_len)
-char *str;
-int max_len;
-{
- if (strlen(str) > max_len)
- strcpy((str + max_len - 1), ">");
- return(str);
-}
diff --git a/usr/src/cmd/fmli/menu/mreshape.c b/usr/src/cmd/fmli/menu/mreshape.c
deleted file mode 100644
index a62b31c881..0000000000
--- a/usr/src/cmd/fmli/menu/mreshape.c
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-
-/*
- * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-#include <stdio.h>
-#include "wish.h"
-#include "menu.h"
-#include "menudefs.h"
-#include "vtdefs.h"
-#include "var_arrays.h"
-#include "ctl.h"
-
-struct menu *MNU_array;
-
-int
-_menu_reshape(m, srow, scol, rows, cols)
-register struct menu *m;
-register int srow;
-register int scol;
-register unsigned rows;
-register unsigned cols;
-{
- int ncols;
- int nrows;
- register int oldindex;
-
- if (rows < 3 || cols < 5) {
- mess_temp("Too small, try again");
- return FAIL;
- }
- vt_reshape(m->vid, srow, scol, rows, cols);
- vt_ctl(m->vid, CTGETSIZ, &nrows, &ncols);
- /* set up m */
- oldindex = m->index;
- m->index = -1;
- m->topline = -MENU_ALL;
- m->flags |= MENU_DIRTY;
- m->hcols = MENU_ALL;
- if (m->dwidth == 0 && m->number > nrows) {
- /* try for multi-column */
- m->ncols = (ncols - 1) / (m->hwidth + 1);
- if (m->ncols * nrows < m->number)
- m->ncols = 1;
- }
- else
- m->ncols = 1;
- menu_index(m, oldindex, MENU_ALL);
- return SUCCESS;
-}
diff --git a/usr/src/cmd/fmli/menu/stmenu.c b/usr/src/cmd/fmli/menu/stmenu.c
deleted file mode 100644
index 1a248412b5..0000000000
--- a/usr/src/cmd/fmli/menu/stmenu.c
+++ /dev/null
@@ -1,603 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License (the "License").
- * You may not use this file except in compliance with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-
-/*
- * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-#include <stdio.h>
-#include <ctype.h>
-#include "wish.h"
-#include "menu.h"
-#include "menudefs.h"
-#include "vtdefs.h"
-#include "token.h"
-#include "ctl.h"
-#include "moremacros.h"
-#include "message.h"
-#include "sizes.h"
-
-#define myisprint(C) ((C) >= ' ' && (C) <= '~')
-
-static char *curstring;
-static int menu_match();
-/* mouse coordinates */
-extern int Mouse_row;
-extern int Mouse_col;
-
-token
-menu_stream(t)
-register token t;
-{
- register int newindex, begindex;
- register struct menu *m;
- struct menu_line men;
- extern menu_id MNU_curid;
- void _menu_cleanup();
- char badmatch[PATHSIZ];
-
- if (MNU_curid < 0)
- return t;
- m = &MNU_array[MNU_curid];
- /* curstring is set if we partial-matched on the previous character */
- if (curstring) {
- if (myisprint((int) t) && (newindex = menu_match(m, curstring, m->hcols, t)) != FAIL) {
- menu_index(m, newindex, m->hcols + 1);
- return TOK_NEXT;
- }
- else if (t == TOK_BACKSPACE) {
- if (m->hcols > 1) {
- menu_index(m, m->index, m->hcols - 1);
- return TOK_NEXT;
- }
- }
- if (myisprint((int) t) && t != ' ') {
- sprintf(badmatch, "Can't match item starting with \"%.*s%c\"",
- m->hcols, curstring, (char) t);
- mess_temp(badmatch);
- mess_lock();
- return(TOK_BADCHAR);
- }
- }
-
- /*
- * NOTE: tokens that change the current menu item return
- * TOK_NEXT so that application stream handler (objmenu_stream)
- * is aware ...
- */
- switch (t) {
- case ' ':
- case TOK_TAB: /* abs k16 */
- case TOK_RIGHT:
- if (m->ncols > 1) {
- int row, col;
-
- vt_ctl(m->vid, CTGETSIZ, &row, &col);
- begindex = m->index;
- if ((newindex = m->index + row) < m->number) {
- menu_index(m, newindex, MENU_ALL);
- men = (*m->disp)(m->index, m->arg);
- t = TOK_NEXT;
- /*
- * RIGHT ARROW
- * Do not match inactive menu items.
- */
- while (men.flags & MENU_INACT) {
- if ((newindex = m->index + row) < m->number) {
- menu_index(m, newindex, MENU_ALL);
- t = TOK_NEXT;
- men = (*m->disp)(m->index, m->arg);
- }
- else {
- sprintf(badmatch,"Can't match inactive menu item.");
- mess_temp(badmatch);
- mess_lock();
- menu_index(m, begindex, MENU_ALL);
- t = TOK_NOP;
- break;
- }
- }
- }
- break;
- }
- /* FALL THROUGH */
- case TOK_DOWN:
- case TOK_NEXT:
- if (m->index < m->number - 1) {
- menu_index(m, m->index + 1, MENU_ALL);
- t = TOK_NEXT;
- /*
- * DOWN ARROW
- * Do not match inactive menu items.
- */
- men = (*m->disp)(m->index, m->arg);
- while (men.flags & MENU_INACT) {
- if (m->index < m->number - 1) {
- menu_index(m, m->index + 1, MENU_ALL);
- t = TOK_NEXT;
- men = (*m->disp)(m->index, m->arg);
- }
- else {
- menu_index(m, 0, MENU_ALL);
- t = TOK_NEXT;
- men = (*m->disp)(m->index, m->arg);
- }
- }
- }
- else {
- menu_index(m, 0, MENU_ALL);
- t = TOK_NEXT;
- /*
- * DOWN ARROW when you are at the bottom of
- * the menu and the down arrow will take you
- * to the first menu item.
- *
- * Do not match inactive menu items.
- */
- men = (*m->disp)(m->index, m->arg);
- while (men.flags & MENU_INACT) {
- menu_index(m, m->index + 1, MENU_ALL);
- t = TOK_NEXT;
- men = (*m->disp)(m->index, m->arg);
- }
- }
- break;
- case TOK_BPRESSED: /* Button 1 press */
- begindex = m->index;
- if (m->ncols > 1) {
- int rows, dummy;
-
- /*
- * Multicolumn menu: get frame size (rows)
- * to determine menu item offset (newindex)
- */
- vt_ctl(m->vid, CTGETSIZ, &rows, &dummy);
- newindex = rows * ((int)((Mouse_col + 1) / m->hwidth));
- newindex += Mouse_row;
- }
- else
- newindex = m->topline + Mouse_row;
- if (newindex > (m->number - 1))
- t = TOK_BADCHAR; /* out of bounds */
- else if (m->index == newindex)
- t = TOK_NOP; /* do nothing */
- else {
- menu_index(m, newindex, MENU_ALL);
- men = (*m->disp)(m->index, m->arg);
- /*
- * Do not match inactive menu items
- *
- * NOTE: The mouse code for inactive menu items
- * will remain untested until ported to the 386.
- * sfsup!njp 4/12/89
- */
- if (men.flags & MENU_INACT) {
- sprintf(badmatch,"Can't match inactive menu item.");
- mess_temp(badmatch);
- mess_lock();
- menu_index(m, begindex, MENU_ALL);
- t = TOK_NOP;
- }
- else
- t = TOK_NEXT;
- }
- break;
- case TOK_BACKSPACE:
- case TOK_BTAB: /* abs k16 */
- case TOK_LEFT:
- if (m->ncols > 1) {
- int row, col;
-
- vt_ctl(m->vid, CTGETSIZ, &row, &col);
- begindex = m->index;
- if ((newindex = m->index - row) >= 0) {
- menu_index(m, newindex, MENU_ALL);
- men = (*m->disp)(m->index, m->arg);
- t = TOK_NEXT;
- /*
- * LEFT ARROW
- * Do not match inactive menu items.
- */
- while (men.flags & MENU_INACT) {
- if ((newindex = m->index - row) > 0) {
- menu_index(m, newindex, MENU_ALL);
- t = TOK_NEXT;
- men = (*m->disp)(m->index, m->arg);
- }
- else {
- sprintf(badmatch,"Can't match inactive menu item.");
- mess_temp(badmatch);
- mess_lock();
- menu_index(m, begindex, MENU_ALL);
- t = TOK_NOP;
- break;
- }
- }
- }
- break;
- }
- /* FALL THROUGH */
- case TOK_UP:
- case TOK_PREVIOUS:
- if (m->index > 0) {
- menu_index(m, m->index - 1, MENU_ALL);
- t = TOK_NEXT;
- /*
- * UP ARROW
- * Do not match inactive menu items.
- */
- men = (*m->disp)(m->index, m->arg);
- while (men.flags & MENU_INACT) {
- if (m->index > 0) {
- menu_index(m, m->index - 1, MENU_ALL);
- t = TOK_NEXT;
- men = (*m->disp)(m->index, m->arg);
- }
- else {
- menu_index(m, m->number - 1, MENU_ALL);
- t = TOK_NEXT;
- men = (*m->disp)(m->index, m->arg);
- }
-
- }
- }
- else {
- menu_index(m, m->number - 1, MENU_ALL);
- t = TOK_NEXT;
- /*
- * UP ARROW when you are at the top of
- * the menu and the up arrow will take you
- * to the last menu item.
- *
- * Do not match inactive menu items.
- */
- men = (*m->disp)(m->index, m->arg);
- while (men.flags & MENU_INACT) {
- menu_index(m, m->index - 1, MENU_ALL);
- t = TOK_NEXT;
- men = (*m->disp)(m->index, m->arg);
- }
- }
- break;
- case TOK_BRELEASED:
- if (m->ncols > 1) {
- int rows, dummy;
-
- /*
- * Multicolumn menu: get frame size (rows)
- * to determine menu item offset (newindex)
- */
- vt_ctl(m->vid, CTGETSIZ, &rows, &dummy);
- newindex = rows * ((int)((Mouse_col + 1) / m->hwidth));
- newindex += Mouse_row;
- }
- else
- newindex = m->topline + Mouse_row;
- if (newindex != m->index)
- t = TOK_NOP;
- else if (m->flags & MENU_MSELECT)
- t = TOK_MARK; /* multi-select menu */
- else
- t = TOK_OPEN;
- break;
- case TOK_RETURN:
- case TOK_OPEN:
- case TOK_ENTER:
- t = TOK_OPEN;
- break;
- case TOK_HOME:
- menu_index(m, m->topline, MENU_ALL);
- t = TOK_NEXT;
- men = (*m->disp)(m->index, m->arg);
- while (men.flags & MENU_INACT) {
- menu_index(m, m->index + 1, MENU_ALL);
- t = TOK_NEXT;
- men = (*m->disp)(m->index, m->arg);
- }
- break;
- case TOK_BEG:
- menu_index(m, 0, MENU_ALL);
- t = TOK_NEXT;
- men = (*m->disp)(m->index, m->arg);
- while (men.flags & MENU_INACT) {
- menu_index(m, m->index + 1, MENU_ALL);
- t = TOK_NEXT;
- men = (*m->disp)(m->index, m->arg);
- }
- break;
- case TOK_LL:
- case TOK_SHOME: /* move to last item on cur. page */
- {
- int row, col;
- int topline, index; /* abs */
-
- vt_ctl(m->vid, CTGETSIZ, &row, &col);
- menu_ctl(MNU_curid, CTGETPARMS, &topline, &index); /* abs */
- menu_index(m, row + topline - 1, MENU_ALL);
- t = TOK_NEXT;
- men = (*m->disp)(m->index, m->arg);
- while (men.flags & MENU_INACT) {
- menu_index(m, m->index - 1, MENU_ALL);
- t = TOK_NEXT;
- men = (*m->disp)(m->index, m->arg);
- }
- }
- break;
- case TOK_END:
- menu_index(m, m->number - 1, MENU_ALL);
- t = TOK_NEXT;
- men = (*m->disp)(m->index, m->arg);
- while (men.flags & MENU_INACT) {
- menu_index(m, m->index - 1, MENU_ALL);
- t = TOK_NEXT;
- men = (*m->disp)(m->index, m->arg);
- }
- break;
- case TOK_SR:
- if (m->topline > 0) {
- begindex = m->index;
- newindex = m->index - 1;
- /* force reverse scroll */
- menu_index(m, m->topline - 1, 0);
- /*reset position */
- menu_index(m, newindex, MENU_ALL);
- men = (*m->disp)(m->index, m->arg);
- t = TOK_NEXT;
- /*
- * REVERSE SCROLL
- * Do not match inactive menu items.
- */
- while (men.flags & MENU_INACT) {
- if (m->topline > 0) {
- newindex = m->index - 1;
- /* force reverse scroll */
- menu_index(m, m->topline - 1, 0);
- /*reset position */
- menu_index(m, newindex, MENU_ALL);
- men = (*m->disp)(m->index, m->arg);
- t = TOK_NEXT;
- }
- else {
- menu_index(m, begindex, MENU_ALL);
- t = TOK_NOP;
- break;
- }
- }
- }
- break;
- case TOK_SF:
- if (m->ncols == 1) {
- int row;
- int col;
-
- vt_ctl(m->vid, CTGETSIZ, &row, &col);
- if (m->topline + row < m->number) {
- begindex = m->index;
- newindex = m->index + 1;
- /* cause scroll */
- menu_index(m, m->topline + row, 0);
- /* reset position */
- menu_index(m, newindex, MENU_ALL);
- t = TOK_NEXT;
- men = (*m->disp)(m->index, m->arg);
- while (men.flags & MENU_INACT) {
- if (m->topline + row < m->number) {
- newindex = m->index + 1;
- /* cause scroll */
- menu_index(m, m->topline + row, 0);
- /* reset position */
- menu_index(m, newindex, MENU_ALL);
- t = TOK_NEXT;
- men = (*m->disp)(m->index, m->arg);
- }
- else {
- menu_index(m, begindex, MENU_ALL);
- t = TOK_NOP;
- break;
- }
- }
- }
- }
- break;
- case TOK_PPAGE:
- if (m->ncols == 1) {
- int row;
- int col;
-
- if (m->topline == 0)
- break;
- vt_ctl(m->vid, CTGETSIZ, &row, &col);
- newindex = m->topline - row + row / 2;
- if (newindex < 0)
- newindex = 0;
- /*
- * force middle of page
- * then set position to top of window
- */
- menu_index(m, newindex, 0);
- menu_index(m, m->topline, MENU_ALL);
- t = TOK_NEXT;
- men = (*m->disp)(m->index, m->arg);
- while (men.flags & MENU_INACT) {
- if (m->index > 0) {
- menu_index(m, m->index - 1, MENU_ALL);
- t = TOK_NEXT;
- men = (*m->disp)(m->index, m->arg);
- }
- else {
- menu_index(m, m->number - 1, MENU_ALL);
- t = TOK_NEXT;
- men = (*m->disp)(m->index, m->arg);
- }
-
- }
- }
- break;
- case TOK_NPAGE:
- if (m->ncols == 1) {
- int row;
- int col;
-
- vt_ctl(m->vid, CTGETSIZ, &row, &col);
- if ((m->topline + row) == m->number)
- break;
- newindex = m->topline + row + row / 2;
- if (newindex >= m->number)
- newindex = m->number;
- /*
- * force middle of page
- * then set position to top of window
- */
- menu_index(m, newindex, 0);
- menu_index(m, m->topline, MENU_ALL);
- t = TOK_NEXT;
- men = (*m->disp)(m->index, m->arg);
- while (men.flags & MENU_INACT) {
- if (m->index < m->number - 1) {
- menu_index(m, m->index + 1, MENU_ALL);
- t = TOK_NEXT;
- men = (*m->disp)(m->index, m->arg);
- }
- else {
- menu_index(m, 0, MENU_ALL);
- t = TOK_NEXT;
- men = (*m->disp)(m->index, m->arg);
- }
- }
- }
- break;
- default:
- if (myisprint((int) t)) {
- if ((newindex = menu_match(m, nil, 0, t)) != FAIL) {
- menu_index(m, newindex, 1);
- men = (*m->disp)(m->index, m->arg);
- while (men.flags & MENU_INACT) {
- if (m->index < m->number - 1) {
- menu_index(m, m->index + 1, MENU_ALL);
- men = (*m->disp)(m->index, m->arg);
- }
- else {
- menu_index(m, 0, MENU_ALL);
- men = (*m->disp)(m->index, m->arg);
- }
- }
- return TOK_NEXT;
- }
- else {
- sprintf(badmatch, "Can't match item starting with \"%c\"", (char) t);
- mess_temp(badmatch);
- mess_lock();
- return(TOK_BADCHAR);
- }
- }
- break;
- }
- _menu_cleanup();
- return t;
-}
-
-void
-_menu_cleanup()
-{
- if (curstring)
- free(curstring);
- curstring = NULL;
-}
-
-static void strtolower();
-static int nocase_strncmp();
-
-static int
-menu_match(m, s, n, t)
-register struct menu *m;
-char *s;
-int n;
-token t;
-{
- register int i;
- register int start;
- register int count;
- register char *p;
- char badmatch[PATHSIZ];
-
- start = m->index;
- for (i = m->index, count = 0; count < m->number; count++) {
- struct menu_line men;
-
- men = (*m->disp)(i, m->arg);
- p = men.highlight;
- if (nocase_strncmp(p, s, n) == 0 && ((p[n] == t) ||
- (isupper(t) && (p[n] == _tolower(t))) ||
- (islower(t) && (p[n] == _toupper(t))))) {
- /*
- * Do not match inactive menu items
- */
- if (men.flags & MENU_INACT) {
- sprintf(badmatch,"Can't match inactive menu item.");
- mess_temp(badmatch);
- mess_lock();
- return start;
- }
- else {
- if (m->index != i || curstring == NULL) {
- if (curstring)
- free(curstring);
- curstring = strsave(p);
- strtolower(curstring);
- }
- }
- return i;
- }
- if (++i >= m->number)
- i = 0;
- }
- return FAIL;
-}
-
-static void
-strtolower(s)
-register char *s;
-{
- for (; *s != '\0'; s++)
- *s = tolower(*s);
-}
-
-static int
-nocase_strncmp(p, s, n)
-register char *p, *s;
-int n;
-{
- register int i;
-
- if (!p || !s)
- return(1);
- for (i = 0; i < n; i++) {
- if (!(*p || *s))
- break; /* both strings shorter than n */
- else if (tolower(*p++) != tolower(*s++))
- return(1);
- }
- return(0);
-}
diff --git a/usr/src/cmd/fmli/oeu/Makefile b/usr/src/cmd/fmli/oeu/Makefile
deleted file mode 100644
index a32a300ffe..0000000000
--- a/usr/src/cmd/fmli/oeu/Makefile
+++ /dev/null
@@ -1,60 +0,0 @@
-#
-# CDDL HEADER START
-#
-# The contents of this file are subject to the terms of the
-# Common Development and Distribution License, Version 1.0 only
-# (the "License"). You may not use this file except in compliance
-# with the License.
-#
-# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
-# or http://www.opensolaris.org/os/licensing.
-# See the License for the specific language governing permissions
-# and limitations under the License.
-#
-# When distributing Covered Code, include this CDDL HEADER in each
-# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
-# If applicable, add the following below this CDDL HEADER, with the
-# fields enclosed by brackets "[]" replaced with your own identifying
-# information: Portions Copyright [yyyy] [name of copyright owner]
-#
-# CDDL HEADER END
-#
-#
-# Copyright 2004 Sun Microsystems, Inc. All rights reserved.
-# Use is subject to license terms.
-#
-# ident "%Z%%M% %I% %E% SMI"
-#
-# cmd/fmli/oeu/Makefile
-#
-LIBRARY = liboeu.a
-
-OBJECTS = oeu.o oeucheck.o rm_atob.o genparse.o
-
-# include library definitions
-include ../../../lib/Makefile.lib
-
-C99MODE= $(C99_DISABLE)
-
-# Specifically request the construction of a static library.
-# This library is not installed in the proto area.
-LIBS = $(LIBRARY)
-
-# inc must be first.
-CPPFLAGS = -I../inc $(CPPFLAGS.master)
-
-.KEEP_STATE:
-
-# two objects from one source.
-%/oeucheck.o := CPPFLAGS += -DJUSTCHECK
-
-%/oeucheck.o: oeu.c
- $(COMPILE.c) -o $@ oeu.c
-
-all: $(LIBS)
-
-install: all
- @echo "$(LIBRARY) is not installed."
-
-# include library targets
-include ../../../lib/Makefile.targ
diff --git a/usr/src/cmd/fmli/oeu/genparse.c b/usr/src/cmd/fmli/oeu/genparse.c
deleted file mode 100644
index eec1415c1e..0000000000
--- a/usr/src/cmd/fmli/oeu/genparse.c
+++ /dev/null
@@ -1,180 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-/*
- * Copyright (c) 1985 AT&T
- * All Rights Reserved
- */
-
-#ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.5 */
-
-#include <stdio.h>
-#include <string.h>
-#include <ctype.h>
-#include <sys/types.h> /* EFT abs k16 */
-#include "wish.h"
-#include "io.h"
-#include "retcds.h"
-#include "parse.h"
-#include "smdef.h"
-#include "typetab.h"
-#include "mail.h"
-#include "terror.h"
-#include "moremacros.h"
-
-long Befkwd;
-/* les static???
-static char *strsave();
-*/
-static char *Nullstr = "";
-int
-skip(fp, p)
-FILE *fp;
-struct oeh *p;
-{
- return(skiptokwd(fp));
-}
-
-long
-getnum(fp, type)
-FILE *fp;
-int type;
-{
- char c;
- int i;
- long atol();
- char buf[STR_SIZE];
-
- if (skipspace(fp) == KEYWORD)
- return(0L);
- for (i = 0, c = getc(fp); isdigit(c); i++, c = getc(fp))
- buf[i] = c;
- buf[i] = '\0';
- ungetc(c, fp);
- if (type == SKIP)
- skiptokwd(fp);
- return(atol(buf));
-}
-
-char *
-uptokwd(fp)
-FILE *fp;
-{
- char *p;
- int c;
- int len;
- char buf[STR_SIZE];
-
- if (skipspace(fp) == KEYWORD)
- return(Nullstr);
- fgets(buf, STR_SIZE, fp);
- p = strsave(buf);
- len = strlen(p);
- p[len - 1] = '\0';
- while ((c = getc(fp)) == ' ' || c == '\t') {
- if (skipspace(fp) == KEYWORD)
- return(NULL);
- fgets(buf, STR_SIZE, fp);
- if ((p = realloc(p, (strlen(buf) + len + 3) * sizeof(char))) == NULL)
- fatal(NOMEM, NULL);
- strcat(p, " ");
- strcat(p, buf);
- len = strlen(p);
- p[len - 1] = '\0';
- }
- ungetc(c, fp);
- return(p);
-}
-
-int
-nextkwd(fp, buf)
-FILE *fp;
-char *buf;
-{
- int c;
- int i;
-
- Befkwd = ftell(fp);
- if ((c = getc(fp)) == '\n')
- return(PDONE);
- for (i = 0; c != '\n' && c != '\t' && c != ' ' && c != EOF; c = getc(fp), i++)
- if (i >= STR_SIZE)
- return(PDONE);
- else
- buf[i] = (char)LOWER(c); /* abs: added cast for lint */
- if (c == EOF)
- return(EOF);
-
- buf[i] = '\0';
- if (strncmp(buf, SEPLINE, 10) == 0)
- return(PDONE);
- ungetc(c, fp);
- /*if (buf[i - 1] != ':' && buf[0] != '>')*/
- /*return(NOTKEY);*/
- return(KEYWORD);
-}
-
-/*
-** Could easily be made into a macro if preferrable
-*/
-int
-skiptokwd(fp)
-FILE *fp;
-{
- int c;
- char buf[STR_SIZE];
-
- for (fgets(buf, STR_SIZE, fp); (c = getc(fp)) == ' ' || c == '\t'; fgets(buf, STR_SIZE, fp));
- if (c == EOF)
- return(EOF);
- ungetc(c, fp);
- return(KEYWORD);
-}
-
-int
-skipspace(fp)
-FILE *fp;
-{
- int c;
-
- while ((c = getc(fp)) != EOF) {
- switch (c) {
- case '\t':
- case ' ':
- continue;
- case '\n':
- if ((c = getc(fp)) == ' ' || c == '\t')
- continue;
- else {
- ungetc(c, fp);
- return(KEYWORD);
- }
- default:
- ungetc(c, fp);
- return(WORD);
- }
- }
- return(EOF);
-}
diff --git a/usr/src/cmd/fmli/oeu/oeu.c b/usr/src/cmd/fmli/oeu/oeu.c
deleted file mode 100644
index eb4206ac72..0000000000
--- a/usr/src/cmd/fmli/oeu/oeu.c
+++ /dev/null
@@ -1,301 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-
-/*
- * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-/* Copyright (c) 1984, 1985, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-#include <stdio.h>
-#include <string.h>
-#include <ctype.h>
-#include <sys/types.h> /* EFT abs k16 */
-#include "wish.h"
-#include "io.h"
-#include "retcds.h"
-#include "parse.h"
-#include "smdef.h"
-#include "typetab.h"
-#include "mail.h"
-#include "partabdefs.h"
-#include "terror.h"
-#include "sizes.h"
-
-
-#define NOFIELDS 20
-#define PARTFIELDS 13
-static int look_ahead = 0;
-char *uptokwd();
-long getnum();
-int skipspace();
-static int stopit();
-extern int skip(); /* >>>> CHANGED FROM "static" <<<< */
-static int obj_num();
-static int obj_name();
-static int obj_type();
-static void encrytest();
-static int par_count();
-static struct parsetab {
- char *testring;
- int (*func)();
-} Parsetab[NOFIELDS] =
- {
- { "type:", obj_type },
- { "application:", skip },
- { "format:", skip },
- { "product-id:", skip },
- { "object-number:", obj_num },
- { "count:", par_count },
- { "name:", obj_name },
- { "cdate:", skip },
- { "moddate:", skip },
- { "author:", skip },
- { "folder:", skip },
- { "keywords:", skip },
- { "subject:", skip },
- { "product-info:", skip },
- { "part-type:", stopit },
- { "encrypted:", stopit },
- { "encryption-test:", stopit },
- { "part-encoding:", stopit },
- { "encoding-algorithm:",stopit },
- { "part-length:", stopit }
-};
-
-static int
-stopit(fp, p)
-FILE *fp;
-struct oeh *p;
-{
- look_ahead = TRUE;
- return (0);
-}
-int
-#ifndef JUSTCHECK
-oeuparse(from, p, unpack)
-#else
-oeucheck(from, p, unpack)
-#endif /* JUSTCHECK */
-char *from;
-struct oeh *p;
-int unpack;
-{
- struct opt_entry *parts, *obj_to_parts();
- struct one_part *apart, *opt_next_part();
- FILE *fp, *fp2;
- char *enc, *type ,*filename();
- int c, kwd, i /* , place */; /* abs: vaiable unused */
- long length;
- char partname[PATHSIZ], fullname[PATHSIZ];
- char buf[STR_SIZE];
-
- if ((fp = fopen(from, "r")) == NULL) {
- warn(NOPEN, from);
- return(OEH_BAD);
- }
- p->name = p->num = NULL;
- p->encrytest = NULL;
- p->count = 1;
- while ((kwd = nextkwd(fp, buf)) == PDONE);
- if (kwd == EOF) {
- fclose(fp);
- return(OEH_BAD);
- }
- if (strcmp(buf, "version:") && strcmp(buf, "content-version:")) {
- fclose(fp);
- return(OEH_NOT);
- }
- skiptokwd(fp);
- look_ahead = FALSE;
- while ((kwd = nextkwd(fp, buf)) == KEYWORD) {
- for (i = 0; i < NOFIELDS; i++)
- if (strcmp(buf, Parsetab[i].testring) == 0) {
- (*(Parsetab[i].func))(fp, p);
- break;
- }
- if (i == NOFIELDS)
- skiptokwd(fp);
- if (i > PARTFIELDS)
- break;
- }
- if (((parts = obj_to_parts(p->num)) == NULL) && ((unpack == NUM_CHECK) || (p->count > 1))) {
- fclose(fp);
- return(OBJ_UNK);
- }
- if ((unpack == NUM_CHECK) && (parts->int_class & CL_OEU)) {
- fclose(fp);
- return(OBJ_OEU);
- }
- if (parts->int_class & CL_OEU)
- parts = NULL;
- if (!look_ahead)
- while ((kwd = nextkwd(fp, buf)) == PDONE);
- if (kwd == EOF) {
- fclose(fp);
- return(OEH_BAD);
- }
- while (kwd == KEYWORD) {
- if (strcmp(buf, "part-type:") == 0) {
- type = uptokwd(fp);
- kwd = nextkwd(fp, buf);
- }
- else if (strcmp(buf, "encrypted:") == 0) {
- skiptokwd(fp);
- kwd = nextkwd(fp, buf);
- }
- else if (strcmp(buf, "encryption-test:") == 0) {
- encrytest(fp, p);
- kwd = nextkwd(fp, buf);
- }
- else if (strcmp(buf, "part-encoding:") == 0) {
- enc = uptokwd(fp);
- if (strncmp(enc, "ascii", 5) && strncmp(enc, "binary", 6)) {
- fclose(fp);
- return(ENC_BAD);
- }
- kwd = nextkwd(fp, buf);
- }
- else if (strcmp(buf, "encoding-algorithm:") == 0) {
- char *encod;
-
- encod = uptokwd(fp);
- if (strncmp(encod, "btoa", 4) || strncmp(enc, "binary", 6)) {
- fclose(fp);
- return(ENC_BAD);
- }
- kwd = nextkwd(fp, buf);
- }
- else if (strcmp(buf, "part-length:") == 0) {
- length = getnum(fp, SKIP);
- if ((unpack == READ_HEADER) || ((unpack == NUM_CHECK) && p->encrytest))
- break;
-#ifndef JUSTCHECK
- if (!parts) {
- if (strcmp(enc, "binary") == 0)
- rm_atob(fp, p->file);
- else {
- if ((fp2 = fopen(p->file, "w")) == NULL) {
- warn(NOPEN, p->file);
- fclose(fp);
- return(OEH_BAD);
- };
- for (i = 0; (i < length) && ((c = getc(fp)) != EOF); i++)
- putc(c, fp2);
- fclose(fp2);
- }
- while ((kwd = nextkwd(fp, buf)) == PDONE);
- continue;
-
- }
- if (parts->numparts > 1) {
- if (type)
- for (apart = opt_next_part(parts), i = 0;
- (i < MAXPARTS) && (strcmp(apart->part_name, type) != 0) &&apart;
- i++, apart = opt_next_part(NULL));
- if (!type || i == MAXPARTS) {
- fclose(fp);
- return(PART_BAD);
- }
- }
- else
- apart = opt_next_part(parts);
- sprintf(partname, apart->part_template, filename(p->file));
- strcpy(fullname, p->file);
- strcpy(filename(fullname), partname);
- if ((apart->part_flags & PRT_BIN) || p->encrytest) {
- rm_atob(fp, fullname);
- }
- else {
- if ((fp2 = fopen(fullname, "w")) == NULL) {
- warn(NOPEN, fullname);
- fclose(fp);
- return(OEH_BAD);
- }
- for (i = 0; (i < length) && ((c = getc(fp)) != EOF); i++)
- putc(c, fp2);
- fclose(fp2);
- }
- while ((kwd = nextkwd(fp, buf)) == PDONE);
-#endif /* JUSTCHECK */
- }
- else {
- skiptokwd(fp);
- kwd = nextkwd(fp, buf);
- }
- }
- fclose(fp);
- return(0);
-}
-static void
-encrytest(fp, p)
-FILE *fp;
-struct oeh *p;
-{
- p->encrytest = uptokwd(fp);
-}
-static int
-obj_num(fp, p)
-FILE *fp;
-struct oeh *p;
-{
- if (skipspace(fp) == KEYWORD)
- p->num = NULL;
- else
- p->num = uptokwd(fp);
- return(KEYWORD);
-}
-static int
-obj_type(fp, p)
-FILE *fp;
-struct oeh *p;
-{
- if (skipspace(fp) == KEYWORD)
- p->name = NULL;
- else
- p->type = uptokwd(fp);
- return(KEYWORD);
-}
-static int
-obj_name(fp, p)
-FILE *fp;
-struct oeh *p;
-{
- if (skipspace(fp) == KEYWORD)
- p->name = NULL;
- else
- p->name = uptokwd(fp);
- return(KEYWORD);
-}
-static int
-par_count(fp, p)
-FILE *fp;
-struct oeh *p;
-{
- p->count = (int) getnum(fp, SKIP);
- return(KEYWORD);
-}
diff --git a/usr/src/cmd/fmli/oeu/rm_atob.c b/usr/src/cmd/fmli/oeu/rm_atob.c
deleted file mode 100644
index 528a7edeed..0000000000
--- a/usr/src/cmd/fmli/oeu/rm_atob.c
+++ /dev/null
@@ -1,187 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-
-/*
- * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-/* Copyright (c) 1984, 1985, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-/*
- * ``atob'' - Convert an ASCII "btoa" file to binary.
- *
- * If bad chars, or checksums do not match: exit(1) and produce NO output.
- * Assumes that int is 32 bits.
- *
- * Author:
- * Paul Rutter (philabs!per)
- * Received from netnews (net.sources) 3-May-84 15:47:06 EDT
- * Adopted for uOMS:
- * R. P. Eby (pegasus!eby)
- * Modified to work on 16-bit machines 20-Jul-84
- */
-
-#include <stdio.h>
-
-#define ulong unsigned long
-#define streq(s0, s1) strcmp(s0, s1) == 0
-#define DE(c) ((c) - ' ')
-
-static long Ceor = 0;
-static long Csum = 0;
-static long Crot = 0;
-static long bcount = 0;
-static long word = 0;
-static FILE *xtmpfile;
-static long Outcount;
-static long Bufcount;
-static char Outbuf[4];
-static void myputc();
-
-int
-rm_atob(fp, filenm)
-FILE *fp;
-char *filenm;
-{
- register long c;
- char buf[100];
- long n1, n2, oeor, osum, orot;
-
- Outcount = Bufcount = Ceor = Csum = Crot = bcount = word = 0;
- xtmpfile = fopen(filenm, "w+");
- if (xtmpfile == NULL)
- return(1);
- /* search for header line */
- for (;;) {
- if (fgets(buf, sizeof buf, fp) == NULL) {
- fatal();
- return(1);
- }
- if (streq(buf, "xbtoa Begin\n")) {
- break;
- }
- }
- while ((c = getc(fp)) != EOF) {
- if (c == '\n') {
- continue;
- } else if (c == 'x') {
- break;
- } else {
- decode(c);
- }
- }
- if (fscanf(fp, "btoa End N %ld %lx E %lx S %lx R %lx\n", &n1, &n2, &oeor, &osum, &orot) != 5) {
- fatal();
- return(1);
- }
- while (Outcount < n1)
- myputc(' ', xtmpfile);
- if ((n1 != n2) || (oeor != Ceor) || (osum != Csum) || (orot != Crot)) {
- fatal();
- return(1);
- }
- fclose(xtmpfile);
- return(0);
-}
-
-int
-fatal(void)
-{
- fclose(xtmpfile);
- return (0);
-}
-
-int
-decode(c)
-register long c;
-{
- if (c == (ulong) 'z') {
- if (bcount != 0) {
- fatal();
- } else {
- byteout(0L);
- byteout(0L);
- byteout(0L);
- byteout(0L);
- }
- } else if ((c >= (ulong) ' ') && (c < (ulong) (' ' + 85))) {
- if (bcount == 0) {
- word = DE(c);
- ++bcount;
- } else if (bcount < 4) {
- word *= 85L;
- word += DE(c);
- ++bcount;
- } else {
- word = ((ulong) word * (ulong) 85) + DE(c);
- byteout((word >> 24) & 255L);
- byteout((word >> 16) & 255L);
- byteout((word >> 8) & 255L);
- byteout(word & 255L);
- word = 0;
- bcount = 0;
- }
- } else {
- fatal();
- }
- return (0);
-}
-
-int
-byteout(c)
-register long c;
-{
-
- Ceor ^= c;
- Csum += c;
- Csum += 1;
- if (Crot & 0x80000000L) {
- Crot <<= 1;
- Crot += 1;
- } else {
- Crot <<= 1;
- }
- Crot += c;
- myputc(c, xtmpfile);
- return (0);
-}
-
-static void
-myputc(c, fp)
-int c;
-FILE *fp;
-{
- int i;
-
- Bufcount++;
- if (Bufcount > 4) {
- putc(*Outbuf, fp);
- Outcount++;
- }
- for (i = 0; i < 3; i++)
- Outbuf[i] = Outbuf[i + 1];
- Outbuf[3] = c;
-}
-
diff --git a/usr/src/cmd/fmli/oh/Makefile b/usr/src/cmd/fmli/oh/Makefile
deleted file mode 100644
index c4d17d92bf..0000000000
--- a/usr/src/cmd/fmli/oh/Makefile
+++ /dev/null
@@ -1,63 +0,0 @@
-#
-# CDDL HEADER START
-#
-# The contents of this file are subject to the terms of the
-# Common Development and Distribution License, Version 1.0 only
-# (the "License"). You may not use this file except in compliance
-# with the License.
-#
-# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
-# or http://www.opensolaris.org/os/licensing.
-# See the License for the specific language governing permissions
-# and limitations under the License.
-#
-# When distributing Covered Code, include this CDDL HEADER in each
-# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
-# If applicable, add the following below this CDDL HEADER, with the
-# fields enclosed by brackets "[]" replaced with your own identifying
-# information: Portions Copyright [yyyy] [name of copyright owner]
-#
-# CDDL HEADER END
-#
-#
-# Copyright 2004 Sun Microsystems, Inc. All rights reserved.
-# Use is subject to license terms.
-#
-# ident "%Z%%M% %I% %E% SMI"
-#
-# cmd/fmli/oh/Makefile
-#
-LIBRARY = liboh.a
-
-OBJECTS = action.o alias.o cmd.o detab.o detect.o dispfuncs.o \
- evstr.o externoot.o fm_mn_par.o getval.o helptext.o \
- if_ascii.o if_dir.o if_init.o if_exec.o if_form.o if_help.o \
- if_menu.o ifuncs.o interrupt.o is_objtype.o misc.o \
- namecheck.o nextpart.o obj_to_opt.o obj_to_par.o odftread.o \
- odikey.o oh_init.o ootpart.o ootread.o opt_rename.o optab.o \
- optabfuncs.o ott_mv.o partab.o partabfunc.o pathtitle.o \
- pathfstype.o path_to_vp.o pathott.o scram.o slk.o \
- suffuncs.o typefuncs.o typetab.o
-
-# include library definitions
-include ../../../lib/Makefile.lib
-
-C99MODE= $(C99_DISABLE)
-
-# Specifically request the construction of a static library.
-# This library is not installed in the proto area.
-LIBS = $(LIBRARY)
-
-# inc must be first.
-CPPFLAGS = -I../inc $(CPPFLAGS.master)
-CPPFLAGS += -DWISH
-
-.KEEP_STATE:
-
-all: $(LIBS)
-
-install: all
- @echo "$(LIBRARY) is not installed."
-
-# include library targets
-include ../../../lib/Makefile.targ
diff --git a/usr/src/cmd/fmli/oh/action.c b/usr/src/cmd/fmli/oh/action.c
deleted file mode 100644
index 84829435fe..0000000000
--- a/usr/src/cmd/fmli/oh/action.c
+++ /dev/null
@@ -1,95 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-/*
- * Copyright (c) 1985 AT&T
- * All Rights Reserved
- */
-#ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.8 */
-
-#include <stdio.h>
-#include <ctype.h>
-#include "wish.h"
-#include "token.h"
-#include "var_arrays.h"
-#include "moremacros.h"
-
-/*
- * There should be ONE definition of MAX_ARGS in wish.h
- */
-#define MAX_ARGS 25
-
-/*
-** Takes a list and turns it into an action. If there is no action,
-** the action is close.
-*/
-token
-make_action(list)
-register char **list;
-{
- extern char *Args[];
- extern int Arg_count;
- token setaction();
-
- if (!list || !array_len(list) || !list[0] || !list[0][0])
- return(TOK_CLOSE);
- return(setaction(list));
-}
-
-/*
-** Takes the list and sets Args to each member and returns the correct
-** token.
-*/
-token
-setaction(list)
-char **list;
-{
- extern char *Args[MAX_ARGS];
- extern int Arg_count;
- int lcv;
-
- if (!list || !array_len(list) || !list[0] || !list[0][0])
-/* if (!(list && array_len(list))) above is safer. abs */
- return(TOK_BADCHAR);
- if (strnCcmp(*list, "RETURN", 7) == 0) {
- if (isdigit(*list[1]))
- return(atoi(list[1]));
- return(mencmd_to_tok(list[1]));
- }
- lcv = array_len(list);
- for (Arg_count = 0; Arg_count < lcv && Arg_count < (MAX_ARGS - 1); Arg_count++) {
- if (Args[Arg_count])
- free(Args[Arg_count]); /* les */
- Args[Arg_count] = strsave(list[Arg_count]);
- }
-
-
- if (Args[Arg_count])
- free(Args[Arg_count]); /* les */
-
- Args[Arg_count] = NULL;
- return(mencmd_to_tok(list[0]));
-}
-
diff --git a/usr/src/cmd/fmli/oh/alias.c b/usr/src/cmd/fmli/oh/alias.c
deleted file mode 100644
index b2bca3addd..0000000000
--- a/usr/src/cmd/fmli/oh/alias.c
+++ /dev/null
@@ -1,187 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/*
- * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-/* Copyright (c) 1984, 1985, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-#include <stdio.h>
-#include <string.h>
-#include "wish.h"
-#include "token.h"
-#include "slk.h"
-#include "actrec.h"
-#include "ctl.h"
-#include "moremacros.h"
-#include "sizes.h"
-
-extern int Vflag;
-extern char *Aliasfile;
-
-#define MAX_ALIAS 32
-
-static int Num_alias = 0;
-static struct pathalias {
- char *alias;
- char *path;
-} Alias[MAX_ALIAS];
-
-static void get_one(char *path);
-static void get_aliases(void);
-
-char *
-path_to_full(s)
-char *s;
-{
- int n;
- char buf[PATHSIZ];
- register char *p, *q;
- bool b;
- struct actrec *a;
- extern char *Home, *Filecabinet;
- struct actrec *wdw_to_ar();
- char *expand(), *alias_to_path();
-
- if (strcmp(s, "-i") == 0) /* unfortunate kludge for inline objects */
- return(strsave(s));
-
- if (Num_alias == 0 && Aliasfile)
- get_aliases();
-
- /* check if a number, if so then path of an open folder */
-
- if ((n = atoi(s)) > 0 && strspn(s, "0123456789") == strlen(s) &&
- (a = wdw_to_ar(n)) != NULL)
- return(strsave(a->path));
-
- p = expand(s);
- if (*p == '/') /* already a full path */
- return(p);
-
- /* check if an alias of another path */
-
- if (q = strchr(p, '/'))
- *q = '\0';
- if ((s = alias_to_path(p, q ? q + 1 : NULL)) != NULL)
- return(s);
- if (q)
- *q = '/'; /* restore p */
-
- if (Vflag) {
- /*
- * relative to current folder if there is one, else FILECABINET
- */
-
- if (ar_ctl(ar_get_current(), CTISDEST, &b, NULL, NULL, NULL, NULL, NULL) != FAIL && b == TRUE)
- sprintf(buf, "%s/%s", ar_get_current()->path, p);
- else
- sprintf(buf, "%s/%s", Filecabinet, p);
- }
- else
- strcpy(buf, p);
- free(p);
- return(strsave(buf));
-}
-
-static void
-get_aliases(void)
-{
- char path[PATHSIZ];
- extern char *Home;
-
- if (Vflag) {
- sprintf(path, "%s/pref/pathalias", Home);
- get_one(path);
- }
- strcpy(path, Aliasfile);
- get_one(path);
-}
-
-static void
-get_one(char *path)
-{
- FILE *fp;
- char buf[BUFSIZ];
- char *p;
- char *expand();
-
- if ((fp = fopen(path, "r")) == NULL)
- return;
-
- while (Num_alias < MAX_ALIAS && fgets(buf, BUFSIZ, fp)) {
- if (p = strchr(buf, '=')) {
- buf[strlen(buf)-1] = '\0'; /* clip off the newline */
- *p = '\0';
- /* les 12/4
- if (Alias[Num_alias].alias)
- free(Alias[Num_alias].alias);
- */
- Alias[Num_alias].alias = strsave(buf);
- Alias[Num_alias].path = expand(++p);
- Num_alias++;
- }
- }
- fclose(fp);
-}
-
-char *
-alias_to_path(s, rest)
-char *s;
-char *rest;
-{
- register int i;
-
- for (i = 0; i < Num_alias; i++) {
- if (strCcmp(s, Alias[i].alias) == 0) {
- char *hold;
- register char *p;
- char path[PATHSIZ];
-
- if (!strchr(Alias[i].path, ':')) {
- strcpy(path, Alias[i].path);
- if (rest) {
- strcat(path, "/");
- strcat(path, rest);
- }
- return(strsave(path));
- }
- for (p = strtok(hold = strsave(Alias[i].path), ":"); p; p = strtok(NULL, ":")) {
- strcpy(path, p);
- if (rest) {
- strcat(path, "/");
- strcat(path, rest);
- }
- if (access(path, 0) == 0) {
- free(hold);
- return(strsave(path));
- }
- }
- break;
- }
- }
- return(NULL);
-}
diff --git a/usr/src/cmd/fmli/oh/cmd.c b/usr/src/cmd/fmli/oh/cmd.c
deleted file mode 100644
index a04cba694e..0000000000
--- a/usr/src/cmd/fmli/oh/cmd.c
+++ /dev/null
@@ -1,707 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/*
- * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-/* Copyright (c) 1984, 1985, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-#include <stdio.h>
-#include "wish.h"
-#include "token.h"
-#include "slk.h"
-#include "actrec.h"
-#include "terror.h"
-#include "ctl.h"
-#include "menudefs.h"
-#include "vtdefs.h"
-#include "fm_mn_par.h"
-#include "moremacros.h"
-#include "eval.h"
-#include "interrupt.h"
-#include "sizes.h"
-
-extern menu_id menu_make();
-extern char *Args[];
-extern char nil[];
-extern int Arg_count;
-
-struct cmdspec {
- char *name;
- token tok;
- int helpindex;
- char *tokstr;
- char *helpaction;
- char *intr;
- char *onintr;
-};
-
-#define NOTEXT ((int) -1)
-
-/*
- * NODISP is used for internal commands not to be displayed on the
- * command menu.
-*/
-
-#define NODISP ((int) -2)
-
-/*
- * Table from which command defaults are selected
- */
-static struct cmdspec Defaults[] = {
- {"cancel", TOK_CLOSE, 0, NULL, NULL, NULL, NULL },
- {"cleanup", TOK_CLEANUP, 1, NULL, NULL, NULL, NULL },
- {"copy", TOK_COPY, NOTEXT, NULL, NULL, NULL, NULL },
- {"create", TOK_CREATE, NOTEXT, NULL, NULL, NULL, NULL },
- {"delete", TOK_DELETE, NOTEXT, NULL, NULL, NULL, NULL },
- {"display", TOK_DISPLAY, NOTEXT, NULL, NULL, NULL, NULL },
- {"exit", TOK_LOGOUT, 3, NULL, NULL, NULL, NULL },
- {"find", TOK_FIND, NOTEXT, NULL, NULL, NULL, NULL },
- {"frm-mgmt", TOK_WDWMGMT, 4, NULL, NULL, NULL, NULL },
- {"goto", TOK_GOTO, 5, NULL, NULL, NULL, NULL },
- {"help", TOK_HELP, 6, NULL, NULL, NULL, NULL },
- {"move", TOK_MOVE, NOTEXT, NULL, NULL, NULL, NULL },
- {"next-frm", TOK_NEXT_WDW, 7, NULL, NULL, NULL, NULL },
- {"organize", TOK_ORGANIZE, NOTEXT, NULL, NULL, NULL, NULL },
- {"prev-frm", TOK_PREV_WDW, 8, NULL, NULL, NULL, NULL },
- {"print", TOK_PRINT, NOTEXT, NULL, NULL, NULL, NULL },
- {"redescribe", TOK_SREPLACE, NOTEXT, NULL, NULL, NULL, NULL },
- {"refresh", TOK_REFRESH, 9, NULL, NULL, NULL, NULL },
- {"rename", TOK_REPLACE, NOTEXT, NULL, NULL, NULL, NULL },
- {"run", TOK_RUN, NOTEXT, NULL, NULL, NULL, NULL },
- {"security", TOK_SECURITY, NOTEXT, NULL, NULL, NULL, NULL },
- {"show-path", TOK_SHOW_PATH, NOTEXT, NULL, NULL, NULL, NULL },
- {"time", TOK_TIME, NOTEXT, NULL, NULL, NULL, NULL },
- {"undelete", TOK_UNDELETE, NOTEXT, NULL, NULL, NULL, NULL },
- {"unix-system", TOK_UNIX, 10, NULL, NULL, NULL, NULL },
- {"update", TOK_REREAD, 11, NULL, NULL, NULL, NULL },
- {"unix", TOK_UNIX, NODISP, NULL, NULL, NULL, NULL },
- {NULL, TOK_NOP, NOTEXT, NULL, NULL, NULL, NULL }
-};
-
-/*
- * Commands with NODISP have to be last in the above table befor the
- * NULL command.
-*/
-
-#define MAX_CMD 64
-
-/*
- * Command table, presented to the user via the command menu.
- * This table, once initialized, is kept in alphabetical order.
- */
-static struct cmdspec Commands[MAX_CMD];
-
-/*
- * Commands that the user doesn't see in the cmd menu, but exist
- * none-the-less, (most are used for token translations from within
- * the FMLI language).
- */
-static struct cmdspec Interncmd[] = {
- {"badchar", TOK_BADCHAR, NOTEXT, NULL, NULL, NULL, NULL },
- {"choices", TOK_OPTIONS, NOTEXT, NULL, NULL, NULL, NULL },
- {"checkworld", TOK_CHECKWORLD, NOTEXT, NULL, NULL, NULL, NULL },
- {"close", TOK_CLOSE, NOTEXT, NULL, NULL, NULL, NULL },
- {"cmd-menu", TOK_CMD, NOTEXT, NULL, NULL, NULL, NULL },
- {"done", TOK_DONE, NOTEXT, NULL, NULL, NULL, NULL },
- {"enter", TOK_RETURN, NOTEXT, NULL, NULL, NULL, NULL },
- {"exit_now", TOK_LOGOUT, NOTEXT, NULL, NULL, NULL, NULL },
- {"mark", TOK_MARK, NOTEXT, NULL, NULL, NULL, NULL },
- {"nextpage", TOK_NPAGE, NOTEXT, NULL, NULL, NULL, NULL },
- {"nop", TOK_NOP, NOTEXT, NULL, NULL, NULL, NULL },
- {"nunique", TOK_NUNIQUE, NOTEXT, NULL, NULL, NULL, NULL },
- {"objop", TOK_OBJOP, NOTEXT, NULL, NULL, NULL, NULL },
- {"open", TOK_OPEN, NOTEXT, NULL, NULL, NULL, NULL },
- {"prevpage", TOK_PPAGE, NOTEXT, NULL, NULL, NULL, NULL },
- {"release", TOK_RELEASE, NOTEXT, NULL, NULL, NULL, NULL },
- {"reset", TOK_RESET, NOTEXT, NULL, NULL, NULL, NULL },
- {"run", TOK_RUN, NOTEXT, NULL, NULL, NULL, NULL },
- {"togslk", TOK_TOGSLK, NOTEXT, NULL, NULL, NULL, NULL },
-
- /* Secret commands, they wouldn't let us document them... */
- /*{"?", TOK_REDO, NOTEXT, NULL, NULL, NULL, NULL },*/
- /*{"%", TOK_DEBUG, NOTEXT, NULL, NULL, NULL, NULL },*/
- {"=", TOK_SET, NOTEXT, NULL, NULL, NULL, NULL },
-
- {NULL, TOK_NOP, NOTEXT, NULL, NULL, NULL, NULL }
-};
-
-static int Numdefaults = sizeof(Defaults)/sizeof(struct cmdspec);
-static int Numcommands = sizeof(Commands)/sizeof(struct cmdspec);
-static struct actrec *Cmd_ar;
-static char *Tokstr;
-static int Cmd_index;
-
-extern int Vflag; /* is this the User Interface ?? */
-extern char *init_ctl(); /* in if_init.c */
-static struct cmdspec *get_cmd();
-
-int
-cmd_table_init()
-{
- register int i, j;
-
- for (i = 0, j = 0; i < Numdefaults; i++) {
- if (Vflag || Defaults[i].helpindex != NOTEXT)
- Commands[j++] = Defaults[i];
- }
- Commands[j].name = NULL;
- return (0);
-}
-
-static struct menu_line
-cmd_disp(n, ptr)
-int n;
-char *ptr;
-{
- struct menu_line m;
-
- m.description = NULL;
- m.flags = 0;
-
-/* Commands marked as NODISP do not go on the command menu */
-
- if (n >= Numcommands || Commands[n].helpindex == NODISP)
- m.highlight = NULL;
- else
- m.highlight = Commands[n].name;
- return m;
-}
-
-static int
-cmd_odsh(a, t)
-struct actrec *a;
-token t;
-{
- extern int Arg_count;
- char **actstr, **eval_string();
- token tok, make_action();
- int flags;
- char *intr, *onintr;
- t = menu_stream(t);
- if (t == TOK_OPEN && Arg_count <= 1) {
- int line;
-
- (void) menu_ctl(a->id, CTGETPOS, &line);
- if (Commands[line].tok >= 0) /* internal */
- tok = Commands[line].tok;
- else {
- /* update the interrupt structures based on
- the values for the current command, if
- defined else with the inherited values.
- */
- Cur_intr.skip_eval = FALSE;
- if ((intr = Commands[line].intr) == NULL)
- intr = init_ctl(CTGETINTR);
- flags = RET_BOOL;
- Cur_intr.interrupt = FALSE; /* dont intrupt eval of intr */
- Cur_intr.interrupt =
- (bool)(uintptr_t)eval_string(intr, &flags);
-
- if ((onintr = Commands[line].onintr) == NULL)
- onintr = init_ctl(CTGETONINTR);
- Cur_intr.oninterrupt = onintr;
-
- flags = RET_ARGS;
- actstr = eval_string(Commands[line].tokstr, &flags);
- tok = make_action(actstr);
- }
- t = arf_odsh(a->backup, tok);
- (void) ar_close(a, FALSE); /* Command execution causes close */
- }
- else if (t == TOK_NEXT)
- t = TOK_NOP; /* eat it up */
- else if (t == TOK_CANCEL) {
- ar_backup();
- t = TOK_NOP;
- }
- return t;
-}
-
-static int
-cmd_close(a)
-struct actrec *a;
-{
- Cmd_ar = NULL;
- return(AR_MEN_CLOSE(a));
-}
-
-int
-cmd_help(cmd)
-char *cmd;
-{
- char help[PATHSIZ];
- int flags;
- char **helpaction, **eval_string();
- token tok, make_action(), generic_help();
- extern char *Filesys;
- char *cur_cmd(), *tok_to_cmd();
- struct cmdspec *command, *get_cmd();
- extern int Vflag;
-
- if (cmd && *cmd)
- {
-/* below cannot destinguish between user defined cmds. abs k17
-** cmd = tok_to_cmd(cmd_to_tok(cmd));
-*/
- if (cmd_to_tok(cmd) == TOK_NUNIQUE) /* abs k17 */
- {
- mess_temp("Could not find help on that command"); /* abs k17 */
- return(SUCCESS); /* abs k17 */
- }
-
- }
- else
- cmd = cur_cmd();
- if (!cmd || ((command = get_cmd(cmd)) == NULL)) {
- mess_temp("Could not find help on that command");
- return(SUCCESS);
- }
-
- /*
- * If there is a help action defined then do it ...
- * else if there is a "hardcoded" help string use that
- * else if FACE is running use the FACE help files
- * else there is no help available ....
- */
- if (command->helpaction && command->helpaction[0] != '\0') {
- flags = RET_ARGS;
- helpaction = eval_string(command->helpaction, &flags);
- tok = make_action(helpaction);
- return(tok);
- }
- else if (command->helpindex >= 0) /* abs k18 */
- return(generic_help(cmd, command->helpindex));
- else if (Vflag) { /* FACE has its own help file setup */
- sprintf(help, "%s/OBJECTS/Text.help", Filesys);
- objop("OPEN", "TEXT", help, cmd, cmd, NULL);
- return(SUCCESS);
- }
- else
- mess_temp("Could not find help on that command");
- return SUCCESS;
-}
-
-extern char *Help_text[];
-
-char *Help_args[3] = {
- "OPEN",
- "TEXT",
- "-i"
-};
-
-token
-generic_help(name, helpindex)
-char *name;
-int helpindex;
-{
- extern char *Args[];
- extern int Arg_count;
- extern int Vflag;
- register IOSTRUCT *out;
-
- out = io_open(EV_USE_STRING, NULL);
- putastr("title=Help Facility: \"", out);
- putastr(name, out);
- putastr("\"\n", out);
- putastr("lifetime=shortterm\n", out); /* was longterm abs k18 */
- putastr("rows=12\n", out);
- putastr("columns=72\n", out);
- putastr("begrow=distinct\n", out);
- putastr("begcol=distinct\n", out);
- putastr("text=\"", out);
- putastr(Help_text[helpindex], out);
- putastr("\"\n", out);
- if (Vflag) {
- putastr("name=\"CONTENTS\"\n",out);
- putastr("button=8\n",out);
- putastr("action=OPEN MENU OBJECTS/Menu.h0.toc\n",out);
- }
- for (Arg_count = 0; Arg_count < 3; Arg_count++)
- {
- if ( Args[Arg_count])
- free( Args[Arg_count]); /* les 12/4 */
- Args[Arg_count] = strsave(Help_args[Arg_count]);
- }
- if ( Args[Arg_count])
- free( Args[Arg_count]); /* les 12/4 */
- Args[Arg_count++] = (char *) io_string(out);
- if ( Args[Arg_count])
- free( Args[Arg_count]); /* les 12/4 */
- Args[Arg_count] = NULL;
- io_close(out);
- return(TOK_OPEN);
-}
-
-struct actrec *
-cmd_create()
-{
- struct actrec a;
- struct actrec *ar_create(), *ar_current();
-
- if (Numcommands == 0) {
- mess_temp("There are no commands in the command menu");
- return(NULL);
- }
-
- a.id = (int) menu_make(-1, "Command Menu", VT_NONUMBER | VT_CENTER,
- VT_UNDEFINED, VT_UNDEFINED, 0, 0, cmd_disp, NULL);
-
- ar_menu_init(&a);
- a.fcntbl[AR_CLOSE] = cmd_close;
- a.fcntbl[AR_ODSH] = cmd_odsh;
- a.fcntbl[AR_HELP] = cmd_help;
- a.flags = 0;
-
- /* theres no frame level interrupt or oninterrupt descriptors.. */
- /* .. so set up values in the actrec now since they'll only .. */
- /* .. change on a re-init. */
- ar_ctl(&a, CTSETINTR, init_ctl(CTGETINTR), NULL, NULL, NULL, NULL, NULL);
- ar_ctl(&a, CTSETONINTR, init_ctl(CTGETONINTR), NULL, NULL, NULL, NULL, NULL);
-
- Cmd_ar = ar_create(&a);
- return(ar_current(Cmd_ar, FALSE)); /* abs k15 */
-}
-
-token
-_cmd_to_tok(cmd, partial, slk)
-char *cmd;
-bool partial;
-bool slk;
-{
- register int i;
- register int size = (cmd) ? strlen(cmd) : 0;
- register int cmdnumatch = 0, slknumatch = 0; /* number of matches */
- register int cmdmatch= -1, slkmatch = -1; /* index of last match */
- extern struct slk SLK_array[MAX_SLK];
- int strnCcmp(), strCcmp();
-
- Tokstr = NULL;
- Cmd_index = -1;
- if (!cmd) /* no input (^j <return>) */
- return(TOK_CANCEL);
- if (slk) {
- for (i = 0; i < MAX_SLK; i++) {
- if ((partial ? strnCcmp : strCcmp)(SLK_array[i].label, cmd, size) == 0) {
- /*
- * If there is another match BUT ...
- * the command token is the same
- * OR the name strings match exactly
- * then ignore the 'ith' SLK
- */
- if (slknumatch == 1 &&
- (SLK_array[i].tok == SLK_array[slkmatch].tok ||
- strCcmp(SLK_array[slkmatch].label, SLK_array[i].label) == 0))
- continue;
- slknumatch++;
- slkmatch = i;
- }
- }
- }
-
- for (i = 0; i < Numcommands; i++) {
- if (Commands[i].name == NULL)
- Commands[i].name = nil;
- if ((partial ? strnCcmp : strCcmp)(Commands[i].name, cmd, size) == 0) {
- /*
- * if there is an exact match then break
- */
- if (partial && strCcmp(Commands[i].name, cmd) == 0) {
- cmdmatch = i;
- cmdnumatch = 1;
- break;
- }
- cmdnumatch++;
- cmdmatch = i;
- }
- }
-/* since "unix" is unadvertised, don't get confused by 2 partial matches
- * for unix and unix-system. mek k17
- */
- if ((slknumatch == 0) && (cmdnumatch == 2) &&
- (strcmp(Commands[cmdmatch].name, "unix") == 0))
- return(Commands[cmdmatch].tok);
-
- if (slknumatch + cmdnumatch == 0) {
- /*
- * no matches, check internal command table
- */
- for (i = 0; Interncmd[i].name; i++)
- if (strCcmp(Interncmd[i].name, cmd) == 0)
- return(Interncmd[i].tok);
- return(TOK_NOP);
- }
- else if (slknumatch > 1 || cmdnumatch > 1) /* input not unique */
- return(TOK_NUNIQUE);
- else if (slknumatch == 1 && cmdnumatch == 0) { /* matched slk only */
- Tokstr = SLK_array[slkmatch].tokstr;
- return(SLK_array[slkmatch].tok);
- }
- else if (cmdnumatch == 1 && slknumatch == 0) { /* matched cmd only */
- Tokstr = Commands[cmdmatch].tokstr;
- Cmd_index = cmdmatch;
- return(Commands[cmdmatch].tok);
- }
- else {
- /*
- * If there is only ONE match in both the
- * SLKS and the Command Menu then
- * - the SLK takes precedence if both match exactly
- * - match is not unique if both match "partially"
- */
- if (strCcmp(SLK_array[slkmatch].label, Commands[cmdmatch].name) == 0) {
- Tokstr = SLK_array[slkmatch].tokstr;
- return(SLK_array[slkmatch].tok);
- }
- else
- return(TOK_NUNIQUE);
- }
-}
-
-/* LES: replace with MACRO's
-
-token
-cmd_to_tok(cmd)
-char *cmd;
-{
- return(_cmd_to_tok(cmd, TRUE, TRUE));
-}
-
- NEVER CALLED
-token
-fullcmd_to_tok(cmd)
-char *cmd;
-{
- return(_cmd_to_tok(cmd, FALSE, TRUE));
-}
-
-token
-mencmd_to_tok(cmd)
-char *cmd;
-{
- return(_cmd_to_tok(cmd, FALSE, FALSE));
-}
-*/
-
-char *
-tok_to_cmd(tok)
-token tok;
-{
- register int i;
- extern struct slk SLK_array[];
-
- /* Most frequently referenced command is open, make it QUICK !!! */
- if (tok == TOK_OPEN)
- return("open");
-
- for (i = 0; i < Numcommands; i++)
- if (Commands[i].tok == tok)
- return Commands[i].name;
- for (i = 0; SLK_array[i].label; i++)
- if (SLK_array[i].tok == tok)
- return SLK_array[i].label;
- for (i = 0; Interncmd[i].name; i++)
- if (Interncmd[i].tok == tok)
- return Interncmd[i].name;
- return NULL;
-}
-
-char *
-cur_cmd()
-{
- int line;
- /* char *cur_hist(); */
-
- if (ar_get_current() != Cmd_ar)
- return(NULL);
- menu_ctl(Cmd_ar->id, CTGETPOS, &line);
- return Commands[line].name;
-}
-
-/*
- * ADD_CMD will add a command to the command list preserving
- * alphabetical ordering
- */
-int
-add_cmd(name, tokstr, help, intr, onintr)
-char *name;
-char *tokstr;
-char *help;
-char *intr;
-char *onintr;
-{
- register int i, j, comp;
-
- for (i = 0; Interncmd[i].name; i++) {
- if (strcmp(Interncmd[i].name, name) == 0)
- return (0); /* internal command conflict */
- }
- for (i = 0; Commands[i].name; i++) {
- comp = strcmp(name, Commands[i].name);
- if (comp < 0) {
- /*
- * shift list to make room for new entry
- */
- for (j = MAX_CMD - 1; j > i; j--)
- Commands[j] = Commands[j - 1];
-
- Commands[i].name = strsave(name);
- Commands[i].tok = -1; /* no token */
- Commands[i].helpindex = NOTEXT;
- Commands[i].tokstr = strsave(tokstr);
- Commands[i].helpaction = strsave(help);
- Commands[i].intr = strsave(intr);
- Commands[i].onintr = strsave(onintr);
- break;
- }
- else if (comp == 0) {
- /*
- * Command already exists
- */
- if (Commands[i].tok >= 0) {
- /*
- * Name conflict with a generic command,
- * only accept redefinitions for helpaction
- */
- if (help && (*help != '\0')) {
- Commands[i].helpindex = NOTEXT;
- Commands[i].helpaction= strsave(help);
- }
- }
- else {
- /*
- * Redefine a previous definition
- */
- Commands[i].name = strsave(name);
- Commands[i].tok = -1; /* no token */
- Commands[i].helpindex = NOTEXT;
- Commands[i].tokstr = strsave(tokstr);
- Commands[i].helpaction = strsave(help);
- Commands[i].intr = strsave(intr);
- Commands[i].onintr = strsave(onintr);
- }
- break;
- }
- }
- return (0);
-}
-
-
-/*
- * DEL_CMD will remove a command from the command menu
- * (shifting the command menu accordingly)
- */
-int
-del_cmd(name)
-char *name;
-{
- register int i, j;
-
- for (i = 0; Commands[i].name; i++) { /* if not end of list */
- if (strcmp(name, Commands[i].name) == 0) {
- /*
- * scrunch list to remove entry
- */
- for (j = i; j < MAX_CMD - 1; j++)
- Commands[j] = Commands[j + 1];
- break;
- }
- }
- return (0);
-}
-
-static struct cmdspec *
-get_cmd(cmdstr)
-char *cmdstr;
-{
- register int i;
-
- for (i = 0; i < Numcommands && Commands[i].name; i++)
- if (strcmp(Commands[i].name, cmdstr) == 0)
- return(&(Commands[i]));
- return(NULL);
-}
-
-token
-do_app_cmd()
-{
- char **strlist, **eval_string();
- token t, make_action();
- int flags;
- char *intr, *onintr;
-
- if (Tokstr) /* set in _cmd_to_tok */
- {
- if (Cmd_index >= 0) /* set in _cmd_to_tok */
- {
- /* update the interrupt structures based on
- the values for the current command, if
- defined else with the inherited values.
- */
- Cur_intr.skip_eval = FALSE;
- if ((intr = Commands[Cmd_index].intr) == NULL)
- intr = init_ctl(CTGETINTR);
- flags = RET_BOOL;
- Cur_intr.interrupt = FALSE; /* dont intrupt eval of intr */
- Cur_intr.interrupt =
- (bool)(uintptr_t)eval_string(intr, &flags);
-
- if ((onintr = Commands[Cmd_index].onintr) == NULL)
- onintr = init_ctl(CTGETONINTR);
- Cur_intr.oninterrupt = onintr;
- }
- flags = RET_ARGS;
- strlist = eval_string(Tokstr, &flags);
- t = make_action(strlist);
- }
- else
- t = TOK_NOP;
- return (t);
-}
-
-
-
-int
-cmd_reinit(argc, argv, instr, outstr, errstr)
-int argc;
-char *argv[];
-IOSTRUCT *instr;
-IOSTRUCT *outstr;
-IOSTRUCT *errstr;
-{
- if (argv[1] && (*argv[1] != '\0') && (access(argv[1], 2) == 0))
- {
- read_inits(argv[1]);
- init_sfk(FALSE); /* download PFK's for terms like 630. k17 */
- set_def_colors(); /* moved above next line. k17 */
- set_def_status();
- ar_ctl(Cmd_ar, CTSETINTR, init_ctl(CTGETINTR), NULL, NULL, NULL, NULL, NULL);
- ar_ctl(Cmd_ar, CTSETONINTR, init_ctl(CTGETONINTR), NULL, NULL, NULL, NULL, NULL);
- return(SUCCESS);
- }
- else
- return(FAIL);
-}
diff --git a/usr/src/cmd/fmli/oh/detab.c b/usr/src/cmd/fmli/oh/detab.c
deleted file mode 100644
index 34363f3b4d..0000000000
--- a/usr/src/cmd/fmli/oh/detab.c
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-/*
- * Copyright (c) 1985 AT&T
- * All Rights Reserved
- */
-
-#ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.3 */
-
-#include <stdio.h>
-#include <sys/types.h> /* EFT abs k16 */
-#include "wish.h"
-#include "typetab.h"
-#include "detabdefs.h"
-
-struct odft_entry Detab[MAXODFT];
diff --git a/usr/src/cmd/fmli/oh/detect.c b/usr/src/cmd/fmli/oh/detect.c
deleted file mode 100644
index cda32fcf10..0000000000
--- a/usr/src/cmd/fmli/oh/detect.c
+++ /dev/null
@@ -1,620 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-
-/*
- * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-/* Copyright (c) 1984, 1985, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-#include <stdio.h>
-#include <string.h>
-#include <fcntl.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-/*#include <sys/dir.h> this is file system dependent. abs */
-#include <sys/times.h>
-#include <ctype.h>
-#include "wish.h"
-#include "var_arrays.h"
-#include "typetab.h"
-#include "detabdefs.h"
-#include "partabdefs.h"
-#include "optabdefs.h"
-#include "parse.h"
-#include "sizes.h"
-
-#define ACC_NOTSET 1
-#define ACC_OKREAD 0
-#define ACC_NOREAD -1
-#define ck_readable(X) (access(X, 4))
-#define NULLSTR ""
-
-/* PGSHFT should be PNUMSHF from <sys/immu.h> see below abs 9/15/99 */
-/* #define PGSHFT 64 kludge to detect core files */
-#define LOOKED_AT_OEH 1
-#define LOOKED_AT_BYTES 2
-
-extern struct one_part Parts[MAXPARTS];
-extern struct odft_entry Detab[MAXODFT];
-
-
-static int Seen_non_printable;
-static int Seen_eighth_bit;
-static int Already_looked;
-static struct oeh Oeh;
-
-int Pathlen;
-
-#ifndef WISH
-void det_mail_in(), det_mail_out();
-#endif
-static int look_at_bytes();
-static int magic_heuristics();
-static int external_heuristics();
-static int oeu_heuristics();
-struct opt_entry *obj_to_parts();
-static bool exist_heuristics();
-static bool part_heuristics();
-
-/* The heuristics program drives off of the detection table (defined in
- * detab.c). It cycles through this table, executing heuristics commands
- * as it goes. There are basically 4 kinds of heuristics:
- *
- * Heuristics based on object part names
- * Heuristics based on magic numbers
- * Heuristics based on user-defined functions
- * Heuristics based on internal functions
- *
- * The most efficient method is part-names, the least efficient is
- * user-defined functions since they require a fork().
- * For this reason, it is probably best for user-defined functions to come
- * last if possible.
- */
-
-int
-heuristics(path, stray)
-char *path;
-char stray[][FILE_NAME_SIZ];
-{ /* begin heuristics */
- struct stat sbuf;
- char buf[2048]; /* xed header size */
- register int i;
- int psize = strlen(path) + 1;
- int size = array_len(stray);
- long docmask = 0L;
- char pathbuf[PATHSIZ];
- bool is_directory, determined;
- int heur;
- int accessible;
-
- strcpy(pathbuf, path);
- strcat(pathbuf, "/");
- Pathlen = psize;
-
- for (i = 0; i < size; i++) {
- if (stray[i][0] == '\0')
- continue; /* already determined by other heuristics */
- /* below, 3 is for: "/" & prefixes */
- if (psize + (int)strlen(stray[i]) + 3 > PATHSIZ) /* EFT k16 */
- continue; /* ignore - path too big */
- strcpy(pathbuf+psize, stray[i]);
- if (stat(pathbuf, &sbuf) == -1) {
-#ifdef _DEBUG
- _debug(stderr, "can't stat %s\n", pathbuf);
-#endif
- continue;
- }
-
- /* MUST be a directory to be check for exist_heuristics;
- * Directories will ONLY be checked for exist_heuristics, part_-
- * heuristics and shell and exec functions. (No magic or internal
- * (oeu,ascii,core,archive,mailin/out) functions will be run.)
- */
- if (sbuf.st_mode & 040000)
- is_directory = TRUE;
- else
- is_directory = FALSE;
-
- if ( sbuf.st_mode & 04000 ) /* narrow screen file */
- docmask = M_NAR;
- else
- docmask = 0L;
-
- determined = FALSE;
- accessible = ACC_NOTSET;
- Already_looked = 0;
- for (heur = 0; !determined && Detab[heur].objtype[0]; heur++) {
- switch (Detab[heur].func_type) {
- case F_DPARTS:
- if (is_directory == FALSE)
- continue;
- if (exist_heuristics(path, stray[i], Detab[heur].objtype,
- Detab[heur].defmask, Detab[heur].defodi,
- sbuf.st_mtime))
- determined = TRUE;
- break;
- case F_PARTS:
- if (part_heuristics(path, stray, i, Detab[heur].objtype,
- Detab[heur].defmask, Detab[heur].defodi,
- sbuf.st_mtime, NULL))
- determined = TRUE;
- break;
- case F_MAGIC:
- if (is_directory == TRUE)
- continue;
- if (accessible == ACC_NOTSET)
- accessible = ck_readable(pathbuf);
- if (accessible == ACC_NOREAD)
- break;
- if (magic_heuristics(path, stray[i], Detab[heur].objtype,
- Detab[heur].defmask, Detab[heur].defodi,
- sbuf.st_mtime, Detab[heur].magic_offset,
- Detab[heur].magic_bytes))
- determined = TRUE;
- break;
- case F_SHELL:
- case F_EXEC:
- if (external_heuristics(path, stray[i], Detab[heur].defmask,
- Detab[heur].defodi, sbuf.st_mtime, NULL))
- determined = TRUE;
- break;
- case F_INT:
- if (is_directory == TRUE)
- continue;
- switch (Detab[heur].intern_func) {
- case IDF_ZLASC: /* zero length ascii */
- if (sbuf.st_size == 0) {
- /* file pathsize already tested at top of this fcn */
- ott_make_entry(stray[i], stray[i], Detab[heur].objtype,
- docmask|Detab[heur].defmask, Detab[heur].defodi,
- sbuf.st_mtime);
- stray[i][0] = '\0';
- determined = TRUE;
- }
- break;
- case IDF_ASC:
- if (accessible == ACC_NOTSET)
- accessible = ck_readable(pathbuf);
- if (accessible == ACC_NOREAD)
- break;
- look_at_bytes(path, stray[i]);
- if (! Seen_non_printable) {
- /* file pathsize already tested at top of this fcn */
- ott_make_entry(stray[i], stray[i], Detab[heur].objtype,
- docmask|Detab[heur].defmask, Detab[heur].defodi,
- sbuf.st_mtime);
- stray[i][0] = '\0';
- determined = TRUE;
- }
- break;
- case IDF_TRANS:
- if (accessible == ACC_NOTSET)
- accessible = ck_readable(pathbuf);
- if (accessible == ACC_NOREAD)
- break;
- if (oeu_heuristics(path, stray[i], Detab[heur].objtype,
- Detab[heur].defmask, Detab[heur].defodi,
- sbuf.st_mtime)) {
- determined = TRUE;
- }
- break;
- case IDF_CORE:
- /* if a file is named "core" and it is at least 3 pages long
- * and it is an even multiple of a page size, and it has at
- * least one byte within the first five hundred with the
- * eighth bit set, then it is probably a core file.
- * >> This sounds nice but you can't do this with PGSHFT = 64
- * >> which causes the code below to do nothing more than generate
- * >> compiler warnings. you could replace PGSHFT with PNUMSHFT
- * >> from <sys/immu.h> but this introduces machine dependencies
- * >> and may still get into trouble when memory management changes.
- * >> since no one but the compiler has complained, I commented out
- * >> the code. abs 9/15/88
- */
- if (accessible == ACC_NOTSET)
- accessible = ck_readable(pathbuf);
- if (accessible == ACC_NOREAD)
- break;
- look_at_bytes(path, stray[i]);
- if (strcmp(stray[i], "core") == 0 && Seen_non_printable
- /* && sbuf.st_size >= (1<<PGSHFT)*3 && ! (sbuf.st_size % (1<<PGSHFT) ) */
- )
- {
- /* file pathsize already tested at top of this fcn */
- ott_make_entry(stray[i],stray[i],Detab[heur].objtype,
- Detab[heur].defmask,Detab[heur].defodi,
- sbuf.st_mtime);
- stray[i][0] = '\0';
- determined = TRUE;
- }
- break;
- case IDF_ARCH:
- if (accessible == ACC_NOTSET)
- accessible = ck_readable(pathbuf);
- if (accessible == ACC_NOREAD)
- break;
- look_at_bytes(path, stray[i]);
- if (Seen_non_printable && has_suffix(stray[i], ".a") &&
- strncmp(buf, "!<arch>", 7) == 0) {
- /* file pathsize already tested at top of this fcn */
- ott_make_entry(stray[i], stray[i], Detab[heur].objtype,
- Detab[heur].defmask,Detab[heur].defodi,
- sbuf.st_mtime);
- stray[i][0] = '\0';
- determined = TRUE;
- }
- break;
- case IDF_ENCRYPT:
- if (accessible == ACC_NOTSET)
- accessible = ck_readable(pathbuf);
- if (accessible == ACC_NOREAD)
- break;
- if (oeu_heuristics(path, stray[i], NULL,
- Detab[heur].defmask, Detab[heur].defodi,
- sbuf.st_mtime)) {
- determined = TRUE;
- }
- break;
- case IDF_UNKNOWN:
- /* file pathsize already tested at top of this fcn */
- ott_make_entry(stray[i], stray[i], Detab[heur].objtype,
- Detab[heur].defmask, Detab[heur].defodi,
- sbuf.st_mtime);
- stray[i][0] = '\0';
- determined = TRUE;
- break;
-#ifndef WISH
- case IDF_MAIL_IN:
- if (part_heuristics(path, stray, i, Detab[heur].objtype,
- Detab[heur].defmask, Detab[heur].defodi,
- sbuf.st_mtime, det_mail_in)) {
- determined = TRUE;
- }
- break;
- case IDF_MAIL_OUT:
- if (part_heuristics(path, stray, i, Detab[heur].objtype,
- Detab[heur].defmask, Detab[heur].defodi,
- sbuf.st_mtime, det_mail_out)) {
- determined = TRUE;
- }
- break;
-#endif
-#ifdef _DEBUG
- default:
- _debug(stderr, "no such func: %d\n", Detab[heur].intern_func);
-#endif
- }
- }
- }
- }
- return(0);
-}
-
-static bool
-
-exist_heuristics(path, name, objtype, mask, odi, mtime)
-char *path, *name, *objtype;
-long mask;
-char *odi;
-time_t mtime; /* EFT abs k16 */
-{
- register int i;
- struct opt_entry *partab;
- int part_offset, numparts;
- char *base;
- char *pattern;
- char *part_construct();
- int found[MAXOBJPARTS];
- char pathbuf[PATHSIZ];
- char *part_match();
-
- /* get the parts table associated with objtype */
-
- if ((partab = obj_to_parts(objtype)) == NULL)
- return(FALSE);
- part_offset = partab->part_offset;
- numparts = partab->numparts;
-
- if ((base = part_match(name, Parts[part_offset].part_template)) == NULL)
- return(FALSE);
-
- found[0] = 1;
- for (i = 1; i < numparts; i++)
- found[i] = -1;
-
- for (i = 1; i < numparts; i++) {
- pattern = part_construct(base, Parts[part_offset+i].part_template);
- /* if any part's path is > PATHSIZ, do not display it */
- if ((int)strlen(pattern) + Pathlen + 3 > PATHSIZ) /* EFT k16 */
- return(FALSE);
- sprintf(pathbuf, "%s/%s", path, pattern);
- if (access(pathbuf, 0) == -1) { /* exists ? */
- if (!(Parts[part_offset+i].part_flags & PRT_OPT))
- return(FALSE);
- } else {
- found[i] = 1;
- }
- }
- /* file pathsize already tested in heuristics() - this uses "name" */
- ott_make_entry(name, base, objtype, mask|partab->int_class, odi, mtime);
-
- for (i = 1; i < numparts; i++) {
- if (found[i] == 1)
- /* file pathsize already tested when each part found */
- ott_make_entry(part_construct(base,
- Parts[part_offset+i].part_template),
- NULLSTR, NULL, mask|partab->int_class, NULL, mtime);
- }
-
- return(TRUE);
-}
-
-static bool
-part_heuristics(path, stray, index, objtype, mask, odi, mtime, info_func)
-char *path;
-char stray[][FILE_NAME_SIZ];
-char *objtype;
-int index;
-long mask;
-char *odi;
-time_t mtime; /* EFT abs k16 */
-void (*info_func)();
-{
- register int i, j;
- int found[MAXOBJPARTS];
- struct opt_entry *partab;
- int part_offset, numparts;
- int size = array_len(stray);
- char *p, base[PNAMESIZ];
- char fullpath[PATHSIZ];
- char *dname;
- char *part_match();
-
- /* get the parts table associated with objtype */
-
- if ((partab = obj_to_parts(objtype)) == NULL)
- return(FALSE);
- part_offset = partab->part_offset;
- numparts = partab->numparts;
-
- for (i = 0; i < numparts; i++)
- found[i] = -1;
-
- /* look for the entry index in the table, in reverse order since
- * the more restrictive names are at the end (for example, the first
- * parts template is often unrestricted).
- */
-
- for (i = numparts-1; i >= 0; i--)
- if (p = part_match(stray[index], Parts[part_offset+i].part_template)) {
- found[i] = index;
- strcpy(base, p);
- break;
- }
-
- if (!p) /* was not found */
- return(FALSE);
-
- /* if any part's path is > PATHSIZ, do not display it */
- if ((found[i] != -1) &&
- ((int)strlen(stray[found[i]]) + Pathlen + 3 > PATHSIZ)) /* EFT k16 */
- return(FALSE);
-
- /* scan through the rest of the parts, looking in the stray
- * array for each one. If a required part is ever not found,
- * or if the name is > PATHSIZ,
- * then immediately return FALSE.
- */
-
- for (i = 0; i < numparts; i++) {
- /* don't look for an already found part */
- if (found[i] != -1)
- continue;
- for (j = 0; j < size; j++) {
- if (stray[j][0] == '\0' || j == index)
- continue;
- if ((p=part_match(stray[j], Parts[part_offset+i].part_template)) &&
- strcmp(p, base) == 0) {
- found[i] = j;
- break;
- }
- }
-
- /* if a required part is not found, then return FALSE */
-
- if (found[i] == -1 && !(Parts[part_offset+i].part_flags & PRT_OPT))
- return(FALSE);
- /* if any part's path is > PATHSIZ, do not display it */
- if ((found[i] != -1) &&
- ((int)strlen(stray[found[i]]) + Pathlen + 3 > PATHSIZ)) /*EFT k16*/
- return(FALSE);
- }
-
- /* at this point, we should have all the parts, so we will go
- * through the found array and make entries for each part.
- */
-
- j = 0;
- while (found[j] == -1)
- j++;
-
- if (info_func != NULL) {
- strcpy(fullpath, path);
- strcat(fullpath, "/");
- strcat(fullpath, stray[found[j]]);
- (*info_func)(fullpath, &dname, &odi, &mask, &mtime);
- } else {
- if (base && *base)
- dname = base;
- else
- dname = stray[found[j]];
- }
- /* file pathsize already tested when each part found */
- ott_make_entry(stray[found[j]], dname, objtype, mask|partab->int_class, odi, mtime);
- stray[found[j]][0] = '\0';
-
- for (i = j+1; i < numparts; i++) {
- if (found[i] != -1) {
- /* file pathsize already tested when each part found */
- ott_make_entry(stray[found[i]], NULL, NULL,
- mask|partab->int_class, NULL, mtime);
- stray[found[i]][0] = '\0';
- }
- }
-
- return(TRUE);
-}
-
-static int
-look_at_bytes(path, file)
-char *path, *file;
-{
- char buf[PATHSIZ];
- register char *p;
- register int numread;
- register int fd;
-
- if (Already_looked & LOOKED_AT_BYTES)
- return (0);
-
- Already_looked |= LOOKED_AT_BYTES;
- Seen_eighth_bit = Seen_non_printable = FALSE;
- sprintf(buf, "%s/%s", path, file);
- if ((fd = open(buf, O_RDONLY)) < 0)
- return (0);
- numread = read(fd, buf, sizeof(buf));
- close(fd);
-
- for (p = buf; numread > 0; numread--, p++)
- if (!isprint(*p) && !isspace(*p) && *p != '\7' && *p != '\b') {
- Seen_non_printable = TRUE;
- if (!isascii(*p))
- Seen_eighth_bit = TRUE;
- }
- return (0);
-}
-
-static int
-magic_heuristics(path, name, objtype, mask, odi, mtime, offsets, bytes)
-char *path, *name, *objtype;
-long mask;
-char *odi;
-time_t mtime; /* EFT abs k16 */
-long *offsets;
-char *bytes;
-{
- FILE *fp;
- register int i;
- char buf[PATHSIZ];
-
- /* file pathsize already tested in heuristics() */
- sprintf(buf, "%s/%s", path, name);
- if ((fp = fopen(buf, "r")) == NULL)
- return(0);
-
- for (i = 0; offsets[i] != -1; i++) {
- /* if the next offset is equal to the previous plus one, no need
- * to seek
- */
- if (i == 0 || offsets[i-1] != offsets[i] - 1) {
- if (fseek(fp, offsets[i], 0) != 0) {
- fclose(fp);
- return(0);
- }
- }
- if (getc(fp) != bytes[i]) {
- fclose(fp);
- return(0);
- }
- }
-
- fclose(fp);
- ott_make_entry(name, name, objtype, mask, odi, mtime);
- name[0] = 0;
-
- return(1);
-}
-
-
-/* currently unimplemented */
-
-static int
-external_heuristics()
-{
- return(0);
-}
-
-static int
-oeu_heuristics(path, name, objtype, defmask, defodi, mtime)
-char *path, *name, *objtype;
-long defmask;
-char *defodi;
-time_t mtime; /* EFT abs k16 */
-{
- char fullpath_or_odi[PATHSIZ];
-
- /* file pathsize already tested in heuristics() */
- sprintf(fullpath_or_odi, "%s/%s", path, name);
- if (look_at_oeh(fullpath_or_odi) != 0) {
- return(0);
- }
-
- if (!objtype) { /* any encrypted object */
- if (Oeh.encrytest)
- objtype = Oeh.num;
- else
- return (0);
- }
- /* reuse fullpath_or_odi variable */
- strcpy(fullpath_or_odi, "TYPE=");
- strcat(fullpath_or_odi, Oeh.type);
- ott_make_entry(name, name, objtype,
- defmask, (defodi&&*defodi)?defodi:fullpath_or_odi, mtime);
- return(1);
-}
-
-int
-look_at_oeh(path)
-char *path;
-{
- static int oeh_retcode;
-
- if (Already_looked & LOOKED_AT_OEH)
- return(oeh_retcode);
-
-#ifdef WISH
- oeh_retcode = oeucheck(path, &Oeh, READ_HEADER);
-#else
- oeh_retcode = oeuparse(path, &Oeh, READ_HEADER);
-#endif
-#ifdef _DEBUG
- _debug(stderr, "oeuparse(%s) returned %d\n", path, oeh_retcode);
-#endif
- Already_looked |= LOOKED_AT_OEH;
- return(oeh_retcode);
-}
diff --git a/usr/src/cmd/fmli/oh/dispfuncs.c b/usr/src/cmd/fmli/oh/dispfuncs.c
deleted file mode 100644
index aca5639544..0000000000
--- a/usr/src/cmd/fmli/oh/dispfuncs.c
+++ /dev/null
@@ -1,118 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-/*
- * Copyright (c) 1985 AT&T
- * All Rights Reserved
- */
-#ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.6 */
-
-#include <stdio.h>
-#include <sys/types.h> /* EFT abs k16 */
-#include "wish.h"
-#include "typetab.h"
-#include "partabdefs.h"
-#include "var_arrays.h"
-#include "terror.h"
-#include "moremacros.h"
-
-#define START_OBJS 20
-
-static char **All_objtypes;
-static char **All_displays;
-
-char *
-def_display(objtype)
-char *objtype;
-{
- register int i, size;
- struct opt_entry *opt, *obj_to_parts();
-
- if (!All_objtypes) {
- All_objtypes = (char **)array_create(sizeof(char *), START_OBJS);
- All_displays = (char **)array_create(sizeof(char *), START_OBJS);
- }
- size = array_len(All_objtypes);
- for (i = 0; i < size; i++)
- if (strcmp(All_objtypes[i], objtype) == 0)
- return(All_displays[i]);
-
- /* not found, append new */
- All_objtypes = (char **)array_append(All_objtypes, NULL);
-
- All_objtypes[size] = strsave(objtype);
-
- if (opt = obj_to_parts(objtype)) {
- All_displays = (char **)array_append(All_displays, NULL);
- All_displays[size] = strsave(opt->objdisp);
- } else {
- All_displays = (char **)array_append(All_displays, NULL);
- All_displays[size] = "Data file";
- }
-
- return(All_displays[size]);
-}
-
-char *
-def_objtype(objtype)
-char *objtype;
-{
- register int i, size;
- struct opt_entry *opt, *obj_to_parts();
-
- if (!All_objtypes) {
- All_objtypes = (char **)array_create(sizeof(char *), START_OBJS);
- All_displays = (char **)array_create(sizeof(char *), START_OBJS);
- }
-
- size = array_len(All_objtypes);
-
- for (i = 0; i < size; i++)
- if (strcmp(All_objtypes[i], objtype) == 0)
- return(All_objtypes[i]);
-
- /* not found, append new */
-
- All_objtypes = (char **)array_append(All_objtypes, NULL);
- /* ehr 3
- if (All_objtypes[size])
- free(All_objtypes[size]);
- */
- All_objtypes[size] = strsave(objtype);
-
- if (opt = obj_to_parts(objtype)) {
- All_displays = (char **)array_append(All_displays, NULL);
- /* ehr3
- if (All_objtypes[size])
- free(All_objtypes[size]);
- */
- All_displays[size] = strsave(opt->objdisp);
- } else {
- All_displays = (char **)array_append(All_displays, NULL);
- All_displays[size] = "Data file";
- }
-
- return(All_objtypes[size]);
-}
diff --git a/usr/src/cmd/fmli/oh/evstr.c b/usr/src/cmd/fmli/oh/evstr.c
deleted file mode 100644
index f3cc329a75..0000000000
--- a/usr/src/cmd/fmli/oh/evstr.c
+++ /dev/null
@@ -1,293 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/*
- * Copyright 1993 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-/* Copyright (c) 1984, 1985, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-#include <stdio.h>
-#include <string.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <ctype.h>
-#include <signal.h>
-#include "wish.h"
-#include "token.h"
-#include "fm_mn_par.h"
-#include "var_arrays.h"
-#include "terror.h"
-#include "eval.h"
-#include "moremacros.h"
-#include "interrupt.h"
-
-char *pline();
-char **parselist();
-
-/* Global variables used in "eval" (see sys/eval.c) */
-extern int EV_retcode;
-extern int EV_backquotes;
-extern int Lasttok;
-
-/*
- * EVAL_STRING sets up calls to the evaluator (eval) given the
- * expected descriptor type
- */
-extern void intr_handler();
-
-char *
-eval_string(defstring, flags)
-char *defstring;
-int *flags;
-{
- char *retval;
- int savecode;
- int savequotes;
- int savetok;
- int tmpflags;
-
- /*
- * Save globals used in "eval" (in case eval_string is
- * called while "eval" function is still active ... this
- * save/restore should ultimately be done in eval.c)
- */
- savecode = EV_retcode;
- savequotes = EV_backquotes;
- savetok = Lasttok;
-
-
-
-/* If interrupts are suppose to be enabled,
- * set up the interrupt handler.
-*/
- if (Cur_intr.interrupt)
- sigset(SIGINT, intr_handler);
-
- switch(*flags & RETS) {
- case RET_BOOL:
- retval = pline(defstring, flags);
- if (retval && (strCcmp(retval, "false") == 0)) {
- free(retval);
- retval = NULL;
- }
- break;
- case RET_INT:
- case RET_STR:
- if (!(retval = pline(defstring, flags)))
- retval = strsave(nil);
- break;
- case RET_ARGS:
- case RET_LIST:
- retval = (char *) parselist(defstring, flags, '\0', '\0');
- break;
- }
- sigignore(SIGINT); /* ignore interrupts */
- if (Cur_intr.skip_eval == TRUE) /* if (eval was interrupted) */
- {
- Cur_intr.skip_eval = FALSE;
- Cur_intr.interrupt = FALSE;
- tmpflags = RET_ARGS;
- retval = eval_string(Cur_intr.oninterrupt, &tmpflags);
- }
-
-
- /*
- * Restore globals used in "eval"
- */
- EV_retcode = savecode;
- EV_backquotes = savequotes;
- Lasttok = savetok;
- return(retval);
-}
-
-/*
-** Calls eval() repeatedly to generate one string.
-*/
-char *
-pline(line, pflags)
-char *line;
-int *pflags;
-{
- char *ret;
- IOSTRUCT *in, *out;
- int firstime;
-
- if (!line)
- return(NULL);
- /* could be useful in future */
- /* if (strcspn(line, "'\"`$\\") == strlen(line)) */
- /* return(strsave(line)); */
- ret = nil;
- firstime = TRUE;
- in = io_open(EV_USE_STRING, line);
- out = io_open(EV_USE_STRING, NULL);
- if (strcspn(line, "`$") == strlen(line))
- io_size(out, strlen(line) + 1);
- while (eval(in, out, EV_TOKEN))
- {
- /* for booleans, return code has precidence over the string generated: */
- if (EV_retcode && ((*pflags & RETS) == RET_BOOL)) /* abs k16 */
- {
- ret = NULL;
- break;
- }
-
- if (firstime)
- {
- char *str;
-
- str = io_string(out);
- if (strncmp(str, "vary", 4) == 0)
- {
-/* if (*pflags & EVAL_ONCE)
-** *pflags = (*pflags & (RETS | FREEIT)) | EVAL_SOMETIMES;
-** abs k15 */
- *pflags = (*pflags & (RETS | FREEIT)) | EVAL_ALWAYS;
- io_seek(out, 0);
- }
- else if (strncmp(str, "const", 5) == 0)
- {
-/** if (*pflags & EVAL_SOMETIMES) abs k15 */
- *pflags = (*pflags & (RETS | FREEIT)) | EVAL_ONCE;
- io_seek(out, 0);
- }
- else
- firstime = FALSE;
- free(str);
- }
- if (!firstime)
- putac(' ', out);
- }
- /* remove trailing space */
- if (!firstime)
- unputac(out);
- if (ret)
- ret = io_string(out);
- io_close(out);
- io_close(in);
- return(ret);
-}
-
-/*
-** Repeatedly calls "eval" to get a list of tokens.
-*/
-char **
-parselist(list, pflags, beg, end)
-char *list;
-register int *pflags;
-char beg;
-char end;
-{
- IOSTRUCT *in, *out;
- register char **hold;
- char *str;
- int squig_flag;
-
- hold = (char **) array_create(sizeof(char *), 5);
- if (!(list && *list))
- return(hold);
-
- /* flag to tell eval whether `{' and `}' have special meaning */
- squig_flag = *pflags & EV_SQUIG;
-
- in = io_open(EV_USE_STRING, list);
- out = io_open(EV_USE_STRING, NULL);
- if (eval(in, out, EV_TOKEN | squig_flag)) {
- str = io_ret_string(out);
- if (str && *str == '\0') {
- io_seek(out, 0);
- if (eval(in, out, EV_TOKEN | squig_flag))
- str = io_ret_string(out);
- }
- if (strncmp(str, "vary", 4) == 0) {
-/* if (*pflags & EVAL_ONCE)
-** *pflags = (*pflags & (RETS | FREEIT)) | EVAL_SOMETIMES;
-abs k15 */
- *pflags = (*pflags & (RETS | FREEIT)) | EVAL_ALWAYS;
- io_seek(out, 0);
- if (eval(in, out, EV_TOKEN | squig_flag))
- str = io_ret_string(out);
- }
- else if (strncmp(str, "const", 5) == 0) {
-/** if (*pflags & EVAL_SOMETIMES) abs k15 */
- *pflags = (*pflags & (RETS | FREEIT)) | EVAL_ONCE;
- io_seek(out, 0);
- if (eval(in, out, EV_TOKEN | squig_flag))
- str = io_ret_string(out);
- }
- if (beg && (str[0] != beg)) {
- FILE *fp;
- char buf[BUFSIZ];
-
- if ((fp = fopen(str, "r")) == NULL) {
- warn(NOPEN, nil);
- io_close(in);
- io_close(out);
- return(NULL);
- }
- while (fgets(buf, BUFSIZ, fp)) {
- char *p;
-
- buf[strlen(buf) -1] = '\0';
- p = strsave(buf);
- hold = (char **) array_append(hold, &p);
- }
- io_close(in);
- io_close(out);
- return(hold);
- }
- if (!beg) {
- char *p, *q;
-
- str = strsave(str);
- if (EV_backquotes && (p = strtok(str, " \t\n"))) {
- for (; p; p = strtok(NULL, " \t\n")) {
- q = strsave(p);
- hold = (char **) array_append(hold, &q);
- }
- free(str);
- }
- else
- hold = (char **) array_append(hold, &str);
- }
- io_seek(out, 0);
- while (eval(in, out, EV_TOKEN | squig_flag)) {
- if (EV_retcode != 0) {
- array_trunc(hold);
- break;
- }
- str = io_string(out);
- io_seek(out, 0);
- if (!end || (*str != end))
- hold = (char **) array_append(hold, &str);
- else if (str)
- free(str);
- }
- }
- io_close(out);
- io_close(in);
- return(hold);
-}
diff --git a/usr/src/cmd/fmli/oh/externoot.c b/usr/src/cmd/fmli/oh/externoot.c
deleted file mode 100644
index e021250305..0000000000
--- a/usr/src/cmd/fmli/oh/externoot.c
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-
-/*
- * Copyright (c) 1985 AT&T
- * All Rights Reserved
- */
-#ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.2 */
-
-#include "sizes.h"
-
-char *
-externoot(obj)
-char *obj;
-{
- char *extdir = "/info/OH/externals/";
- extern char *Oasys;
- static char fname[PATHSIZ];
-
- strcpy(fname, Oasys);
- strcat(fname, extdir);
- strcat(fname, obj);
- return(fname);
-}
-
diff --git a/usr/src/cmd/fmli/oh/fm_mn_par.c b/usr/src/cmd/fmli/oh/fm_mn_par.c
deleted file mode 100644
index 1697914c95..0000000000
--- a/usr/src/cmd/fmli/oh/fm_mn_par.c
+++ /dev/null
@@ -1,372 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/*
- * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-/* Copyright (c) 1984, 1985, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-#include <stdio.h>
-#include <string.h>
-#include "wish.h"
-#include "token.h"
-#include "actrec.h"
-#include "fm_mn_par.h"
-#include "var_arrays.h"
-#include "terror.h"
-#include "eval.h"
-#include "vtdefs.h"
-#include "moremacros.h"
-
-/*
-** Frees one attribute. This involves freeing the "def" if set,
-** and the "cur" as an array if the flags say so, or as a string
-** if set.
-*/
-void
-freeattr(attr)
-register struct attribute *attr;
-{
- if (attr->flags & FREEIT) {
- if (attr->def) {
- free(attr->def);
- attr->def = (char *)NULL;
- }
- if (attr->cur) {
- if (((attr->flags & RETS) == RET_LIST) ||
- ((attr->flags & RETS) == RET_ARGS))
- listfree(attr->cur);
- else {
- free(attr->cur);
- attr->cur = (char *)NULL;
- }
- }
- free(attr);
- }
-}
-
-/*
-** If the "single" array is NULL then this structure does
-** not contain any data to be freed
-*/
-void
-freeitup(fm_mn)
-register struct fm_mn *fm_mn;
-{
- register int i, j;
- int lcv, lcv2;
-
- if (fm_mn->single.attrs == NULL)
- return;
- lcv = array_len(fm_mn->single.attrs);
- for (i = 0; i < lcv; i++)
- freeattr(fm_mn->single.attrs[i]);
- array_destroy(fm_mn->single.attrs);
- fm_mn->single.attrs = NULL;
- if (!fm_mn->multi)
- return;
- lcv = array_len(fm_mn->multi);
- for (j = 0; j < lcv; j++)
- if (fm_mn->multi[j].attrs) {
- lcv2 = array_len(fm_mn->multi[j].attrs);
- for (i = 0; i < lcv2; i++)
- freeattr(fm_mn->multi[j].attrs[i]);
- array_destroy(fm_mn->multi[j].attrs);
- }
- array_destroy(fm_mn->multi);
- fm_mn->multi = NULL;
-}
-
-/*
-** Fills an array with the information from another (in this case,
-** the array of defaults.
-*/
-void
-filldef(fld, defaults, no)
-struct fld *fld;
-struct attribute *defaults;
-int no;
-{
- int i;
- struct attribute *p;
-
- fld->attrs = (struct attribute **)
- array_create(sizeof(struct attribute *), no);
-
- for (i = 0; i < no; i++)
- {
- if (defaults[i].flags & MAKE_COPY)
- {
- p = (struct attribute *)new(struct attribute);
- *p = defaults[i];
- if(defaults[i].def != NULL) /* abs k14.1 */
- {
- p->def = malloc(strlen(defaults[i].def)+1);
- if(p->def == NULL)
- {
- fatal(NOMEM, nil);
- }
- strcpy(p->def, defaults[i].def);
- }
- p->flags |= FREEIT;
- }
- else
- p = defaults + i;
- fld->attrs = (struct attribute **) array_append(fld->attrs, &p);
- }
-}
-
-/*
-** Boosts a the sequence number for the whole object. This will
-** force every variable field to be evaluated.
-*/
-int
-upseqno(fm_mn)
-struct fm_mn *fm_mn;
-{
- fm_mn->seqno++;
- return (0);
-}
-
-/*
-** This parses an object. The "flags" say whether info_or_file is
-** the information itself or the file of where the information sits.
-** Sdfl, sdflsize, mdfl and mdflsize describe the default arrays and
-** single and multi are the addresses of pointers to store the
-** information in.
-*/
-int
-parser(flags, info_or_file, sdfl, sdflsize, single, mdfl, mdflsize, multi, fp)
-int flags;
-char *info_or_file;
-struct attribute *sdfl;
-int sdflsize;
-struct fld *single;
-struct attribute *mdfl;
-int mdflsize;
-struct fld **multi;
-FILE *fp;
-{
- int i;
- register char *val, *kwd;
- char mybuf[BUFSIZ];
- int more;
- IOSTRUCT *in, *out;
- struct fld *multiptr, ptr;
-
- if (flags & INLINE)
- in = io_open(EV_USE_STRING, info_or_file);
- else
- {
- setbuf(fp, mybuf);
- in = io_open(EV_USE_FP, fp);
- }
- out = io_open(EV_USE_STRING, NULL);
- while (more = eval(in, out, EV_GROUP))
- {
- kwd = io_ret_string(out);
- if (val = strchr(kwd, '='))
- *val++ = '\0';
- else
- val = nil;
- for (i = 0; i < sdflsize; i++)
- if (strCcmp(kwd, sdfl[i].testring) == 0)
- break;
- if (i == sdflsize)
- {
- if (strCcmp(kwd, mdfl[PAR_NAME].testring) == 0)
- break;
- }
- else
- {
- struct attribute *hold;
-
- hold = (struct attribute *)new(struct attribute);
- memcpy(hold, single->attrs[i], sizeof(struct attribute));
- hold->flags |= FREEIT;
- hold->cur = NULL;
- hold->seqno = 0;
- set_def(single->attrs[i] = hold, strsave(val));
- }
- io_seek(out, 0);
- }
-
- multiptr = (struct fld *) array_create(sizeof(struct fld), 1024);
- for ( ; more; more = eval(in, out, EV_GROUP))
- {
- if (!kwd)
- {
- kwd = io_ret_string(out);
- if (val = strchr(kwd, '='))
- *val++ = '\0';
- else
- val = nil;
- }
- for (i = 0; i < mdflsize; i++)
- if (strCcmp(kwd, mdfl[i].testring) == 0)
- break;
- if (i == PAR_NAME) /* if its the first multi-descriptor */
- {
- filldef(&ptr, mdfl, mdflsize);
- multiptr = (struct fld *) array_append(multiptr, &ptr);
- }
- if (i != mdflsize) /* if its the one we're looking for */
- {
- struct attribute *hold;
-
- hold = (struct attribute *)new(struct attribute);
- memcpy(hold, ptr.attrs[i], sizeof(struct attribute));
- hold->flags |= FREEIT;
- hold->cur = NULL;
- hold->seqno = 0;
- /* don't comment out until you're SURE
- if (mdfl[i].flags & MAKE_COPY)
- free(ptr.attrs[i]);
- */
- set_def(ptr.attrs[i] = hold, strsave(val));
- }
- io_seek(out, 0);
- kwd = NULL;
- }
- multiptr = (struct fld *) array_shrink(multiptr);
- *multi = multiptr;
- io_close(out);
- io_close(in);
- return (0);
-}
-
-/*
-** This puts the args into an altenv ($ARG1, $ARG2 and $ARG3)
-*/
-void
-setupenv(flags, args, altenv)
-int flags;
-register char **args;
-register char ***altenv;
-{
- char buf[BUFSIZ];
- char argbuf[6];
- char *envbuf;
- register int i;
-
- strcpy(argbuf, "ARG1=");
- for (i = flags & INLINE ? 2 : 1; args[i]; i++, (argbuf[3])++) {
- int dofree, maxamt, amt;
-
- dofree = 0;
- maxamt = BUFSIZ - sizeof(argbuf) - 2;
- if ((amt = strlen(args[i])) > maxamt) {
- /*
- * Value is greater than 1K so malloc
- * enough space to hold it.
- */
- maxamt = amt + sizeof(argbuf) + 2;
- if ((envbuf = (char *) malloc(maxamt)) == NULL)
- fatal(NOMEM, nil);
- dofree++;
- }
- else {
- /*
- * ... otherwise, use static 1K buffer
- */
- envbuf = buf;
- dofree = 0;
- }
- strcpy(envbuf, argbuf);
- strncat(envbuf, args[i], maxamt);
- putaltenv(altenv, envbuf);
- if (dofree) /* if buffer was malloc'd, free it */
- free(envbuf);
- }
- argbuf[4] = '\0';
- while(delAltenv(argbuf) == SUCCESS)
- (argbuf[3])++;
- copyAltenv(*altenv);
-}
-
-/*
-** This will setup the lifetime and positioning for an object.
-*/
-void
-life_and_pos(a, life, begrow, begcol, prow, pcol, ptype)
-register struct actrec *a;
-register char *life;
-register char *begrow;
-register char *begcol;
-int *prow;
-int *pcol;
-int *ptype;
-{
- void setlifetime();
-
- *prow = VT_UNDEFINED;
- *pcol = VT_UNDEFINED;
- *ptype = 0;
- if (strCcmp(begrow, "center") == 0) {
- *ptype = VT_CENTER;
- if (!(*pcol = atoi(begcol)))
- *pcol = VT_UNDEFINED;
- }
- else if (strCcmp(begcol, "center") == 0) {
- *ptype = VT_CENTER;
- if (!(*prow = atoi(begrow)))
- *prow = VT_UNDEFINED;
- }
- else if (strCcmp(begrow, "current") == 0)
- *ptype = VT_COVERCUR;
- else if (strCcmp(begrow, "distinct") == 0)
- *ptype = VT_NOCOVERCUR;
- else {
- if (!(*prow = atoi(begrow))) {
- *prow = VT_UNDEFINED;
- *pcol = VT_UNDEFINED;
- }
- else {
- if (!(*pcol = atoi(begcol)))
- *pcol = VT_UNDEFINED;
- }
- }
- if (life)
- setlifetime(a, life);
-}
-
-void
-setlifetime(a, life)
-struct actrec *a;
-char *life;
-{
- /* Added a check for a->id to be >= 0 for an active frame. mek 112289 */
- if (a->id >= 0 && a->lifetime == AR_CLOSING) /* abs k17 */
- return; /* abs k17 */
- if (strCcmp(life, "shortterm") == 0)
- a->lifetime = AR_SHORTERM;
- else if (strCcmp(life, "permanent") == 0)
- a->lifetime = AR_PERMANENT;
- else if (strCcmp(life, "immortal") == 0)
- a->lifetime = AR_IMMORTAL;
- else
- a->lifetime = AR_LONGTERM;
-}
diff --git a/usr/src/cmd/fmli/oh/fm_mn_par.h b/usr/src/cmd/fmli/oh/fm_mn_par.h
deleted file mode 100644
index b3606c68c4..0000000000
--- a/usr/src/cmd/fmli/oh/fm_mn_par.h
+++ /dev/null
@@ -1,93 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-/*
- * Copyright (c) 1985 AT&T
- * All Rights Reserved
- */
-#ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.8 */
-
-extern char *fld_eval();
-
-#define sing_eval(a,b) fld_eval(&(a)->single, b, (a)->seqno)
-#define multi_eval(a,b,c) fld_eval((a)->multi + b, c, (a)->seqno)
-
-#define KEYWORDSIZE 14
-
-#define VAL_CALC -1
-#define CMD 32
-
-/* Possible return types for attribute. */
-
-#define RET_INT 0x1
-#define RET_STR 0x2
-#define RET_BOOL 0x3
-#define RET_LIST 0x4
-#define RET_ARGS 0x5
-#define RET_PATH 0x40
-#define EVAL_ONCE 0x80
-#define EVAL_ALWAYS 0x100
-#define EVAL_SOMETIMES 0x200
-#define FREEIT 0x400
-#define MAKE_COPY 0x800
-#define MENU_MARKED 0x1000
-#define MENU_CHECKED 0x2000
-#define ATTR_TOUCHED 0x4000
-#ifndef EV_SQUIG /* must match EV_SQUIG in inc/eval.h */
-#define EV_SQUIG 0x8000 /* set when {} are special in a descriptor */
-#endif /* careful.. flag is flipped in eval() */
-#define RETS 7
-
-#define INLINE 1
-
-/* parse table indexes for items that must have the same index
- in more than one parse table
- */
-
-
-#define PAR_INTR 0
-#define PAR_ONINTR 1
-#define PAR_DONE 2
-#define PAR_ACTION 2
-#define PAR_NAME 3
-
-
-struct attribute {
- char *testring;
- int flags;
- char *def;
- char *cur;
- unsigned int seqno;
-};
-
-struct fld {
- struct attribute **attrs;
-};
-
-struct fm_mn {
- unsigned int seqno;
- struct fld single;
- struct fld *multi;
-};
diff --git a/usr/src/cmd/fmli/oh/getval.c b/usr/src/cmd/fmli/oh/getval.c
deleted file mode 100644
index 29b64c3a11..0000000000
--- a/usr/src/cmd/fmli/oh/getval.c
+++ /dev/null
@@ -1,311 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/*
- * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-/* Copyright (c) 1984, 1985, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-#include <stdio.h>
-#include <string.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <ctype.h>
-#include <signal.h>
-#include <curses.h>
-#include "wish.h"
-#include "token.h"
-#include "winp.h"
-#include "form.h"
-#include "fm_mn_par.h"
-#include "objform.h"
-#include "var_arrays.h"
-#include "terror.h"
-#include "eval.h"
-#include "ctl.h"
-#include "moremacros.h"
-#include "interrupt.h"
-
-
-extern void intr_handler();
-void part_expand();
-void set_def();
-extern int EV_retcode;
-
-
-#define SKIPLINES TRUE
-#define NONE 0
-#define BQMODE 1
-#define DQMODE 2
-
-#define getac(fp, Q) ((fp) ? Getc(fp) : *(Q)++)
-#define UNGetac(C, fp, Q) ((fp) ? unGetc((C), (fp)) : *(Q)--)
-void evalattr();
-
-
-/*
-** Evaluate one of the single occurrence attributes.
-*/
-
-/* Les: replace with MACRO
-
-char *
-sing_eval(fm_mn, fldtype)
-struct fm_mn *fm_mn;
-int fldtype;
-{
- char *fld_eval();
-
- return(fld_eval(&fm_mn->single, fldtype, fm_mn->seqno));
-}
-*/
-
-/*
-** Evaluate one of the multi-occurrence attributes.
-*/
-
-/* Les: replace with 1 line function
-
-char *
-multi_eval(fm_mn, fldno, fldtype)
-struct fm_mn *fm_mn;
-int fldno, fldtype;
-{
- char *fld_eval();
-
- return(fld_eval(fm_mn->multi + fldno, fldtype, fm_mn->seqno));
-}
-*/
-
-/*
-** Evaluate one attribute based on a seqno.
-*/
-/* only called within this file */
-char *
-fld_eval(fld, fldtype, seqno)
-struct fld *fld;
-int fldtype;
-int seqno;
-{
- char *eval_string();
- struct attribute *attr, *tmp_attr;
- char *intr, *onintr;
- int flags;
-
-/* if this type of descriptor can ever be interrupted, then
- update the interrupt structures based on the values for the
- current field, if defined else with the inherited values
- If interrupts are suppose to be enabled, set up the
- interrupt handler.
-*/
- Cur_intr.skip_eval = FALSE;
- if (fld == (struct fld *)NULL)
- return (char *)NULL;
- attr = fld->attrs[fldtype];
- if (strcmp(attr->testring, "action") == 0 ||
- strcmp(attr->testring, "done") == 0)
- {
- tmp_attr = fld->attrs[PAR_INTR];
- if ((intr = tmp_attr->def) == NULL)
- intr = (char *)ar_ctl(AR_cur, CTGETINTR, NULL, NULL, NULL, NULL, NULL, NULL);
- flags = RET_BOOL;
- Cur_intr.interrupt = FALSE; /* dont interrupt eval of intr */
- Cur_intr.interrupt = (bool)(uintptr_t)eval_string(intr, &flags);
-
- tmp_attr = fld->attrs[PAR_ONINTR];
- if ((onintr = tmp_attr->def) == NULL)
- onintr = (char *)ar_ctl(AR_cur, CTGETONINTR, NULL, NULL, NULL, NULL, NULL, NULL);
- Cur_intr.oninterrupt = onintr;
- }
-
-
-/*
- * Decides whether to re_evaluate the attribute.
- */
-
- if (!(((attr->flags & EVAL_ONCE) && attr->seqno) ||
- ((attr->flags & EVAL_SOMETIMES) && (attr->seqno >= seqno))))
- {
- if ((attr->flags & FREEIT) && attr->cur)
- {
- if (((attr->flags & RETS) == RET_LIST) ||
- ((attr->flags & RETS) == RET_ARGS))
- listfree(attr->cur);
- else
- free(attr->cur);
- attr->cur = NULL;
- }
- attr->cur = eval_string(attr->def, &attr->flags);
- attr->seqno = seqno;
- }
-
- return(attr->cur);
-}
-
-/*
-** Forces reevaluation of current value for an attribute.
-*/
-void
-de_const(fm_mn, fldno, fldtype)
-struct fm_mn *fm_mn;
-int fldno, fldtype;
-{
- fm_mn->multi[fldno].attrs[fldtype]->seqno = 0;
-}
-
-/*
- * SET_SINGLE_DEFAULT will generate a new attribute structure
- * and set the "def" portion of the structure to "val" ...
- * (NOTE that the string passed is "strsaved" thus can/should be
- * static)
- */
-int
-set_single_default(fm, index, val)
-struct fm_mn *fm;
-int index;
-char *val;
-{
- struct fld *single;
- struct attribute *hold;
- struct attribute *attr;
-
- if ((int)fm->single.attrs == 0) /* abs k17 */
- return(FAIL); /* abs k17 */
- single = &fm->single;
- attr = single->attrs[index];
- hold = new(struct attribute);
- memcpy(hold, attr, sizeof(struct attribute));
- hold->flags |= FREEIT;
- hold->cur = NULL;
- hold->seqno = 0;
- if (attr->flags & FREEIT)
- freeattr(attr); /* free old structure */
- set_def(single->attrs[index] = hold, strsave(val));
- return(SUCCESS); /* abs k17 */
-}
-
-void
-set_def(attr, str)
-struct attribute *attr;
-char *str;
-{
- attr->def = str;
-}
-
-/*
-** Set current value of an attribute (only used in "value" field of
-** form).
-*/
-void
-set_cur(fm_mn, fldno, fldtype, str)
-register struct fm_mn *fm_mn;
-register int fldno, fldtype;
-char *str;
-{
- struct attribute *attr;
-
- attr = fm_mn->multi[fldno].attrs[fldtype];
- if ((attr->flags & FREEIT) && attr->cur) {
- if (((attr->flags & RETS) == RET_LIST) ||
- ((attr->flags & RETS) == RET_ARGS))
- listfree(attr->cur);
- else
- free(attr->cur);
- }
- attr->cur = str;
- attr->seqno = 1;
- attr->flags |= EVAL_ONCE;
-}
-
-/*
-** Set current value of an attribute (only used in "text" objects)
-*/
-void
-set_sing_cur(fm_mn, desctype, str)
-register struct fm_mn *fm_mn;
-register int desctype;
-char *str;
-{
- struct attribute *attr;
-
- attr = fm_mn->single.attrs[desctype];
- if ((attr->flags & FREEIT) && attr->cur) {
- if (((attr->flags & RETS) == RET_LIST) ||
- ((attr->flags & RETS) == RET_ARGS))
- listfree(attr->cur);
- else
- free(attr->cur);
- }
- attr->cur = str;
- attr->seqno = 1;
- attr->flags |= EVAL_ONCE;
-}
-
-/*
-** Get default value of an multi-eval attribute
-*/
-char *
-get_def(fm_mn, fldno, fldtype)
-register struct fm_mn *fm_mn;
-register int fldno, fldtype;
-{
- return(fm_mn->multi[fldno].attrs[fldtype]->def);
-}
-
-
-
-/*
-** Get define value of an sing-eval attribute
-*/
-char *
-get_sing_def(fm_mn, fldtype)
-register struct fm_mn *fm_mn;
-register int fldtype;
-{
- return(fm_mn->single.attrs[fldtype]->def);
-}
-
-
-
-
-/*
-** Free a list of strings generated by parselist.
-*/
-int
-listfree(list)
-char **list;
-{
- int i;
- int lcv;
-
- if (!list)
- return (0);
- lcv = array_len(list);
- for (i = 0; i < lcv; i++)
- free(list[i]);
- array_destroy(list);
- return (0);
-}
diff --git a/usr/src/cmd/fmli/oh/helptext.c b/usr/src/cmd/fmli/oh/helptext.c
deleted file mode 100644
index 1f1dfe5477..0000000000
--- a/usr/src/cmd/fmli/oh/helptext.c
+++ /dev/null
@@ -1,244 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-/*
- * Copyright (c) 1986 AT&T
- * All Rights Reserved
- */
-#ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.3 */
-
-char *Help_text[] = {
-
-/***************************************************
- * CANCEL
- ***************************************************/
-"\
-\n\
-\n\
- The cancel command allows you to cancel a current command or\n\
- activity.\n\
-\n\
- To use cancel choose one of the following options:\n\
-\n\
- - Screen Labeled Key - Press CANCEL\n\
-\n\
- - Typed Command - Type cancel + ENTER\n\
-",
-
-/***************************************************
- * CLEANUP
- ***************************************************/
-"\
-\n\
- The cleanup command cancels all frames on the screen,\n\
- excluding those frames that can only be canceled upon exit. \n\
-\n\
- Use one of the following:\n\
-\n\
- - Command Menu - Select cleanup + ENTER\n\
-\n\
- - Typed Command - Type cleanup + ENTER\n\
-",
-
-/***************************************************
- * CMD-MENU
- ***************************************************/
-"\
-The cmd-menu is a multi-column menu of the commands available.\n\
-It serves as a command reference list, a place from which you\n\
-can issue a command, or a place to get help on a specific\n\
-command.\n\
-",
-
-/***************************************************
- * EXIT
- ***************************************************/
-"\
-\n\
- Use the exit command to cancel all frames and exit the application.\n\
-\n\
- To exit use one of the following options:\n\
-\n\
- - Command Menu - Select exit + ENTER\n\
-\n\
- - Typed Command - Type exit + ENTER\n\
-",
-
-/***************************************************
- * FRM-MGMT
- ***************************************************/
-"\
-\n\
- The frm-mgmt command allows you to move and reshape frames. It\n\
- also supports a \\\"list\\\" operation which lists for you all open\n\
- frames on the screen. In the command syntax \\\"operation\\\" refers\n\
- to \\\"move\\\", \\\"reshape\\\" or \\\"list\\\".\n\
-\n\
- 1. To use the frm-mgmt command, choose one of the following.\n\
- If a frame number or name is not specified, the currently\n\
- active frame is assumed to be the frame you would like to\n\
- operate on.\n\
-\n\
- - Screen Labeled Key - Press FRM-MGMT\n\
-\n\
- - Command Menu - Select frm-mgmt + ENTER\n\
-\n\
- - Typed Command - Type frm-mgmt [operation]\n\
- [frame_#] + ENTER\n\
-\n\
- 2. If an \\\"operation\\\" is not specified a pop-up menu frame\n\
- will appear listing frm-mgmt operations. You select\n\
- the frame operation you want to perform by moving the\n\
- cursor to the item and pressing ENTER or the ENTER screen\n\
- labeled key. Pressing the CANCEL screen labeled key\n\
- cancels the frm-mgmt command.\n\
-",
-
-/***************************************************
- * GOTO
- ***************************************************/
-"\
-\n\
- The goto command allows you to move the cursor to another\n\
- open frame by specifying the frame number.\n\
-\n\
- 1. To use the goto choose one of the following:\n\
-\n\
- - Command Menu - Select goto + ENTER\n\
-\n\
- - Typed Command - Type goto [frame_#] + ENTER\n\
-\n\
- 2. If you use the goto command without specifying a frame\n\
- number, you will be prompted for one.\n\
-",
-
-/***************************************************
- * HELP
- ***************************************************/
-"\
-\n\
- The help command creates an active frame containing a text message\n\
- which describes either the action you are trying to perform or the\n\
- current object or form. To exit the Help Facility press the CANCEL\n\
- screen labeled key.\n\
-\n\
- To access help use one of the following options. If no argument is\n\
- specified the system assumes you want help on the current frame or\n\
- on what you are currently doing.\n\
-\n\
- - Screen Labeled Key - Press HELP\n\
-\n\
- - Command Menu - Select help + ENTER\n\
-\n\
- - Typed command - Type help [command_name] + ENTER\n\
-",
-
-/***************************************************
- * NEXT-FRM
- ***************************************************/
-"\
-\n\
- The next-frm command allows you to move among frames according to\n\
- the order in which frames were opened.\n\
-\n\
- To use next-frm choose one of the following options:\n\
-\n\
- - Screen Labeled Key - Press NEXT-FRM\n\
-\n\
- - Command Menu - Select next-frm + ENTER\n\
-\n\
- - Typed Command - Type next-frm + ENTER\n\
-",
-
-/***************************************************
- * PREV-FRM
- ***************************************************/
-"\
-\n\
- The prev-frm command allows you to move to the previous frame\n\
- according to the reverse order in which the frames were opened.\n\
-\n\
- To use prev-frm choose one of the following options:\n\
-\n\
- - Screen Labeled Key - Press PREV-FRM\n\
-\n\
- - Command Menu - Select prev-frm + ENTER\n\
-\n\
- - Typed Command - Type prev-frm + ENTER\n\
-",
-
-/***************************************************
- * REFRESH
- ***************************************************/
-"\
-\n\
- The refresh command will simply redraw the screen.\n\
-\n\
- - Command Menu - Select refresh + ENTER\n\
-\n\
- - Typed Command - Type refresh + ENTER\n\
-",
-
-/***************************************************
- * UNIX
- ***************************************************/
-"\
-\n\
- The unix-system command invokes the shell command interpreter\n\
- defined in the environmental variable SHELL.\n\
-\n\
- To invoke unix-system use one of the following options:\n\
-\n\
- - Command Menu - Select unix-system + ENTER\n\
-\n\
- - Typed Command - Type unix-system + ENTER\n\
-\n\
- Your screen will be cleared of frames and the prompt\n\
- defined in the environmental variable PS1 will be displayed.\n\
-\n\
- To return from the shell type exit or control-d at the prompt.\n\
- You will then be prompted to press ENTER to refresh the screen.\n\
-",
-
-
-/***************************************************
- * UPDATE
- ***************************************************/
-"\
-\n\
- The update command is used to update the contents of a frame to\n\
- reflect changes made since the frame was originally opened.\n\
-\n\
- To use the update command do one of the following options. If a\n\
- frame is not specified, the current frame is assumed. In the\n\
- \\\"typed command\\\" syntax the frame number is specified as\n\
- it is listed in the label of the frame to be updated. \n\
-\n\
- - Command Menu - Select update + ENTER\n\
-\n\
- - Typed Command - Type update [ frame_number] + ENTER\n\
-",
-
-};
diff --git a/usr/src/cmd/fmli/oh/if_ascii.c b/usr/src/cmd/fmli/oh/if_ascii.c
deleted file mode 100644
index 8702212afb..0000000000
--- a/usr/src/cmd/fmli/oh/if_ascii.c
+++ /dev/null
@@ -1,181 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-/*
- * Copyright (c) 1985 AT&T
- * All Rights Reserved
- */
-#ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.11 */
-
-#include <stdio.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include "wish.h"
-#include "but.h"
-#include "typetab.h"
-#include "obj.h"
-#include "retcds.h"
-#include "procdefs.h"
-#include "sizes.h"
-
-char *ott_to_path(), *strcpy();
-#define B_LEN 256 /* pulled out of air--80 seemed too small abs */
-
-int
-IF_acv(argv)
-char *argv[];
-{
- return(0);
-}
-
-/*ARGSUSED*/
-int
-IF_aed(argv)
-char *argv[];
-{
- char title[PATHSIZ];
- struct ott_entry *ott, *path_to_ott();
- char *bsd_path_to_title();
-
- if (access(argv[0], 04) == FAIL) {
- mess_temp(nstrcat("You do not have permission to access ",
- bsd_path_to_title(argv[0], MESS_COLS-37), NULL));
- return(FAIL);
- }
- strcpy(title, "Suspended ");
- strcat(title, bsd_path_to_title(argv[0], COLS - FIXED_COLS - 10));
- proc_open(PR_ERRPROMPT, title, NULL, "$EDITOR", argv[0], NULL);
- if ((ott = path_to_ott(argv[0])) != NULL)
- ott_mtime(ott);
- return(SUCCESS);
-}
-
-int
-IF_apr(argv)
-char *argv[];
-{
- struct ott_entry *entry, *path_to_ott();
- struct stat buf;
- int ret;
-
- if ((entry = path_to_ott(argv[0])) == NULL)
- return(FAIL);
-
- if ((ret=stat(argv[0],&buf))== 0)
- if (buf.st_size == 0) {
- mess_temp("Cannot print zero length files");
- return(FAIL);
- }
-
- return(obj_print(entry, NULL, NULL));
-}
-
-int
-obj_print(entry, draftstyle, prclass)
-struct ott_entry *entry;
-char *draftstyle;
-char *prclass;
-{
- FILE *pinfo;
- char prname[PATHSIZ];
- int i;
- char buf[PATHSIZ];
- char *command[10], objtypebuf[20], titlebuf[MAX_WIDTH];
- char draftbuf[20], pdefbuf[B_LEN];
- char jobclass[4]; /* might as well make it 4 since it gets aligned*/
- char *pdefs;
-
- struct ott_entry *name_to_ott();
- char *odi_getkey();
- static char Pdefaults[] = "PRINTOPTS";
-
- if (((pdefs = odi_getkey(entry, Pdefaults))) != NULL && *pdefs)
- sprintf(jobclass, "%c", *pdefs);
- else if (prclass != NULL)
- strcpy(jobclass, prclass);
- else if (entry->objmask & CL_DOC) {
- strcpy(jobclass, "d");
- } else if (entry->objmask & CL_MAIL)
- strcpy(jobclass, "m");
- else
- strcpy(jobclass, "d");
-
-#ifdef _DEBUG
- _debug(stderr, "PDEFAULTS=%s jobclass=%s\n", pdefs, jobclass);
-#endif
-
- i = 0;
- command[i++] = "$VMSYS/OBJECTS/Menu.print";
- if (pdefs && *pdefs) {
- sprintf(pdefbuf, "-u%s", pdefs);
- command[i++] = pdefbuf;
- }
-/***********
- sprintf(jobclassbuf, "-j%s", jobclass);
- command[i++] = jobclassbuf;
-***********/
- if (draftstyle) {
- sprintf(draftbuf, "-F%s", draftstyle);
- command[i++] = draftbuf;
- }
- sprintf(titlebuf, "-t%s", entry->dname);
- command[i++] = titlebuf;
- sprintf(objtypebuf, "-f%s", entry->objtype);
- command[i++] = objtypebuf;
- command[i++] = ott_to_path(entry);
- command[i++] = NULL;
-
- objopv("OPEN", "MENU", command);
-
- strcpy(prname, entry->dirpath);
- strcat(prname, "/.P");
- strcat(prname, entry->name);
-
- if ((pinfo = fopen(prname, "r")) != NULL) {
- if (fgets(buf, BUFSIZ, pinfo) != NULL) {
- buf[strlen(buf)-1] = '\0';
- ott_lock_dsk(entry->dirpath);
- if (entry = name_to_ott(entry->name)) {
-#ifdef _DEBUG
- _debug(stderr, "putting new printer info:%s\n",buf);
-#endif
- odi_putkey(entry, Pdefaults, buf);
- ott_dirty();
- ott_synch(FALSE);
- }
-#ifdef _DEBUG
- _debug(stderr, "PRINTDEFS: %s\n", buf);
-#endif
- }
- (void) fclose(pinfo);
- (void) unlink(prname);
- }
-#ifdef _DEBUG
- else
- _debug(stderr, "PRINT SAVE FAIL: jobclass=%s prname=%s\n", jobclass, prname);
-#endif
-
- return(SUCCESS);
-}
diff --git a/usr/src/cmd/fmli/oh/if_dir.c b/usr/src/cmd/fmli/oh/if_dir.c
deleted file mode 100644
index 3b29463bb6..0000000000
--- a/usr/src/cmd/fmli/oh/if_dir.c
+++ /dev/null
@@ -1,680 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-
-/*
- * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-/* Copyright (c) 1984, 1985, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-#include <stdio.h>
-#include <string.h>
-#include <sys/types.h> /* EFT abs k16 */
-#include "wish.h"
-#include "menudefs.h"
-#include "vtdefs.h"
-#include "token.h"
-#include "slk.h"
-#include "actrec.h"
-#include "typetab.h"
-#include "ctl.h"
-#include "var_arrays.h"
-#include "terror.h"
-#include "moremacros.h"
-#include "message.h"
-#include "sizes.h"
-
-extern menu_id folder_make();
-extern char *path_to_title();
-static int dir_mv_cp();
-static int dir_init();
-
-#define MAX_DIRS (16)
-
-/* The activation record for a file folder contains the ott_tab for the
- * folder in the odptr field. File folders use the menu human-interface,
- * so the id field of the activation record is a menu_id.
- */
-
-long Sortmodes = OTT_SALPHA, Dispmodes = OTT_DOBJ;
-time_t Prefmodtime = (time_t)0L; /* EFT abs k16 */
-
-static int Dirs_open = 0; /* count how many open */
-
-/* macro to cast the odptr field of an actrec to my struct odptr */
-
-#define MYODPTR(X) ((struct myodptr *)(X->odptr))
-
-struct myodptr {
- struct ott_tab *ott;
- time_t dir_mtime; /* EFT abs k16 */
- time_t ott_mtime; /* EFT abs k16 */
- time_t pref_mtime; /* EFT abs k16 */
-};
-
-static int
-dir_close(a)
-struct actrec *a;
-{
- extern char *Filecabinet;
- extern char Opwd[];
-#ifdef _DEBUG
- _debug(stderr, "DIR_CLOSE\n");
-#endif
- ott_unlock_inc(MYODPTR(a)->ott); /* unlock the ott so it can be swapped */
- free(MYODPTR(a));
- if (a->path)
- free(a->path);
- Dirs_open--;
- if ( ! Dirs_open ) {
- (void) chdir(Filecabinet);
- sprintf(&Opwd[5], "%.*s", PATHSIZ, Filecabinet);
- }
- return(menu_close(a->id)); /* close the menu id */
-}
-
-static struct menu_line
-dir_disp(n, ptr)
-int n;
-struct ott_tab *ptr;
-{
- register int i;
- int size = array_len(ptr->parents);
- int d_cols = COLS - FIXED_COLS;
- struct ott_entry *entry;
- struct menu_line m;
- static char ldescr[MAX_WIDTH];
- char *bsd_path_to_title();
-
- m.flags = 0;
-
- if (n == 0 && size == 0) { /* empty! */
- m.highlight = "Empty Folder";
- m.description = NULL;
- } else if (n >= (int)array_len(ptr->parents)) { /* done */
- m.highlight = m.description = NULL;
- } else {
- entry = &(ptr->ott[ptr->parents[n]]);
-
- switch (ptr->modes & DISMODES) {
- case 0: /* don't display anything but name */
- m.description = NULL;
- m.highlight = bsd_path_to_title(entry->dname,d_cols);
- break;
- case OTT_DMARK:
- m.description = NULL;
- if (entry->objmask & CL_DIR) {
- strcpy(ldescr, bsd_path_to_title(entry->dname,(d_cols-1)));
- strcat(ldescr, "/");
- }
- else if (strcmp(entry->objtype, "EXECUTABLE") == 0) {
- strcpy(ldescr, bsd_path_to_title(entry->dname,(d_cols-1)));
- strcat(ldescr, "*");
- }
- else
- strcpy(ldescr, bsd_path_to_title(entry->dname,d_cols));
- m.highlight = ldescr;
- break;
- default:
- case OTT_DOBJ: /* display description only */
- m.description = entry->display;
- i = d_cols - strlen(m.description) - 3;
- m.highlight = entry->dname;
- break;
- case OTT_DODI: /* display description with odi value */
- {
- char *key_val, *odi_getkey();
-
- key_val = odi_getkey(entry,"UNDELDIR");
- if ( key_val && *key_val ) {
- if ( (i = strlen(entry->dname)) > 20 )
- i = 20;
- i = d_cols - i - strlen(entry->display) - 11;
- sprintf(ldescr,"%s - From %s",entry->display,bsd_path_to_title(key_val, i));
- } else {
- sprintf(ldescr,"%s - From unknown",entry->display);
- }
- }
- i = d_cols - strlen(ldescr) - 3;
- m.highlight = entry->dname;
- m.description = ldescr;
- break;
- case OTT_DMTIME: /* display long form */
- {
- char *p, *ct, *ctime();
- int len, i;
- bool usrdisp = FALSE;
- struct ott_entry *tmp;
- char *def_display();
- int lcv;
-
- lcv = array_len(ptr->parents);
- for (i = 0; !usrdisp && i < lcv; i++) {
- tmp = &(ptr->ott[ptr->parents[i]]);
- p = def_display(tmp->objtype);
- if (tmp->display != p && strcmp(tmp->display, p) != 0)
- usrdisp = TRUE;
- }
-
- if (entry->display == (p = def_display(entry->objtype))
- || strcmp(entry->display, p) == 0)
- len = sprintf(ldescr, "%-14.14s%*s",
- entry->display, usrdisp ? 23 : 2, "");
- else
- len = sprintf(ldescr, "%-19.19s [%-.14s]%*s ",
- entry->display, p, 14-strlen(p), "");
- ct = ctime(&(entry->mtime));
- sprintf(ldescr+len, "%12.12s", ct+4);
- }
- i = d_cols - strlen(ldescr) - 3;
- m.highlight = entry->dname;
- m.description = ldescr;
- break;
- }
- }
- return(m);
-}
-
-static int
-dir_help(a)
-struct actrec *a;
-{
- extern char *Wastebasket;
- char *help, *title, path[PATHSIZ];
- char *filename(), *anyenv();
-
- sprintf(path, "%s/.pref", a->path);
- if ((help = anyenv(path, "HELP")) == NULL || *help == '\0') {
- if (strncmp(a->path, Wastebasket, strlen(Wastebasket)) == 0) {
- help = "T.h55.waste";
- title = "Wastebasket";
- }
- else {
- help = "T.h43.fold";
- title = "File folder";
- }
- } else {
- title = filename(a->path);
- }
-
- return(objop("OPEN", "TEXT", "$VMSYS/OBJECTS/Text.mfhelp", help,
- title, NULL));
-}
-
-static int
-dir_current(a)
-struct actrec *a;
-{
- extern char Opwd[];
-
- make_current(a->path);
- menu_current(a->id);
- chdir(a->path);
- sprintf(&Opwd[5], "%.*s", PATHSIZ, a->path);
- return(SUCCESS);
-}
-
-static int
-dir_reread(a)
-struct actrec *a;
-{
- return(dir_init(a, TRUE));
-}
-
-static int
-dir_reinit(a)
-struct actrec *a;
-{
- return(dir_init(a, FALSE));
-}
-
-static int
-dir_init(a, force)
-struct actrec *a;
-bool force;
-{
- struct ott_tab *ott = MYODPTR(a)->ott;
-
-#ifdef _DEBUG
- _debug(stderr, "DIR_REINIT ");
-#endif
- MYODPTR(a)->ott = (ott = ott_get(ott->path, Sortmodes, Dispmodes,
- ott->amask, ott->nmask));
- if (ott == NULL)
- return(FAIL);
-
- if (force || MYODPTR(a)->dir_mtime != ott->dir_mtime ||
- MYODPTR(a)->ott_mtime != ott->ott_mtime ||
- Prefmodtime != MYODPTR(a)->pref_mtime ) {
-#ifdef _DEBUG
- _debug(stderr, "RECREATING WINDOW %s\n", ott->path);
-#endif
- MYODPTR(a)->dir_mtime = ott->dir_mtime;
- MYODPTR(a)->ott_mtime = ott->ott_mtime;
- MYODPTR(a)->pref_mtime = Prefmodtime;
- a->id = folder_reinit(a->id, 0, 18, 0, dir_disp, ott);
- }
-#ifdef _DEBUG
- else
- _debug(stderr, "No change in directory\n");
-#endif
-
- ott_lock_inc(ott);
- return(SUCCESS);
-}
-
-/* these arguments are kludgy, but varargs wouldn't do the trick */
-
-static int
-dir_ctl(rec, cmd, arg1, arg2, arg3, arg4, arg5, arg6)
-struct actrec *rec;
-int cmd;
-int arg1, arg2, arg3, arg4, arg5, arg6;
-{
-#ifdef _DEBUG
- _debug(stderr, "DIR_CTL: cmd=%d\n", cmd);
-#endif
- switch (cmd)
- {
- case CTGETARG:
- {
- int line;
- char *path;
- struct ott_entry *entry;
- struct ott_tab *tab = MYODPTR(rec)->ott;
- char *ott_to_path();
-
- if (array_len(tab->parents) == 0)
- return(FAIL);
- (void) menu_ctl(rec->id, CTGETPOS, &line);
- entry = &(tab->ott[tab->parents[line]]);
- path = ott_to_path(entry);
- /*if ( **((char ***)(&arg1))) */
- /* free( **((char ***)(&arg1))); */ /* les 12/4 */
- **((char ***)(&arg1)) = strsave(path);
- return(SUCCESS);
- }
- case CTSETMSG:
- /* framemsg is always this - miked */
- mess_frame("Move to an item with arrow keys and press ENTER to select the item.");
- return(SUCCESS);
- case CTSETLIFE:
- /* lifetime of directory is always longterm */
- return(SUCCESS);
- case CTISDEST:
- **((bool **)(&arg1)) = TRUE;
- return(SUCCESS);
- default:
- return(menu_ctl(rec->id, cmd, arg1, arg2, arg3, arg4, arg5, arg6));
- break;
- }
-}
-
-static token
-dir_odsh(rec, t)
-struct actrec *rec;
-register token t;
-{
- token menu_stream();
-
-#ifdef _DEBUG
- _debug(stderr, "dir_odsh(%o) => ", t);
-#endif
- t = menu_stream(t);
-#ifdef _DEBUG
- _debug(stderr, "%o\n", t);
-#endif
- if (t == TOK_NEXT)
- t = TOK_NOP; /* filter out, see menu_stream */
- return(t);
-}
-
-int
-IF_dir_open(argv)
-char *argv[];
-{
- register int i;
- char *path;
- long amask, nmask;
- struct ott_tab *ott;
- struct actrec a, *prevdir, *path_to_ar();
- char *bsd_path_to_title();
- char *nstrcat();
-
- struct ott_tab *ott_get();
-
-
- init_modes();
- amask = 0;
- nmask = M_WB;
-
- for (i = 0; argv[i]; i++) {
- if (argv[i][0] == '-') {
- switch (argv[i][1]) {
- case 'w': /* wastebasket mode */
- amask = M_WB;
- nmask = 0;
- break;
- case 'a': /* set amask only */
- amask = strtol(argv[i]+2);
- break;
- case 'n': /* set nmask only */
- nmask = strtol(argv[i]+2);
- break;
- }
- } else
- path = argv[i];
- }
-
- if (prevdir = path_to_ar(path)) {
- ar_current(prevdir, TRUE);
- return(SUCCESS);
- }
- if (Dirs_open > MAX_DIRS) {
- mess_temp("Too many folders open. Close some, then try again.");
- return(FAIL);
- }
- if ((ott = ott_get(path, Sortmodes, Dispmodes, amask, nmask)) == NULL) {
- mess_temp(nstrcat("Could not open folder ",
- bsd_path_to_title(path, MESS_COLS - 22), NULL));
- return(FAIL);
- }
-
- if (dir_create(ott, &a, FALSE) == FAIL || !ar_current(ar_create(&a), FALSE))
- return(FAIL);
- Dirs_open++;
- return(SUCCESS);
-}
-
-int
-dir_create(ott, a, cover)
-struct ott_tab *ott;
-struct actrec *a;
-bool cover;
-{
- static char path_tit[MAX_WIDTH];
- char *bsd_path_to_title();
-
- /*if ( a->path )
- free( a->path ); */ /* les 12/4 */
- a->path = strsave(ott->path);
- a->fcntbl[AR_CLOSE] = dir_close;
- a->fcntbl[AR_REREAD] = dir_reread;
- a->fcntbl[AR_REINIT] = dir_reinit;
- a->fcntbl[AR_CURRENT] = dir_current;
- a->fcntbl[AR_TEMP_CUR] = dir_current; /* abs k15. optimize later */
- a->fcntbl[AR_NONCUR] = AR_MEN_NONCUR;
- a->fcntbl[AR_HELP] = dir_help;
- a->fcntbl[AR_CTL] = dir_ctl;
- a->fcntbl[AR_ODSH] = (int (*)())dir_odsh; /* added cast. abs */
-
- /* we will keep track of what the mod times were on the ott at the
- * time we first created the window, that way we will be able to
- * know when we should recreate the window to reflect the new data.
- */
- a->odptr = (char *) new(struct myodptr);
- MYODPTR(a)->ott = ott;
- MYODPTR(a)->dir_mtime = ott->dir_mtime;
- MYODPTR(a)->ott_mtime = ott->ott_mtime;
-#ifdef _DEBUG
- _debug(stderr, "dir_create mtimes=%d %d\n", ott->dir_mtime, ott->ott_mtime);
-#endif
-
-/*
- (void)strncpy(path_tit,path_to_title(ott->path, NULL, 0),MAX_TITLE-1);
- path_tit[MAX_TITLE-1] = '\0';
-*/
- (void)strcpy(path_tit,bsd_path_to_title(ott->path, 0));
- a->id = folder_make(-1, path_tit, cover ? VT_COVERCUR : 0,
- VT_UNDEFINED, VT_UNDEFINED, 18, 0, dir_disp, ott);
-
- if (a->id == FAIL)
- return(FAIL);
-
- a->lifetime = AR_LONGTERM;
- a->flags = 0;
- a->slks = NULL;
-
- return SUCCESS;
-}
-
-/* selection handlers are not used by wish - they are built in to the
- * ODSH function
- */
-
-int
-IF_dsh()
-{
- return (0);
-}
-
-int
-IF_dvi()
-{
- return (0);
-}
-
-int
-IF_dmv(argv)
-char *argv[];
-{
- return(dir_mv_cp(TRUE, argv));
-}
-
-int
-IF_dcp(argv)
-char *argv[];
-{
- return(dir_mv_cp(FALSE, argv));
-}
-
-static bool
-eq_waste_fc(path, op)
-char *path, *op;
-{
- char *err = NULL;
- extern char *Filecabinet, *Wastebasket;
- char *filename() , *nstrcat();
-
- if (strcmp(Filecabinet, path) == 0)
- err = Filecabinet;
- else if (strcmp(Wastebasket, path) == 0)
- err = Wastebasket;
- if (err) {
- mess_temp(nstrcat("Can't ", op, " your ", filename(err), NULL));
- return(TRUE);
- } else
- return(FALSE);
-}
-
-static int
-dir_mv_cp(mv, argv)
-bool mv;
-char *argv[];
-{
- struct ott_entry *ott;
- char command[FILE_NAME_SIZ+PATHSIZ*2+11];
- char *odi, *display, path[PATHSIZ], msg[MESSIZ];
- int l, ret = SUCCESS;
- extern char *Wastebasket, Undel[];
- char *nstrcat(), *filename();
- struct ott_entry *path_to_ott();
- char *bsd_path_to_title();
- char *parent();
-
- working(TRUE);
- if (strncmp(argv[0], argv[1], l = strlen(argv[0])) == 0 &&
- argv[1][0] == '/') {
- mess_temp(nstrcat("Can't ", mv?"move":"copy",
- " a folder inside itself!", NULL));
- return(FAIL);
- }
-
- if (eq_waste_fc(argv[0], mv ? "move" : "copy"))
- return(FAIL);
- if (mv && ckperms(parent(argv[0]), 02) == FAIL)
- return(FAIL);
- if (ckperms(argv[1], 02) == FAIL)
- return(FAIL);
- if (mv && path_isopen(argv[0], mv ? "move" : "copy", TRUE))
- return(FAIL);
- if ((ott = path_to_ott(argv[0])) == NULL)
- return(FAIL);
- odi = strsave(ott->odi);
- display = strsave(ott->display);
- sprintf(command, "dir_%s %s %s %s", mv?"move":"copy", argv[0], argv[1],
- argv[2]?argv[2]:"");
-
- if (waitspawn(sysspawn(command)) == 0) {
-
- if ( argv[2] ) {
- sprintf(msg, "%s %sed to the ",
- bsd_path_to_title(filename(argv[0]), (MESS_COLS-33)/3), mv ? "mov" : "copi");
- l = strlen(msg);
- strcat(msg, bsd_path_to_title(argv[1],MESS_COLS-l-18-(MESS_COLS-33)/3));
- strcat(msg, " folder and named ");
- l = strlen(msg);
- strcat(msg, bsd_path_to_title(argv[2],MESS_COLS - l));
- } else {
- sprintf(msg, "%s %sed to the ",
- bsd_path_to_title(filename(argv[0]), (MESS_COLS-22)/2), mv ? "mov" : "copi");
- l = strlen(msg);
- strcat(msg, bsd_path_to_title(argv[1],MESS_COLS - l - 7));
- strcat(msg, " folder");
- }
-/* miked k17
- sprintf(msg, "%s %sed to the ",
- bsd_path_to_title(argv[2] ? argv[2] : filename(argv[0]),(MESS_COLS-22)/2),
- mv ? "mov" : "copi");
- l = strlen(msg);
- strcat(msg, bsd_path_to_title(argv[1],MESS_COLS - l - 7));
- strcat(msg, " folder");
-*/
- sprintf(path, "%s/%s", argv[1], argv[2] ? argv[2] : filename(argv[0]));
- if ((ott = path_to_ott(path)) == NULL)
- return(FAIL);
- /*if ( ott->odi )
- free( ott->odi ); */ /* les 12/4 */
- ott->odi = odi;
- /*if ( ott->display )
- free( ott->display ); */ /* les 12/4 */
- ott->display = display;
- (void) ott_chg_odi(ott);
- if (strncmp(path, Wastebasket, strlen(Wastebasket)) == 0)
- (void) odi_putkey(ott, Undel, parent(argv[0]));
- else if (strncmp(argv[0], Wastebasket, strlen(Wastebasket)) == 0)
- (void) odi_putkey(ott, Undel, NULL);
- (void) utime(path, NULL);
- ott_mtime(ott);
- ret = SUCCESS;
- } else {
- sprintf(msg, "%s %s failed to the ",
- bsd_path_to_title(argv[2] ? argv[2] : filename(argv[0]),(MESS_COLS-27)/2),
- mv ? "move" : "copy");
- l = strlen(msg);
- strcat(msg, bsd_path_to_title(argv[1],MESS_COLS - l - 7));
- strcat(msg, " folder");
- ret = FAIL;
- }
- mess_temp(msg);
- return(ret);
-}
-
-int
-IF_drn(argv)
-char *argv[];
-{
- register char *p;
- char *nstrcat(), *filename(), *parent();
- char *bsd_path_to_title();
-
- p = filename(argv[0]);
- if (ckperms(parent(argv[0]), 02) == FAIL)
- return(FAIL);
- if (path_isopen(argv[0], "rename", TRUE))
- return(FAIL);
- if (eq_waste_fc(argv[0], "rename"))
- return(FAIL);
- if (waitspawn(spawn("/bin/mv", "mv", "-f", argv[0],
- nstrcat(parent(argv[0]), "/", argv[1], NULL), NULL))) {
- mess_temp(nstrcat(bsd_path_to_title(p,MESS_COLS - 14), " rename failed", NULL));
- return(FAIL);
- } else {
- mess_temp(nstrcat(bsd_path_to_title(p,(MESS_COLS - 12)/2), " renamed to ", bsd_path_to_title(argv[1],(MESS_COLS - 12)/2), NULL));
- return(SUCCESS);
- }
-}
-
-/*
- * note: This subroutine depends on the fact that its argument is
- * a legal UNIX path, i.e., slash separated strings.
- */
-
-char *
-bsd_path_to_title(str, width)
-char *str;
-int width;
-{
- static char title[MAX_WIDTH];
- register int len;
- extern char *parent();
- extern char *filename();
-
- if ((str == NULL) || (*str == '\0'))
- return str; /* protect ourselves from the empty devil */
-
- if (width <= 0)
- width = MAX_TITLE;
- if (width >= MAX_WIDTH)
- width = MAX_WIDTH - 1; /* lets not exceed the buffer */
-
- if ((len = strlen(str)) > width) {
- register int flen;
-
- flen = strlen(filename(str));
- if (flen >= (width-1)) {
- if (len == flen || len == flen+1) {
- (void) strncpy(title, str, (width-1));
- } else {
- (void) strcpy(title, "</");
- (void) strncat(title, filename(str), (width-3));
- }
- (void) strcpy(&title[width-1], ">");
- } else if (flen) {
- if ( (int)strlen(parent(str)) <= 4 ) { /* EFT k16 */
- (void) strcpy(title, "</");
- (void) strcat(title, filename(str));
- } else {
- (void) strcpy(title, path_to_title(parent(str),"X",(width-flen-1)));
- (void) strcat(title, "/");
- (void) strcat(title, filename(str));
- }
- } else
- (void) strcpy(title, path_to_title(str,"X",width));
- } else
- strcpy(title, str);
- return strdup(title);
-}
diff --git a/usr/src/cmd/fmli/oh/if_exec.c b/usr/src/cmd/fmli/oh/if_exec.c
deleted file mode 100644
index 49d376c0ef..0000000000
--- a/usr/src/cmd/fmli/oh/if_exec.c
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-
-/*
- * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-/* Copyright (c) 1984, 1985, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-#include <stdio.h>
-#include "wish.h"
-#include "terror.h"
-
-
-int
-IF_exec_open(argv)
-char *argv[];
-{
- (void) proc_openv(0, NULL, NULL, argv);
- return (0);
-}
diff --git a/usr/src/cmd/fmli/oh/if_form.c b/usr/src/cmd/fmli/oh/if_form.c
deleted file mode 100644
index bb951f44ae..0000000000
--- a/usr/src/cmd/fmli/oh/if_form.c
+++ /dev/null
@@ -1,1857 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License (the "License").
- * You may not use this file except in compliance with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-
-/*
- * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-/* Copyright (c) 1984, 1985, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-#include <ctype.h>
-#include <stdio.h>
-#include <string.h>
-#include <curses.h>
-#include <sys/types.h> /* EFT abs k16 */
-#include "wish.h"
-#include "menudefs.h"
-#include "message.h"
-#include "token.h"
-#include "vtdefs.h"
-#include "ctl.h"
-#include "slk.h"
-#include "actrec.h"
-#include "typetab.h"
-#include "winp.h"
-#include "form.h"
-#include "fm_mn_par.h"
-#include "objform.h"
-#include "eval.h"
-#include "terror.h"
-#include "var_arrays.h"
-#include "moremacros.h"
-#include "interrupt.h"
-#include "sizes.h"
-
-
-#define FM_KEYS 13
-#define FM_INTR PAR_INTR
-#define FM_ONINTR PAR_ONINTR
-#define FM_DONE PAR_DONE
-#define FM_TITLE 3
-#define FM_LIFE 4
-#define FM_INIT 5
-#define FM_BEGROW 6
-#define FM_BEGCOL 7
-#define FM_HELP 8
-#define FM_REREAD 9
-#define FM_CLOSE 10
-#define FM_ALTSLKS 11
-#define FM_FRMMSG 12
-
-#define FM_FLD_KEYS 27
-
-/* defined above abs
-#define FM_INTR PAR_INTR
-#define FM_ONINTR PAR_ONINTR
-*/
-#define FM_ACTI PAR_ACTION
-#define FM_NAME PAR_NAME
-#define FM_FROW 4
-#define FM_FCOL 5
-#define FM_NROW 6
-#define FM_NCOL 7
-#define FM_ROWS 8
-#define FM_COLS 9
-#define FM_FLEN 10
-#define FM_VALUE 11
-#define FM_RMENU 12
-#define FM_CHOICEMSG 13
-#define FM_VALID 14
-#define FM_NOECHO 15
-#define FM_MENUO 16
-#define FM_SHOW 17
-#define FM_SCROLL 18
-#define FM_WRAP 19
-#define FM_PAGE 20
-#define FM_BUTT 21
-#define FM_VALMSG 22
-#define FM_INACTIVE 23
-#define FM_FIELDMSG 24
-#define FM_LININFO 25
-#define FM_AUTOADVANCE 26
-
-static struct attribute Fm_tab[FM_KEYS] = {
- { "interrupt", RET_STR|EVAL_ALWAYS, NULL, NULL, 0 },
- { "oninterrupt",RET_STR|EVAL_ALWAYS, NULL, NULL, 0 },
- { "done", RET_ARGS|EVAL_ALWAYS, "", NULL, 0 },
- { "form", RET_STR|EVAL_ONCE, "Form", NULL, 0 },
- { "lifetime", RET_STR|EVAL_ALWAYS, "longterm", NULL, 0 },
- { "init", RET_BOOL|EVAL_ALWAYS, "", NULL, 0 },
- { "begrow", RET_INT|EVAL_ONCE, "any", NULL, 0 },
- { "begcol", RET_INT|EVAL_ONCE, "any", NULL, 0 },
- { "help", RET_ARGS|EVAL_ALWAYS, "", NULL, 0 },
- { "reread", RET_BOOL|EVAL_ALWAYS, NULL, NULL, 0 },
- { "close", RET_BOOL|EVAL_ONCE, NULL, NULL, 0 },
- { "altslks", RET_BOOL|EVAL_ONCE, NULL, NULL, 0 },
- { "framemsg", RET_STR|EVAL_ONCE, "", NULL, 0 }
-};
-
-static struct attribute Fm_fld_tab[FM_FLD_KEYS] = {
- { "interrupt", RET_STR|EVAL_ALWAYS, NULL, NULL, 0 },
- { "oninterrupt",RET_STR|EVAL_ALWAYS, NULL, NULL, 0 },
- { "action", RET_ARGS|EVAL_ALWAYS, "", NULL, 0 },
- { "name", RET_STR|EVAL_ONCE, NULL, NULL, 0 },
- { "frow", RET_INT|EVAL_ONCE, "-1", NULL, 0 },
- { "fcol", RET_INT|EVAL_ONCE, "-1", NULL, 0 },
- { "nrow", RET_INT|EVAL_ONCE, "-1", NULL, 0 },
- { "ncol", RET_INT|EVAL_ONCE, "-1", NULL, 0 },
- { "rows", RET_INT|EVAL_ONCE, "1", NULL, 0 }, /* abs f15 */
- { "columns", RET_INT|EVAL_ONCE, "-1", NULL, 0 },
- { "flen", RET_INT|EVAL_ONCE, NULL, NULL, 0 },
- { "value", MAKE_COPY|RET_STR|EVAL_SOMETIMES,"", NULL, 0 },
- { "rmenu", RET_LIST|EVAL_ONCE|EV_SQUIG,"", NULL, 0 },
- { "choicemsg", RET_STR|EVAL_ONCE, NULL, NULL, 0 },
- { "valid", RET_BOOL|EVAL_SOMETIMES,"", NULL, 0 },
- { "noecho", RET_BOOL|EVAL_ONCE, NULL, NULL, 0 },
- { "menuonly", RET_BOOL|EVAL_ONCE, NULL, NULL, 0 },
- { "show", RET_BOOL|EVAL_SOMETIMES,"", NULL, 0 },
- { "scroll", RET_BOOL|EVAL_ONCE, NULL, NULL, 0 },
- { "wrap", RET_BOOL|EVAL_ONCE, NULL, NULL, 0 },
- { "page", RET_STR|EVAL_ONCE, "1", NULL, 0 },
- { "button", RET_INT|EVAL_ONCE, "0", NULL, 0 },
- { "invalidmsg", RET_STR|EVAL_SOMETIMES, NULL, NULL, 0 },
- { "inactive", RET_BOOL|EVAL_SOMETIMES, NULL, NULL, 0 },
- { "fieldmsg", RET_STR|EVAL_ALWAYS, NULL, NULL, 0 },
- { "lininfo", RET_STR|EVAL_ALWAYS, NULL, NULL, 0 },
- { "autoadvance",RET_BOOL|EVAL_ONCE, NULL, NULL, 0 }
-};
-
-char *itoa();
-
-#define DEVirt(X) (((forminfo *) Cur_rec->odptr)->visible[X])
-#define CURforminfo() ((forminfo *) Cur_rec->odptr)
-#define CURform() (&(((forminfo *) Cur_rec->odptr)->fm_mn))
-#define CURattr(x, y) ((CURform()->multi + x)->attrs[y])
-#define NUMvis() (array_len(((forminfo *) Cur_rec->odptr)->visible))
-#define NUMactive() (((forminfo *) Cur_rec->odptr)->numactive)
-#define VALS() (((forminfo *) Cur_rec->odptr)->mulvals)
-#define PTRS() (((forminfo *) Cur_rec->odptr)->holdptrs)
-#define NUMflds() (array_len(((forminfo *) Cur_rec->odptr)->fm_mn.multi))
-#define CURfield() (((forminfo *) Cur_rec->odptr)->curfield)
-#define CURffield() (objform_disp(DEVirt(((forminfo *) Cur_rec->odptr)->curfield), CURforminfo()))
-#define SET_curfield(X) (((forminfo *) Cur_rec->odptr)->curfield) = X
-#define CURpage() ((((forminfo *) Cur_rec->odptr)->curpage))
-#define LASTpage() ((((forminfo *) Cur_rec->odptr)->lastpage))
-#define NUMSTR(X) (strcpy(Field_str + 1, itoa((long)X, 10)), Field_str) /* abs k16 */
-
-extern int Mouse_row; /* Row offset of the mouse */
-extern int Mouse_col; /* Column offset of the mouse */
-extern int Toggle; /* when to "toggle" field choices (if_init.c) */
-
-#define NX_ANY 0 /* pseudo flag */
-#define NX_NOCUR 1
-#define NX_ADVANCE 2
-
-extern char *shrink_str();
-extern char *expand();
-extern char *getaltenv();
-extern struct actrec *ar_create(), *ar_current();
-
-static void chg_curfield();
-static int objform_close();
-static int objform_reinit();
-static int objform_reread();
-static int objform_current();
-static int objform_noncur();
-static int objform_ctl();
-static int objform_stream();
-static int fld_ck();
-static int is_valid();
-static struct fm_mn parse_form();
-
-static struct actrec *Cur_rec; /* current activation record */
-static char *Equal = "=";
-static char *Field_str = "F000";
-
-#define QUERY -1
-#define TOOBIG 1000
-#define TOOSMALL -1000
-
-/*
- * Returns the virtual index of the given actual field number ........
- *
- * The ACTUAL number is the order that the field appears in the form's
- * definition file.
- *
- * The VIRTUAL number is the index into the VISIBLE array of fields
- * (i.e., the subset of ACTUAL fields that contains only those fields
- * that appear on the "current page" or whose "show" descriptor = "true").
- */
-int
-virt(i)
-register int i;
-{
- register int j;
- int lcv;
-
- lcv = NUMvis();
- for (j = 0; j < lcv; j++)
- if (DEVirt(j) == i)
- return(j);
- return(0); /* not exactly right but better than garbage.. */
- /* ..since no one checks the return value */
-}
-
-/*
-** Starting with start, recalculate the values until they are
-** all set. This works by faking out each value into being
-** a control sequence and then substituting the real value for
-** the control sequence
-*/
-int
-redo_vals(start)
-int start;
-{
- int changed;
- register char *envbuf;
- register int i;
- char *hold1, *hold2;
- char buf[BUFSIZ];
- int lcv;
-
- upseqno(CURform());
-
- envbuf = buf;
- lcv = NUMflds();
- for (i = start; i < lcv; i++) {
- strcpy(envbuf, NUMSTR(i + 1));
- strcat(envbuf, "=\001");
- strcat(envbuf, NUMSTR(i + 1));
- putAltenv(envbuf);
- }
-
- changed = FALSE;
- lcv = NUMflds();
- for (i = start; i < lcv; i++) {
- int dofree, maxamt, amt;
-
- dofree = 0;
- hold1 = multi_eval(CURform(), i, FM_VALUE);
- maxamt = BUFSIZ - strlen(NUMSTR(i + 1)) - 2;
- if ((amt = strlen(hold1)) > maxamt) {
- /*
- * Value is greater than 1K so malloc
- * enough space to hold it.
- */
- maxamt = amt + strlen(NUMSTR(i + 1)) + 2;
- if ((envbuf = (char *) malloc(maxamt)) == NULL)
- fatal(NOMEM, nil);
- dofree++;
- }
- else {
- /*
- * ... otherwise, use static 1K buffer
- */
- envbuf = buf;
- dofree = 0;
- }
- strcpy(envbuf, NUMSTR(i + 1));
- changed |= strcmp(hold1, (hold2 = getaltenv(VALS(), envbuf)) ?
- hold2 : nil) == 0;
- strcat(envbuf, Equal);
- strncat(envbuf, hold1, maxamt);
- putAltenv(envbuf);
- putaltenv(&VALS(), envbuf);
- if (dofree) /* if buffer was malloc'd, free it */
- free(envbuf);
- }
- while (changed) {
- changed = FALSE;
- lcv = NUMflds();
- for (i = start; i < lcv; i++) {
- register char *p;
- int dofree, amt, maxamt;
-
- dofree = 0;
- envbuf = buf;
- strcpy(envbuf, NUMSTR(i + 1));
- hold1 = getaltenv(VALS(), envbuf);
- for (p = NULL; p = strchr(hold1, '\001'); )
- *p = '$';
- if (!p)
- continue;
- hold2 = expand(hold1);
- maxamt = BUFSIZ - strlen(NUMSTR(i + 1)) - 2;
- if ((amt = strlen(hold2)) > maxamt) {
- /*
- * Value is greater than 1K so malloc
- * enough space to hold it.
- */
- maxamt = amt + strlen(NUMSTR(i + 1)) + 2;
- if ((envbuf = (char *) malloc(maxamt)) == NULL)
- fatal(NOMEM, nil);
- strcpy(envbuf, NUMSTR(i + 1));
- dofree++;
- }
- else {
- /*
- * ... otherwise, use static 1K buffer
- */
- dofree = 0;
- }
- strcat(envbuf, Equal);
- strncat(envbuf, hold2, maxamt);
- changed = TRUE;
- free(hold2);
- putaltenv(&VALS(), envbuf);
- putAltenv(envbuf);
- if (dofree)
- free(envbuf);
- }
- }
- return (0);
-}
-
-/*
-** Returns the current value of the field, fieldno.
-*/
-char *
-curval(fieldno)
-int fieldno;
-{
- return(getaltenv(VALS(), NUMSTR(fieldno + 1)));
-}
-
-/*
-** Figure out which fields are on the screen as decided by the show
-** function values.
-*/
-int
-fm_vislist(ptr)
-forminfo *ptr;
-{
- int i, num;
- struct fm_mn *fm_mn;
- char *page;
- int lcv;
-
- fm_mn = &(ptr->fm_mn);
- if (!ptr->visible) {
- ptr->slks = (int *) array_create(sizeof(int),array_len(fm_mn->multi));
- ptr->visible = (int *) array_create(sizeof(int), NUMflds());
- }
- else {
- array_trunc(ptr->visible);
- array_trunc(ptr->slks);
- }
-
- lcv = NUMflds();
- NUMactive() = 0;
- for (i = 0; i < lcv; i++) {
- if (atoi(multi_eval(fm_mn, i, FM_BUTT))) {
- /*
- * SLK definition
- */
- if (multi_eval(fm_mn, i, FM_SHOW))
- ptr->slks = (int *) array_append(ptr->slks, (char *) &i);
- }
- else {
- /*
- * FIELD definition
- */
- page = multi_eval(fm_mn, i, FM_PAGE);
- num = atoi(page);
- if (num > LASTpage())
- LASTpage() = num; /* record last page */
- /*
- * Only make visible fields on the CURRENT
- * page ...
- */
- if ((num <= 0) || !page)
- continue;
- else if ((num == CURpage()) ||
- (strcmp(page, "all") == 0) || (*page == '*')) {
- /*
- * add field to visible list ...
- * keep track of the number of active fields
- * for this page ...
- */
- ptr->visible = (int *) array_append(ptr->visible, &i);
- if (multi_eval(fm_mn, i, FM_SHOW) &&
- (!multi_eval(fm_mn, i, FM_INACTIVE)))
- NUMactive()++;
- }
- }
- }
- return (0);
-}
-
-
-static int
-objform_reinit(a)
-struct actrec *a;
-{
- Cur_rec = a;
- if (sing_eval(CURform(), FM_REREAD))
- return(objform_reread(a));
- return(SUCCESS);
-}
-
-/*
-** A front end to parser() which will set up most of the defaults for
-** a form.
-*/
-static struct fm_mn
-parse_form(flags, info_or_file, fp)
-int flags;
-char *info_or_file;
-FILE *fp;
-{
- struct fm_mn fm_mn;
-
- fm_mn.single.attrs = NULL;
- fm_mn.multi = NULL;
- filldef(&fm_mn.single, Fm_tab, FM_KEYS);
- parser(flags, info_or_file, Fm_tab, FM_KEYS, &fm_mn.single,
- Fm_fld_tab, FM_FLD_KEYS, &fm_mn.multi, fp);
- return(fm_mn);
-}
-
-/*
-** Read the form object indicated by this actrec, if a->id > 0
-** then the object is being reread.
-*/
-static int
-objform_reread(a)
-struct actrec *a;
-{
- extern struct slk Defslk[MAX_SLK + 1];
- extern struct slk Formslk[];
- forminfo *fi;
- register int i, but;
- char *label, *intr, *onintr, *get_def();
- int lcv;
- FILE *fp = NULL;
-
- Cur_rec = a;
- fi = CURforminfo();
-
- /* make sure file exists and is readable (if there is a file)
- * The "flags" say if a->path is the information
- * itself or the file of where the information sits. abs k15
- */
- if (!(fi->flags & INLINE))
- if ((fp = fopen(a->path, "r")) == NULL)
- {
- if (a->id >= 0) /* if frame is already posted */
- warn(NOT_UPDATED, a->path);
- else
- warn(FRAME_NOPEN, a->path);
- return(FAIL);
- }
- if (a->id >= 0)
- freeitup(CURform()); /* if posted then free it old one */
- fi->fm_mn = parse_form(fi->flags, a->path, fp); /* abs k14.0 */
- if ((CURform())->single.attrs == NULL) {
-#ifdef _DEBUG4
- _debug4(stderr, "Couldn't parse it\n");
-#endif
- return(FAIL);
- }
- (CURform())->seqno = 1;
- if (PTRS())
- free(PTRS());
- if (NUMflds() && (PTRS() = (char **) calloc(NUMflds(), sizeof(char *))) == NULL)
- fatal(NOMEM, nil);
- lcv = NUMflds();
- for (i = 0; i < lcv; i++)
- PTRS()[i] = (char *) NULL;
-
- fi->visible = NULL; /* initialize array of visible fields */
- fi->slks = NULL; /* initialize array of object's SLKS */
- redo_vals(0); /* initialize field values */
- fm_vislist(CURforminfo()); /* set up visible field list */
- if (a->id < 0)
- SET_curfield(-1);
-
- /*
- * If "init=false" or Form is empty then cleanup
- */
- if (!sing_eval(CURform(), FM_INIT) || (NUMactive() <= 0))
- {
- if (a->id >= 0) /* form is already posted */
- {
- if (a->lifetime == AR_INITIAL)
- {
- mess_temp("can't close this frame");
- mess_lock();
- }
- else
- {
- ar_close(a, FALSE);
- return(FAIL);
- }
- }
- else
- {
- sing_eval(CURform(), FM_CLOSE);
- objform_noncur(a, TRUE); /* takes ARGs out of Altenv */
- freeitup(CURform());
- return(FAIL);
- }
- }
-
- /*
- * update the interrupt descriptors in the activation rec
- */
- ar_ctl(a, CTSETINTR, get_sing_def(CURform(), FM_INTR), NULL, NULL, NULL, NULL, NULL);
- ar_ctl(a, CTSETONINTR, get_sing_def(CURform(), FM_ONINTR), NULL, NULL, NULL, NULL, NULL);
- /*
- * Set up object specific SLK array
- */
- set_top_slks(Formslk);
- memcpy((char *)a->slks, (char *)Defslk, sizeof(Defslk));
- lcv = array_len(fi->slks);
- for (i = 0; i < lcv; i++) {
- but = atoi(multi_eval(CURform(), fi->slks[i], FM_BUTT)) - 1;
- if (but < 0 || but >= MAX_SLK) /* abs */
- continue;
- label = multi_eval(CURform(), fi->slks[i], FM_NAME);
- intr = get_def(CURform(),fi->slks[i], FM_INTR);
- onintr = get_def(CURform(),fi->slks[i], FM_ONINTR);
- set_obj_slk(&(a->slks[but]), label, TOK_SLK1 + but, intr, onintr);
- }
-
- if (a->id >= 0) /* go to first field, first page */
- {
- vt_current(form_ctl(a->id, CTGETVT));
- CURpage() = 1;
- fm_vislist(CURforminfo());
- form_ctl(a->id, CTSETPAGE, TRUE, 1, fi->lastpage);
- nextfield(0, 0, 1, NX_ANY);
- form_ctl(a->id, CTSETDIRTY);
-
- /* used to just go to first field of current page..
- ar_ctl(a, CTCLEARWIN, 0, NULL, NULL, NULL, NULL, NULL);
- nextfield(0, 0, 1, NX_ANY);
- form_ctl(a->id, CTSETDIRTY);
- */
- }
- (void) ar_ctl(Cur_rec, CTSETMSG, FALSE, NULL, NULL, NULL, NULL, NULL); /* was AR_cur. abs k15 */
- return(SUCCESS);
-}
-
-/*
-** Frees up the structures and evaluates the "close" function.
-*/
-static int
-objform_close(a)
-struct actrec *a;
-{
- register int i, lcv;
- char *p, *strchr();
-
- Cur_rec = a;
- form_close(a->id); /* remove the form FIRST */
- copyAltenv(VALS());
- sing_eval(CURform(), FM_CLOSE); /* evaluate close function */
- objform_noncur(a, FALSE); /* remove ARGs from Altenv */
-
- /*
- * Free information IN the forminfo structure
- */
- freeitup(CURform()); /* the form parse table */
- if (PTRS()) /* holdptrs array */
- free(PTRS());
- lcv = array_len(VALS());
- for (i = 0; i < lcv; i++) { /* form specific variables */
- char namebuf[BUFSIZ]; /* (e.g., F1, F2, .... ) */
-
- if (p = strchr(VALS()[0], '='))
- *p = '\0';
- strcpy(namebuf, VALS()[0]);
- if (p)
- *p = '=';
- delaltenv(&VALS(), namebuf);
- }
- array_destroy(VALS()); /* variables array */
- array_destroy(((forminfo *)a->odptr)->slks); /* visible SLKS */
- array_destroy(((forminfo *)a->odptr)->visible); /* visible fields */
-
- /*
- * Free information in the activation record
- */
- free(a->odptr); /* the forminfo structure */
- free(a->slks); /* object specific SLKS */
- free(a->path); /* form definition file */
-
- return(SUCCESS);
-}
-
-/*
-** Takes this objects's information out of the major altenv.
-*/
-static int
-objform_noncur(a, all)
-struct actrec *a;
-bool all;
-{
- register int i;
- register char *p;
- int lcv;
-
- Cur_rec = a;
- lcv = array_len(VALS());
- for (i = 0; i < lcv; i++) {
- char namebuf[BUFSIZ];
-
- if (p = strchr(VALS()[i], '='))
- *p = '\0';
- strcpy(namebuf, VALS()[i]);
- if (p)
- *p = '=';
- delAltenv(namebuf);
- }
- if (all)
- return(form_noncurrent());
- else
- return(SUCCESS);
-}
-
-/*
-** Sets up the major alternate environment based on the values
-** for the altenv that pertains to this object.
-*/
-static int
-objform_current(a)
-struct actrec *a;
-{
- char *choice;
- static char *Form_Choice = "Form_Choice";
-
- /*
- * Make the form "current" and make the first field
- * current if this is the first time.
- */
- Cur_rec = a;
- form_current(a->id);
- if (CURfield() == -1)
- nextfield(0, 0, 1, NX_ANY);
- /*
- * Initialize the field with the value of variable "Form_Choice"
- * (variable holds the selected item(s) from a choices menu)
- */
- if (choice = getAltenv(Form_Choice)) {
- copyAltenv(VALS());
- if (set_curval(strsave(choice)) == SUCCESS) {
- fm_vislist(CURforminfo());
- redo_vals(CURfield() + 1);
- form_ctl(Cur_rec->id, CTSETDIRTY);
- if (multi_eval(CURform(), CURfield(), FM_AUTOADVANCE))
- nextfield(atoi(CURattr(CURfield(),FM_FROW)->cur),
- atoi(CURattr(CURfield(),FM_FCOL)->cur),
- 1, NX_NOCUR);
- }
- delAltenv(Form_Choice);
- }
- else
- copyAltenv(VALS());
-
- set_form_field(a->id, CURfield());
- return(SUCCESS);
-}
-
-/*
-** Sets up the major alternate environment based on the values
-** for the altenv that pertains to this object.
-** Does min neccessary to make object "temporarily" current,
-** invisible to the user.
-*/
-static int
-objform_temp_cur(a)
-struct actrec *a;
-{
- /*
- * Make the form "current"
- */
- Cur_rec = a;
- form_current(a->id);
- if (CURfield() == -1)
- nextfield(0, 0, 1, NX_ANY);
- copyAltenv(VALS());
-
- return(SUCCESS);
-}
-
-/*
-** Evaluates many of the fields to return a form structure that includes
-** name, value, their positions, editing capabilities and a structure
-** that is held here and is used by the low-level form code to pertain
-** to each field.
-*/
-static formfield
-objform_disp(n, fi)
-int n;
-forminfo *fi;
-{
- register int i;
- struct fm_mn *ptr;
- formfield m;
-
- ptr = &(fi->fm_mn);
- if (n >= (int)NUMvis() || n < 0) /* abs k17 */
- m.name = NULL;
- else
- {
- i = DEVirt(n);
- m.name = multi_eval(ptr, i, FM_NAME);
- m.value = (char *) curval(i);
- m.frow = atoi(multi_eval(ptr, i, FM_FROW));
- m.fcol = atoi(multi_eval(ptr, i, FM_FCOL));
- m.nrow = atoi(multi_eval(ptr, i, FM_NROW));
- m.ncol = atoi(multi_eval(ptr, i, FM_NCOL));
- m.rows = atoi(multi_eval(ptr, i, FM_ROWS));
- m.cols = atoi(multi_eval(ptr, i, FM_COLS));
- if (multi_eval(ptr, i, FM_INACTIVE))
- m.flags = I_FANCY;
- else
- m.flags = I_BLANK|I_FANCY|I_FILL;
- if (!multi_eval(ptr, i, FM_SHOW))
- m.flags |= I_NOSHOW;
- m.ptr = PTRS() + i;
- if (multi_eval(ptr, i, FM_WRAP))
- m.flags |= I_WRAP;
- if (multi_eval(ptr, i, FM_SCROLL))
- m.flags |= I_SCROLL;
- if (LASTpage() > 1)
- m.flags |= I_NOPAGE;
- if (multi_eval(ptr, i, FM_NOECHO)) {
- m.flags |= I_INVISIBLE;
- m.flags &= ~(I_BLANK | I_FILL);
- }
- if (multi_eval(ptr, i, FM_AUTOADVANCE))
- m.flags |= I_AUTOADV;
-
- if (m.cols <= 0 || m.rows <= 0 || m.frow < 0 || m.fcol < 0)
- { /* field not active */
- m.cols = 1;
- m.rows = 1;
- m.frow = -1; /* title bar line */
- m.fcol = 0;
- m.flags = I_NOEDIT;
- m.value = "";
- }
- }
- return(m);
-}
-
-/*
-** Evaluates the help field and returns a token for it.
-*/
-static token
-objform_help(rec)
-struct actrec *rec;
-{
- token make_action();
-
- Cur_rec = rec;
- return(make_action(sing_eval(CURform(), FM_HELP)));
-}
-
-/*
-** Forms have no arguments to give, so that must fail. All else is
-** passed on.
-*/
-static int
-objform_ctl(rec, cmd, arg1, arg2, arg3, arg4, arg5, arg6)
-struct actrec *rec;
-int cmd;
-int arg1, arg2, arg3, arg4, arg5, arg6;
-{
- Cur_rec = rec;
- switch (cmd)
- {
- case CTGETARG:
- return(FAIL);
- case CTSETMSG:
- if (arg1 == TRUE) {
- /*
- * if arg1 == TRUE then the frame message was
- * generated "externally" (i.e., via the message
- * built-it). Update the "framemsg" descriptor
- * accordingly.
- */
- char *newmsg, *get_mess_frame();
-
- newmsg = get_mess_frame();
- set_single_default(CURform(), FM_FRMMSG, newmsg);
- }
- else
- mess_frame(sing_eval(CURform(), FM_FRMMSG));
- return(SUCCESS);
- case CTSETLIFE:
- {
- char *life;
-
- /* used CURform, Cur_rec before F15. abs */
- life = sing_eval((&(((forminfo *) rec->odptr)->fm_mn)), FM_LIFE);
- setlifetime(rec, life);
- return(SUCCESS);
- }
- default:
- return(form_ctl(rec->id, cmd, arg1, arg2, arg3, arg4, arg5, arg6));
- }
-}
-
-/*
-** Calls path_to_ar() and nextpath_to_ar() to decide whether this is a
-** reopen or a first open. If it is the latter, it sets up the actrec
-** and calls ar_create().
-*/
-int
-IF_ofopen(args)
-register char **args;
-{
- register int i;
- struct actrec a, *first_rec, *path_to_ar(), *nextpath_to_ar();
- extern struct slk Defslk[MAX_SLK + 1];
- int startrow, startcol;
- int do_inline;
- int type;
- char *life;
- char *begcol, *begrow;
- register struct fm_mn *fm_mn;
- forminfo *fi;
- char envbuf[6];
-
- a.serial = 0;
- a.slks = (struct slk *)NULL;
- a.prevrec = (struct actrec *)NULL;
- a.nextrec = (struct actrec *)NULL;
- a.backup = (struct actrec *)NULL;
-
- if (strCcmp(args[0], "-i") == 0)
- {
- do_inline = TRUE;
- Cur_rec = path_to_ar(args[1]);
- }
- else
- {
- do_inline = FALSE;
- Cur_rec = path_to_ar(args[0]);
- }
- for (first_rec = Cur_rec; Cur_rec; ) {
- char *env;
-
- strcpy(envbuf, "ARG1");
- for (i = do_inline ? 2 : 1;
- (env = getaltenv(VALS(), envbuf)) && args[i];
- envbuf[3]++, i++)
- if (strcmp(args[i], env))
- break;
- if (!args[i] && !env) {
- ar_current(Cur_rec, TRUE); /* abs k15 */
- return(SUCCESS);
- }
- Cur_rec = nextpath_to_ar(Cur_rec);
- if (Cur_rec == first_rec)
- break;
- }
- fi = (forminfo *)new(forminfo);
- fi->flags = do_inline ? INLINE : 0;
- fi->mulvals = NULL;
- fm_mn = &(fi->fm_mn);
- a.odptr = (char *) fi;
- a.id = -1;
- fm_mn->single.attrs = NULL;
- if (do_inline)
- a.path = strsave(args[1]);
- else
- a.path = strsave(args[0]);
- if ((a.slks = (struct slk *) malloc(sizeof(Defslk))) == NULL)
- fatal(NOMEM, nil);
- a.fcntbl[AR_CLOSE] = objform_close;
- a.fcntbl[AR_HELP] = (int (*)())objform_help; /* added cast abs */
- a.fcntbl[AR_REREAD] = objform_reread;
- a.fcntbl[AR_REINIT] = objform_reinit;
- a.fcntbl[AR_CURRENT] = objform_current;
- a.fcntbl[AR_TEMP_CUR] = objform_temp_cur; /* abs k15 */
- a.fcntbl[AR_NONCUR] = objform_noncur;
- a.fcntbl[AR_CTL] = objform_ctl;
- a.fcntbl[AR_ODSH] = objform_stream;
- Cur_rec = &a;
- CURpage() = 1;
- setupenv(fi->flags, args, &VALS());
- if (objform_reread(&a) == FAIL)
- return(FAIL);
- /* return(NULL); abs */
- type = 0;
- life = sing_eval(CURform(), FM_LIFE);
- begrow = sing_eval(fm_mn, FM_BEGROW);
- begcol = sing_eval(fm_mn, FM_BEGCOL);
- life_and_pos(&a, life, begrow, begcol, &startrow, &startcol, &type);
- a.id = form_default(shrink_str(sing_eval(fm_mn, FM_TITLE), MAX_TITLE),
- type, startrow, startcol, objform_disp, (char *)fi);
- if (sing_eval(fm_mn, FM_ALTSLKS))
- a.flags = AR_ALTSLKS | AR_NORESHAPE;
- else
- a.flags = AR_NORESHAPE;
- if (a.id == FAIL)
- return(FAIL);
- form_ctl(a.id, CTSETPAGE, FALSE, CURpage(), LASTpage());
- return((int) ar_current(Cur_rec = (struct actrec *) ar_create(&a), FALSE));
-}
-
-/*
-** Set the value of the current field.
-*/
-int
-set_curval(str)
-char *str;
-{
- char *s;
- char *tmp=NULL;
- char buf[BUFSIZ];
- char *envbuf;
-
- strcpy(buf, NUMSTR(CURfield() + 1));
- form_ctl(Cur_rec->id, CTGETARG, &tmp);
- if (strcmp(str, s = getaltenv(VALS(), buf)) || strcmp(str,tmp)) {
- /*
- * If the current value and the passed value are
- * different then add the passed value (str) to
- * the environment
- */
- int dofree, maxamt, amt;
-
- dofree = 0;
- maxamt = BUFSIZ - strlen(NUMSTR(CURfield() + 1)) - 2;
- if ((amt = strlen(str)) > maxamt) {
- /*
- * Value is greater than 1K so malloc
- * enough space to hold it.
- */
- maxamt = amt + strlen(NUMSTR(CURfield() + 1)) + 2;
- if ((envbuf = (char *) malloc(maxamt)) == NULL)
- fatal(NOMEM, nil);
- dofree++;
- }
- else {
- /*
- * ... otherwise, use static 1K buffer
- */
- envbuf = buf;
- dofree = 0;
- }
- set_cur(CURform(), CURfield(), FM_VALUE, strsave(str));
- strcpy(envbuf, NUMSTR(CURfield() + 1));
- strcat(envbuf, Equal);
- strncat(envbuf, str, maxamt);
- putaltenv(&VALS(), envbuf);
- putAltenv(envbuf);
- if (dofree)
- free(envbuf);
- return(SUCCESS);
- }
- return(FAIL);
-}
-
-static int chk_page();
-
-/*
- * CHK_FORM returns the actual number of the FIRST field that
- * is invalid ....
- */
-static int
-chk_form()
-{
- register int n, page, fldnum;
- int savefield, savepage, retval;
-
- /*
- * Save current form page/field
- */
- savepage = CURpage();
- savefield = CURfield();
-
- /*
- * if the current page has an invalid field then return
- * its field number
- */
- if ((fldnum = chk_page(CURpage())) >= 0) {
- SET_curfield(savefield);
- return(fldnum);
- }
-
- /*
- * For each page of the form, scan the list of
- * fields and validate those that were not touched.
- * (Start with the page AFTER the current page and wrap around)
- */
- retval = -1;
- page = CURpage();
- for (n = 1; n < LASTpage(); n++) {
- page = (page % LASTpage()) + 1;
- if ((fldnum = chk_page(page)) >= 0) {
- retval = fldnum;
- break;
- }
- }
-
- /*
- * restore current form page/field
- */
- if (CURpage() != savepage) {
- CURpage() = savepage;
- fm_vislist(CURforminfo()); /* create new visible list */
- }
- SET_curfield(savefield);
- return(retval);
-}
-
-/*
- * CHK_PAGE will make sure that all visible fields of "page" are valid.
- */
-static int
-chk_page(page)
-int page;
-{
- register int i, j, lcv;
- register struct attribute *attr;
-
- if (page != CURpage()) { /* compute new visible list? */
- CURpage() = page;
- fm_vislist(CURforminfo());
- }
- for (i = 0, lcv = NUMvis(); i < lcv; i++) {
- j = DEVirt(i);
- /*
- * check the flags of the appropriate "attribute"
- * structure to see if the field has ever been "touched"
- * (visited) ...
- */
- if (multi_eval(CURform(), j, FM_MENUO))
- attr = CURattr(j, FM_MENUO);
- else
- attr = CURattr(j, FM_VALID);
- if (multi_eval(CURform(), j, FM_SHOW) && attr &&
- !(attr->flags & ATTR_TOUCHED)) {
- attr->flags |= ATTR_TOUCHED;
- SET_curfield(j);
- if (fld_ck(j) != SUCCESS)
- return(j);
- }
- }
- return(-1);
-}
-
-/*
-** Given a form_field structure, it will get the value of the current
-** field and see if it is A) different and B) valid. If the value is
-** different all sorts of recalculation must go on (the show function,
-** all the new values). If the value is valid, it returns SUCCESS,
-** so that the function calling it can navigate or close.
-*/
-int
-fld_get_ck(form_field)
-formfield *form_field;
-{
- char *s;
- char buf[BUFSIZ];
-
- if ( form_field->flags & I_SCROLL )
- s = NULL;
- else
- s = (form_field->rows * form_field->cols >= BUFSIZ) ? NULL : buf;
- form_ctl(Cur_rec->id, CTGETARG, &s);
- if (set_curval(s) == SUCCESS) {
- redo_vals(CURfield() + 1);
- fm_vislist(CURforminfo());
- form_ctl(Cur_rec->id, CTSETDIRTY);
- }
- return(is_valid(s));
-}
-
-/*
- * FLD_IS_VALID will check to see if a field is valid by retrieving, and
- * not computing, the value of "$FN" ...
- */
-static int
-fld_ck(i)
-int i;
-{
- char *s;
- char buf[BUFSIZ];
-
- strcpy(buf, NUMSTR(i + 1));
- s = getaltenv(VALS(), buf);
- return(is_valid(s));
-}
-
-static int
-is_valid(s)
-char *s;
-{
- int ret;
- char *str;
-
- ret = SUCCESS;
- if (!multi_eval(CURform(), CURfield(), FM_VALID)) {
- if ((str=multi_eval(CURform(), CURfield(), FM_VALMSG)) && *str)
- mess_temp(str);
- else
- warn(VALID, s);
- mess_lock();
- ret = FAIL;
- }
- else if (multi_eval(CURform(), CURfield(), FM_MENUO)) {
- char **list;
-
- if ((list = (char **) multi_eval(CURform(), CURfield(), FM_RMENU)) &&
- *list != '\0')
- {
- int i, lcv;
-
- lcv = array_len(list) - 1;
- for (i = 1; i < lcv; i++)
- if (strcmp(s, list[i]) == 0)
- break;
- if (i == lcv) {
- if ((str = multi_eval(CURform(), CURfield(), FM_VALMSG)) && *str)
- mess_temp(str);
- else
- warn(VALID, s);
- mess_lock();
- ret = FAIL;
- }
- }
- else {
- if ((str = multi_eval(CURform(), CURfield(), FM_VALMSG)) && *str)
- mess_temp(str);
- else
- warn(VALID, s);
- mess_lock();
- ret = FAIL;
- }
- }
- return(ret);
-}
-
-/*
-** Move to another field.
-*/
-static void
-chg_curfield(virtnum)
-int virtnum;
-{
- int num;
-
- num = DEVirt(virtnum);
- if (CURfield() == num)
- return;
- SET_curfield(num);
- set_form_field(Cur_rec->id, num);
-}
-
-/*
-** Calculates the next field to go to. Mode is either positive or
-** negative 1 for forward and backward navigation. Canbecur
-** decides whether the current field should be eliminated from the
-** choices for nextfield().
-*/
-int
-nextfield(currow, curcol, mode, flags)
-int currow;
-int curcol;
-register int mode;
-int flags;
-{
- register int i, j, frow, fcol;
- int curi, rows, cols;
- int newcurrow, newcurcol;
- int leastcol, leastrow, leasti;
- struct fm_mn *curf;
- int no_current, page_advance;
- int lcv;
- int f_error, oldfield, oldpage; /* abs */
- int try; /* abs k17 */
-
- oldfield = CURfield(); /* abs */
- oldpage = CURpage(); /* abs */
- no_current = page_advance = 0;
- if (flags & NX_NOCUR)
- no_current++;
- if (flags & NX_ADVANCE)
- page_advance++;
-
- curf = CURform();
- leastrow = mode * TOOBIG;
- leastcol = mode * TOOBIG;
- newcurrow = mode * TOOBIG;
- newcurcol = mode * TOOBIG;
- curi = -1;
- leasti = -1;
- lcv = NUMvis();
- for (i = 0; i < lcv; i++)
- {
- /*
- * First eliminate fields that can be eliminated
- *
- * IF ...
- * 1. field is inactive/non showable OR
- * 2. field is current and isn't eligible OR
- * 3. either rows or cols <= 0 OR
- * 4. frow or fcol < 0
- *
- * THEN skip the field
- *
- * NOTE: The reason that fields that do not satisfy
- * (3) and (4) are visible is that one can
- * have a field name with no field associated
- * with it .... (ETI does not have such a
- * field/field-name association)
- *
- */
- j = DEVirt(i);
- if (multi_eval(curf, j, FM_INACTIVE) ||
- (!multi_eval(curf, j, FM_SHOW)) ||
- ((j == CURfield()) && no_current))
- continue;
-
- rows = atoi(multi_eval(curf, j, FM_ROWS));
- cols = atoi(multi_eval(curf, j, FM_COLS));
- frow = atoi(multi_eval(curf, j, FM_FROW));
- fcol = atoi(multi_eval(curf, j, FM_FCOL));
- if (rows <= 0 || cols <= 0 || frow < 0 || fcol < 0)
- continue;
-
- /*
- * Determine whether the "ith" visible field is next
- * A few comments here would help !!!
- */
- if ((mode * frow >= mode * currow) && (mode * frow <= mode * newcurrow))
- {
- if (((mode * frow > mode * currow) ||
- (mode * fcol >= mode * curcol)) &&
- ((mode * frow < mode * newcurrow) ||
- (mode * fcol < mode * newcurcol)))
- {
- newcurcol = fcol;
- newcurrow = frow;
- curi = i;
- continue;
- }
- }
- if ((mode * frow <= mode * leastrow))
- {
- if ((mode * frow < mode * leastrow) ||
- (mode * fcol <= mode * leastcol))
- {
- leastcol = fcol;
- leastrow = frow;
- leasti = i;
- }
- }
- } /* end for i=0.. */
- if ((newcurrow == mode * TOOBIG) && (newcurcol == mode * TOOBIG))
- {
- /*
- * User has reached a page boundary (i.e., there is no
- * next/previous field on the current page)
- */
- if (LASTpage() != 1 && page_advance)
- {
- /*
- * If this is a multi-page form AND the page should be
- * automatically advanced on page boundaries then ...
- */
- if (mode < 0) /* prev field */
- { /* find the prev page with visible fields abs k17 */
- f_error = TRUE; /* abs k17 */
- for (try = LASTpage(); try > 1; try--) /* abs k17 */
- { /* abs k17 */
- if (CURpage() != 1)
- CURpage()--;
- else
- CURpage() = LASTpage();
- fm_vislist(CURforminfo());
- if ((int)NUMvis() > 0) /* abs k17 */
- { /* abs k17 */
- f_error = FALSE; /* abs k17 */
- break; /* abs k17 */
- } /* abs k17 */
- } /* abs k17 */
-
- if (!f_error) /* abs k17 */
- f_error = form_ctl(Cur_rec->id, CTSETPAGE, TRUE, CURpage(),
- LASTpage());
- if (f_error)
- {
- CURpage() = oldpage;
- CURfield() = oldfield;
- fm_vislist(CURforminfo());
- form_ctl(Cur_rec->id, CTSETPAGE, TRUE, oldpage, LASTpage());
- mess_temp("Cannot display the previous page: page may be too large");
- mess_lock();
- return (0);
- }
- CURfield() = -1; /* abs */
- nextfield(1000, 1000, -1, NX_ANY);
- return (0);
- }
- else /* next field */
- { /* find the next page with visible fields abs k17 */
- f_error = TRUE; /* abs k17 */
- for (try = LASTpage(); try > 1; try--) /* abs k17 */
- { /* abs k17 */
- if (CURpage() != LASTpage())
- CURpage()++;
- else
- CURpage() = 1;
- fm_vislist(CURforminfo());
- if ((int)NUMvis() > 0) /* abs k17 */
- { /* abs k17 */
- f_error = FALSE; /* abs k17 */
- break; /* abs k17 */
- } /* abs k17 */
- } /* abs k17 */
-
- if (!f_error) /* abs k17 */
- f_error = form_ctl(Cur_rec->id, CTSETPAGE, TRUE, CURpage(),
- LASTpage());
- if (f_error)
- {
- CURpage() = oldpage;
- CURfield() = oldfield;
- fm_vislist(CURforminfo());
- form_ctl(Cur_rec->id, CTSETPAGE, TRUE, oldpage, LASTpage());
- mess_temp("Cannot display the next page: page may be too large");
- mess_lock();
- return (0);
- }
- CURfield() = -1; /* abs */
- nextfield(0, 0, 1, NX_ANY);
- return (0);
- }
- }
- else
- {
- /*
- * simply wrap around to the top/bottom of the page
- */
- curi = leasti;
- }
- }
- if (curi < 0)
- curi = virt(CURfield()); /* zero or one active field */
-
- chg_curfield(curi);
- return (0);
-}
-
-token
-seek_field(row, col)
-int row, col;
-{
- register int i, j, lcv;
- struct fm_mn *curf;
- int frow, fcol, foundfield;
-
- curf = CURform();
- lcv = NUMvis();
- foundfield = -1;
- /*
- * since row,col is 0,0 use 1,1 scale for offset
- */
- for (i = 0; i < lcv; i++) {
- /*
- * First eliminate fields that can be eliminated
- */
- j = DEVirt(i);
- if ((multi_eval(curf, j, FM_SHOW)) &&
- ((frow = atoi(multi_eval(curf, j, FM_FROW))) <= row) &&
- (atoi(multi_eval(curf, j, FM_ROWS)) + frow > row) &&
- ((fcol = atoi(multi_eval(curf, j, FM_FCOL))) <= col) &&
- (atoi(multi_eval(curf, j, FM_COLS)) + fcol > col)) {
- foundfield = i;
- break;
- }
- }
- if (foundfield < 0 || multi_eval(curf, foundfield, FM_INACTIVE))
- return(TOK_BADCHAR);
- else {
- chg_curfield(foundfield);
- return(TOK_NOP);
- }
-}
-
-/* return values */
-#define TOGGLE 1
-#define LONGLIST 2
-#define ACTION 3
-
-/*
-** Checks an "rmenu" to see if it is a small list (toggle choices
-** if less than "threshold" members), a large list or a command.
-*/
-int
-testlist(list)
-char **list;
-{
- if (list[0][0] == '{') {
- if (((int)array_len(list) - 2) <= Toggle) /* account for "{ }" */
- return(TOGGLE);
- return(LONGLIST);
- }
- return(ACTION);
-}
-
-char *Choice_list[3] =
-{
- "OPEN",
- "MENU",
- "-i"
-};
-
-/*
-** Turns an rmenu field into a command.
-*/
-token
-rmenuaction(list)
-register char **list;
-{
- extern char *Args[];
- extern int Arg_count;
- int lcv;
-
- if (testlist(list) == LONGLIST) {
- register int i;
- register IOSTRUCT *out;
- /* char **help;
- */
- out = io_open(EV_USE_STRING, NULL);
-
- putastr("menu=Choices\n", out);
- putastr("lifetime=shortterm\n", out);
-
- /* Shouldn't evaluate help when choices is pressed!! abs.
- * putastr("Help=", out);
- * help = (char **) sing_eval(CURform(), FM_HELP);
- * lcv = array_len(help);
- * for (i = 0; i < lcv; i++) {
- * putastr(help[i], out);
- * putac(' ', out);
- * }
- * putac('\n', out);
- */
- lcv = array_len(list) - 1;
- for (i = 1; i < lcv; i++) {
- putac('\n', out);
- putastr("name=\"", out);
- putastr(list[i], out);
- putastr("\"\n", out);
- putastr("lininfo=\"", out);
- putastr(list[i], out);
- putastr("\"\n", out);
- putastr("action=`set -l Form_Choice=\"", out);
- putastr(list[i], out);
- putastr("\"`close", out);
- putac('\n', out);
- putac('\n', out);
- }
- putastr("name=\nbutton=1\naction=badchar\n", out);
- putastr("name=\nbutton=2\naction=badchar\n", out);
- putastr("name=\nbutton=4\naction=badchar\n", out);
- putastr("name=\nbutton=5\naction=badchar\n", out);
- putastr("name=\nbutton=7\naction=badchar\n", out);
- putastr("name=\nbutton=8\naction=badchar\n", out);
-
- for (Arg_count = 0; Arg_count < 3; Arg_count++) {
- if (Args[Arg_count])
- free(Args[Arg_count]); /* les */
-
- Args[Arg_count] = strsave(Choice_list[Arg_count]);
- }
-
- if (Args[Arg_count])
- free(Args[Arg_count]); /* les */
-
- Args[Arg_count++] = io_string(out);
- io_close(out);
-
- if (Args[Arg_count])
- free(Args[Arg_count]); /* les */
-
- Args[Arg_count] = NULL;
- return(TOK_OPEN);
- }
- return(setaction(list));
-}
-
-/*
-** Processes characters after the editor.
-*/
-token
-post_stream(t)
-register token t;
-{
- formfield form_field;
- char *str;
- char **list;
- int *slks;
- int i, len;
- int num, fnum;
- int nextflags, flag;
- char *s;
- int lcv;
- int f_error; /* abs */
- token make_action();
-
- nextflags = flag = 0;
- form_field = CURffield();
-
- s = NULL;
- if (t >= TOK_SLK1 && t <= TOK_SLK16) {
- slks = CURforminfo()->slks;
- num = t - TOK_SLK1 + 1;
- lcv = array_len(slks);
- for(i = 0; i < lcv; i++)
- if (atoi(multi_eval(CURform(), slks[i], FM_BUTT)) == num) {
- form_ctl(Cur_rec->id, CTGETARG, &s);
- t = setaction(multi_eval(CURform(), slks[i], FM_ACTI));
- break;
- }
- }
- switch(t) {
- case TOK_BPRESSED:
- return(TOK_NOP); /* do nothing on a button press */
- case TOK_BRELEASED:
- return((token) seek_field(Mouse_row, Mouse_col));
- case TOK_OPTIONS:
- t = TOK_NOP;
- if (list = (char **) multi_eval(CURform(), CURfield(), FM_RMENU)) {
- int i;
- char *str;
-
- if ((str = multi_eval(CURform(), CURfield(), FM_CHOICEMSG)) && *str) {
- mess_temp(str);
- mess_lock(); /* don't overwrite it !!! */
- }
- len = array_len(list);
- if (len == 0 || (len <= 2 && list[0][0] == '{')) {
- if (!(str && *str))
- mess_temp("There are no choices available");
- }
- else if (testlist(list) == TOGGLE) {
- char *s;
-
- s = getaltenv(VALS(), NUMSTR(CURfield() + 1));
- len -= 2;
- list = list + 1;
-
- for (i = 0; i < len - 1; i++)
- if (strcmp(s, list[i]) == 0)
- break;
- if (set_curval(strsave(list[(i + 1) % len])) == SUCCESS) {
- fm_vislist(CURforminfo());
- redo_vals(CURfield() + 1);
- form_ctl(Cur_rec->id, CTSETDIRTY);
- }
- }
- else
- t = rmenuaction(list);
- }
- break;
- case TOK_RESET:
- {
- char *s = NULL;
-
- form_ctl(Cur_rec->id, CTGETARG, &s);
- de_const(CURform(), CURfield(), FM_VALUE);
- redo_vals(CURfield());
- fm_vislist(CURforminfo());
- form_ctl(Cur_rec->id, CTSETDIRTY);
- t = TOK_NOP;
- break;
- }
- case TOK_DONE:
- t = TOK_BADCHAR;
- if (fld_get_ck(&form_field) != SUCCESS)
- t = TOK_NOP;
- else if ((fnum = chk_form()) >= 0) {
- int page;
-
- /*
- * fnum is the actual (rather than the virtual)
- * field num
- */
- page = atoi(multi_eval(CURform(), fnum, FM_PAGE));
- if (page != CURpage()) {
- /*
- * make the new page visible
- */
- CURpage() = page;
- fm_vislist(CURforminfo());
- form_ctl(Cur_rec->id, CTSETPAGE, TRUE, CURpage(), LASTpage());
- }
- chg_curfield(virt(fnum));
- t = TOK_NOP;
- }
- else if (str = sing_eval(CURform(), FM_DONE))
- t = make_action(str);
- else {
- warn(VALID, "");
- mess_lock();
- }
- break;
- case TOK_UP:
- nextflags |= NX_ADVANCE;
- /* fall through */
- case TOK_PREVIOUS:
- case TOK_BTAB: /* added backtab mapping. abs k16 */
- nextflags |= NX_NOCUR;
- if (fld_get_ck(&form_field) == SUCCESS)
- nextfield(atoi(multi_eval(CURform(), CURfield(), FM_FROW)),
- atoi(multi_eval(CURform(), CURfield(), FM_FCOL)),
- -1, nextflags);
- else
- set_form_field(Cur_rec->id, CURfield());
- t = TOK_NOP;
- break;
- case TOK_DOWN:
- nextflags |= NX_ADVANCE;
- /* fall through */
- case TOK_TIME:
- case TOK_SAVE:
- case TOK_NEXT:
- nextflags |= NX_NOCUR;
- if (fld_get_ck(&form_field) == SUCCESS)
- nextfield(atoi(multi_eval(CURform(), CURfield(), FM_FROW)),
- atoi(multi_eval(CURform(), CURfield(), FM_FCOL)),
- 1, nextflags);
- else
- set_form_field(Cur_rec->id, CURfield());
- t = TOK_NOP;
- break;
- case TOK_PPAGE:
- if (fld_get_ck(&form_field) == SUCCESS)
- { /* find the prev page with visible fields. abs k17 */
- int oldpage = CURpage(); /* abs k17 */
-
- if (CURpage() == 1) /* abs k17 */
- {
- set_form_field(Cur_rec->id, CURfield());
- t = TOK_BADCHAR;
- break;
- }
- else
- {
- while (CURpage() != 1) /* abs k17 */
- { /* abs k17 */
- CURpage()--;
- fm_vislist(CURforminfo());
- if ((int)NUMvis() > 0) /* abs k17 */
- { /* abs k17 */
- f_error = FALSE; /* abs k17 */
- break; /* abs k17 */
- } /* abs k17 */
- else /* abs k17 */
- f_error = TRUE; /* abs k17 */
- } /* abs k17 */
-
- if (!f_error) /* abs k17 */
- f_error = form_ctl(Cur_rec->id, CTSETPAGE, TRUE,
- CURpage(), LASTpage());
- if (f_error) /* bad page .. go back to old one */
- {
- CURpage() = oldpage; /* abs k17 */
- fm_vislist(CURforminfo());
- f_error = form_ctl(Cur_rec->id, CTSETPAGE, TRUE,
- CURpage(), LASTpage());
- mess_temp("Cannot display the previous page: page may be too large");
- mess_lock();
- }
- else
- nextfield(0, 0, 1, NX_ANY);
- }
- }
- else
- set_form_field(Cur_rec->id, CURfield());
- t = TOK_NOP;
- break;
- case TOK_NPAGE:
- if (fld_get_ck(&form_field) == SUCCESS)
- { /* find the next page with visible fields. abs k17 */
- int oldpage = CURpage(); /* abs k17 */
-
- if (CURpage() == LASTpage()) /* abs k17 */
- {
- set_form_field(Cur_rec->id, CURfield());
- t = TOK_BADCHAR;
- break;
- }
- else
- {
- while (CURpage() != LASTpage() ) /* abs k17 */
- { /* abs k17 */
- CURpage()++;
- fm_vislist(CURforminfo());
- if ((int)NUMvis() > 0) /* abs k17 */
- { /* abs k17 */
- f_error = FALSE; /* abs k17 */
- break; /* abs k17 */
- } /* abs k17 */
- else /* abs k17 */
- f_error = TRUE; /* abs k17 */
- } /* abs k17 */
-
- if (!f_error) /* abs k17 */
- f_error = form_ctl(Cur_rec->id, CTSETPAGE, TRUE,
- CURpage(), LASTpage());
- if (f_error) /* bad page .. go back to old one */
- {
- CURpage() = oldpage; /* abs k17 */
- fm_vislist(CURforminfo());
- f_error = form_ctl(Cur_rec->id, CTSETPAGE, TRUE,
- CURpage(), LASTpage());
- mess_temp("Cannot display the next page: page may be too large");
- mess_lock();
- }
- else
- nextfield(0, 0, 1, NX_ANY);
- }
- }
- else
- set_form_field(Cur_rec->id, CURfield());
- t = TOK_NOP;
- break;
- }
- return(t);
-}
-
-/*
-** Processes characters before the editor.
-*/
-int
-pre_stream(t)
-register token t;
-{
- formfield form_field;
-
- /* les */
-/* if ( isprint(t)) ** only looks at 8 bits. abs k17 */
- if ( t > 037 && t < 0177 )
- return t;
- /*******/
-
- form_field = CURffield();
- switch(t) {
- case TOK_END:
- nextfield(1000, 1000, -1, NX_ANY);
- t = TOK_NOP;
- break;
- case TOK_BEG:
- nextfield(0, 0, 1, NX_ANY);
- t = TOK_NOP;
- break;
- case TOK_BTAB:
- if (fld_get_ck(&form_field) == SUCCESS)
- nextfield(atoi(multi_eval(CURform(), CURfield(), FM_FROW)),
- atoi(multi_eval(CURform(), CURfield(), FM_FCOL)),
- -1, NX_NOCUR | NX_ADVANCE);
- else
- set_form_field(Cur_rec->id, CURfield());
- t = TOK_NOP;
- break;
- case TOK_TAB:
- t = TOK_SAVE;
- case TOK_WDWMGMT:
- break;
- }
- return(t);
-}
-
-/*
-** Sets up the stream for forms.
-*/
-static int
-objform_stream(a, t)
-struct actrec *a;
-token t;
-{
- int (*func[5])();
- register int olifetime;
- extern int field_stream();
-
- Cur_rec = a;
- olifetime = Cur_rec->lifetime;
- Cur_rec->lifetime = AR_PERMANENT;
- func[0] = pre_stream;
- func[1] = field_stream;
- func[2] = (int (*)())post_stream; /* added cast abs */
- func[3] = NULL;
- t = stream(t, func);
- Cur_rec->lifetime = olifetime;
- return(t);
-}
-
-int
-set_form_field(id, field_num)
-int id, field_num;
-{
- char *str;
- char *lininfo;
- char buf[BUFSIZ];
- struct attribute *attr;
-
- /*
- * mark the attribute as touched (visited) ...
- */
- if (multi_eval(CURform(), field_num, FM_MENUO))
- attr = CURattr(field_num, FM_MENUO);
- else
- attr = CURattr(field_num, FM_VALID);
- if (attr)
- attr->flags |= ATTR_TOUCHED;
-
- /*
- * set "LININFO" variable to the value of the "lininfo"
- * descriptor for field_num
- */
- lininfo = multi_eval(CURform(), field_num, FM_LININFO);
- if (strlen(lininfo)) {
- sprintf(buf, "LININFO=%s", lininfo);
- putAltenv(buf);
- }
- else
- delAltenv("LININFO");
-
- /*
- * display on the message line the "fieldmsg" for field_num
- */
- if ((str = multi_eval(CURform(), field_num, FM_FIELDMSG)) && *str)
- mess_temp(str);
- form_ctl(id, CTSETPOS, virt(field_num), 0, 0);
- return (0);
-}
diff --git a/usr/src/cmd/fmli/oh/if_help.c b/usr/src/cmd/fmli/oh/if_help.c
deleted file mode 100644
index df5fdd265a..0000000000
--- a/usr/src/cmd/fmli/oh/if_help.c
+++ /dev/null
@@ -1,694 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-
-/*
- * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-/* Copyright (c) 1984, 1985, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-#include <stdio.h>
-#include <string.h>
-#include <curses.h>
-#include <sys/types.h> /* EFT abs k16 */
-#include "wish.h"
-#include "vtdefs.h"
-#include "ctl.h"
-#include "token.h"
-#include "winp.h"
-#include "form.h"
-#include "slk.h"
-#include "actrec.h"
-#include "typetab.h"
-#include "fm_mn_par.h"
-#include "objhelp.h"
-#include "var_arrays.h"
-#include "terror.h"
-#include "moremacros.h"
-#include "interrupt.h"
-#include "vt.h" /* abs for headers */
-#include "sizes.h"
-#include "message.h"
-
-#define HL_INTR PAR_INTR
-#define HL_ONINTR PAR_ONINTR
-#define HL_DONE PAR_DONE
-#define HL_TITLE 3
-#define HL_TEXT 4
-#define HL_WRAP 5
-#define HL_EDIT 6
-#define HL_INIT 7
-#define HL_LIFE 8
-#define HL_ROWS 9
-#define HL_COLUMNS 10
-#define HL_BEGROW 11
-#define HL_BEGCOL 12
-#define HL_HELP 13
-#define HL_REREAD 14
-#define HL_CLOSE 15
-#define HL_ALTSLKS 16
-#define HL_FRMMSG 17
-#define HL_HEADER 18 /* abs */
-
-/* defined above
-#define HL_INTR PAR_INTR
-#define HL_ONINTR PAR_ONINTR
-*/
-#define HL_ACTI PAR_ACTION
-#define HL_NAME PAR_NAME
-#define HL_BUTT 4
-#define HL_SHOW 5
-
-#define HL_KEYS 19
-static struct attribute Hl_tab[HL_KEYS] = {
- { "interrupt", RET_STR|EVAL_ALWAYS, NULL, NULL, 0 },
- { "oninterrupt",RET_STR|EVAL_ALWAYS, NULL, NULL, 0 },
- { "done", RET_ARGS|EVAL_ALWAYS, "", NULL, 0 }, /* abs */
- { "title", RET_STR|EVAL_ONCE, "Text", NULL, 0 },
- { "text", RET_STR|EVAL_ONCE, NULL, NULL, 0 },
- { "wrap", RET_BOOL|EVAL_ONCE, "", NULL, 0 },
- { "edit", RET_BOOL|EVAL_ONCE, NULL, NULL, 0 },
- { "init", RET_BOOL|EVAL_ALWAYS, "", NULL, 0 },
- { "lifetime", RET_STR|EVAL_ALWAYS, "longterm", NULL, 0 },
- { "rows", RET_INT|EVAL_ONCE, "10", NULL, 0 },
- { "columns", RET_INT|EVAL_ONCE, "30", NULL, 0 },
- { "begrow", RET_STR|EVAL_ONCE, "any", NULL, 0 },
- { "begcol", RET_STR|EVAL_ONCE, "any", NULL, 0 },
- { "help", RET_ARGS|EVAL_ALWAYS, NULL, NULL, 0 },
- { "reread", RET_BOOL|EVAL_ALWAYS, NULL, NULL, 0 },
- { "close", RET_BOOL|EVAL_ONCE, NULL, NULL, 0 },
- { "altslks", RET_BOOL|EVAL_ONCE, NULL, NULL, 0 },
- { "framemsg", RET_STR|EVAL_ONCE, "", NULL, 0 },
- { "header", RET_STR|EVAL_ONCE, NULL, NULL, 0 } /* abs */
-};
-
-#define HL_FLD_KEYS 6
-static struct attribute Hl_fld_tab[HL_FLD_KEYS] = {
- { "interrupt", RET_STR|EVAL_ALWAYS, NULL, NULL, 0 },
- { "oninterrupt",RET_STR|EVAL_ALWAYS, NULL, NULL, 0 },
- { "action", RET_ARGS|EVAL_ALWAYS ,NULL, NULL, 0 },
- { "name", RET_STR|EVAL_ONCE, NULL, NULL, 0 },
- { "button", RET_INT|EVAL_ONCE, "0", NULL, 0 },
- { "show", RET_BOOL|EVAL_SOMETIMES,"", NULL, 0 }
-};
-
-#define CURhelp() (&(((helpinfo *) Cur_rec->odptr)->fm_mn))
-#define CURhelpinfo() ((helpinfo *) Cur_rec->odptr)
-#define ARGS() (((helpinfo *) Cur_rec->odptr)->args)
-#define PTRS() (((helpinfo *) Cur_rec->odptr)->holdptrs)
-
-extern int Vflag; /* abs k15 */
-extern char *strnsave();
-extern char *shrink_str();
-static struct actrec *Cur_rec;
-static struct fm_mn parse_help();
-static int objhelp_reread();
-static int objhelp_noncur();
-
-static token bighelp_stream();
-
-/*
-** Returns a token so that the help object can be brought up.
-*/
-static token
-objhelp_help(a)
-struct actrec *a;
-{
- return(setaction(sing_eval(CURhelp(), HL_HELP)));
-}
-
-/*
-** Frees up the structures and calls the close function.
-*/
-static int
-objhelp_close(a)
-struct actrec *a;
-{
- register int i, lcv;
- char *p, *strchr();
-
- Cur_rec = a;
- copyAltenv(ARGS()); /* in case HL_CLOSE references $ARGs abs k14*/
- form_close(a->id); /* free the form FIRST */
- sing_eval(CURhelp(), HL_CLOSE);
- objhelp_noncur(a, FALSE); /* remove ARGs from Altenv */
-
- /*
- * free information IN the helpinfo structure
- */
- freeitup(CURhelp()); /* the text parse table */
- if (PTRS()) /* holdptrs array */
- free(PTRS());
- lcv = array_len(ARGS()); /* the object specific variable */
- for (i = 0; i < lcv; i++) { /* (e.g., $TEXT) */
- char namebuf[BUFSIZ];
-
- if (p = strchr(ARGS()[i], '='))
- *p = '\0';
- strncpy(namebuf, ARGS()[i], BUFSIZ);
- namebuf[BUFSIZ-1] = '\0';
- if (p)
- *p = '=';
- delaltenv(&ARGS(), namebuf);
- delAltenv(namebuf);
- }
- array_destroy(ARGS()); /* the object variable array */
-
- /*
- * Free information in the activation record structure
- */
- free(a->odptr); /* the helpinfo structure itself */
- free(a->slks); /* the object specific SLKS */
- free(a->path); /* the definition file path */
-
- return(SUCCESS);
-}
-
-/*
-** Checks to see whether to reread and if so, calls reread.
-*/
-static int
-objhelp_reinit(a)
-struct actrec *a;
-{
- Cur_rec = a;
- if (sing_eval(CURhelp(), HL_REREAD))
- return(objhelp_reread(a));
- return(SUCCESS);
-}
-
-/*
-** Front-end to parser(), which sets up defaults.
-*/
-static struct fm_mn
-parse_help(flags, info_or_file, fp)
-int flags;
-char *info_or_file;
-FILE *fp;
-{
- struct fm_mn fm_mn;
-
- fm_mn.single.attrs = NULL;
- fm_mn.multi = NULL;
- filldef(&fm_mn.single, Hl_tab, HL_KEYS);
- parser(flags, info_or_file, Hl_tab, HL_KEYS, &fm_mn.single,
- Hl_fld_tab, HL_FLD_KEYS, &fm_mn.multi, fp);
- return(fm_mn);
-}
-
-/*
-** Frees contents of old help, and sets new one. Note: odptr
-** is set either way since freeitup will not free anything if
-** the single array is empty
-*/
-static int
-objhelp_reread(a)
-register struct actrec *a;
-{
- extern struct slk Defslk[MAX_SLK + 1];
- extern struct slk Textslk[];
- register int i;
- register struct fm_mn *fm_mn;
- register helpinfo *hi;
- char *label, *intr, *onintr, *get_def();
- int lcv, but;
- FILE *fp = NULL;
-
- Cur_rec = a;
- fm_mn = CURhelp();
- hi = CURhelpinfo();
-
- /* make sure file exists and is readable (if there is a file)
- * The "flags" say if a->path is the information
- * itself or the file of where the information sits. abs k15
- */
- if (!(hi->flags & INLINE))
- if ((fp = fopen(a->path, "r")) == NULL)
- {
- if (a->id >= 0) /* if frame is already posted */
- warn(NOT_UPDATED, a->path);
- else
- warn(FRAME_NOPEN, a->path);
- return(FAIL);
- }
- if (a->id >= 0)
- freeitup(fm_mn);
- hi->fm_mn = parse_help(hi->flags, a->path, fp); /* abs k14.0 */
- if (fm_mn->single.attrs == NULL) {
- /*
- * very strange indeed ...
- *
- if (a->id < 0)
- sing_eval(fm_mn, HL_CLOSE);
- */
- return(FAIL);
- }
- if (PTRS())
- free(PTRS());
- lcv = sing_eval(fm_mn, HL_HEADER) ? 2:1;
- if ((PTRS() = (char **) calloc(lcv, sizeof(char *))) == NULL)
- fatal(NOMEM, nil);
- for (i = 0; i < lcv; i++)
- PTRS()[i] = (char *) NULL;
- fm_mn->seqno = 1;
- hl_vislist(hi);
-
- /*
- * If "init=false" then clean-up
- */
- if (!sing_eval(CURhelp(), HL_INIT))
- {
- if (a->id >= 0) /* form is already posted */
- {
- if (a->lifetime == AR_INITIAL)
- {
- mess_temp("can't close this frame");
- mess_lock();
- }
- else
- {
- ar_close(a, FALSE);
- return(FAIL);
- }
- }
- else
- {
- sing_eval(CURhelp(),HL_CLOSE);
- objhelp_noncur(a, TRUE); /* remove ARGs from Altenv */
- freeitup(CURhelp());
- return(FAIL);
- }
- }
- /*
- * update the interrupt descriptors in the activation rec
- */
- ar_ctl(Cur_rec, CTSETINTR, get_sing_def(CURhelp(), HL_INTR), NULL, NULL, NULL, NULL, NULL);
- ar_ctl(Cur_rec, CTSETONINTR, get_sing_def(CURhelp(), HL_ONINTR), NULL, NULL, NULL, NULL, NULL);
-
- /*
- * Set up object's SLK array
- */
- set_top_slks(Textslk);
- memcpy((char *)a->slks, (char *)Defslk, sizeof(Defslk));
- lcv = array_len(hi->slks);
- for (i = 0; i < lcv; i++) {
- but = atoi(multi_eval(fm_mn, hi->slks[i], HL_BUTT)) - 1;
- if (but < 0 || but >= MAX_SLK) /* abs */
- continue;
- label = multi_eval(fm_mn, hi->slks[i], HL_NAME);
- intr = get_def(CURhelp(),hi->slks[i], HL_INTR);
- onintr = get_def(CURhelp(),hi->slks[i], HL_ONINTR);
- set_obj_slk(&(a->slks[but]), label, TOK_SLK1 + but, intr, onintr);
- }
- if (a->id >= 0)
- form_ctl(a->id, CTSETDIRTY);
- (void) ar_ctl(Cur_rec, CTSETMSG, FALSE, NULL, NULL, NULL, NULL, NULL); /* was AR_cur. abs k15 */
- return(SUCCESS);
-}
-
-/*
-** Takes this object's information out of the major altenv.
-*/
-static int
-objhelp_noncur(a, all)
-struct actrec *a;
-bool all;
-{
- register int i;
- register char *p;
- int lcv;
-
- Cur_rec = a;
- lcv = array_len(ARGS());
- for (i = 0; i < lcv; i++) {
- char namebuf[BUFSIZ];
-
- if (p = strchr(ARGS()[i], '='))
- *p = '\0';
- strncpy(namebuf, ARGS()[i], BUFSIZ);
- namebuf[BUFSIZ - 1] = '\0';
- if (p)
- *p = '=';
- delAltenv(namebuf);
- }
- if (all)
- return(form_noncurrent(a->id));
- else
- return(SUCCESS);
-}
-
-/*
-** Puts this object's altenv() into the major altenv().
-*/
-static int
-objhelp_current(a)
-struct actrec *a;
-{
- int ret;
-
- Cur_rec = a;
- copyAltenv(ARGS());
- ret = form_current(a->id);
- form_ctl(a->id, CTSETPOS, 1, 0, 0); /* `1' is "text=" field abs*/
- return(ret);
-}
-
-/*
-** Sets up SLK array, based on show functions.
-*/
-int
-hl_vislist(hi)
-helpinfo *hi;
-{
- int i;
- struct fm_mn *ptr;
- int lcv;
-
- ptr = &(hi->fm_mn);
- if (!hi->slks)
- hi->slks = (int *) array_create(sizeof(int), array_len(ptr->multi));
- else
- array_trunc(hi->slks);
-
- lcv = array_len(ptr->multi);
- for (i = 0; i < lcv; i++)
- if (multi_eval(ptr, i, HL_SHOW))
- hi->slks = (int *) array_append(hi->slks, (char *) &i);
- return (0);
-}
-#define MIN_ROWS_TEXT 4 /* includes 2 rows of margin along frame border */
-
-/* Size a text header by counting the newlines */
-int
-header_size(m)
-formfield m;
-{
- register char *c;
- register int linefeeds;
- register struct vt *v;
- int rows, cols;
-
- if (*m.value == 0) /* null string */
- return(0);
-
- for (linefeeds = 1, c = m.value; *c != NULL; c++)
- if (*c == '\n')
- linefeeds++;
-
- /* leave at least MIN_ROWS_TEXT rows for text */
- v = &VT_array[VT_curid];
- getmaxyx(v->win, rows, cols);
- return(linefeeds > rows - MIN_ROWS_TEXT) ? rows - MIN_ROWS_TEXT : linefeeds;
-
-}
-
-
-/*
-** Gives header and text as only fields, fields that have no names.
-*/
-static formfield
-objhelp_disp(n, hi)
-int n;
-helpinfo *hi;
-{
- struct fm_mn *ptr;
- char *readfile();
- formfield m;
- static int header_rows;
-
- ptr = &(hi->fm_mn);
- switch (n)
- {
- case 0: /* non-scrolling header field. abs8/88 */
- m.name = strsave("");
- m.value = sing_eval(ptr, HL_HEADER);
- m.frow = 0;
- m.fcol = 0;
- m.nrow = VT_UNDEFINED;
- m.ncol = VT_UNDEFINED;
- m.rows = header_rows = header_size(m);
- m.cols = atoi(sing_eval(CURhelp(), HL_COLUMNS));
- m.flags = I_FANCY | I_NOEDIT | I_TEXT;
- m.ptr = PTRS();
- break;
- case 1: /* text field */
- m.name = strsave("");
- m.value = sing_eval(ptr, HL_TEXT);
- m.frow = header_rows; /* header has rows 0 -> header_rows - 1 */
- m.fcol = 0;
- m.nrow = VT_UNDEFINED;
- m.ncol = VT_UNDEFINED;
- m.rows = atoi(sing_eval(CURhelp(), HL_ROWS)) - header_rows;
- m.cols = atoi(sing_eval(CURhelp(), HL_COLUMNS));
- m.flags = I_FANCY|I_SCROLL|I_TEXT;
- if (header_rows == 0) /* curses optimization.. */
- m.flags |= I_FULLWIN; /* ..if no subwindows needed */
- if (!sing_eval(CURhelp(), HL_EDIT))
- m.flags |= I_NOEDIT;
- if (sing_eval(CURhelp(), HL_WRAP))
- m.flags |= I_WRAP;
- m.ptr = PTRS() + 1;
- break;
- default:
- m.name = NULL;
- }
- return(m);
-}
-
-
-/*
-** There are no args, so return FAIL. Otherwise, pass it on.
-*/
-int
-objhelp_ctl(rec, cmd, arg1, arg2, arg3, arg4, arg5, arg6)
-struct actrec *rec;
-int cmd;
-int arg1, arg2, arg3, arg4, arg5, arg6;
-{
- if (cmd == CTGETARG)
- return(FAIL);
- else if (cmd == CTSETMSG) {
- if (arg1 == TRUE) {
- /*
- * if arg1 == TRUE then the frame message was
- * generated "externally" (i.e., via the message
- * built-it). Update the "framemsg" descriptor
- * accordingly.
- */
- char *newmsg, *get_mess_frame();
-
- newmsg = get_mess_frame();
- set_single_default(CURhelp(), HL_FRMMSG, newmsg);
- }
- else
- mess_frame(sing_eval(CURhelp(), HL_FRMMSG));
- return(SUCCESS);
- }
- if (cmd == CTSETLIFE) {
- char *life;
-
- life = sing_eval((&(((helpinfo *) rec->odptr)->fm_mn)), HL_LIFE);
- setlifetime(rec, life);
- return(SUCCESS);
- }
- return(form_ctl(rec->id, cmd, arg1, arg2, arg3, arg4, arg5, arg6));
-}
-
-/*
-** Uses path_to_ar and nextpath_to_ar to see if it is a reopen. If
-** so, make it current. Otherwise, set up the actrec and call
-** ar_create.
-*/
-int
-IF_helpopen(args)
-register char **args;
-{
- register int i;
- int type, startrow, startcol;
- char *begrow, *begcol;
- struct actrec a, *first_rec, *ar_create(), *path_to_ar(), *nextpath_to_ar();
- int do_inline;
- struct fm_mn *fm_mn;
- extern struct slk Defslk[MAX_SLK + 1];
- extern char *filename();
- helpinfo *hi;
- char *life;
- char buf[BUFSIZ], envbuf[6];
- char *ptr;
-
- if (strCcmp(args[0], "-i") == 0)
- {
- do_inline = TRUE;
- Cur_rec = path_to_ar(args[1]);
- }
- else
- {
- do_inline = FALSE;
- Cur_rec = path_to_ar(args[0]);
- }
-
- for (first_rec = Cur_rec; Cur_rec; ) {
- char *env, *getaltenv();
-
- strcpy(envbuf, "ARG1");
- for (i = do_inline ? 2 : 1; (env = getaltenv(ARGS(), envbuf)) && args[i];
- envbuf[3]++, i++)
- if (strcmp(args[i], env))
- break;
- if (!args[i] && !env) {
- ar_current(Cur_rec, TRUE); /* abs k15 */
- return(SUCCESS);
- }
- Cur_rec = nextpath_to_ar(Cur_rec);
- if (Cur_rec == first_rec) /* circular list */
- break;
- }
- hi = (helpinfo *)new(helpinfo);
- hi->flags = do_inline ? INLINE : 0;
- hi->args = NULL;
- a.id = -1;
- a.odptr = (char *) hi;
- fm_mn = &(hi->fm_mn);
- fm_mn->single.attrs = NULL;
- if (do_inline)
- a.path = strsave(args[1]);
- else
- a.path = strsave(args[0]);
- if ((a.slks = (struct slk *) malloc(sizeof(Defslk))) == NULL)
- fatal(NOMEM, nil);
- a.fcntbl[AR_CLOSE] = objhelp_close;
- a.fcntbl[AR_REREAD] = objhelp_reread;
- a.fcntbl[AR_REINIT] = objhelp_reinit;
- a.fcntbl[AR_CURRENT] = objhelp_current;
- a.fcntbl[AR_TEMP_CUR] = objhelp_current; /* abs k15. optimize later */
- a.fcntbl[AR_NONCUR] = objhelp_noncur;
- a.fcntbl[AR_ODSH] = (int (*)())bighelp_stream; /* added cast abs */
- a.fcntbl[AR_HELP] = (int (*)())objhelp_help; /* added cast abs */
- a.fcntbl[AR_CTL] = objhelp_ctl;
- Cur_rec = &a;
- setupenv(hi->flags, args, &ARGS());
- if (objhelp_reread(&a) == FAIL)
- return(FAIL);
- ptr = strnsave("TEXT=", strlen(life = sing_eval(fm_mn, HL_TEXT)) + 6);
- strcat(ptr, life);
- putaltenv(&ARGS(), ptr);
- putAltenv(ptr);
- free(ptr);
- begrow = sing_eval(fm_mn, HL_BEGROW);
- begcol = sing_eval(fm_mn, HL_BEGCOL);
- life = sing_eval(fm_mn, HL_LIFE);
- life_and_pos(&a, life, begrow, begcol, &startrow, &startcol, &type);
-
- if (Vflag) /* abs k15 */
- strcpy(buf, shrink_str(filename(sing_eval(fm_mn, HL_TITLE)), MAX_TITLE));
- else /* abs k15 */
- strcpy(buf, shrink_str(sing_eval(fm_mn, HL_TITLE), MAX_TITLE));
- a.id = form_default(buf, type, startrow, startcol,
- objhelp_disp, (char *)hi);
- if (a.id == FAIL)
- return(FAIL);
-
- if (sing_eval(fm_mn, HL_ALTSLKS))
- a.flags = AR_ALTSLKS;
- else
- a.flags = 0;
- return(ar_current(Cur_rec = ar_create(&a), FALSE)); /* abs k15 */
-}
-
-/*
-** Intercepts SLKs after the editor. Also, TOK_SAVE is an exit.
-*/
-token
-help_stream(tok)
-register token tok;
-{
- char *buf, *s;
- int *slks;
- int lcv;
-
-
- s = NULL;
- if (tok >= TOK_SLK1 && tok <= TOK_SLK16) {
- int num;
- int i;
-
- slks = CURhelpinfo()->slks;
- num = tok - TOK_SLK1 + 1;
- lcv = array_len(slks);
- for (i = 0; i < lcv; i++)
- if (atoi(multi_eval(CURhelp(), slks[i], HL_BUTT)) == num) {
- form_ctl(Cur_rec->id, CTGETARG, &s);
- if (sing_eval(CURhelp(), HL_EDIT))
- set_sing_cur(CURhelp(), HL_TEXT, strsave(s));
- buf = strnsave("TEXT=", strlen(s) + 6);
- strcat(buf, s);
- putaltenv(&ARGS(), buf);
- putAltenv(buf);
- tok = setaction(multi_eval(CURhelp(), slks[i], HL_ACTI));
- free(buf);
- break;
- }
- }
- if (tok == TOK_SAVE)
- tok = TOK_CLOSE;
- if (tok == TOK_CLOSE) {
- if (!s) {
- form_ctl(Cur_rec->id, CTGETARG, &s);
- buf = strnsave("TEXT=", strlen(s) + 6);
- strcat(buf, s);
- putaltenv(&ARGS(), buf);
- putAltenv(buf);
- free(buf);
- }
- /* tok = sing_eval(CURhelp(), HL_DONE) ? TOK_CLOSE : TOK_BADCHAR; abs */
- tok = make_action(sing_eval(CURhelp(), HL_DONE));
- }
- return(tok);
-}
-
-/*
-** Sets up stream and calls stream.
-*/
-static token
-bighelp_stream(a, t)
-struct actrec *a;
-register token t;
-{
- token (*func[3])();
- extern int field_stream();
- register int olifetime;
-
- Cur_rec = a;
- olifetime = Cur_rec->lifetime;
- Cur_rec->lifetime = AR_PERMANENT;
- func[0] = (token (*)())field_stream; /* added cast abs */
- func[1] = help_stream;
- func[2] = NULL;
- t = stream(t, func);
- Cur_rec->lifetime = olifetime;
- return(t);
-}
diff --git a/usr/src/cmd/fmli/oh/if_init.c b/usr/src/cmd/fmli/oh/if_init.c
deleted file mode 100644
index b98f48db5d..0000000000
--- a/usr/src/cmd/fmli/oh/if_init.c
+++ /dev/null
@@ -1,622 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License (the "License").
- * You may not use this file except in compliance with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-
-/*
- * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-/* Copyright (c) 1984, 1985, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-#include <stdio.h>
-#include <curses.h>
-#include <string.h>
-#include "wish.h"
-#include "fm_mn_par.h"
-#include "terror.h"
-#include "var_arrays.h"
-#include "vtdefs.h"
-#include "ctl.h"
-#include "attrs.h"
-#include "color_pair.h"
-#include "moremacros.h"
-#include "interrupt.h"
-#include "token.h"
-#include "slk.h"
-
-/* single instance desriptors in initialization file */
-#define INIT_SING_KEYS 28
-
-#define INIT_INTR PAR_INTR
-#define INIT_ONINTR PAR_ONINTR
-#define INIT_TITLE 2
-#define INIT_TEXT 3
-#define INIT_ROWS 4
-#define INIT_COLUMNS 5
-#define INIT_BANNER 6
-#define INIT_BANCOL 7
-#define INIT_WORKING 8
-#define COL_SCREEN 9
-#define COL_BANNER_TEXT 10
-#define COL_WINDOW_TEXT 11
-#define COL_ACTIVE_BORD 12
-#define COL_INACTIVE_BORD 13
-#define COL_ACTIVE_TITLE 14
-#define COL_ACTIVE_TITLE_BAR 15
-#define COL_INACTIVE_TITLE 16
-#define COL_INACTIVE_TITLE_BAR 17
-#define COL_BAR 18
-#define COL_BAR_TEXT 19
-#define COL_SLK_BAR 20
-#define COL_SLK_TEXT 21
-#define COL_FIELD_BAR 22
-#define COL_FIELD_TEXT 23
-#define INIT_TOGGLE 24
-#define INIT_NOBANG 25 /* abs */
-#define INIT_DOUBLEVARS 26
-#define INIT_PERMMSG 27
-
-/* Multi-instance descriptors for initialization file */
-#define INIT_MULT_KEYS 6
-
-#define SLK_INTR PAR_INTR
-#define SLK_ONINTR PAR_ONINTR
-#define SLK_ACTION PAR_ACTION
-#define SLK_NAME PAR_NAME
-#define SLK_SHOW 4
-#define SLK_BUTTON 5
-
-/* Single-instance descriptors for commands file */
-/*
- * there is none
- */
-#define CMD_SING_KEYS 0
-
-/* Multi-instance descriptors for commands file */
-#define CMD_MULT_KEYS 6
-
-#define CMD_INTR PAR_INTR
-#define CMD_ONINTR PAR_ONINTR
-#define CMD_ACTION PAR_ACTION
-#define CMD_NAME PAR_NAME
-#define CMD_SHOW 4
-#define CMD_HELP 5
-
-
-#define WORKINGMSG "Working"
-#define FOURFOUR "4-4"
-#define DEFTOGGLE 3
-
-static struct attribute Init_single_tab[INIT_SING_KEYS] = {
- { "interrupt", RET_STR|EVAL_ONCE, "false", "false", 0 },
- { "oninterrupt",RET_STR|EVAL_ONCE, DEF_ONINTR, DEF_ONINTR, 0 },
- { "title", RET_STR|EVAL_ONCE, "", NULL, 0 },
- { "text", RET_STR|EVAL_ONCE, "", NULL, 0 },
- { "rows", RET_STR|EVAL_ONCE, "10", NULL, 0 },
- { "columns", RET_STR|EVAL_ONCE, "50", NULL, 0 },
- { "banner", RET_STR|EVAL_ONCE, "", NULL, 0 },
- { "bancol", RET_INT|EVAL_ONCE, "", NULL, 0 },
- { "working", RET_STR|EVAL_ONCE, "Working", NULL, 0 },
- { "screen", RET_STR|EVAL_ONCE, "", NULL, 0 },
- { "banner_text", RET_STR|EVAL_ONCE, "", NULL, 0 },
- { "window_text", RET_STR|EVAL_ONCE, "", NULL, 0 },
- { "active_border", RET_STR|EVAL_ONCE, "", NULL, 0 },
- { "inactive_border", RET_STR|EVAL_ONCE, "", NULL, 0 },
- { "active_title_text", RET_STR|EVAL_ONCE, "", NULL, 0 },
- { "active_title_bar", RET_STR|EVAL_ONCE, "", NULL, 0 },
- { "inactive_title_text",RET_STR|EVAL_ONCE, "", NULL, 0 },
- { "inactive_title_bar", RET_STR|EVAL_ONCE, "", NULL, 0 },
- { "highlight_bar", RET_STR|EVAL_ONCE, "", NULL, 0 },
- { "highlight_bar_text", RET_STR|EVAL_ONCE, "", NULL, 0 },
- { "slk_bar", RET_STR|EVAL_ONCE, "", NULL, 0 },
- { "slk_text", RET_STR|EVAL_ONCE, "", NULL, 0 },
- { "field_bar", RET_STR|EVAL_ONCE, "", NULL, 0 },
- { "field_text", RET_STR|EVAL_ONCE, "", NULL, 0 },
- { "toggle", RET_STR|EVAL_ONCE, "3", NULL, 0 },
- { "nobang", RET_BOOL|EVAL_ONCE, FALSE, FALSE, 0 },
- { "use_incorrect_pre4.0_behavior",
- RET_BOOL|EVAL_ONCE, FALSE, FALSE, 0 },
- { "permanentmsg", RET_STR|EVAL_ONCE, "", FALSE, 0 }
-};
-
-/*
- * Table for SLKS and CMDS
- */
-static struct attribute Init_multi_tab[INIT_MULT_KEYS] = {
- { "interrupt", RET_STR|EVAL_ALWAYS, NULL, NULL, 0 },
- { "oninterrupt",RET_STR|EVAL_ALWAYS, NULL, NULL, 0 },
- { "action", RET_ARGS|EVAL_ALWAYS, NULL, NULL, 0 },
- { "name", RET_STR|EVAL_ALWAYS, NULL, NULL, 0 },
- { "show", RET_BOOL|EVAL_ALWAYS, "", NULL, 0 },
- { "button", RET_INT|EVAL_ALWAYS, "0", NULL, 0 }
-};
-
-
-static struct attribute Cmd_multi_tab[CMD_MULT_KEYS] = {
- { "interrupt", RET_STR|EVAL_ALWAYS, NULL, NULL, 0 },
- { "oninterrupt",RET_STR|EVAL_ALWAYS, NULL, NULL, 0 },
- { "action", RET_ARGS|EVAL_ALWAYS, NULL, NULL, 0 },
- { "name", RET_STR|EVAL_ALWAYS, NULL, NULL, 0 },
- { "show", RET_BOOL|EVAL_ALWAYS, "", NULL, 0 },
- { "help", RET_ARGS|EVAL_ALWAYS, NULL, NULL, 0 }
-};
-
-bool Doublevars = FALSE;
-/*
- * The variable "Doublevars" is set to TRUE/FALSE depending on the
- * true/false value of the descriptor "use_incorrect_pre4.0_behavior".
- * By default Doublevars = FALSE.
- *
- * If "Doublevars == TRUE" then the previously incorrect behavior of
- * "re-evaluating" an expanded environment variable will be
- * allowed (see eval_dollar() in eval.c for details).
- *
- * If "Doublevars == FALSE" then variables will be expanded as they
- * are in the UNIX shell. In addition, the new construct "$!" will be
- * recognized so as to facilitate the "old" behavior. The reason for
- * the new construct is that the "old" behavior of variable
- * "re-evaluation", though often damaging, is also quite useful.
- *
- * NOTE: The descriptor "use_incorrect_pre4.0_behavior" was only added
- * to avoid "blind-siding" those applications that depend on the "old"
- * behavior. Since it is expected that ALL applications conform to the
- * "new" behavior in the future, this descriptor will (most likely) be
- * ignored by FMLI in post 4.0 releases.
- */
-extern int Vflag;
-int Border_colors_differ; /* do active/inactive border colors differ? */
-
-/*
- * Introductory object attributes
- */
-static char *Intro_title;
-static char *Intro_text;
-static int Intro_rows;
-static int Intro_cols;
-static char *Banner = NULL;
-static char *Bancolstr;
-static char *Col_screen;
-static char *Col_banner_text;
-static char *Col_window_text;
-static char *Col_active_bord;
-static char *Col_inactive_bord;
-static char *Col_active_title;
-static char *Col_active_title_bar;
-static char *Col_inactive_title;
-static char *Col_inactive_title_bar;
-static char *Col_bar;
-static char *Col_bar_text;
-static char *Col_slk_bar;
-static char *Col_slk_text;
-static char *Col_field_bar;
-static char *Col_field_text;
-static char *Intr = NULL;
-static char *Onintr = NULL;
-/*
- * extern globals
- */
-char *Work_msg = NULL;
-int Work_col;
-int Mail_col;
-int Toggle = DEFTOGGLE;
-bool Nobang = FALSE; /* defaults to bang enabled */
-
-char *strnsave();
-static int settoggle();
-static struct fm_mn Inits;
-
-static char *set_default();
-static int center_it();
-
-/*
-** Front-end to parser(), which sets up defaults.
-*/
-int
-read_inits(initfile)
-char *initfile;
-{
- register int i, numslks;
- char *permmsg, *get_def();
- static int free_inits = FALSE;
- int sbutton;
- FILE *fp;
-
-/* if (access(initfile, 04) < 0)
-** return; abs k15 */
-
- /* make sure file exists and is readable abs k15 */
-
- if (initfile && ((fp = fopen(initfile, "r")) == NULL)) {
- mess_temp("error: initialization file missing or not readable");
- mess_flash("error: initialization file missing or not readable");
- doupdate();
- return (0);
- }
-
- if (free_inits == TRUE)
- freeitup(&Inits);
- else
- free_inits = TRUE;
-
- /*
- * Parse initialization file
- */
- Inits.single.attrs = NULL;
- Inits.multi = NULL;
- filldef(&Inits.single, Init_single_tab, INIT_SING_KEYS);
- if (initfile)
- parser(0, initfile, Init_single_tab, INIT_SING_KEYS,
- &Inits.single, Init_multi_tab, INIT_MULT_KEYS,
- &Inits.multi, fp);
-
- numslks = array_len(Inits.multi);
- for (i = 0; i < numslks; i++)
- {
- sbutton = atoi(multi_eval(&Inits, i, SLK_BUTTON)) - 1;
- if (multi_eval(&Inits, i, SLK_SHOW) &&
- sbutton >= 0 && sbutton < MAX_SLK) /* abs */
- {
- set_def_slk(sbutton,
- multi_eval(&Inits, i, SLK_NAME),
- get_def(&Inits, i, SLK_ACTION),
- get_def(&Inits, i, SLK_INTR),
- get_def(&Inits, i, SLK_ONINTR));
- }
- }
-
- /*
- * Introductory object info
- */
- Intro_title = set_default(INIT_TITLE);
- Intro_text = set_default(INIT_TEXT);
- Intro_rows = atoi(set_default(INIT_ROWS));
- Intro_cols = atoi(set_default(INIT_COLUMNS));
-
- /*
- * Session interrupt info
- */
- Intr = (char *)get_sing_def(&Inits, INIT_INTR);
- Onintr = (char *)get_sing_def(&Inits, INIT_ONINTR);
-
- /*
- * BANNER line info
- */
- Banner = set_default(INIT_BANNER);
- Bancolstr = set_default(INIT_BANCOL);
- Work_msg = set_default(INIT_WORKING);
-
- /*
- * COLOR specifications
- */
- if (Color_terminal == TRUE) {
- Col_screen = set_default(COL_SCREEN);
- Col_banner_text = set_default(COL_BANNER_TEXT);
- Col_window_text = set_default(COL_WINDOW_TEXT);
- Col_active_bord = set_default(COL_ACTIVE_BORD);
- Col_inactive_bord = set_default(COL_INACTIVE_BORD);
- Col_active_title = set_default(COL_ACTIVE_TITLE);
- Col_active_title_bar = set_default(COL_ACTIVE_TITLE_BAR);
- Col_inactive_title = set_default(COL_INACTIVE_TITLE);
- Col_inactive_title_bar = set_default(COL_INACTIVE_TITLE_BAR);
- Col_bar = set_default(COL_BAR);
- Col_bar_text = set_default(COL_BAR_TEXT);
- Col_slk_bar = set_default(COL_SLK_BAR);
- Col_slk_text = set_default(COL_SLK_TEXT);
- Col_field_bar = set_default(COL_FIELD_BAR);
- Col_field_text = set_default(COL_FIELD_TEXT);
- }
-
- /*
- * Miscallaneous global attributes
- */
- Toggle = settoggle(set_default(INIT_TOGGLE));
- set_default(INIT_NOBANG);
- Nobang = sing_eval(&Inits, INIT_NOBANG) ? TRUE: FALSE;
-
- set_default(INIT_DOUBLEVARS);
- if (sing_eval(&Inits, INIT_DOUBLEVARS))
- Doublevars = TRUE;
- else
- Doublevars = FALSE;
-
- permmsg = sing_eval(&Inits, INIT_PERMMSG);
- if (permmsg && permmsg[0] != '\0')
- mess_perm(permmsg);
-/* set_default(INIT_INTR);
- set_default(INIT_ONINTR);
-*/
- return (0);
-}
-
-/*
- * SET_DEFAULT determines the value of the appropriate descriptor
- * and makes it the new default in the Initialization table.
- */
-static char*
-set_default(index)
-int index;
-{
- char *tmp;
-
- tmp = sing_eval(&Inits, index);
- if (((tmp != 0) && (Init_single_tab[index].def != 0)) &&
- (strcmp(tmp, Init_single_tab[index].def) != 0))
- Init_single_tab[index].def = strsave(tmp);
- return(Init_single_tab[index].def);
-}
-
-int
-read_cmds(cmdfile)
-char *cmdfile;
-{
- struct fm_mn cmds;
- char *command, *action;
- register int i, numcmds;
- FILE* fp, *fopen();
- char *get_def();
-
-/* if (access(cmdfile, 04) < 0)
- * return (0);
- */
-
- /* make sure file exists and is readable abs k15 */
-
- if ((fp = fopen(cmdfile, "r")) == NULL)
- {
- mess_temp("error: commands file missing or not readable");
- mess_flash("error: commands file missing or not readable");
- doupdate();
- return (0);
- }
-
- /*
- * Parse commands file
- */
- cmds.single.attrs = NULL;
- cmds.multi = NULL;
- parser(0, cmdfile, NULL, 0, NULL, Cmd_multi_tab, CMD_MULT_KEYS,
- &cmds.multi, fp);
-
- numcmds = array_len(cmds.multi);
- for (i = 0; i < numcmds; i++) {
- if ((command = multi_eval(&cmds, i, CMD_NAME)) == NULL)
- continue;
- action = get_def(&cmds, i, CMD_ACTION);
- if (action && strCcmp(action, "nop") == 0) {
- del_cmd(command); /* delete from command table */
-/*
- * If one of the commands "unix" or "unix-system is disabled
- * the other one is disabled automatically.
-*/
- if (strCcmp(command, "unix-system") == 0)
- del_cmd("unix");
- else
- if (strCcmp(command, "unix") == 0)
- del_cmd("unix-system");
- }
- else
- add_cmd(command, action,
- get_def(&cmds, i, CMD_HELP),
- get_def(&cmds, i, CMD_INTR),
- get_def(&cmds, i, CMD_ONINTR));
- }
- return (0);
-}
-
-/*
- * SETTOGGLE will determine the number of choices that must be present
- * for a form field before a choices "menu" is generated.
- */
-static int
-settoggle(str)
-char *str;
-{
- int threshold;
-
- if (strCcmp(str, "always") == 0)
- threshold = BUFSIZ; /* large number */
- else if (strCcmp(str, "never") == 0)
- threshold = 0;
- else if ((threshold = atoi(str)) <= 0)
- threshold = DEFTOGGLE;
- return(threshold);
-}
-
-
-#define MAKEpair(x, y, z) setpair(x, getcolor_id(y), getcolor_id(z))
-#define COL_STRSIZE 40
-
-/*
- * SET_DEF_COLORS initializes the color attributes
- */
-int
-set_def_colors()
-{
- static int refresh_scr = TRUE;
-
- if (!Color_terminal)
- return (0);
- MAKEpair(WINDOW_PAIR, Col_window_text, Col_screen);
- MAKEpair(ACTIVE_TITLE_PAIR, Col_active_title, Col_active_title_bar);
- MAKEpair(INACTIVE_TITLE_PAIR, Col_inactive_title, Col_inactive_title_bar);
- MAKEpair(ACTIVE_BORD_PAIR, Col_active_bord, Col_screen);
- MAKEpair(INACTIVE_BORD_PAIR, Col_inactive_bord, Col_screen);
- MAKEpair(BAR_PAIR, Col_bar_text, Col_bar);
- MAKEpair(BANNER_PAIR, Col_banner_text, Col_screen);
- MAKEpair(SLK_PAIR, Col_slk_text, Col_slk_bar);
- MAKEpair(ACTIVE_SCROLL_PAIR, Col_screen, Col_active_bord);
- MAKEpair(INACTIVE_SCROLL_PAIR, Col_screen, Col_inactive_bord);
- if (MAKEpair(FIELD_PAIR, Col_field_text, Col_field_bar) == FALSE)
- MAKEpair(FIELD_PAIR, Col_screen, Col_window_text);
-
- set_slk_color(SLK_PAIR);
- set_scr_color(WINDOW_PAIR, refresh_scr);
- set_underline_attr(FIELD_PAIR);
- refresh_scr = FALSE;
- if (strcmp(Col_active_bord, Col_inactive_bord) == 0)
- Border_colors_differ = FALSE;
- else
- Border_colors_differ = TRUE;
- return (0);
-}
-
-/*
- * SET_DEF_STATUS initializes the status (banner) line
- */
-int
-set_def_status()
-{
- int r, c, bancol;
- vt_id oldvid, vt_current();
-
- vt_ctl(STATUS_WIN, CTGETSIZ, &r, &c);
- if (Vflag) {
- Mail_col = 0;
- showmail(TRUE);
- }
- if (!Work_msg)
- Work_msg = WORKINGMSG;
- Work_col = c - strlen(Work_msg);
- if (Banner) {
- if ((Bancolstr && *Bancolstr == '\0') ||
- (strCcmp(Bancolstr, "center") == 0))
- bancol = center_it(Banner);
- else
- bancol = atoi(Bancolstr);
- if (bancol < 0 || bancol > c)
- bancol = c;
- oldvid = vt_current(STATUS_WIN);
- vt_ctl(STATUS_WIN, CTSETATTR, Attr_normal, BANNER_PAIR);
- wclrwin();
- wgo(0, bancol);
- winprintf(Banner);
- vt_current(oldvid);
- }
- return (0);
-}
-
-/*
- * GET_DESC_VAL scans the filename for the "target" descriptor ...
- * Though the function is generic, its primary use is the "slk_layout"
- * descriptor in the Initialization file....
- * Unfortunately this descriptor has to be evaluated BEFORE curses
- * is ever initialized, therefore, it must be accounted for before the
- * Initialization file is parsed completely.
- */
-char *
-get_desc_val(filename, descname)
-char *filename;
-char *descname;
-{
- FILE *fp;
- int evalflags;
- char strbuf[BUFSIZ];
- static char *retstr = nil;
- char *ptr, *eval_string();
-
- if ((fp = fopen(filename, "r")) == NULL) {
- warn(NOPEN, filename);
- return(retstr);
- }
- while (fgets(strbuf, BUFSIZ, fp) != NULL) {
- if ((ptr = strchr(strbuf, '=')) != NULL) {
- *ptr = '\0';
- if (strCcmp(strbuf, descname) == 0) {
- evalflags = RET_STR;
- retstr = eval_string(++ptr, &evalflags);
- break;
- }
- }
- }
- return(retstr);
-}
-
-/*
- * COPYRIGHT puts up the initial text object which can be customized by
- * the application (e.g., FACE puts up a copyright notice)
- */
-vt_id
-copyright()
-{
- vt_id vid, vt_create();
- char *text;
-
- if ((Intro_text && (*Intro_text != '\0')) ||
- (Intro_title && (*Intro_title != '\0'))) {
- if ((vid = vt_create(Intro_title, VT_CENTER | VT_NONUMBER,
- -1, -1, Intro_rows, Intro_cols)) == FAIL)
- return((vt_id)NULL);
- text = Intro_text;
- }
- else
- return((vt_id)NULL);
- vt_current(vid);
- winputs(text, NULL);
- vt_flush();
- sleep(2);
- return(vid);
-}
-
-static int
-center_it(str)
-char *str;
-{
- int r, c;
- int datecol;
- int s;
-
- s = strlen(str);
- vt_ctl(STATUS_WIN, CTGETSIZ, &r, &c);
- if (s < c)
- datecol = (c - s) / 2;
- else
- datecol = 0;
- return(datecol);
-}
-
-/* init_ctl
- return value of initialization desriptors
- implemented as minimal routine for values currently needed.
- expand as needed if more complex situation need to be handled.
-*/
-char *
-init_ctl(cmd)
-unsigned int cmd;
-{
- switch(cmd)
- {
- case CTGETINTR:
- if (Intr == NULL)
- return("false"); /* default behavior */
- else
- return(Intr);
- break;
- case CTGETONINTR:
- if (Onintr == NULL)
- return(DEF_ONINTR);
- else
- return(Onintr);
- break;
- default:
- return((char *)FAIL);
- }
-}
diff --git a/usr/src/cmd/fmli/oh/if_menu.c b/usr/src/cmd/fmli/oh/if_menu.c
deleted file mode 100644
index dc059acc16..0000000000
--- a/usr/src/cmd/fmli/oh/if_menu.c
+++ /dev/null
@@ -1,816 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-
-/*
- * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-/* Copyright (c) 1984, 1985, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-#include <stdio.h>
-#include <string.h>
-#include <ctype.h>
-#include <sys/types.h> /* EFT abs k16 */
-#include "wish.h"
-#include "vtdefs.h"
-#include "ctl.h"
-#include "menudefs.h"
-#include "token.h"
-#include "slk.h"
-#include "actrec.h"
-#include "typetab.h"
-#include "fm_mn_par.h"
-#include "objmenu.h"
-#include "var_arrays.h"
-#include "terror.h"
-#include "moremacros.h"
-#include "interrupt.h"
-#include "sizes.h"
-#include "message.h"
-
-#define MN_INTR PAR_INTR
-#define MN_ONINTR PAR_ONINTR
-#define MN_DONE PAR_DONE
-#define MN_MENU 3
-#define MN_HELP 4
-#define MN_LIFE 5
-#define MN_INIT 6
-#define MN_BEGROW 7
-#define MN_BEGCOL 8
-#define MN_ROWS 9
-#define MN_COLUMNS 10
-#define MN_CLOSE 11
-#define MN_REREAD 12
-#define MN_MULTI 13
-#define MN_MSELECT 14
-#define MN_ALTSLKS 15
-#define MN_FRMMSG 16
-
-/* defined above
-#define MN_INTR PAR_INTR
-#define MN_ONINTR PAR_ONINTR
-abs */
-#define MN_ACTI PAR_ACTION
-#define MN_NAME PAR_NAME
-#define MN_DESC 4
-#define MN_BUTT 5
-#define MN_LININFO 6
-#define MN_SHOW 7
-#define MN_ARG 8
-#define MN_SELECTED 9
-#define MN_ITEMMSG 10
-#define MN_INACTIVE 11
-
-#define MN_KEYS 17
-static struct attribute Mn_tab[MN_KEYS] = {
- { "interrupt", RET_STR|EVAL_ALWAYS, NULL, NULL, 0 },
- { "oninterrupt",RET_STR|EVAL_ALWAYS, NULL, NULL, 0 },
- { "done", RET_ARGS|EVAL_ALWAYS, "", NULL, 0 },
- { "menu", RET_STR|EVAL_ONCE, "Menu", NULL, 0 },
- { "help", RET_ARGS|EVAL_ALWAYS, "", NULL, 0 },
- { "lifetime", RET_STR|EVAL_ALWAYS, "longterm", NULL, 0 },
- { "init", RET_BOOL|EVAL_ALWAYS, "", NULL, 0 },
- { "begrow", RET_STR|EVAL_ONCE, "any", NULL, 0 },
- { "begcol", RET_STR|EVAL_ONCE, "any", NULL, 0 },
- { "rows", RET_INT|EVAL_ONCE, "0", NULL, 0 },
- { "columns", RET_INT|EVAL_ONCE, "0", NULL, 0 },
- { "close", RET_BOOL|EVAL_ONCE, NULL, NULL, 0 },
- { "reread", RET_BOOL|EVAL_ALWAYS, NULL, NULL, 0 },
- { "multicolumn",RET_BOOL|EVAL_ONCE, "", NULL, 0 },
- { "multiselect",RET_BOOL|EVAL_ONCE, NULL, NULL, 0 },
- { "altslks", RET_BOOL|EVAL_ONCE, NULL, NULL, 0 },
- { "framemsg", RET_STR|EVAL_ONCE, "", NULL, 0 }
-};
-
-#define MN_FLD_KEYS 12
-static struct attribute Mn_fld_tab[MN_FLD_KEYS] = {
- { "interrupt", RET_STR|EVAL_ALWAYS, NULL, NULL, 0 },
- { "oninterrupt",RET_STR|EVAL_ALWAYS, NULL, NULL, 0 },
- { "action", RET_ARGS|EVAL_ALWAYS, "", NULL, 0 },
- { "name", RET_STR|EVAL_ONCE, NULL, NULL, 0 },
- { "description",RET_STR|EVAL_ONCE, NULL, NULL, 0 },
- { "button", RET_INT|EVAL_ONCE, "0", NULL, 0 },
- { "lininfo", RET_STR|EVAL_ALWAYS, NULL, NULL, 0 },
- { "show", RET_BOOL|EVAL_SOMETIMES,"", NULL, 0 },
- { "arg", RET_STR|EVAL_SOMETIMES, NULL, NULL, 0 },
- { "selected", MAKE_COPY|RET_BOOL|EVAL_SOMETIMES, NULL, NULL, 0 },
- { "itemmsg", RET_STR|EVAL_ALWAYS, NULL, NULL, 0 },
- { "inactive", RET_BOOL|EVAL_SOMETIMES, NULL, NULL, 0 }
-};
-
-#define CURmenu() (&(((menuinfo *) Cur_rec->odptr)->fm_mn))
-#define CURmenuinfo() ((menuinfo *) Cur_rec->odptr)
-#define NUMactive() (((menuinfo *) Cur_rec->odptr)->numactive)
-#define DEVirt(X) (((menuinfo *) Cur_rec->odptr)->visible[X])
-#define ARGS() (((menuinfo *) Cur_rec->odptr)->args)
-static struct menu_line objmenu_disp();
-static struct actrec *Cur_rec;
-static int objmenu_noncur();
-static int objmenu_reread();
-static struct fm_mn parse_menu();
-
-static token if_omsh();
-extern menu_id menu_make();
-
-/*
-** Calls setaction and returns the token.
-*/
-static token
-objmenu_help(rec)
-struct actrec *rec;
-{
- token make_action();
-
- Cur_rec = rec;
- return(setaction(sing_eval(CURmenu(), MN_HELP)));
-}
-
-/*
-** Calls close function and frees the structures.
-*/
-static int
-objmenu_close(a)
-struct actrec *a;
-{
- int lcv, i;
- char *p, *strchr();
-
- Cur_rec = a;
- copyAltenv(ARGS()); /* in case MN_CLOSE references $ARGs */
- sing_eval(CURmenu(), MN_CLOSE); /* execute the close function */
- freeitup(CURmenu()); /* free information IN the menuinfo structure */
- objmenu_noncur(a, FALSE); /* delete ARGs from the Altenv */
-
- lcv = array_len(ARGS()); /* delete ARGs from the menu data */
- for (i = 0; i < lcv; i++) {
- char namebuf[BUFSIZ];
-
- if (p = strchr(ARGS()[i], '='))
- *p = '\0';
- strcpy(namebuf, ARGS()[i]);
- if (p)
- *p = '=';
- delaltenv(&ARGS(), namebuf);
- }
-
- array_destroy(ARGS()); /* variable table */
- array_destroy(((menuinfo *)a->odptr)->slks); /* visible slks */
- array_destroy(((menuinfo *)a->odptr)->visible); /* visible items */
-
- /*
- * Free information in the activation record
- */
- free(a->odptr); /* free the menuinfo structure */
- free(a->slks); /* free the object specific SLKS */
- free(a->path); /* free path of the definition file */
-
- return(menu_close(a->id)); /* close the menu */
-}
-
-/*
- * Rereads if reread is set
- */
-static int
-objmenu_reinit(a)
-struct actrec *a;
-{
- Cur_rec = a;
- if (sing_eval(CURmenu(), MN_REREAD))
- return(objmenu_reread(a));
- return(SUCCESS);
-}
-
-/*
-** Front-end to parser(), it sets up defaults.
-*/
-static struct fm_mn
-parse_menu(flags, info_or_file, fp)
-int flags;
-char *info_or_file;
-FILE *fp;
-{
- struct fm_mn fm_mn;
-
- fm_mn.single.attrs = NULL;
- fm_mn.multi = NULL;
- filldef(&fm_mn.single, Mn_tab, MN_KEYS);
- parser(flags, info_or_file, Mn_tab, MN_KEYS, &fm_mn.single,
- Mn_fld_tab, MN_FLD_KEYS, &fm_mn.multi, fp);
- return(fm_mn);
-}
-
-/*
-** If a->id >= 0 this is a reread. If so it frees the old info.
-** Either way it calls the parser.
-*/
-static int
-objmenu_reread(a)
-register struct actrec *a;
-{
- struct fm_mn *fm_mn;
- extern struct slk Defslk[MAX_SLK + 1];
- extern struct slk Menuslk[];
- extern char * itoa();
- register int i, but;
- char buf[10];
- char *label, *intr, *onintr, *get_def();
- menuinfo *mi;
- int lcv;
- FILE *fp = NULL;
-
- Cur_rec = a;
- fm_mn = CURmenu();
- mi = CURmenuinfo();
-
- /* make sure file exists and is readable (if there is a file)
- * The "flags" say if a->path is the information
- * itself or the file of where the information sits. abs k15
- */
- if (!(mi->flags & INLINE))
- if ((fp = fopen(a->path, "r")) == NULL)
- {
- if (a->id >= 0) /* if frame is already posted */
- warn(NOT_UPDATED, a->path);
- else
- warn(FRAME_NOPEN, a->path);
- return(FAIL);
- }
- if (a->id >= 0)
- freeitup(CURmenu());
- mi->fm_mn = parse_menu(mi->flags, a->path, fp); /* abs k14.0 */
- if (fm_mn->single.attrs == NULL) {
- if (a->id >= 0)
- ar_close(a, FALSE);
- return(FAIL);
- }
- fm_mn->seqno = 1;
- mi->visible = NULL;
- mn_vislist(mi);
- strcpy(buf, "NR=");
- strncat(buf, itoa((long)array_len(mi->visible), 10), 6); /* abs k16 */
- putaltenv(&ARGS(), buf);
- putAltenv(buf);
- if (!sing_eval(CURmenu(), MN_INIT) || (int)array_len(mi->visible) <= 0 ||
- (NUMactive() <= 0))
- {
- if (a->id >= 0) /* form is already posted */
- {
- if (a->lifetime == AR_INITIAL)
- {
- mess_temp("can't close this frame");
- mess_lock();
- }
- else
- {
- ar_close(a, FALSE);
- return(FAIL);
- }
- }
- else
- {
- sing_eval(CURmenu(), MN_CLOSE);
- freeitup(CURmenu());
- objmenu_noncur(a, FALSE); /* clean up Altenv. abs k14 */
- return(FAIL);
- }
- }
- ar_ctl(a, CTSETINTR, get_sing_def(CURmenu(), MN_INTR), NULL, NULL, NULL, NULL, NULL);
- ar_ctl(a, CTSETONINTR, get_sing_def(CURmenu(), MN_ONINTR), NULL, NULL, NULL, NULL, NULL);
-
- set_top_slks(Menuslk);
- if (sing_eval(CURmenu(), MN_MSELECT))
- set_slk_mark(TRUE);
- else
- set_slk_mark(FALSE);
- memcpy((char *)a->slks, (char *)Defslk, sizeof(Defslk));
- lcv = array_len(mi->slks);
- for (i = 0; i < lcv; i++) {
- but = atoi(multi_eval(fm_mn, mi->slks[i], MN_BUTT)) - 1;
- if (but < 0 || but >= MAX_SLK) /* abs */
- continue;
- label = multi_eval(fm_mn, mi->slks[i], MN_NAME);
- intr = get_def(CURmenu(),mi->slks[i], MN_INTR);
- onintr = get_def(CURmenu(),mi->slks[i], MN_ONINTR);
- set_obj_slk(&(a->slks[but]), label, TOK_SLK1 + but, intr, onintr);
- }
- if (a->id >= 0) {
- objmenu_ctl(0, CTSETSTRT, a->id); /* go to 1st item. abs */
- a->id = menu_reinit(a->id, 0, atoi(sing_eval(CURmenu(), MN_ROWS)),
- atoi(sing_eval(CURmenu(), MN_COLUMNS)), objmenu_disp, a->odptr);
- }
- (void) ar_ctl(Cur_rec, CTSETMSG, FALSE, NULL, NULL, NULL, NULL, NULL); /* was AR_cur. abs k15 */
- return(SUCCESS);
-}
-
-/*
-** Takes this object's information out of the altenv.
-*/
-static int
-objmenu_noncur(a, all)
-struct actrec *a;
-bool all;
-{
- register int i;
- register char *p;
- int lcv;
-
- Cur_rec = a;
- lcv = array_len(ARGS());
- for (i = 0; i < lcv; i++) {
- char namebuf[BUFSIZ];
-
- if (p = strchr(ARGS()[i], '='))
- *p = '\0';
- strcpy(namebuf, ARGS()[i]);
- if (p)
- *p = '=';
- delAltenv(namebuf);
- }
- if (all)
- return(menu_noncurrent(a->id));
- else
- return(SUCCESS);
-}
-
-/*
-** Moves information in this object's altenv to the major altenv.
-*/
-static int
-objmenu_current(a)
-struct actrec *a;
-{
- int line;
- char *str;
-
- Cur_rec = a;
- copyAltenv(ARGS());
- menu_ctl(Cur_rec->id, CTGETPOS, &line);
- if ((str = multi_eval(CURmenu(), DEVirt(line), MN_ITEMMSG)) && *str)
- mess_temp(str);
- return(menu_current(a->id));
-}
-
-
-/*
-** get the right ARGS. abs k18
-*/
-static int
-objmenu_temp_cur(a)
-struct actrec *a;
-{
- Cur_rec = a;
- copyAltenv(ARGS());
- return(menu_current(a->id));
-}
-
-/*
-** Calculates the show functions to decide which menu lines and SLKs
-** should be shown.
-*/
-int
-mn_vislist(mi)
-menuinfo *mi;
-{
- int i;
- struct fm_mn *ptr;
- int lcv;
-
- ptr = &(mi->fm_mn);
- if (!mi->visible) {
- mi->slks = (int *) array_create(sizeof(int), array_len(ptr->multi));
- mi->visible = (int *) array_create(sizeof(int), array_len(ptr->multi));
- }
- else {
- array_trunc(mi->slks);
- array_trunc(mi->visible);
- }
-
- lcv = array_len(ptr->multi);
- NUMactive() = 0;
- for (i = 0; i < lcv; i++)
- if (multi_eval(ptr, i, MN_SHOW)) {
- if (atoi(multi_eval(ptr, i, MN_BUTT)))
- mi->slks = (int *) array_append(mi->slks, (char *) &i);
- else
- mi->visible = (int *) array_append(mi->visible, (char *) &i);
- /*
- * Keep track of number of active menu items
- */
- if (!multi_eval(ptr, i, MN_INACTIVE))
- NUMactive()++;
- }
- return (0);
-}
-
-/*
- * TOGGLE MARK will toggle the "mark" flag for a given menu
- * item indexed by i (Multiple Selection Menus).
- */
-int
-toggle_mark(ptr, i)
-struct fm_mn *ptr;
-int i;
-{
- struct attribute *att;
-
- att = (ptr->multi + i)->attrs[MN_SELECTED];
- att->flags ^= MENU_MARKED; /* toggle flag */
- return (0);
-}
-
-/*
- * ISMARKED will check for the "mark" flag
- */
-int
-ismarked(ptr, i)
-struct fm_mn *ptr;
-int i;
-{
- struct attribute *att;
-
- att = (ptr->multi + i)->attrs[MN_SELECTED];
- if (!att)
- return(0);
- if (sing_eval(ptr, MN_MSELECT) && !(att->flags & MENU_CHECKED) &&
- multi_eval(ptr, i, MN_SELECTED)) {
- toggle_mark(ptr, i);
- att->flags |= MENU_CHECKED;
- }
- return (att->flags & MENU_MARKED);
-}
-
-/*
-** Calculates NAME, FLAGS, and DESCRIPTION
-*/
-static struct menu_line
-objmenu_disp(n, mi)
-int n;
-menuinfo *mi;
-{
- register int i;
- struct fm_mn *ptr;
- struct menu_line m;
-
- if (n >= (int)array_len(mi->visible))
- m.highlight = m.description = NULL;
- else {
- i = mi->visible[n];
- ptr = &(mi->fm_mn);
- m.highlight = multi_eval(ptr, i, MN_NAME);
- m.lininfo = multi_eval(ptr, i, MN_LININFO);
- m.flags = 0;
- if (multi_eval(ptr, i, MN_INACTIVE))
- m.flags = MENU_INACT;
- if (ismarked(ptr, i)) {
- m.flags = MENU_MRK;
- if (multi_eval(ptr, i, MN_INACTIVE))
- m.flags = MENU_INACT|MENU_MRK;
- }
- m.description = multi_eval(ptr, i, MN_DESC);
- }
- return(m);
-}
-
-/*
-** Shrinks the string (if needed) to max_len characters.
-** Terminate the string with TRUNCATE_STR to show that it was
-** truncated.
-*/
-char *
-shrink_str(str, max_len)
-char *str;
-int max_len;
-{
- static char shrunk[MAX_WIDTH];
- int len;
-
- len = strlen(str);
- if (len <= max_len)
- {
- strncpy(shrunk, str, len);
- shrunk[len] = '\0';
- }
- else
- {
- strncpy(shrunk, str, max_len - LEN_TRUNC_STR);
- strcpy(shrunk + max_len - LEN_TRUNC_STR, TRUNCATE_STR);
- }
- return(shrunk);
-}
-
-
-
-int
-objmenu_ctl(rec, cmd, arg1, arg2, arg3, arg4, arg5, arg6)
-struct actrec *rec;
-int cmd;
-int arg1, arg2, arg3, arg4, arg5, arg6;
-{
- int pos;
-
- switch (cmd)
- {
- case CTGETARG:
- {
- char *str;
-
- Cur_rec = rec;
- if (menu_ctl(rec->id, CTGETPOS, &pos) == FAIL)
- return(FAIL);
- pos = DEVirt(pos);
- if ((str = multi_eval(CURmenu(), pos, MN_ARG)) && *str) /* abs k16 */
- {
- **((char ***)(&arg1)) = strsave(str);
- return(SUCCESS);
- }
- return(FAIL);
- }
- case CTSETMSG:
- {
- if (arg1 == TRUE) {
- /*
- * if arg1 == TRUE then the frame message was
- * generated "externally" (i.e., via the message
- * built-it). Update the "framemsg" descriptor
- * accordingly.
- */
- char *newmsg, *get_mess_frame();
-
- newmsg = get_mess_frame();
- set_single_default(CURmenu(), MN_FRMMSG, newmsg);
- }
- else
- mess_frame(sing_eval(CURmenu(), MN_FRMMSG));
- return(SUCCESS);
- }
- case CTSETLIFE:
- {
- char *life;
-
- /* used Cur_rec before. abs F15 */
- life = sing_eval((&(((menuinfo *) rec->odptr)->fm_mn)), MN_LIFE);
- setlifetime(rec, life);
- return(SUCCESS);
- }
- case CTSETSTRT:
- {
- char *str;
-
- menu_ctl(arg1, CTSETSTRT);
- if ((str = multi_eval(CURmenu(), DEVirt(0), MN_ITEMMSG)) && *str)
- mess_temp(str);
- return(SUCCESS);
- }
-/* not needed (yet) afterall. to add must make this routine return char *
- case CTGETDESCRIPTION:
- {
- menuinfo *mi = (menuinfo *)arg2;
- struct fm_mn *ptr = &(mi->fm_mn);
-
- if (arg1 >= array_len(mi->visible))
- return(NULL);
- else
- return(multi_eval(ptr, mi->visible[arg1], MN_DESC));
- }
-*/
- default:
- return(menu_ctl(rec->id, cmd, arg1, arg2, arg3, arg4, arg5, arg6));
- }
-}
-
-/*
-** Uses path_to_ar() and nextpath_to_ar() to see if it is a reopen
-** and if so, makes it current. Otherwise, it builds the actrec and
-** calls ar_create().
-*/
-int
-IF_omopen(args)
-register char **args;
-{
- register int i;
- int do_inline;
- struct actrec a, *first_rec, *ar_create(), *path_to_ar(), *nextpath_to_ar();
- struct fm_mn *fm_mn;
- extern struct slk Defslk[MAX_SLK + 1];
- menuinfo *mi;
- char *life;
- char envbuf[6];
- char *begcol, *begrow;
- int startrow, startcol, type;
-
- a.serial = 0;
- a.slks = (struct slk *)NULL;
- a.prevrec = (struct actrec *)NULL;
- a.nextrec = (struct actrec *)NULL;
- a.backup = (struct actrec *)NULL;
-
- if (strCcmp(args[0], "-i") == 0)
- {
- do_inline = TRUE;
- Cur_rec = path_to_ar(args[1]);
- }
- else
- {
- do_inline = FALSE;
- Cur_rec = path_to_ar(args[0]);
- }
- for (first_rec = Cur_rec; Cur_rec; ) {
- char *env, *getaltenv();
-
- strcpy(envbuf, "ARG1");
- for (i = do_inline ? 2 : 1;
- (env = getaltenv(ARGS(), envbuf)) && args[i];
- envbuf[3]++, i++)
- if (strcmp(args[i], env))
- break;
- if (!args[i] && !env) {
- ar_current(Cur_rec, TRUE); /* abs k15 */
- return(SUCCESS);
- }
- Cur_rec = nextpath_to_ar(Cur_rec);
- if (Cur_rec == first_rec) /* circular list */
- break;
- }
- mi = (menuinfo *)new(menuinfo);
- mi->flags = do_inline ? INLINE : 0;
- mi->args = NULL;
- a.odptr = (char *) mi;
- fm_mn = &(mi->fm_mn);
- fm_mn->single.attrs = NULL;
- if (do_inline)
- a.path = strsave(args[1]);
- else
- a.path = strsave(args[0]);
- if ((a.slks = (struct slk *) malloc(sizeof(Defslk))) == NULL)
- fatal(NOMEM, nil);
- a.id = -1;
- a.fcntbl[AR_CLOSE] = objmenu_close;
- a.fcntbl[AR_HELP] = (int (*)())objmenu_help; /* added cast abs 9/12/88 */
- a.fcntbl[AR_REREAD] = objmenu_reread;
- a.fcntbl[AR_REINIT] = objmenu_reinit;
- a.fcntbl[AR_CURRENT] = objmenu_current;
- a.fcntbl[AR_TEMP_CUR] = objmenu_temp_cur; /* abs k18 */
- a.fcntbl[AR_NONCUR] = objmenu_noncur;
- a.fcntbl[AR_ODSH] = (int (*)())if_omsh; /* added cast abs 9/12/88 */
- a.fcntbl[AR_CTL] = objmenu_ctl;
- Cur_rec = &a;
- setupenv(mi->flags, args, &ARGS());
- if (objmenu_reread(&a) == FAIL)
- return(FAIL);
- begrow = sing_eval(fm_mn, MN_BEGROW);
- begcol = sing_eval(fm_mn, MN_BEGCOL);
- life = sing_eval(CURmenu(), MN_LIFE);
- life_and_pos(&a, life, begrow, begcol, &startrow, &startcol, &type);
-
- /*
- * create the menu (menu frame)
- */
- a.id = menu_make(-1, shrink_str(sing_eval(fm_mn, MN_MENU), MAX_TITLE),
- type, startrow, startcol, atoi(sing_eval(fm_mn, MN_ROWS)),
- atoi(sing_eval(fm_mn, MN_COLUMNS)), objmenu_disp,
- (char *)mi);
-
- if (a.id == FAIL)
- return(FAIL);
- if (sing_eval(fm_mn, MN_ALTSLKS))
- a.flags = AR_ALTSLKS;
- else
- a.flags = 0;
- if (sing_eval(fm_mn, MN_MSELECT))
- menu_ctl(a.id, CTSETATTR); /* multi-select menu */
- return(ar_current(Cur_rec = ar_create(&a), FALSE)); /* abs k15 */
-}
-
-/*
-** Takes a line number and calls setaction on its ACTION.
-** (re-evaluate the lifetime descriptor before actually performing
-** the specifie action via "setaction")
-*/
-token
-linaction(n)
-int n;
-{
- return(setaction(multi_eval(CURmenu(), n, MN_ACTI)));
-}
-
-/*
-** Catches SLKs and processes them.
-*/
-token
-objmenu_stream(tok)
-register token tok;
-{
- int line;
- char *tmp, *str;
- char *ott_to_path();
- int *slks;
- extern int Arg_count;
- int lcv;
-
- if (tok == TOK_NEXT) {
- /* kludge for per-item message (menu_stream passes TOK_NEXT) */
- menu_ctl(Cur_rec->id, CTGETPOS, &line);
- if ((str = multi_eval(CURmenu(), DEVirt(line), MN_ITEMMSG)) && *str)
- mess_temp(str);
- return(TOK_NOP);
- }
- menu_ctl(Cur_rec->id, CTGETPOS, &line);
- tmp = multi_eval(CURmenu(), DEVirt(line), MN_LININFO);
- if (strlen(tmp)) {
- char buf[BUFSIZ];
-
- sprintf(buf, "LININFO=%s", tmp);
- putAltenv(buf);
- }
- else
- delAltenv("LININFO");
-
- if (tok >= TOK_SLK1 && tok <= TOK_SLK16) {
- int num;
- int i;
-
- slks = CURmenuinfo()->slks;
- num = tok - TOK_SLK1 + 1;
- lcv = array_len(slks);
- for (i = 0; i < lcv; i++) {
- if (atoi(multi_eval(CURmenu(), slks[i],MN_BUTT)) == num)
- tok = linaction(slks[i]);
- }
- }
- if (tok == TOK_MARK && sing_eval(CURmenu(), MN_MSELECT)) {
- /*
- * If this is a multiple selection menu then
- * mark the item (and update the menu)
- */
- toggle_mark(CURmenu(), DEVirt(line));
- menu_ctl(Cur_rec->id, CTSETPOS, DEVirt(line));
-
- /*
- * SELECTED is updated in the alternate
- * environment in case the "action" descriptor
- * contains a reference to $SELECTED
- */
- if (ismarked(CURmenu(), DEVirt(line)))
- putAltenv("SELECTED=true");
- else
- putAltenv("SELECTED=false");
- multi_eval(CURmenu(), DEVirt(line), MN_ACTI);
- tok = TOK_NOP;
- }
- else if (tok == TOK_OPEN && Arg_count < 2) {
- if (sing_eval(CURmenu(), MN_MSELECT))
- tok = setaction(sing_eval(CURmenu(), MN_DONE));
- else {
- menu_ctl(Cur_rec->id, CTGETPOS, &line);
- tok = linaction(DEVirt(line));
- }
- }
- return(tok);
-}
-
-/*
-** Calls menu_stream and objmenu_stream()
-*/
-static token
-if_omsh(a, t)
-struct actrec *a;
-register token t;
-{
- token (*func[3])();
- extern token menu_stream();
- register int olifetime;
-
- Cur_rec = a;
- olifetime = Cur_rec->lifetime;
- Cur_rec->lifetime = AR_PERMANENT;
- func[0] = menu_stream;
- func[1] = objmenu_stream;
- func[2] = NULL;
- t = stream(t, func);
- Cur_rec->lifetime = olifetime;
- return(t);
-}
diff --git a/usr/src/cmd/fmli/oh/ifuncs.c b/usr/src/cmd/fmli/oh/ifuncs.c
deleted file mode 100644
index 61af15b315..0000000000
--- a/usr/src/cmd/fmli/oh/ifuncs.c
+++ /dev/null
@@ -1,524 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/*
- * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-/* Copyright (c) 1984, 1985, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-#include <stdio.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include "wish.h"
-#include "but.h"
-#include "typetab.h"
-#include "ifuncdefs.h"
-#include "partabdefs.h"
-#include "obj.h"
-#include "optabdefs.h"
-#include "retcds.h"
-#include "windefs.h"
-#include "var_arrays.h"
-#include "terror.h"
-#include "token.h"
-#include "moremacros.h"
-#include "message.h"
-#include "sizes.h"
-
-struct ott_entry *name_to_ott();
-char Undel[] = "UNDELDIR";
-static char *Arg;
-struct ott_entry *Ott;
-extern char nil[];
-
-
-int (*Function[MAX_IFUNCS])();
-void docv();
-char *getepenv();
-static token confirmW();
-static token confirm();
-static int mv_or_cp();
-
-int
-IF_badfunc()
-{
- mess_temp("That operation is not available in FACE");
- return(FAIL);
-}
-
-int
-IF_sh()
-{
- return (0);
-}
-
-int
-IF_rn(argv)
-char *argv[];
-{
- char msg[MESSIZ];
- char oldname[DNAMESIZ];
- struct ott_entry *entry, *path_to_ott();
- char *bsd_path_to_title();
-
- if (path_isopen(argv[0], "rename", TRUE))
- return(FAIL);
- if (ckperms(parent(argv[0]), 02) == FAIL)
- return(FAIL);
- if ((entry = path_to_ott(argv[0])) == NULL)
- return(FAIL);
- strcpy(oldname, entry->name);
- if (ott_mv(entry, NULL, argv[1], TRUE) != FAIL) {
- sprintf(msg, "%s renamed to %s", bsd_path_to_title(oldname,(MESS_COLS - 12)/2), bsd_path_to_title(argv[1],(MESS_COLS - 12)/2));
- mess_temp(msg);
- return(SUCCESS);
- } else {
- sprintf(msg, "%s rename failed", bsd_path_to_title(oldname,MESS_COLS - 14));
- mess_temp(msg);
- return(FAIL);
- }
-}
-
-int
-IF_cp(argv)
-char *argv[];
-{
- return(mv_or_cp(FALSE, argv));
-}
-
-int
-IF_mv(argv)
-char *argv[];
-{
- return(mv_or_cp(TRUE, argv));
-}
-
-static int
-mv_or_cp(mv, argv)
-bool mv;
-char *argv[];
-{
- char msg[MESSIZ];
- char oldname[DNAMESIZ], newname[DNAMESIZ];
- char *display, path[PATHSIZ];
- struct ott_entry *entry, *path_to_ott();
- extern char *Wastebasket;
- char *filename();
- char *bsd_path_to_title();
- int plen;
-
- working(TRUE);
- if (mv && path_isopen(argv[0], mv ? "move" : "copy", TRUE))
- return(FAIL);
- if (mv && ckperms(parent(argv[0]), 02) == FAIL) {
- return(FAIL);
- }
- if (! mv && ckperms(argv[0], 04) == FAIL) {
- return(FAIL);
- }
- if (ckperms(argv[1], 02) == FAIL) {
- return(FAIL);
- }
- if ((entry = path_to_ott(argv[1])) == NULL)
- return(FAIL);
- if (!(entry->objmask & CL_DIR)) {
- sprintf(msg, "%s is not a proper destination for %s",
- bsd_path_to_title(argv[1], MESS_COLS-37), mv ? "move" : "copy");
- mess_temp(msg);
- return(FAIL);
- }
- if ((entry = path_to_ott(argv[0])) == NULL)
- return(FAIL);
- display = strsave(entry->display);
- strcpy(oldname, entry->name);
- if (argv[2] == NULL)
- strcpy(newname, entry->name);
- else
- strcpy(newname, filename(argv[2]));
- if (ott_mv(entry, argv[1], newname, mv) != FAIL) {
- sprintf(path, "%s/%s", argv[1], newname);
- if ((entry = path_to_ott(path)) == NULL)
- return(FAIL);
- entry->display = display;
- ott_chg_display(entry);
- if (strncmp(path, Wastebasket, strlen(Wastebasket)) == 0)
- (void) odi_putkey(entry, Undel, parent(argv[0]));
- else if (strncmp(argv[0], Wastebasket, strlen(Wastebasket)) == 0)
- (void) odi_putkey(entry, Undel, NULL);
- utime(path, NULL); /* Touch the file */
- ott_mtime(entry);
-
- if ( strcmp(oldname, newname) == 0 ) {
- sprintf(msg, "%s %sed to the ",
- bsd_path_to_title(oldname, (MESS_COLS-22)/2), mv ? "mov" : "copi");
- plen = strlen(msg);
- strcat(msg, bsd_path_to_title(argv[1],MESS_COLS - plen - 7));
- strcat(msg, " folder");
- } else {
- sprintf(msg, "%s %sed to the ",
- bsd_path_to_title(oldname, (MESS_COLS-33)/3), mv ? "mov" : "copi");
- plen = strlen(msg);
- strcat(msg, bsd_path_to_title(argv[1],MESS_COLS-plen-18-(MESS_COLS-33)/3));
- strcat(msg, " folder and named ");
- plen = strlen(msg);
- strcat(msg, bsd_path_to_title(newname,MESS_COLS - plen));
- }
-
- mess_temp(msg);
- return(SUCCESS);
- } else {
- sprintf(msg, "%s %s failed to the ",
- bsd_path_to_title(oldname,(MESS_COLS-27)/2),
- mv ? "move" : "copy");
- plen = strlen(msg);
- strcat(msg, bsd_path_to_title(argv[1],MESS_COLS - plen - 7));
- strcat(msg," folder");
- mess_temp(msg);
- return(FAIL);
- }
-}
-
-int
-IF_sc(argv)
-char *argv[];
-{
- if (scram(argv[0]) == FAIL)
- return(FAIL);
- return(SUCCESS);
-}
-
-int
-IF_unsc(argv)
-char *argv[];
-{
- if (unscram(argv[0]) == FAIL)
- return(FAIL);
- return(SUCCESS);
-}
-
-int
-IF_rm(argv)
-char *argv[];
-{
- struct ott_entry *ott;
- struct ott_entry *path_to_ott();
- struct ott_tab *paths_ott;
- struct ott_tab *ott_get();
- char buf[BUFSIZ], *filename(), *bsd_path_to_title();
- extern char *Filecabinet, *Wastebasket;
-
- Arg=strsave(argv[0]);
-
- if ((ott = path_to_ott(argv[0])) == NULL)
- return(FAIL);
-
- if (strcmp(argv[0], Filecabinet) == 0) {
- mess_temp("You are not allowed to delete your Filecabinet");
- return(FAIL);
- }
-
- if (strcmp(argv[0], Wastebasket) == 0) {
- if (path_isopen(argv[0], "delete", FALSE))
- return(FAIL);
- sprintf(buf, "Press ENTER to empty your %s:", filename(argv[0]));
- mess_temp("WARNING: You are about to permanently remove all objects in your WASTEBASKET");
- get_string(confirmW, buf, "", 0, FALSE, "delete", "delete");
- return(SUCCESS);
- }
-
- if (path_isopen(argv[0], "delete", TRUE)) {
- return(FAIL);
- }
-
-/*
- * The following if statement reads,
- * if the object we are deleting is a directory and
- * we can get an ott for it and
- * the directory is not empty.
- */
- if ((ott->objmask & CL_DIR) &&
- ((paths_ott = ott_get(argv[0], OTT_SALPHA, 0, 0, 0)) != NULL) &&
- array_len(paths_ott->parents))
- mess_temp("WARNING: The folder you are about to delete is not empty");
-
- sprintf(buf, "Press ENTER to delete %s:",
- bsd_path_to_title(filename(argv[0]), MESS_COLS - 23));
-
- if (strncmp(argv[0], Wastebasket, strlen(Wastebasket)) == 0) {
- Ott=ott;
- get_string(confirm, buf, "", 0, FALSE, "delete", "delete");
- return(SUCCESS);
- }
-
- get_string(confirm, buf, "", 0, FALSE, "delete", "delete");
- return(SUCCESS);
-}
-
-int
-blow_away(ott)
-struct ott_entry *ott;
-{
- char command[10*PATHSIZ + 30];
- struct ott_entry *ott_next_part();
- int len;
-
- len = sprintf(command, "/bin/rm -rf %s ", ott_to_path(ott));
- while (ott = ott_next_part(ott))
- len += sprintf(command+len, "%s ", ott_to_path(ott));
- (void) system(command);
- return (0);
-}
-
-int
-IF_unrm(argv)
-char *argv[];
-{
- struct ott_entry *ott, *path_to_ott();
- char *path, *odi_getkey();
- int strncmp(), strlen();
- extern char *Wastebasket;
-
- if ( strncmp(argv[0], Wastebasket, strlen(Wastebasket)) ||
- ! strcmp(argv[0], Wastebasket) ) {
- mess_temp("Undelete can only be used on objects in your WASTEBASKET");
- return(FAIL);
- }
- if ((ott = path_to_ott(argv[0])) == NULL)
- return(FAIL);
-
- if ( ! ((path = odi_getkey(ott, Undel)) && *path )) {
- mess_temp("Unable to find previous folder, use MOVE");
- return(FAIL);
- }
-
- return(objop("move", NULL, argv[0], path, NULL));
-}
-
-int
-IF_vi(argv)
-char *argv[];
-{
- return (0);
-}
-
-#define MAX_DESCRIP 24
-
-int
-redescribe(argv)
-char *argv[];
-{
- register int i, len;
- struct ott_entry *entry;
- char newdesc[MAX_DESCRIP+1]; /* + 1 to allow for NULL in sprintf */
- struct ott_entry *path_to_ott();
-
- char *filename(), *bsd_path_to_title();
-
- if ((entry = path_to_ott(argv[0])) == NULL)
- return(FAIL);
- for (i = 1, len = 0; argv[i] && len < MAX_DESCRIP-1; i++)
- len += sprintf(&newdesc[len], "%.*s ", MAX_DESCRIP-len-1, argv[i]);
- newdesc[len-1] = '\0';
- if (strchr(newdesc, '|')) {
- mess_temp("The character '|' is not allowed in description, try again");
- return(FAIL);
- }
- if (strcmp(newdesc,"") == 0) {
- mess_temp("Null strings are not allowed in description, try again");
- return(FAIL);
- }
-
-
- entry->display = strsave(newdesc);
- (void) ott_chg_display(entry);
-
- mess_temp(nstrcat(bsd_path_to_title(filename(argv[0]),
- MESS_COLS - 17 - strlen(newdesc)),
- " redescribed as ", newdesc, ".", NULL));
- return(SUCCESS);
-}
-
-static char *
-permsg(mode)
-mode_t mode; /* EFT abs k16 */
-{
- switch (mode) {
- case 01:
- return("search");
- case 02:
- return("modify");
- case 04:
- return("read");
- default:
- return("access");
- }
-}
-
-int
-ckperms(path, mode)
-char *path;
-mode_t mode; /* EFT abs k16 */
-{
- char *bsd_path_to_title();
-
- if (access(path, 00) == FAIL) {
- mess_temp(nstrcat(bsd_path_to_title(path, MESS_COLS-15)," does not exist",
- NULL));
- return(FAIL);
- }
-
- if (access(path, mode) == FAIL) {
- mess_temp(nstrcat("You do not have permission to ", permsg(mode), " ",
- bsd_path_to_title(path, MESS_COLS-37), NULL));
- return(FAIL);
- }
- return(SUCCESS);
-}
-
-void
-fcn_init()
-{
- int IF_dvi(), IF_dir_open(), IF_dmv(), IF_dcp(), IF_drn();
- int IF_sp();
- int IF_aed(), IF_acv(), IF_apr(), IF_aed();
- int IF_omopen();
- int IF_helpopen();
- int IF_ofopen();
- int IF_exec_open();
-
-/* general purpose operations */
-
- Function[IF_VI] = IF_vi;
- Function[IF_SH] = IF_sh;
- Function[IF_CP] = IF_cp;
- Function[IF_RN] = IF_rn;
- Function[IF_MV] = IF_mv;
- Function[IF_RM] = IF_rm;
- Function[IF_UNRM] = IF_unrm;
- Function[IF_SC] = IF_sc;
- Function[IF_UNSC] = IF_unsc;
-
-/* operations specific to ascii files */
-
- Function[IF_ACV] = IF_acv;
- Function[IF_AED] = IF_aed;
- Function[IF_APR] = IF_apr;
-
-/* operations specific to menu objects */
-
- Function[IF_MENOPEN] = IF_omopen;
-
-/* operations specific to help objects */
-
- Function[IF_HLPOPEN] = IF_helpopen;
-
-/* operations specific to form objects */
-
- Function[IF_FRMOPEN] = IF_ofopen;
-
-/* operations specific to file folders */
-
- Function[IF_DED] = IF_dir_open;
- Function[IF_DVI] = IF_dvi;
- Function[IF_DMV] = IF_dmv;
- Function[IF_DCP] = IF_dcp;
- Function[IF_DRN] = IF_drn;
-
-/* operations specific to executables */
-
- Function[IF_EED] = IF_exec_open;
-
-/* illegal function */
-
- Function[IF_BADFUNC] = IF_badfunc;
-
- return;
-}
-
-static token
-confirm(s, t)
-char *s;
-token t;
-{
- extern char *Wastebasket;
- char buf[BUFSIZ], *filename(), *bsd_path_to_title();
-
- sprintf(buf, "Press ENTER to delete %s:",
- bsd_path_to_title(filename(Arg),MESS_COLS - 23));
-
- if (t == TOK_CANCEL)
- return TOK_NOP;
-
- if (t == TOK_SAVE && *s == NULL) {
- if (strncmp(Arg, Wastebasket, strlen(Wastebasket)) == 0) {
- blow_away(Ott);
- mess_temp(nstrcat("Object ", Ott->dname,
- " permanently removed from WASTEBASKET", NULL));
- ar_checkworld(TRUE);
- return TOK_NOP;
- }
-
- if (objop("move", NULL, Arg, Wastebasket, NULL) == FAIL)
- return TOK_NOP;
- else
- ar_checkworld(TRUE);
- }
- else if (*s != NULL) {
- get_string(confirm, buf, "", 0, FALSE, "delete", "delete");
- mess_temp("Please re-enter value");
- }
-
- return TOK_NOP;
-}
-
-static token
-confirmW(s, t)
-char *s;
-token t;
-{
- extern char *Wastebasket;
- char buf[BUFSIZ], *filename();
- char command[PATHSIZ + 100];
-
- sprintf(buf, "Press ENTER to empty your %s:", filename(Arg));
-
- if (t == TOK_CANCEL)
- return TOK_NOP;
-
- if (t == TOK_SAVE && *s == NULL) {
-
- sprintf(command,"for i in %s/*; do /bin/rm -rf $i; done 1>/dev/null 2>/dev/null",Wastebasket);
- (void) system(command);
- mess_temp("All objects in WASTEBASKET have been permanently removed");
- ar_checkworld(TRUE);
- }
- else if (*s != NULL) {
- get_string(confirmW, buf, "", 0, FALSE, "delete", "delete");
- mess_temp("Please re-enter value");
- }
-
- return TOK_NOP;
-}
diff --git a/usr/src/cmd/fmli/oh/interrupt.c b/usr/src/cmd/fmli/oh/interrupt.c
deleted file mode 100644
index f03c3b9216..0000000000
--- a/usr/src/cmd/fmli/oh/interrupt.c
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-/*
- * Copyright (c) 1988 AT&T
- * All Rights Reserved
- */
-#ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.2 */
-
-#include "wish.h"
-
-/* routines defined in this file: */
-
-void intr_handler();
-
-
-
-/* declare data structures for interrupt feature
- * the following is a copy of interrupt.h without the `extern'
- */
-
-
-struct {
- bool interrupt;
- char *oninterrupt;
- bool skip_eval;
-} Cur_intr;
-
-
-/* intr_handler
- This routine will execute on receipt of a SIGINT while
- executing a fmli builtin or external executable (if
- interrupts are enabled)
-
- Sets flag to tell eval() to throw away the rest of the
- descriptor it is parsing.
-*/
-void
-intr_handler()
-{
- Cur_intr.skip_eval = TRUE;
-}
-
diff --git a/usr/src/cmd/fmli/oh/is_objtype.c b/usr/src/cmd/fmli/oh/is_objtype.c
deleted file mode 100644
index 827fa15516..0000000000
--- a/usr/src/cmd/fmli/oh/is_objtype.c
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-/*
- * Copyright (c) 1985 AT&T
- * All Rights Reserved
- */
-#ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.2 */
-
-#include <stdio.h>
-#include <sys/types.h> /* EFT abs k16 */
-#include "wish.h"
-#include "terror.h"
-#include "typetab.h"
-#include "detabdefs.h"
-
-extern struct odft_entry Detab[MAXODFT];
-
-bool
-is_objtype(obj)
-char *obj;
-{
- register int i;
-
- for (i = 0; Detab[i].objtype[0]; i++)
- if (strCcmp(obj, Detab[i].objtype) == 0)
- return(TRUE);
- return(FALSE);
-}
diff --git a/usr/src/cmd/fmli/oh/misc.c b/usr/src/cmd/fmli/oh/misc.c
deleted file mode 100644
index 6a6e95a348..0000000000
--- a/usr/src/cmd/fmli/oh/misc.c
+++ /dev/null
@@ -1,99 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-/*
- * Copyright (c) 1985 AT&T
- * All Rights Reserved
- */
-
-#ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.3 */
-
-#include <stdio.h>
-#include "wish.h"
-#include "moremacros.h"
-
-/*
- * gets the next line that does not begin with '#' or '\n', and removes
- * the trailing '\n'. Returns buf, or NULL if EOF is encountered.
- */
-char *
-get_skip(buf, size, fp)
-char *buf;
-int size;
-FILE *fp;
-{
- register char *p;
-
- while ((p = fgets(buf, size, fp)) && (buf[0] == '#' || buf[0] == '\n'))
- ;
- if (p)
- p[strlen(p) - 1] = '\0';
- return p;
-}
-
-/*
- * frees *dst, if already set, and sets it to the strsaved value of the
- * next tab delimited field. Return value is ptr to char after the tab
- * (which is overwritten by a '\0'). If there is no field or src is
- * NULL, *dst remains unchanged and NULL is returned
- */
-char *
-tab_parse(dst, src)
-char **dst;
-char *src;
-{
- register char *p;
- char *strchr();
-
- if (src == NULL)
- return NULL;
- while (*src == '\t')
- src++;
- if (*src == '\0')
- return NULL;
- if (*dst)
- free(*dst);
- if (p = strchr(src, '\t'))
- *p++ = '\0';
- *dst = strsave(src);
- src = p;
- return src;
-}
-
-long
-tab_long(src, base)
-char **src;
-{
- char *strchr();
- long strtol();
-
- if (*src == NULL || **src == '\0') {
- *src = NULL;
- return 0L;
- }
- while (**src == '\t')
- (*src)++;
- return strtol(*src, src, base);
-}
diff --git a/usr/src/cmd/fmli/oh/namecheck.c b/usr/src/cmd/fmli/oh/namecheck.c
deleted file mode 100644
index 0f831accaa..0000000000
--- a/usr/src/cmd/fmli/oh/namecheck.c
+++ /dev/null
@@ -1,259 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-
-/*
- * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-/* Copyright (c) 1984, 1985, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-#include <stdio.h>
-#include <string.h>
-#include <fcntl.h>
-#include <ctype.h>
-#include <time.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <errno.h>
-#include "mio.h"
-#include "wish.h"
-#include "typetab.h"
-#include "partabdefs.h"
-#include "message.h"
-#include "sizes.h"
-
-extern struct ott_tab *Cur_ott;
-static int find_max();
-
-bool
-namecheck(path, name, objtype, errstr, is_new)
-char *path, *name, *objtype, **errstr;
-bool is_new;
-{
- int len;
- static char error[MESSIZ];
- char pathbuf[PATHSIZ], oldpath[PATHSIZ];
- char *p;
- char *template = NULL;
- int span;
- int fs_max_fix;
- int maxchar;
- int maxpath;
- int retval;
- struct opt_entry *opt;
- struct ott_entry *ott;
- extern struct one_part Parts[];
- struct opt_entry *obj_to_parts();
- struct ott_entry *dname_to_ott();
- extern char * part_construct();
- extern char * path_to_fstype();
- extern char Opwd[];
-
-#ifdef _DEBUG
- _debug(stderr, "in namecheck(%s)\n", name);
-#endif
-
- if (name == NULL || name[0] == '\0') {
- *errstr = "Object name must have at least 1 character";
- return(FALSE);
- }
-/* miked k17 */
-/* for (p = name; *p; p++) */ /* convert spaces and tabs to underlines */
-/* if (*p == ' ' || *p == '\t')
- *p = '_';
-*/
-
- for (p = name; *p; p++) /* check for spaces and tabs */
- if (*p == ' ' || *p == '\t') {
- sprintf(error, "Object name cannot contain space or tab characters\n");
- *errstr = error;
- return(FALSE);
- }
-
- if (objtype)
- opt = obj_to_parts(objtype);
- else
- opt = NULL;
-
-/* if ( path && ! strcmp(path_to_fstype(path),"s5") ) */
-/*
- * this mess sets the maximum object name size depending on the
- * file system type of the path arguement or, if path is null,
- * on the value of Opwd, a global containing the pathname of
- * the last filefolder made current. The mechanations with
- * fs_max_fix are because the is a table in Parts that contains
- * max object lengths that are based on 255. This table cannot
- * be changed to reflect s5 .vs. ufs so the kluge is made here.
- */
- if ( ! strcmp(path_to_fstype(path?path:&Opwd[5]),"s5") )
- fs_max_fix = FILE_NAME_SIZ - 1 - 14;
- else
- fs_max_fix = 0;
-
- if (opt) {
- template = Parts[opt->part_offset].part_template;
- maxchar = find_max(template) - fs_max_fix;
- } else {
- maxchar = FILE_NAME_SIZ - 1 - fs_max_fix;
- }
- /*
- * changed 12 to 14 here. miked .. upped 14 to FILE_NAME_SIZ. abs
- */
-
- if ((len=strlen(name)) > maxchar) {
- sprintf(error, "Object name cannot have more than %d characters\n", maxchar);
- *errstr = error;
- return(FALSE);
- }
- /* check if total pathsize to big */
- if (opt)
- maxpath = len + 4; /* 4: "/" + prefix(2) + NULL */
- else
- maxpath = FILE_NAME_SIZ + 10; /* name + /.pref + 3 is biggest defined */
-
- if ((int)(path?strlen(path):0) + maxpath > PATHSIZ) {
- sprintf(error,
- "Can't create object: folder path length exceeds %d characters\n"
- , PATHSIZ - maxpath);
- *errstr = error;
- return(FALSE);
- }
-
-/* if ((span=strcspn(name, "!@#$^&*(){}[]|\\`~;\"'<>/?")) < len) {
-miked */
- if ((span=strcspn(name, "/!&|<>")) < len) {
- sprintf(error,
- "Object name cannot contain the special character '%c'", name[span]);
- *errstr = error;
- return(FALSE);
- }
-
- for (p = name; *p; p++) /* test for only printable characters. miked */
- if ( iscntrl( *p ) ) {
- sprintf(error,
- "Object name cannot contain the special character ^%c",
- (*p + '@'));
- *errstr = error;
- return(FALSE);
- }
-
- if ((span=strspn(name, ".")) != 0) {
- sprintf(error, "Object name cannot start with the character '%c'", *name);
- *errstr = error;
- return(FALSE);
- }
-
- if (!is_new) {
-#ifdef _DEBUG
- _debug(stderr, "namecheck returning true\n");
-#endif
- return(TRUE);
- }
-
- if (path) {
- strcat(strcpy(pathbuf, path), "/");
- } else
- pathbuf[0] = '\0';
-
- if (template)
- strcat(pathbuf, part_construct(name, template));
- else
- strcat(pathbuf, name);
-#ifdef _DEBUG
- _debug(stderr, "namecheck: checking existance of %s\n",pathbuf);
-#endif
-
-#ifndef WISH
- /* check if the object is in the wastebasket */
-
- if (Cur_ott && path && strcmp(Cur_ott->path, path) != 0) {
- strcpy(oldpath, Cur_ott->path);
- ott_lock_inc(NULL);
- ott_get(path?path:".", 0L, 0L, 0L, 0L);
- } else
- oldpath[0] = '\0';
-
- if ((ott = dname_to_ott(name)) != NULL) {
- if (ott->objmask & M_WB)
- sprintf(error, "object exists in wastebasket");
- else
- sprintf(error, "An object with that name already exists");
- *errstr = error;
- retval = FALSE;
- } else if (access(pathbuf, 0) != -1) {
- *errstr = "An object with that name already exists";
- retval = FALSE;
- } else
- retval = TRUE;
-
- if (oldpath[0]) { /* restore old ott */
- make_current(oldpath);
- ott_unlock_inc(NULL);
- }
-#else
- if (access(pathbuf, 0) != -1) {
- static char dbuf[MESSIZ];
-
- sprintf(dbuf, "An object with that name already exists in %s",
- bsd_path_to_title(path?path:&Opwd[5], MESS_COLS-43));
- *errstr = dbuf;
- retval = FALSE;
- } else
- retval = TRUE;
-#endif
-
-#ifdef _DEBUG
- _debug(stderr, "namecheck returning %d\n", retval);
-#endif
- return(retval);
-}
-
-static int
-find_max(template)
-char *template;
-{
- int max_len;
- register char *p = template;
-
- while (*p && *p != '%')
- p++;
-
- if (*p == '\0')
- return(FILE_NAME_SIZ -1);
-
- p++;
-
- if (*p != '.')
- return(FILE_NAME_SIZ -1);
-
- p++;
-
- if ((max_len = atoi(p)) == 0)
- return(FILE_NAME_SIZ -1);
-
- return(max_len);
-}
diff --git a/usr/src/cmd/fmli/oh/nextpart.c b/usr/src/cmd/fmli/oh/nextpart.c
deleted file mode 100644
index ff27271e75..0000000000
--- a/usr/src/cmd/fmli/oh/nextpart.c
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-/*
- * Copyright (c) 1985 AT&T
- * All Rights Reserved
- */
-
-#ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.3 */
-
-#include <stdio.h>
-#include <string.h>
-#include <sys/types.h> /* EFT abs k16 */
-#include "but.h"
-#include "wish.h"
-#include "typetab.h"
-#include "optabdefs.h"
-#include "partabdefs.h"
-
-struct one_part *
-opt_next_part(entry)
-struct opt_entry *entry;
-{
- static int partsleft;
- static int curoffset;
- struct one_part *retval;
- extern struct one_part Parts[MAXPARTS];
-
- if (entry) {
- partsleft = entry->numparts;
- curoffset = entry->part_offset;
- }
- if (partsleft > 0) {
- retval = Parts + curoffset++;
- partsleft--;
- } else
- retval = NULL;
-
- return(retval);
-}
diff --git a/usr/src/cmd/fmli/oh/obj_to_opt.c b/usr/src/cmd/fmli/oh/obj_to_opt.c
deleted file mode 100644
index cc9a5d7963..0000000000
--- a/usr/src/cmd/fmli/oh/obj_to_opt.c
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-/*
- * Copyright (c) 1985 AT&T
- * All Rights Reserved
- */
-
-#ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.4 */
-
-#include <stdio.h>
-#include <string.h>
-#include <sys/types.h> /* EFT abs k16 */
-#include "but.h"
-#include "wish.h"
-#include "typetab.h"
-#include "ifuncdefs.h"
-#include "optabdefs.h"
-#include "partabdefs.h"
-
-extern bool No_operations;
-
-struct opt_entry *
-obj_to_opt(objtype)
-char *objtype;
-{
- register int i;
- extern struct opt_entry Partab[MAX_TYPES];
-
- for (i = 0; i < MAX_TYPES && Partab[i].objtype; i++) {
- if (strcmp(objtype, Partab[i].objtype) == 0) {
- if (i != MAX_TYPES-1 || No_operations == FALSE)
- return(Partab + i);
- }
- }
-
-#ifdef _DEBUG
- _debug(stderr, "Object %s Not Found, searching external\n",objtype);
-#endif
-
- if (ootread(objtype) == O_FAIL) {
-#ifdef _DEBUG
- _debug(stderr, "Failed to find extern\n");
-#endif
- return(NULL);
- } else {
-#ifdef _DEBUG
- _debug(stderr, "Found object extern\n");
-#endif
- No_operations = FALSE;
- return(Partab + MAX_TYPES - 1);
- }
-}
diff --git a/usr/src/cmd/fmli/oh/obj_to_par.c b/usr/src/cmd/fmli/oh/obj_to_par.c
deleted file mode 100644
index 1c687b4c9e..0000000000
--- a/usr/src/cmd/fmli/oh/obj_to_par.c
+++ /dev/null
@@ -1,88 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-/*
- * Copyright (c) 1985 AT&T
- * All Rights Reserved
- */
-
-#ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.5 */
-
-#include <stdio.h>
-#include <string.h>
-#include <sys/types.h> /* EFT abs k16 */
-#include "but.h"
-#include "wish.h"
-#include "typetab.h"
-#include "ifuncdefs.h"
-#include "partabdefs.h"
-#include "optabdefs.h"
-
-/* Obj_to_parts should be used instead of obj_to_opt in those executables
- * that do not need access to the object operations table. It only
- * reads the global flags and parts information for an object.
- */
-
-/* The No_operations flag is set to TRUE if the externally read object
- * has not had its operations read.
- */
-bool No_operations;
-
-struct opt_entry *
-obj_to_parts(objtype)
-char *objtype;
-{
- register int i;
- FILE *fp;
- extern struct opt_entry Partab[MAX_TYPES];
- extern char *externoot();
-
- for (i = 0; i < MAX_TYPES && Partab[i].objtype; i++) {
- if (strcmp(objtype, Partab[i].objtype) == 0 )
- return(Partab + i);
- }
-
- /* read in the external object table for this object, but
- * only read in the parts information.
- */
-
- if ((fp = fopen(externoot(objtype), "r")) == NULL)
- return(NULL);
-
- if (read_parts(fp, objtype) == O_FAIL) {
-#ifdef _DEBUG
- _debug(stderr, "External Object not found\n");
-#endif
- fclose(fp);
- return(NULL);
- } else {
-#ifdef _DEBUG
- _debug(stderr, "External Object %s found\n", objtype);
-#endif
- No_operations = TRUE;
- fclose(fp);
- return(Partab + MAX_TYPES - 1);
- }
-}
diff --git a/usr/src/cmd/fmli/oh/objform.h b/usr/src/cmd/fmli/oh/objform.h
deleted file mode 100644
index d6d0562567..0000000000
--- a/usr/src/cmd/fmli/oh/objform.h
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-/*
- * Copyright (c) 1985 AT&T
- * All Rights Reserved
- */
-#ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.4 */
-
-typedef struct {
- int flags;
- int curpage; /* current form page */
- int lastpage; /* last page of the form */
- int curfield; /* current field number */
- int numactive; /* number of active fields */
- char **holdptrs; /* array of low-level field structures */
- char **mulvals; /* field specific variables (F1, F2, etc.) */
- struct fm_mn fm_mn; /* main structure for form descriptors */
- int *visible; /* list of active/visible fields */
- int *slks; /* list of SLKS specific to this form */
-} forminfo;
diff --git a/usr/src/cmd/fmli/oh/objhelp.h b/usr/src/cmd/fmli/oh/objhelp.h
deleted file mode 100644
index 546c9a5fbb..0000000000
--- a/usr/src/cmd/fmli/oh/objhelp.h
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-/*
- * Copyright (c) 1985 AT&T
- * All Rights Reserved
- */
-#ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.2 */
-
-typedef struct {
- int flags;
- struct fm_mn fm_mn;
- char **holdptrs;
- int *slks;
- char **args;
-} helpinfo;
diff --git a/usr/src/cmd/fmli/oh/objmenu.h b/usr/src/cmd/fmli/oh/objmenu.h
deleted file mode 100644
index 3678a58778..0000000000
--- a/usr/src/cmd/fmli/oh/objmenu.h
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-/*
- * Copyright (c) 1985 AT&T
- * All Rights Reserved
- */
-#ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.2 */
-
-typedef struct {
- int flags;
- int numactive; /* number of inactive menu items */
- struct fm_mn fm_mn;
- int *visible;
- int *slks;
- char **args;
-} menuinfo;
diff --git a/usr/src/cmd/fmli/oh/odftread.c b/usr/src/cmd/fmli/oh/odftread.c
deleted file mode 100644
index 6fe554eba7..0000000000
--- a/usr/src/cmd/fmli/oh/odftread.c
+++ /dev/null
@@ -1,289 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-/*
- * Copyright (c) 1985 AT&T
- * All Rights Reserved
- */
-
-#ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.15 */
-
-#include <stdio.h>
-#include <ctype.h>
-#include <malloc.h>
-#include <sys/types.h> /* EFT abs k16 */
-#include "wish.h"
-#include "typetab.h"
-#include "optabdefs.h"
-#include "detabdefs.h"
-#include "retcds.h"
-#include "mio.h"
-#include "terror.h"
-#include "sizes.h"
-
-/* This function reads the External Object Detection Function Table,
- * or "oddfoot" as it is known in conversation.
- * If the oddfoot exists, then it replaces the internal oddfoot.
- *
- * The structure of the external oddfoot is:
- *
- * [LINUM] OBJTYPE DEFAULT-ODI DEFAULT-MASK FUNCTION-TYPE [ARGUMENTS]
- * where:
- * LINUM is an optional decimal line number that is ignored.
- * OBJTYPE is the internal OTS name of the object.
- * DEFAULT-ODI is a string of default Object Dependent Information
- * DEFAULT-MASK is a hex number to be or'ed in with the object's mask.
- * FUNCTION-TYPE is an integer, one of:
- * F_INT (4) Detect by internal detection function.
- * F_SHELL (5) Detect by forking a process with a shell
- * F_EXEC (6) Detect by forking a process
- * F_PARTS (7) Detect by part names
- * F_DPARTS (8) Detect by the existance of parts
- * F_MAGIC (9) Detect by magic numbers
- * ARGUMENTS are possible arguments to the function being called:
- * F_INT argument is a hex number,telling which internal function should
- * be used.
- * F_SHELL and F_EXEC, argument is a string, indicating a path.
- * F_PARTS and F_DPARTS do not need arguments
- * F_MAGIC a list of pairs of numbers. The first number of each pair
- * is an offset, the second is a byte value. Numbers may be in
- * hex, octal, or decimal according to the normal conventions
- * (0xnumber, 0number, or number).
- * For example: 0x01 033 0x02 041. There is a limit of MAXMAGIC
- * magic pairs.
- */
-
-
-char *expand();
-
-static bool Already_read = FALSE; /* only do it once */
-
-static long Normal_mag_offset[] = {0L, 1L, -1L};
-
-/* magic number info 0 0177 1 0105 2 0114 3 0106*/
-static long O1[] = {0L, 2047L, -1L};
-static long O2[] = {0L, 1L, -1L};
-static long O3[] = {0L, 1L, -1L};
-static long O4[] = {0L, 1L, -1L};
-static long O5[] = {0L, 1L, -1L};
-static long O6[] = {0L, 1L, -1L};
-static long O8[] = {0L, 1L, 2L, 3L, 17L, -1L};
-static long O9[] = {0L, 1L, 2L, 3L, 16L, -1L};
-
-static char B1[] = {5, 2 };
-static char B2[] = {1, 0150 };
-static char B3[] = {1, 0151 };
-static char B4[] = {1, 0160 };
-static char B5[] = {1, 0161 }; /* >> CHANGED FROM 1,1061 abs7/6/88 << */
-static char B6[] = {1, 015 };
-static char B7[] = {0114, 01 };
-static char B8[] = {0177, 0105, 0114, 0106, 02 };
-
-extern struct odft_entry Detab[MAXODFT];
-
-struct odft_entry FMLI_detab[MAXODFT] = {
- { "MDIRECTORY", "", 0, 8, 0, NULL, NULL, NULL },
- { "DIRECTORY", "", 0, 8, 0, NULL, NULL, NULL },
- { "MENU", "", 0, 7, 0, NULL, NULL, NULL },
- { "FORM", "", 0, 7, 0, NULL, NULL, NULL },
- { "TEXT", "", 0, 7, 0, NULL, NULL, NULL },
- { "STRUCT_1.0", "", 0, 7, 0, NULL, NULL, NULL },
- { "UCALC_1.0", "", 0, 7, 0, NULL, NULL, NULL },
-/* dmd 6/13/89
- { "MAIL_OUT", "", 0, 4, 10,NULL, NULL, NULL },
- { "MAIL_IN", "", 0, 4, 9, NULL, NULL, NULL },
-*/
- { "ASCII", "", 0, 4, 0, NULL, NULL, NULL },
- { "XED_5.208", "", 0, 9, 0, NULL, O1, B1 },
- { "EXECUTABLE", "TYPE=3B2/ELF", 0, 9, 0, NULL, O8, B8 },
- { "EXECUTABLE", "TYPE=386/ELF", 0, 9, 0, NULL, O9, B8 },
- { "EXECUTABLE", "TYPE=3B20", 0, 9, 0, NULL, O2, B2 },
- { "EXECUTABLE", "TYPE=3B20", 0, 9, 0, NULL, O3, B3 },
- { "EXECUTABLE", "TYPE=3B5/3B2", 0, 9, 0, NULL, O4, B4 },
- { "EXECUTABLE", "TYPE=3B5/3B2", 0, 9, 0, NULL, O5, B5 },
- { "EXECUTABLE", "TYPE=Z80", 0, 9, 0, NULL, O6, B6 },
-#ifdef i386
- { "EXECUTABLE", "TYPE=386", 0, 9, 0, NULL, O2, B7 },
-#endif
- { "TRANSFER", "", 0, 4, 3, NULL, NULL, NULL },
- { "ASCII", "", 0, 4, 1, NULL, NULL, NULL },
- { "UNKNOWN", "TYPE=COREDUMP",4000, 4, 4, NULL, NULL, NULL },
- { "UNKNOWN", "TYPE=ARCHIVE", 0, 4, 5, NULL, NULL, NULL },
- { "ASCII", "", 200, 4, 6, NULL, NULL, NULL },
- { "XED_5.208", "", 200, 4, 7, NULL, NULL, NULL },
- { "UNKNOWN", "", 0, 4, 8, NULL, NULL, NULL },
- { "", "", 0, 0, 0, NULL, NULL, NULL }
-};
-
-extern int Vflag;
-
-int
-odftread()
-{
- if (Already_read)
- return(0);
- Already_read = TRUE;
- if (!Vflag) {
- /*
- * table is hard-coded for "FACE" FMLI
- */
- register int i;
-
- for (i = 0; i < MAXODFT && FMLI_detab[i].objtype[0] != '\0';i++)
- Detab[i] = FMLI_detab[i];
- Detab[i].objtype[0] = '\0';
- }
- else {
- register int i, moffset;
- char *p, *q, buf[PATHSIZ];
- char *b;
- char *tmpstr;
- FILE *fp;
- int offset = 0, magic;
- long magic_offset[MAXMAGIC+1];
- char magic_bytes[MAXMAGIC];
- char *get_skip();
- char *tab_parse();
- long tab_long();
-
- p = expand("$OASYS/info/OH/externals/detect.tab");
- fp = fopen(p, "r");
- free(p);
- if (fp == NULL)
- fatal(MISSING, "detect.tab");
- tmpstr = NULL;
- while (get_skip(buf, PATHSIZ, fp) != NULL) {
- /* flush optional line number */
- for (b = buf; *b == '\t' || isdigit(*b); b++)
- ;
- b = tab_parse(&tmpstr, b);
- strncpy(Detab[offset].objtype, tmpstr, OTYPESIZ);
- if (b) {
- char *unbackslash();
-
- b = tab_parse(&Detab[offset].defodi, b);
- p = unbackslash(Detab[offset].defodi);
- if (p[0] == '"')
- memshift(p, p + 1, strlen(p));
- p += strlen(p) - 1;
- if (p[0] == '"')
- p[0] = '\0';
- }
- Detab[offset].defmask = tab_long(&b, 16);
- if (b && *b)
- Detab[offset].func_type = tab_long(&b, 16);
- else {
-#ifdef _DEBUG
- _debug(stderr, "BAD ODFT '%s'\n", Detab[offset].objtype);
-#endif
- error(MUNGED, "heuristics table");
- continue;
- }
- switch (Detab[offset].func_type) {
- case F_INT:
- Detab[offset].intern_func = tab_long(&b, 0);
- break;
- case F_SHELL:
- case F_EXEC:
- b = tab_parse(&tmpstr, b);
- Detab[offset].extern_func = tmpstr;
- tmpstr = NULL;
- break;
- case F_PARTS:
- case F_DPARTS:
- break;
- case F_MAGIC:
- p = b;
- magic = 0;
- while (*p && magic < MAXMAGIC) {
- moffset = strtol(p, &q, 0);
- if (p == q) /* strtol failed */
- break;
- p = q;
- while (*q && isspace(*q))
- q++;
- if (*q == '"') {
- q++;
- while (*q && *q != '"' && magic < MAXMAGIC-1) {
- magic_bytes[magic] = *q;
- magic_offset[magic] = moffset++;
- magic++;
- q++;
- }
- if (*q)
- q++;
- } else {
- magic_offset[magic] = moffset;
- magic_bytes[magic] = (char) strtol(p,&q,0);
- if (p == q) {
- p = '\0';
- break;
- } else
- p = q;
- magic++;
- }
- }
- if (magic == 0) {
-#ifdef _DEBUG
- _debug(stderr, "BAD ODFT '%s' MAGIC: %s\n", Detab[offset].objtype, q);
-#endif
- error(MUNGED, "heuristics magic number");
- continue;
- }
- magic_offset[magic] = -1L;
-
- /* for efficiency, the most common magic number
- * case, 0, 1, -1, is coded up.
- */
-
- if (magic == 2 && magic_offset[0] == 0L &&
- magic_offset[1] == 1L) {
- Detab[offset].magic_offset = &(Normal_mag_offset[0]);
- }
- else {
- Detab[offset].magic_offset = (long *)calloc(magic+1, sizeof(long));
- for (i = 0; i < magic+1; i++)
- Detab[offset].magic_offset[i] = magic_offset[i];
- }
- Detab[offset].magic_bytes = calloc(magic, sizeof(char));
- for (i = 0; i < magic; i++)
- Detab[offset].magic_bytes[i] = magic_bytes[i];
- break;
- default:
-#ifdef _DEBUG
- _debug(stderr, "ODFT '%s' BAD FUNCTION: %d\n", Detab[offset].objtype, Detab[offset].func_type);
-#endif
- error(MUNGED, "heuristics table function");
- continue;
- }
- offset++;
- }
- fclose(fp);
- Detab[offset].objtype[0] = '\0';
- if (tmpstr)
- free(tmpstr);
- }
- return(0);
-}
diff --git a/usr/src/cmd/fmli/oh/odikey.c b/usr/src/cmd/fmli/oh/odikey.c
deleted file mode 100644
index c06af25072..0000000000
--- a/usr/src/cmd/fmli/oh/odikey.c
+++ /dev/null
@@ -1,203 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/*
- * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-/* Copyright (c) 1984, 1985, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-#include <stdio.h>
-#include <sys/types.h> /* EFT abs k16 */
-#include "wish.h"
-#include "typetab.h"
-#include "var_arrays.h"
-#include "moremacros.h"
-#include "sizes.h"
-
-#define ODISIZ (2*PATHSIZ)
-#define NULLSTR ""
-
-static char *copy_to_key();
-static char *skip_to_key();
-
-int
-odi_putkey(entry, key, value)
-struct ott_entry *entry;
-char *key, *value;
-{
- int length;
- register char *p, *q;
- char valbuf[PATHSIZ], odibuf[ODISIZ];
- char *copy_to_key(), *skip_to_key();
-
- if (key == NULL)
- key = NULLSTR;
- if (value == NULL)
- value = NULLSTR;
-
- if ((length = strlen(value) + strlen(key)) >= sizeof(valbuf))
- return(O_FAIL);
- if (entry->odi && (strlen(entry->odi) + length >= ODISIZ))
- return(O_FAIL);
-
- strcpy(valbuf, key);
- strcat(valbuf, "=");
- q = value;
- for (p=valbuf+strlen(valbuf); (*q!='\0') && (p < valbuf+PATHSIZ); p++,q++) {
- switch (*q) {
- case ';':
- case '=':
- case '\\':
- *p++ = '\\';
- /* no break */
- default:
- *p = *q;
- }
- }
- *p = '\0';
-
- if (entry->odi == NULL) { /* no odi, just add it */
- entry->odi = strsave(valbuf);
- return(O_OK);
- }
-
- /* copy the new value onto beginning of odibuf, then copy all of
- * the old odibuf onto the end, leaving out the original key if
- * it exists.
- */
- strcpy(odibuf, valbuf);
-
- strcpy(valbuf, key);
- strcat(valbuf, "=");
- length = strlen(valbuf);
- q = entry->odi;
- for (p = &odibuf[strlen(odibuf)]; *q; ) {
- if (strncmp(q, valbuf, length) == 0)
- q = skip_to_key(q);
- else {
- *p++ = ';';
- q = copy_to_key(p, q, sizeof(odibuf) - (p-odibuf), FALSE);
- p = p + strlen(p);
- }
- }
- *p = '\0';
-
- free(entry->odi);
- entry->odi = strsave(odibuf);
- return(O_OK);
-}
-
-char *
-odi_getkey(entry, key)
-struct ott_entry *entry;
-char *key;
-{
- register int length;
- register char *p;
- static char keybuf[PATHSIZ];
-
- char *copy_to_key(), *skip_to_key();
-
- strcpy(keybuf, key);
- strcat(keybuf, "=");
- length = strlen(keybuf);
-
- for (p = entry->odi; p && *p; p = skip_to_key(p)) {
- if (strncmp(keybuf, p, length) == 0) {
- copy_to_key(keybuf, p+length, sizeof(keybuf), TRUE);
- break;
- }
- }
- if (p && *p)
- return(keybuf);
- else
- return(NULL);
-}
-
-/* copy from src to dst one keyword's value, of maximum size sizedst.
- * If unquote is TRUE, then the copy should also remove a level of backslashes.
- */
-
-static char *
-copy_to_key(dst, src, sizedst, unquote)
-char *dst, *src;
-int sizedst;
-bool unquote;
-{
- register char *p = dst;
- register bool done = FALSE;
-
- while (!done && src && *src && dst-p < sizedst-1 ) {
- switch (*src) {
- case ';':
- done = TRUE;
- break;
- case '\\':
- if (src[1]) {
- if (unquote == FALSE)
- *dst++ = *src;
- src++;
- }
- /* no break! continue with next case */
- default:
- *dst++ = *src++;
- break;
- }
- }
- *dst = '\0';
- return(done?++src:src); /* skip the ";" */
-}
-
-static char *
-skip_to_key(src)
-char *src;
-{
- char dst[PATHSIZ];
-
- return(copy_to_key(dst, src, sizeof(dst), TRUE));
-}
-
-/* return the first entry in the current ott which has key set to
- * value.
- */
-
-struct ott_entry *
-key_to_odi(key, value)
-char *key, *value;
-{
- extern struct ott_entry *Cur_entry;
-
- register int i;
- register int size = array_len(Cur_entry);
- register char *p;
-
-
- for (i = 0; i < size; i++)
- if ((p = odi_getkey(Cur_entry[i].dname, key)) && strcmp(p, value) == 0)
- return(Cur_entry + i);
-
- return(NULL);
-}
diff --git a/usr/src/cmd/fmli/oh/oh_init.c b/usr/src/cmd/fmli/oh/oh_init.c
deleted file mode 100644
index 13e1856d9e..0000000000
--- a/usr/src/cmd/fmli/oh/oh_init.c
+++ /dev/null
@@ -1,120 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-/*
- * Copyright (c) 1985 AT&T
- * All Rights Reserved
- */
-#ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.6 */
-
-#include <stdio.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include "wish.h"
-#include "typetab.h"
-
-extern char *nstrcat();
-extern long Dispmodes, Sortmodes;
-extern time_t Prefmodtime; /* EFT abs k16 */
-extern int Vflag;
-
-void
-oh_init()
-{
- void oot_init(), init_modes();
-
- if (Vflag)
- init_modes();
- oot_get();
- return;
-}
-
-void
-init_modes()
-{
- time_t oldpref; /* EFT abs k16 */
- char *value;
- struct stat sbuf;
- extern char *Home;
- char *getepenv();
-
- /* folders need updating if the pref directory has been touched
- * since the SORTMODES and DISPLAYMODES have been read.
- * So, any form that wants to update all the folders on the screen
- * need only touch $HOME/pref.
- */
- oldpref = Prefmodtime;
- if (stat(nstrcat(Home, "/pref", NULL), &sbuf) != FAIL) {
- Prefmodtime = sbuf.st_mtime;
- if (oldpref == Prefmodtime)
- return; /* no need to reread variables if hasn't changed */
- }
-#ifdef _DEBUG
- else
- _debug(stderr, "pref stat failed\n");
-#endif
-
- /* get environment settings; if not set, use defaults */
-
- if (((value = getepenv("DISPLAYMODE")) == NULL) || (value[0] == '\0'))
- Dispmodes = OTT_DOBJ;
- else {
- switch (value[0]) {
- case 'T': /* object Type */
- Dispmodes = OTT_DOBJ;
- break;
- case 'M': /* Modification Time */
- Dispmodes = OTT_DMTIME;
- break;
- case 'S':
- Dispmodes = 0;
- break;
- default:
- Dispmodes = strtol(value, NULL, 16);
- break;
- }
- }
-
- if (((value = getepenv("SORTMODE")) == NULL) || (value[0] == '\0'))
- Sortmodes = OTT_SALPHA;
- else {
- switch (value[0]) {
- case 'A': /* Alphabetic */
- Sortmodes = OTT_SALPHA;
- break;
- case 'M': /* Most Recent */
- Sortmodes = OTT_SMTIME;
- break;
- case 'L': /* Least Recent */
- Sortmodes = OTT_SMTIME|OTT_SREV;
- break;
- case 'O':
- Sortmodes = OTT_SOBJ;
- break;
- default:
- Sortmodes = strtol(value, NULL, 16);
- }
- }
-}
diff --git a/usr/src/cmd/fmli/oh/ootpart.c b/usr/src/cmd/fmli/oh/ootpart.c
deleted file mode 100644
index 1181905087..0000000000
--- a/usr/src/cmd/fmli/oh/ootpart.c
+++ /dev/null
@@ -1,150 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-/*
- * Copyright (c) 1985 AT&T
- * All Rights Reserved
- */
-
-#ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.4 */
-
-#include <stdio.h>
-#include <sys/types.h> /* EFT abs k16 */
-#include "wish.h"
-#include "typetab.h"
-#include "optabdefs.h"
-#include "partabdefs.h"
-
-extern struct opt_entry Partab[MAX_TYPES];
-extern struct one_part Parts[MAXPARTS];
-
-char *get_skip();
-char *tab_parse();
-
-int
-read_parts(fp, obj)
-FILE *fp;
-char *obj;
-{
- register char *p;
- char *tmpstr;
- char buf[BUFSIZ];
- register int i;
- struct opt_entry *partab;
- int openpart;
-
- partab = Partab + MAX_TYPES - 1;
- openpart = MAXPARTS - MAXOBJPARTS;
- if (get_skip(buf, BUFSIZ, fp) == NULL) {
-#ifdef _DEBUG
- _debug(stderr, "No parts\n");
-#endif
- return O_FAIL;
- }
- strncpy(partab->objtype, obj, OTYPESIZ);
- tmpstr = NULL;
- p = tab_parse(&tmpstr, buf);
- strncpy(partab->objdisp, tmpstr, OTYPESIZ);
- if (p) {
- p = tab_parse(&tmpstr, p);
- partab->int_class = strtol(tmpstr, 0, 16);
- }
- p = tab_parse(&partab->oeu, p);
- p = tab_parse(&partab->objformat, p);
- p = tab_parse(&partab->objapp, p);
- p = tab_parse(&partab->objprod, p);
- if (p == NULL) {
-#ifdef _DEBUG
- _debug(stderr, "Bad def line, '%s'\n", buf);
-#endif
- if (tmpstr)
- free(tmpstr);
- return O_FAIL;
- }
- p = tab_parse(&partab->objclass, p);
- if (p) {
- p = tab_parse(&tmpstr, p);
- partab->info_type = strtol(tmpstr, 0, 16);
- }
- else
- partab->info_type = -1;
- if (p) {
- p = tab_parse(&tmpstr, p);
- partab->info_int = strtol(tmpstr, 0, 16);
- }
- p = tab_parse(&partab->info_ext, p);
- partab->part_offset = MAXPARTS - MAXOBJPARTS;
- if (partab->info_type == -1) {
- partab->info_int = 0;
- partab->info_ext = NULL;
- }
- if (get_skip(buf, BUFSIZ, fp) == NULL) {
-#ifdef _DEBUG
- _debug(stderr, "No partnum\n");
-#endif
- if (tmpstr)
- free(tmpstr);
- return O_FAIL;
- }
- partab->numparts = strtol(buf, &tmpstr, 0);
- if (tmpstr == buf) {
-#ifdef _DEBUG
- _debug(stderr, "Bad partnum fld\n");
-#endif
- return O_FAIL;
- }
- tmpstr = NULL;
- for (i = 0; i < partab->numparts; i++) {
- if (get_skip(buf, BUFSIZ, fp) == NULL) {
-#ifdef _DEBUG
- _debug(stderr, "Missing part\n");
-#endif
- if (tmpstr)
- free(tmpstr);
- return O_FAIL;
- }
- p = tab_parse(&tmpstr, buf);
- strncpy(Parts[i + openpart].part_name, tmpstr, PNAMESIZ);
- if (p) {
- p = tab_parse(&tmpstr, p);
- strncpy(Parts[i + openpart].part_template, tmpstr, PNAMESIZ);
- }
- if (p) {
- p = tab_parse(&tmpstr, p);
- Parts[i + openpart].part_flags = strtol(tmpstr, NULL, 16);
- }
- else {
-#ifdef _DEBUG
- _debug(stderr, "Bad part num %d '%s'\n", i, buf);
-#endif
- if (tmpstr)
- free(tmpstr);
- return O_FAIL;
- }
- }
- if (tmpstr)
- free(tmpstr);
- return O_OK;
-}
diff --git a/usr/src/cmd/fmli/oh/ootread.c b/usr/src/cmd/fmli/oh/ootread.c
deleted file mode 100644
index e4468139f7..0000000000
--- a/usr/src/cmd/fmli/oh/ootread.c
+++ /dev/null
@@ -1,364 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-
-/*
- * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-/* Copyright (c) 1984, 1985, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-#include <stdio.h>
-#include <sys/types.h> /* EFT abs k16 */
-#include "wish.h"
-#include "typetab.h"
-#include "optabdefs.h"
-#include "partabdefs.h"
-#include "ifuncdefs.h"
-#include "mess.h"
-#include "mio.h"
-#include "terror.h"
-#include "var_arrays.h"
-#include "sizes.h"
-
-/*
- * read the object operations and parts information from the definition
- * file. This file is located in $OASYS/info/OH/eternals and has the name
- * of the internal TeleSystem name of the object. The format of this file is:
- *
- * OBJECT DEFINITIONS
- * Number of parts
- * Part Definition 1
- * Part Definition 2
- * ...
- * Part Definition n
- * Operation Definition 1
- * Operation Definition 2
- * ...
- * Operation Definition m
- *
- * where:
- * OBJECT DEFINITIONS = displayname class oeu format applic prod rclass
- * Part Definition = partname template flags
- * Operation Def = funcname but type intern extern optype mult all none
- *
- * All fields are tab separated. See optabdefs.h and partabdefs.h for the
- * format of the internal tables.
- *
- * Basically, the way this whole thing works is that there is an internal
- * set of tables (the oot and the opt) which define internally-known
- * objects. If a VAR adds an object, he makes a file with the above format
- * which will define it. If the object architecture is asked to handle an
- * object which is not in the internal table, it looks out in the external
- * files directory for a file with the name of the object it is supposed to
- * handle. It reads it into the last slot of the internal table. Thus, if
- * such an object is accessed twice in a row, there is no need to read it in
- * again the second time.
- */
-
-
-#define LASTOBJ (MAX_TYPES-1)
-
-static struct operation Extops[MAX_OPERS]; /* external operations */
-
-extern struct operation *Optab[MAX_TYPES][MAX_OPERS];
-extern struct opt_entry Partab[MAX_TYPES];
-extern struct one_part Parts[MAXPARTS];
-
-
-extern struct operation Obj_sh;
-extern struct operation Obj_view;
-extern struct operation Obj_cp;
-extern struct operation Obj_rn;
-extern struct operation Obj_mv;
-extern struct operation Obj_sc;
-extern struct operation Obj_unsc;
-extern struct operation Obj_rm;
-extern struct operation Ascii_pr;
-extern struct operation Ascii_open;
-extern struct operation Ascii_cv;
-extern struct operation Dir_sh;
-extern struct operation Dir_view;
-extern struct operation Dir_ex;
-extern struct operation No_op;
-extern struct operation Illeg_op;
-
-struct operation Obj_sp;
-struct operation Obj_unrm;
-struct operation Obj_ml;
-struct operation Obj_viewfull;
-struct operation Unknown_ex;
-struct operation Unknown_cv;
-
-struct oper_trans {
- char *name;
- struct operation *op;
-} Optrans[] = {
- {"SH", &Obj_sh},
- {"VI", &Obj_view},
- {"CP", &Obj_cp},
- {"RN", &Obj_rn},
- {"MV", &Obj_mv},
- {"SP", &Obj_sp},
- {"SC", &Obj_sc},
- {"UNSC", &Obj_unsc},
- {"RM", &Obj_rm},
- {"UNRM", &Obj_unrm},
- {"ML", &Obj_ml},
- {"VF", &Obj_viewfull},
- {"PR", &Ascii_pr},
- {"ED", &Ascii_open},
-
- {"UNK_EX", &Unknown_ex},
- {"UNK_CV", &Unknown_cv},
- {"ASC_CV", &Ascii_cv},
-
- {"DIR_SH", &Dir_sh},
- {"DIR_VI", &Dir_view},
- {"DIR_EX", &Dir_ex},
- {"NOP", &No_op},
-
- {"ILL", &Illeg_op},
- {"",NULL}
-};
-
-static char **Notfound; /* all the objects I could never find... */
-static int get_oper();
-
-int
-ootread(obj)
-char *obj;
-{
- char *fname;
- register int i;
- FILE *fp;
- char *externoot();
- int lcv;
-
- if (Notfound)
- {
- lcv = array_len(Notfound);
- for (i = 0; i < lcv; i++)
- if (strcmp(Notfound[i], obj))
- return O_FAIL;
- }
-
- fname = externoot(obj);
-
- if ((fp = fopen(fname, "r")) == NULL) {
- var_append(char *, Notfound, (&obj));
- return O_FAIL;
- }
-
- if (read_parts(fp, obj) == O_FAIL) {
- fclose(fp);
- return O_FAIL;
- }
- for (i = 0; i < MAX_OPERS; i++) {
- Extops[i].opername = NULL;
- Optab[LASTOBJ][i] = Extops + i;
- if (get_oper(fp, i) == O_FAIL)
- break;
- }
- fclose(fp);
- if (i < MAX_OPERS)
- Optab[LASTOBJ][i] = NULL;
-
- return O_OK;
-}
-
-static int
-get_oper(fp, index)
-FILE *fp;
-int index;
-{
- char *p;
- char buf[BUFSIZ];
- register int i;
- extern int (*Function[MAX_IFUNCS])();
- struct operation *optab;
- char *get_skip();
- char *tab_parse();
- char *unbackslash();
- long tab_long();
-
- optab = Optab[LASTOBJ][index];
- if (get_skip(buf, BUFSIZ, fp) == NULL)
- return O_FAIL;
- if (buf[0] == '.') {
- for (i = 0; Optrans[i].name[0]; i++) {
- if (strncmp(buf+1,Optrans[i].name,strlen(Optrans[i].name)) == 0) {
- Optab[LASTOBJ][index] = Optrans[i].op;
-#ifdef _DEBUG
- _debug(stderr, "Intern func(%s) at %d\n",Optrans[i].name, index);
-#endif
- return O_OK;
- }
- }
-#ifdef _DEBUG
- _debug(stderr, "UNKNOWN BUILT-IN OP: %s\n", buf);
-#endif
- return O_FAIL;
- }
-
- p = tab_parse(&optab->opername, buf);
- (void) unbackslash(optab->opername);
- optab->but = tab_long(&p, 16) - 1;
- optab->func_type = tab_long(&p, 16);
- optab->intern_func = tab_long(&p, 16);
- if (optab->intern_func < 0 || optab->intern_func >= MAX_IFUNCS || Function[optab->intern_func] == NULL) {
-#ifdef _DEBUG
- _debug(stderr, "Intern func num out of range: %d\n", optab->intern_func);
-#endif
- optab->intern_func = IF_BADFUNC;
- }
- p = tab_parse(&optab->extern_func, p);
- optab->op_type = tab_long(&p, 16);
- optab->multiple = tab_long(&p, 16);
- optab->all_mask = tab_long(&p, 16);
- if (p && *p) {
- optab->none_mask = tab_long(&p, 16);
-#ifdef _DEBUG
- _debug(stderr,
- "PARSED FUNC: %s %x %x %x %s %x %x %x %x at %d\n",
- optab->opername,
- optab->but,
- optab->func_type,
- optab->intern_func,
- optab->extern_func,
- optab->op_type,
- optab->multiple,
- optab->all_mask,
- optab->none_mask,
- index);
-#endif
- return O_OK;
- }
-#ifdef _DEBUG
- _debug(stderr, "Bad Func Def line '%s'\n", buf);
-#endif
- return O_FAIL;
-}
-
-#ifndef WISH
-
-int
-ootwrite(objtype, file)
-char *objtype, *file;
-{
- FILE *fp;
- struct one_part *p;
- struct opt_entry *prt;
- struct operation **oot;
- register int i, j;
-
- extern struct one_part Parts[MAXPARTS];
- extern char *Oasys;
-
- struct operation **obj_to_oot();
- struct opt_entry *obj_to_opt();
- char *esc_nl();
- time_t time(), t; /* EFT abs k16 */
- char *ctime();
-
- if (objtype == NULL || *objtype == '\0') { /* dump all objects */
- char path[PATHSIZ];
- for (i=0; i < MAX_TYPES; i++) {
- if (Partab[i].objtype == NULL || Partab[i].objtype[0] == '\0')
- continue;
- sprintf(path,"%s/info/OH/internals/%s", Oasys, Partab[i].objtype);
- ootwrite(Partab[i].objtype, path);
- }
- return(O_OK);
- }
-
- if ((oot = obj_to_oot(objtype)) == NULL)
- return(O_FAIL);
-
- if ((prt = obj_to_opt(objtype)) == NULL)
- return(O_FAIL);
-
- if ((fp = fopen(file, "w")) == NULL)
- return(O_FAIL);
-
- time(&t);
- fprintf(fp, "#\n# Object Definition Dump of object type %s\n", objtype);
- fprintf(fp, "# Dump date: %s#\n", ctime(&t));
- fprintf(fp, "%s\t%x\t%s\t%s\t%s\t%s\t%s\n",
- (prt->objdisp && prt->objdisp[0])?prt->objdisp:"-",
- prt->int_class,
- prt->oeu, prt->objformat, prt->objapp, prt->objprod,
- prt->objclass);
-
- fprintf(fp, "#\n# Part Definitions\n#\n");
- fprintf(fp, "%d\n", prt->numparts);
- for (i = 0; i < prt->numparts; i++) {
- p = Parts + prt->part_offset+i;
- fprintf(fp, "%s\t%s\t%x\n", p->part_name,
- p->part_template, p->part_flags);
- }
- fprintf(fp, "#\n# Operation Definitions\n#\n");
-
- for (i = 0; i < MAX_OPERS && oot[i] != NULL; i++) {
- /* find alias if one exists */
- for (j = 0; Optrans[j].op; j++)
- if (Optrans[j].op == oot[i])
- break;
- if (Optrans[j].op)
- fprintf(fp, ".%s\n# ", Optrans[j].name);
- fprintf(fp, "%s\t%d\t%x\t%x\t%s\t%x\t%d\t%x\t%x\n",
- esc_nl(oot[i]->opername), oot[i]->but + 1, oot[i]->func_type,
- oot[i]->intern_func,
- oot[i]->extern_func?oot[i]->extern_func:"none", oot[i]->op_type,
- oot[i]->multiple, oot[i]->all_mask, oot[i]->none_mask);
- }
- fclose(fp);
-}
-
-char *
-esc_nl(s)
-char *s;
-{
- static char news[MAX_WIDTH];
- char *ns = &news[0];
-
- if (s == NULL || *s == '\0')
- return("none");
-
- while (*s) {
- if (*s != '\n')
- *ns = *s;
- else {
- *ns++ = '\\';
- *ns = 'n';
- }
- s++;
- ns++;
- }
- *ns = '\0';
- return(&news[0]);
-}
-#endif
diff --git a/usr/src/cmd/fmli/oh/opt_rename.c b/usr/src/cmd/fmli/oh/opt_rename.c
deleted file mode 100644
index 4fa6b32068..0000000000
--- a/usr/src/cmd/fmli/oh/opt_rename.c
+++ /dev/null
@@ -1,84 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-/*
- * Copyright (c) 1985 AT&T
- * All Rights Reserved
- */
-
-#ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.3 */
-
-#include <stdio.h>
-#include <string.h>
-#include <sys/types.h> /* EFT abs k16 */
-#include "but.h"
-#include "wish.h"
-#include "sizes.h"
-#include "typetab.h"
-#include "ifuncdefs.h"
-#include "optabdefs.h"
-#include "partabdefs.h"
-
-bool
-opt_rename(entry, newbase, allnames)
-struct ott_entry *entry[MAXOBJPARTS+1];
-char *newbase;
-char allnames[MAXOBJPARTS][FILE_NAME_SIZ];
-{
- char *part_construct();
- register int i = 0, n = 0;
- struct opt_entry *partab;
- int part_offset;
- char *base, *p;
- extern struct one_part Parts[MAXPARTS];
- struct opt_entry *obj_to_parts();
- char *part_match();
-
-
- if ((partab = obj_to_parts(entry[0]->objtype)) == NULL)
- return(O_FAIL);
- part_offset = partab->part_offset;
-
- if (base = part_match(entry[0]->name, Parts[part_offset].part_template)) {
- strcpy(allnames[n++],
- part_construct(newbase, Parts[part_offset+i].part_template));
- if (++entry == NULL)
- return(O_OK);
- } else
- return(O_FAIL);
-
- for (i = 1; i < partab->numparts; i++) {
- p = part_construct(base, Parts[part_offset+i].part_template);
- if (strcmp(entry[0]->name, p) == 0) {
- strcpy(allnames[n++],
- part_construct(newbase, Parts[part_offset+i].part_template));
- if (++entry == NULL)
- return(O_OK);
- } else if (!(Parts[part_offset+i].part_flags & PRT_OPT) ) {
- return(O_FAIL);
- }
- }
- return(O_OK);
-}
diff --git a/usr/src/cmd/fmli/oh/optab.c b/usr/src/cmd/fmli/oh/optab.c
deleted file mode 100644
index 0d611a1025..0000000000
--- a/usr/src/cmd/fmli/oh/optab.c
+++ /dev/null
@@ -1,251 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-/*
- * Copyright (c) 1985 AT&T
- * All Rights Reserved
- */
-
-#ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.3 */
-
-/* Note: this file created with tabstops set to 4.
- *
- * Definition of the internal Object Operations Table (OOT).
- */
-
-#include <stdio.h>
-#include <sys/types.h> /* EFT abs k16 */
-#include "wish.h"
-#include "but.h"
-#include "typetab.h"
-#include "ifuncdefs.h"
-#include "optabdefs.h"
-
-/* The following static char's are used to both make this table more
- * readable, and also to save memory, since in many cases the same
- * labels will appear for different objects, and this way they will
- * be shared
- */
-
-/* these are for most normal objects */
-
-static char Op_null[] = "";
-static char Op_view[] = ""; /* viewing init function */
-static char Op_sh[] = ""; /* selection handler */
-static char Op_cv[] = ""; /* veiwing/ascii conversions */
-static char Op_ex[] = ""; /* exit function */
-static char Op_open[] = "OPEN";
-static char Op_cp[] = "COPY";
-static char Op_pr[] = "PRINT";
-static char Op_rn[] = "RENAME";
-static char Op_mv[] = "MOVE";
-static char Op_unsc[] = "UNSCRAMBLE";
-static char Op_sc[] = "SCRAMBLE";
-static char Op_unrm[] = "UNDELETE";
-static char Op_rm[] = "DELETE";
-
-
-/* these define null and illegal operations */
-
-struct operation No_op =
- {Op_null,NOBUT,F_NOP,0,NULL,0,FALSE,NOMASK,NOMASK};
-struct operation Illeg_op =
- {Op_null,NOBUT,F_ILL,0,NULL,0,FALSE,NOMASK,NOMASK};
-
-/* these are specific to directories */
-
-/** To save space, common internal operations are assigned static vars to be
- ** used in the table, thus reducing table size by about a factor of 2.
- **/
-
-/** general operations which can apply to most objects **/
-
-struct operation Obj_view = /* viewing init function */
- { Op_view, NOBUT, F_INT, IF_VI, NULL, OP_SNG,
- FALSE, NOMASK, NOMASK
- };
-
-struct operation Obj_sh = /* selection handler */
- { Op_sh, NOBUT, F_INT, IF_SH, NULL, OP_BUT,
- FALSE, NOMASK, NOMASK
- };
-
-struct operation Obj_cp =
- { Op_cp, BUT2, F_INT, IF_CP, NULL, OP_NEW|OP_DIR,
- FALSE, NOMASK, M_VF|M_RO|M_WB
- };
-
-struct operation Obj_rn =
- { Op_rn, BUT4, F_INT, IF_RN, NULL, OP_NEW,
- FALSE, NOMASK, M_VF|M_RO|M_WB
- };
-
-struct operation Obj_mv =
- { Op_mv, BUT5, F_INT, IF_MV, NULL, OP_DIR,
- FALSE, NOMASK, M_VF|M_RO|M_WB
- };
-
-struct operation Obj_sc =
- { Op_sc, BUT6, F_INT, IF_SC,NULL, OP_SNG,
- FALSE, NOMASK, M_RO|M_VF|M_EN|M_ZL|M_WB
- };
-
-struct operation Obj_unsc =
- { Op_unsc, BUT6, F_INT, IF_UNSC,NULL, OP_SNG,
- FALSE, M_EN, M_RO|M_VF|M_ZL|M_WB
- };
-
-struct operation Obj_rm =
- { Op_rm, BUT1R, F_INT, IF_RM, NULL, OP_SNG,
- FALSE, NOMASK, M_VF|M_RO|M_WB
- };
-
-struct operation Obj_unrm =
- { Op_unrm, BUT1R, F_INT, IF_UNRM, NULL, OP_SNG,
- FALSE, NOMASK, M_VF|M_RO
- };
-
-/** operations pertaining to directories **/
-
-struct operation Dir_view =
- { Op_view, NOBUT, F_INT, IF_DVI, NULL, OP_SNG, FALSE, NOMASK, NOMASK};
-struct operation Dir_sh =
- { Op_sh, NOBUT, F_INT, IF_DSH, NULL, OP_BUT, FALSE, NOMASK, NOMASK};
-struct operation Dir_ex =
- { Op_ex, NOBUT, F_INT, IF_DEX, NULL, OP_SNG, FALSE, NOMASK, NOMASK};
-static struct operation Dir_open =
- { Op_open, BUT1R, F_INT, IF_DED,NULL, OP_SNG, FALSE, M_OB3, M_WB|M_BR|M_ZL|M_RO};
-
-static struct operation Dir_mv =
- { Op_mv, BUT1R, F_INT, IF_DMV,NULL, OP_CUR, FALSE, M_OB3, M_WB|M_BR|M_ZL|M_RO};
-
-static struct operation Dir_rm =
- { Op_rm, BUT2R, F_INT, IF_DRM,NULL, OP_CUR, FALSE, NOMASK, M_WB|M_BR|M_ZL|M_RO};
-
-static struct operation Dir_rn =
- { Op_rn, BUT3R, F_INT, IF_DRN, NULL, OP_NEW, FALSE, NOMASK, M_OB3|M_WB|M_BR|M_ZL|M_RO};
-
-static struct operation Dir_cp =
- { Op_cp, BUT3R, F_INT, IF_DCP, NULL, OP_NEW|OP_CUR, FALSE, NOMASK, M_OB3|M_WB|M_BR|M_ZL|M_RO};
-
-/** operations pertaining to ascii files**/
-
-struct operation Ascii_cv =
- { Op_cv, NOBUT, F_INT, IF_ACV, NULL, OP_SNG, FALSE, NOMASK, NOMASK};
-struct operation Ascii_pr =
- { Op_pr, BUT3, F_INT, IF_APR, NULL, OP_SNG, FALSE, NOMASK, M_VF|M_EN|M_ZL|M_WB};
-struct operation Ascii_open =
- { Op_open, BUT1, F_INT, IF_AED, NULL, OP_SNG, FALSE, NOMASK, M_VF|M_EN|M_RO|M_WB};
-
-/** operations pertaining to menu objects */
-
-static struct operation Menu_open =
- { Op_open, NOBUT, F_INT, IF_MENOPEN,NULL,OP_SNG, FALSE, M_OB3, M_WB|M_BR|M_ZL|M_RO};
-
-/** operations pertaining to text objects */
-
-static struct operation Text_open =
- { Op_open, NOBUT, F_INT, IF_HLPOPEN,NULL,OP_SNG, FALSE, M_OB3, M_WB|M_BR|M_ZL|M_RO};
-
-/** operations pertaining to form objects */
-
-static struct operation Form_open =
- { Op_open, NOBUT, F_INT, IF_FRMOPEN,NULL,OP_SNG, FALSE, M_OB3, M_WB|M_BR|M_ZL|M_RO};
-
-/** operations pertaining to executable objects */
-
-static struct operation Exec_open =
- { Op_open, BUT1R, F_INT, IF_EED,NULL, OP_SNG, FALSE, M_OB3, M_WB|M_BR};
-
-
-/*** IMPORTANT NOTE: The entries in this table must be in the same
- *** order as the entries in the Object Parts Table (partab.c),
- *** because that is used as an indexing mechanism into this table!
- ***/
-
-struct operation *Optab[MAX_TYPES][MAX_OPERS] = {
-
- /** DIRECTORY **/
-{
-&Dir_view, &Dir_sh, &Dir_ex, &Illeg_op,
-&Dir_open, &Dir_mv, &Dir_cp, &Dir_rn, &Obj_rm, &Obj_unrm,
-NULL
-},
-
- /** ASCII **/
-{
-&Obj_view, &Obj_sh, &Illeg_op, &Ascii_cv,
-&Ascii_open, &Obj_cp, &Obj_rn, &Obj_mv, &Obj_sc, &Obj_unsc, &Ascii_pr,
-&Obj_rm, &Obj_unrm,
-NULL
-},
-
- /** MENU **/
-{
-&Obj_view, &Obj_sh, &Illeg_op, &Ascii_cv,
-&Menu_open, &Obj_cp, &Obj_rn, &Obj_mv, &Obj_sc, &Obj_unsc, &Ascii_pr, &Obj_rm,
-&Obj_unrm,
-NULL
-},
-
- /** FORM **/
-{
-&Obj_view, &Obj_sh, &Illeg_op, &Ascii_cv,
-&Form_open, &Obj_cp, &Obj_rn, &Obj_mv, &Obj_sc, &Obj_unsc, &Ascii_pr, &Obj_rm,
-&Obj_unrm,
-NULL
-},
-
- /** TEXT **/
-{
-&Obj_view, &Obj_sh, &Illeg_op, &Ascii_cv,
-&Text_open, &Obj_cp, &Obj_rn, &Obj_mv, &Obj_sc, &Obj_unsc, &Ascii_pr,
-&Obj_rm, &Obj_unrm,
-NULL
-},
-
- /** EXECUTABLE **/
-{
-&No_op, &Obj_sh, &Illeg_op, &No_op,
-&Exec_open, &Obj_cp, &Obj_rn, &Obj_mv, &Obj_sc, &Obj_unsc, &Obj_rm, &Obj_unrm,
-NULL
-},
-
- /** TRANSFER **/
-{
-&No_op, &Obj_sh, &Illeg_op, &No_op,
-&Obj_cp, &Obj_rn, &Obj_mv, &Obj_sc, &Obj_unsc, &Obj_rm, &Obj_unrm,
-NULL
-},
-
- /** UNKNOWN **/
-{
-&No_op, &Obj_sh, &Illeg_op, &No_op,
-&Obj_cp, &Obj_rn, &Obj_mv, &Obj_sc, &Obj_unsc, &Obj_rm, &Obj_unrm,
-NULL
-},
-
-NULL
-};
diff --git a/usr/src/cmd/fmli/oh/optabfuncs.c b/usr/src/cmd/fmli/oh/optabfuncs.c
deleted file mode 100644
index 5b2e2ce3e2..0000000000
--- a/usr/src/cmd/fmli/oh/optabfuncs.c
+++ /dev/null
@@ -1,85 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-/*
- * Copyright (c) 1985 AT&T
- * All Rights Reserved
- */
-
-#ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.6 */
-
-#include <stdio.h>
-#include <string.h>
-#include <sys/types.h> /* EFT abs k16 */
-#include "but.h"
-#include "wish.h"
-#include "typetab.h"
-#include "ifuncdefs.h"
-#include "optabdefs.h"
-#include "partabdefs.h"
-
-extern bool No_operations;
-extern int Vflag;
-
-/* functions pertaining to the object operations table (oot) and object parts
- * table (opt).
- */
-
-struct operation **
-oot_get()
-{
- extern struct operation *Optab[MAX_TYPES][MAX_OPERS];
- void fcn_init();
-
- fcn_init();
- odftread();
- return((struct operation **)Optab);
-}
-
-struct operation **
-obj_to_oot(objtype)
-char *objtype;
-{
- register int i;
- extern struct operation *Optab[MAX_TYPES][MAX_OPERS];
- extern struct opt_entry Partab[MAX_TYPES];
-
- for (i = 0; i < MAX_TYPES && Partab[i].objtype; i++) {
- if (strcmp(objtype, Partab[i].objtype) == 0 ) {
- if (!Vflag && !(Partab[i].int_class & CL_FMLI))
- return(NULL);
- if (i != MAX_TYPES-1 || No_operations == FALSE)
- return(Optab[i]);
- }
- }
-
- if (ootread(objtype) == O_FAIL) {
- return(NULL);
- } else {
- _debug(stderr, "External read of %s succeeded\n", objtype);
- No_operations = FALSE;
- return(Optab[MAX_TYPES - 1]);
- }
-}
diff --git a/usr/src/cmd/fmli/oh/ott_mv.c b/usr/src/cmd/fmli/oh/ott_mv.c
deleted file mode 100644
index a5633ca3c6..0000000000
--- a/usr/src/cmd/fmli/oh/ott_mv.c
+++ /dev/null
@@ -1,244 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-
-/*
- * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-/* Copyright (c) 1984, 1985 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-#include <stdio.h>
-#include <string.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include "wish.h"
-#include "sizes.h"
-#include "typetab.h"
-#include "partabdefs.h"
-
-extern struct ott_tab *Cur_ott;
-extern struct ott_entry *Cur_entry;
-
-static void recurrent();
-
-int
-ott_mv(entry, path, name, move)
-struct ott_entry *entry;
-char *path;
-char *name;
-bool move;
-{
- struct ott_tab *oldtab;
- register int i;
- int numparts = 0;
- char newnames[MAXOBJPARTS][FILE_NAME_SIZ];
- struct ott_entry *entries[MAXOBJPARTS+1];
- struct opt_entry *optab, *obj_to_opt();
- char oldpath[PATHSIZ], dname[DNAMESIZ];
- int part_offset;
- int pathlen;
- char source[PATHSIZ], destination[PATHSIZ];
- struct ott_entry *name_to_ott(), *ott_next_part();
- extern struct one_part Parts[MAXPARTS];
- struct ott_entry *ott_dup();
- struct stat buffer, *buf;
- extern char *part_match(), *ott_to_path(); /* abs 9/12/88 */
-
-#ifdef _DEBUG
- _debug(stderr, "IN OTT_MV(%s/%s, %s, %s, %d)\n", entry->dirpath, entry->name, path, name, move);
-#endif
-
- if ((entry = name_to_ott(entry->name)) == NULL) {
- return(O_FAIL);
- }
-
- if (!name || !name[0] || strcmp(name, entry->name) == 0)
- strcpy(dname, entry->dname);
- else
- *dname = '\0';
- /** keep the current ott path for later restoration **/
-
- if (path == NULL || strcmp(path, Cur_ott->path) == 0)
- oldpath[0] = '\0';
- else
- strcpy(oldpath, Cur_ott->path);
-
- /* cannot copy to same directory if name is the same */
-
- if (oldpath[0] == '\0' && (name == NULL || strcmp(name, entry->name)==0)) {
-#ifdef _DEBUG
- _debug(stderr, "ott_copy: cannot copy name to same dir\n");
-#endif
- return(O_FAIL);
- }
-
- /** Because various routines could invalidate the pointers inside the
- ** entry pionter, the first thing to do is to copy all the parts of
- ** that object to a stable place.
- **/
-
- do {
- entries[numparts++] = ott_dup(entry);
- entry = ott_next_part(entry);
- } while (entry);
- entries[numparts] = NULL;
- if (move) { /* do stat on old file to redo ownership and group */
- buf = &buffer;
- if (stat(ott_to_path(entries[0]), buf) == -1)
- buf = NULL;
- }
-
- if (name && name[0]) {
- if (opt_rename(entries, name, newnames) == O_FAIL) {
-#ifdef _DEBUG
- _debug(stderr, "Ott rename fail in ott_copy\n");
-#endif
- return(O_FAIL);
- }
- } else {
- for (i=0; i < numparts; i++)
- strcpy(newnames[i], entries[i]->name);
- }
- if (path)
- strcpy(destination, path);
- else
- strcpy(destination, Cur_ott->path);
- pathlen = strlen(destination);
- destination[pathlen++] = '/';
- /* make sure all parts do not exist */
- for (i = 0; i < numparts; i++) {
- strcpy(destination + pathlen, newnames[i]);
-#ifdef _DEBUG
- _debug(stderr, "access of destination %s checked\n", destination);
-#endif
- if (access(destination, 04) != -1)
- return(O_FAIL);
- }
-
- /** get the destination ott if it is not the same as the current
- ** ott.
- **/
-
- if (oldpath[0]) {
- ott_lock_inc(NULL); /* lock incore, we will restore later */
- make_current(path);
- }
-
- if ((optab = obj_to_opt(entries[0]->objtype)) == NULL) {
- recurrent(oldpath);
- return(O_FAIL);
- }
- part_offset = optab->part_offset;
-
- if (!(*dname))
- strcpy(dname, part_match(newnames[0], Parts[part_offset].part_template));
- if (name_to_ott(newnames[0]) != NULL)
- return(O_FAIL);
- ott_add_entry(NULL, newnames[0], dname,
- entries[0]->objtype, entries[0]->objmask,entries[0]->odi, NULL);
- for (i = 1; i < numparts; i++) {
- ott_add_entry(NULL, newnames[i],
- NULL, entries[i]->objtype,
- entries[i]->objmask, entries[i]->odi, NULL);
- }
- ott_synch(FALSE);
-
- /* physically move the UNIX files */
-
- for (i = 0; i < numparts; i++) {
- /* this code can be enhanced to only strcpy the dest once */
- if (path)
- strcpy(destination, path);
- else
- strcpy(destination, entries[i]->dirpath);
- strcat(destination, "/");
- strcat(destination, newnames[i]);
- strcpy(source, ott_to_path(entries[i]));
- if (Parts[part_offset+i].part_flags & PRT_DIR) {
- if (path) {
- if (waitspawn(spawn("/bin/mkdir", "/bin/mkdir", destination, 0)) != 0) {
- recurrent(oldpath);
- return(O_FAIL);
- }
- } else {
- if (waitspawn(spawn("/bin/mv", "/bin/mv", "-f", source, destination, 0)) != 0) {
- recurrent(oldpath);
- return(O_FAIL);
- }
- }
- } else {
- if (move) {
- if (movefile(source, destination) != 0) {
- recurrent(oldpath);
- return(O_FAIL);
- }
- } else {
- if (copyfile(source, destination) != 0) {
- recurrent(oldpath);
- return(O_FAIL);
- }
- }
- }
- }
- /* must reget entry and DONT use old file owner and group of a copy */
- /* DO if a move (could have a dir as a part */
- if (path)
- strcpy(destination, path);
- else
- strcpy(destination, entries[0]->dirpath);
- strcat(destination, "/");
- strcat(destination, name);
- if (move && buf)
- change_owns(destination, NULL, &buf->st_uid, &buf->st_gid);
- else
- change_owns(destination, NULL, NULL, NULL);
- if (move) {
- for (i = 0; i < numparts; i++) {
- if ((Parts[part_offset+i].part_flags & PRT_DIR) && !path)
- waitspawn(spawn("/bin/rmdir", "/bin/rmdir", ott_to_path(entries[i])));
- }
- }
-
- recurrent(oldpath);
-
- for (i = 0; i < numparts; i++)
- ott_free(entries[i]);
-
- return(O_OK);
-}
-
-static void
-recurrent(oldpath)
-char *oldpath;
-{
- if (!(*oldpath))
- return;
- Cur_ott->last_used -= 2; /* swapping penalty */
- make_current(oldpath);
- ott_unlock_inc(NULL);
-}
-
diff --git a/usr/src/cmd/fmli/oh/partab.c b/usr/src/cmd/fmli/oh/partab.c
deleted file mode 100644
index 2b5a949818..0000000000
--- a/usr/src/cmd/fmli/oh/partab.c
+++ /dev/null
@@ -1,82 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-
-/*
- * Copyright (c) 1985 AT&T
- * All Rights Reserved
- */
-
-#ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.5 */
-
-/* Note: this file created with tabstops set to 4.
- *
- * Definition of the Object Parts Table (OPT).
- *
- */
-
-#include <stdio.h>
-#include <sys/types.h> /* EFT abs k16 */
-#include "wish.h"
-#include "but.h"
-#include "typetab.h"
-#include "ifuncdefs.h"
-#include "optabdefs.h"
-#include "partabdefs.h"
-
-
-/*** NOTE: the ordering of the objects in this table must be the same
- *** as the order in the object operations table (In optab.c), as this table is
- *** used as an index into that table.
- ***/
-
-struct opt_entry Partab[MAX_TYPES] =
-{
- { "DIRECTORY", "File folder", CL_DIR, "?", "?", "?", "?", "?", 0, 2},
- { "ASCII", "Standard file",CL_DOC, "?", "?", "?", "?", "?", 2, 1},
- { "MENU", "Menu", CL_DYN | CL_FMLI,"?", "?", "?", "?", "?", 3, 1},
- { "FORM", "Form", CL_FMLI, "?", "?", "?", "?", "?", 4, 1},
- { "TEXT", "Text", CL_FMLI, "?", "?", "?", "?", "?", 5, 1},
- { "EXECUTABLE", "Executable", CL_FMLI, "?", "?", "?", "?", "?", 7, 1},
- { "TRANSFER", "Foreign file", CL_OEU, "?", "?", "?", "?", "?", 6, 1},
- { "UNKNOWN", "Data file", NOCLASS, "?", "?", "?", "?", "?", 7, 1},
- { "", "", NOCLASS, NULL, NULL, NULL, NULL, NULL, 0, 0}
-};
-
-/* the "magic" numbers in the "%.ns" below (2nd field) are based on
- * a max file name size of 255.
- */
-struct one_part Parts[MAXPARTS] =
-{
- {"1", "%.255s", PRT_DIR}, /* 0 DIRECTORY */
- {"2", "%.249s/.pref", PRT_FILE|PRT_OPT}, /* 1 */
- {"1", "%.255s", PRT_FILE}, /* 2 ASCII */
- {"1", "Menu.%.250s", PRT_FILE}, /* 3 MENU */
- {"1", "Form.%.250s", PRT_FILE}, /* 4 FORM */
- {"1", "Text.%.250s", PRT_FILE}, /* 5 TEXT */
- {"1", "%.255s", PRT_FILE|PRT_BIN}, /* 6 TRANSFER */
- {"1", "%.255s", PRT_FILE|PRT_BIN}, /* 7 UNKNOWN/EXEC*/
- {"", "", 0}
-};
diff --git a/usr/src/cmd/fmli/oh/partabfunc.c b/usr/src/cmd/fmli/oh/partabfunc.c
deleted file mode 100644
index d22c439ffc..0000000000
--- a/usr/src/cmd/fmli/oh/partabfunc.c
+++ /dev/null
@@ -1,150 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-/*
- * Copyright (c) 1985 AT&T
- * All Rights Reserved
- */
-
-#ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.5 */
-
-#include <stdio.h>
-#include <string.h>
-#include <sys/types.h> /* EFT abs k16 */
-#include "but.h"
-#include "wish.h"
-#include "sizes.h"
-#include "typetab.h"
-#include "ifuncdefs.h"
-#include "optabdefs.h"
-#include "partabdefs.h"
-
-extern size_t strlen();
-
-char *
-part_match(name, template)
-char *name, *template;
-{
- char pre[FILE_NAME_SIZ], suf[FILE_NAME_SIZ];
- char name1[FILE_NAME_SIZ];
- char *p;
- static char retstr[FILE_NAME_SIZ];
- int matchlen = FILE_NAME_SIZ;
- int len;
-
- p = pre;
-
- while (*template && (*template != '%' || *(template+1) == '%')) {
- *p++ = *template++;
- }
-
- *p = '\0';
-
- if (*template == '%') {
- if (*(++template) == '.')
- matchlen = atoi(++template);
- if (matchlen == 0)
- matchlen = FILE_NAME_SIZ;
- while (*template && *template >= '0' && *template <= '9')
- template++;
- if (*template == 's') {
- template++;
- }
- }
-
- p = suf;
-
- while (*template && *template != '/')
- *p++ = *template++;
-
- *p = '\0';
-
- if (*template == '/') {
- if ((p = strchr(name, '/')) == NULL)
- return(NULL);
- strncpy(name1, name, name-p);
- name1[name-p] = '\0';
- } else {
- strcpy(name1, name);
- }
-
- if (*pre)
- {
- if ((int)strlen(name1) < (int)strlen(pre) || /* EFT k16 */
- strncmp(name1, pre, strlen(pre)) != 0)
- {
- return(NULL);
- }
- }
-
- if (*suf)
- {
- if (!has_suffix(name1+strlen(pre), suf))
- {
- return(NULL);
- }
- }
- /* EFT k16.. */
- if ((int)strlen(name1) > matchlen + (int)strlen(pre) + (int)strlen(suf))
- {
- return(NULL);
- }
-
- strncpy(retstr, name+strlen(pre),
- (len=strlen(name)-strlen(pre)-strlen(suf)));
- retstr[len] = '\0';
-
- if (*template == '/') {
- sprintf(name1, ++template, retstr);
- if (strcmp(++p, name1) != 0)
- return(NULL);
- }
-
- return(retstr);
-}
-
-char *
-part_construct(name, template)
-char *name, *template;
-{
- static char result[FILE_NAME_SIZ];
-
- sprintf(result, template, name, name);
- return(result);
-}
-
-char *
-objparent(base, objtype)
-char *base;
-char *objtype;
-{
- struct opt_entry *partab, *obj_to_parts();
- struct one_part *apart, *opt_next_part();
-
- if ((partab = obj_to_parts(objtype)) == NULL)
- return(NULL);
- apart = opt_next_part(partab);
- return(part_construct(base, apart->part_template));
-}
diff --git a/usr/src/cmd/fmli/oh/path_to_vp.c b/usr/src/cmd/fmli/oh/path_to_vp.c
deleted file mode 100644
index d15750f512..0000000000
--- a/usr/src/cmd/fmli/oh/path_to_vp.c
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-/*
- * Copyright (c) 1985 AT&T
- * All Rights Reserved
- */
-#ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.3 */
-
-#include <stdio.h>
-#include <sys/types.h> /* EFT abs k16 */
-#include "wish.h"
-#include "typetab.h"
-#include "optabdefs.h"
-#include "obj.h"
-#include "sizes.h"
-
-extern struct operation Ascii_cv, Unknown_cv, Illeg_op, No_op;
-static char Holdpath[PATHSIZ];
-
-char *
-path_to_vpath(path)
-char *path;
-{
- struct ott_entry *entry;
- extern char *Oasys;
- static char *viewdir = "/info/OH/view/";
- struct operation **obj_to_oot();
- struct operation *convert;
- struct ott_entry *path_to_ott();
-
- if ((entry = path_to_ott(path)) == NULL)
- return(NULL);
- convert = obj_to_oot(entry->objtype)[OF_MV];
-
- if (entry->objmask & M_EN) {
- strcpy(Holdpath, Oasys);
- strcat(Holdpath, viewdir);
- strcat(Holdpath, "scram.view");
- } else if (convert == &Ascii_cv) /* ascii convert uses file itself*/
- return(path);
- else if (convert == &Unknown_cv) /* unknown convert uses object type*/
- sprintf(Holdpath, "%s%sv.%s", Oasys, viewdir, entry->objtype);
- else if (convert == &Illeg_op || convert == &No_op)
- return(NULL);
- else
- sprintf(Holdpath, "%s/.v%s", entry->dirpath, entry->name);
-
- return(Holdpath);
-}
diff --git a/usr/src/cmd/fmli/oh/pathfstype.c b/usr/src/cmd/fmli/oh/pathfstype.c
deleted file mode 100644
index e961993dc3..0000000000
--- a/usr/src/cmd/fmli/oh/pathfstype.c
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-/*LINTLIBRARY*/
-#ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.1 */
-
-/*
- * This function returns the identifier of the filesystem that
- * the path arguement resides on. If any errors occur, it
- * return s5 as a default.
- */
-
-#include <sys/types.h>
-#include <sys/statfs.h>
-#include <sys/fstyp.h>
-#include <sys/fsid.h>
-
-static char fs_buf[FSTYPSZ];
-static char fs_default[]="s5";
-
-char *
-path_to_fstype(path)
-char *path;
-{
- struct statfs stat_buf;
-
- if ( statfs(path,&stat_buf,sizeof(struct statfs),0) ) {
- return(fs_default);
- }
-
- if ( sysfs(GETFSTYP,stat_buf.f_fstyp,fs_buf) ) {
- return(fs_default);
- }
-
- return(fs_buf);
-}
diff --git a/usr/src/cmd/fmli/oh/pathott.c b/usr/src/cmd/fmli/oh/pathott.c
deleted file mode 100644
index ba4a732a28..0000000000
--- a/usr/src/cmd/fmli/oh/pathott.c
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-
-/*
- * Copyright (c) 1985 AT&T
- * All Rights Reserved
- */
-#ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.8 */
-
-#include <stdio.h>
-#include <sys/types.h> /* EFT abs k16 */
-#include "typetab.h"
-#include "sizes.h"
-
-extern int Vflag;
-
-struct ott_entry *
-path_to_ott(path)
-char *path;
-{
- register char *name;
- register struct ott_entry *entry;
- struct ott_entry *name_to_ott();
- struct ott_entry *dname_to_ott();
- char *filename();
- char *parent();
- char *nstrcat();
- char *path_to_title();
-
- if (make_current(parent(path)) == O_FAIL) {
- if (Vflag)
- mess_temp(nstrcat("Could not open folder ",
- path_to_title(parent(path), NULL, MESS_COLS-22), NULL));
- else
- mess_temp("Command unknown, please try again");
- return(NULL);
- }
- if ((entry = name_to_ott(name = filename(path))) == NULL &&
- (entry = dname_to_ott(name)) == NULL) {
- /*
- * Backedup the changes to test the valid fmli name
- */
- /*
- if ( strncmp("Text", name, 4) == 0 ||
- strncmp("Menu", name, 4) == 0 ||
- strncmp("Form", name, 4) == 0 ) */
- /* Changed the message. Removed the word object */
- mess_temp(nstrcat("Could not access ", name, NULL));
- /*
- else
- mess_temp("Command unknown, please try again"); */
- return(NULL);
- }
- return(entry);
-}
diff --git a/usr/src/cmd/fmli/oh/pathtitle.c b/usr/src/cmd/fmli/oh/pathtitle.c
deleted file mode 100644
index aed575aaf5..0000000000
--- a/usr/src/cmd/fmli/oh/pathtitle.c
+++ /dev/null
@@ -1,103 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-/*
- * Copyright (c) 1985 AT&T
- * All Rights Reserved
- */
-
-#ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.4 */
-
-#include <stdio.h>
-#include <string.h>
-#include "wish.h"
-#include "sizes.h"
-
-
-/*
- * note: This subroutine depends on the fact that its argument is
- * a legal UNIX path, i.e., slash separated strings.
- */
-char *
-path_to_title(str, pre, width)
-char *str;
-char *pre;
-int width;
-{
- static char title[MAX_WIDTH];
- register int len;
- extern char *Home;
- char *strchr();
-
- if (width <= 0)
- width = MAX_TITLE;
- if (pre == NULL) /* face fun and games */
- pre = Home;
- if (pre != NULL)
- { /* clip off pre */
- len = strlen(pre);
- if (strncmp(str, pre, len) == 0 && str[len] == '/')
- str += len + 1;
- }
- if ((len = strlen(str)) >= width) {
- register char *part; /* a component of the path */
- register int tcount;
-
- /* replace part(s) of it by "..." */
- part = str + width / 2;
- while (*part != '/' && part > str)
- part--;
- tcount = ++part - str;
- strncpy(title, str, tcount);
- /*
- * title now has all the leading components of the path..
- * ..that fit completely in half of the desired width
- */
- strcpy(&title[tcount], "..."); /* show something is missing */
- /*
- * if there are trailing components that fit in the second half..
- * ..tack them on
- */
- if (part = strchr(&str[len - width + tcount + 3], '/')) /* abs */
- strcat(title, part);
- else /* tack on as much of the last component as fits. abs */
- {
- part = &str[len];
- while (*(--part) != '/')
- ;
- if (part <= str + tcount) /* orig. cut removed last component */
- {
- title[tcount-1] = NULL; /* -1 to prevent double // */
- strncat(title, part, width -tcount -3);
- }
- else
- strncat(title, part, width - tcount -6);
- strcpy(&title[width-4], "...");
- }
- }
- else
- strcpy(title, str);
- return title;
-}
diff --git a/usr/src/cmd/fmli/oh/scram.c b/usr/src/cmd/fmli/oh/scram.c
deleted file mode 100644
index 1b265bec20..0000000000
--- a/usr/src/cmd/fmli/oh/scram.c
+++ /dev/null
@@ -1,425 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License (the "License").
- * You may not use this file except in compliance with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-
-/*
- * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-/* Copyright (c) 1984, 1985, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-#include <curses.h>
-#define _SYS_TERMIO_H /* sys/termio.h is included by curses.h */
-#include <fcntl.h>
-#include <string.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <stdlib.h>
-#include "wish.h"
-#include "vtdefs.h"
-#include "token.h"
-#include "obj.h"
-#include "typetab.h"
-#include "partabdefs.h"
-#include "parse.h"
-#include "retcds.h"
-#include "exception.h"
-#include "terror.h"
-#include "winp.h"
-#include "moremacros.h"
-#include "sizes.h"
-
-#define KEYSIZE 101
-
-extern char *Home;
-
-static unsigned char Keycheck[KEYSIZE];
-static char Passwd[20];
-static char Keyprompt[35];
-static char Srcfile[PATHSIZ];
-static int cryptit(), mkencrypart();
-static char scram_string[] = "scramble";
-static char uscram_string[] = "unscramble";
-static int check_key();
-static int crypt_file();
-static int pack();
-static int unpack();
-static int keysave();
-static int keyvalid();
-static void regetkey();
-
-/*
- * scram -- Scramble an object and pack all its parts into an OEU package
- */
-int
-scram(file)
-register char *file;
-{
-
- strcpy(Keyprompt, "Please enter scramble key: ");
- strcpy(Srcfile, file);
- get_string(regetkey, Keyprompt, "",
- I_INVISIBLE, FALSE, scram_string, scram_string);
- return (0);
-}
-
-/*
- * unscram -- Unscramble an object which was packed into an OEU package before
- */
-int
-unscram(file)
-register char *file;
-{
- int keysave();
-
- strcpy(Keyprompt, "Please enter unscramble key: ");
- strcpy(Srcfile, file);
- get_string(keysave, Keyprompt, "",
- I_INVISIBLE, FALSE, uscram_string, uscram_string);
- return (0);
-}
-
-static void
-regetkey(s, t)
-char *s;
-token t;
-{
- int keyvalid();
-
- if (t == TOK_CANCEL)
- return;
-
- strcpy(Passwd, s);
- get_string(keyvalid, "Please re-enter scramble key: ", "",
- I_INVISIBLE, FALSE, scram_string, scram_string);
-}
-
-static int
-keyvalid(s, t)
-char *s;
-token t;
-{
- struct ott_entry *entry, *path_to_ott();
- struct stat buf;
-
- if (t == TOK_CANCEL)
- return (SUCCESS);
-
- if (strcmp(Passwd, s) != 0) {
- mess_temp("The two scramble keys are different.");
- get_string(regetkey, Keyprompt, "",
- I_INVISIBLE, FALSE, scram_string, scram_string);
- return (SUCCESS);
- } else {
- stat(Srcfile, &buf); /* return code check? */
- if ((entry = path_to_ott(Srcfile)) == NULL)
- return (FAIL);
- working(TRUE);
- if (mkencrypart() == FAIL ||
- crypt_file(entry, buf, FALSE) == FAIL ||
- pack(entry, buf) == FAIL)
- return (FAIL);
- else {
- ott_mark(entry, M_EN, TRUE);
- return (SUCCESS);
- }
- }
-}
-
-static int
-keysave(s, t)
-char *s;
-token t;
-{
- struct ott_entry *entry, *path_to_ott();
- char package[PATHSIZ];
- struct stat buf;
- int check_key();
-
- strcpy(Passwd, s);
- stat(Srcfile, &buf); /* return code check? */
- if ((entry = path_to_ott(Srcfile)) == NULL)
- return (FAIL);
- working(TRUE);
- strcpy(package, Home);
- strcat(package, "/tmp/.TMPorigin");
- if (unpack(entry, package) == FAIL) {
- unlink(package);
- return (FAIL);
- }
- if (check_key(entry) == SUCCESS) {
- crypt_file(entry, buf, TRUE);
- unlink(package);
- ott_mark(entry, M_EN, FALSE);
- } else {
- (void) pack(entry, buf);
- unlink(Srcfile);
- if (movefile(package, Srcfile))
- unlink(package);
- /* get_string(keysave, Keyprompt, "", */
- /* I_INVISIBLE, FALSE, scram_string, scram_string); */
- }
- return (SUCCESS);
-}
-
-static int
-unpack(entry, package)
-struct ott_entry *entry;
-char *package;
-{
- struct opt_entry *part_ent, *obj_to_opt();
- struct one_part *opt_next_part();
- char *filename(), *nameptr;
- char path[PATHSIZ], action[(PATHSIZ * 2) + 20];
- char *part_match();
- FILE *pipeptr, *popen();
-
- part_ent = obj_to_opt(entry->objtype);
- if (!part_ent) {
- warn(MUNGED, NULL);
- return (FAIL);
- }
- nameptr = part_match(filename(Srcfile),
- opt_next_part(part_ent)->part_template);
- movefile(Srcfile, package);
- sprintf(path, "%s/%s", entry->dirpath, nameptr);
- sprintf(action, "oeupkg -u -d %s -s %s", path, package);
- if ((pipeptr = popen(action, "r")) == NULL)
- fatal(NOPEN, action);
- /* abs:added cast */
- if (fgets((char *)Keycheck, KEYSIZE, pipeptr) == NULL)
- return (FAIL);
- Keycheck[KEYSIZE - 1] = 0; /* ?? */
- pclose(pipeptr);
- return (SUCCESS);
-}
-
-static int
-pack(entry, buf)
-struct ott_entry *entry;
-struct stat buf;
-{
- char temp[PATHSIZ];
- char action[(PATHSIZ * 3) + 80];
- struct ott_entry *ptr, *ott_next_part(), *name_to_ott();
-
- strcpy(temp, Home);
- strcat(temp, "/tmp/.TMPscram");
- sprintf(action, "oeupkg -d %s -s %s -o %s -e %s",
- temp, Srcfile, entry->objtype, Keycheck);
- if (waitspawn(sysspawn(action)) != R_OK)
- return (FAIL);
-
- if (chmod(temp, buf.st_mode) == 0 &&
- chown(temp, buf.st_uid, buf.st_gid) == 0) {
- unlink(Srcfile);
- movefile(temp, Srcfile);
- }
- /* remove OTHER parts after packing */
- ptr = ott_next_part(entry);
- while (ptr) {
- unlink(ott_to_path(ptr));
- ott_mark(name_to_ott(ptr->name), M_DL, TRUE);
- ptr = ott_next_part(ptr);
- }
- /* dereference children from parent */
- ptr = name_to_ott(entry->name);
- ptr->next_part = OTTNIL;
- return (SUCCESS);
-}
-
-/*
- * crypt_file -- encrypt or decrypt using the UNIX "crypt" command
- */
-static int
-crypt_file(entry, buf, create_entry)
-struct ott_entry *entry;
-struct stat buf;
-int create_entry;
-{
-
- int i;
- char action[PATHSIZ + 40], temp[PATHSIZ];
- char path[PATHSIZ];
- char *part, *base;
- struct opt_entry *partab;
- struct ott_entry *orig_entry;
- extern struct one_part Parts[MAXPARTS];
-
- char *part_match(), *part_construct();
- struct opt_entry *obj_to_parts();
- struct ott_entry *ott_make_entry(), *name_to_ott();
-
- /* if either return NULL */
- if (!(partab = obj_to_parts(entry->objtype)) ||
- !(base = part_match(entry->name,
- Parts[partab->part_offset].part_template)))
- return (FAIL);
-
- for (i = 0, part = base; i < partab->numparts; i++,
- part = part_construct(base,
- Parts[partab->part_offset+i].part_template)) {
- sprintf(path, "%s/%s", entry->dirpath, part);
- if (access(path, 0))
- continue;
- strcpy(temp, Home);
- strcat(temp, "/tmp/.TMPcrypt");
- (void) close(open(temp, O_EXCL | O_CREAT | O_TRUNC, 0600));
- sprintf(action, "crypt '%s' < '%s' > '%s'", Passwd, path, temp);
- if (waitspawn(sysspawn(action)) != 0) {
- mess_temp("Encryption software not available");
- return (FAIL);
- }
- if (chmod(temp, buf.st_mode) == 0 &&
- chown(temp, buf.st_uid, buf.st_gid) == 0) {
- unlink(path);
- link(temp, path);
- }
- unlink(temp);
- /* if need to create an entry (unscrambling) */
- if (create_entry) {
- /* since calling other routines */
- part = strsave(part);
-#ifdef _DEBUG
- _debug(stderr, "creating entry for %s\n", part);
-#endif
- if ((i == 0) && (partab->numparts > 1)) {
- /* remake parent so can do children - IF children exist */
- orig_entry = name_to_ott(entry->name);
- orig_entry->objmask |= M_DL;
- entry = ott_make_entry(part,
- entry->dname, entry->objtype,
- entry->objmask, entry->odi, entry->mtime);
- /* dupped entry so don't need to & out ~M_DL */
- } else if (i != 0) /* add child */
- ott_make_entry(part, NULL, NULL,
- entry->objmask|partab->int_class,
- NULL, entry->mtime);
- free(part);
- /* NOTE: part has been freed if anything is added after this */
- }
- }
- if (create_entry && (partab->numparts > 1))
- ott_synch(FALSE);
- return (SUCCESS);
-}
-
-static int
-check_key(entry)
-struct ott_entry *entry;
-{
- int m, n;
- unsigned char buf[51];
- int left, right;
- char tempstr[3];
-
- tempstr[2] = '\0';
- for (m = 0; m < 50; m++)
- {
- n = m + m;
- tempstr[0] = Keycheck[n];
- tempstr[1] = Keycheck[n+1];
- buf[m] = (int)strtol(tempstr, NULL, 16);
- }
-
- if (cryptit(buf) == FAIL)
- return (FAIL);
-
- for (m = 0; m < 50; m++) {
- if (buf[m] > 0177) {
- char msg[PATHSIZ + 30];
-
- sprintf(msg, "Key does not unscramble %s",
- entry->dname);
- mess_temp(msg);
- return (FAIL); /* encrypted */
- }
- }
- return (SUCCESS); /* not encrypted */
-}
-
-static int
-mkencrypart()
-{
- register int n, m;
- char tempstr[3];
- unsigned char buf[51];
- unsigned int left, right;
- time_t clock; /* EFT abs k16 */
-
- clock = time((time_t *)0); /* EFT abs k16 */
- right = clock & 0177;
- buf[0] = right;
-
- for (n = 1; n < 50; n++) {
- right = (right + n + (right & 0125)) & 0177;
- if (right == 0177) right = n;
- buf[n] = right;
- }
-
- if (cryptit(buf) == FAIL)
- return (FAIL);
-
- for (m = 0; m < 50; m++) {
- static char hex[] = "0123456789abcdef";
-
- n = m * 2;
- Keycheck[n] = hex[(buf[m] >> 4) & 0xf];
- Keycheck[n+1] = hex[buf[m] & 0xf];
- }
- Keycheck[KEYSIZE - 1] = '\0';
- return (SUCCESS);
-}
-
-static int
-cryptit(buf)
-char *buf;
-{
- int fd;
- char efile[20], dfile[20];
- char action[(2 * PATHSIZ) + 80];
-
- strcpy(dfile, "/tmp/.DECXXXXXX");
- strcpy(efile, "/tmp/.ENCXXXXXX");
- if ((fd = mkstemp(efile)) < 0)
- fatal(NOPEN, efile);
- write(fd, buf, 50);
- (void) close(fd);
- if ((fd = mkstemp(dfile)) < 0)
- fatal(NOPEN, dfile);
- (void) close(fd);
- sprintf(action, "crypt '%s' < %s > %s", Passwd, efile, dfile);
- if (waitspawn(sysspawn(action)) != 0) {
- mess_temp("Encryption software not available");
- (void) unlink(efile);
- (void) unlink(dfile);
- return (FAIL);
- }
- unlink(efile);
- if ((fd = open(dfile, O_RDONLY)) < 0)
- fatal(NOPEN, dfile);
- read(fd, buf, 50);
- (void) close(fd);
- (void) unlink(dfile);
- return (SUCCESS);
-}
diff --git a/usr/src/cmd/fmli/oh/slk.c b/usr/src/cmd/fmli/oh/slk.c
deleted file mode 100644
index 8e0f9cfe84..0000000000
--- a/usr/src/cmd/fmli/oh/slk.c
+++ /dev/null
@@ -1,762 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License (the "License").
- * You may not use this file except in compliance with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/*
- * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-/* microsecond delay timer not available before SVR4.0 abs k18 */
-#ifdef PRE_SVR4_COMPILE
-#define DO_NOT_DELAY
-#endif
-
-#include <stdio.h>
-#include <curses.h>
-#include <term.h>
-#include <string.h> /* abs k17 */
-#include <sys/types.h> /* abs k17 */
-#include <unistd.h> /* abs k18 */
-#include <stdlib.h> /* abs k18 */
-#ifndef DO_NOT_DELAY
-#include <sys/time.h> /* abs k18 */
-#endif
-#include "wish.h"
-#include "token.h"
-#include "fm_mn_par.h"
-#include "slk.h"
-#include "ctl.h"
-#include "moremacros.h"
-#include "interrupt.h"
-
-struct slk Moreslk = {
- "CHG-KEYS", TOK_TOGSLK, NULL, NULL, NULL
-};
-
-struct slk Markslk = {
- "MARK", TOK_MARK, NULL, NULL, NULL
-};
-
-struct slk Blankslk = {
- "", TOK_NOP, NULL, NULL, NULL
-};
-
-struct slk Formslk[] = {
- {"HELP", TOK_HELP, NULL, NULL, NULL},
- {"CHOICES", TOK_OPTIONS, NULL, NULL, NULL},
- {"SAVE", TOK_DONE, NULL, NULL, NULL},
- {"PREV-FRM", TOK_PREV_WDW, NULL, NULL, NULL},
- {"NEXT-FRM", TOK_NEXT_WDW, NULL, NULL, NULL},
- {"CANCEL", TOK_CLOSE, NULL, NULL, NULL},
- {"CMD-MENU", TOK_CMD, NULL, NULL, NULL},
- {"", TOK_NOP, NULL, NULL, NULL},
- {NULL, TOK_NOP, NULL, NULL, NULL}
-};
-
-#define MARK 1
-
-struct slk Menuslk[] = {
- {"HELP", TOK_HELP, NULL, NULL, NULL},
- {"", TOK_NOP, NULL, NULL, NULL},/* MARK for mult. selections */
- {"ENTER", TOK_RETURN, NULL, NULL, NULL},
- {"PREV-FRM", TOK_PREV_WDW, NULL, NULL, NULL},
- {"NEXT-FRM", TOK_NEXT_WDW, NULL, NULL, NULL},
- {"CANCEL", TOK_CLOSE, NULL, NULL, NULL},
- {"CMD-MENU", TOK_CMD, NULL, NULL, NULL},
- {"", TOK_NOP, NULL, NULL, NULL},
- {NULL, TOK_NOP, NULL, NULL, NULL}
-};
-
-struct slk Textslk[] = {
- {"HELP", TOK_HELP, NULL, NULL, NULL},
- {"PREVPAGE", TOK_PPAGE, NULL, NULL, NULL},
- {"NEXTPAGE", TOK_NPAGE, NULL, NULL, NULL},
- {"PREV-FRM", TOK_PREV_WDW, NULL, NULL, NULL},
- {"NEXT-FRM", TOK_NEXT_WDW, NULL, NULL, NULL},
- {"CANCEL", TOK_CLOSE, NULL, NULL, NULL},
- {"CMD-MENU", TOK_CMD, NULL, NULL, NULL},
- {"", TOK_NOP, NULL, NULL, NULL},
- {NULL, TOK_NOP, NULL, NULL, NULL}
-};
-
-struct slk Echslk[] = { /* Enter/Cancel/Help slks */
- {"HELP", TOK_HELP, NULL, NULL, NULL},
- {"", TOK_BADCHAR, NULL, NULL, NULL},
- {"", TOK_BADCHAR, NULL, NULL, NULL},
- {"", TOK_BADCHAR, NULL, NULL, NULL},
- {"", TOK_BADCHAR, NULL, NULL, NULL},
- {"CANCEL", TOK_CANCEL, NULL, NULL, NULL},
- {"", TOK_BADCHAR, NULL, NULL, NULL},
- {"", TOK_BADCHAR, NULL, NULL, NULL},
- {"", TOK_BADCHAR, NULL, NULL, NULL},
- {"", TOK_BADCHAR, NULL, NULL, NULL},
- {"", TOK_BADCHAR, NULL, NULL, NULL},
- {"", TOK_BADCHAR, NULL, NULL, NULL},
- {"", TOK_BADCHAR, NULL, NULL, NULL},
- {"", TOK_BADCHAR, NULL, NULL, NULL},
- {"", TOK_BADCHAR, NULL, NULL, NULL},
- {"", TOK_BADCHAR, NULL, NULL, NULL},
- {NULL, TOK_NOP, NULL, NULL, NULL}
-};
-
-
-/*
- * FACE user interface Directory SLKS
- */
-struct slk Vmslk[] = {
- {"HELP", TOK_HELP, NULL, NULL, NULL},
- {"", TOK_NOP, NULL, NULL, NULL},
- {"ENTER", TOK_RETURN, NULL, NULL, NULL},
- {"PREV-FRM", TOK_PREV_WDW, NULL, NULL, NULL},
- {"NEXT-FRM", TOK_NEXT_WDW, NULL, NULL, NULL},
- {"CANCEL", TOK_CLOSE, NULL, NULL, NULL},
- {"CMD-MENU", TOK_CMD, NULL, NULL, NULL},
- {"", TOK_NOP, NULL, NULL, NULL},
- {"HELP", TOK_HELP, NULL, NULL, NULL},
- {"COPY", TOK_COPY, NULL, NULL, NULL},
- {"MOVE", TOK_MOVE, NULL, NULL, NULL},
- {"DELETE", TOK_DELETE, NULL, NULL, NULL},
- {"RENAME", TOK_REPLACE, NULL, NULL, NULL},
- {"CREATE", TOK_CREATE, NULL, NULL, NULL},
- {"SECURITY", TOK_SECURITY, NULL, NULL, NULL},
- {"", TOK_NOP, NULL, NULL, NULL},
- {NULL, TOK_NOP, NULL, NULL, NULL}
-};
-
-extern int Browse_mode;
-
-
-/*
- * FACE user interface Browse Mode SLKS
- */
-struct slk Browslk[] = { /* slks when browsing */
- {"HELP", TOK_HELP, NULL, NULL, NULL},
- {"", TOK_NOP, NULL, NULL, NULL},
- {"", TOK_NOP, NULL, NULL, NULL},
- {"PREV-FRM", TOK_PREV_WDW, NULL, NULL, NULL},
- {"NEXT-FRM", TOK_NEXT_WDW, NULL, NULL, NULL},
- {"CANCEL", TOK_CANCEL, NULL, NULL, NULL},
- {"CMD-MENU", TOK_CMD, NULL, NULL, NULL},
- {"SELECT", TOK_SELECT, NULL, NULL, NULL},
- {NULL, TOK_NOP, NULL, NULL, NULL}
-};
-
-#define CHG_KEYS 7 /* SLK number of first level CHG_KEYS */
-#define SECOND_LEVEL 8 /* number of slks displayable */
-#define ALT_CHG_KEYS 15 /* SLK number of second level CHG_KEYS */
-#define MAX_SLKS 16 /* total number of slks */
-
-struct slk No_slks[1];
-struct slk SLK_array[MAX_SLKS];
-struct slk Defslk[MAX_SLKS];
-struct slk *Curslk = &Defslk[0];
-static int SLK_level = 0;
-
-static void showslks();
-static bool sfk_prompt();
-
-extern int Vflag;
-
-/*
- * init_sfk tries to initialize the screen function keys for terminals
- * (like the att630) which do not have pre-defined screen function keys
- * It will not do anything if:
- * 1) the environment variable LOADPFK is set to anything other than
- * yes, true, or the null string (case insensitive) or
- * 2) the terminal does not support software downloading of these strings or
- * 3) if the terminal has predefined strings sent by the function keys.
- * 4) if, when prompted, the user responds with anything other than
- * "yes", "y", or "" (whitespace & extra words ignored.) Prompt only occurs
- * once per session and only if LOADPFK is not defined.
- *
- * NOTE: if the terminfo entry indicates a mandatory delay is needed
- * and there is no pad char then FMLI will insert the delay.
- * For some terminals (ex dmd 5620) this delay is appreciable
- * and should be avoided, when feasable, by downloading once then
- * setting LOADPFK=no.
- * IMPORTANT: remove the delay code (ifdef'd by DO_NOT_DELAY)
- * when curses gets smart enough to do delays right for
- * terminals like the dmd 5620 which do not have pad characters
- */
-
-int
-init_sfk(do_prompt)
-bool do_prompt; /* abs k18 */
-{
- char sequence[3];
- int i;
-#ifndef DO_NOT_DELAY
- char *sub_str;
- char *end_str; /* abs k18 */
- unsigned time_left; /* abs k18 */
- static struct itimerval delay_time; /* abs k18 */
- static long Mandatory_delay = 0L; /* abs k18 */
- static bool First_time = TRUE; /* abs k18 */
-#endif
- static bool Said_no = FALSE; /* abs k18 */
- char *load; /* abs k18 */
-
- sequence[0] = 'F' & 037; /* <control f> */
- sequence[2] = '\0';
-
- /* if we already prompted user and they said no then don't do anything */
-
- if (Said_no == TRUE) /* abs k18 */
- return (0); /* abs k18 */
-
- /* if LOADPFK is set in the environment, don't download function keys,
- * unless it is set to yes, true, or the null string. abs k18
- */
-
- if ( (load = getenv("LOADPFK")) && *load &&
- strCcmp(load, "yes") && strCcmp(load, "true")) /* abs k18 */
- return (0); /* user says don't mess with my keys! */
-
- if (load)
- do_prompt = FALSE; /* don't prompt if LOADPFK is set. abs k18 */
-
- if (!pkey_xmit || pkey_xmit == NULL) /* term can't transmit fn keys */
- return (0);
-#ifndef DO_NOT_DELAY
- if (First_time == TRUE) /* this block added k18 abs. */
- {
- First_time = FALSE;
- if (no_pad_char) /* can't create delay by sending pads */
- {
- /* look for mandatory delay
- * delays are coded $<nnn/> where n is a digit and
- * the slash, if present, means the delay is mandatory.
- */
-
- sub_str = pkey_xmit;
- while (sub_str = strchr(sub_str, '$'))
- if (*(++sub_str) == '<')
- {
- Mandatory_delay = strtol(&sub_str[1], &end_str, 10);
- if (end_str[0] != '/' || end_str[1] != '>')
- Mandatory_delay = 0L;
- }
- if (Mandatory_delay)
- {
- /* convert milliseconds to microseconds and seconds.
- * tv_usec must be less than 1,000,000. abs k18.2
- */
- delay_time.it_value.tv_usec = (Mandatory_delay % 1000L) * 1000L;
- delay_time.it_value.tv_sec = Mandatory_delay / 1000L;
- delay_time.it_interval.tv_sec = 0L;
- delay_time.it_interval.tv_usec = 0L;
- }
-
- }
- }
-
- /* don't want mailcheck to intefere with timer. abs k18 */
- time_left = alarm((unsigned)0);
-#endif
- if (!key_f1 || *key_f1 == NULL) /* if no pre-defined key 1 then assume
- * keys 2 - 8 not pre-defined either */
- {
- if (do_prompt == TRUE && (Said_no = sfk_prompt()) == TRUE) /* abs k18 */
- return (0); /* abs k18 */
-
-/* The following line was moved from below. This is where it belongs,
-** unfortunately the doupdate() to make the indicator visible
-** interferes with downloading 5620 pfk's (somehow?!) depending on whats
-** in the curses screen buffer. abs k18.2
-** working(TRUE);
-*/
- for (i = 1; i < 9; i++)
- {
- sequence[1] = '0' + i;
- putp(tparm(pkey_xmit, i, sequence));
- fflush(stdout);
-#ifndef DO_NOT_DELAY
- if (Mandatory_delay) /* abs k18 */
- {
- setitimer(ITIMER_REAL, &delay_time, NULL); /* abs k18 */
- pause(); /* abs k18 */
- }
-#endif
- }
- }
- else
- {
- if (!key_f2 || *key_f2 == NULL)
- {
- if (do_prompt == TRUE && (Said_no = sfk_prompt()) == TRUE) /* abs k18 */
- return (0); /* abs k18 */
- else /* abs k18 */
- do_prompt = FALSE; /* abs k18 */
- sequence[1] = '2';
- putp(tparm(pkey_xmit, 2, sequence));
- fflush(stdout);
-#ifndef DO_NOT_DELAY
- if (Mandatory_delay) /* abs k18 */
- {
- setitimer(ITIMER_REAL, &delay_time, NULL); /* abs k18 */
- pause(); /* abs k18 */
- }
-#endif
- }
- if (!key_f3 || *key_f3 == NULL)
- {
- if (do_prompt == TRUE && (Said_no = sfk_prompt()) == TRUE) /* abs k18 */
- return (0); /* abs k18 */
- else /* abs k18 */
- do_prompt = FALSE; /* abs k18 */
- sequence[1] = '3';
- putp(tparm(pkey_xmit, 3, sequence));
- fflush(stdout);
-#ifndef DO_NOT_DELAY
- if (Mandatory_delay) /* abs k18 */
- {
- setitimer(ITIMER_REAL, &delay_time, NULL); /* abs k18 */
- pause(); /* abs k18 */
- }
-#endif
- }
- if (!key_f4 || *key_f4 == NULL)
- {
- if (do_prompt == TRUE && (Said_no = sfk_prompt()) == TRUE) /* abs k18 */
- return (0); /* abs k18 */
- else /* abs k18 */
- do_prompt = FALSE; /* abs k18 */
- sequence[1] = '4';
- putp(tparm(pkey_xmit, 4, sequence));
- fflush(stdout);
-#ifndef DO_NOT_DELAY
- if (Mandatory_delay) /* abs k18 */
- {
- setitimer(ITIMER_REAL, &delay_time, NULL); /* abs k18 */
- pause(); /* abs k18 */
- }
-#endif
- }
- if (!key_f5 || *key_f5 == NULL)
- {
- if (do_prompt == TRUE && (Said_no = sfk_prompt()) == TRUE) /* abs k18 */
- return (0); /* abs k18 */
- else /* abs k18 */
- do_prompt = FALSE; /* abs k18 */
- sequence[1] = '5';
- putp(tparm(pkey_xmit, 5, sequence));
- fflush(stdout);
-#ifndef DO_NOT_DELAY
- if (Mandatory_delay) /* abs k18 */
- {
- setitimer(ITIMER_REAL, &delay_time, NULL); /* abs k18 */
- pause(); /* abs k18 */
- }
-#endif
- }
- if (!key_f6 || *key_f6 == NULL)
- {
- if (do_prompt == TRUE && (Said_no = sfk_prompt()) == TRUE) /* abs k18 */
- return (0); /* abs k18 */
- else /* abs k18 */
- do_prompt = FALSE; /* abs k18 */
- sequence[1] = '6';
- putp(tparm(pkey_xmit, 6, sequence));
- fflush(stdout);
-#ifndef DO_NOT_DELAY
- if (Mandatory_delay) /* abs k18 */
- {
- setitimer(ITIMER_REAL, &delay_time, NULL); /* abs k18 */
- pause(); /* abs k18 */
- }
-#endif
- }
- if (!key_f7 || *key_f7 == NULL)
- {
- if (do_prompt == TRUE && (Said_no = sfk_prompt()) == TRUE) /* abs k18 */
- return (0); /* abs k18 */
- else /* abs k18 */
- do_prompt = FALSE; /* abs k18 */
- sequence[1] = '7';
- putp(tparm(pkey_xmit, 7, sequence));
- fflush(stdout);
-#ifndef DO_NOT_DELAY
- if (Mandatory_delay) /* abs k18 */
- {
- setitimer(ITIMER_REAL, &delay_time, NULL); /* abs k18 */
- pause(); /* abs k18 */
- }
-#endif
- }
- if (!key_f8 || *key_f8 == NULL)
- {
- if (do_prompt == TRUE && (Said_no = sfk_prompt()) == TRUE) /* abs k18 */
- return (0); /* abs k18 */
- else /* abs k18 */
- do_prompt = FALSE; /* abs k18 */
- sequence[1] = '8';
- putp(tparm(pkey_xmit, 8, sequence));
- fflush(stdout);
-#ifndef DO_NOT_DELAY
- if (Mandatory_delay) /* abs k18 */
- {
- setitimer(ITIMER_REAL, &delay_time, NULL); /* abs k18 */
- pause(); /* abs k18 */
- }
-#endif
- }
-
- }
-#ifndef DO_NOT_DELAY
- alarm(time_left); /* reset alarm. abs k18 */
-#endif
- return (0);
-}
-
-
-static bool
-sfk_prompt()
-{
- char raw_input[80];
- char *response, *word_end;
- WINDOW *win;
- int cursor, x, y;
-
- win = newwin(0,0,1,0); /* almost full screen window */
- getmaxyx(win, y, x);
- wmove(win, y/2-6, 0); /* go to about the center row */
- cursor = curs_set(1); /* make cursor visible */
- flushinp();
-
- wprintw(win, "This terminal does not have usable default settings for its function keys;\nhowever, this application can download usable settings.\n\nIf you reply yes, function keys will work, BUT any values you may already \nhave programmed into them will be overwritten.\n\n");
- wprintw(win, "If you reply no, function keys may not work, and you must use CTRL-f1 \nthru CTRL-f8 to simulate the function keys.\n\nThis prompt will not occur if you set LOADPFK=YES or LOADPFK=NO in \nyour environment.\n\nDownload usable settings into the function keys [default is yes]? ");
-
- wrefresh(win);
- echo();
- wgetnstr(win, raw_input, 79);
- noecho();
- werase(win);
- wrefresh(win);
- delwin(win);
- (void)curs_set(cursor);
-
- response = raw_input;
- while (isspace(*response))
- response++;
- word_end = response; /* abs k18.2 */
- while (!isspace(*word_end) && *word_end != '\0') /* abs k18.2 */
- word_end++; /* abs k18.2 */
- *word_end = '\0'; /* abs k18.2 */
-
- if (*response && strCcmp(response, "y") && strCcmp(response, "yes"))
- {
- putenv("LOADPFK=NO"); /* so child fmli's don't prompt. abs k18.2 */
- return(TRUE); /* said no */
- }
- else
- {
- putenv("LOADPFK=YES"); /* so child fmli's don't prompt. abs k18.2 */
- return(FALSE); /* said yes */
- }
-}
-
-
-
-
-/*
- * SETUP_SLK_ARRAY will initialize defaults for the SLKS
- */
-int
-setup_slk_array()
-{
- register int i, j;
-
- for (i = 0; i < SECOND_LEVEL; i++)
- Defslk[i] = Menuslk[i];
-
- for (i = SECOND_LEVEL; i < MAX_SLKS; i++) {
- Defslk[i].label = nil;
- Defslk[i].tok = TOK_NOP;
- Defslk[i].tokstr = NULL;
- Defslk[i].intr = NULL;
- Defslk[i].onintr = NULL;
- }
- return (0);
-}
-
-#define REDEFINED(x) ((x).label && (*((x).label) != '\0' || (x).tok < 0))
-
-static void showslks();
-
-/*
- * SETSLKS will make "slks" the currently displayed SLKS
- */
-void
-setslks(slks, flag)
-struct slk slks[];
-int flag;
-{
- register int i, more_slks;
-
-#ifdef _DEBUG
- _debug(stderr, "in setslk!\n");
-#endif
- if (slks == NULL) { /* e.g., directory object */
- if (Vflag) { /* FACE specific slks */
- if (Browse_mode)
- setslks(Browslk, 0);
- else
- setslks(Vmslk, 0);
- }
- else { /* use menu slks by default */
- set_top_slks(Menuslk);
- setslks(Defslk, 0);
- }
- return;
- }
- else if (slks == No_slks) {
-#ifdef _DEBUG
- _debug(stderr, "slks are history\n");
-#endif
- SLK_level = -1;
- slk_clear();
- return;
- }
- more_slks = 0;
- for (i = 0; slks[i].label && i < MAX_SLKS; i++) {
- if (i >= SECOND_LEVEL && *(slks[i].label) != '\0')
- more_slks++;
-#ifdef _DEBUG
- _debug(stderr, "SLK_array[%d] = '%s'\n", i, slks[i].label);
-#endif
- SLK_array[i] = slks[i];
- }
-#ifdef _DEBUG
- if (slks[i].label)
- _debug(stderr, "setslks was passed an array without a NULL terminator\n");
-#endif
- while (i < MAX_SLKS)
- SLK_array[i++].label = nil;
- if (more_slks && !(REDEFINED(SLK_array[CHG_KEYS]) ||
- REDEFINED(SLK_array[ALT_CHG_KEYS])))
- SLK_array[CHG_KEYS] = SLK_array[ALT_CHG_KEYS] = Moreslk;
- showslks(flag);
-}
-
-int Refresh_slks = 0;
-
-/*
- * SHOWSLKS will do the actial displaying
- */
-static void
-showslks(flag)
-int flag;
-{
- register int i;
- register int j;
-
- if (SLK_level < 0) {
- Refresh_slks++;
- /*slk_restore(); defer to vt_flush() */
- }
- if (flag)
- SLK_level = j = SECOND_LEVEL;
- else
- SLK_level = j = 0;
- for (i = 1; i <= SECOND_LEVEL; i++)
- slk_set(i, SLK_array[j++].label, 1);
- slk_noutrefresh();
-}
-
-/*
- * SLK_TOKEN will determine the token action for a given SLK
- */
-token
-slk_token(t)
-token t;
-{
- register int n;
- int flags;
- char **arglist, **eval_string();
- char *intr, *onintr;
-
- n = t - TOK_SLK1 + SLK_level;
-#ifdef _DEBUG
- _debug(stderr, "slk %d is labeled '%s' and returns token %d\n", t, SLK_array[n].label,SLK_array[n].tok);
-#endif
- if (SLK_array[n].label && SLK_array[n].label[0])
- {
- if (SLK_array[n].tok >= 0) /* internally-defined */
- return(SLK_array[n].tok);
- else
- {
-
- /* update the interrupt structures based on
- the values for the current slk, if defined
- else with the inherited values.
- */
- Cur_intr.skip_eval = FALSE;
- if ((intr = SLK_array[n].intr) == NULL)
- intr = (char *)ar_ctl(AR_cur, CTGETINTR, NULL, NULL, NULL, NULL, NULL, NULL);
- flags = RET_BOOL;
- Cur_intr.interrupt = FALSE; /* dont intrupt eval of intr */
- Cur_intr.interrupt = (bool)(uintptr_t)eval_string(intr, &flags);
-
- if ((onintr = SLK_array[n].onintr) == NULL)
- onintr = (char *)ar_ctl(AR_cur, CTGETONINTR, NULL, NULL, NULL, NULL, NULL, NULL);
- Cur_intr.oninterrupt = onintr;
-
- flags = RET_ARGS;
- arglist = eval_string(SLK_array[n].tokstr, &flags);
- return(make_action(arglist));
- }
- }
- return TOK_BADCHAR;
-}
-
-int
-set_top_slks(slks)
-struct slk slks[];
-{
- register int i;
-
- for (i = 0; i < SECOND_LEVEL; i++)
- Defslk[i] = slks[i];
- return (0);
-}
-
-/*
- * SET_OBJ_SLK is called by objects that wish to redefine the
- * GLOBAL default SLKS ...
- * The object will pass a "slktok" in the range SLK1 - SLK16.
- * If a token in this range is "caught" by the object,
- * the object itself will determine the appropriate action.
- */
-int
-set_obj_slk(slk, label, slktok, intr, onintr)
-struct slk *slk;
-char *label;
-int slktok;
-char *intr, *onintr;
-{
- int slknum;
-
- if (label && (*label == '\0')) { /* disable any SLK */
- slk->label = "";
- slk->tok = -1;
- slk->tokstr = NULL;
- slk->intr = NULL;
- slk->onintr = NULL;
- }
- else {
- slknum = slktok - TOK_SLK1; /* (adjust for array offset) */
- if (slknum >= CHG_KEYS) { /* redefine certain SLKS */
- slk->label = strsave(label);
- /*
- * unfortunately this test needs to be made ...
- * (if odsh gets prevpage or nextpage its too late)
- * We must search for a better way !!!
- */
- if (strCcmp(label, "prevpage") == 0)
- slk->tok = TOK_PPAGE;
- else if (strCcmp(label, "nextpage") == 0)
- slk->tok = TOK_NPAGE;
- else if (strCcmp(label, "prev-frm") == 0)
- slk->tok = TOK_PREV_WDW;
- else if (strCcmp(label, "next-frm") == 0)
- slk->tok = TOK_NEXT_WDW;
- else if (strCcmp(label, "enter") == 0)
- slk->tok = TOK_RETURN;
- else
- slk->tok = slktok;
- slk->tokstr = NULL;
- slk->intr = strsave(intr);
- slk->onintr = strsave(onintr);
- }
- else { /* must use the defaults! */
- slk->label = Defslk[slknum].label;
- slk->tok = Defslk[slknum].tok;
- slk->tokstr = Defslk[slknum].tokstr;
- slk->tokstr = Defslk[slknum].intr;
- slk->tokstr = Defslk[slknum].onintr;
- }
- }
- return (0);
-}
-
-
-/*
- * SET_DEF_SLK will over-write the GLOBAL default SLKS
- */
-int
-set_def_slk(slknum, label, action, intr, onintr)
-int slknum;
-char *label;
-char *action;
-char *intr, *onintr;
-{
- /*
- * if less then CHG_KEYS do nothing (can't redefine first level)
- */
- if (label && (*label == '\0')) { /* disable any SLK */
- Defslk[slknum].label = "";
- Defslk[slknum].tok = -1;
- Defslk[slknum].tokstr = NULL;
- Defslk[slknum].intr = NULL;
- Defslk[slknum].onintr = NULL;
- }
- else if (slknum >= CHG_KEYS) { /* redefine certain SLKS */
- Defslk[slknum].label = strsave(label);
- Defslk[slknum].tok = -1;
- Defslk[slknum].tokstr = strsave(action);
- Defslk[slknum].intr = strsave(intr);
- Defslk[slknum].onintr = strsave(onintr);
- }
- /*
- * if SLK is at the first level, then change the object
- * SLKS to reflect the redefined or disabled SLK
- */
- if (slknum <= CHG_KEYS) {
- Formslk[slknum] = Defslk[slknum];
- Textslk[slknum] = Defslk[slknum];
- Menuslk[slknum] = Defslk[slknum];
- }
- return (0);
-}
-
-/*
- * SLK_TOGGLE will toggle the currently displayed SLKS
- */
-int
-slk_toggle(void)
-{
- showslks(!SLK_level);
- return (0);
-}
-
-int
-set_slk_mark(flag)
-int flag;
-{
- if (flag == TRUE)
- Menuslk[MARK] = Markslk;
- else
- Menuslk[MARK] = Blankslk;
- Defslk[MARK] = Menuslk[MARK];
- return (0);
-}
diff --git a/usr/src/cmd/fmli/oh/suffuncs.c b/usr/src/cmd/fmli/oh/suffuncs.c
deleted file mode 100644
index b518072332..0000000000
--- a/usr/src/cmd/fmli/oh/suffuncs.c
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-/*
- * Copyright (c) 1985 AT&T
- * All Rights Reserved
- */
-
-#ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.2 */
-
-#include <stdio.h>
-#include <sys/types.h>
-
-
-int
-has_suffix(str,suf)
-char *str, *suf;
-{
- char *p;
- p = str + strlen(str) - strlen(suf);
- if (strcmp(p, suf) == 0) {
- return(1);
- } else {
- return(0);
- }
-}
-
-/* the rest of this file is dead code abs
-char *
-rem_suffix(str, num, len)
-char *str; int num, len;
-{
- static char buf[len +1];
-
- strcpy(buf, str);
- buf[strlen(str)-num] = '\0';
- return((char *)buf);
-}
-
-char *
-add_suffix(str, suf, len)
-char *str, *suf;
-int len
-{
- static char buf[len +1];
- char *strcat();
-
- if (strlen(str) +strlen(suf) > Stray_siz )
- return((char *)NULL);
-
- return(strcat(strcpy(buf, str), suf));
-}
-
-*/
diff --git a/usr/src/cmd/fmli/oh/typefuncs.c b/usr/src/cmd/fmli/oh/typefuncs.c
deleted file mode 100644
index 4fbd74e0a9..0000000000
--- a/usr/src/cmd/fmli/oh/typefuncs.c
+++ /dev/null
@@ -1,258 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-/*
- * Copyright (c) 1985 AT&T
- * All Rights Reserved
- */
-
-#ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.5 */
-
-#include <stdio.h>
-#include <string.h>
-#include <fcntl.h>
-#include <ctype.h>
-#include <time.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <errno.h>
-#include "mio.h"
-#include "wish.h"
-#include "var_arrays.h"
-#include "typetab.h"
-#include "partabdefs.h"
-#include "moremacros.h"
-#include "sizes.h"
-
-
-char Holdpath[PATHSIZ];
-
-struct ott_entry *
-ott_dup(entry)
-struct ott_entry *entry;
-{
- char *def_display();
- struct ott_entry *newentry = (struct ott_entry *)
- array_create(sizeof(struct ott_entry), 1);
-
- if (!entry)
- return(NULL);
-
- memcpy(newentry, entry, sizeof(struct ott_entry));
-
- if (entry->dname)
- newentry->dname = strsave(entry->dname);
-
- if (entry->display && entry->objtype &&
- entry->display != def_display(entry->objtype))
- newentry->display = strsave(entry->display);
-
- if (entry->odi)
- newentry->odi = strsave(entry->odi);
-
- if (entry->dirpath)
- newentry->dirpath = strsave(entry->dirpath);
-
- return(newentry);
-}
-
-void
-ott_int_free(entry) /* free the internals of an ott_entry */
-struct ott_entry *entry;
-{
- char *def_display();
-
- if (entry->dname)
- free(entry->dname);
- if (entry->odi)
- free(entry->odi);
- if (entry->display && entry->objtype &&
- entry->display != def_display(entry->objtype))
- free(entry->display);
-}
-
-void
-ott_free(entry)
-struct ott_entry *entry;
-{
- if (!entry)
- return;
- if (entry->dirpath)
- /* can't be in ott_int_free because called by other things than
- * those that were ott_dup'd */
- free(entry->dirpath);
- ott_int_free(entry);
- array_destroy(entry);
-}
-
-char *
-ott_to_path(entry)
-struct ott_entry *entry;
-{
- strcpy(Holdpath, entry->dirpath);
- strcat(Holdpath, "/");
- strcat(Holdpath, entry->name);
- return(Holdpath);
-}
-
-void
-ott_mark(entry, mask, value)
-struct ott_entry *entry;
-long mask;
-bool value;
-{
- register int i;
- extern struct ott_tab *Cur_ott;
- extern struct ott_entry *Cur_entry;
- void ott_mtime();
-
- ott_lock_dsk(Cur_ott->path);
-
- if (value)
- entry->objmask |= mask;
- else
- entry->objmask &= ~mask;
- utime(ott_to_path(entry), NULL);
- ott_mtime(entry);
-
- /* if it is a parent, kill all children */
-
- if (entry->dname) {
- for(i = entry->next_part; i != OTTNIL; i = Cur_entry[i].next_part) {
- if (value)
- Cur_entry[i].objmask |= mask;
- else
- Cur_entry[i].objmask &= ~mask;
- utime(ott_to_path(&(Cur_entry[i])), NULL);
- ott_mtime(&(Cur_entry[i]));
- }
- }
- Cur_ott->modes |= OTT_DIRTY;
- ott_synch(FALSE);
-}
-
-void
-ott_mtime(entry) /* update the mod time on the entry */
-struct ott_entry *entry;
-{
- struct ott_entry *name_to_ott();
-
- extern struct ott_tab *Cur_ott;
- extern struct ott_entry *Cur_entry;
- struct stat sbuf;
-
- if (!Cur_ott || !Cur_entry)
- return;
-
- /* do nothing if mtime is not wrong */
- if (stat(ott_to_path(entry), &sbuf) == -1 || sbuf.st_mtime == entry->mtime)
- return;
-
- ott_lock_dsk(Cur_ott->path);
- if ((entry = name_to_ott(entry->name)) != NULL)
- entry->mtime = sbuf.st_mtime;
- Cur_ott->modes |= OTT_DIRTY;
- ott_synch(FALSE);
-}
-
-/* The next few functions change various fields of an ott entry */
-
-#define ODI_FLD 0
-#define OBJM_FLD 1
-#define DNAME_FLD 2
-#define DISPLAY_FLD 3
-
-static void
-ott_chg_item(entry, field)
-struct ott_entry *entry;
-short field;
-{
- extern struct ott_tab *Cur_ott;
- extern struct ott_entry *Cur_entry;
- struct ott_entry *name_to_ott();
- struct ott_entry *old_entry = entry;
- char *def_display();
- char *newodi = entry->odi;
- char *newdname = entry->dname;
- char *newdisplay = entry->display;
- long newobjm = entry->objmask;
-
- ott_lock_dsk(Cur_ott->path);
-
- if (old_entry != (entry = name_to_ott(entry->name)))
- { switch(field)
- { case ODI_FLD:
- if (entry->odi)
- free(entry->odi);
- entry->odi = strsave(newodi);
- break;
- case OBJM_FLD:
- entry->objmask = newobjm;
- break;
- case DNAME_FLD:
- if (entry->dname)
- free(entry->dname);
- entry->dname = strsave(newdname);
- break;
- case DISPLAY_FLD:
- if (entry->display && entry->objtype &&
- entry->display != def_display(entry->objtype))
- free(entry->display);
- entry->display = strsave(newdisplay);
- break;
- default: break;
- }
- }
- Cur_ott->modes |= OTT_DIRTY;
- ott_synch(FALSE);
-}
-
-void
-ott_chg_odi(entry)
-struct ott_entry *entry;
-{
- (void)ott_chg_item(entry, ODI_FLD);
-}
-
-void
-ott_chg_objm(entry)
-struct ott_entry *entry;
-{
- (void)ott_chg_item(entry, OBJM_FLD);
-}
-
-void
-ott_chg_dname(entry)
-struct ott_entry *entry;
-{
- (void)ott_chg_item(entry, DNAME_FLD);
-}
-
-void
-ott_chg_display(entry)
-struct ott_entry *entry;
-{
- (void)ott_chg_item(entry, DISPLAY_FLD);
-}
diff --git a/usr/src/cmd/fmli/oh/typetab.c b/usr/src/cmd/fmli/oh/typetab.c
deleted file mode 100644
index 2b9c1a9f62..0000000000
--- a/usr/src/cmd/fmli/oh/typetab.c
+++ /dev/null
@@ -1,1145 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/*
- * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-/* Copyright (c) 1984, 1985, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-#include <stdio.h>
-#include <string.h>
-#include <fcntl.h>
-#include <ctype.h>
-/*#include <sys/types.h> included by dirent.h abs */
-#include <dirent.h> /* changed from sys/dir.h abs */
-#include <sys/stat.h>
-#include <sys/times.h>
-#include <errno.h>
-#include "mio.h"
-#include "wish.h"
-#include "sizes.h"
-#include "typetab.h"
-#include "partabdefs.h"
-#include "var_arrays.h"
-#include "moremacros.h"
-
-
-/* This file contains a package of functions which manipulate object
- * type tables (ott's). The ott's are files (one per Telesystem
- * directory) which contain information about all objects in that
- * directory.
- *
- * See the liboh.a reference card for a description of the functions
- * in here.
- */
-
-#define HSIZE 512 /* hash table size, must be power of 2! */
-#define ODISIZ (2*PATHSIZ)
-#define NULLSTR ""
-
-/* some statics global to these internal routines */
-
-struct ott_tab Otts[MAX_OTT];
-struct ott_tab *Cur_ott; /* pointer to current tab in Ott */
-struct ott_entry *Cur_entry; /* pointer to current entry in Cur_ott */
-static int Creation_size = OTT_ENTRIES; /* number of entrys to create */
-static char Ott_version[] = "OTT V1.1\n"; /* file sys independent abs. */
-static char Ott_name[] = "/.ott";
-static int Ott_len = 5; /* strlen of above string */
-static int ott_use();
-static int ott_write();
-static int qhash();
-clock_t times(); /* EFT abs k16 */
-extern long a64l(); /* abs k16 */
-char *estrtok();
-
-
-static char *Scanenv;
-
-int
-scanbuf(buf, hold, max_len)
-char *buf, *hold;
-int max_len;
-{
- register char *p = estrtok(&Scanenv, buf, "|\n");
-
- hold[0] = '\0';
- if (!p)
- return(O_FAIL);
- strncpy(hold, p, max_len-1);
- hold[max_len-1] = '\0';
- return(0);
-}
-
-int
-scanhex(buf, var)
-char *buf;
-long *var;
-{
- register char *p = estrtok(&Scanenv, buf, "|");
- long strtol();
-
- if (!p)
- return(O_FAIL);
- *var = strtol(p, NULL, 16);
- return(0);
-}
-
-static int
-ott_read(path, readall)
-char *path;
-bool readall; /* read the .ott as well as cross indexing directory */
-{
- register int i, j, alldead;
- int size;
- bool convert = FALSE;
- FILE *ottfp;
- DIR *dirfp; /* abs */
- int recnum, result;
- char ottname[PATHSIZ], buf[BUFSIZ];
- char fname[FILE_NAME_SIZ]; /* abs */
- static char *found;
- short int qhtab[HSIZE]; /*quick hash table really kludgy but real easy*/
- struct ott_entry *name_to_ott();
- char *def_display();
-
- char name[FILE_NAME_SIZ], dname[DNAMESIZ], display[DISPSIZ],
- obtype[OTYPESIZ], odinfo[ODISIZ];
- long mask;
- time_t mtime; /* EFT abs k16 */
- int hindex, val;
- struct ott_entry *entry;
- struct stat sbuf, dirsbuf;
- struct dirent *dir_entry; /* for reading in the directory structure */
- struct tms timebuf; /* for keeping timing statistics */
- time_t stime, utime; /* EFT abs k16 */
- static char *stray; /* stray files, i.e. not in ott */
- times(&timebuf);
- stime = timebuf.tms_stime;
- utime = timebuf.tms_utime;
-
-#ifdef _DEBUG
- _debug(stderr, "READING: %s\n", path);
-#endif
- if ((dirfp = opendir(path)) == NULL || /* use fs independent funcs. abs */
- stat(path, &dirsbuf) == -1)
- {
-#ifdef _DEBUG
- _debug(stderr, "DIR open failed %s errno=%d\n", path,errno);
-#endif
-/* (void) fclose(dirfp); */
- return(O_FAIL);
- }
-
- memset(qhtab,0xff,HSIZE*sizeof(short int)); /* initialize hash table */
-
- if (found) /* the found array will be used to cross index the ott*/
- array_trunc(found);
- else {
- found = (char *) array_create(sizeof(char), Creation_size);
- array_ctl(found, OTT_ENTRIES);
- }
-
- if (readall) { /* is the following calculation valid?? <<<<<<<<<<<<< */
- Creation_size = dirsbuf.st_size/sizeof(struct dirent); /* <<<<<<<<<<<<< */
- ott_init(); /* get a new current ott */
- Cur_ott->dir_mtime = dirsbuf.st_mtime;
-
- if ((int)strlen(path) + Ott_len + 1 > PATHSIZ) { /* EFT abs k16 */
-#ifdef _DEBUG
- _debug(stderr, ".ott path too long for %s\n", path);
-#endif
- return(O_FAIL);
- }
- strcat(strcpy(ottname, path), Ott_name);
- Cur_ott->path = strsave(path);
- Cur_ott->modes = OTT_ACTIVE;
- Cur_ott->prefs = 0;
- Cur_ott->fmask = 0;
-
- ottfp = (FILE *)NULL;
- recnum = 0;
- if ((ottfp = fopen(ottname, "r")) != NULL &&
- (fstat(fileno(ottfp), &sbuf) != -1) ) {
-#ifdef _DEBUG
- _debug(stderr, "Opened ott fd=%d\n", (int)fileno(ottfp));
-#endif
- Cur_ott->ott_mtime = sbuf.st_mtime;
- if (fgets(buf, BUFSIZ, ottfp) && strcmp(buf, Ott_version) != 0) {
- Cur_ott->modes |= OTT_DIRTY;
- rewind(ottfp);
- }
- while (fgets(buf, BUFSIZ, ottfp) != NULL) {
- odinfo[0] = '\0';
-#ifdef _DEBUG
- _debug(stderr, ".");
-#endif
- if (scanbuf(buf, name, FILE_NAME_SIZ) ||
- scanbuf(NULL, dname, DNAMESIZ) ||
- scanbuf(NULL, display, DISPSIZ) ||
- scanbuf(NULL, obtype, OTYPESIZ) ||
- scanhex(NULL, &mask) ||
- scanhex(NULL, &mtime)) {
-
- Cur_ott->modes |= OTT_DIRTY; /* force rewrite */
- continue;
- }
- scanbuf(NULL, odinfo, ODISIZ); /* odi allowed to be null */
-
- Cur_entry = (struct ott_entry *) array_append(Cur_entry, NULL);
- Cur_ott->ott = Cur_entry;
- entry = Cur_entry + recnum;
-
- hindex = qhash(name);
- val = qhtab[hindex];
- if (val == -1)
- qhtab[hindex] = recnum;
- else
- qhtab[hindex] = recnum>val?val:recnum;
-
- /* the found array will be used later during the cross-index*/
- found = (char *) array_append(found, NULL);
- found[recnum] = 'n';
-
- strncpy(entry->name, name, FILE_NAME_SIZ);
- entry->name[FILE_NAME_SIZ - 1] = '\0';
- entry->dirpath = Cur_ott->path;
- if (obtype[0] == ' ')
- entry->objtype = NULL;
- else
- entry->objtype = strsave(obtype);
- entry->mtime = mtime;
- entry->next_part = OTTNIL;
-
- if (strcmp(dname, " ") == 0) {
- entry->dname = NULL;
- if (recnum > 0) {
- entry[-1].next_part = recnum;
- } else {
-#ifdef _DEBUG
- _debug(stderr, "Orphan\n");
-#endif
- continue;
- }
- } else {
- if (strcmp(dname, ".") == 0)
- entry->dname = strsave(entry->name);
- else {
- dname[DNAMESIZ - 1] = '\0';
- entry->dname = strsave(dname);
- }
- }
- if (strcmp(display, " ") == 0)
- entry->display = NULL;
- else if (strcmp(display, ".") == 0)
- entry->display = def_display(obtype);
- else
- entry->display = strsave(display);
- entry->objmask = mask;
- if (*odinfo)
- entry->odi = strsave(odinfo);
- else
- entry->odi = NULL;
- recnum++;
- }
- } else {
- Cur_ott->modes |= OTT_DIRTY;
-#ifdef _DEBUG
- _debug(stderr, "creating ott\n");
-#endif
- }
- Cur_ott->priority = recnum/15; /* favor bigger .ott's */
-
- if (ottfp)
- (void) fclose(ottfp);
- } else { /* ott already in core, just construct the cross-index array*/
- recnum = array_len(Cur_entry);
-
-#ifdef _DEBUG
- _debug(stderr, "Only doing cross-index\n");
-#endif
- Cur_ott->dir_mtime = dirsbuf.st_mtime;
- Cur_ott->fmask = 0;
- Cur_ott->prefs = 0;
- Cur_ott->modes = OTT_ACTIVE;
- for (i = 0; i < recnum; i++) {
- Cur_entry[i].objmask &= ~M_DL; /* undelete it: refigure */
- hindex = qhash(Cur_entry[i].name);
- val = qhtab[hindex];
- if (val == -1)
- qhtab[hindex] = i;
- else
- qhtab[hindex] = i>val?val:i;
-
- /* entry not found yet*/
-
- found = (char *)array_append(found, NULL);
- found[i] = 'n';
- }
- }
-
- if (Cur_ott->dir_mtime >= Cur_ott->ott_mtime) {
- /* Cross index the ott with the unix directory structure,
- * putting anything that is not found in the stray array.
- * The stray array will be passed to the heuristics program
- * to determine the type of object.
- */
-
- if (stray)
- array_trunc(stray); /* just reset. */
- else /* 1st time */
- {
- stray = (char *)array_create(FILE_NAME_SIZ, Creation_size/2 + 1);
- array_ctl(stray, OTT_ENTRIES/2);
- }
-
-/* skip . & ..
-** (void) fseek(dirfp,(long)(2*sizeof(struct direct)),0);
-** while (fread(&dir, sizeof(dir), 1, dirfp) > 0) {
-*/
- dir_entry = readdir(dirfp); /* skip "." abs */
- dir_entry = readdir(dirfp); /* skip ".." abs */
- while ((dir_entry = readdir(dirfp)) != NULL) /* abs */
- {
- if (dir_entry->d_ino == 0) /* file was deleted, skip it*/
- continue;
- strncpy(fname, dir_entry->d_name, FILE_NAME_SIZ);
- fname[FILE_NAME_SIZ -1] = '\0';
-
- i = qhtab[qhash(fname)];
- entry = NULL;
- if (i != -1) {
- for (; i < recnum; i++)
- if (strcmp(fname, Cur_entry[i].name) == 0) {
- entry = Cur_entry + i;
- break;
- }
- }
-
- if (entry != NULL) {
- found[entry - Cur_entry] = 'y';
- } else if (fname[0] != '.' ||
- strcmp(fname, ".ott") == 0 ||
- strcmp(fname, ".pref") == 0 ||
- strncmp(fname, ".V", 2) == 0 ||
- strncmp(fname, ".L", 2) == 0) {
-
-#ifdef _DEBUG
- _debug(stderr, "s");
-#endif
- stray = (char *) array_append(stray, fname);
- }
- }
- closedir(dirfp); /* abs */
-
- /* delete any entries in the ott which have no counterpart in the
- * directory.
- */
-
- size = array_len(found);
- for (i = 0; i < size; i++) {
- if (found[i] == 'n') { /* doesn't exist in unix dir, delete */
-
- /* skip parts that are in a subdirectory */
- if (strchr(Cur_entry[i].name, '/') && !Cur_entry[i].dname)
- continue;
- Cur_ott->modes |= OTT_DIRTY;
- if (Cur_entry[i].dname) { /* parent, kill only if all kids dead*/
- alldead = 1;
- j = i+1;
- while (j < recnum && ! Cur_entry[j].dname) {
- if (found[j] == 'y') {
- alldead = 0;
- break;
- }
- j++;
- }
- if (alldead) {
- do {
- Cur_entry[i].name[0] = '\0';
- Cur_entry[i++].objmask |= M_DL;
- } while (i < recnum && Cur_entry[i].dname == NULL);
- i--;
- }
- } else {
- Cur_entry[i].name[0] = '\0';
- Cur_entry[i].objmask |= M_DL;
- Cur_entry[i-1].next_part = Cur_entry[i].next_part;
- }
- }
- }
-
- /* run heuristics on the stray entries */
-
- if (array_len(stray) != 0) {
-#ifdef _DEBUG
- _debug(stderr, "\nHeur: %d files\n\n", array_len(stray));
-#endif
- heuristics(path, stray);
- Cur_ott->modes |= OTT_DIRTY;
- }
- } else {
-#ifdef _DEBUG
- _debug(stderr, "ott older than dir - no cross index\n");
-#endif
- closedir(dirfp); /* abs */
- }
-
- times(&timebuf);
-#ifdef _DEBUG
- _debug(stderr, "\nREAD TIME: %du + %ds = %d/100 secs ",
- (timebuf.tms_utime-utime), (timebuf.tms_stime-stime),
- (i = timebuf.tms_utime + timebuf.tms_stime - utime - stime));
- if ((readall && (j = array_len(Cur_entry))) || (j = array_len(stray)))
- _debug(stderr, "(%d/1000 per file)\n\n",(10*i)/j);
- else
- _debug(stderr, "\n");
-#endif
-
- if (name_to_ott(".pref") != NULL) {
- char buf[BUFSIZ];
- /* add 1 - here if adding /.ott short enough & /.pref is 1 more */
- char pref[PATHSIZ + 1];
- FILE *fp;
- long strtol();
-
-#ifdef _DEBUG
- _debug(stderr, "Reading .pref\n");
-#endif
- sprintf(pref, "%s/.pref", path);
- if ((fp = fopen(pref, "r")) == NULL) {
-#ifdef _DEBUG
- _debug(stderr, "no .pref\n");
-#endif
- return(O_OK);
- }
- while (fgets(buf, BUFSIZ, fp) != NULL) {
- if (strncmp(buf, "DISPMODE=", 9) == 0) {
- Cur_ott->prefs |= PREF_DIS;
- Cur_ott->modes |= strtol(buf+9, (char **)NULL, 16);
-#ifdef _DEBUG
- _debug(stderr, "DISP=%s (%x)\n", buf+9, strtol(buf+9,NULL,16));
-#endif
- } else if (strncmp(buf, "SORTMODE=", 9) == 0) {
- Cur_ott->prefs |= PREF_SORT;
- Cur_ott->modes |= strtol(buf+9, (char **)NULL, 16);
-#ifdef _DEBUG
- _debug(stderr, "SORT=%s (%x)\n", buf+9, strtol(buf+9,NULL,16));
-#endif
- } else if (strncmp(buf, "FMASK=", 6) == 0) {
- Cur_ott->fmask = strtol(buf+6, (char **)NULL, 10);
- } else if (strncmp(buf, "MAX_AGE=", 8) == 0) {
- ott_del_old(strtol(buf + 8, (char **) NULL, 10));
- } else if (strncmp(buf, "PRIORITY=", 9) == 0) {
- Cur_ott->priority = strtol(buf+9, (char **)NULL, 10);
- }
- }
- fclose(fp);
- }
-#ifdef _DEBUG
- else
- _debug(stderr, "No .pref\n");
-#endif
-
- if (Cur_ott->modes & OTT_DIRTY) {
-#ifdef _DEBUG
- _debug(stderr, "Writing ott\n");
-#endif
- ott_write();
- }
-
- return(O_OK);
-}
-
-int
-ott_del_old(age)
-long age;
-{
- int i;
- struct ott_entry *ent, *ott_next_part();
- time_t thetime; /* EFT abs k16 */
- int lcv;
-
- if (age < 1 || age > 365)
- return (0);
- thetime = time(NULL) - 24 * 60 * 60 * age;
-#ifdef _DEBUG
- _debug(stderr, "ctime(&thetime) = %s\n", ctime(&thetime));
-#endif
- lcv = array_len(Cur_ott->ott);
- for (i = 0; i < lcv; i++) {
- ent = Cur_ott->ott + i;
-/*
- * If we are doing a MAIL_OUT object, then we automatically age it
- */
- if (strcmp(ent->objtype, "MAIL_OUT") == 0)
- if (ent->mtime < thetime) {
- do {
- ent->objmask |= M_WB;
- Cur_ott->modes |= OTT_DIRTY;
- ent = ott_next_part(ent);
- } while (ent);
- }
- }
- return (0);
-}
-
-/* simple multiplicative hash function. This hashing algorithm is
- * really great as long as there are less than about 100 files in a
- * directory. It begins to degrade after that, and is about as
- * efficient as a linear search if the number of files goes beyond about
- * 300. It never gets worse than linear search. It is great because there
- * are no "buckets" a simple collision mechanism and quick search time.
- */
-
-static int
-qhash(str)
-char *str;
-{
- register int result = 511; /* why 511? why not. */
-
- while (*str) {
- result *= *str++;
- }
- return( (result>>8) & (HSIZE-1) ); /* take the middle bits */
-}
-
-struct ott_entry *
-ott_make_entry(name,dname,objtype,objmask,odi,mtime)
-char *name, *dname, *objtype;
-long objmask;
-char *odi;
-time_t mtime; /* EFT abs k16 */
-{
- struct ott_entry *entry;
- struct stat sbuf;
- char *def_display(), *def_objtype();
-
- Cur_entry = (struct ott_entry *)array_append(Cur_entry, NULL);
- Cur_ott->ott = Cur_entry;
- entry = Cur_entry + array_len(Cur_entry) - 1;
-
- strncpy(entry->name, name, FILE_NAME_SIZ);
-
- if (objtype && objtype[0]) {
- entry->objtype = def_objtype(objtype);
- entry->display = def_display(objtype);
- } else {
- entry->objtype = NULL;
- entry->display = NULL;
- }
-
- if ((int)strlen(dname) >= DNAMESIZ) /* EFT abs k16 */
- dname[DNAMESIZ-1] = '\0';
- if (dname && dname[0]) {
- entry->dname = strsave(dname);
- } else {
- entry->dname = NULL;
- entry[-1].next_part = entry - Cur_entry;
- }
-
- if (odi && odi[0])
- entry->odi = strsave(odi);
- else
- entry->odi = NULL;
-
- entry->next_part = OTTNIL;
- entry->objmask = objmask;
-
- if (mtime)
- entry->mtime = mtime;
- else {
- if (stat(name, &sbuf) != -1)
- entry->mtime = sbuf.st_mtime;
- else
- entry->mtime = time((time_t *) 0);
- }
- entry->dirpath = Cur_ott->path;
-
- Cur_ott->modes |= OTT_DIRTY; /* needs writing */
-
- return(entry);
-}
-
-struct ott_entry *
-ott_add_entry(ottpath, name, dname, objtype, mask, odi, mtime)
-char *ottpath, *name, *dname, *objtype;
-long mask;
-char *odi;
-time_t mtime; /* EFT abs k16 */
-{
- struct ott_entry *entry;
- struct ott_entry *name_to_ott();
-
- if (ottpath) {
- if (make_current(ottpath) == O_FAIL)
- return(NULL);
- }
- if (dname)
- ott_lock_dsk(Cur_ott->path);
-
- if (entry = name_to_ott(name)) {
-#ifdef _DEBUG
- _debug(stderr, "ott_add_entry: deleting previous entry for %s\n", entry->name);
-#endif
- entry->objmask |= M_DL; /* remove if already in */
- }
-
- return(ott_make_entry(name, dname, objtype, mask, odi, mtime));
-}
-
-static int
-ott_alphasort(el1, el2)
-int *el1, *el2;
-{
- int reverse = (Cur_ott->modes & OTT_SREV)?-1:1;
-
- return(reverse * strcmp(Cur_entry[*el1].dname, Cur_entry[*el2].dname));
-}
-
-static int
-ott_obj_alphasort(el1, el2)
-int *el1, *el2;
-{
- int comp1;
- int reverse = (Cur_ott->modes & OTT_SREV)?-1:1;
-
- if ((comp1 = strcmp(Cur_entry[*el1].display, Cur_entry[*el2].display)) == 0)
- return(ott_alphasort(el1, el2));
- else
- return(reverse * comp1);
-}
-
-static int
-ott_timesort(el1, el2)
-int *el1, *el2;
-{
- time_t time1, time2; /* EFT abs k16 */
- char *key, *odi_getkey();
- int reverse = (Cur_ott->modes & OTT_SREV)?-1:1;
-
- if (key = odi_getkey(Cur_entry + *el1, "DATE"))
- time1 = a64l(key);
- else
- time1 = Cur_entry[*el1].mtime;
- if (key = odi_getkey(Cur_entry + *el2, "DATE"))
- time2 = a64l(key);
- else
- time2 = Cur_entry[*el2].mtime;
- return(reverse * (time2 - time1));
-}
-
-int
-ott_dirty()
-{
- Cur_ott->modes |= OTT_DIRTY;
- return (0);
-}
-
-/*
- * Synchronize the current internal ott with the disk version. The ott
- * should always be locked during internal changes, so there should be
- * no problems with contention. This routine will sort the current ott,
- * then write it out to disk, then unlock it.
- */
-
-struct ott_tab *
-ott_synch(nosort)
-bool nosort; /* don't sort if not dirty */
-{
- register int size = array_len(Cur_entry);
- int i;
- long objmask, amask, nmask, smask;
-
- if (nosort && !(Cur_ott->modes & OTT_DIRTY))
- return(Cur_ott);
-
- if (Cur_ott->modes & OTT_DIRTY) {
- ott_lock_dsk(Cur_ott->path);
-#ifdef _DEBUG
- _debug(stderr, "ott_synch: writing dirty ott %s\n", Cur_ott->path);
-#endif
- ott_write();
- ott_unlock_dsk(Cur_ott->path);
- }
-
- /* scan the ott, keeping a list of parents */
-
- array_trunc(Cur_ott->parents);
- smask = Cur_ott->amask & Cur_ott->nmask;
- amask = Cur_ott->amask & ~smask;
- nmask = Cur_ott->nmask & ~smask;
-
- for (i = 0; i < size; i++) {
- objmask = Cur_entry[i].objmask;
-
- if ( Cur_entry[i].dname && Cur_entry[i].dname[0] &&
- Cur_entry[i].name[0] &&
- !(objmask & M_DL) &&
- ((amask & objmask)==amask) &&
- !(nmask & objmask) &&
- ((!smask) || (smask & objmask)) &&
- (Cur_entry[i].dname[0] != '.' || Cur_ott->modes & OTT_DALL))
- Cur_ott->parents = (int *)array_append(Cur_ott->parents, &i);
- }
-
- /* sort the array of parents */
-
-#ifdef _DEBUG
- if (Cur_ott->modes & OTT_SREV)
- _debug(stderr, "reverse ");
-#endif
-
- if (Cur_ott->modes & OTT_SALPHA) {
-#ifdef _DEBUG
- _debug(stderr, "alpha sort\n");
-#endif
- qsort((char *)Cur_ott->parents, array_len(Cur_ott->parents),
- sizeof(int), ott_alphasort);
- } else if (Cur_ott->modes & OTT_SMTIME) {
-#ifdef _DEBUG
- _debug(stderr, "modtime sort\n");
-#endif
- qsort((char *)Cur_ott->parents, array_len(Cur_ott->parents),
- sizeof(int), ott_timesort);
- } else if (Cur_ott->modes & OTT_SOBJ) {
-#ifdef _DEBUG
- _debug(stderr, "objtype sort\n");
-#endif
- qsort((char *)Cur_ott->parents, array_len(Cur_ott->parents),
- sizeof(int), ott_obj_alphasort);
- }
-#ifdef _DEBUG
- else
- _debug(stderr, "no sort\n");
-#endif
-
- if (Cur_ott->modes & OTT_DMAIL)
- Cur_ott->numpages = ((int)array_len(Cur_ott->parents)+5) / 6;
- else
- Cur_ott->numpages = ((int)array_len(Cur_ott->parents)+6) / 7;
-
- return(Cur_ott);
-}
-
-struct ott_tab *
-ott_get_current()
-{
- return(Cur_ott);
-}
-
-struct ott_tab *
-ott_reget()
-{
- return(ott_get(Cur_ott->path, Cur_ott->modes & SORTMODES, Cur_ott->modes & DISMODES, Cur_ott->amask, Cur_ott->nmask));
-}
-
-struct ott_tab *
-ott_get(path, sortmode, dismode, amask, nmask)
-char *path;
-int sortmode, dismode;
-long amask, nmask;
-{
- bool needsort = FALSE;
-
- if (make_current(path) == O_FAIL)
- return(NULL);
-
- /* if being opened with different modes than current modes, then
- * set and resort
- */
- if (Cur_ott->nmask != nmask || Cur_ott->amask != amask) {
- Cur_ott->nmask = nmask;
- Cur_ott->amask = amask;
- needsort = TRUE;
- }
- if (!(Cur_ott->prefs & PREF_SORT) &&
- ((Cur_ott->modes & SORTMODES) != sortmode)) {
- needsort = TRUE;
- Cur_ott->modes = (Cur_ott->modes & ~SORTMODES) | sortmode;
- }
- if (!(Cur_ott->prefs & PREF_DIS) &&
- ((Cur_ott->modes & DISMODES) != dismode)) {
- needsort = TRUE;
- Cur_ott->modes = (Cur_ott->modes & ~DISMODES) | dismode;
- }
- if (Cur_ott->prefs != 0)
- needsort = TRUE;
-
- if (needsort)
- ott_synch(FALSE);
- Cur_ott->curpage = 0;
- Cur_ott->last_used = ott_use() + Cur_ott->priority;
-#ifdef _DEBUG
- _debug(stderr, "Usetime: %d\n", Cur_ott->last_used);
-#endif
-
- return(Cur_ott);
-}
-
-int
-ott_in_core(path)
-char *path;
-{
- register int i;
-
- for (i = 0; i < MAX_OTT; i++)
- if ( Otts[i].path && (Otts[i].modes&OTT_ACTIVE) &&
- (strcmp(Otts[i].path, path) == 0) ) {
-#ifdef _DEBUG
- _debug(stderr, "Found %s incore\n", path);
-#endif
- return(i);
- }
- return(O_FAIL);
-}
-
-int
-make_current(path)
-char *path;
-{
- register int i;
- struct stat sbuf, dirsbuf;
- struct ott_entry *prefent, *name_to_ott();
- char ottname[PATHSIZ];
- int retcode;
- bool readall = TRUE;
- static int hits, trys;
-
- trys++;
- for (i = 0; i < MAX_OTT; i++) {
- if (!(Otts[i].path))
- continue;
- if ((Otts[i].modes & OTT_ACTIVE) && (strcmp(Otts[i].path, path) == 0)) {
-#ifdef _DEBUG
- _debug(stderr, "Found %s incore\n", path);
-#endif
- Cur_ott = Otts + i;
- Cur_entry = Cur_ott->ott;
- hits++;
-
- if (stat(path, &dirsbuf) == -1)
- return(O_FAIL);
- if ((int)strlen(Cur_ott->path) + Ott_len + 1 > PATHSIZ) /*EFT k16*/
- {
-#ifdef _DEBUG
- _debug(stderr, ".ott path too long for %s\n", Cur_ott->path);
-#endif
- return(O_FAIL);
- }
- strcat(strcpy(ottname, Cur_ott->path), Ott_name);
- if (stat(ottname, &sbuf) != -1 &&
- Cur_ott->ott_mtime < sbuf.st_mtime) {
-#ifdef _DEBUG
- _debug(stderr, "Incore old (.ott)\n");
-#endif
- Cur_ott->modes &= ~OTT_ACTIVE; /* deallocate */
- break; /* go down and read */
- } else if (Cur_ott->dir_mtime < dirsbuf.st_mtime) {
-#ifdef _DEBUG
- _debug(stderr, "Incore old (dir)\n");
-#endif
- readall = FALSE;
- break;
- } else {
-#ifdef _DEBUG
- _debug(stderr, "hit ratio: %d/%d (%d%%)\n",hits,trys,(100*hits)/trys);
-#endif
- return(O_OK);
- }
- }
- }
-
- /* not resident, so read it in */
-
- ott_lock_dsk(path);
- retcode = ott_read(path, readall);
- ott_unlock_dsk(path);
-
-#ifdef _DEBUG
- _debug(stderr, "hit ratio: %d/%d (%d%)\n",hits,trys,(100*hits)/trys);
-#endif
- return(retcode);
-}
-
-int
-ott_lock_inc(optr)
-struct ott_tab *optr;
-{
-#ifdef _DEBUG
- _debug(stderr, "%s: locked\n", Cur_ott->path);
-#endif
- if (optr == NULL)
- Cur_ott->modes |= OTT_LOCKED;
- else
- optr->modes |= OTT_LOCKED;
- return (0);
-}
-
-int
-ott_unlock_inc(optr)
-struct ott_tab *optr;
-{
-#ifdef _DEBUG
- _debug(stderr, "%s: unlocked\n", Cur_ott->path);
-#endif
- if (optr == NULL)
- Cur_ott->modes &= ~OTT_LOCKED;
- else
- optr->modes &= ~OTT_LOCKED;
- return (0);
-}
-
-int
-ott_lock_dsk(path)
-char *path;
-{
- return(O_OK);
-}
-
-int
-ott_unlock_dsk(path)
-char *path;
-{
- return(O_OK);
-}
-
-struct ott_entry *
-name_to_ott(name)
-char *name;
-{
- register int i, j;
- register int size = array_len(Cur_entry);
- register int psize= array_len(Cur_ott->parents);
-
- for (i = 0; i < size; i++)
- if (!(Cur_entry[i].objmask & M_DL) &&
- strcmp(Cur_entry[i].name, name) == 0) {
- for (j = 0; j < psize; j++) {
- if (Cur_ott->parents[j] == i) {
- if (Cur_ott->modes & OTT_DMAIL)
- Cur_ott->curpage = j/6;
- else
- Cur_ott->curpage = j/7;
- break;
- }
- }
- if (Cur_ott->curpage > Cur_ott->numpages)
- Cur_ott->curpage = Cur_ott->numpages;
- return(Cur_entry + i);
- }
-
- Cur_ott->curpage = 0;
- return(NULL);
-}
-
-struct ott_entry *
-dname_to_ott(name)
-char *name;
-{
- register int i;
- register int size = array_len(Cur_entry);
-
- for (i = 0; i < size; i++) {
- if (Cur_entry[i].dname == NULL)
- Cur_entry[i].dname = NULLSTR;
- if (!(Cur_entry[i].objmask & M_DL) &&
- strcmp(Cur_entry[i].dname, name) == 0)
- return(Cur_entry + i);
- }
- return(NULL);
-}
-
-static int
-ott_write()
-{
- register int i;
- char *dname, *display;
- FILE *ottfp;
- int ottfd;
- struct stat sbuf;
- char ottname[PATHSIZ];
- int size = array_len(Cur_entry);
- char *def_display();
-
- if ((int)strlen(Cur_ott->path) + Ott_len + 1 > PATHSIZ) /* EFT k16 */
- {
-#ifdef _DEBUG
- _debug(stderr, ".ott path too long for %s\n", Cur_ott->path);
-#endif
- return(O_FAIL);
- }
- strcat(strcpy(ottname, Cur_ott->path), Ott_name);
-
- if ((ottfd = open(ottname, O_CREAT|O_WRONLY|O_TRUNC,0666)) == -1 ||
- (ottfp = fdopen(ottfd, "w")) == NULL) {
-#ifdef _DEBUG
- _debug(stderr, "Can't write ott (errno=%d)\n", errno);
-#endif
- (void) close(ottfd);
- Cur_ott->ott_mtime = time(0); /* last time we tried to update is now*/
- return(O_FAIL);
- }
-
- fprintf(ottfp, Ott_version);
- for (i = 0; i < size; i++ ) {
- if (Cur_entry[i].name[0] == '.' &&
- strcmp(Cur_entry[i].name, ".pref") != 0 &&
- strcmp(Cur_entry[i].name, ".ott") != 0 &&
- strncmp(Cur_entry[i].name, ".V", 2) != 0 &&
- strncmp(Cur_entry[i].name, ".L", 2) != 0)
- continue;
- if (!(Cur_entry[i].objmask & M_DL)) {
- if (Cur_entry[i].dname && Cur_entry[i].dname[0]) {
- if (strcmp(Cur_entry[i].dname, Cur_entry[i].name) == 0)
- dname = ".";
- else
- dname = Cur_entry[i].dname;
- } else
- dname = " ";
- if (Cur_entry[i].display && Cur_entry[i].display[0] &&
- Cur_entry[i].objtype) {
- if (strcmp(Cur_entry[i].display,
- def_display(Cur_entry[i].objtype)) == 0)
- display = ".";
- else
- display = Cur_entry[i].display;
- } else
- display = " ";
-
- fprintf(ottfp,"%s|%.*s|%s|%s|%lx|%lx|%.*s\n",
- Cur_entry[i].name,
- DNAMESIZ,
- dname,
- display,
- Cur_entry[i].objtype?Cur_entry[i].objtype:" ",
- Cur_entry[i].objmask,
- Cur_entry[i].mtime,
- ODISIZ,
- Cur_entry[i].odi?Cur_entry[i].odi:"");
- }
- }
-
- if (fstat(ottfd, &sbuf) != -1)
- Cur_ott->ott_mtime = sbuf.st_mtime;
-
- if (stat(Cur_ott->path, &sbuf) != -1)
- Cur_ott->dir_mtime = sbuf.st_mtime;
-
- chown(ottname, sbuf.st_uid, sbuf.st_gid); /* ott owned and group of dir*/
- (void) fclose(ottfp);
- (void) close(ottfd);
- Cur_ott->modes &= ~OTT_DIRTY;
-
- return(O_OK);
-}
-
-static struct ott_tab *
-ott_lru()
-{
- register int i;
- int oldest = 0; /* abs k16 */
- long oldusetime;
-
- /* first, look for one that is unused */
-
- for (i = 0; i < MAX_OTT; i++)
- if (!(Otts[i].modes & OTT_ACTIVE)) {
- Otts[i].modes |= OTT_ACTIVE;
- return(Otts+i);
- }
-
-#ifdef _DEBUG
- _debug(stderr, "No Free Ott, dealloc\n");
-#endif
-
- /* ok, so there is none free. Now what? Good question.
- * So, we'll find the one that's been ott_get()'ed least recently.
- */
-
- oldest = 0;
- oldusetime = Otts[oldest].last_used;
-
- for (i = 1; i < MAX_OTT; i++) {
- if (!(Otts[i].modes & OTT_LOCKED) && Otts[i].last_used < oldusetime) {
- oldest = i;
- oldusetime = Otts[i].last_used;
- }
- }
-
-#ifdef _DEBUG
- _debug(stderr,"Selected %s for dealloc %d\n",Otts[oldest].path,oldusetime);
-#endif
- Otts[oldest].modes |= OTT_ACTIVE;
- return(Otts + oldest);
-}
-
-int
-ott_init()
-{
- register int i, size;
-
- Cur_ott = ott_lru();
-
- if (Cur_ott->ott == NULL) { /* first time using this ott */
- Cur_ott->ott = (struct ott_entry *)
- array_create(sizeof(struct ott_entry), Creation_size);
- Cur_entry = Cur_ott->ott;
- array_ctl(Cur_entry, OTT_ENTRIES);
- Cur_ott->parents = (int *) array_create(sizeof(int), Creation_size);
- } else {
- size = array_len(Cur_ott->ott);
- for (i = 0; i < size; i++)
- ott_int_free(Cur_ott->ott + i);
- if (Cur_ott->path)
- free(Cur_ott->path);
- array_trunc(Cur_ott->ott);
- array_trunc(Cur_ott->parents);
- Cur_entry = Cur_ott->ott;
- }
-
- Cur_ott->curpage = Cur_ott->numpages = 0;
- Cur_ott->ott_mtime = (time_t)0; /* EFT abs k16 */
- Cur_ott->modes = 0L;
- return (0);
-}
-
-static int
-ott_use()
-{
- static int use;
- return(++use);
-}
-
-struct ott_entry *
-ott_next_part(entry)
-struct ott_entry *entry;
-{
- if (entry->next_part != OTTNIL)
- return(Cur_ott->ott + entry->next_part);
- else
- return(NULL);
-}
diff --git a/usr/src/cmd/fmli/proc/Makefile b/usr/src/cmd/fmli/proc/Makefile
deleted file mode 100644
index 7c486323f7..0000000000
--- a/usr/src/cmd/fmli/proc/Makefile
+++ /dev/null
@@ -1,55 +0,0 @@
-#
-# CDDL HEADER START
-#
-# The contents of this file are subject to the terms of the
-# Common Development and Distribution License, Version 1.0 only
-# (the "License"). You may not use this file except in compliance
-# with the License.
-#
-# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
-# or http://www.opensolaris.org/os/licensing.
-# See the License for the specific language governing permissions
-# and limitations under the License.
-#
-# When distributing Covered Code, include this CDDL HEADER in each
-# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
-# If applicable, add the following below this CDDL HEADER, with the
-# fields enclosed by brackets "[]" replaced with your own identifying
-# information: Portions Copyright [yyyy] [name of copyright owner]
-#
-# CDDL HEADER END
-#
-#
-# Copyright 2004 Sun Microsystems, Inc. All rights reserved.
-# Use is subject to license terms.
-#
-# ident "%Z%%M% %I% %E% SMI"
-#
-# cmd/fmli/proc/Makefile
-#
-LIBRARY = libproc.a
-
-OBJECTS = pclose.o pcurrent.o pctl.o pdefault.o list.o pnoncur.o \
- open.o suspend.o
-
-# include library definitions
-include ../../../lib/Makefile.lib
-
-C99MODE= $(C99_DISABLE)
-
-# Specifically request the construction of a static library.
-# This library is not installed in the proto area.
-LIBS = $(LIBRARY)
-
-# inc must be first.
-CPPFLAGS = -I../inc $(CPPFLAGS.master)
-
-.KEEP_STATE:
-
-all: $(LIBS)
-
-install: all
- @echo "$(LIBRARY) is not installed."
-
-# include library targets
-include ../../../lib/Makefile.targ
diff --git a/usr/src/cmd/fmli/proc/list.c b/usr/src/cmd/fmli/proc/list.c
deleted file mode 100644
index af7f0f39ff..0000000000
--- a/usr/src/cmd/fmli/proc/list.c
+++ /dev/null
@@ -1,80 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-/*
- * Copyright (c) 1985 AT&T
- * All Rights Reserved
- */
-
-/*
- * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-#include <stdio.h>
-#include <sys/types.h> /* EFT abs k16 */
-#include "wish.h"
-#include "token.h"
-#include "slk.h"
-#include "actrec.h"
-#include "proc.h"
-#include "procdefs.h"
-#include "terror.h"
-#include "ctl.h"
-#include "menudefs.h"
-
-extern struct proc_rec PR_all[];
-
-
-struct actrec *
-menline_to_proc(n)
-int n;
-{
- register int i, l;
-
- for (i = l = 0; i < MAX_PROCS; i++) {
- if (PR_all[i].name)
- if (++l == n)
- return(PR_all[i].ar);
- }
- return(NULL);
-}
-
-struct menu_line
-proc_menudisp(n, ptr)
-int n;
-char *ptr;
-{
- struct menu_line m;
- struct actrec *a;
-
- m.highlight = m.description = NULL;
- m.flags = 0;
- if ((a = menline_to_proc(n)) != NULL)
- ar_ctl(a, CTGETITLE, &m.highlight, NULL, NULL, NULL, NULL, NULL);
- return(m);
-}
diff --git a/usr/src/cmd/fmli/proc/open.c b/usr/src/cmd/fmli/proc/open.c
deleted file mode 100644
index fa6c4594a1..0000000000
--- a/usr/src/cmd/fmli/proc/open.c
+++ /dev/null
@@ -1,136 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-
-/*
- * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-/* Copyright (c) 1984, 1985, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-#include <stdio.h>
-#include <stdarg.h>
-#include <sys/types.h> /* EFT abs k16 */
-#include "wish.h"
-#include "token.h"
-#include "slk.h"
-#include "actrec.h"
-#include "proc.h"
-#include "terror.h"
-#include "moremacros.h"
-
-struct actrec *Proc_list = NULL;
-extern struct proc_rec PR_all[];
-
-int
-proc_open(int flags, char *title, char *path, ...)
-{
- char *argv[MAX_ARGS+2];
- register int i;
- va_list list;
-
- va_start(list, path);
- for (i = 0; i < MAX_ARGS+1 && (argv[i] = va_arg(list, char *)); i++)
- ;
- argv[MAX_ARGS+1] = NULL;
- va_end(list);
-
- return(proc_openv(flags, title, path, argv));
-}
-
-int
-proc_opensys(flags, title, path, arg)
-int flags;
-char *title, *path;
-char *arg;
-{
- return(proc_open(flags, title, path, "/bin/sh", "-c", arg, NULL));
-}
-
-int
-proc_openv(flags, title, path, argv)
-int flags;
-char *title, *path;
-char *argv[];
-{
- struct actrec a, *rec;
- extern struct slk No_slks[];
- int proc_close(), proc_current(), proc_noncurrent(), proc_ctl();
- struct actrec *ar_create(), *path_to_ar();
-
- a.serial = 0;
- a.interrupt = (char *)NULL;
- a.oninterrupt = (char *)NULL;
- a.slks = (struct slk *)NULL;
- a.prevrec = (struct actrec *)NULL;
- a.nextrec = (struct actrec *)NULL;
- a.backup = (struct actrec *)NULL;
-
- /* if no path is specified, consider all the arguments put together
- * to be the path.
- */
-
- if (path == NULL) {
- char buf[BUFSIZ];
- register int i, len;
-
- for (i = len = 0; argv[i]; i++)
- len += sprintf(buf+len, "%s\t", argv[i]);
- a.path = strsave(buf);
- } else
- a.path = strsave(path);
-
- if ((rec = path_to_ar(a.path)) != NULL) {
- free(a.path);
- return(ar_current(rec, TRUE)); /* abs k15 */
- }
-
- a.odptr = title?strsave(title):NULL;
-
- a.fcntbl[AR_CLOSE] = proc_close;
- a.fcntbl[AR_REREAD] = AR_NOP;
- a.fcntbl[AR_REINIT] = AR_NOP;
- a.fcntbl[AR_CURRENT] = proc_current;
-/* a.fcntbl[AR_TEMP_CUR] = proc_current; */ /* abs k15 optimize later */
- a.fcntbl[AR_TEMP_CUR] = AR_NOP; /* miked */
- a.fcntbl[AR_NONCUR] = proc_noncurrent;
- a.fcntbl[AR_CTL] = proc_ctl;
- a.fcntbl[AR_HELP] = AR_NOHELP;
- a.fcntbl[AR_ODSH] = AR_NOP;
- a.id = proc_default(flags, argv);
- if (a.id == FAIL)
- return(FAIL);
- a.lifetime = AR_LONGTERM;
- a.flags = AR_SKIP;
- a.slks = No_slks;
-
- if (Proc_list)
- (void) ar_close(Proc_list, FALSE);
-
- PR_all[a.id].ar = ar_create(&a);
-
- return(ar_current(PR_all[a.id].ar, FALSE)?SUCCESS:FAIL); /* abs k15 */
-}
diff --git a/usr/src/cmd/fmli/proc/pclose.c b/usr/src/cmd/fmli/proc/pclose.c
deleted file mode 100644
index fc0f9dd918..0000000000
--- a/usr/src/cmd/fmli/proc/pclose.c
+++ /dev/null
@@ -1,80 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-/*
- * Copyright (c) 1985 AT&T
- * All Rights Reserved
- */
-#ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.5 */
-
-#include <stdio.h>
-#include <signal.h>
-#include <sys/types.h> /* EFT abs k16 */
-#include "wish.h"
-#include "token.h"
-#include "slk.h"
-#include "actrec.h"
-#include "proc.h"
-#include "procdefs.h"
-#include "terror.h"
-
-extern struct proc_rec PR_all[];
-extern int Vflag;
-
-int
-proc_close(rec)
-register struct actrec *rec;
-{
- int i;
- int id;
- pid_t pid; /* EFT abs k16 */
- int oldsuspend;
-
- if (Vflag)
- showmail(TRUE);
- id = rec->id;
- pid = PR_all[id].pid;
-#ifdef _DEBUG
- _debug(stderr, "closing process table %d, pid=%d\n", id, pid);
-#endif
- if (pid != NOPID) { /* force the user to close by resuming it */
-#ifdef _DEBUG
- _debug(stderr, "FORCING CLOSE ON PID %d\n", pid);
-#endif
- oldsuspend = suspset(FALSE); /* disallow suspend */
- PR_all[id].flags |= PR_CLOSING;
- ar_current(rec, TRUE); /* abs k15 */
- suspset(oldsuspend);
- }
- for (i = 0; i < MAX_ARGS && PR_all[id].argv[i]; i++)
- free(PR_all[id].argv[i]);
- PR_all[id].name = NULL;
- PR_all[id].status = ST_DEAD;
- if (rec->path)
- free(rec->path);
- if (rec->odptr)
- free(rec->odptr);
- return SUCCESS;
-}
diff --git a/usr/src/cmd/fmli/proc/pctl.c b/usr/src/cmd/fmli/proc/pctl.c
deleted file mode 100644
index 410d96025a..0000000000
--- a/usr/src/cmd/fmli/proc/pctl.c
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/* Copyright (c) 1984, 1985, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-#include <stdio.h>
-#include <sys/types.h> /* EFT abs k16 */
-#include "wish.h"
-#include "token.h"
-#include "slk.h"
-#include "actrec.h"
-#include "proc.h"
-#include "procdefs.h"
-#include "terror.h"
-#include "ctl.h"
-#include "sizes.h"
-
-
-extern struct proc_rec PR_all[];
-
-int
-proc_ctl(rec, cmd, arg1, arg2, arg3, arg4, arg5, arg6)
-struct actrec *rec;
-int cmd;
-int arg1, arg2, arg3, arg4, arg5, arg6;
-{
- static char title[MAX_WIDTH];
- int p = rec->id;
- register int len, i;
-
- switch (cmd) {
- case CTGETITLE:
- if (rec->odptr) {
- **((char ***)(&arg1)) = rec->odptr;
- } else {
- len = sprintf(title, "%.*s ", MAX_TITLE, PR_all[p].name);
- i = 1;
- while (len<MAX_TITLE && i<MAX_ARGS && PR_all[p].argv[i]) {
- len += sprintf(title+len, "%.*s ", MAX_TITLE-len,
- filename(PR_all[p].argv[i]));
- i++;
- }
- **((char ***)(&arg1)) = &title[0];
- }
- return(SUCCESS);
- case CTGETPID:
- *((pid_t *)arg1) = PR_all[rec->id].respid; /* EFT abs k16 */
- return(SUCCESS); /* miked k17 */
- case CTSETPID:
- PR_all[rec->id].respid = (pid_t)arg1; /* EFT abs k16 */
- return(SUCCESS);
- default:
- return(FAIL);
- }
-}
diff --git a/usr/src/cmd/fmli/proc/pcurrent.c b/usr/src/cmd/fmli/proc/pcurrent.c
deleted file mode 100644
index eda684b54d..0000000000
--- a/usr/src/cmd/fmli/proc/pcurrent.c
+++ /dev/null
@@ -1,188 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/*
- * Copyright 1992 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-/* Copyright (c) 1984, 1985, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-#include <stdio.h>
-#include <signal.h>
-#include <sys/types.h> /* EFT abs k16 */
-#include <errno.h>
-#include "wish.h"
-#include "token.h"
-#include "slk.h"
-#include "actrec.h"
-#include "proc.h"
-#include "procdefs.h"
-#include "terror.h"
-#include "sizes.h"
-
-extern struct proc_rec PR_all[];
-extern bool Suspend_interupt;
-extern char *Suspend_window;
-
-/* extern int errno; EFT abs k16 */
-
-int
-proc_current(rec)
-struct actrec *rec;
-{
- int p = rec->id;
- pid_t pid, w; /* EFT abs k16 */
- int status;
- extern int _Debug;
- void sigcatch();
- void (*oldquit) (), (*oldint) ();
- int set_ret_val();
-
- if (PR_all[p].status == ST_DEAD)
- return(FAIL);
-
- /* if process is not already forked, fork it else resume it */
-
- vt_before_fork();
- fork_clrscr();
- if (PR_all[p].pid == NOPID) {
-#ifdef _DEBUG
- _debug(stderr, "NEW PROCESS FORKING\n");
-#endif
- switch (pid = fork()) {
- case FAIL:
-#ifdef _DEBUG
- _debug(stderr, "Fork failed with errno=%d\n", errno);
-#endif
- error(MISSING, "process fork failed");
- return(FAIL);
- case 0: /* child */
-#ifdef _DEBUG
- if (_Debug)
- (void) freopen("/dev/tty", "w+", stderr);
-#endif
- sigset(SIGINT, SIG_DFL);
- sigset(SIGQUIT, SIG_DFL);
- execvp(PR_all[p].name, PR_all[p].argv);
- error_exec(errno);
- child_error(NOEXEC, PR_all[p].name); /* abs k15 */
- _exit(255);
- default:
- oldquit = sigset(SIGQUIT, SIG_IGN); /* changed from.. */
- oldint = sigset(SIGINT, SIG_IGN); /* ..signal() abs */
- PR_all[p].pid = PR_all[p].respid = pid;
- break;
- }
- } else { /* resume */
- pid = PR_all[p].pid;
-#ifdef _DEBUG
- _debug(stderr, "resuming pid %d by signaling %d\n", pid, PR_all[p].respid);
-#endif
- if (PR_all[p].flags & PR_CLOSING) {
- fflush(stdout);
- fflush(stderr);
- printf("You are returning to a suspended activity. This activity\r\n");
- printf("must be ended before you can complete logging out.\r\n");
- printf("Please take whatever steps are necessary to end this\r\n");
- printf("activity.\r\n\n");
- fflush(stdout);
- sleep(3);
- } else {
- fflush(stdout);
- fflush(stderr);
- printf("You are returning to a suspended activity. \r\n");
- fflush(stdout);
- sleep(3);
- }
-
- if (kill(PR_all[p].respid, SIGUSR1) == FAIL) {
-#ifdef _DEBUG
- _debug(stderr, "RESUME SIGNAL FAILED WITH ERRNO=%d\n", errno);
-#endif
- return(FAIL);
- }
- }
- PR_all[p].status = ST_RUNNING;
-
-#ifdef _DEBUG
- _debug(stderr, "Waiting for pid %d\n", pid);
-#endif
- status = 0;
- Suspend_interupt = FALSE;
-
- while ((w = wait(&status)) != pid) {
- if ((w == FAIL && errno != EINTR) || Suspend_interupt) {
-#ifdef _DEBUG
- _debug(stderr, "Woken while waiting for %d\n", pid);
-#endif
- break;
- }
- }
- if (Suspend_interupt) {
-#ifdef _DEBUG
- _debug(stderr, "Process %d suspended, making non-current\n", pid);
-#endif
- if (Suspend_window == NULL)
- ar_backup(); /* go back to previous activation record */
- else {
- objop("OPEN", NULL, Suspend_window, NULL);
- free(Suspend_window);
- Suspend_window = NULL;
- }
- } else {
- (void) set_ret_val(status);
-#ifdef _DEBUG
- _debug(stderr, "Process terminated, closing actrec\n");
-#endif
- PR_all[p].pid = PR_all[p].respid = NOPID;
- if ((PR_all[p].flags == PR_ERRPROMPT && status>>8 != 0) ||
- (PR_all[p].flags & ~PR_CLOSING) == 0) {
- char buf[PATHSIZ];
-
- printf("\r\nPress ENTER to continue");
- fflush(stdout);
- fgets(buf, PATHSIZ, stdin);
- }
- if ((PR_all[p].flags & PR_CLOSING) == 0)
- ar_close(rec, FALSE);
- }
- /* signal(SIGINT, oldint);
- signal(SIGQUIT, oldquit);
- abs */
- sigset(SIGINT, oldint);
- sigset(SIGQUIT, oldquit);
- vt_after_fork();
- return(SUCCESS);
-}
-
-void sigcatch(sig)
-int sig;
-{
-/* signal(sig, SIG_IGN);
- signal(sig, sigcatch);
-abs */
- sigignore(sig);
- sigset(sig, sigcatch);
-}
diff --git a/usr/src/cmd/fmli/proc/pdefault.c b/usr/src/cmd/fmli/proc/pdefault.c
deleted file mode 100644
index fd7e99bacd..0000000000
--- a/usr/src/cmd/fmli/proc/pdefault.c
+++ /dev/null
@@ -1,116 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-
-/*
- * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-/* Copyright (c) 1984, 1985, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-#include <stdio.h>
-#include <sys/types.h> /* EFT abs k16 */
-#include "wish.h"
-#include "terror.h"
-#include "token.h"
-#include "slk.h"
-#include "actrec.h"
-#include "proc.h"
-#include "procdefs.h"
-
-struct proc_rec PR_all[MAX_PROCS];
-static int pflag=1;
-static int find_freeproc(void);
-
-/* make a default process, i.e. one that takes over the full screen */
-
-proc_id
-proc_default(flags, argv)
-int flags;
-char *argv[];
-{
- register int i;
- int index;
- char *expand();
-
- if (pflag) {
- proc_init();
- pflag=0;
- }
- if ((index = find_freeproc()) == FAIL) {
- mess_temp("Too many suspended activities! Use frm-mgmt list to resume and close some.");
- return(FAIL);
- }
-
-#ifdef _DEBUG
- _debug(stderr, "Creating process at %d\n", index);
-#endif
- PR_all[index].argv[0] = PR_all[index].name = expand(argv[0]);
-#ifdef _DEBUG
- _debug(stderr, "PROCESS: %s", PR_all[index].name);
-#endif
- for (i = 1; argv[i]; i++) {
- PR_all[index].argv[i] = expand(argv[i]);
-#ifdef _DEBUG
- _debug(stderr, " %s", PR_all[index].argv[i]);
-#endif
- }
-#ifdef _DEBUG
- _debug(stderr, "\n");
-#endif
- PR_all[index].argv[i] = NULL;
- PR_all[index].ar = NULL;
- PR_all[index].status = ST_RUNNING;
- PR_all[index].flags = flags;
-
- PR_all[index].pid = PR_all[index].respid = NOPID;
- return(index);
-}
-
-static int
-find_freeproc(void)
-{
- register int i;
-
- for (i = 0; i < MAX_PROCS; i++)
- if (PR_all[i].name == NULL)
- return(i);
- return(FAIL);
-}
-
-int
-proc_init()
-{
- register int i, j;
-
- for (i = 0; i < MAX_PROCS; i++) {
- PR_all[i].name = NULL;
- for (j=0; j < MAX_ARGS +2; j++)
- PR_all[i].argv[j] = NULL;
- }
- return (0);
-}
-
diff --git a/usr/src/cmd/fmli/proc/pnoncur.c b/usr/src/cmd/fmli/proc/pnoncur.c
deleted file mode 100644
index 1a4409a128..0000000000
--- a/usr/src/cmd/fmli/proc/pnoncur.c
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-
-/*
- * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-/* Copyright (c) 1984, 1985, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-#include <stdio.h>
-#include <sys/types.h> /* EFT abs k16 */
-#include "wish.h"
-#include "terror.h"
-#include "proc.h"
-#include "procdefs.h"
-
-extern struct proc_ref PR_all;
-
-int
-proc_noncurrent(p, all)
-proc_id p;
-bool all;
-{
- /* suspend process */
-#ifdef _DEBUG
- _debug(stderr, "proc_noncurrent not yet implemented\n");
-#endif
- return (0);
-}
diff --git a/usr/src/cmd/fmli/proc/proc.h b/usr/src/cmd/fmli/proc/proc.h
deleted file mode 100644
index b8dcfb8bf2..0000000000
--- a/usr/src/cmd/fmli/proc/proc.h
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-/*
- * Copyright (c) 1985 AT&T
- * All Rights Reserved
- */
-#ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.2 */
-
-#define MAX_PROCS 5
-#define MAX_ARGS 10
-
-#ifndef NOPID /* EFT abs k16 */
-#define NOPID (pid_t)(-1) /* EFT abs k16 */
-#endif
-#define ST_RUNNING 0
-#define ST_DEAD 1
-#define ST_SUSPENDED 2
-
-struct proc_rec {
- char *name;
- char *argv[MAX_ARGS+2];
- int status; /* running, dead, or suspended */
- int flags; /* prompt at end */
- pid_t pid; /* actual process id. EFT k16 */
- pid_t respid; /* process id to resume EFT k16 */
- struct actrec *ar; /* activation record proc is in */
-};
diff --git a/usr/src/cmd/fmli/proc/suspend.c b/usr/src/cmd/fmli/proc/suspend.c
deleted file mode 100644
index 4401823e02..0000000000
--- a/usr/src/cmd/fmli/proc/suspend.c
+++ /dev/null
@@ -1,84 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-
-/*
- * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-/* Copyright (c) 1984, 1985, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-#include <stdio.h>
-#include <signal.h>
-#include <sys/types.h> /* EFT abs k16 */
-#include "wish.h"
-
-static void sig_nothing(int sig);
-
-int
-suspend(cmd)
-char *cmd;
-{
- char suspath[40];
- pid_t vpid; /* EFT abs k16 */
- FILE *fp;
-
- sigset(SIGUSR1, sig_nothing);
-
- if ((vpid = strtol(getenv("VPID"), (char **)NULL, 0)) == 0) /* EFT k16 */
- {
-#ifdef _DEBUG
- _debug(stderr, "Unable to get VPID\n");
-#endif
- return(FAIL);
- }
-
- sprintf(suspath, "/tmp/suspend%d", vpid);
- if ((fp = fopen(suspath, "w")) == NULL) {
-#ifdef _DEBUG
- _debug(stderr, "Unable to open suspend file %s\n", suspath);
-#endif
- return(FAIL);
- }
- (void) fprintf(fp, "%d\n%s\n", getpid(), cmd ? cmd : "");
- (void) fclose(fp);
-
- if (kill(vpid, SIGUSR1) == FAIL) {
-#ifdef _DEBUG
- _debug(stderr, "Unable to send sigusr1 to face pid=%d\n", vpid);
-#endif
- return(FAIL);
- }
- pause();
- return(SUCCESS);
-}
-
-
-static void
-sig_nothing(int sig)
-{
- /* do nothing, just catch the signal and return */
- return;
-}
diff --git a/usr/src/cmd/fmli/qued/Makefile b/usr/src/cmd/fmli/qued/Makefile
deleted file mode 100644
index 5275700ec8..0000000000
--- a/usr/src/cmd/fmli/qued/Makefile
+++ /dev/null
@@ -1,57 +0,0 @@
-#
-# CDDL HEADER START
-#
-# The contents of this file are subject to the terms of the
-# Common Development and Distribution License, Version 1.0 only
-# (the "License"). You may not use this file except in compliance
-# with the License.
-#
-# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
-# or http://www.opensolaris.org/os/licensing.
-# See the License for the specific language governing permissions
-# and limitations under the License.
-#
-# When distributing Covered Code, include this CDDL HEADER in each
-# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
-# If applicable, add the following below this CDDL HEADER, with the
-# fields enclosed by brackets "[]" replaced with your own identifying
-# information: Portions Copyright [yyyy] [name of copyright owner]
-#
-# CDDL HEADER END
-#
-#
-# Copyright 2004 Sun Microsystems, Inc. All rights reserved.
-# Use is subject to license terms.
-#
-# ident "%Z%%M% %I% %E% SMI"
-#
-# cmd/fmli/qued/Makefile
-#
-LIBRARY = libqued.a
-
-OBJECTS = acs_io.o arrows.o copyfield.o fclear.o fgo.o fstream.o \
- fput.o fread.o initfield.o editmulti.o editsingle.o \
- getfield.o mfuncs.o multiline.o putfield.o setfield.o \
- scrollbuf.o sfuncs.o singleline.o vfuncs.o wrap.o
-
-# include library definitions
-include ../../../lib/Makefile.lib
-
-C99MODE= $(C99_DISABLE)
-
-# Specifically request the construction of a static library.
-# This library is not installed in the proto area.
-LIBS = $(LIBRARY)
-
-# inc must be first.
-CPPFLAGS = -I../inc $(CPPFLAGS.master)
-
-.KEEP_STATE:
-
-all: $(LIBS)
-
-install: all
- @echo "$(LIBRARY) is not installed."
-
-# include library targets
-include ../../../lib/Makefile.targ
diff --git a/usr/src/cmd/fmli/qued/acs_io.c b/usr/src/cmd/fmli/qued/acs_io.c
deleted file mode 100644
index 74085338c9..0000000000
--- a/usr/src/cmd/fmli/qued/acs_io.c
+++ /dev/null
@@ -1,227 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-
-/*
- * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-/* Copyright (c) 1984, 1985, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-#include <curses.h>
-#include "wish.h"
-#include "token.h"
-#include "winp.h"
-#include "fmacs.h"
-#include "vtdefs.h"
-#include "vt.h"
-
-#define STR_SIZE 256
-
-/* acsreadline is identical to freadline except it does NOT
- * strip off the curses attribute bits, ie. it deals with
- * a line of chtype's intead of chars.
- */
-
-int
-acsreadline(row, buff, terminate)
-int row;
-chtype *buff;
-int terminate;
-{
- register int len, size = 0;
- chtype ch_string[STR_SIZE];
-
- fgo (row, 0);
- len = winchnstr((&VT_array[VT_curid])->win, ch_string, LASTCOL + 1) - 1;
-
- /* extract characters from the ch_string and copy them into buff */
-
- while (len >= 0 && ((ch_string[len] & A_CHARTEXT) == ' '))
- len--;
-
- if (len >= 0) { /* if there is text on this line */
- size = ++len;
- len = 0;
- while (len < size)
- *buff++ = ch_string[len++];
- }
- if (terminate)
- *buff = (chtype)'\0';
- return(size);
-}
-
-
-void
-acswinschar(ch)
-chtype ch;
-{
- register struct vt *v;
-
- v = &VT_array[VT_curid];
- v->flags |= VT_DIRTY;
- winsch(v->win, ch);
-}
-
-
-/* this routine is the same as finschar except it deals with
- * a chtype instead of a char
- */
-int
-acsinschar(ch)
-chtype ch;
-{
- int saverow, savecol;
-
- saverow = Cfld->currow;
- savecol = Cfld->curcol;
- /*
- * delete last character, re-position cursor and insert
- * a character
- */
- fgo(saverow, LASTCOL);
- wdelchar();
- fgo(saverow, savecol);
- acswinschar(ch);
- return (0);
-}
-
-/* this routine is the same as finsstr except it deals with
- * chtype's instead of a char's
- */
-int
-acsinsstr(buff)
-chtype *buff;
-{
- register chtype *bptr;
-
- for (bptr = buff; (*bptr & A_CHARTEXT) != 0 ; bptr++)
- ;
- bptr--;
- while (bptr >= buff)
- acsinschar(*bptr--);
- return (0);
-}
-
-/* this routine is the same as wreadchar except it does NOT
- * strip the curses attribute bits, ie. it deals with a chtype
- * instead of a char
- */
-chtype
-acswreadchar(row, col)
-unsigned row;
-unsigned col;
-{
- register struct vt *v;
- int savey, savex;
- register chtype ch;
-
- v = &VT_array[VT_curid];
- getyx(v->win, savey, savex);
- if (!(v->flags & VT_NOBORDER)) {
- row++;
- col++;
- }
- ch = mvwinch(v->win, row, col);
- wmove(v->win, savey, savex); /* return cursor */
- return(ch);
-}
-
-/*
- -----------------------------------------------------------------------------
-acswputchar
- Output character `ch' to current window
- Used when character was already on the screen once, and
- thus we know character is printable and any special proccesing
- was previously done.
- -----------------------------------------------------------------------------
-*/
-void
-acswputchar(ch)
-chtype ch;
-{
- register WINDOW *win;
- register struct vt *v;
-
- v = &VT_array[VT_curid];
- v->flags |= VT_DIRTY;
- win = v->win;
-
- waddch(win, ch);
- return;
-}
-
-
-/*
- * ACSPUTSTRING is used in place of fputstring when outputing from the
- * scroll buffer. since all the special character and output attribute
- * proccessing was already done when fputstring wrote into the scrollbuffer
- * none of that processing is needed here.
- */
-void
-acsputstring(str)
-chtype *str;
-{
- register chtype *sptr;
- register int row, col, done;
- register WINDOW *win;
- struct vt *v;
-
- v = &VT_array[VT_curid];
- v->flags |= VT_DIRTY;
- win = v->win;
-
- v = &VT_array[VT_curid];
- v->flags |= VT_DIRTY;
- win = v->win;
- col = Cfld->curcol;
- row = Cfld->currow;
- done = FALSE;
- sptr = str;
- while (!done)
- {
- if ((*sptr) & A_CHARTEXT)
- {
- waddch(win, *sptr++);
- col++;
- }
- else
- {
- done = TRUE;
- continue;
- }
- if (col > LASTCOL)
- {
- if (row == LASTROW)
- done = TRUE;
- else
- fgo(++row, col = 0);
- }
- }
- Cfld->curcol = col;
- Cfld->currow = row;
- return;
-}
diff --git a/usr/src/cmd/fmli/qued/arrows.c b/usr/src/cmd/fmli/qued/arrows.c
deleted file mode 100644
index 034ab95009..0000000000
--- a/usr/src/cmd/fmli/qued/arrows.c
+++ /dev/null
@@ -1,94 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-
-/*
- * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-/* Copyright (c) 1984, 1985, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-
-#include <stdio.h>
-#include <curses.h>
-#include "winp.h"
-#include "wish.h"
-#include "ctl.h"
-#include "fmacs.h"
-#include "vtdefs.h"
-
-/*
- * SETARROWS is used to set/clear scroll indicators for both
- * single-line and multi-line scrollable fields
- */
-int
-setarrows(void)
-{
- register unsigned line;
- register int ch, savecol;
-
- line = 0;
- if (!(Flags & I_SCROLL))
- vt_ctl(VT_UNDEFINED, CTSETSARROWS, 0);
- else if (Cfld->rows == 1) {
- vt_ctl(VT_UNDEFINED, CTSETSARROWS, 0);
- savecol = Cfld->curcol;
- if (Buffoffset > 0)
- line |= VT_UPSARROW;
- if ((Buffoffset + Cfld->cols + 1) < Bufflast)
- line |= VT_DNSARROW;
- if (line & VT_UPSARROW) {
- if (line & VT_DNSARROW)
- ch = '=';
- else
- ch = '<';
- }
- else if (line & VT_DNSARROW) {
- if (line & VT_UPSARROW)
- ch = '=';
- else
- ch = '>';
- }
- else
- ch = ' ';
- fgo(0, LASTCOL + 1);
- fputchar(ch);
- fgo(0, savecol);
- }
- else {
- /*
- * If the field takes up the entire frame
- * or is a text object, then use the
- * scroll box rather than the scroll indicators
- */
- if (Buffoffset > 0)
- line |= (Flags & (I_FULLWIN | I_TEXT)) ? VT_UPPARROW : VT_UPSARROW;
- if ((Valptr != NULL) || ((Buffoffset + FIELDBYTES) < Bufflast))
- line |= (Flags & (I_FULLWIN | I_TEXT)) ? VT_DNPARROW : VT_DNSARROW;
- vt_ctl(VT_UNDEFINED, (Flags & (I_FULLWIN | I_TEXT)) ?
- CTSETPARROWS : CTSETSARROWS, line);
- }
- return (0);
-}
diff --git a/usr/src/cmd/fmli/qued/copyfield.c b/usr/src/cmd/fmli/qued/copyfield.c
deleted file mode 100644
index 7a5087c94b..0000000000
--- a/usr/src/cmd/fmli/qued/copyfield.c
+++ /dev/null
@@ -1,121 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-
-/*
- * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-/* Copyright (c) 1984, 1985, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-#include <stdio.h>
-#include <memory.h>
-#include <curses.h>
-#include "wish.h"
-#include "token.h"
-#include "winp.h"
-#include "fmacs.h"
-#include "moremacros.h"
-#include "terror.h"
-
-extern char *fputstring();
-extern void acsputstring();
-
-/*
- * COPYFIELD will copy a field form one part of the screen to another
- * (including all of the field status information)
- */
-int
-copyfield(srcfld, destfld)
-ifield *srcfld, *destfld;
-{
- ifield *savefield;
- long tmpoffset;
-
-
- if (srcfld == NULL || destfld == NULL)
- return(FAIL);
- savefield = Cfld;
- Cfld = destfld;
- if (srcfld->scrollbuf) { /* if a scrollable field */
- register int linesize, i;
-
- if (destfld->scrollbuf) /* ehr3 */
- free(destfld->scrollbuf); /* ehr3 */
-
- if ((destfld->scrollbuf = (chtype *)malloc /* added +1 abs k15 */
- ((srcfld->buffsize + 1) * sizeof(*srcfld->scrollbuf))) == NULL)
- fatal(NOMEM, "");
-
- destfld->buffsize = srcfld->buffsize;
- memcpy(destfld->scrollbuf, srcfld->scrollbuf, /* added +1 abs k15 */
- (srcfld->buffsize +1) * sizeof(*srcfld->scrollbuf));
- linesize = destfld->cols + 1;
- tmpoffset = 0L;
- for (i = 0; i < srcfld->rows; i++) {
- /* print the copied field to the screen */
- fgo(i, 0);
- acsputstring(destfld->scrollbuf + tmpoffset);
- tmpoffset += linesize;
- }
- }
- if (srcfld->value) {
- if (destfld->value) /* ehr3 */
- free(destfld->value); /* ehr3 */
-
- destfld->value = strsave(srcfld->value);
-
- if (!destfld->scrollbuf) /* if not a scroll field */
- destfld->valptr = fputstring(destfld->value);
- }
- destfld->currow = srcfld->currow;
- destfld->curcol = srcfld->curcol;
- Cfld = savefield;
- return(SUCCESS);
-}
-
-/*
- * HIDEFIELD will remove the field from screen WITHOUT destroying the
- * ifield structure.
- */
-int
-hidefield(fld)
-ifield *fld;
-{
- ifield *savefield;
- int flags;
-
- savefield = Cfld;
- if (fld != NULL)
- Cfld = fld;
- flags = fld->flags;
- setfieldflags(fld, (fld->flags & ~I_FILL));
- fgo(0, 0);
- fclear();
- setfieldflags(fld, flags);
- Cfld = savefield;
- return (0);
-}
diff --git a/usr/src/cmd/fmli/qued/editmulti.c b/usr/src/cmd/fmli/qued/editmulti.c
deleted file mode 100644
index 68489984bf..0000000000
--- a/usr/src/cmd/fmli/qued/editmulti.c
+++ /dev/null
@@ -1,109 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-
-/*
- * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-/* Copyright (c) 1984, 1985, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-#include <ctype.h>
-#include <stdio.h>
-#include <curses.h>
-#include "token.h"
-#include "winp.h"
-#include "fmacs.h"
-#include "wish.h"
-
-int
-editmulti(tok)
-token tok;
-{
- register token rettok;
- register int row, col;
- int wrapcol;
-
- row = Cfld->currow;
- col = Cfld->curcol;
- rettok = TOK_NOP;
- switch(tok) {
- case TOK_UP:
- if (row == 0)
- rettok = TOK_UP;
- else
- row--;
- break;
- case TOK_DOWN:
- if (row == LASTROW)
- rettok = TOK_DOWN;
- else
- row++;
- break;
- case TOK_RETURN:
- case TOK_ENTER:
- if (row == LASTROW)
- rettok = TOK_RETURN;
- else {
- row++;
- col = 0;
- }
- break;
- case TOK_BACKSPACE:
- /* reposition cursor for further backspaces or erases */
- if (row == 0)
- rettok = tok;
- else {
- fgo(--row, col = LASTCOL);
- fputchar(' ');
- }
- break;
- case TOK_WRAP:
- if (row == LASTROW)
- rettok = tok;
- else if (Flags & I_WRAP) {
- if ((wrapcol = do_wrap()) < 0) {
- wrapcol = 0;
- beep();
- }
- if (col == LASTCOL) { /* if cursor on last col */
- col = wrapcol;
- row++;
- }
- }
- else if (col == LASTCOL) {
- row++;
- col = 0;
- }
- else
- beep();
- break;
- default:
- rettok = tok;
- }
- fgo(row, col);
- return(rettok);
-}
diff --git a/usr/src/cmd/fmli/qued/editsingle.c b/usr/src/cmd/fmli/qued/editsingle.c
deleted file mode 100644
index 791b4423f6..0000000000
--- a/usr/src/cmd/fmli/qued/editsingle.c
+++ /dev/null
@@ -1,197 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-
-/*
- * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-/* Copyright (c) 1984, 1985, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-#include <stdio.h>
-#include <ctype.h>
-#include <curses.h>
-#include "wish.h"
-#include "token.h"
-#include "winp.h"
-#include "fmacs.h"
-#include "terror.h"
-
-#define ischange(x) (x == TOK_BACKSPACE || x == TOK_CLEAR || x == TOK_ERASE || x == TOK_DC ||\
- x == TOK_EOL || x == TOK_SEOL || x == TOK_UNDO || \
- x == TOK_IC)
-#define isslash(x) (x == '\b' || (isspace(x) && x != ' '))
-
-int
-editsingle(tok)
-token tok;
-{
- register token rettok;
- register int row, col;
-
- rettok = TOK_NOP;
-
- if (tok == TOK_NOP)
- return rettok;
- row = Cfld->currow;
- col = Cfld->curcol;
-/*
- if ( isprint(tok) && !(Flags & I_NOEDIT))
-*/
- if ( isascii(tok) && isprint(tok) && !(Flags & I_NOEDIT))
- {
- Flags |= I_CHANGED;
- if (Flags & I_BLANK) {
- /*
- * check to see if character typed should clear field
- */
- if ((Cfld->rows == 1) && (row == 0) && (col == 0)) {
- fclear();
- if (Flags & I_SCROLL)
- clearbuf(); /* clear scroll buff */
- }
- }
- if (Flags & I_INVISIBLE) { /* invisible field */
- int count;
-
- if (Valptr == NULL)
- Valptr = Value;
- count = Valptr - Value + 1;
- if ( count < FIELDBYTES) {
- *Valptr++ = tok;
- *Valptr = '\0';
- if (++count == FIELDBYTES) /* abs for autoadvance */
- rettok = TOK_WRAP;
- }
- else
- rettok = TOK_WRAP; /* abs was beep() */
- }
- else {
- fputchar(tok); /* print character */
- if (col == LASTCOL) /* end of line */
- rettok = TOK_WRAP;
- else
- col++;
- }
- }
- else if (ischange(tok)) {
- Flags |= I_CHANGED;
- if (Flags & I_NOEDIT) { /* no-edit field */
- beep();
- goto alldone;
- }
- switch(tok) {
- case TOK_CLEAR:
- case TOK_EOL:
- fgo(row, col = 0);
- case TOK_SEOL:
- fclearline();
- if (Currtype == SINGLE && (Flags & I_SCROLL))
- clearbuf();
- break;
- case TOK_BACKSPACE:
- if (col > 0) {
- if (col == LASTCOL && freadchar(row, col) != ' ') {
- fputchar(' ');
- fgo(row, col);
- }
- else {
- fgo(row, --col);
- fdelchar();
- finschar(' ');
- }
- }
- else
- rettok = TOK_BACKSPACE;
- break;
- case TOK_TAB:
- /* tab */
- while (col < LASTCOL && (col & 7))
- col++;
- break;
- case TOK_BTAB:
- /* back tab */
- while (col && (col & 7))
- col--;
- break;
- case TOK_IC:
- /*
- * insert char and check for word wrapping
- * due to line shift to the right
- */
- if (Currtype == SINGLE && (Flags & I_SCROLL)) {
- shiftbuf(RIGHT);
- finschar(' ');
- }
- else if (wrap() == TRUE)
- rettok = TOK_WRAP;
- else
- finschar(' ');
- break;
- case TOK_DC:
- case TOK_ERASE:
- /* delete char */
- fdelchar();
- if (Currtype == SINGLE && (Flags & I_SCROLL))
- shiftbuf(LEFT);
- break;
- case TOK_UNDO:
- /* enhacement */
- beep();
- break;
- }
- }
- else {
- switch(tok) {
- case TOK_ENTER:
- case TOK_RETURN:
- /* carriage return */
- rettok = TOK_RETURN;
- break;
- case TOK_LEFT:
- /* move left */
- if (col == 0)
- rettok = TOK_LEFT;
- else
- fgo(row, --col);
- break;
- case TOK_RIGHT:
- /* move right */
- if (col == LASTCOL)
- rettok = TOK_RIGHT;
- else
- fgo(row, ++col);
- break;
- default:
- /* pass it back */
- rettok = tok;
- }
- }
-alldone:
- Cfld->curcol = col;
- Flags &= ~(I_BLANK);
- return(rettok);
-}
diff --git a/usr/src/cmd/fmli/qued/fclear.c b/usr/src/cmd/fmli/qued/fclear.c
deleted file mode 100644
index e1b77b6f0b..0000000000
--- a/usr/src/cmd/fmli/qued/fclear.c
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-
-/*
- * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-/* Copyright (c) 1984, 1985, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-#include <stdio.h>
-#include <curses.h>
-#include "token.h"
-#include "winp.h"
-#include "fmacs.h"
-
-/*
- * FCLEAR will clear the field from the current cursor position to
- * the end of the field
- */
-int
-fclear(void)
-{
- register int row, col;
- register int saverow, savecol;
-
- saverow = Cfld->currow;
- savecol = Cfld->curcol;
- for (row = saverow, col = savecol; row <= LASTROW; row++, col = 0) {
- fgo(row, col);
- for (; col <= LASTCOL; col++)
- fputchar(' ');
- }
- fgo(saverow, savecol);
- return (0);
-}
-
-int
-fclearline(void)
-{
- register int col, savecol;
-
- savecol = Cfld->curcol;
- for (col = savecol; col <= LASTCOL; col++)
- fputchar(' ');
- fgo(Cfld->currow, savecol);
- return (0);
-}
diff --git a/usr/src/cmd/fmli/qued/fgo.c b/usr/src/cmd/fmli/qued/fgo.c
deleted file mode 100644
index 899b2c03ca..0000000000
--- a/usr/src/cmd/fmli/qued/fgo.c
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-
-/*
- * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-/* Copyright (c) 1984, 1985, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-#include <stdio.h>
-#include <curses.h>
-#include "token.h"
-#include "winp.h"
-
-int
-fgo(row, col)
-int row;
-int col;
-{
- Cfld->currow = row;
- Cfld->curcol = col;
- wgo(row + Cfld->frow, col + Cfld->fcol);
- return (0);
-}
diff --git a/usr/src/cmd/fmli/qued/fmacs.h b/usr/src/cmd/fmli/qued/fmacs.h
deleted file mode 100644
index 34e2078d61..0000000000
--- a/usr/src/cmd/fmli/qued/fmacs.h
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-/*
- * Copyright (c) 1985 AT&T
- * All Rights Reserved
- *
- */
-
-#ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.8 */
-
-extern chtype getattr();
-extern chtype acswreadchar();
-
-/* defines for Substreams */
-#define SINGLE 0
-#define MULTI 1
-
-/* Miscellaneous defines and macros */
-#define Fieldrows (Cfld->rows)
-#define Fieldcols (Cfld->cols)
-#define Flags (Cfld->flags)
-#define Fieldattr (Cfld->fieldattr)
-#define Lastattr (Cfld->lastattr)
-#define Currtype (Cfld->currtype)
-#define Scrollbuf (Cfld->scrollbuf)
-#define Buffoffset (Cfld->buffoffset)
-#define Buffsize (Cfld->buffsize)
-#define Bufflast (Cfld->bufflast)
-#define Value (Cfld->value)
-#define Valptr (Cfld->valptr)
-
-/* computational macros */
-#define LASTCOL (Cfld->cols - 1)
-#define LASTROW (Cfld->rows - 1)
-#define LINEBYTES (Cfld->cols + 1)
-#define FIELDBYTES (Cfld->rows * (Cfld->cols + 1))
-
-
-/* field character operation macros */
-#define freadchar(r,c) wreadchar(r+Cfld->frow,c+Cfld->fcol)
-#define acsreadchar(r,c) acswreadchar(r+Cfld->frow,c+Cfld->fcol)
-#define fputchar(x) wputchar(x, Fieldattr, NULL);
-
-#define UP 0
-#define DOWN 1
-#define LEFT 2
-#define RIGHT 3
diff --git a/usr/src/cmd/fmli/qued/fput.c b/usr/src/cmd/fmli/qued/fput.c
deleted file mode 100644
index b23401351b..0000000000
--- a/usr/src/cmd/fmli/qued/fput.c
+++ /dev/null
@@ -1,155 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-/*
- * Copyright (c) 1985 AT&T
- * All Rights Reserved
- */
-#ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.11 */
-
-#include <stdio.h>
-#include <curses.h>
-#include "wish.h"
-#include "token.h"
-#include "winp.h"
-#include "fmacs.h"
-#include "attrs.h"
-
-
-extern char *attr_on();
-extern char *attr_off();
-
-
-/*
- * FPUTSTRING will return NULL if the entire string fits in the field
- * otherwise it returns a pointer to the beginning of the substring that
- * does not fit
- */
-char *
-fputstring(str)
-char *str;
-{
- register char *sptr;
- register int row, col, done;
- int i, numspaces, pos;
- chtype attrs;
-
- col = Cfld->curcol;
- row = Cfld->currow;
- attrs = Lastattr;
- done = FALSE;
- sptr = str;
- while (!done) {
- if (*sptr == '\\') {
- switch(*(++sptr)) {
- case 'b':
- *sptr = '\b';
- break;
- case '-':
- if (Cfld->flags & I_TEXT)
- sptr = attr_off(sptr, &attrs, NULL) + 1;
- continue; /* don't need to wputchar */
- case 'n':
- *sptr = '\n';
- break;
- case '+':
- if (Cfld->flags & I_TEXT)
- sptr = attr_on(sptr, &attrs, NULL) + 1;
- continue; /* don't need to wputchar */
- case 't':
- *sptr = '\t';
- break;
- case 'r':
- *sptr = '\r';
- break;
- }
- }
- switch(*sptr) {
- case '\n':
- fgo(row, col);
- fclearline();
- if (row == LASTROW)
- done = TRUE;
- else
- fgo(++row, col = 0);
- sptr++;
- break;
- case '\b':
- if (col != 0)
- fgo(row, --col);
- sptr++;
- break;
- case '\t':
- numspaces = ((col + 8) & ~7) - col;
- for (i = 0; i < numspaces && col <= LASTCOL; i++, col++)
- wputchar(' ', attrs, NULL);
- sptr++;
- break;
- case '\0':
- done = TRUE;
- sptr = NULL;
- continue;
- default:
- wputchar(*sptr++, attrs, NULL);
- col++;
- break;
- }
- if (col > LASTCOL) {
- if (row == LASTROW) {
- if ((Flags & I_SCROLL) && (Flags & I_WRAP)) {
- /*
- * If the word is not longer then
- * the length of the field then
- * clear away the word to wrap...
- * and adjust the string pointer to
- * "unput" the word ....
- */
- pos = prev_bndry(row, ' ', TRUE);
- if (pos >= 0) {
- fgo(row, pos);
- fclearline();
- sptr -= (LASTCOL - pos);
- }
- }
- else
- sptr++;
- done = TRUE;
- }
- else if ((Flags & I_WRAP) && (wrap() == TRUE)) {
- if ((col = do_wrap()) < 0)
- col = 0;
- fgo(++row, col);
- }
- else {
- if (*sptr != '\n')
- fgo(++row, col = 0);
- }
- }
- }
- Lastattr = attrs;
- Cfld->curcol = col;
- Cfld->currow = row;
- return(sptr);
-}
diff --git a/usr/src/cmd/fmli/qued/fread.c b/usr/src/cmd/fmli/qued/fread.c
deleted file mode 100644
index 0aadb30b15..0000000000
--- a/usr/src/cmd/fmli/qued/fread.c
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-/*
- * Copyright (c) 1985 AT&T
- * All Rights Reserved
- */
-#ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.9 */
-
-#include <curses.h>
-#include "wish.h"
-#include "token.h"
-#include "winp.h"
-#include "fmacs.h"
-#include "vtdefs.h"
-#include "vt.h"
-#include "string.h"
-
-#define STR_SIZE 256
-
-int
-freadline(row, buff, terminate)
-int row;
-char *buff;
-int terminate;
-{
- register int len, size = 0;
- chtype ch_string[STR_SIZE];
-
- fgo (row, 0);
- len = winchnstr((&VT_array[VT_curid])->win, ch_string, LASTCOL + 1) - 1;
-
- /* extract characters from the ch_string and copy them into buff */
-
- while (len >= 0 && ((ch_string[len] & A_CHARTEXT) == ' '))
- len--;
-
- if (len >= 0) { /* if there is text on this line */
- size = ++len;
- len = 0;
- while (len < size)
- *buff++ = ch_string[len++] & A_CHARTEXT;
- }
- if (terminate)
- *buff = '\0';
- return(size);
-}
diff --git a/usr/src/cmd/fmli/qued/fstream.c b/usr/src/cmd/fmli/qued/fstream.c
deleted file mode 100644
index ed068c3b0d..0000000000
--- a/usr/src/cmd/fmli/qued/fstream.c
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-/*
- * Copyright (c) 1985 AT&T
- * All Rights Reserved
- */
-#ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.4 */
-
-#include <stdio.h>
-#include <ctype.h>
-#include <curses.h>
-#include "wish.h"
-#include "terror.h"
-#include "token.h"
-#include "winp.h"
-#include "fmacs.h"
-#include "vtdefs.h"
-#include "ctl.h"
-#include "attrs.h"
-
-#define MAXSUBS 5
-
-/* ODSH functions */
-extern token singleline();
-extern token multiline();
-extern token editsingle();
-extern token editmulti();
-
-token (*Substream[][MAXSUBS])() = {
- {
- editsingle,
- singleline,
- NULL
- },
- {
- editsingle,
- editmulti,
- multiline,
- NULL
- },
-};
-
-token
-field_stream(tok)
-token tok;
-{
- token stream();
-
- return(stream(tok, Substream[Currtype]));
-}
diff --git a/usr/src/cmd/fmli/qued/getfield.c b/usr/src/cmd/fmli/qued/getfield.c
deleted file mode 100644
index c8d00f1b49..0000000000
--- a/usr/src/cmd/fmli/qued/getfield.c
+++ /dev/null
@@ -1,189 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/*
- * Copyright 1992 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-/* Copyright (c) 1984, 1985, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-#include <stdio.h>
-#include <curses.h>
-#include "token.h"
-#include "wish.h"
-#include "winp.h"
-#include "fmacs.h"
-#include "terror.h"
-
-static char *getfixedval();
-static char *getscrollval();
-
-/*
- * GETFIELD will return the contents of the current field. It is not
- * stable as of yet and does not account for scrolling field.
- */
-char *
-getfield(fld, buff)
-ifield *fld;
-char *buff;
-{
- register char *fbuf, *val;
- ifield *savefield;
-
- savefield = Cfld;
- if (fld != NULL)
- Cfld = fld;
- if (Flags & I_INVISIBLE) {
- if (Value == NULL)
- val = nil;
- else
- val = Value;
- }
- else if (Flags & I_SCROLL)
- val = getscrollval();
- else
- val = getfixedval();
- /*
- * getscrollval() and getfixedval() return NULL from
- * time to time - causing calling functions to segfault.
- */
- if (val == NULL)
- val = nil;
- if (buff == NULL)
- fbuf = val;
- else {
- strcpy(buff, val);
- fbuf = buff;
- }
- Cfld = savefield;
- return(fbuf);
-}
-
-static char *
-getfixedval()
-{
- register int row;
- register char *bptr;
-
- if (!(Flags & I_CHANGED))
- return(Value);
- Flags &= ~(I_CHANGED);
-
- /*
- * If this field does not already have a value then
- * allocate space equal to the size of the field dimensions
- * (Buffer is guarenteed to be at least this size if there
- * already is a field value)
- */
- if (!Value && (Value = malloc(FIELDBYTES +1)) == NULL) /* +1 abs k15 */
- fatal(NOMEM, nil);
-
- /*
- * Read the field value from the window map and eat
- * trailing new-line characters
- */
- for (bptr = Value, row = 0; row <= LASTROW; row++) {
- bptr += freadline(row, bptr, TRUE);
- *bptr++ = '\n';
- }
- while (--bptr >= Value && *bptr == '\n')
- *bptr = '\0';
- return(Value);
-}
-
-static char *
-getscrollval()
-{
- register char *dptr;
- register chtype *sptr, *lastptr, *saveptr;
- unsigned buflength, lenvalptr;
- char *dest;
-
- if (!(Flags & I_CHANGED))
- return(Value);
- Flags &= ~(I_CHANGED);
- /*
- * HORIZONTAL SCROLL FIELD
- *
- * - syncronize the window map with the scroll buffer.
- * - set Value to the result
- *
- */
- if (Currtype == SINGLE) {
- syncbuf(Buffoffset, 0, 0); /* syncronize buffer */
- if ((dest = malloc(Buffsize + 1)) == NULL)
- fatal(NOMEM, nil);
- dptr = dest;
- sptr = Scrollbuf;
- while ((*dptr++ = (char)(*(sptr++) & A_CHARTEXT)) != '\0')
- ;
- if (Value)
- free(Value);
- Value = dest;
- return(Value);
- }
-
- /*
- * VERTICAL SCROLL FIELD
- *
- * - syncronize the window map with the scroll buffer.
- * - "pack" the scoll buffer (remove trailing blanks).
- * - append the remaining (unprocessed) text pointed to by Valptr.
- * - eat trailing new-lines
- * - set Value to the result.
- *
- */
- syncbuf(Buffoffset, 0, Fieldrows - 1); /* syncronize buffer */
- if ((dest = malloc(Buffsize + 1)) == NULL)
- fatal(NOMEM, nil);
- lastptr = Scrollbuf + Bufflast;
- saveptr = sptr = Scrollbuf;
- dptr = dest;
- while (sptr < lastptr) { /* pack Scrollbuf */
- if ((*dptr++ = (char)(*(sptr++) & A_CHARTEXT)) == '\0') {
- saveptr += LINEBYTES;
- sptr = saveptr;
- *(dptr - 1) = '\n';
- }
- }
- *dptr = '\0';
-
- buflength = strlen(dest);
- if (Valptr) { /* append unprocessed text */
- lenvalptr = strlen(Valptr);
- if ((dest = realloc(dest, buflength + lenvalptr + 1)) == NULL)
- fatal(NOMEM, nil);
- strcat(dest, Valptr);
- Valptr = dest + buflength;
- buflength += lenvalptr;
- }
- if (Value)
- free(Value);
- Value = dest;
- for (dptr = dest + buflength - 1; --dptr >= dest && *dptr == '\n'; )
- *dptr = '\0'; /* eat trailing new-lines */
- return(Value);
-}
-
diff --git a/usr/src/cmd/fmli/qued/initfield.c b/usr/src/cmd/fmli/qued/initfield.c
deleted file mode 100644
index 6c469e5120..0000000000
--- a/usr/src/cmd/fmli/qued/initfield.c
+++ /dev/null
@@ -1,155 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-
-/*
- * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-/* Copyright (c) 1984, 1985, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-#include <stdio.h>
-#include <curses.h>
-#include "wish.h"
-#include "terror.h"
-#include "token.h"
-#include "vtdefs.h"
-#include "winp.h"
-#include "fmacs.h"
-#include "ctl.h"
-#include "attrs.h"
-
-#define FSIZE(x) (x->rows * (x->cols + 1))
-
-ifield *Cfld = NULL;
-
-ifield *
-deffield()
-{
- int rows, cols, currow, curcol;
- ifield *newfield();
-
- /*
- * Compute default values
- */
- vt_ctl(VT_UNDEFINED, CTGETSIZ, &rows, &cols);
- vt_ctl(VT_UNDEFINED, CTGETPOS, &currow, &curcol);
- return(newfield(currow, curcol, rows, cols - curcol - 1, 0));
-}
-
-ifield *
-newfield(firstrow, firstcol, rows, cols, flags)
-int firstrow;
-int firstcol;
-int rows;
-int cols;
-int flags;
-{
- ifield *newfld;
-
- newfld = (ifield *)new(ifield);
- newfld->frow = firstrow;
- newfld->fcol = firstcol;
- newfld->rows = rows;
- newfld->cols = cols;
- newfld->flags = flags;
- newfld->currow = 0;
- newfld->curcol = 0;
- newfld->scrollbuf = NULL;
- newfld->buffsize = 0;
- newfld->buffoffset = 0;
- newfld->bufflast = 0;
- if (newfld->rows == 1) {
- newfld->currtype = SINGLE;
- if (newfld->flags & I_SCROLL) {
- newfld->flags &= ~(I_WRAP);
- newfld->cols -= 1;
- }
- }
- else {
- newfld->currtype = MULTI;
- newfld->flags &= ~(I_BLANK);
- }
- if (newfld->flags & I_INVISIBLE) {
- /*
- * bit of a kludge to handle no-echo ... rather
- * than putting characters into the window map,
- * these characters are put DIRECTLY into the
- * field value string and are NOT echoed to the
- * screen.
- */
- if ((newfld->value = (char *) malloc(FSIZE(newfld))) == NULL)
- fatal(NOMEM, "");
- newfld->valptr = newfld->value;
- }
- else {
- newfld->value = NULL;
- newfld->valptr = NULL;
- }
- newfld->fieldattr = newfld->lastattr =
- (newfld->flags & I_FILL ? Attr_underline: Attr_normal);
- return(newfld);
-}
-
-int
-gotofield(fld, row, col)
-ifield *fld;
-int row;
-int col;
-{
- if (fld != NULL)
- Cfld = fld;
- else if (!Cfld)
- return (0);
- if (row < 0 || col < 0)
- fgo(Cfld->currow, Cfld->curcol);
- else
- fgo(row, col);
- setarrows();
- return (0);
-}
-
-int
-endfield(fld)
-ifield *fld;
-{
- if (fld == NULL)
- fld = Cfld;
- if (fld) {
- if (fld->value != NULL) {
- free(fld->value);
- fld->value = fld->valptr = NULL;
- }
- if (fld->scrollbuf != NULL) {
- free(fld->scrollbuf);
- fld->scrollbuf = NULL;
- }
- free(fld);
- }
- if (fld == Cfld)
- Cfld = NULL; /* terminating current field */
- return (0);
-}
diff --git a/usr/src/cmd/fmli/qued/mfuncs.c b/usr/src/cmd/fmli/qued/mfuncs.c
deleted file mode 100644
index 5885f91a28..0000000000
--- a/usr/src/cmd/fmli/qued/mfuncs.c
+++ /dev/null
@@ -1,138 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-
-/*
- * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-/* Copyright (c) 1984, 1985, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-#include <curses.h>
-/*#include "curses.h"*/
-#include "wish.h"
-/* #include "vtdefs.h" */
-/* #include "token.h" */
-#include "fmacs.h"
-#include "winp.h"
-#include "vt.h"
-
-static void fcopyline(int src, int dest);
-
-int
-fdelline(num)
-int num;
-{
- register int saverow, i;
- register struct vt *v = &VT_array[VT_curid];
-
- saverow = Cfld->currow;
- if (Cfld->flags & I_FULLWIN) {
- /*
- * Use the subwindow to delete lines
- */
- if (v->subwin) {
- wmove(v->subwin, saverow + Cfld->frow, Cfld->fcol);
- winsdelln(v->subwin, -num);
- wsyncup(v->subwin);
- }
- else
- winsdelln (v->win, -num);
- }
- else {
- /*
- * only a partial window (scroll field)
- * don't use a subwindow
- */
- for (i = saverow; i <= LASTROW; i++) {
- if ((i + num) <= LASTROW)
- fcopyline(i + num, i);
- else {
- fgo(i, 0);
- fclearline();
- }
- }
- }
- fgo(saverow, 0);
- return (0);
-}
-
-int
-finsline(num, after)
-int num, after;
-{
- register int saverow, start, i;
- register struct vt *v = &VT_array[VT_curid];
-
- start = saverow = Cfld->currow;
- if (after == TRUE)
- start++;
- fgo(start, 0);
- if (Cfld->flags & I_FULLWIN) {
- if (v->subwin) {
- wmove(v->subwin, start + Cfld->frow, Cfld->fcol);
- winsdelln(v->subwin, num);
- wsyncup(v->subwin);
- }
- else
- winsdelln(v->win, num);
- }
- else {
- /*
- * only a partial window (scroll field)
- * don't use a subwindow
- */
- for (i = LASTROW; i >= start; i--) {
- if ((i - num) >= start)
- fcopyline(i - num, i);
- else {
- fgo(i, 0);
- fclearline();
- }
- }
- }
- fgo(start, 0);
- return (0);
-}
-
-#define STR_SIZE 256
-
-static void
-fcopyline(int src, int dest)
-{
- register struct vt *v = &VT_array[VT_curid];
- register int len;
- chtype ch_string[STR_SIZE];
-
- /*
- * Call winchnstr() to get a line and
- * waddchnstr() to copy it to dest
- */
- fgo (src, 0);
- len = winchnstr(v->win, ch_string, LASTCOL + 1);
- fgo (dest, 0);
- waddchnstr(v->win, ch_string, len);
-}
diff --git a/usr/src/cmd/fmli/qued/multiline.c b/usr/src/cmd/fmli/qued/multiline.c
deleted file mode 100644
index 906320f629..0000000000
--- a/usr/src/cmd/fmli/qued/multiline.c
+++ /dev/null
@@ -1,241 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License (the "License").
- * You may not use this file except in compliance with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/*
- * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-/*
- * Copyright (c) 1985 AT&T
- * All Rights Reserved
- */
-
-#include <stdio.h>
-#include <ctype.h>
-#include <curses.h>
-#include "wish.h"
-#include "token.h"
-#include "winp.h"
-#include "fmacs.h"
-
-static token _fixed();
-static token _virtual();
-static int emptyrow();
-
-#define SCROLLSIZE ((Cfld->rows - 2 <= 0) ? 1 : Cfld->rows - 2)
-#define HALFSIZE (int)(Cfld->rows / 2)
-
-token
-multiline(tok)
-{
- if (Flags & I_SCROLL)
- return(_virtual(tok));
- else
- return(_fixed(tok));
-}
-
-static token
-_fixed(tok)
-token tok;
-{
- register token rettok;
- register int col;
-
- rettok = TOK_NOP;
- switch (tok) {
- case TOK_BACKSPACE:
- case TOK_RETURN:
- case TOK_WRAP:
- if (Flags & I_AUTOADV)
- rettok = TOK_NEXT;
- else
- beep();
- break;
- case TOK_IL:
- if (Flags & I_NOEDIT)
- beep();
- else if (emptyrow(LASTROW) == FALSE)
- beep();
- else {
- finsline(1, TRUE);
- Flags |= I_CHANGED;
- }
- break;
- case TOK_DL:
- if (Flags & I_NOEDIT)
- beep();
- else {
- fdelline(1);
- Flags |= I_CHANGED;
- }
- break;
- case TOK_HOME:
- case TOK_BEG:
- fgo(0, 0);
- break;
- case TOK_SHOME:
- case TOK_END:
- col = LASTCOL;
- while (col >= 0 && freadchar(LASTROW, col) == ' ')
- col--;
- fgo(LASTROW, (col == LASTCOL || col == 0 ? col : col+1));
- break;
- default:
- rettok = tok;
- }
- return(rettok);
-}
-
-static token
-_virtual(tok)
-token tok;
-{
- register token rettok;
- register int col;
-
- rettok = TOK_NOP;
- switch (tok) {
- case TOK_DL:
- if (Flags & I_NOEDIT) {
- beep();
- break;
- }
- Flags |= I_CHANGED;
- fdelline(1);
- shiftbuf(UP);
- break;
- case TOK_IL:
- if (Flags & I_NOEDIT) {
- beep();
- break;
- }
- if (Cfld->currow == LASTROW) {
- if (scroll_down(1) == FALSE) {
- Bufflast += FIELDBYTES;
- growbuf(Bufflast);
- scroll_down(1);
- }
- fgo(LASTROW - 1, 0);
- }
- Flags |= I_CHANGED;
- shiftbuf(DOWN);
- finsline(1, TRUE);
- break;
- case TOK_NPAGE:
- if (Flags & I_NOPAGE)
- rettok = tok; /* paging not permitted */
- else {
- if (scroll_down(SCROLLSIZE) == FALSE)
- beep();
- }
- break;
- case TOK_PPAGE:
- if (Flags & I_NOPAGE)
- rettok = tok; /* paging not permitted */
- else {
- if (scroll_up(SCROLLSIZE) == FALSE)
- beep();
- }
- break;
- case TOK_UP:
- case TOK_SR:
- if (scroll_up(1) == FALSE)
- rettok = TOK_UP;
- break;
- case TOK_RETURN:
- if (scroll_down(HALFSIZE) == FALSE) {
- if (Flags & I_NOEDIT)
- beep();
- else {
- Bufflast += FIELDBYTES ; /* abs k17 */
- growbuf(Bufflast); /* abs k17 */
- scroll_down(HALFSIZE);
- }
- }
- fgo(Cfld->currow == LASTROW ? Cfld->currow : Cfld->currow + 1, 0);
- break;
- case TOK_DOWN:
- case TOK_SF:
- if (scroll_down(1) == FALSE)
- rettok = TOK_DOWN;
- break;
- case TOK_WRAP:
- if (scroll_down(1) == FALSE) {
- Bufflast += FIELDBYTES; /* abs k17 */
- growbuf(Bufflast); /* abs k17 */
- scroll_down(1);
- }
- fgo(LASTROW - 1, Cfld->curcol);
- if ((col = do_wrap()) < 0) {
- col = 0;
- beep();
- }
- if (Cfld->curcol == LASTCOL) /* if cursor on last col */
- fgo(Cfld->currow + 1, col);
- break;
- case TOK_BACKSPACE:
- if (scroll_up(1) == FALSE)
- beep();
- else {
- fgo(Cfld->currow, LASTCOL);
- fputchar(' ');
- }
- break;
- case TOK_HOME:
- case TOK_BEG:
- while (scroll_up(SCROLLSIZE) == TRUE)
- ;
- fgo(0, 0);
- break;
- case TOK_SHOME:
- case TOK_END:
- while (scroll_down(SCROLLSIZE) == TRUE)
- ;
- col = LASTCOL;
- while (col >= 0 && freadchar(LASTROW, col) == ' ')
- col--;
- fgo(LASTROW, (col == LASTCOL || col == 0 ? col : col+1));
- break;
- default:
- rettok = tok;
- }
- return(rettok);
-}
-
-static int
-emptyrow(row)
-register int row;
-{
- register int col;
- int saverow, savecol;
-
- saverow = Cfld->currow;
- savecol = Cfld->curcol;
- fgo(row, col = LASTCOL);
- while (col >= 0 && freadchar(row, col) == ' ')
- col--;
- fgo(saverow, savecol);
- return(col < 0 ? TRUE : FALSE);
-}
diff --git a/usr/src/cmd/fmli/qued/putfield.c b/usr/src/cmd/fmli/qued/putfield.c
deleted file mode 100644
index 6ac25bfedf..0000000000
--- a/usr/src/cmd/fmli/qued/putfield.c
+++ /dev/null
@@ -1,117 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-
-/*
- * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-/* Copyright (c) 1984, 1985, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-#include <stdio.h>
-#include <curses.h>
-#include "wish.h"
-#include "token.h"
-#include "winp.h"
-#include "fmacs.h"
-#include "moremacros.h"
-#include "terror.h"
-
-extern char *fputstring();
-
-int
-putfield(fld, str)
-ifield *fld;
-char *str;
-{
- ifield *savefield;
- chtype *sbuf_ptr;
- char *v_ptr;
-
- if (str == NULL)
- return (0);
- savefield = Cfld;
- if (fld != NULL)
- Cfld = fld;
- else if (!Cfld) /* no current field */
- return (0);
- if (Flags & I_INVISIBLE) {
- Cfld = savefield;
- return (0);
- }
- Flags |= I_CHANGED;
- fgo(0, 0); /* home the cursor */
-
- /*
- * Free remains of a previous field value
- */
- if (Value)
- free(Value);
- if (Scrollbuf)
- free_scroll_buf(Cfld); /* if used, reset scroll buffers */
-
- /*
- * If Value is LESS than the visible field size
- * then allocate at least the field size
- * otherwise strsave the passed value.
- */
- if (strlen(str) < FIELDBYTES) {
- if ((Value = malloc(FIELDBYTES +1)) == NULL) /* +1 abs k15 */
- fatal(NOMEM, nil);
- strcpy(Value, str);
- }
- else
- Value = strsave(str);
-
- Valptr = fputstring(Value); /* update pointer into value */
- fclear(); /* clear the rest of field */
- fgo(0, 0); /* home the cursor */
- if ((Flags & I_SCROLL) && Currtype == SINGLE) {
- /*
- * HORIZONTAL SCROLLING
- * initialize scroll buffer and copy string to it
- */
- unsigned vallength, maxlength;
-
- vallength = strlen(Value);
- maxlength = max(vallength, FIELDBYTES); /* removed +1 abs k15 */
- growbuf(maxlength);
-/* strcpy(Scrollbuf, Value); abs */
- /* THE following is >>> WRONG <<< it does not
- * process characters like tabs. it should be
- * handled like vertical scroll fields.
- */
- sbuf_ptr = Scrollbuf;
- v_ptr = Value;
- while (*v_ptr!= '\0')
- *sbuf_ptr++ = ((chtype) *v_ptr++) | Fieldattr;
- free(Value);
- Valptr = Value = NULL;
- }
- setarrows();
- Cfld = savefield;
- return (0);
-}
diff --git a/usr/src/cmd/fmli/qued/scrollbuf.c b/usr/src/cmd/fmli/qued/scrollbuf.c
deleted file mode 100644
index 0ff6c3958f..0000000000
--- a/usr/src/cmd/fmli/qued/scrollbuf.c
+++ /dev/null
@@ -1,207 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-
-/*
- * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-/* Copyright (c) 1984, 1985, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-#include <stdio.h>
-#include <curses.h>
-#include "wish.h"
-#include "token.h"
-#include "winp.h"
-#include "fmacs.h"
-#include "terror.h"
-
-extern int *acsreadline();
-extern void acswputchar();
-extern void acsputstring();
-extern char *fputstring();
-
-/*
- * GROWBUF will increase the scroll buffer by size
- */
-void
-growbuf(size)
-int size;
-{
- unsigned oldbuffsize;
-
- oldbuffsize = Buffsize;
- if (Scrollbuf == NULL) {
- if ((Scrollbuf = /* added +1 abs k15 */
- (chtype *)malloc((size +1) * sizeof(*Scrollbuf))) == NULL)
- fatal(NOMEM, "");
- Buffoffset = 0;
- Bufflast = size;
- }
- else if (Buffsize != size) {
- if ((Scrollbuf = (chtype *) /* added +1 abs k15 */
- realloc(Scrollbuf, (size +1) * sizeof(*Scrollbuf))) == NULL)
- fatal(NOMEM, "");
- }
- if ((Buffsize = size) > oldbuffsize) /* initialize new block */
- memset((char *)(Scrollbuf + oldbuffsize), 0,
- (Buffsize - oldbuffsize +1) * sizeof(*Scrollbuf)); /* +1 abs k15 */
-}
-
-int
-free_scroll_buf(fld)
-ifield *fld;
-{
- if (fld->scrollbuf)
- free(fld->scrollbuf);
- fld->scrollbuf = NULL;
- fld->buffsize = 0;
- fld->buffoffset = 0;
- fld->bufflast = 0;
- return (0);
-}
-
-/*
- * SYNCBUF will syncronize the window map with the scroll buffer
- */
-void
-syncbuf(offset, start, end)
-unsigned offset;
-int start;
-int end;
-{
- register chtype *currptr;
- register int i;
- int saverow, savecol;
-
- saverow = Cfld->currow;
- savecol = Cfld->curcol;
- if (Scrollbuf == NULL)
- growbuf(FIELDBYTES); /* initialize scroll buffer */
- currptr = Scrollbuf + offset;
- if (Currtype == SINGLE) {
- if ((offset + Cfld->cols) >= Bufflast)
- Bufflast = offset + (unsigned)acsreadline(0, currptr, TRUE);
- else
- acsreadline(0, currptr, FALSE);
- }
- else {
- for (i = start; i <= end; i++, currptr += LINEBYTES)
- acsreadline(i, currptr, TRUE);
- }
- fgo(saverow, savecol);
-}
-
-/*
- * CLEARBUF will clear the scroll buffer
- */
-void
-clearbuf()
-{
- /*
- * clear scroll buffer from current cursor position to end of field
- */
- syncbuf(Buffoffset, 0, Fieldrows - 1); /* added +1 on next line. abs f15 */
- Bufflast = Buffoffset + (Currtype == SINGLE ? Cfld->cols : FIELDBYTES);
- /* actually shrinks scroll buffer... was growbuf(Buffsize) abs k15 */
- growbuf(Buffoffset + (Currtype == SINGLE ? Cfld->cols : FIELDBYTES));
- setarrows();
-}
-
-/*
- * SHIFTBUF will shift the scroll buffer in the specified direction
- */
-void
-shiftbuf(direction)
-int direction;
-{
- register chtype *sptr;
- int startcol, startrow;
- int saverow, savecol;
-
- saverow = Cfld->currow;
- savecol = Cfld->curcol;
- if (Scrollbuf == NULL)
- growbuf(FIELDBYTES);
- switch(direction) {
- case UP:
- if ((startrow = Buffoffset + FIELDBYTES) >= Bufflast) {
- /* end of scroll buffer, see if there is more text */
- if (Valptr) {
- fgo(LASTROW, 0);
- Valptr = (char *) fputstring(Valptr);
- }
- }
- else {
- Bufflast -= LINEBYTES;
- sptr = Scrollbuf + startrow;
- fgo(LASTROW, 0);
- acsputstring(sptr);
- memshift((char *)sptr, (char *)(sptr + LINEBYTES)
- , (Bufflast - startrow) * sizeof(*sptr));
- }
- break;
- case DOWN:
- startrow = Buffoffset + FIELDBYTES;
- if ((Bufflast + LINEBYTES) > Buffsize)
- growbuf(Buffsize + FIELDBYTES);
- sptr = Scrollbuf + startrow;
- memshift((char *)(sptr + LINEBYTES), (char *)sptr,
- (Bufflast - startrow) * sizeof(*sptr));
- Bufflast += LINEBYTES;
- acsreadline(LASTROW, sptr, TRUE);
- break;
- case LEFT:
- /*
- * If this is the last page then there is no "off-screen"
- * text to shift.
- */
- if ((startcol = Buffoffset + Cfld->cols) >= Bufflast)
- return;
- sptr = Scrollbuf + startcol;
- fgo(0, LASTCOL);
- acswputchar(*sptr); /* print character shifted in */
- memshift((char *)sptr, (char *)(sptr + 1),
- (Bufflast - startcol) * sizeof(*sptr));
- Bufflast--;
- break;
- case RIGHT:
- /*
- * If this is the last page then there is no "off-screen"
- * text to shift.
- */
- if ((startcol = Buffoffset + Cfld->cols) > ++Bufflast)
- return;
- if (Bufflast >= Buffsize)
- growbuf(Buffsize + Cfld->cols);
- sptr = Scrollbuf + startcol;
- memshift((char *)(sptr + 1), (char *)sptr,
- (Bufflast - startcol) * sizeof(*sptr));
- *sptr = acsreadchar(0, LASTCOL); /* character shifted out */
- }
- setarrows();
- fgo(saverow, savecol);
-}
diff --git a/usr/src/cmd/fmli/qued/setfield.c b/usr/src/cmd/fmli/qued/setfield.c
deleted file mode 100644
index 06481677b5..0000000000
--- a/usr/src/cmd/fmli/qued/setfield.c
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-
-/*
- * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-/* Copyright (c) 1984, 1985, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-#include <stdio.h>
-#include <curses.h>
-#include <malloc.h>
-#include "token.h"
-#include "winp.h"
-#include "fmacs.h"
-#include "terror.h"
-#include "attrs.h"
-
-#define FSIZE(x) (x->rows * (x->cols + 1))
-
-int
-setfieldflags(fld, flags)
-register ifield *fld;
-register int flags;
-{
- fld->flags = (flags & I_CHANGEABLE) | (fld->flags & ~(I_CHANGEABLE));
- if (fld->flags & I_INVISIBLE)
- {
- if (fld->value)
- free(fld->value); /* abs */
- if ((fld->value = (char *)malloc(FSIZE(fld))) == NULL)
- fatal(NOMEM, "");
- fld->valptr = fld->value;
- }
- fld->fieldattr = (fld->flags & I_FILL ? Attr_underline: Attr_normal);
- return (0);
-}
diff --git a/usr/src/cmd/fmli/qued/sfuncs.c b/usr/src/cmd/fmli/qued/sfuncs.c
deleted file mode 100644
index 969fcf43c2..0000000000
--- a/usr/src/cmd/fmli/qued/sfuncs.c
+++ /dev/null
@@ -1,93 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-
-/*
- * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-/* Copyright (c) 1984, 1985, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-#include <stdio.h>
-#include <curses.h>
-#include "wish.h"
-#include "vtdefs.h"
-#include "token.h"
-#include "winp.h"
-#include "fmacs.h"
-#include "attrs.h"
-
-extern void acswinschar();
-
-int
-fdelchar()
-{
- int saverow, savecol;
-
- saverow = Cfld->currow;
- savecol = Cfld->curcol;
- wdelchar();
- /*
- * go to last column and insert a blank
- */
- fgo(saverow, LASTCOL);
- winschar(' ', Fieldattr);
- fgo(saverow, savecol);
- return (0);
-}
-
-int
-finsstr(buff)
-char *buff;
-{
- register char *bptr;
-
- for (bptr = buff; *bptr & A_CHARTEXT != '\0'; bptr++)
- ;
- bptr--;
- while (bptr >= buff)
- finschar(*bptr--);
- return (0);
-}
-
-int
-finschar(c)
-char c;
-{
- int saverow, savecol;
-
- saverow = Cfld->currow;
- savecol = Cfld->curcol;
- /*
- * delete last character, re-position cursor and insert
- * a character
- */
- fgo(saverow, LASTCOL);
- wdelchar();
- fgo(saverow, savecol);
- winschar(c, Fieldattr);
- return (0);
-}
diff --git a/usr/src/cmd/fmli/qued/singleline.c b/usr/src/cmd/fmli/qued/singleline.c
deleted file mode 100644
index 230a000355..0000000000
--- a/usr/src/cmd/fmli/qued/singleline.c
+++ /dev/null
@@ -1,188 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-
-/*
- * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-/* Copyright (c) 1984, 1985, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-#include <ctype.h>
-#include <curses.h>
-#include "token.h"
-#include "winp.h"
-#include "fmacs.h"
-#include "wish.h"
-
-#define HALFLINE (int)(Cfld->cols / 2)
-
-static token _fixed();
-static token _virtual();
-
-/*
- * get single line of input
- */
-token
-singleline(tok)
-token tok;
-{
- if (Flags & I_SCROLL)
- return(_virtual(tok));
- else
- return(_fixed(tok));
-}
-
-static token
-_fixed(tok)
-token tok;
-{
- register token rettok;
- register int col;
- static int lastwaswrap = FALSE;
-
- rettok = TOK_NOP;
- switch(tok) {
- case TOK_BACKSPACE:
- case TOK_LEFT:
- case TOK_RIGHT:
- case TOK_IL:
- beep(); /* do nothing and beep */
- break;
- case TOK_ENTER:
- case TOK_RETURN:
- if (!(Flags & I_NOEDIT))
- rettok = TOK_SAVE;
- else
- fgo(0, 0);
- break;
- case TOK_DL:
- Flags |= I_CHANGED;
- fgo(0, 0);
- fclearline();
- break;
- case TOK_WRAP:
- if (Flags & I_AUTOADV && !(Flags & I_NOEDIT))
- rettok = TOK_SAVE;
- else
- if (lastwaswrap == TRUE)
- beep();
- if (Cfld->curcol >= LASTCOL)
- fgo(0, LASTCOL);
- break;
- case TOK_HOME:
- case TOK_BEG:
- fgo(0, 0);
- break;
- case TOK_SHOME:
- case TOK_END:
- col = LASTCOL;
- while (col >= 0 && freadchar(0, col) == ' ')
- col--;
- fgo(0, (col == LASTCOL || col == 0 ? col : col+1));
- break;
- default:
- rettok = tok;
- }
- lastwaswrap = (tok == TOK_WRAP ? TRUE : FALSE);
- return(rettok);
-}
-
-static token
-_virtual(tok)
-token tok;
-{
- register token rettok;
- register int col;
-
- rettok = TOK_NOP;
- switch(tok) {
- case TOK_IL:
- beep();
- break;
- case TOK_BACKSPACE:
- if (scroll_left(HALFLINE) == FALSE)
- beep();
- else {
- fgo(0, Cfld->curcol - 1);
- fdelchar();
- }
- break;
- case TOK_ENTER:
- case TOK_RETURN:
- while (scroll_left(Cfld->cols) == TRUE) /* abs k14 */
- ;
- if (!(Flags & I_NOEDIT))
- rettok = TOK_SAVE;
- else
- fgo(0, 0);
- break;
- case TOK_DL:
- Flags |= I_CHANGED;
- fgo(0, 0);
- fclearline();
- Buffoffset = 0;
- clearbuf();
- break;
- case TOK_LEFT:
- if (scroll_left(HALFLINE) == FALSE)
- beep();
- break;
- case TOK_RIGHT:
- if (scroll_right(HALFLINE, FALSE) == FALSE)
- beep();
- break;
- case TOK_WRAP:
- if (scroll_right(HALFLINE, FALSE) == FALSE) {
-
- Bufflast += HALFLINE;
- growbuf(Bufflast);
-
-/** growbuf(Buffsize + HALFLINE); abs k17 */
- syncbuf(Buffoffset, 0, 0); /* abs f15 */
- scroll_right(HALFLINE, TRUE);
- }
- fgo(0, Cfld->curcol + 1);
- break;
- case TOK_HOME:
- case TOK_BEG:
- while (scroll_left(Cfld->cols) == TRUE)
- ;
- fgo(0, 0);
- break;
- case TOK_SHOME:
- case TOK_END:
- while (scroll_right(Cfld->cols, FALSE) == TRUE)
- ;
- col = LASTCOL;
- while (col >= 0 && freadchar(0, col) == ' ')
- col--;
- fgo(0, (col == LASTCOL || col == 0 ? col : col+1));
- break;
- default:
- rettok = tok;
- }
- return(rettok);
-}
diff --git a/usr/src/cmd/fmli/qued/vfuncs.c b/usr/src/cmd/fmli/qued/vfuncs.c
deleted file mode 100644
index 9f2033be04..0000000000
--- a/usr/src/cmd/fmli/qued/vfuncs.c
+++ /dev/null
@@ -1,278 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-
-/*
- * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-/* Copyright (c) 1984, 1985, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-#include <stdio.h>
-#include <curses.h>
-#include "wish.h"
-#include "token.h"
-#include "ctl.h"
-#include "winp.h"
-#include "fmacs.h"
-#include "terror.h"
-#include "vtdefs.h"
-
-extern void acsputstring();
-
-int
-scroll_up(num)
-int num;
-{
- register int i;
- register chtype *currptr;
- int saverow, savecol;
- int pagelines, pagebytes, lastpage;
-
- pagelines = num;
- pagebytes = pagelines * LINEBYTES;
- lastpage = Fieldrows - pagelines;
-
- if (Buffoffset == 0) {
- setarrows();
- return(FALSE); /* top of file */
- }
- saverow = Cfld->currow;
- savecol = Cfld->curcol;
- if (Buffoffset < pagebytes) { /* if a partial scroll */
- pagelines = (int) (Buffoffset / LINEBYTES);
- pagebytes = pagelines * LINEBYTES;
- lastpage = Fieldrows - pagelines;
- }
-
- /*
- * first, store bottom lines
- */
- syncbuf(Buffoffset + FIELDBYTES - pagebytes, lastpage, Fieldrows - 1);
- Buffoffset -= pagebytes;
-
- /*
- * second, push displayed lines off the bottom
- */
- fgo(0, 0);
- finsline(pagelines, FALSE);
-
- /*
- * thirdly, put buffered text at the top
- */
- currptr = Scrollbuf + Buffoffset;
- for (i = 0; i < pagelines; i++, currptr += LINEBYTES) {
- fgo(i, 0);
- acsputstring(currptr);
- }
-
- /*
- * finally, adjust cursor so that is points to the same character
- * that it did before the scroll (if possible)
- *
- * Also, update the scroll indicator before returning TRUE
- */
- if (pagelines != 1 && (saverow = (saverow + pagelines)) > LASTROW)
- saverow = LASTROW;
- fgo(saverow, savecol);
- setarrows();
- return(TRUE);
-}
-
-int
-scroll_down(num)
-int num;
-{
- register int i;
- register unsigned fieldoffset;
- int saverow, savecol;
- int pagelines, pagebytes, lastpage;
-
- pagelines = num;
- pagebytes = pagelines * LINEBYTES;
- lastpage = Fieldrows - pagelines;
- fieldoffset = Buffoffset + FIELDBYTES;
-
- if (Scrollbuf == NULL) /* make sure scroll buffer exists */
- growbuf(FIELDBYTES);
- if (fieldoffset >= Bufflast && Valptr == NULL) /* abs k17 */
- {
- setarrows(); /* at the end of the scroll buffer */
- return(FALSE);
- }
-
- saverow = Cfld->currow;
- savecol = Cfld->curcol;
- /*
- * first, synchronize the scroll buffer with the window
- */
- syncbuf(Buffoffset, 0, pagelines - 1);
- Buffoffset += pagebytes;
- if (Buffoffset + FIELDBYTES >= Buffsize)
- growbuf(Buffoffset + FIELDBYTES); /* need more buffer space */
-
- /*
- * secondly, delete displayed lines form the top of the field
- */
- fgo(0, 0);
- fdelline(pagelines);
-
- /*
- * thirdly, display buffered text at the bottom of the field
- */
- fgo(lastpage, 0);
- for (i = 0; i < pagelines; i++) {
- /*
- * If you are at the end of the scroll buffer then,
- * if there is more text (Valptr != NULL), display
- * it on the screen.
- */
- if (fieldoffset >= Bufflast) {
- if (Valptr)
- Valptr = (char *) fputstring(Valptr);
- Bufflast = Buffoffset + FIELDBYTES;
- break;
- }
- fgo(lastpage + i, 0);
- acsputstring(Scrollbuf + fieldoffset);
- fieldoffset += LINEBYTES;
- }
-
- /*
- * finally, adjust cursor so that is points to the same character
- * that it did before the scroll (if possible)
- *
- * Also, update the scroll indicator before returning TRUE
- */
- if (pagelines != 1 && (saverow = (saverow - pagelines)) < 0)
- saverow = 0;
- fgo(saverow, savecol);
- setarrows();
- return(TRUE);
-}
-
-int
-scroll_left(num)
-int num;
-{
- register int savecol, pagechars;
-
-
- pagechars = num;
- if (Buffoffset == 0) {
- /*
- * if at top of the buffer then update scroll arrows
- * and return FALSE
- */
- setarrows();
- return(FALSE);
- }
- savecol = Cfld->curcol; /* keep track of where cursor was */
- if (Buffoffset < pagechars) /* if a partial scroll */
- pagechars = Buffoffset;
-
- /*
- * first sync buffer to the visible contents of the field
- */
- syncbuf(Buffoffset, 0, 0);
- Buffoffset -= pagechars;
-
- /*
- * next, shift visible window
- */
- fgo(0, 0);
- fclearline();
- fgo(0, 0);
- acsputstring(Scrollbuf + Buffoffset);
-
- /*
- * finally, adjust cursor so that is points to the same character
- * that it did before the scroll (if possible)
- *
- * Also, update the scroll indicator before returning TRUE
- */
- if ((savecol += pagechars) > LASTCOL)
- savecol = LASTCOL;
- fgo(0, savecol);
- setarrows();
- return(TRUE);
-}
-
-int
-scroll_right(num, just_synced)
-int num;
-bool just_synced; /* for performance. abs f15 */
-{
- register int savecol, pagechars;
- register unsigned fieldoffset;
-
- pagechars = num;
- fieldoffset = Buffoffset + Fieldcols;
-
- /*
- * if you are at the end of the "used" part of the buffer
- * (Bufflast), simply update the scroll indicator and
- * return FALSE
- */
- if (fieldoffset >= Bufflast) /* was > abs k17 */
- {
- setarrows();
- return(FALSE);
- }
-
- savecol = Cfld->curcol;
- /*
- * First sync the field buffer to the visible contents of the field ...
- * unless it was done just before calling this function ...
- * Secondly, bump the buffer offset by pagechars (growing the buffer if
- * necessary)
- */
- if (just_synced == FALSE) /* abs f15 */
- syncbuf(Buffoffset, 0, 0);
- Buffoffset += pagechars;
- if (Buffoffset + Fieldcols > Buffsize) /* was >= abs f15 */
- growbuf(Buffoffset + Fieldcols); /* need more buffer space */
-
- /*
- * Next, shift the visible window
- */
- fgo(0, 0);
- fclearline();
- fgo(0, 0);
- acsputstring(Scrollbuf + Buffoffset);
-
- /*
- * Finally, adjust cursor so that is points to the same character
- * that it did before the scroll (if possible)
- *
- * Also, update the scroll indicator before returning TRUE
- */
- if ((savecol = (savecol - num)) < 0)
- savecol = 0;
- fgo(0, savecol);
- setarrows();
- return(TRUE);
-}
diff --git a/usr/src/cmd/fmli/qued/wrap.c b/usr/src/cmd/fmli/qued/wrap.c
deleted file mode 100644
index 5987029702..0000000000
--- a/usr/src/cmd/fmli/qued/wrap.c
+++ /dev/null
@@ -1,156 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-
-/*
- * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-/* Copyright (c) 1984, 1985, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-#include <stdio.h>
-#include <curses.h>
-#include "wish.h"
-#include "token.h"
-#include "winp.h"
-#include "fmacs.h"
-#include "terror.h"
-
-#define MAXBOUND 3
-
-extern int acsinsstr();
-
-/*
- * PREV_BNDRY returns the position within the line of the previous blank
- * (or nonblank) starting from the last column of the current row
- */
-int
-prev_bndry(row, ch, val)
-int row;
-char ch;
-int val;
-{
- register int pos;
-
- for (pos = LASTCOL; pos >= 0; pos--)
- if ((freadchar(row, pos) == ch) == val)
- break;
- return(pos);
-}
-
-/*
- * WRAP returns TRUE if there is a character in the last line of the current
- * row and FALSE otherwise.
- */
-int
-wrap(void)
-{
- if (freadchar(Cfld->currow, LASTCOL) != ' ')
- return(TRUE);
- else
- return(FALSE);
-}
-
-/*
- * DO_WRAP performs the word wrap ... It returns the number of characters
- * that were wrapped to the next line.
- */
-int
-do_wrap(void)
-{
- register int i, need, pos, row;
- register chtype *bptr;
- int saverow, savecol;
- int numblanks;
- chtype *buff;
- int maxlength, totallength, lastnonblank;
-
- if ((row = Cfld->currow) >= LASTROW)
- return(-1); /* can't wrap on last line */
-
- saverow = row;
- savecol = Cfld->curcol;
-
- /*
- * see if wrap word fits on the next line
- */
- pos = prev_bndry(row, ' ', TRUE) + 1;
- need = LASTCOL - pos + 1;
- numblanks = padding(freadchar(row, LASTCOL));
- totallength = need + numblanks;
- lastnonblank = prev_bndry(row + 1, ' ', FALSE);
- maxlength = (LASTCOL - MAXBOUND + 1) - (lastnonblank + 1);
- if (totallength > maxlength)
- return(-1);
-
- /*
- * clear the word from the current line
- */
- fgo(row, pos);
- if ((buff = (chtype *)malloc((totallength + 1) * sizeof(*buff))) == NULL)
- fatal(NOMEM, "");
- bptr = buff;
- for (i = 0; i < need; i++) {
- *bptr++ = acsreadchar(row, pos++);
-/*>>ATTR<<*/ fputchar(' ');
- }
- for (i = 0; i < numblanks; i++)
- *bptr++ = ' ';
- *bptr = '\0';
-
- /*
- * .. and place it on the next row
- */
- fgo(row + 1, 0);
- acsinsstr(buff);
- free(buff);
-
- /*
- * replace the cursor and let the calling routine move it if
- * necessary
- */
- fgo(saverow, savecol);
-
- return(totallength - numblanks);
-}
-
-int
-padding(lastchar)
-int lastchar;
-{
- register int numblanks;
-
- /*
- * compute number of blanks that must follow the wrapped word
- */
- if (lastchar == '"' || lastchar == '\'')
- lastchar = freadchar(Cfld->currow, LASTCOL - 1);
- if (lastchar == '.' || lastchar == '?' || lastchar == ':' || lastchar == '!')
- numblanks = 2;
- else
- numblanks = 1;
- return(numblanks);
-}
diff --git a/usr/src/cmd/fmli/sys/Makefile b/usr/src/cmd/fmli/sys/Makefile
deleted file mode 100644
index 7e69ac8010..0000000000
--- a/usr/src/cmd/fmli/sys/Makefile
+++ /dev/null
@@ -1,62 +0,0 @@
-#
-# CDDL HEADER START
-#
-# The contents of this file are subject to the terms of the
-# Common Development and Distribution License, Version 1.0 only
-# (the "License"). You may not use this file except in compliance
-# with the License.
-#
-# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
-# or http://www.opensolaris.org/os/licensing.
-# See the License for the specific language governing permissions
-# and limitations under the License.
-#
-# When distributing Covered Code, include this CDDL HEADER in each
-# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
-# If applicable, add the following below this CDDL HEADER, with the
-# fields enclosed by brackets "[]" replaced with your own identifying
-# information: Portions Copyright [yyyy] [name of copyright owner]
-#
-# CDDL HEADER END
-#
-#
-# Copyright 2004 Sun Microsystems, Inc. All rights reserved.
-# Use is subject to license terms.
-#
-# ident "%Z%%M% %I% %E% SMI"
-#
-# cmd/fmli/sys/Makefile
-#
-LIBRARY = libsys.a
-
-OBJECTS = actrec.o ar_mfuncs.o backslash.o chgenv.o chgepenv.o \
- compile.o coproc.o copyfile.o estrtok.o evfuncs.o eval.o \
- evalstr.o exit.o expand.o expr.o filename.o genfind.o \
- getaltenv.o getepenv.o grep.o io.o itoa.o memshift.o \
- mencmds.o cut.o nstrcat.o onexit.o parent.o putaltenv.o \
- readfile.o scrclean.o spawn.o strappend.o strCcmp.o stream.o \
- strsave.o tempfiles.o terrmess.o terror.o test.o varappend.o \
- varchkapnd.o varcreate.o vardelete.o vargrow.o varinsert.o \
- varshrink.o watch.o
-
-# include library definitions
-include ../../../lib/Makefile.lib
-
-C99MODE= $(C99_DISABLE)
-
-# Specifically request the construction of a static library.
-# This library is not installed in the proto area.
-LIBS = $(LIBRARY)
-
-# inc must be first.
-CPPFLAGS = -I../inc $(CPPFLAGS.master)
-
-.KEEP_STATE:
-
-all: $(LIBS)
-
-install: all
- @echo "$(LIBRARY) is not installed."
-
-# include library targets
-include ../../../lib/Makefile.targ
diff --git a/usr/src/cmd/fmli/sys/actrec.c b/usr/src/cmd/fmli/sys/actrec.c
deleted file mode 100644
index 176e1febd0..0000000000
--- a/usr/src/cmd/fmli/sys/actrec.c
+++ /dev/null
@@ -1,684 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-
-/*
- * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-/* Copyright (c) 1984, 1985, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-#include <stdio.h>
-#include <sys/types.h>
-#include "wish.h"
-#include "token.h"
-#include "slk.h"
-#include "actrec.h"
-#include "menudefs.h"
-#include "ctl.h"
-#include "terror.h"
-#include "message.h"
-#include "moremacros.h"
-
-/* Functions for manipulating activation records */
-static struct actrec *AR_head;
- struct actrec *AR_cur;
-static int AR_serial = 0;
-
-void ar_dump();
-static void ar_cur_end();
-
-/* LES: becoming a MACRO
-
-struct actrec *
-ar_get_current()
-{
- return(AR_cur);
-}
-*/
-
-struct actrec *
-ar_create(rec)
-register struct actrec *rec;
-{
- register struct actrec *newrec;
- register struct actrec *ap;
-
- newrec = (struct actrec *)new(struct actrec);
- *newrec = *rec;
- newrec->serial = AR_serial++;
-
- /* link the new record right after the current record */
-
- if (AR_head == NULL) {
- /* nobody has been made yet, so make a degenerate list */
- AR_head = newrec;
- newrec->nextrec = newrec;
- newrec->prevrec = newrec;
- newrec->backup = newrec;
- }
- else {
- ap = (AR_cur ? AR_cur : AR_head);
- newrec->prevrec = ap;
- newrec->nextrec = ap->nextrec;
- newrec->backup = ap;
- ap->nextrec = newrec;
- newrec->nextrec->prevrec = newrec;
- }
- return(newrec);
-}
-
-struct actrec *
-ar_reinit(rec)
-register struct actrec *rec;
-{
- struct actrec *ret;
-
- ret = (struct actrec *) arf_reinit(rec, rec);
- if (rec == AR_cur)
- ar_setslks(rec->slks, rec->flags & AR_ALTSLKS);
- return ret;
-}
-
-int
-ar_reread(rec)
-register struct actrec *rec;
-{
- int ret; /* abs k15 */
-
- ret = arf_reread(rec, rec);
- if (rec == AR_cur && ret == SUCCESS) /* abs k15 */
- ar_setslks(rec->slks, rec->flags & AR_ALTSLKS);
- return ret;
-}
-
-struct actrec *
-ar_close(rec, logout)
-register struct actrec *rec;
-bool logout;
-{
- register struct actrec *ap;
- register struct actrec *new_cur;
- struct actrec *ar_cur_prev();
-
- if (rec == NULL && ((rec = AR_cur) == NULL))
- {
- error(MUNGED, "NULL actrec");
- return(rec);
- }
- /* don't allow recursive closes! */
- if (rec->lifetime == AR_CLOSING) /* abs k17 */
- return(rec); /* abs k17 */
-
- /* re-evaluate lifetime - if immortal, don't close */
- if (rec->lifetime != AR_INITIAL)
- (void) ar_ctl(rec, CTSETLIFE, 0, NULL, NULL, NULL, NULL, NULL);
- if (rec->lifetime == AR_IMMORTAL ||
- rec->lifetime == AR_INITIAL)
- {
- mess_temp("Can't close this frame\n");
- return rec;
- }
- else
- rec->lifetime = AR_CLOSING; /* abs k17 */
-
- /* close the internals of the record */
-
- if (arf_close(rec, rec) == FAIL)
- {
- error(MUNGED, "can't close actrec");
- return(AR_cur);
- }
-
- /* if closing current record and not exiting fmli, choose a new one */
- if (rec == AR_cur && !logout)
- new_cur = AR_cur->backup;
- else {
- if ( logout )
- AR_cur = AR_head;
- new_cur = NULL;
- }
-
- /* relink the lists */
- if (rec->nextrec == rec)
- AR_head = NULL;
- else
- {
- if (rec == AR_head)
- AR_head = rec->prevrec;
- rec->nextrec->prevrec = rec->prevrec;
- rec->prevrec->nextrec = rec->nextrec;
- for (ap = AR_cur; ap; )
- {
- if (ap->backup == rec)
- {
- ap->backup = rec->backup;
- break;
- }
- if ((ap = ap->backup) == AR_cur)
- {
- /* rec = NULL; causes core dump. abs k14 */
- break;
- }
- }
- }
- if (new_cur == rec)
- AR_cur = NULL;
- else if (new_cur)
- {
- register struct actrec *old_AR_cur;
-
- if (new_cur->lifetime == AR_CLOSING) /* abs k17 */
- AR_cur = new_cur; /* abs k17 */
- else /* abs k17 */
- {
- (void) arf_reinit(new_cur, new_cur);
- old_AR_cur = AR_cur;
- AR_cur = new_cur;
- ar_cur_end(old_AR_cur);
- }
- }
-#ifdef _DEBUG
- _debug(stderr, "FREEING ACTREC %x\n", rec);
-#endif
- if (rec)
- free(rec);
-#ifdef _DEBUG5
- ar_dump("AFTER ar_close");
-#endif
- return AR_cur;
-}
-
-struct actrec *
-ar_cur_next()
-{
- register struct actrec *ap;
- struct actrec *ar_current();
-
- for (ap = AR_cur->nextrec; ap && (ap->flags & AR_SKIP); ap = ap->nextrec)
- if (ap == AR_cur)
- break;
- if (ap != AR_cur)
- ap = ar_current(ap, TRUE); /* abs k15 */
- return ap;
-}
-
-struct actrec *
-ar_cur_prev()
-{
- register struct actrec *ap;
- struct actrec *ar_current();
-
- for (ap = AR_cur->prevrec; ap && (ap->flags & AR_SKIP); ap = ap->prevrec)
- if (ap == AR_cur)
- break;
- if (ap != AR_cur)
- ap = ar_current(ap, TRUE); /* abs k15 */
- return ap;
-}
-
-/*
- * front end for ar_current and ar_backup
- * cleans up previously current actrec and calls reinit on new current one
- */
-static void
-ar_cur_front(ap, do_reinit)
-register struct actrec *ap;
-bool do_reinit;
-{
- /*
- * if there is a current record, and that record is not the same
- * as the one we are making current, then either close it or make
- * it non-current, depending on its lifetime.
- * (call ar_ctl with CTSETLIFE to determine whether
- * the current object's "lifetime" has changed)
- * NOTE: lifetime can not change for initial objects
- */
- if (AR_cur && AR_cur != ap) {
-/* bug 1138884 - this code is not in the SVR3 version so...
- if (AR_cur->lifetime != AR_INITIAL)
- (void) ar_ctl(AR_cur, CTSETLIFE, 0, NULL, NULL, NULL, NULL, NULL);
-*/
- if (AR_cur->lifetime == AR_SHORTERM) {
- mess_lock(); /* don't ask ... */
- (void) ar_close(AR_cur, FALSE);
- mess_unlock();
- }
- (void) arf_noncur(AR_cur, AR_cur);
- mess_frame(""); /* clear frame message */
- }
- if (do_reinit == TRUE) /* abs k15 */
- (void) arf_reinit(ap, ap);
-}
-
-/*
- * back end for ar_current and ar_backup
- * calls current function and sets slks
- * "ap" is actrec to make current if it fails
- */
-static void
-ar_cur_end(ap)
-register struct actrec *ap;
-{
- ar_setslks(AR_cur->slks, AR_cur->flags & AR_ALTSLKS);
- if (arf_current(AR_cur, AR_cur) == FAIL)
- {
- if (AR_cur->lifetime == AR_INITIAL && AR_cur->nextrec == AR_cur)
- fatal(MUNGED, "can't make only actrec current");
- else
- {
- error(MUNGED, "can't make actrec current");
- AR_cur = ap;
- ar_setslks(AR_cur->slks, AR_cur->flags & AR_ALTSLKS);
- }
- }
- else
- (void) ar_ctl(AR_cur, CTSETMSG, FALSE, NULL, NULL, NULL, NULL, NULL);
-
-
-#ifdef _DEBUG5
- ar_dump("at end of ar_current");
-#endif
-}
-
-struct actrec *
-ar_backup()
-{
- register struct actrec *ap;
- register struct actrec *old_AR_cur;
-
- ap = AR_cur->backup;
- ar_cur_front( ap , TRUE ); /* miked k17 */
- old_AR_cur = AR_cur;
- AR_cur = ap;
- ar_cur_end(old_AR_cur);
- return AR_cur;
-}
-
-struct actrec *
-ar_current(rec, do_reinit)
-register struct actrec *rec;
-bool do_reinit; /* abs k15 */
-{
- register struct actrec *ap;
- pid_t pid; /* miked k17 */
-
- /* do not make rec current if it's closing. abs k17 */
- if (rec && rec->lifetime == AR_CLOSING && /* abs k17 */
- ar_ctl(rec, CTGETPID, &pid, NULL, NULL, NULL, NULL, NULL) == FAIL ) /* miked k17 */
- return(AR_cur); /* abs k17 */
-
- ar_cur_front(rec, do_reinit); /* abs k15 */
- /*
- * backup is a circularly linked list
- */
- if (AR_cur == NULL)
- /* produce degenerate list */
- rec->backup = rec;
- else if (AR_cur != rec) {
- /* traverse entire list */
- for (ap = AR_cur; ap->backup != AR_cur; ap = ap->backup) {
- /*
- * if rec is in list and is not where we want it
- * unlink it from list
- */
- if (ap->backup == rec && rec->backup != AR_cur)
- ap->backup = ap->backup->backup;
- }
- /* if rec is not where we want it, link it in befre cur */
- if (ap != rec) {
- rec->backup = ap->backup;
- ap->backup = rec;
- }
- }
- AR_cur = rec;
- ar_cur_end(AR_cur->backup);
- return AR_cur;
-}
-
-
-
-/* a minimal version of ar_current for use when the frame is
- * made current only for internal purposes. for example, used
- * when doing a reread from ar_checkworld. The user doesn't
- * see a change in what frame is current but internally we
- * make the frame current so we can update it.
- */
-
-int
-ar_cur_temp(rec)
-register struct actrec *rec;
-{
-
-
- /* do not make rec current if it's closing. abs k17 */
- if (rec && rec->lifetime == AR_CLOSING) /* abs k17 */
- return(FAIL); /* abs k17 */
-
- if (AR_cur && AR_cur != rec)
- (void) arf_noncur(AR_cur, AR_cur);
- if (rec->backup == NULL)
- /* produce degenerate list */
- rec->backup = rec;
- AR_cur = rec;
- if (arf_temp_current(AR_cur, AR_cur) == FAIL)
- {
- if (AR_cur->lifetime == AR_INITIAL && AR_cur->nextrec == AR_cur)
- fatal(MUNGED, "can't make only actrec current"); /* exit fmli */
- else
- {
- error(MUNGED, "can't make actrec current");
- AR_cur = AR_cur->backup;
- return FAIL;
- }
- }
- return SUCCESS;
-}
-
-
-int
-ar_setslks(s, flags)
-struct slk *s;
-int flags;
-{
- setslks(s, flags);
- return SUCCESS;
-}
-
-token
-actrec_stream(t)
-token t;
-{
- return arf_odsh(AR_cur, t);
-}
-
-/* find an activation record via its window number */
-
-struct actrec *
-wdw_to_ar(wdw)
-int wdw;
-{
- struct actrec *p;
-
- for (p = AR_head; p; p = p->nextrec)
- if (wdw == ar_ctl(p, CTGETWDW, NULL, NULL, NULL, NULL, NULL, NULL))
- return p;
- else if (p->nextrec == AR_head)
- return NULL;
- return NULL;
-}
-
-/* find an activation record via its path */
-
-struct actrec *
-path_to_ar(s)
-char *s;
-{
- struct actrec *p;
-
- for (p = AR_head; p; p = p->nextrec)
- if ((p->path != NULL) && (s != NULL) &&
- (strcmp(p->path, s) == 0))
- return p;
- else if (p->nextrec == AR_head)
- return NULL;
- return NULL;
-}
-
-bool
-path_isopen(s, op, exact)
-char *s, *op;
-bool exact; /* if TRUE, don't allow exact match */
-{
- struct actrec *p;
- int len = strlen(s);
-
- for (p = AR_head; p->path; p = p->nextrec) {
- if (exact && strcmp(p->path, s) == 0) {
- mess_temp(nstrcat("Can't ", op,
- " an open object, close it first", NULL));
- return(TRUE);
- } else if (strncmp(p->path, s, len) == 0 && p->path[len] == '/') {
- mess_temp(nstrcat("Can't ", op,
- " a folder with open sub-folders, close them first", NULL));
- return(TRUE);
- } else if (p->nextrec == AR_head)
- break;
- }
- return FALSE;
-}
-
-/* find the activation record past the argument given with a certain path */
-
-struct actrec *
-nextpath_to_ar(ar)
-register struct actrec *ar;
-{
- register struct actrec *p;
-
- for (p = ar->nextrec; p != ar; p = p->nextrec) {
- if ((p->path != NULL) && (ar->path != NULL)) {
- if (strcmp(p->path, ar->path) == 0)
- return(p);
- } else if ((p->path == NULL) && (ar->path == NULL))
- return(p);
- }
- return(NULL);
-}
-
-struct actrec *
-ar_cleanup(life) /* clean up all records with lifetime <= life */
-register int life;
-{
- register struct actrec *p, *nextp;
- register bool logout;
-
- logout = (life == AR_INITIAL) ? TRUE : FALSE; /* are we exiting fmli? */
-/* p = AR_head miked k17+ */;
- nextp = AR_head->nextrec; /* miked k17+ */
- do
- {
-/* p = p->nextrec; miked k17+ */
- p = nextp; /* miked k17+ */
- nextp = p->nextrec; /* miked k17+ */
- if (p->lifetime <= life && !(life < AR_IMMORTAL && p->flags & AR_SKIP))
- (void) ar_close(p, logout);
- } while ((AR_head != NULL) && (p != AR_head));
-
- return(AR_cur);
-}
-
-int
-ar_help(rec) /* do help on current actrec */
-struct actrec *rec;
-{
- return(arf_help(rec, rec));
-}
-
-void
-ar_checkworld(force)
-bool force; /* if TRUE, forced check */
-{
- struct actrec *rec, *start_rec, *sav_cur = AR_cur;
- static time_t last_check; /* EFT abs k16 */
- static bool first_time = TRUE; /* abs k15 */
- extern long Mail_check;
- extern time_t Cur_time; /* EFT abs k16 */
-
- if (force == FALSE &&
- (Cur_time <= last_check + Mail_check || first_time == TRUE)) /* abs k15 */
- {
- first_time = FALSE; /* abs k15 */
- return;
- }
- last_check = Cur_time;
-
- start_rec = AR_cur->backup->backup; /* miked k17+ */
- if ( start_rec == AR_cur )
- start_rec = AR_cur->backup;
-
-/* for (rec = AR_head; rec; rec = rec->nextrec) miked k17+ */
- for (rec = start_rec; rec; rec = rec->backup)
- {
- if (ar_cur_temp(rec) == SUCCESS) /* abs k15 */
- (void) arf_reinit(rec, rec);
-/* if (rec->nextrec == AR_head) miked k17+ */
- if (rec->backup == start_rec)
- break;
- }
- (void) ar_cur_temp(sav_cur);
- (void) ar_ctl(AR_cur, CTSETMSG, FALSE, NULL, NULL, NULL, NULL, NULL);
-}
-
-int
-ar_isfirst(ar1, ar2)
-struct actrec *ar1, *ar2;
-{
- register struct actrec *p;
-
- for (p = AR_cur; p->backup != AR_cur; p = p->backup) {
- if (p == ar1)
- return(TRUE);
- else if (p == ar2)
- return(FALSE);
- }
- return(TRUE); /* should not get this far */
-}
-
-struct actrec *
-menline_to_ar(n)
-int n;
-{
- register int i;
- register struct actrec *p;
-
- for (p = AR_head, i = -1; p; p = p->nextrec) {
- /* records with NULL path fields are not listed */
- if (p->path) {
- if (++i == n)
- return(p);
- }
- if (p->nextrec == AR_head)
- break;
- }
- return NULL;
-}
-
-struct menu_line
-ar_menudisp(n, ptr)
-register int n;
-register char *ptr;
-{
- register struct actrec *p;
- struct menu_line m;
-
- m.description = NULL;
- m.flags = 0;
- if (p = menline_to_ar(n))
- (void) ar_ctl(p, CTGETITLE, &m.highlight, NULL, NULL, NULL, NULL, NULL);
- else
- m.highlight = NULL;
- return m;
-}
-
-int /* >>>>>> NONPORTABLE!!! change to "char *" <<<<<<< */
-ar_ctl(rec, cmd, arg1, arg2, arg3, arg4, arg5, arg6)
-struct actrec *rec;
-int cmd;
-int arg1, arg2, arg3, arg4, arg5, arg6;
-{
- if (rec == NULL)
- return(FAIL);
-/* if (cmd == CTSETLIFE && arg1 != 0)
- {
- rec->lifetime = arg1;
- return(SUCCESS);
- }
- else
- return((*(rec->fcntbl[AR_CTL]))
- (rec, cmd, arg1, arg2, arg3, arg4, arg5, arg6));
-abs */
- switch (cmd)
- {
- case CTSETLIFE:
- if (arg1 != 0)
- {
- rec->lifetime = arg1;
- return(SUCCESS);
- }
- else
- return((*(rec->fcntbl[AR_CTL]))
- (rec, cmd, arg1, arg2, arg3, arg4, arg5, arg6));
- break;
- case CTSETINTR: /* >>> ADD FREE STR CODE <<< */
- if ((char *)arg1 == NULL)
- rec->interrupt = (char *)strsave(init_ctl(CTGETINTR));
- else
- rec->interrupt = (char *)strsave((char *)arg1);
- return(SUCCESS);
- case CTGETINTR:
- return((int)rec->interrupt);
- case CTSETONINTR: /* >>> ADD FREE STR CODE <<< */
- if ((char *)arg1 == NULL)
- rec->oninterrupt = (char *)strsave(init_ctl(CTGETONINTR));
- else
- rec->oninterrupt = (char *)strsave((char *)arg1);
- return(SUCCESS);
- case CTGETONINTR:
- return((int)rec->oninterrupt);
- default:
- return((*(rec->fcntbl[AR_CTL]))
- (rec, cmd, arg1, arg2, arg3, arg4, arg5, arg6));
- }
-}
-
-#ifdef _DEBUG5
-
-/* for debugging - print out activation record info */
-void
-ar_dump(s)
-char *s;
-{
- struct actrec *p;
-
- _debug5(stderr, "---------- Activation Record Dump: %s ----------\n", s);
- _debug5(stderr, " #\tprev\tnext\tbackup\tpath\n");
-
- for (p = AR_head; p; p = p->nextrec) {
- _debug5(stderr, "%2d\t", p->serial);
- _debug5(stderr, "%2d\t", p->prevrec?p->prevrec->serial:-1);
- _debug5(stderr, "%2d\t", p->nextrec?p->nextrec->serial:-1);
- _debug5(stderr, "%2d\t", p->backup?p->backup->serial:-1);
- _debug5(stderr, "%5.5s", (p==AR_cur)?"CUR>>":" ");
- _debug5(stderr, "%s\n", p->path);
- if (p->nextrec == AR_head)
- break;
- }
- _debug5(stderr, "Current = %s\n", AR_cur?AR_cur->path:"NULL");
- _debug5(stderr, "Head = %s\n", AR_head?AR_head->path:"NULL");
- _debug5(stderr, "-------------**Dump End**------------------\n");
-}
-#endif
diff --git a/usr/src/cmd/fmli/sys/ar_mfuncs.c b/usr/src/cmd/fmli/sys/ar_mfuncs.c
deleted file mode 100644
index 521148c773..0000000000
--- a/usr/src/cmd/fmli/sys/ar_mfuncs.c
+++ /dev/null
@@ -1,104 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/* Copyright (c) 1984, 1985, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-#include <stdio.h>
-#include "wish.h"
-#include "token.h"
-#include "slk.h"
-#include "actrec.h"
-
-/* This file contains standard menu functions that can be used for
- * popup internal menus. They simply take the activation record
- * pointer's id field and call the equivalent menu function.
- */
-
-int
-AR_MEN_CLOSE(a)
-struct actrec *a;
-{ return(menu_close(a->id)); }
-
-int
-AR_MEN_CURRENT(a)
-struct actrec *a;
-{ return(menu_current(a->id)); }
-
-int
-AR_MEN_NONCUR(a)
-struct actrec *a;
-{ return(menu_noncurrent(a->id)); }
-
-int
-AR_NOP(a)
-struct actrec *a;
-{ return(SUCCESS); }
-
-int
-AR_NOHELP(a)
-struct actrec *a;
-{
- mess_temp("No help available here");
- return(SUCCESS);
-}
-
-int
-AR_MEN_CTL(a, cmd, arg1, arg2, arg3, arg4, arg5, arg6)
-struct actrec *a;
-int cmd, arg1, arg2, arg3, arg4, arg5, arg6;
-{ return(menu_ctl(a->id, cmd, arg1, arg2, arg3, arg4, arg5, arg6)); }
-
-token
-AR_MEN_ODSH(a, t)
-struct actrec *a;
-token t;
-{
- token menu_stream();
-
- if (t == TOK_CANCEL)
- t = TOK_CLOSE;
- return(menu_stream(t));
-}
-
-void
-ar_menu_init(a)
-struct actrec *a;
-{
- extern struct slk Echslk[];
-
- a->lifetime = AR_SHORTERM;
- a->path = NULL;
- a->odptr = NULL;
- a->slks = &Echslk[0];
- a->flags = 0;
- a->fcntbl[AR_CLOSE] = AR_MEN_CLOSE;
- a->fcntbl[AR_REREAD] = AR_NOP;
- a->fcntbl[AR_REINIT] = AR_NOP;
- a->fcntbl[AR_CURRENT] = AR_MEN_CURRENT;
- a->fcntbl[AR_TEMP_CUR] = AR_MEN_CURRENT; /* abs k16 */
- a->fcntbl[AR_NONCUR] = AR_MEN_NONCUR;
- a->fcntbl[AR_CTL] = AR_MEN_CTL;
- a->fcntbl[AR_ODSH] = (int (*)())AR_MEN_ODSH; /* added cast abs */
- a->fcntbl[AR_HELP] = AR_NOHELP;
-}
diff --git a/usr/src/cmd/fmli/sys/backslash.c b/usr/src/cmd/fmli/sys/backslash.c
deleted file mode 100644
index 4b6af99982..0000000000
--- a/usr/src/cmd/fmli/sys/backslash.c
+++ /dev/null
@@ -1,117 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-/*
- * Copyright (c) 1986 AT&T
- * All Rights Reserved
- */
-
-#ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.1 */
-
-#include <stdio.h>
-#include <ctype.h>
-#include "wish.h"
-
-char *strchr();
-
-static char withbs[] = "\b\f\n\r\t\\\33";
-static char woutbs[] = "bfnrt\\E";
-
-char *
-backslash(s, n)
-char *s;
-int n;
-{
- char *_backslash();
-
- return _backslash(s, n, withbs, woutbs);
-}
-
-char *
-_backslash(s, n, in, out)
-char *s;
-int n;
-char *in;
-char *out;
-{
- register char *dst;
- register char *p;
-
- n -= strlen(s);
- for (dst = s; *dst; dst++) {
- if (!isprint(*dst)) {
- if ((p = strchr(in, *dst)) && n > 0) {
- *dst++ = '\\';
- memshift(dst + 1, dst, strlen(dst) + 1);
- *dst = out[p - in];
- n--;
- }
- else {
- register int c;
-
- memshift(dst + 3, dst, strlen(dst) + 1);
- c = *dst;
- *dst++ = '\\';
- *dst++ = ((c >> 6) & 3) + '0';
- *dst++ = ((c >> 3) & 7) + '0';
- *dst = (c & 7) + '0';
- }
- }
- }
- return s;
-}
-
-char *
-unbackslash(s)
-char *s;
-{
- register char *src;
- register char *dst;
- register char *p;
-
- for (dst = src = s; *src; src++) {
- if (*src == '\\') {
- if (p = strchr(woutbs, src[1])) {
- *dst++ = withbs[p - woutbs];
- src++;
- }
- else if (isdigit(src[1])) {
- register int c;
-
- c = *++src - '0';
- if (isdigit(src[1])) {
- c = (c << 3) + *++src - '0';
- if (isdigit(src[1]))
- c = (c << 3) + *++src - '0';
- }
- *dst++ = c;
- }
- }
- else
- *dst++ = *src;
- }
- *dst = '\0';
- return s;
-}
diff --git a/usr/src/cmd/fmli/sys/chgenv.c b/usr/src/cmd/fmli/sys/chgenv.c
deleted file mode 100644
index f8ede4ffec..0000000000
--- a/usr/src/cmd/fmli/sys/chgenv.c
+++ /dev/null
@@ -1,121 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-/*
- * Copyright (c) 1985 AT&T
- * All Rights Reserved
- */
-#ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.1 */
-
-#include <stdio.h>
-#include <fcntl.h>
-
-#define LOOKING 1
-#define SKIPPING 2
-
-char *
-chgenv(file, name, val)
-char *file;
-char *name;
-char *val;
-{
- char inbuf[BUFSIZ];
- char outbuf[BUFSIZ];
- register char *p;
- char *index;
- register int c;
- register int state;
- register FILE *infp;
- register FILE *outfp;
- int len;
- char *strnsave();
- char *backslash();
- FILE *tempfile();
-
- if ((outfp = tempfile(NULL, "w+")) == NULL)
- return NULL;
- setbuf(outfp, outbuf);
- if (val) {
- fputs(name, outfp);
- putc('=', outfp);
- len = 2 * strlen(val);
- fputs(p = backslash(strnsave(val, len), len), outfp);
- free(p);
- putc('\n', outfp);
- }
- if ((infp = fopen(file, "r+"))) {
- setbuf(infp, inbuf);
- state = LOOKING;
- index = name;
- for (c = getc(infp); c != EOF; c = getc(infp)) {
- if (state == SKIPPING) {
- if (c == '\n') {
- state = LOOKING;
- index = name;
- }
- continue;
- }
- if (state == LOOKING) {
- /* if we are in name */
- if (*index) {
- if (c == *index) {
- index++;
- continue;
- }
- }
- /* found name, look for "=" */
- else if (c == '=') {
- state = SKIPPING;
- continue;
- }
- /* failure, copy line to outfile */
- for (p = name; p < index; p++)
- putc(*p, outfp);
- state = 0;
- }
- if (c == '\n') {
- state = LOOKING;
- index = name;
- }
- putc(c, outfp);
- }
- fclose(infp);
- }
- {
- register int fd;
- register int n;
-
- if ((fd = open(file, O_WRONLY | O_CREAT | O_TRUNC, 0640)) >= 0) {
- fseek(outfp, 0L, 0);
- while ((n = fread(inbuf, 1, sizeof(inbuf), outfp)) > 0)
- write(fd, inbuf, n);
- close(fd);
- }
- else
- val = NULL;
- }
- fclose(outfp);
- return val;
-}
diff --git a/usr/src/cmd/fmli/sys/chgepenv.c b/usr/src/cmd/fmli/sys/chgepenv.c
deleted file mode 100644
index 509050da3c..0000000000
--- a/usr/src/cmd/fmli/sys/chgepenv.c
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-/*
- * Copyright (c) 1985 AT&T
- * All Rights Reserved
- */
-#ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.2 */
-
-#include <stdio.h>
-#include "sizes.h"
-
-
-char *
-chgepenv(name, value)
-char *name, *value;
-{
- char dirpath[PATHSIZ];
- extern char *Home;
- char *strcat();
- char *strcpy();
- char *chgenv();
-
- return chgenv(strcat(strcpy(dirpath, Home), "/pref/.environ"), name, value);
-}
diff --git a/usr/src/cmd/fmli/sys/compile.c b/usr/src/cmd/fmli/sys/compile.c
deleted file mode 100644
index c1f89f0912..0000000000
--- a/usr/src/cmd/fmli/sys/compile.c
+++ /dev/null
@@ -1,544 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/*
- * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-#include <stdio.h>
-
-#define GETC(x) (*x++)
-#define PEEKC(x) (*x)
-#define UNGETC(x) (--x)
-
-#define CBRA 2
-#define CCHR 4
-#define CDOT 8
-#define CCL 12
-#define CXCL 16
-#define CDOL 20
-#define CCEOF 22
-#define CKET 24
-#define CBACK 36
-#define NCCL 40
-
-#define STAR 01
-#define RNGE 03
-
-#define NBRA 9
-
-#define PLACE(c) ep[c >> 3] |= bittab[c & 07]
-#define ISTHERE(c) (ep[c >> 3] & bittab[c & 07])
-#define ecmp(s1, s2, n) (!strncmp(s1, s2, n))
-
-int sed, nbra;
-char *braslist[NBRA];
-char *braelist[NBRA];
-char *loc1, *loc2, *locs;
-static int nodelim;
-
-int circf;
-static int low;
-static int size;
-
-/*
- * 128 cannot be represented in a char (it becomes -127) - thus
- * decl changed to unsigned char.
- */
-static void getrnge(char *str);
-
-static unsigned char bittab[] = { 1, 2, 4, 8, 16, 32, 64, 128 };
-
-char *
-compile(instring, ep, endbuf, seof, errfunc)
-char *ep;
-char *instring, *endbuf;
-void (*errfunc)();
-{
- char *sp = instring;
- int c;
- int eof = seof;
- char *lastep = instring;
- int cclcnt;
- char bracket[NBRA], *bracketp;
- int closed;
- int neg;
- int lc;
- int i, cflg;
- int iflag; /* used for non-ascii characters in brackets */
-
- /*
- (re)initialize globals (necessary so that if compile()
- is called more than once, globals will be reset ... see
- fmlexpr() which references several of these globals)
- */
- sed = nbra = 0;
- braslist[0] = braelist[0] = NULL;
- loc1 = loc2 = locs = NULL;
-
- lastep = 0;
- if((c = GETC(sp)) == eof || c == '\n') {
- if(c == '\n') {
- UNGETC(sp);
- nodelim = 1;
- }
- if(*ep == 0 && !sed)
- (*errfunc)(41);
- return(ep);
- }
- bracketp = bracket;
- circf = closed = nbra = 0;
- if(c == '^')
- circf++;
- else
- UNGETC(sp);
- while(1) {
- if(ep >= endbuf)
- (*errfunc)(50);
- c = GETC(sp);
- if(c != '*' && ((c != '\\') || (PEEKC(sp) != '{')))
- lastep = ep;
- if(c == eof) {
- *ep++ = CCEOF;
- if (bracketp != bracket)
- (*errfunc)(42);
- return(ep);
- }
- switch(c) {
-
- case '.':
- *ep++ = CDOT;
- continue;
-
- case '\n':
- if(!sed) {
- UNGETC(sp);
- *ep++ = CCEOF;
- nodelim = 1;
- if(bracketp != bracket)
- (*errfunc)(42);
- return(ep);
- }
- else (*errfunc)(36);
- case '*':
- if(lastep == 0 || *lastep == CBRA || *lastep == CKET)
- goto defchar;
- *lastep |= STAR;
- continue;
-
- case '$':
- if(PEEKC(sp) != eof && PEEKC(sp) != '\n')
- goto defchar;
- *ep++ = CDOL;
- continue;
-
- case '[':
- if(&ep[17] >= endbuf)
- (*errfunc)(50);
-
- *ep++ = CCL;
- lc = 0;
- for(i = 0; i < 16; i++)
- ep[i] = 0;
-
- neg = 0;
- if((c = GETC(sp)) == '^') {
- neg = 1;
- c = GETC(sp);
- }
- iflag = 1;
- do {
- c &= 0377;
- if(c == '\0' || c == '\n')
- (*errfunc)(49);
- if((c & 0200) && iflag) {
- iflag = 0;
- if(&ep[32] >= endbuf)
- (*errfunc)(50);
- ep[-1] = CXCL;
- for(i = 16; i < 32; i++)
- ep[i] = 0;
- }
- if(c == '-' && lc != 0) {
- if((c = GETC(sp)) == ']') {
- PLACE('-');
- break;
- }
- if((c & 0200) && iflag) {
- iflag = 0;
- if(&ep[32] >= endbuf)
- (*errfunc)(50);
- ep[-1] = CXCL;
- for(i = 16; i < 32; i++)
- ep[i] = 0;
- }
- while(lc < c ) {
- PLACE(lc);
- lc++;
- }
- }
- lc = c;
- PLACE(c);
- } while((c = GETC(sp)) != ']');
-
- if(iflag)
- iflag = 16;
- else
- iflag = 32;
-
- if(neg) {
- if(iflag == 32) {
- for(cclcnt = 0; cclcnt < iflag; cclcnt++)
- ep[cclcnt] ^= 0377;
- ep[0] &= 0376;
- } else {
- ep[-1] = NCCL;
- /* make nulls match so test fails */
- ep[0] |= 01;
- }
- }
-
- ep += iflag;
-
- continue;
-
- case '\\':
- switch(c = GETC(sp)) {
-
- case '(':
- if(nbra >= NBRA)
- (*errfunc)(43);
- *bracketp++ = nbra;
- *ep++ = CBRA;
- *ep++ = nbra++;
- continue;
-
- case ')':
- if(bracketp <= bracket)
- (*errfunc)(42);
- *ep++ = CKET;
- *ep++ = *--bracketp;
- closed++;
- continue;
-
- case '{':
- if(lastep == (char *) 0)
- goto defchar;
- *lastep |= RNGE;
- cflg = 0;
- nlim:
- c = GETC(sp);
- i = 0;
- do {
- if('0' <= c && c <= '9')
- i = 10 * i + c - '0';
- else
- (*errfunc)(16);
- } while(((c = GETC(sp)) != '\\') && (c != ','));
- if(i >= 255)
- (*errfunc)(11);
- *ep++ = i;
- if(c == ',') {
- if(cflg++)
- (*errfunc)(44);
- if((c = GETC(sp)) == '\\')
- *ep++ = 255;
- else {
- UNGETC(sp);
- goto nlim;
- /* get 2'nd number */
- }
- }
- if(GETC(sp) != '}')
- (*errfunc)(45);
- if(!cflg) /* one number */
- *ep++ = i;
- else if((ep[-1] & 0377) < (ep[-2] & 0377))
- (*errfunc)(46);
- continue;
-
- case '\n':
- (*errfunc)(36);
-
- case 'n':
- c = '\n';
- goto defchar;
-
- default:
- if(c >= '1' && c <= '9') {
- if((c -= '1') >= closed)
- (*errfunc)(25);
- *ep++ = CBACK;
- *ep++ = c;
- continue;
- }
- }
- /* Drop through to default to use \ to turn off special chars */
-
- defchar:
- default:
- lastep = ep;
- *ep++ = CCHR;
- *ep++ = c;
- }
- }
-}
-
-int step(p1, p2)
-char *p1, *p2;
-{
- int c;
-
-
- if(circf) {
- loc1 = p1;
- return(advance(p1, p2));
- }
- /* fast check for first character */
- if(*p2 == CCHR) {
- c = p2[1];
- do {
- if(*p1 != c)
- continue;
- if(advance(p1, p2)) {
- loc1 = p1;
- return(1);
- }
- } while(*p1++);
- return(0);
- }
- /* regular algorithm */
- do {
- if(advance(p1, p2)) {
- loc1 = p1;
- return(1);
- }
- } while(*p1++);
- return(0);
-}
-
-int
-advance(lp, ep)
-char *lp, *ep;
-{
- char *curlp;
- int c;
- char *bbeg;
- char neg;
- int ct;
-
- while(1) {
- neg = 0;
- switch(*ep++) {
-
- case CCHR:
- if(*ep++ == *lp++)
- continue;
- return(0);
-
- case CDOT:
- if(*lp++)
- continue;
- return(0);
-
- case CDOL:
- if(*lp == 0)
- continue;
- return(0);
-
- case CCEOF:
- loc2 = lp;
- return(1);
-
- case CXCL:
- c = (unsigned char)*lp++;
- if(ISTHERE(c)) {
- ep += 32;
- continue;
- }
- return(0);
-
- case NCCL:
- neg = 1;
-
- case CCL:
- c = *lp++;
- if(((c & 0200) == 0 && ISTHERE(c)) ^ neg) {
- ep += 16;
- continue;
- }
- return(0);
-
- case CBRA:
- braslist[*ep++] = lp;
- continue;
-
- case CKET:
- braelist[*ep++] = lp;
- continue;
-
- case CCHR | RNGE:
- c = *ep++;
- getrnge(ep);
- while(low--)
- if(*lp++ != c)
- return(0);
- curlp = lp;
- while(size--)
- if(*lp++ != c)
- break;
- if(size < 0)
- lp++;
- ep += 2;
- goto star;
-
- case CDOT | RNGE:
- getrnge(ep);
- while(low--)
- if(*lp++ == '\0')
- return(0);
- curlp = lp;
- while(size--)
- if(*lp++ == '\0')
- break;
- if(size < 0)
- lp++;
- ep += 2;
- goto star;
-
- case CXCL | RNGE:
- getrnge(ep + 32);
- while(low--) {
- c = (unsigned char)*lp++;
- if(!ISTHERE(c))
- return(0);
- }
- curlp = lp;
- while(size--) {
- c = (unsigned char)*lp++;
- if(!ISTHERE(c))
- break;
- }
- if(size < 0)
- lp++;
- ep += 34; /* 32 + 2 */
- goto star;
-
- case NCCL | RNGE:
- neg = 1;
-
- case CCL | RNGE:
- getrnge(ep + 16);
- while(low--) {
- c = *lp++;
- if(((c & 0200) || !ISTHERE(c)) ^ neg)
- return(0);
- }
- curlp = lp;
- while(size--) {
- c = *lp++;
- if(((c & 0200) || !ISTHERE(c)) ^ neg)
- break;
- }
- if(size < 0)
- lp++;
- ep += 18; /* 16 + 2 */
- goto star;
-
- case CBACK:
- bbeg = braslist[*ep];
- ct = braelist[*ep++] - bbeg;
-
- if(ecmp(bbeg, lp, ct)) {
- lp += ct;
- continue;
- }
- return(0);
-
- case CBACK | STAR:
- bbeg = braslist[*ep];
- ct = braelist[*ep++] - bbeg;
- curlp = lp;
- while(ecmp(bbeg, lp, ct))
- lp += ct;
-
- while(lp >= curlp) {
- if(advance(lp, ep)) return(1);
- lp -= ct;
- }
- return(0);
-
-
- case CDOT | STAR:
- curlp = lp;
- while(*lp++);
- goto star;
-
- case CCHR | STAR:
- curlp = lp;
- while(*lp++ == *ep);
- ep++;
- goto star;
-
- case CXCL | STAR:
- curlp = lp;
- do {
- c = (unsigned char)*lp++;
- } while(ISTHERE(c));
- ep += 32;
- goto star;
-
- case NCCL | STAR:
- neg = 1;
-
- case CCL | STAR:
- curlp = lp;
- do {
- c = *lp++;
- } while(((c & 0200) == 0 && ISTHERE(c)) ^ neg);
- ep += 16;
- goto star;
-
- star:
- do {
- if(--lp == locs)
- break;
- if(advance(lp, ep))
- return(1);
- } while(lp > curlp);
- return(0);
-
- }
- }
-}
-
-static void
-getrnge(char *str)
-{
- low = *str++ & 0377;
- size = ((*str & 0377) == 255)? 20000: (*str &0377) - low;
-}
diff --git a/usr/src/cmd/fmli/sys/coproc.c b/usr/src/cmd/fmli/sys/coproc.c
deleted file mode 100644
index ac7d9d081c..0000000000
--- a/usr/src/cmd/fmli/sys/coproc.c
+++ /dev/null
@@ -1,394 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-
-/*
- * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-/* Copyright (c) 1984, 1985, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-#include <ctype.h>
-#include <stdio.h>
-#include <fcntl.h>
-#include <string.h>
-#include <signal.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <errno.h> /* EFT abs k16 */
-#include "wish.h"
-#include "terror.h"
-#include "var_arrays.h"
-#include "eval.h"
-#include "moremacros.h"
-#include "sizes.h"
-
-typedef struct {
- char *id;
- char *w_path;
- char *r_path;
- FILE *writefp;
- char *expect;
- char *send;
- char **refs;
-} COREC;
-
-#define FREE(STR) if (STR) free(STR)
-
-static COREC *Cotable = NULL;
-static int Cur_corec = -1;
-static FILE *Readfp, *Writefp;
-int Coproc_active = 0;
-extern char Semaphore[]; /* path of FIFO for process synchronization */
-extern pid_t Fmli_pid; /* process ID of FMLI. EFT k16 abs */
-
-int
-cosend(argc, argv, instr, outstr, errstr)
-int argc;
-char **argv;
-IOSTRUCT *instr;
-IOSTRUCT *outstr;
-IOSTRUCT *errstr;
-{
- register int i, blocking;
- void (*osig)();
- char *exp;
- char buf[BUFSIZ];
- char **args;
-
- args = argv;
- if (strcmp(args[1], "-n") == 0) { /* if no-blocking mode */
- args++;
- blocking = FALSE;
- }
- else
- blocking = TRUE;
- if ((i = findtab(args[1])) == -1) /* look-up coproc in proc tab */
- return(NULL);
- make_cur(i); /* make the coproc current */
- osig = sigset(SIGPIPE, SIG_IGN); /* ignore interrupts */
- for (i = 2; (args[i]) && (i < argc); i++) {
- if (i > 2)
- putc(' ', Writefp);
- fputs(args[i], Writefp);
- }
- putc('\n', Writefp);
- if (Cotable[Cur_corec].send) {
- fputs(Cotable[Cur_corec].send, Writefp);
- putc('\n', Writefp);
- }
- fflush(Writefp);
- (void) sigset(SIGPIPE, osig); /* was signal() abs */
- if (blocking) { /* if blocking on a response from coproc */
- if (!(exp = Cotable[Cur_corec].expect)) {
- fgets(buf, BUFSIZ, Readfp);
- putastr(buf, outstr);
- }
- else {
- while (fgets(buf, BUFSIZ, Readfp)) {
- if (strncmp(buf, exp, strlen(exp)) == 0)
- break;
- putastr(buf, outstr);
- }
- }
- }
- return(SUCCESS);
-}
-
-int
-findtab(str)
-char *str;
-{
- int i;
- int lcv;
-
- lcv = array_len(Cotable);
- for (i = 0; i < lcv; i++)
- if (strcmp(Cotable[i].id, str) == 0)
- return(i);
- return(-1);
-}
-
-int
-make_cur(i)
-int i;
-{
- if (Cur_corec == i)
- return (0);
- if (Cur_corec != -1)
- fclose(Readfp);
- Cur_corec = i;
- if (i == -1)
- return (0);
- if (!(Cotable[Cur_corec].writefp) && ((Cotable[Cur_corec].writefp = fopen(Cotable[Cur_corec].w_path, "w")) == NULL))
- warn(NOPEN, "the write pipe");
- Writefp = Cotable[Cur_corec].writefp;
- if ((Readfp = fopen(Cotable[Cur_corec].r_path, "r")) == NULL)
- warn(NOPEN, "the read pipe");
- return (0);
-}
-
-int
-cocreate(argc, args, instr, outstr, errstr)
-int argc;
-char **args;
-IOSTRUCT *instr;
-IOSTRUCT *outstr;
-IOSTRUCT *errstr;
-{
- COREC tmp;
- int i, c;
- int gobble = FALSE;
- char *ref;
- extern char *optarg, *filename();
- extern int optind;
-
- if (!Cotable)
- Cotable = (COREC *) array_create(sizeof(COREC), 1);
- ref = tmp.id = tmp.r_path = tmp.w_path = tmp.expect = tmp.send = NULL;
- tmp.refs = NULL;
- tmp.writefp = NULL;
- optind = 1;
- while ((c = getopt(argc, args, "R:i:ge:w:r:s:")) != EOF)
- switch (c) {
- case 'R':
- ref = optarg;
- break;
- case 'i':
- tmp.id = strsave(optarg);
- break;
- case 'g':
- gobble = TRUE;
- break;
- case 'e':
- tmp.expect = strsave(optarg);
- break;
- case 'w':
- tmp.w_path = strsave(optarg);
- break;
- case 'r':
- tmp.r_path = strsave(optarg);
- break;
- case 's':
- tmp.send = strsave(optarg);
- break;
- default:
- break;
- }
- if (!tmp.id)
- tmp.id = strsave(filename(args[optind]));
- if ((i = findtab(tmp.id)) != -1) {
- make_cur(i);
- if (ref && Cotable[i].refs) {
- register int j;
- int lcv;
-
- lcv = array_len(Cotable[i].refs);
- for (j = 0; (j < lcv) && (strcmp(Cotable[i].refs[j], ref)); j++)
- ;
- if (j >= lcv) {
- ref = strsave(ref);
- Cotable[i].refs = (char **) array_append(Cotable[i].refs, &ref);
- }
- }
- return(SUCCESS);
- }
- else {
- if (Coproc_active == 0) /* set up fifo for Semaphore */
- mknod(Semaphore, 010666, 0);
- Coproc_active++;
- }
- if (ref) {
- tmp.refs = (char **) array_create(sizeof(char *), 1);
- ref = strsave(ref);
- tmp.refs = (char **) array_append(tmp.refs, &ref);
- }
- if (!tmp.r_path) {
- char path[PATHSIZ];
-
- sprintf(path, "/tmp/r%s.%ld", tmp.id, Fmli_pid);
- tmp.r_path = strsave(path);
- }
- if (!tmp.w_path) {
- char path[PATHSIZ];
-
- sprintf(path, "/tmp/w%s.%ld", tmp.id, Fmli_pid);
- tmp.w_path = strsave(path);
- }
- if (mknod(tmp.r_path, 010666, 0) == -1)
-#ifdef _DEBUG4
- _debug4(stderr, "Could not do mknod");
-#endif
- ;
- if (mknod(tmp.w_path, 010666, 0) == -1)
-#ifdef _DEBUG4
- _debug4(stderr, "Could not do mknod");
-#endif
- ;
- switch(fork()) {
- case -1:
- fatal(NOFORK, NULL);
- case 0: {
- int fd;
-
-#ifdef _DEBUG
- _debug(stderr, "in child\n");
-#endif
- if ((fd = open(tmp.w_path, O_RDONLY|O_NDELAY)) == -1)
- child_fatal(NOPEN, nil);
- fcntl(fd, F_SETFL, 0);
- close(0);
- dup(fd);
- close(fd);
- if ((fd = open(tmp.r_path, O_WRONLY)) == -1)
- child_fatal(NOPEN, nil);
- close(1);
- dup(fd);
- close(fd);
- freopen("/dev/null", "w", stderr);
- execvp(args[optind], args + optind);
-#ifdef _DEBUG
- _debug(stderr, "couldnt exec\n");
-#endif
- child_fatal(NOFORK, NULL);
- }
- default:
- break;
- }
- Cotable = (COREC *) array_append(Cotable, &tmp);
- make_cur(array_len(Cotable) - 1);
- if (gobble) {
- char buf[BUFSIZ];
-
- fgets(buf, BUFSIZ, Readfp);
- }
- return(SUCCESS);
-}
-
-int
-codestroy(argc, args, instr, outstr, errstr)
-int argc;
-char **args;
-IOSTRUCT *instr;
-IOSTRUCT *outstr;
-IOSTRUCT *errstr;
-{
- int i;
- int hold;
- char *ref;
- int lcv;
-
- ref = NULL;
- if (strcmp(args[1], "-R") == 0)
- ref = args[2];
-/* if ((i = findtab(args[ref ? 3 : 1])) == -1) amdahl compatibility.. */
- if (ref)
- i = findtab(args[3]);
- else
- i = findtab(args[1]);
- if ( i == -1)
- return(FAIL);
- if (Cotable[i].refs && ref) {
- register int j;
-
- lcv = array_len(Cotable[i].refs);
- for (j = 0; (j < lcv) && (strcmp(Cotable[i].refs[j], ref)); j++)
- ;
- if (j < lcv)
- array_delete(Cotable[i].refs, j);
- }
- if ((int)array_len(Cotable[i].refs) > 0)
- return(SUCCESS);
- hold = cosend(ref ? argc - 2 : argc, ref ? args + 2 : args, instr, outstr);
- make_cur(-1);
- if (Cotable[i].writefp)
- fclose(Cotable[i].writefp);
- unlink(Cotable[i].w_path);
- unlink(Cotable[i].r_path);
- FREE(Cotable[i].expect);
- FREE(Cotable[i].w_path);
- FREE(Cotable[i].r_path);
- FREE(Cotable[i].send);
- FREE(Cotable[i].id);
- array_delete(Cotable, i);
- if (--Coproc_active == 0)
- unlink(Semaphore); /* remove fifo */
- return(hold);
-}
-
-int
-cocheck(argc, argv, instr, outstr, errstr)
-int argc;
-char **argv;
-IOSTRUCT *instr;
-IOSTRUCT *outstr;
-IOSTRUCT *errstr;
-{
- register int i;
- struct stat sbuf;
-
- if ((i = findtab(argv[1])) == -1) /* look-up coproc in proc tab */
- return(FAIL);
- make_cur(i); /* make the coproc current */
- if (fstat(fileno(Readfp), &sbuf) < 0)
- return(FAIL); /* can't stat file */
- if (sbuf.st_size > 0)
- return(SUCCESS);
- else
- return(FAIL);
-}
-
-int
-coreceive(argc, argv, instr, outstr, errstr)
-int argc;
-char **argv;
-IOSTRUCT *instr;
-IOSTRUCT *outstr;
-IOSTRUCT *errstr;
-{
- register int i;
- register char *exp;
- struct stat sbuf;
- char buf[BUFSIZ];
-
- if ((i = findtab(argv[1])) == -1) /* look-up coproc in proc tab */
- return(FAIL);
- make_cur(i); /* make the coproc current */
- if ((fstat(fileno(Readfp), &sbuf) < 0) || (sbuf.st_size == 0))
- return(FAIL);
- if (!(exp = Cotable[Cur_corec].expect)) {
- fgets(buf, BUFSIZ, Readfp);
- putastr(buf, outstr);
- }
- else {
- while (fgets(buf, BUFSIZ, Readfp)) {
- if (strncmp(buf, exp, strlen(exp)) == 0)
- break;
- putastr(buf, outstr);
- }
- }
- return(SUCCESS);
-}
diff --git a/usr/src/cmd/fmli/sys/copyfile.c b/usr/src/cmd/fmli/sys/copyfile.c
deleted file mode 100644
index aa956848a3..0000000000
--- a/usr/src/cmd/fmli/sys/copyfile.c
+++ /dev/null
@@ -1,166 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-
-/*
- * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-/* Copyright (c) 1984, 1985, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-#include <stdio.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include "wish.h"
-#include <termio.h>
-#define _SYS_TERMIO_H
-#include "exception.h"
-
-int (*(ignoresigs()))();
-
-/*
- * copy a file
- */
-FILE *
-cpfile(from, to)
-char *from;
-char *to;
-{
- register int c;
- register FILE *src;
- register FILE *dst;
- register int (*fsave)();
-
- if ((src = fopen(from, "r")) == NULL)
- return NULL;
- if ((dst = fopen(to, "w+")) == NULL) {
- fclose(src);
- return NULL;
- }
- fsave = ignoresigs();
- while ((c = getc(src)) != EOF)
- putc(c, dst);
- if (ferror(src)) {
- fclose(src);
- fclose(dst);
- unlink(to);
- (void) restoresigs(fsave);
- return NULL;
- }
- fclose(src);
- (void) restoresigs(fsave);
- return dst;
-}
-
-int
-copyfile(from, to)
-char *from;
-char *to;
-{
- FILE *fp;
-
- if (fp = cpfile(from, to)) {
- fclose(fp);
- return(0);
- }
- return(-1);
-}
-/*
- * copy a file back to another file. The destination file MUST exist
- */
-bool
-copyback(from, to, src)
-char *from;
-char *to;
-FILE *src;
-{
- register int c;
- register FILE *dst;
- register int (*fsave)();
- struct stat s;
-
- if (stat(to, &s))
- return FALSE;
- fsave = ignoresigs();
- if (unlink(to) || (!from) || link(from, to)) {
- if ((dst = fopen(to, "w")) == NULL) {
- fclose(src);
- (void) restoresigs(fsave);
- return FALSE;
- }
- fseek(src, 0L, 0);
- while ((c = getc(src)) != EOF)
- putc(c, dst);
- fclose(dst);
- if (ferror(src)) {
- fclose(src);
- if (from)
- unlink(from);
- (void) restoresigs(fsave);
- return FALSE;
- }
- }
- fclose(src);
- if (from)
- unlink(from);
- chmod(to, s.st_mode);
- chown(to, s.st_uid, s.st_gid);
- restoresigs(fsave);
- return TRUE;
-}
-
-int
-movefile(source, target)
-char *source, *target;
-{
- char *dirname();
- struct stat s1;
- struct utimbuf {
- time_t actime;
- time_t modtime;
- };
- struct utimbuf times;
-
-#ifdef _DEBUG
- _debug(stderr, "IN MOVEFILE(%s, %s)\n", source, target);
-#endif
- if (link(source, target) < 0) {
- if (access(target, 00) != -1)
- return(-1);
- if (stat(source, &s1) < 0)
- return(-1);
- if (copyfile(source, target) != 0)
- return(-1);
- times.actime = s1.st_atime;
- times.modtime = s1.st_mtime;
- utime(target, &times);
- chmod(target, s1.st_mode);
- chown(target, geteuid(), getegid());
- }
- if (unlink(source) < 0)
- return(-1);
- return(0);
-}
diff --git a/usr/src/cmd/fmli/sys/cut.c b/usr/src/cmd/fmli/sys/cut.c
deleted file mode 100644
index bed64682ed..0000000000
--- a/usr/src/cmd/fmli/sys/cut.c
+++ /dev/null
@@ -1,241 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-
-/*
- * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-#include <stdio.h> /* make: cc cut.c */
-#include <ctype.h>
-#include "wish.h"
-#include "ctl.h"
-#include "eval.h"
-#include "moremacros.h"
-#include "message.h"
-#include "sizes.h"
-
-/* cut : cut and paste columns of a table (projection of a relation) */
-/* Release 1.5; handles single backspaces as produced by nroff */
-
-# define NFIELDS 1024 /* max no of fields or resulting line length */
-# define BACKSPACE '\b'
-
-int strcmp(), atoi();
-void exit();
-char *getastr(); /* rjk */
-
-static char usage[] = "Usage: fmlcut [-s] [-d<char>] {-c<list> | -f<list>} file ...";
-static char cflist[] = "bad list for c/f option";
-
-int
-cmd_cut(argc, argv, instr, outstr, errstr)
-int argc;
-char *argv[];
-IOSTRUCT *instr;
-IOSTRUCT *outstr;
-IOSTRUCT *errstr;
-{
- extern int optind;
- extern char *optarg;
- register int c;
- register char *p1, *rbuf;
- register char *p, *list;
- register int i;
- int del = '\t';
- int num, j, count, poscnt, r, s;
- int endflag, supflag, cflag, fflag, backflag, filenr;
- int sel[NFIELDS];
- char buf[BUFSIZ];
- char *p2, outbuf[NFIELDS];
- FILE *inptr;
- int fromfile; /* rjk */
-
- supflag = cflag = fflag = r = num = s = 0;
- for (i = 0; i < NFIELDS; i++)
- sel[i] = 0;
-
- optind = 1;
- optarg = NULL;
- while((c = getopt(argc, argv, "c:d:f:s")) != EOF)
- switch(c) {
- case 'c':
- if (fflag)
- return(diag(cflist));
- cflag++;
- list = optarg;
- break;
- case 'd':
- if (strlen(optarg) > 1)
- diag("no delimiter");
- else
- del = (int)*optarg;
- break;
- case 'f':
- if (cflag)
- return(diag(usage));
- fflag++;
- list = optarg;
- break;
- case 's':
- supflag++;
- break;
- case '?':
- return(diag(usage));
- }
-
- argv = &argv[optind];
- argc -= optind;
-
- if (!(cflag || fflag))
- return(diag(cflist));
-
- do {
- p = list;
- switch(*p) {
- case '-':
- if (r)
- return(diag(cflist));
- r = 1;
- if (num == 0)
- s = 1;
- else {
- s = num;
- num = 0;
- }
- break;
- case '\0' :
- case ',' :
- if (num >= NFIELDS)
- return(diag(cflist));
- if (r) {
- if (num == 0)
- num = NFIELDS - 1;
- if (num < s)
- return(diag(cflist));
- for (j = s; j <= num; j++)
- sel[j] = 1;
- } else
- sel[num] = (num > 0 ? 1 : 0);
- s = num = r = 0;
- if (*p == '\0')
- continue;
- break;
- default:
- if (!isdigit(*p))
- return(diag(cflist));
- num = atoi(p);
- while (isdigit(*list))
- list++;
- continue;
- }
- list++;
- }while (*p != '\0');
- for (j=0; j < NFIELDS && !sel[j]; j++);
- if (j >= NFIELDS)
- return(diag("no fields"));
-
- filenr = 0;
- do { /* for all input files */
- if ( argc == 0 || strcmp(argv[filenr],"-") == 0 )
- fromfile = 0;
- else {
- /* rjk */
- if ((inptr = fopen(argv[filenr], "r")) == NULL) {
- char errbuf[PATHSIZ + 50];
-
- sprintf(errbuf, "fmlcut: WARNING: cannot open %s\n", argv[filenr]);
- mess_temp(errbuf);
- continue;
- }
- else
- fromfile++;
- }
- endflag = 0;
- do { /* for all lines of a file */
- count = poscnt = backflag = 0;
- p1 = &outbuf[0] - 1 ;
- p2 = p1;
- rbuf = buf;
- /* rjk ... from a file or form Instr) */
- if (fromfile ? ((fgets(buf, BUFSIZ, inptr)) == NULL) :
- (getastr(buf, BUFSIZ, instr) == NULL || buf[0] == '\0')) {
- endflag = 1;
- continue;
- }
- do { /* for all char of the line */
- if (rbuf >= &buf[NFIELDS])
- return(diag("line too long"));
- if (*rbuf != '\n')
- *++p1 = *rbuf;
- if (cflag && (*rbuf == BACKSPACE))
- backflag++;
- else if (!backflag)
- poscnt += 1;
- else
- backflag--;
- if ( backflag > 1 )
- return(diag("cannot handle multiple adjacent backspaces\n"));
- if (*rbuf == '\n' && count > 0 || *rbuf == del || cflag) {
- count += 1;
- if (fflag)
- poscnt = count;
- if (sel[poscnt])
- p2 = p1;
- else
- p1 = p2;
- }
- } while (*rbuf++ != '\n');
- if ( !endflag && (count > 0 || !supflag)) {
- if (*p1 == del && !sel[count])
- *p1 = '\0'; /*suppress trailing delimiter*/
- else
- *++p1 = '\0';
- putastr(outbuf, outstr); /* rjk */
- putac('\n', outstr); /* rjk */
- }
- } while (!endflag);
- if (fromfile)
- fclose(inptr);
- } while (++filenr < argc);
- return(SUCCESS); /* rjk */
-}
-
-
-int
-diag(s)
-char *s;
-{
- /* for now
- fprintf(stderr, "fmlcut: ERROR: %s\n", s);
- exit(2);
- */
- mess_temp(s);
- mess_lock();
- return(FAIL);
-}
diff --git a/usr/src/cmd/fmli/sys/estrtok.c b/usr/src/cmd/fmli/sys/estrtok.c
deleted file mode 100644
index fa25ab7d69..0000000000
--- a/usr/src/cmd/fmli/sys/estrtok.c
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-/*
- * Copyright (c) 1985 AT&T
- * All Rights Reserved
- */
-#ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.1 */
-
-#include <stdio.h>
-#include <string.h>
-
-char *
-estrtok(env, ptr, sep)
-char **env;
-char *ptr;
-char sep[];
-{
- if (ptr == NULL)
- ptr = *env;
- else
- *env = ptr;
- if (ptr == NULL || *ptr == '\0')
- return NULL;
- ptr += strspn(ptr, sep);
- *env = ptr + strcspn(ptr, sep);
- if (**env != '\0') {
- **env = '\0';
- (*env)++;
- }
- return ptr;
-}
diff --git a/usr/src/cmd/fmli/sys/eval.c b/usr/src/cmd/fmli/sys/eval.c
deleted file mode 100644
index 7d7bf7982b..0000000000
--- a/usr/src/cmd/fmli/sys/eval.c
+++ /dev/null
@@ -1,713 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/*
- * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-#ifdef CACA
-#define _DEBUG2 1
-int _Debug=4;
-#endif
-
-#include <stdio.h>
-#include <ctype.h>
-#include "wish.h"
-#include "eval.h"
-#include "terror.h"
-#include "message.h"
-#include "moremacros.h"
-#include "interrupt.h"
-
-#define MAXARGS 64
-
-/* NOTE!!! the following flags compete for bits with
- * the EV_**** flags in inc/eval.h Make sure
- * there is no overlap.
- */
-#define IN_DQ 1
-#define IN_SQ 2
-#define IN_BQ 4
-#define IN_SQUIG 8
-#define FROM_BQ 16
-
-/*
- * list of "special" characters, and flags in which they are not
- * treated as special. NOTE that EV_SQUIG flag is opposite all
- * others. set it in nflags if {} ARE to be treated as special.
- */
-static char spchars[] = "\"'\\`$\n \t{}|&;<>2";
-/*static char spchars[] = "\"'\\`$\n \t{}|&;<>";
-abs */
-static int nflags[] = {
- FROM_BQ | IN_SQ, /* double quote */
- FROM_BQ | IN_DQ, /* single quote */
- FROM_BQ, /* backslash */
- FROM_BQ | IN_SQ, /* back quote */
- FROM_BQ | IN_SQ, /* dollar sign */
- IN_SQUIG | IN_SQ | IN_DQ, /* new line */
- FROM_BQ | IN_SQ | IN_DQ | EV_GROUP, /* space */
- FROM_BQ | IN_SQ | IN_DQ | EV_GROUP, /* tab */
- FROM_BQ | IN_SQUIG | IN_SQ | IN_DQ | IN_BQ | EV_SQUIG, /* open squig */
- FROM_BQ | IN_SQ | IN_DQ | IN_BQ | EV_SQUIG, /* close squig */
- FROM_BQ | IN_SQ | IN_DQ | EV_GROUP, /* pipe symbol */
- FROM_BQ | IN_SQ | IN_DQ | EV_GROUP, /* ampersand */
- FROM_BQ | IN_SQ | IN_DQ | EV_GROUP, /* semicolon */
- FROM_BQ | IN_SQ | IN_DQ | EV_GROUP, /* less than */
- FROM_BQ | IN_SQ | IN_DQ | EV_GROUP /* greater than */
- ,FROM_BQ | IN_SQ | IN_DQ | EV_GROUP /* digit two */
-};
-
-/* return code from most recently executed command */
-int EV_retcode;
-int EV_backquotes;
-int Lasttok;
-
-extern int in_an_if; /* (in an if statement) see evfuncs.c */
-
-static int eval_dollar();
-static void eval_backquote();
-
-char *
-special_char(c, instr)
-register int c;
-IOSTRUCT *instr;
-{
- char *strchr();
- int c2;
-
- if ((char)c == '2')
- {
- c2 = getac(instr);
- if(c2 || instr->flags & EV_USE_FP) /* the other case: EV_USE_STRING */
- ungetac(c2, instr); /* and c2 = EndOfString. don't unget cause */
- /* it would unget c not c2. abs */
- if ((char)c2 != '>')
- return(NULL);
- }
- return(strchr(spchars, c));
-}
-
-
-int
-eval(instr, outstr, flags)
-IOSTRUCT *instr;
-IOSTRUCT *outstr;
-int flags;
-{
- register int c;
- register int tok;
- bool done;
-
- flags ^= EV_SQUIG; /* flip flag so only have to set it
- when special (one case) instead of
- in all other cases. abs */
- if (!(flags & IN_BQ))
- EV_retcode = 0;
- EV_backquotes = FALSE;
- c = getac(instr);
- /* skip leading white space */
- if (flags & (EV_TOKEN | EV_GROUP)) {
- while (isspace(c))
- c = getac(instr);
- if (c == '#') {
- /*
- * skip everything until end of line
- */
- while ((c = getac(instr)) && c != '\n' && c != EOF)
- ;
- }
- }
- /* handler `` at beginning of line if in GROUP mode */
- if ((flags & EV_GROUP) && c == '`') {
- eval_backquote(instr, outstr, flags);
- io_flags(instr, io_flags(instr, 0) & ~FROM_BQ);
- c = getac(instr);
- }
-#ifdef _DEBUG2
-/*
- if ((flags & EV_TOKEN) && (instr->flags & EV_USE_STRING)) {
- _debug2(stderr, "input is '%.*s'\n", instr->mu.str.count - instr->mu.str.pos, instr->mu.str.val + instr->mu.str.pos);
- }
-*/
-#endif
-
- Lasttok = tok = ET_EOF;
- for (done = FALSE; c; c = getac(instr)) {
- register char *p;
- char *strchr();
-
-/* while (!(p = strchr(spchars, c))) {
-abs */
- while(!(p = special_char(c, instr))) {
- Lasttok = ET_WORD;
- putac(c, outstr);
- if (!(c = getac(instr))) {
- done = TRUE;
- break;
- }
- }
- if (done)
- break;
- /* single | and & are correct here */
- if ((instr->flags | flags) & nflags[tok = p - spchars])
- tok = !!c;
- else {
- tok += ET_DQUOTE;
-#ifdef _DEBUG2
- _debug2(stderr, "eval: got special char 0x%x\n", tok);
-#endif
- }
- switch (tok) {
- case ET_EOF:
- done = TRUE;
- break;
- case ET_WORD:
- Lasttok = tok;
- putac(c, outstr);
- break;
- case ET_DQUOTE:
- flags ^= IN_DQ;
- if (!(flags & EV_TOKEN))
- putac(c, outstr);
- break;
- case ET_SQUOTE:
- flags ^= IN_SQ;
- if (!(flags & EV_TOKEN))
- putac(c, outstr);
- break;
- case ET_BSLASH:
- c = getac(instr);
- /*
- * if (not tokenizing or if we're in quotes and the
- * next character is not special, leave backslash
- * there
- * else
- * remove it (don't copy to output)
- */
- if (!(flags & EV_TOKEN) || (flags & (IN_SQ | IN_DQ)) && (!(p = strchr(spchars, c)) || (instr->flags | flags) & nflags[p - spchars]))
- putac('\\', outstr);
- putac(c, outstr);
- break;
- case ET_BQUOTE:
- if (flags & EV_TOKEN) {
- if (flags & IN_BQ) {
- if (Lasttok == ET_EOF) {
- putac(c, outstr);
- c = getac(instr);
- Lasttok = tok;
- }
- done = TRUE;
- }
- else
- eval_backquote(instr, outstr, flags);
- }
- else {
- flags ^= IN_BQ;
- putac(c, outstr);
- }
- EV_backquotes = TRUE;
- break;
- case ET_DOLLAR:
- if (flags & EV_TOKEN)
- eval_dollar(instr, outstr, flags);
- else
- putac(c, outstr);
- break;
- case ET_NEWLINE:
- case ET_SPACE:
- case ET_TAB:
- Lasttok = ET_WORD;
- if ((flags & EV_GROUP) && (flags & IN_BQ))
- putac(c, outstr);
- else
- done = TRUE;
- break;
- case ET_OSQUIG:
- case ET_CSQUIG:
- putac(c, outstr);
- if (flags & EV_GROUP)
- flags ^= IN_SQUIG;
- else if (flags & EV_TOKEN) {
- if (Lasttok == ET_EOF) {
- c = getac(instr);
- Lasttok = tok;
- }
- done = TRUE;
- }
- break;
- case ET_PIPE:
- case ET_AMPERSAND:
- case ET_SEMI:
- case ET_LTHAN:
- case ET_GTHAN:
- if (flags & IN_BQ) {
- if (Lasttok == ET_EOF) {
- register int oldc;
-
- putac(c, outstr);
- oldc = c;
- if ((c = getac(instr)) == oldc) {
- putac(c, outstr);
- c = getac(instr);
- tok += DOUBLE;
- }
- Lasttok = tok;
- }
- done = TRUE;
- }
- else
- putac(c, outstr);
- break;
- case ET_TWO:
- if (flags & IN_BQ) {
- if (Lasttok == ET_EOF) {
- putac(c, outstr);
- c = getac(instr); /* gets > known to follow 2 */
- putac(c, outstr);
- if ((c = getac(instr)) == '>') {
- putac(c, outstr);
- c = getac(instr);
- tok += DOUBLE;
- }
- Lasttok = tok;
- }
- done = TRUE;
- }
- else
- putac(c, outstr);
- break;
- }
- if (done)
- break;
- Lasttok = ET_WORD;
- }
- if (c)
- ungetac(c, instr);
-#ifdef _DEBUG2
- if (flags & EV_TOKEN) {
- _debug2(stderr, "eval -> '%s'\n", io_ret_string(outstr));
- _debug2(stderr, "eval returning 0x%x\n", Lasttok);
- }
-#endif
-
- return Lasttok;
-}
-
-/*
- * NOTE:
- *
- * In pre-4.0 releases of FMLI, the contents of environment variables
- * (after expansion) were put back into the input string for further
- * evaluation (lets call it "double evaluation").
- *
- * To remain backwards compatable, the global variable "Doublevars"
- * will be set to TRUE if double evaluation should be performed on
- * ALL environment variables.
- *
- * If Doublevars == FALSE, then only evaluate the "contents" of the
- * variable if a "!" follows "$" (i.e., the "new" convention for double
- * evaluation is "$!VARNAME").
- *
- */
-/*ARGSUSED*/
-static int
-eval_dollar(instr, outstr, flags)
-IOSTRUCT *instr;
-IOSTRUCT *outstr;
-int flags;
-{
- register char *p;
- register int c;
- register IOSTRUCT *iop;
- char *expand();
- int evalagain;
- extern bool Doublevars;
-
- iop = io_open(EV_USE_STRING, NULL);
- putac('$', iop);
- if (Doublevars == TRUE)
- evalagain = TRUE;
- else {
- if ((c = getac(instr)) == '!') {
- evalagain = TRUE;
- }
- else {
- evalagain = FALSE;
- ungetac(c, instr);
- }
- }
- if ((c = getac(instr)) == '{') {
- while (c != '}') {
- putac(c, iop);
- c = getac(instr);
- }
- putac(c, iop);
- }
- else {
- while (isalpha(c) || isdigit(c) || c == '_') {
- putac(c, iop);
- c = getac(instr);
- }
- if (c)
- ungetac(c, instr);
- }
- if (p = expand(io_ret_string(iop))) {
- io_clear(iop);
- if (evalagain) {
- /*
- * if the "contents" of the variable should
- * be evaluated before passing it to outstr ...
- */
- putastr(p, iop);
- free(p);
- p = (char *)NULL;
- io_seek(iop, 0);
- io_push(instr, iop); /* push it back in instr */
- }
- else {
- /*
- * simply put the variable's contents into outstr
- */
- putastr(p, outstr);
- free(p);
- p = (char *)NULL;
- io_close(iop);
- }
- return SUCCESS;
- }
- return FAIL;
-}
-
-static char *
-eval_token(instr, flags)
-IOSTRUCT *instr;
-int flags;
-{
- register char *p;
- static IOSTRUCT *tmp;
-
- if (instr == NULL) {
- io_close(tmp);
- return NULL;
- }
- if (tmp == NULL)
- tmp = io_open(EV_USE_STRING, NULL);
- (void) eval(instr, tmp, flags);
- p = io_string(tmp);
- io_seek(tmp, 0);
- return p;
-}
-
-static void
-eval_backquote(instr, outstr, flags)
-IOSTRUCT *instr;
-IOSTRUCT *outstr;
-int flags;
-{
- int argc;
- char *argv[MAXARGS];
- bool doit;
- int conditional = 0;
- int if_elif = 0;
- bool skip;
- bool piped;
- bool special;
- IOSTRUCT *mystdin;
- IOSTRUCT *mystdout;
- IOSTRUCT *altstdout;
- IOSTRUCT *altstderr;
-
-#ifdef _DEBUG2
- _debug2(stderr, "eval_backquote\n");
-#endif
- mystdin = io_open(EV_USE_STRING, NULL);
- mystdout = io_open(EV_USE_STRING, NULL);
- altstdout = NULL;
- altstderr = NULL;
- doit = skip = piped = special = FALSE;
-
- for (argc = 0; ; ) {
- conditional = 0;
- argv[argc++] = eval_token(instr, EV_TOKEN | IN_BQ);
-
- if (argc == 1) {
- /*
- * determine whether we've found an
- * if/then/else/elif statement
- */
- if_elif = 0;
-
-#ifdef _DEBUG2
- _debug2(stderr, "argv[0]=\"%s\"\n\r", argv[0]);
-#endif
-
- switch(argv[0][0]) {
- case 'e': /* else, elif */
- if (!strcmp(argv[0], "else"))
- conditional = 1;
- else if (!strcmp(argv[0], "elif")) {
- conditional = 1;
- if_elif = 1;
- }
- break;
- case 'i': /* if */
- if (argv[0][1] == 'f' && argv[0][2] == '\0') {
- conditional = 1;
- if_elif = 1;
- }
- break;
- case 't': /* then */
- if (!strcmp(argv[0], "then"))
- conditional = 1;
- break;
- }
-
- if (conditional) {
- int a, nonwhite, start_look;
- char *cp;
- char ch;
-
- /*
- * Force call to if/then/else/elif built-in
- * (no arguments) ... Don't modify the input
- * string here, just put a semi-colon in the
- * "argv" array and set Lasttok (last token
- * received) to ET_SEMI (semi-colon).
- */
- argv[argc++] = strsave(";");
- Lasttok = ET_SEMI;
-
-
- /*
- * Though the implementation of if/then/else
- * is done via built-ins ... don't allow
- * semi-colons after if/then/else/elif !!
- */
- start_look = instr->mu.str.pos;
- cp = instr->mu.str.val + start_look;
- nonwhite = 1;
- for (a = 0; a < instr->mu.str.count - start_look + 1; a++) {
- ch = *(cp + a);
-
- if (ch == '\n' )
- break;
- else if (ch == ';') {
- /*
- * If all you've seen is
- * white-space then produce
- * an error message
- */
- if (nonwhite) {
- char errbuf[100];
-
- sprintf(errbuf, "Syntax error - \";\" found after \"%s\"", argv[0]);
- mess_temp(errbuf);
- mess_lock();
- Lasttok = ET_EOF;
- in_an_if = 0;
- }
- break;
- }
- else if (ch != '\t' && ch != ' ') {
- /*
- * not a space, tab, new-line
- * or semi-colon ......
- */
- nonwhite = 0;
- }
- }
- }
- }
-
- switch (Lasttok) {
- case ET_EOF:
- case ET_BQUOTE:
- special = doit = TRUE;
- break;
- case ET_PIPE:
- {
- register FILE *fp;
- FILE *tempfile();
-
- if (altstdout) {
-#ifdef _DEBUG2
- _debug2(stderr, "PIPE and > in same eval command\n");
-#endif
- io_close(altstdout);
- altstdout = NULL;
- }
- if (fp = tempfile(NULL, "w+"))
- altstdout = io_open(EV_USE_FP, fp);
- special = doit = piped = TRUE;
- }
- break;
- case ET_AMPERSAND:
- break;
- case ET_SEMI:
- special = doit = TRUE;
- break;
- case ET_LTHAN:
- {
- register FILE *fp;
- register char *p;
-
- special = TRUE;
- p = eval_token(instr, EV_TOKEN | IN_BQ);
- if (fp = fopen(p, "r")) {
- io_close(mystdin);
- mystdin = io_open(EV_USE_FP, fp);
- }
- else
- warn(NOPEN, p);
- free(p);
- p = (char *)NULL;
- }
- break;
- case ET_GTHAN:
- case ET_GTHAN + DOUBLE: /* append symbol */
- {
- register FILE *fp;
- register char *p;
- int savetok=Lasttok;
- special = TRUE;
- if (altstdout) {
-#ifdef _DEBUG2
- _debug2(stderr, "2 >'s in eval command\n");
-#endif
- io_close(altstdout);
- }
- p = eval_token(instr, EV_TOKEN | IN_BQ);
- if (fp = fopen(p, (savetok & DOUBLE)?"a":"w"))
- altstdout = io_open(EV_USE_FP, fp);
- else
- warn(NOPEN, p);
- free(p);
- p = (char *)NULL;
- }
- break;
- case ET_TWO:
- case ET_TWO + DOUBLE: /* append stderr symbol (2>>)*/
- {
- register FILE *fp;
- register char *p;
- int savetok=Lasttok;
-
- special = TRUE;
- if (altstderr) {
-#ifdef _DEBUG2
- _debug2(stderr, "2 >'s in eval command\n");
-#endif
- io_close(altstderr);
- altstderr = NULL;
- }
- p = eval_token(instr, EV_TOKEN | IN_BQ);
- if (fp = fopen(p, (savetok & DOUBLE) ?"a":"w"))
- altstderr = io_open(EV_USE_FP, fp);
- else
- warn(NOPEN, p);
- free(p);
- p = (char *)NULL;
- }
- break;
- /* OR symbol */
- case ET_PIPE + DOUBLE:
- special = doit = TRUE;
- break;
- /* AND symbol */
- case ET_AMPERSAND + DOUBLE:
- special = doit = TRUE;
- break;
- /* semicolon (twice in a row) */
- case ET_SEMI + DOUBLE:
- special = doit = TRUE;
- break;
- /* here document */
- case ET_LTHAN + DOUBLE:
- break;
-
- }
- if (special) {
- free(argv[--argc]);
- argv[argc] = (char *)NULL;
- special = FALSE;
- }
- if (doit || argc >= MAXARGS - 1) {
- register int n;
-
- doit = FALSE;
- if (!skip && !Cur_intr.skip_eval && argc > 0) /* abs */
- {
- argv[argc] = NULL;
- EV_retcode = evalargv(argc, argv, mystdin,
- altstdout ? altstdout : mystdout,
- altstderr);
- /*
- * if there is a syntax error in the
- * conditional statement then terminate
- * evaluation
- */
- if (conditional && (EV_retcode == FAIL))
- Lasttok = ET_EOF;
- }
- skip = (EV_retcode && Lasttok == ET_AMPERSAND + DOUBLE)
- || (!EV_retcode && Lasttok == ET_PIPE + DOUBLE);
- for (n = 0; n < argc; n++)
- if (argv[n]) { /* ehr3 */
- free(argv[n]);
- argv[n] = (char *)NULL;
- }
- argc = 0;
- io_close(mystdin);
- if (piped) {
- mystdin = altstdout;
- io_seek(mystdin, 0);
- piped = FALSE;
- }
- else {
- mystdin = io_open(EV_USE_STRING, NULL);
- if (altstdout)
- io_close(altstdout);
- }
- if (altstderr)
- {
- io_close(altstderr);
- altstderr = NULL;
- }
- altstdout = NULL;
- if (Lasttok == ET_EOF || Lasttok == ET_BQUOTE)
- break;
- }
- }
- if ((argc = unputac(mystdout)) && argc != '\n')
- putac(argc, mystdout);
- if (flags & EV_GROUP)
- putac('\n', mystdout);
- io_seek(mystdout, 0);
- io_flags(mystdout, io_flags(mystdout, 0) | FROM_BQ);
- io_push(instr, mystdout);
-}
diff --git a/usr/src/cmd/fmli/sys/evalstr.c b/usr/src/cmd/fmli/sys/evalstr.c
deleted file mode 100644
index 799d3e96bb..0000000000
--- a/usr/src/cmd/fmli/sys/evalstr.c
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-/*
- * Copyright (c) 1986 AT&T
- * All Rights Reserved
- */
-
-#ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.1 */
-
-#include <stdio.h>
-#include "wish.h"
-#include "eval.h"
-
-char *
-evalstr(s)
-char *s;
-{
- IOSTRUCT *in;
- IOSTRUCT *out;
-
- in = io_open(EV_USE_STRING | EV_READONLY, s);
- out = io_open(EV_USE_STRING, NULL);
- while (eval(in, out, EV_TOKEN) != ET_EOF)
- ;
- s = io_string(out);
- io_close(out);
- return s;
-}
diff --git a/usr/src/cmd/fmli/sys/evfuncs.c b/usr/src/cmd/fmli/sys/evfuncs.c
deleted file mode 100644
index 1a5c23e1af..0000000000
--- a/usr/src/cmd/fmli/sys/evfuncs.c
+++ /dev/null
@@ -1,887 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/*
- * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-#ifdef CACA
-#define _DEBUG2 1
-#endif
-
-#define MAX_IF_DEPTH 256 /* maximum number of nested if's */
-
-/*
- * Possible "if" states
- */
-#define IN_A_CONDITION 1 /* we are evaluating if */
-#define IN_A_THEN 2 /* we are in the then portion */
-#define IN_AN_ELSE 4 /* we are in the else portion */
-#define IN_AN_ELIF_SKIP 8 /* we are in the elif (ignore conditional) */
-#define IF_IS_TRUE 16 /* the condition is true */
-
-/*
- * Miscellaneous macros to set/test various "if/then/else" states
- */
-#define ANY_IF_STATE (IN_A_CONDITION | \
- IN_A_THEN | \
- IN_AN_ELSE | \
- IN_AN_ELIF_SKIP)
-
-int in_an_if = 0; /* keeps track of if depth */
-char status_of_if[MAX_IF_DEPTH]; /* status and pos. of each if */
-
-#include <stdio.h>
-#include <fcntl.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <errno.h>
-#include <signal.h>
-#include <termio.h>
-#include "wish.h"
-#include "eval.h"
-#include "ctl.h"
-#include "moremacros.h"
-#include "message.h"
-#include "interrupt.h"
-#include "retcodes.h" /* abs */
-#include "sizes.h"
-
-extern void exit(); /* fmli's own exit routine */
-
-/*
- * return value of lastly executed command within an "if" statement
- */
-static int Lastret = SUCCESS;
-
-
-#ifdef TEST
-main(argc, argv)
-char *argv[];
-{
- IOSTRUCT *in, *out, *err;
-
- wish_init(argc, argv);
- in = io_open(EV_USE_FP, stdin);
- out = io_open(EV_USE_FP, stdout);
- err = io_open(EV_USE_FP, stderr);
- exit(evalargv(argc - 1, argv + 1, in, out, err));
-}
-
-mess_temp(s)
-char *s;
-{
- fprintf(stderr, "%s\n", s);
-}
-
-mess_perm(s)
-char *s;
-{
- fprintf(stderr, "%s\n", s);
-}
-
-#endif
-
-int cmd_if();
-int cmd_elif();
-
-int
-cmd_fi(argc, argv, instr, outstr, errstr)
-int argc;
-char *argv[];
-IOSTRUCT *instr;
-IOSTRUCT *outstr;
-IOSTRUCT *errstr;
-{
- if (in_an_if <= 0) {
- mess_temp("Syntax error - \"fi\" with no pending \"if\"");
- mess_lock();
- in_an_if = 0;
- return FAIL;
- }
- if (((status_of_if[in_an_if] & IN_A_THEN) == 0) &&
- ((status_of_if[in_an_if] & IN_AN_ELSE) == 0) &&
- ((status_of_if[in_an_if] & IN_AN_ELIF_SKIP) == 0)) {
- mess_temp("Syntax error - \"fi\" with no pending \"then\"");
- mess_lock();
- in_an_if = 0;
- return FAIL;
- }
-
- in_an_if--;
-
- if (argc > 1) {
- mess_temp("Syntax error - missing semi-colon after \"fi\" statement.");
- mess_lock();
- in_an_if = 0;
- return FAIL;
- }
-
- return(Lastret);
-}
-
-int
-cmd_then(argc, argv, instr, outstr, errstr)
-int argc;
-char *argv[];
-IOSTRUCT *instr;
-IOSTRUCT *outstr;
-IOSTRUCT *errstr;
-{
- if (in_an_if <= 0) {
- mess_temp("Syntax error - \"then\" with no pending \"if\"");
- mess_lock();
- in_an_if = 0;
- return FAIL;
- }
-
- if (status_of_if[in_an_if] & IN_A_THEN) {
- mess_temp("Syntax error - \"then\" within \"then\"");
- mess_lock();
- in_an_if = 0;
- return FAIL;
- }
-
- if (status_of_if[in_an_if] & IN_AN_ELSE) {
- mess_temp("Syntax error - \"then\" within \"else\"");
- mess_lock();
- in_an_if = 0;
- return FAIL;
- }
-
- if (((status_of_if[in_an_if] & IN_A_CONDITION) == 0) &&
- ((status_of_if[in_an_if] & IN_AN_ELIF_SKIP) == 0)) {
- mess_temp("Syntax error - \"then\" without a preceeding \"if\"");
- mess_lock();
- in_an_if = 0;
- return FAIL;
- }
-
- /*
- * If we are in an "elif" but are NOT evaluating its condition
- * statement(s) (i.e., a previous "if" condition already evauated
- * to true) ... then just return SUCCESS;
- */
- if (status_of_if[in_an_if] & IN_AN_ELIF_SKIP)
- return SUCCESS;
-
- status_of_if[in_an_if] &= ~(ANY_IF_STATE);
- status_of_if[in_an_if] &= ~(IN_A_CONDITION);
- status_of_if[in_an_if] |= IN_A_THEN;
-
- return SUCCESS;
-}
-
-int
-cmd_else(argc, argv, instr, outstr, errstr)
-int argc;
-char *argv[];
-IOSTRUCT *instr;
-IOSTRUCT *outstr;
-IOSTRUCT *errstr;
-{
- if (in_an_if <= 0) {
- mess_temp("Syntax error - \"else\" with no pending \"if\"");
- mess_lock();
- in_an_if = 0;
- return FAIL;
- }
-
- if (status_of_if[in_an_if] & IN_AN_ELSE) {
- mess_temp("Syntax error - \"else\" within \"else\"");
- mess_lock();
- in_an_if = 0;
- return FAIL;
- }
-
- if (((status_of_if[in_an_if] & IN_A_THEN) == 0) &&
- ((status_of_if[in_an_if] & IN_AN_ELIF_SKIP) == 0)) {
- mess_temp("Syntax error - \"else\" with no pending \"then\"");
- mess_lock();
- in_an_if = 0;
- return FAIL;
- }
-
- status_of_if[in_an_if] &= ~(ANY_IF_STATE);
- status_of_if[in_an_if] |= IN_AN_ELSE;
-
- return SUCCESS;
-}
-
-int
-shell(argc, argv, instr, outstr, errstr)
-int argc;
-char *argv[];
-IOSTRUCT *instr;
-IOSTRUCT *outstr;
-IOSTRUCT *errstr;
-{
- register int i;
- register int len;
- register char *crunch;
- char *myargv[4];
- char *strnsave();
-
- len = 0;
- for (i = 1; i < argc; i++)
- len += strlen(argv[i]);
- crunch = strnsave(nil, len + argc - 1);
- for (i = 1; i < argc; i++) {
- strcat(crunch, " ");
- strcat(crunch, argv[i]);
- }
- myargv[0] = "sh";
- myargv[1] = "-c";
- myargv[2] = crunch;
- myargv[3] = NULL;
- i = execute(3, myargv, instr, outstr, errstr);
- free(crunch);
- return i;
-}
-
-int
-execute(argc, argv, instr, outstr, errstr)
-int argc;
-char *argv[];
-IOSTRUCT *instr;
-IOSTRUCT *outstr;
-IOSTRUCT *errstr;
-{
- register char *p;
- register FILE *errfp;
- register pid_t pid; /* EFT abs k16 */
- int pfd[2];
- char *strchr();
- unsigned char cc_vintr_sav = '\0';
- bool changed_vintr = FALSE;
-
- if (strcmp(argv[0], "extern") == 0)
- argv++;
-#ifdef _DEBUG2
- for (pid = 0; pid < argc; pid++)
- _debug2(stderr, "argv[%d] = '%s'\n", pid, argv[pid]);
-#endif
- if (pipe(pfd))
- return FAIL;
- if (errstr == NULL)
- if ((errfp = fopen(p = tmpnam(NULL), "w+")) != NULL)
-/* if ((errfd = open(p = tmpnam(NULL), O_EXCL | O_CREAT | O_RDWR, 0600)) >= 0)
-abs */
- unlink(p);
- else
- return FAIL;
- else
- errfp = errstr->mu.fp;
-
- switch (pid = fork()) {
- case -1:
- return FAIL;
- case 0: /* child */
- close(pfd[0]);
- close(1);
- dup(pfd[1]);
- close(pfd[1]);
- close(2);
- dup(fileno(errfp));
- fclose(errfp);
-
- {
- if (instr->flags & EV_USE_FP) {
- close(0);
- dup(fileno(instr->mu.fp));
- }
- else if (instr->mu.str.count > 0) {
- register int c;
- register FILE *infp;
- FILE *tempfile();
-
- if ((infp = tempfile(NULL, "w+")) == NULL)
- exit(1);
- while (c = getac(instr))
- putc(c, infp);
- close(0);
- dup(fileno(infp));
- fclose(infp);
- }
- if (Cur_intr.interrupt) /* if (interrupts enabled) */
- sigset(SIGINT, SIG_DFL);
- else /* hide the interrupt key */
- {
- struct termio tbuf;
-
- if (ioctl(stdin, TCGETA, &tbuf) != -1) /* if successful.. */
- {
-
- cc_vintr_sav = tbuf.c_cc[VINTR];
- tbuf.c_cc[VINTR] = 0xff;
- if (ioctl(stdin, TCSETA, &tbuf) != -1)
- changed_vintr = TRUE;
- }
- }
- execvp(argv[0], argv);
- error_exec(errno);
- perror("fmli");
- exit(R_BAD_CHILD); /* abs changed from exit(1).
- This is fmli's exit not the C lib. call */
- }
- break;
- default: /* parent (FMLI) */
- {
- register int c;
- register int retval;
- FILE *fp;
-
- close(pfd[1]);
- if ((fp = fdopen(pfd[0], "r")) == NULL)
- return FAIL;
-
- /* the errno == EINTR is added below to check for
- system interrupts like MAILCHECK that were terminating
- the read in progress -- added 7/89 by njp */
- while ((c = getc(fp)) != EOF || errno == EINTR)
-
- {
- putac(c, outstr);
- errno = 0;
- }
- fclose(fp);
- retval = waitspawn(pid);
-/****
- if ((retval = waitspawn(pid)) && errfp != NULL && errstr != NULL)
- {
- char buf[MESSIZ];
-
- if ((c = fread(buf, sizeof(char), MESSIZ-1, errfp)) > 0)
- {
-******/
-/* for unknown reasons this never worked (returns c = 0) abs
- if ((c = read(errfd, buf, sizeof(buf) - 1)) > 0) {
-*/
-/***** buf[c] = '\0';
- if (p = strchr(buf, '\n'))
- *p = '\0';
- mess_temp(buf);
- }
- }
-******/
- /* reset the interrupt key */
- if (changed_vintr == TRUE)
- {
- struct termio tbuf;
-
- if (ioctl(stdin, TCGETA, &tbuf) != -1) /* if successful.. */
- {
- tbuf.c_cc[VINTR] = cc_vintr_sav;
- ioctl(stdin, TCSETA, &tbuf);
- }
- }
-
- if (errfp != NULL)
- fclose(errfp);
- return retval;
- }
- break;
- }
- /*
- * lint will complain about it, but there's actually no way to
- * reach here because of the exit(), so this is not a return
- * without an expression
- */
- return (0);
-}
-
-int
-get_wdw(argc, argv, instr, outstr, errstr)
-int argc;
-char *argv[];
-IOSTRUCT *instr;
-IOSTRUCT *outstr;
-IOSTRUCT *errstr;
-{
- int wdwnum;
-
- wdwnum = ar_ctl(ar_get_current(), CTGETWDW, NULL, NULL, NULL, NULL, NULL, NULL);
- putastr(itoa((long)wdwnum, 10), outstr); /* abs k16 */
- return SUCCESS;
-}
-
-int
-getmod(argc, argv, instr, outstr, errstr)
-int argc;
-char *argv[];
-IOSTRUCT *instr;
-IOSTRUCT *outstr;
-IOSTRUCT *errstr;
-{
- static mode_t modes; /* EFT abs k16 */
- int i;
- struct stat statbuf;
- long strtol();
- char *bsd_path_to_title();
-
- if (argc < 2)
- return FAIL;
- i = 1;
- if (argc > 2) {
- i++;
- if (strcmp(argv[1], "-u") == 0) {
- register char *p;
- char *getepenv();
-
- if ((p = getepenv("UMASK")) == NULL || *p == '\0')
- modes = 0775;
- else
- modes = ~(strtol(p, NULL, 8)) & 0777;
- } else if (stat(argv[1], &statbuf) == -1) {
- mess_temp(nstrcat("Could not access object ",
- bsd_path_to_title(argv[1], MESS_COLS-24), NULL));
- return FAIL;
- } else
- modes = statbuf.st_mode;
- }
- if (strtol(argv[i], NULL, 8) & modes)
- putastr("yes", outstr);
- else
- putastr("no", outstr);
- return SUCCESS;
-}
-
-int
-setmod(argc, argv, instr, outstr, errstr)
-int argc;
-char *argv[];
-IOSTRUCT *instr;
-IOSTRUCT *outstr;
-IOSTRUCT *errstr;
-{
- register int i;
- register mode_t mode; /* EFT abs k16 */
- char *bsd_path_to_title();
-
- if (argc < 2)
- return FAIL;
- for (i = 2, mode = 0; argv[i]; i++)
- mode = (mode << 1) | !strCcmp(argv[i], "yes");
-
- if ((mode & 0600) != 0600)
- mess_temp("WARNING: You are denying some permissions to yourself!");
-
- if (strcmp(argv[1], "-u") == 0) {
- char buf[20];
-
- mode = ~mode & 0777;
- (void) umask(mode);
- sprintf(buf, "0%o", mode);
- return chgepenv("UMASK", buf);
- } else if (chmod(argv[1], mode) < 0) {
- mess_temp(nstrcat("Unable to change security on ",
- bsd_path_to_title(argv[1], MESS_COLS-29), NULL));
- return(FAIL);
- } else
- return SUCCESS;
-}
-
-int Long_line = -1;
-
-int
-long_line(argc, argv, instr, outstr, errstr)
-int argc;
-char *argv[];
-IOSTRUCT *instr;
-IOSTRUCT *outstr;
-IOSTRUCT *errstr;
-{
- register int maxcount, c, count;
- FILE *fp;
-
- if (argv[1]) { /* if there is a file argument */
- if ((fp = fopen(argv[1], "r")) == NULL)
- return(FAIL);
- for (maxcount = 0, count = 0; (c = getc(fp)) != EOF; count++) {
- if (c == '\n') {
- maxcount = max(maxcount, count);
- count = -1;
- }
- }
- fclose(fp);
- Long_line = max(maxcount, count);
- }
- else if (Long_line < 0)
- return(FAIL);
- putastr(itoa((long)Long_line + 1, 10), outstr); /* abs k16 */
- return SUCCESS;
-}
-
-int
-read_file(argc, argv, instr, outstr, errstr)
-int argc;
-char *argv[];
-IOSTRUCT *instr;
-IOSTRUCT *outstr;
-IOSTRUCT *errstr;
-{
- char *p, *f;
- register int c, count, maxcount;
- FILE *fp;
- char *path_to_full();
-
- if (argc > 1)
- f = path_to_full(argv[1]);
- else {
- f = path_to_full(p = io_string(instr));
- free(p);
- }
- if ((fp = fopen(f, "r")) == NULL)
- return(FAIL);
- free(f);
- for (count = 0, maxcount = 0; (c = getc(fp)) != EOF; count++) {
- if (c == '\n') {
- maxcount = max(maxcount, count);
- count = -1;
- }
- putac(c, outstr);
- }
- Long_line = max(maxcount, count);
- fclose(fp);
- return SUCCESS;
-}
-
-int
-cmd_echo(argc, argv, instr, outstr, errstr)
-int argc;
-char *argv[];
-IOSTRUCT *instr;
-IOSTRUCT *outstr;
-IOSTRUCT *errstr;
-{
- register char *p;
- register int i;
- char *strrchr();
-
- for (i = 1; i < argc; i++) {
- if (i > 1)
- putac(' ', outstr);
- if (i == argc - 1 && (p = strrchr(argv[i], '\\')) && strcmp(p, "\\c'") == 0) {
- *p = '\0';
- putastr(argv[i], outstr);
- return SUCCESS;
- }
- putastr(argv[i], outstr);
- }
- putac('\n', outstr);
- return SUCCESS;
-}
-
-#ifndef TEST
-extern int cocreate();
-extern int cosend();
-extern int codestroy();
-extern int cocheck();
-extern int coreceive();
-extern int genfind();
-extern int cmd_pathconv();
-#endif
-extern int cmd_set();
-extern int cmd_run();
-extern int cmd_regex();
-extern int cmd_getlist();
-extern int cmd_setcolor();
-extern int cmd_reinit();
-extern int cmd_message();
-extern int cmd_indicator();
-extern int cmd_unset();
-extern int cmd_getodi();
-extern int cmd_setodi();
-extern int cmd_cut();
-extern int cmd_grep();
-extern int cmd_test(); /* ehr3 */
-extern int cmd_expr();
-
-#define NUM_FUNCS (sizeof(func) / sizeof(*func))
-
-static struct {
- char *name;
- int (*function)();
-} func[] = {
- { "extern", execute },
- { "shell", shell },
- { "regex", cmd_regex },
- { "echo", cmd_echo },
- { "fmlcut", cmd_cut },
- { "fmlgrep", cmd_grep },
- { "fmlexpr", cmd_expr },
- { "set", cmd_set },
- { "unset", cmd_unset },
- { "getmod", getmod },
- { "getodi", cmd_getodi },
- { "getfrm", get_wdw },
- { "getwdw", get_wdw }, /* alias to getfrm */
- { "setmod", setmod },
- { "setodi", cmd_setodi },
- { "readfile", read_file },
- { "longline", long_line },
- { "message", cmd_message },
- { "indicator", cmd_indicator },
- { "run", cmd_run },
- { "getitems", cmd_getlist },
- { "genfind", genfind },
- { "pathconv", cmd_pathconv },
- { "setcolor", cmd_setcolor},
- { "reinit", cmd_reinit},
- { "test", cmd_test}, /* ehr3 */
- { "[", cmd_test}, /* ehr3 */
- { "if", cmd_if}, /* ehr3 */
- { "then", cmd_then}, /* ehr3 */
- { "else", cmd_else}, /* ehr3 */
- { "elif", cmd_elif}, /* ehr3 */
- { "fi", cmd_fi}, /* ehr3 */
-/*
- * not yet ...
- *
- { "true", cmd_true},
- { "false", cmd_false},
- */
-#ifndef TEST
- { "cocreate", cocreate },
- { "cosend", cosend },
- { "codestroy", codestroy },
- { "cocheck", cocheck },
- { "coreceive", coreceive }
-#endif
-};
-
-int
-evalargv(argc, argv, instr, outstr, errstr)
-int argc;
-char *argv[];
-IOSTRUCT *instr;
-IOSTRUCT *outstr;
-IOSTRUCT *errstr;
-{
- register int n, ret;
- int n2;
-
-/* test moved to calling routine, SUCCESS is wrong here. abs
- * if (argc < 1)
- * return SUCCESS;
- */
-
- for (n = 0; n < NUM_FUNCS; n++)
- if (strcmp(argv[0], func[n].name) == 0)
- break;
-
- if (n >= NUM_FUNCS)
- n = 0;
-
- if (in_an_if) {
- switch(argv[0][0]) {
- case 'i':
- if (!strcmp(argv[0], "if")) {
- ret = cmd_if(argc, argv, instr, outstr);
- return ret;
- }
- break;
-
- case 't':
- if (!strcmp(argv[0], "then")) {
- ret = cmd_then(argc, argv, instr, outstr);
- return ret;
- }
- break;
-
- case 'e':
- if (!strcmp(argv[0], "else")) {
- ret = cmd_else(argc, argv, instr, outstr);
- return ret;
- }
-
- if (!strcmp(argv[0], "elif")) {
- ret = cmd_elif(argc, argv, instr, outstr);
- return ret;
- }
- break;
-
- case 'f':
- if (!strcmp(argv[0], "fi")) {
- ret = cmd_fi(argc, argv, instr, outstr);
- return ret;
- }
- break;
- }
-
- /*
- AFTER checking for if-then-else stuff
- we need to determine if we are in
- executable code or not. We do this by
- checking each prior level of nesting.
- If any of them fails, then we know
- we should not execute this command.
- */
- for (n2 = 1; n2 <= in_an_if; n2++) {
- if (status_of_if[n2] & IF_IS_TRUE) {
- /*
- * The condition is TRUE ...
- * skip the command if:
- *
- * we are in an "else"
- *
- * we are in an "elif" but a previous
- * "if" or "elif" evaluated to true
- */
- if ((status_of_if[n2] & IN_AN_ELSE) ||
- (status_of_if[n2] & IN_AN_ELIF_SKIP))
- return SUCCESS;
- } else {
- /*
- * The condition is FALSE ...
- * skip the command if we are in
- * a "then"
- */
- if (status_of_if[n2] & IN_A_THEN)
- return SUCCESS;
- }
- }
-
- if (status_of_if[in_an_if] & IN_A_CONDITION) {
- int cmd_rc;
-
- cmd_rc = (*func[n].function)(argc, argv, instr, outstr, errstr);
- if (cmd_rc == SUCCESS)
- status_of_if[in_an_if] |= IF_IS_TRUE;
- else
- status_of_if[in_an_if] &= ~IF_IS_TRUE;
- return(cmd_rc);
- } else {
- /*
- * Keep track of the return value from the
- * lastly executed built-in/executable ...
- * This value will determine the SUCCESS/FAILURE
- * of the if/then/else statement (see cmd_fi).
- */
- Lastret = (*func[n].function)(argc, argv, instr, outstr, errstr);
- return(Lastret);
- }
- }
- else return (*func[n].function)(argc, argv, instr, outstr, errstr);
-}
-
-int
-cmd_if(argc, argv, in, out, err)
-int argc;
-char *argv[];
-IOSTRUCT *in;
-IOSTRUCT *out;
-IOSTRUCT *err;
-{
- int n;
- int n2;
-
- in_an_if++;
- status_of_if[in_an_if] = IN_A_CONDITION;
-
- if (in_an_if == MAX_IF_DEPTH) {
- mess_temp("Internal error - \"if\" stack overflow");
- mess_lock();
- in_an_if = 0;
- return FAIL;
- }
-
- return SUCCESS;
-}
-
-int
-cmd_elif(argc, argv, in, out, err)
-int argc;
-char *argv[];
-IOSTRUCT *in;
-IOSTRUCT *out;
-IOSTRUCT *err;
-{
- int n;
- int n2;
-
- if (in_an_if <= 0) {
- mess_temp("Syntax error - \"elif\" with no pending \"if\"");
- mess_lock();
- in_an_if = 0;
- return FAIL;
- }
-
- if (status_of_if[in_an_if] & IN_AN_ELSE) {
- mess_temp("Syntax error - \"elif\" after an \"else\"");
- mess_lock();
- in_an_if = 0;
- return FAIL;
- }
-
- if (((status_of_if[in_an_if] & IN_A_THEN) == 0) &&
- ((status_of_if[in_an_if] & IN_AN_ELIF_SKIP) == 0)) {
- mess_temp("Syntax error - \"elif\" with no pending \"then\"");
- mess_lock();
- in_an_if = 0;
- return FAIL;
- }
-
-
- /*
- * if a previous "if/elif" condition is TRUE
- * then don't evaluate the "elif" condition.
- */
-
- if (status_of_if[in_an_if] & IF_IS_TRUE) {
- status_of_if[in_an_if] &= ~(ANY_IF_STATE);
- status_of_if[in_an_if] |= IN_AN_ELIF_SKIP;
- }
- else
- status_of_if[in_an_if] = IN_A_CONDITION;
-
- return SUCCESS;
-}
-
-/*
- * not yet ...
- *
-cmd_true(argc, argv, in, out, err)
-int argc;
-char *argv[];
-IOSTRUCT *in;
-IOSTRUCT *out;
-IOSTRUCT *err;
-{
- return(SUCCESS);
-}
-
-cmd_false(argc, argv, in, out, err)
-int argc;
-char *argv[];
-IOSTRUCT *in;
-IOSTRUCT *out;
-IOSTRUCT *err;
-{
- return(FAIL);
-}
-*/
diff --git a/usr/src/cmd/fmli/sys/exit.c b/usr/src/cmd/fmli/sys/exit.c
deleted file mode 100644
index eb9d1d1bd4..0000000000
--- a/usr/src/cmd/fmli/sys/exit.c
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-/*
- * Copyright (c) 1986 AT&T
- * All Rights Reserved
- */
-#ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.4 */
-
-#include <stdio.h>
-#include "wish.h"
-#include "var_arrays.h"
-#include "retcodes.h" /* abs */
-
-char *_tmp_ptr;
-char *Home;
-char *Filecabinet;
-char *Wastebasket;
-char *Filesys;
-char *Oasys;
-char *Progname;
-char **Remove;
-int (**Onexit)();
-char nil[] = "";
-int _Debug;
-
-void
-exit(n)
-int n;
-{
- register int i;
- int lcv;
-
- if (n == R_BAD_CHILD) /* abs */
- _exit(n);
- else
- {
- lcv = array_len(Onexit);
- for (i = 0; i < lcv; i++)
- (*Onexit[i])(n);
- lcv = array_len(Remove);
- for (i = 0; i < lcv; i++)
- unlink(Remove[i]);
- _cleanup();
- _exit(n);
- }
-}
diff --git a/usr/src/cmd/fmli/sys/expand.c b/usr/src/cmd/fmli/sys/expand.c
deleted file mode 100644
index 4ede72004d..0000000000
--- a/usr/src/cmd/fmli/sys/expand.c
+++ /dev/null
@@ -1,217 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-
-/*
- * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-/* Copyright (c) 1984, 1985, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-#include <stdio.h>
-#include <string.h>
-#include <ctype.h>
-#include "wish.h"
-#include "moremacros.h"
-#include "terror.h"
-#include "sizes.h"
-#include "sizes.h"
-
-/*
- * Globals to maintain dynamic expansion buffer
- * (destination buffer for "variable expanded" text)
- */
-static char *Destbuf;
-static int Bufsize;
-static int Bufcnt;
-
-/*
- * These macros check that the expansion buffer is BIG enough
- * before text is copies into it.
- */
-#define CHKbuf(p, q) if (++Bufcnt >= Bufsize) { \
- growbuf(q, BUFSIZ); \
- p = Destbuf + Bufcnt - 1; \
- }
-
-#define CHKnbuf(p, q, num) if ((Bufcnt += num) >= Bufsize) { \
- growbuf(q, num); \
- p = Destbuf + Bufcnt - num; \
- }
-static char *pexpand(char *buf, char *name, char eos);
-
-/*
- * GROWBUF will allocate/grow Destbuf by BUFSIZ
- */
-static void
-growbuf(buf, num)
-char *buf;
-int num;
-{
-
- Bufsize += num;
- if (Destbuf == NULL) {
- if ((Destbuf = malloc(Bufsize)) == NULL)
- fatal(NOMEM, nil);
- strcpy(Destbuf, buf);
- }
- else if ((Destbuf = realloc(Destbuf, Bufsize)) == NULL)
- fatal(NOMEM, nil);
-}
-
-/*
- * EXPAND will "expand" all environment variables in the
- * string pointed to by "src" and return a pointer to
- * the expanded text.
- */
-char *
-expand(src)
-char *src;
-{
- char buf[BUFSIZ];
- char *ret;
-
- /*
- * Use a static 1K buffer by default ....
- * pexpand() will create a dynamic buffer
- * if necessary and set "Destbuf" to it.
- */
- Destbuf = NULL;
- Bufsize = BUFSIZ;
- Bufcnt = 0;
-
- (void) pexpand(buf, src, '\0');
- if (Destbuf)
- ret = Destbuf; /* return malloc'd buffer */
- else
- ret = strsave(buf); /* strsave text from static buffer */
- return(ret);
-}
-
-static char *
-pexpand(char *buf, char *name, char eos)
-{
- register char delim;
- register char *src;
- register char *dst;
- register char *file;
- char fbuf[PATHSIZ];
- char *anyenv();
- char *getepenv();
- char *savebuf;
- int savesize;
- int savecnt;
-
- dst = buf;
- src = name;
- while (*src && *src != eos) {
- if (*src == '\\') {
- ++src;
- CHKbuf(dst, buf);
- *dst++ = *src++;
- }
- else if (*src == '$') {
- register char *start;
-
- if ((delim = (*++src == '{') ? '}' : '\0'))
- start = ++src;
- else
- start = src;
- file = NULL;
- if (*src == '(') {
- /*
- * Save dynamic buffer before calling
- * pexpand() recursively
- */
- savebuf = Destbuf;
- savesize = Bufsize;
- savecnt = Bufcnt;
-
- /*
- * Initialize globals
- */
- Destbuf = NULL;
- Bufsize = PATHSIZ;
- Bufcnt = 0;
-
- src = pexpand(fbuf, ++src, ')');
- if (*src) {
- start = ++src;
- if (Destbuf)
- file = Destbuf;
- else
- file = fbuf;
- }
-
- /*
- * Restore previous values for
- * dynamic buffer and continue
- * as usual ....
- */
- Destbuf = savebuf;
- Bufsize = savesize;
- Bufcnt = savecnt;
- }
- if (isalpha(*src)) {
- register char *p;
- register char savechar;
-
- while (isalpha(*src) || isdigit(*src) || *src == '_')
- src++;
- savechar = *src;
- *src = '\0';
- if ((p = (file ? anyenv(file, start) : getepenv(start))) == NULL) {
- if (delim) {
- if ((*src = savechar) == ':' && *++src == '-')
- while (*++src && *src != delim) {
- CHKbuf(dst, buf);
- *dst++ = *src;
- }
- }
- else
- *src = savechar;
- }
- else {
- *src = savechar;
- CHKnbuf(dst, buf, (int)strlen(p)); /* EFT k16 */
- strcpy(dst, p);
- dst += strlen(p);
- free(p);
- }
- if (delim)
- while (*src && *src++ != delim)
- ;
- }
- }
- else {
- CHKbuf(dst, buf);
- *dst++ = *src++;
- }
- }
- CHKbuf(dst, buf);
- *dst = '\0';
- return src;
-}
diff --git a/usr/src/cmd/fmli/sys/expr.c b/usr/src/cmd/fmli/sys/expr.c
deleted file mode 100644
index 43672ea41f..0000000000
--- a/usr/src/cmd/fmli/sys/expr.c
+++ /dev/null
@@ -1,439 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-
-/*
- * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-#include <stdio.h>
-/*
- * FMLI begin
- */
-#include <setjmp.h>
-#include "wish.h"
-/* #include "message.h" */
-#include "eval.h"
-
-static jmp_buf Jumpenv;
-/*
- * FMLI end
- */
-
-# define A_STRING 258
-# define NOARG 259
-# define OR 260
-# define AND 261
-# define EQ 262
-# define LT 263
-# define GT 264
-# define GEQ 265
-# define LEQ 266
-# define NEQ 267
-# define ADD 268
-# define SUBT 269
-# define MULT 270
-# define DIV 271
-# define REM 272
-# define MCH 273
-# define MATCH 274
-
-#define ESIZE 256
-#define EQL(x,y) !strcmp(x,y)
-
-long atol();
-char *strcpy(), *strncpy();
-static char **Av;
-static char *buf;
-static int Ac;
-static int Argi;
-static int noarg;
-static int paren;
-
-static char Mstring[1][128];
-
-static char *ltoa(long l);
-static int ematch(char *s, char *p);
-static int yyerror(char *s);
-
-extern int nbra;
-
-static char *operator[] = {
- "|", "&", "+", "-", "*", "/", "%", ":",
- "=", "==", "<", "<=", ">", ">=", "!=",
- "match", "\0" };
-static int op[] = {
- OR, AND, ADD, SUBT, MULT, DIV, REM, MCH,
- EQ, EQ, LT, LEQ, GT, GEQ, NEQ,
- MATCH };
-static int pri[] = {
- 1,2,3,3,3,3,3,3,4,4,5,5,5,6,7};
-
-int
-yylex() {
- char *p;
- int i;
-
- if(Argi >= Ac) return NOARG;
-
- p = Av[Argi];
-
- if((*p == '(' || *p == ')') && p[1] == '\0' )
- return (int)*p;
- for(i = 0; *operator[i]; ++i)
- if(EQL(operator[i], p))
- return op[i];
-
-
- return A_STRING;
-}
-
-static char *
-rel(oper, r1, r2)
-char *r1, *r2;
-{
- long i;
-
- if(ematch(r1, "-\\{0,1\\}[0-9]*$") && ematch(r2, "-\\{0,1\\}[0-9]*$"))
- i = atol(r1) - atol(r2);
- else
- i = strcmp(r1, r2);
- switch(oper) {
- case EQ:
- i = i==0;
- break;
- case GT:
- i = i>0;
- break;
- case GEQ:
- i = i>=0;
- break;
- case LT:
- i = i<0;
- break;
- case LEQ:
- i = i<=0;
- break;
- case NEQ:
- i = i!=0;
- break;
- }
- return i? "1": "0";
-}
-
-static char *
-arith(oper, r1, r2)
-char *r1, *r2;
-{
- long i1, i2;
- char *rv;
-
- if(!(ematch(r1, "-\\{0,1\\}[0-9]*$") && ematch(r2, "-\\{0,1\\}[0-9]*$")))
- yyerror("non-numeric argument");
- i1 = atol(r1);
- i2 = atol(r2);
-
- switch(oper) {
- case ADD:
- i1 = i1 + i2;
- break;
- case SUBT:
- i1 = i1 - i2;
- break;
- case MULT:
- i1 = i1 * i2;
- break;
- case DIV:
- if (i2 == 0)
- yyerror("division by zero");
- i1 = i1 / i2;
- break;
- case REM:
- if (i2 == 0)
- yyerror("division by zero");
- i1 = i1 % i2;
- break;
- }
- rv = malloc(16);
- (void) strcpy(rv, ltoa(i1));
- return rv;
-}
-static char *
-conj(oper, r1, r2) char *r1, *r2;
-{
- char *rv;
-
- switch(oper) {
-
- case OR:
- if(EQL(r1, "0")
- || EQL(r1, ""))
- if(EQL(r2, "0")
- || EQL(r2, ""))
- rv = "0";
- else
- rv = r2;
- else
- rv = r1;
- break;
- case AND:
- if(EQL(r1, "0")
- || EQL(r1, ""))
- rv = "0";
- else if(EQL(r2, "0")
- || EQL(r2, ""))
- rv = "0";
- else
- rv = r1;
- break;
- }
- return rv;
-}
-
-static char *
-match(s, p)
-char *s, *p;
-{
- char *rv;
-
- (void) strcpy(rv=malloc(8), ltoa((long)ematch(s, p)));
- if(nbra) {
- rv = malloc((unsigned) strlen(Mstring[0]) + 1);
- (void) strcpy(rv, Mstring[0]);
- }
- return rv;
-}
-
-static int
-ematch(char *s, char *p)
-{
- static char expbuf[ESIZE];
- void errxx();
- int num;
- extern char *braslist[], *braelist[], *loc2;
-
- compile(p, expbuf, &expbuf[512], 0, errxx);
- if(nbra > 1)
- yyerror("Too many '\\('s");
- if(advance(s, expbuf)) {
- if(nbra == 1) {
- p = braslist[0];
- num = braelist[0] - p;
- if ((num > 127) || (num < 0)) yyerror("Paren problem");
- (void) strncpy(Mstring[0], p, num);
- Mstring[0][num] = '\0';
- }
- return(loc2-s);
- }
- return(0);
-}
-
-void
-errxx()
-{
- yyerror("RE error");
-}
-
-static int
-yyerror(char *s)
-{
- char tmpbuf[BUFSIZ];
-
- /*
- * Changed the expr prefix to fmlexpr. mek
- */
- sprintf(tmpbuf, "fmlexpr: %s\n", s);
- mess_temp(tmpbuf);
- mess_flash(tmpbuf);
- doupdate();
- longjmp(Jumpenv, 1);
- /*NOTREACHED*/
-}
-
-static char *
-ltoa(long l)
-{
- static int str[20];
- char *sp = (char *) &str[18]; /*u370*/
- int i;
- int neg = 0;
-
- if(l == 0x80000000L)
- return "-2147483648";
- if(l < 0)
- ++neg, l = -l;
- str[19] = '\0';
- do {
- i = l % 10;
- *sp-- = '0' + i;
- l /= 10;
- }
- while(l);
- if(neg)
- *sp-- = '-';
- return ++sp;
-}
-
-static char *
-expres(prior,par) int prior, par;
-{
- int ylex, temp, op1;
- char *r1, *ra, *rb;
- ylex = yylex();
- if (ylex >= NOARG && ylex < MATCH) {
- yyerror("syntax error");
- }
- if (ylex == A_STRING) {
- r1 = Av[Argi++];
- temp = Argi;
- }
- else {
- if (ylex == '(') {
- paren++;
- Argi++;
- r1 = expres(0,Argi);
- Argi--;
- }
- }
-lop:
- ylex = yylex();
- if (ylex > NOARG && ylex < MATCH) {
- op1 = ylex;
- Argi++;
- if (pri[op1-OR] <= prior )
- return r1;
- else {
- switch(op1) {
- case OR:
- case AND:
- r1 = conj(op1,r1,expres(pri[op1-OR],0));
- break;
- case EQ:
- case LT:
- case GT:
- case LEQ:
- case GEQ:
- case NEQ:
- r1=rel(op1,r1,expres(pri[op1-OR],0));
- break;
- case ADD:
- case SUBT:
- case MULT:
- case DIV:
- case REM:
- r1=arith(op1,r1,expres(pri[op1-OR],0));
- break;
- case MCH:
- r1=match(r1,expres(pri[op1-OR],0));
- break;
- }
- if(noarg == 1) {
- return r1;
- }
- Argi--;
- goto lop;
- }
- }
- ylex = yylex();
- if(ylex == ')') {
- if(par == Argi) {
- yyerror("syntax error");
- }
- if(par != 0) {
- paren--;
- Argi++;
- }
- Argi++;
- return r1;
- }
- ylex = yylex();
- if(ylex > MCH && ylex <= MATCH) {
- if (Argi == temp) {
- return r1;
- }
- op1 = ylex;
- Argi++;
- switch(op1) {
- case MATCH:
- rb = expres(pri[op1-OR],0);
- ra = expres(pri[op1-OR],0);
- }
- switch(op1) {
- case MATCH:
- r1 = match(rb,ra);
- break;
- }
- if(noarg == 1) {
- return r1;
- }
- Argi--;
- goto lop;
- }
- ylex = yylex();
- if (ylex == NOARG) {
- noarg = 1;
- }
- return r1;
-}
-
-int
-cmd_expr(argc, argv, instr, outstr)
-int argc;
-char **argv;
-IOSTRUCT *instr;
-IOSTRUCT *outstr;
-{
- Ac = argc;
- Argi = 1;
- noarg = 0;
- paren = 0;
- Av = argv;
- buf = NULL;
-
- Mstring[0][0] = '\0';
-
- /*
- * FMLI: return FAIL if setjmp returns a non-zero value
- * (i.e., called by longjmp() in yyerror())
- */
- if (setjmp(Jumpenv) != 0)
- return(FAIL);
-
- buf = expres(0,1);
- if(Ac != Argi || paren != 0) {
- yyerror("syntax error");
- }
-
- /*
- * use FMLI output routines
- */
- (void) putastr(buf, outstr);
- (void) putastr("\n", outstr);
- return((!strcmp(buf, "0") || !buf[0])? FAIL: SUCCESS);
-}
diff --git a/usr/src/cmd/fmli/sys/filename.c b/usr/src/cmd/fmli/sys/filename.c
deleted file mode 100644
index 054afaa9bc..0000000000
--- a/usr/src/cmd/fmli/sys/filename.c
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-/*
- * Copyright (c) 1985 AT&T
- * All Rights Reserved
- */
-#ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.1 */
-
-#include <stdio.h>
-
-char *
-filename(pt)
-register char *pt;
-{
- register char *name;
- char *strrchr();
-
- if (pt == NULL)
- return "(null)";
- if ((name = strrchr(pt, '/')) == NULL)
- return pt;
-
- return name + 1;
-}
diff --git a/usr/src/cmd/fmli/sys/genfind.c b/usr/src/cmd/fmli/sys/genfind.c
deleted file mode 100644
index 940068ba26..0000000000
--- a/usr/src/cmd/fmli/sys/genfind.c
+++ /dev/null
@@ -1,359 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-
-/*
- * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-/* Copyright (c) 1984, 1985, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-#include <pwd.h>
-#include <stdio.h>
-#include <string.h>
-#include <time.h>
-#include <values.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include "wish.h"
-#undef min
-#undef max
-#include "typetab.h" /* for ott masks ott_tab ott_entry() */
-#include "partabdefs.h"
-#include "var_arrays.h" /* for array_len() */
-#include "sizes.h"
-
-#ifndef TEST
-
-#include "eval.h"
-
-#else /* TEST */
-#define IOSTRUCT FILE
-#define putac putc
-#define putastr fputs
-#define mess_temp puts
-#endif /* TEST */
-
-#define DAY (24L * 60L * 60L)
-
-extern struct ott_entry *Cur_entry;
-extern struct opt_entry Partab[];
-extern char *Oasys;
-
-static char any[] = "any";
-static char path_buf[PATHSIZ];
-static void traverse();
-static char *myregcmp(char *s);
-static int range(char *s, int origin, int *mindays, int *maxdays);
-
-#ifdef TEST
-int
-main(argc, argv)
-int argc;
-char *argv[];
-{
- wish_init(argc, argv);
- odftread();
- genfind(argc, argv, stdin, stdout);
- return (0);
-}
-#endif /* TEST */
-
-/*
- * usage: genfind path filename type owner age
- */
-int
-genfind(argc, argv, instr, outstr, errstr)
-int argc;
-char *argv[];
-IOSTRUCT *instr;
-IOSTRUCT *outstr;
-IOSTRUCT *errstr;
-{
- FILE *fp;
- register pid_t uid; /* EFT abs k16 */
- int min_days;
- int max_days;
- int do_traverse;
- int origin;
- int pathpos;
- int namepos;
- char path[PATHSIZ];
- char buf[BUFSIZ];
- char *type;
- char *dtype;
- char allpath[PATHSIZ];
- char *Allfile="/info/OH/externals/allobjs";
- register int i;
- register char *pattern;
- register struct passwd *passwdptr;
- struct passwd *getpwnam();
-
- if (argc < 6 && argc > 8) {
- mess_temp("Arguments invalid");
- return FAIL;
- }
- i = 1;
- origin = 0;
- if (strcmp(argv[i], "-1") == 0) {
- origin = 1;
- i++;
- }
- else
- do_traverse = TRUE;
- if (strcmp(argv[i], "-n") == 0) {
- do_traverse = FALSE;
- i++;
- }
- else
- do_traverse = TRUE;
- pathpos = i;
- /* traverse assumes at least 1 extra byte available in path */
- if ((int)strlen(argv[i]) > PATHSIZ - 2) { /* EFT k16 */
- mess_temp("Path too long");
- return FAIL;
- }
- strncpy(path, argv[i], PATHSIZ);
- path[sizeof(path) - 1] = '\0';
- if ((pattern = myregcmp(argv[++i])) == NULL) {
- mess_temp("Name invalid");
- return FAIL;
- }
- namepos = ++i;
- if (strCcmp(argv[++i], any)) {
- if ((passwdptr = getpwnam(argv[i])) == NULL) {
- mess_temp("Owner invalid");
- return FAIL;
- }
- uid = passwdptr->pw_uid;
- }
- else
- uid = -1;
- if (strCcmp(argv[++i], any)) {
- if (range(argv[i], origin, &min_days, &max_days) < 0) {
- mess_temp("Age invalid");
- return FAIL;
- }
- }
- else
- min_days = -1;
-
- (void) strcpy(allpath, Oasys);
- (void) strcat(allpath, Allfile);
-
-
- if ((fp = fopen(allpath, "r")) == NULL)
- type=NULL;
- else
- while(fgets(buf,BUFSIZ,fp)) {
- type=strtok(buf,"\t");
- dtype=strtok(NULL,"\n");
- if (strcmp(argv[namepos],dtype) == 0)
- break;
- type=NULL;
- }
- fclose(fp);
-
- traverse(path, pattern, uid, strCcmp(argv[namepos], any) ? argv[namepos] : NULL, min_days, max_days, argv[pathpos], do_traverse, outstr, type );
- return SUCCESS;
-}
-
-static void
-traverse(path, pattern, uid, objtype, min_days, max_days, prefix, do_traverse, outstr, type)
-char *path;
-char *pattern;
-int uid;
-char *objtype;
-int min_days;
-int max_days;
-char *prefix;
-int do_traverse;
-IOSTRUCT *outstr;
-char *type;
-{
- register int i;
- register int length;
- register int ott_len;
- register int numdays;
- char *basename;
- char *objname;
- char *typename;
- char *intobj;
- long mask;
- time_t now; /* EFT abs k16 */
- struct stat filestat;
- struct tm *t;
- struct ott_tab *ott;
- struct ott_tab *ott_get();
- struct ott_entry *entry;
- char *bsd_path_to_title();
- char *regex();
- time_t time(); /* EFT abs k16 */
- struct tm *localtime();
-
- /* check to see if enough space to put file names */
- if ((length = strlen(path)) >= PATHSIZ - 2)
- return;
- if ((ott = ott_get(path, OTT_SALPHA, 0, 0, 0)) == NULL)
- return;
- entry = Cur_entry;
- ott_len = array_len(ott->parents);
- now = time(NULL);
- t = localtime(&now);
- now += (60 - t->tm_sec) + 60 * ((59 - t->tm_min) + 60 * (23 - t->tm_hour));
- for (i = 0; i < ott_len; ++i) {
- /* shorter names */
- basename = entry[ott->parents[i]].name;
- objname = entry[ott->parents[i]].dname;
- typename = entry[ott->parents[i]].display;
- intobj = entry[ott->parents[i]].objtype;
- mask = entry[ott->parents[i]].objmask;
- /* object's name not viewable or marked deleted */
- if (basename[0] == '\0' || (mask & M_WB) || (mask & M_DL))
- continue;
- /*
- * these tests are performed in order of increasing
- * computational cost
- */
- path[length] = '/';
- strncpy(&path[length + 1], basename, PATHSIZ - length - 2);
-
- if ((!objtype || !strcmp(objtype, typename) ||
- !strcmp(intobj, type)) && regex(pattern, objname)) {
- numdays = (int) ((now - entry[ott->parents[i]].mtime) / DAY);
- if (min_days < 0 || (numdays >= min_days && numdays <= max_days)) {
- if (uid >= 0 && stat(path, &filestat))
- continue;
- if (uid < 0 || filestat.st_uid == uid) {
- putastr(path, outstr);
- putac(';', outstr);
- putastr(entry[ott->parents[i]].objtype, outstr);
- putac(';', outstr);
- path[length] = '\0';
- if (do_traverse) {
-
- strcpy(path_buf,path);
- strcat(path_buf,"/");
- strcat(path_buf,objname);
- putastr(bsd_path_to_title(&path_buf[strlen(prefix)+1],
- COLS - 30), outstr);
- } else
- putastr(objname, outstr);
- path[length] = '/';
- putac(';', outstr);
- putastr(typename, outstr);
- putac('\n', outstr);
- }
- }
- }
- if (mask & CL_DIR) {
- /* object is a directory and not deleted, search */
- if (do_traverse)
- traverse(path, pattern, uid, objtype, min_days, max_days,
- prefix, do_traverse, outstr, type);
- path[length] = '\0';
- if ((ott = ott_get(path, OTT_SALPHA, 0, 0, 0)) == NULL)
- return;
- entry = Cur_entry;
- ott_len = array_len(ott->parents);
- }
- } /* end of for loop */
-}
-
-static int
-range(char *s, int origin, int *mindays, int *maxdays)
-{
- char *s1;
- long strtol();
-
- switch (*s) {
- case '<':
- *mindays = 0;
- *maxdays = (int) strtol(s + 1, &s1, 10);
- break;
- case '>':
- *maxdays = MAXINT;
- *mindays = (int) strtol(s + 1, &s1, 10);
- break;
- default:
- *mindays = (int) strtol(s, &s1, 10);
- if (s1 == s)
- return FAIL;
- if (*s1 == '-')
- *maxdays = (int) strtol(s1 + 1, &s1, 10);
- else if (*s1 == '.' && s1[1] == '.')
- *maxdays = (int) strtol(s1 + 2, &s1, 10);
- else
- *maxdays = *mindays;
- break;
- }
- if (origin && *mindays == 1)
- *mindays = 0;
- if (*mindays < 0 || *maxdays < 0)
- return FAIL;
- return (*s1 == '\0') ? SUCCESS : FAIL;
-}
-
-static char *
-myregcmp(char *s)
-{
- register char *p;
- register char *q;
- register int len;
- static char special[] = "+.${}()";
- char *regcmp();
- char *strnsave();
- char *_backslash();
-
- len = strlen(s) * 2 + 4;
- p = strnsave("^", len);
- (void) strcat(p, s);
- (void) _backslash(p, len, special, special);
- (void) strcat(p, "$");
- for (q = p; *q; q++)
- switch (*q) {
- case '*':
- memshift(q + 1, q, strlen(q) + 1);
- *q++ = '.';
- break;
- case '?':
- *q = '.';
- break;
- case '\\':
- if (!*++q)
- q--;
- break;
- case '[':
- if (q[1] == '!')
- q[1] = '^';
- break;
- default:
- break;
- }
- q = regcmp(p, NULL);
- free(p);
- return q;
-}
diff --git a/usr/src/cmd/fmli/sys/getaltenv.c b/usr/src/cmd/fmli/sys/getaltenv.c
deleted file mode 100644
index fad5a2df59..0000000000
--- a/usr/src/cmd/fmli/sys/getaltenv.c
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-
-/*
- * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-/* Copyright (c) 1984, 1985, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-#include <stdio.h>
-#include <string.h>
-#include "wish.h"
-#include "var_arrays.h"
-
-char **Altenv = NULL;
-char *getaltenv();
-
-/* LES: replace with MACRO
-char *
-getAltenv(name)
-char *name;
-{
- return(getaltenv(Altenv, name));
-}
-*/
-
-char *
-getaltenv(the_env, name)
-char **the_env;
-char *name;
-{
- int i;
-
- if (the_env && ((i = findaltenv(the_env, name)) != FAIL))
- return(strchr(the_env[i], '=') + 1);
- return(NULL);
-}
-
-int
-findaltenv(the_env, name)
-char **the_env;
-char *name;
-{
- int i, len;
- int lcv;
-
- len = strlen(name);
- lcv = array_len(the_env);
- for (i = 0; i < lcv; i++)
- if ((strncmp(name, the_env[i], len) == 0) && (the_env[i][len] == '='))
- return(i);
- return(FAIL);
-}
diff --git a/usr/src/cmd/fmli/sys/getepenv.c b/usr/src/cmd/fmli/sys/getepenv.c
deleted file mode 100644
index 66bb398a6c..0000000000
--- a/usr/src/cmd/fmli/sys/getepenv.c
+++ /dev/null
@@ -1,97 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-/*
- * Copyright (c) 1985 AT&T
- * All Rights Reserved
- */
-#ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.4 */
-
-#include <stdio.h>
-#include "wish.h"
-#include "moremacros.h"
-#include "sizes.h"
-
-/*
- * getepenv looks for name=value in environment and in $HOME/pref/.environ
- * If not present, return NULL.
- */
-char *
-getepenv(name)
-char *name;
-{
- char path[PATHSIZ];
- register char *ptr;
- extern char *Home;
- char *anyenv();
- char *getenv();
-
- if ((ptr = getAltenv(name)) || (ptr = getenv(name)))
- return strsave(ptr);
- strcpy(path, Home);
- strcat(path, "/pref/.environ");
- return anyenv(path, name);
-}
-
-/*
- * anyenv lloks in path for name=value and returns value
- * value is backslash processed and expanded before it is returned
- */
-char *
-anyenv(path, name)
-char *path;
-char *name;
-{
- char buf[BUFSIZ];
- char fpbuf[BUFSIZ];
- register char *ptr;
- register int c;
- register FILE *fp;
- char *fgets();
- char *expand();
- char *unbackslash();
-
- if ((fp = fopen(path, "r")) == NULL)
- return NULL;
- setbuf(fp, fpbuf);
- /* for (each line of .environ file) */
- for (c = !EOF; c != EOF; ) {
- ptr = name;
- while (*ptr && (c = getc(fp)) == *ptr)
- ptr++;
- /* if ("name=" found) get rest of line */
- if (*ptr == '\0' && (c = getc(fp)) == '=' && fgets(buf, sizeof(buf), fp)) {
- if (buf[c = strlen(buf) - 1] == '\n')
- buf[c] = '\0';
- fclose(fp);
- return expand(unbackslash(buf));
- }
- /* skip rest of line */
- while (c != EOF && c != '\n')
- c = getc(fp);
- }
- fclose(fp);
- return NULL;
-}
diff --git a/usr/src/cmd/fmli/sys/grep.c b/usr/src/cmd/fmli/sys/grep.c
deleted file mode 100644
index a8bd547820..0000000000
--- a/usr/src/cmd/fmli/sys/grep.c
+++ /dev/null
@@ -1,380 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/*
- * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-/*
- * fmlgrep -- print lines matching (or not matching) a pattern
- *
- * status returns:
- * TRUE - ok, and some matches
- * FALSE - no matches or error
- */
-
-#include <stdio.h>
-#include <ctype.h>
-#include "wish.h"
-#include "ctl.h"
-#include "eval.h"
-#include "moremacros.h"
-#include "message.h"
-
-/*
- * define some macros for rexexp.h
- */
-
-char errstr[][64] = {
- "Range endpoint too large." ,
- "Bad number." ,
- "``\\digit'' out of range." ,
- "Illegal or missing delimiter." ,
- "No remembered search string." ,
- "\\( \\) imbalance." ,
- "Too many \\(." ,
- "More than 2 numbers given in \\{ \\}." ,
- "} expected after \\." ,
- "First number exceeds second in \\{ \\}." ,
- "[ ] imbalance." ,
- "Regular expression overflow." ,
- "Unknown regexp error code!!" ,
- NULL
-};
-
-/*
- * Macros for FMLI i/o and FMLI error messages (rjk)
- */
-static char tmpbuf[BUFSIZ]; /* for formatting purposes */
-
-#define PRINTF(x, y) { \
- sprintf(tmpbuf, x, y); \
- putastr(tmpbuf, Outstr); \
- }
-
-#define errmsg(msg, arg) { \
- sprintf(tmpbuf, msg, arg); \
- mess_temp(tmpbuf); \
- }
-#define ESIZE 256
-#define BLKSIZE 512
-
-static void execute();
-static int succeed();
-static int fgetl();
-
-char *strrchr();
-
-static FILE *temp;
-static long lnum;
-static char linebuf[BUFSIZ];
-char prntbuf[BUFSIZ];
-static char expbuf[ESIZE];
-static int nflag;
-static int bflag;
-static int lflag;
-static int cflag;
-static int vflag;
-static int sflag;
-static int iflag;
-static int errflg;
-static int nfile;
-static long tln;
-static int nsucc;
-static int nchars;
-static int nlflag;
-
-static IOSTRUCT *Instr;
-static IOSTRUCT *Outstr;
-
-int
-cmd_grep(argc, argv, instr, outstr, errstr)
-int argc;
-char *argv[];
-IOSTRUCT *instr;
-IOSTRUCT *outstr;
-IOSTRUCT *errstr;
-{
- int c;
- char *arg;
- extern int optind;
- void regerr();
-
- prntbuf[0] = expbuf[0] = linebuf[0] = '\0';
- nflag = bflag = lflag = cflag = vflag = nchars = 0;
- sflag = iflag = errflg = nfile = nsucc = 0;
- lnum = tln = 0;
- optind = 1;
-
- while((c=getopt(argc, argv, "blcnsvi")) != EOF)
- switch(c) {
- case 'v':
- vflag++;
- break;
- case 'c':
- cflag++;
- break;
- case 'n':
- nflag++;
- break;
- case 'b':
- bflag++;
- break;
- case 's':
- sflag++;
- break;
- case 'l':
- lflag++;
- break;
- case 'i':
- iflag++;
- break;
- case '?':
- errflg++;
- }
-
- if(errflg || (optind >= argc)) {
- errmsg("Usage: fmlgrep -blcnsvi pattern file . . .\n",
- (char *)NULL);
- /* exit(2); */
- return(FAIL); /* rjk */
- }
- Instr = instr; /* rjk */
- Outstr = outstr; /* rjk */
-
- argv = &argv[optind];
- argc -= optind;
- nfile = argc - 1;
-
- if (strrchr(*argv,'\n')) {
- regerr(41);
- return(FAIL); /* rjk */
- }
-
- if (iflag) {
- for(arg = *argv; *arg != NULL; ++arg)
- *arg = (char)tolower((int)((unsigned char)*arg));
- }
-
- compile(*argv, expbuf, &expbuf[ESIZE], '\0', regerr);
-
- if (--argc == 0)
- execute(NULL);
- else
- while (argc-- > 0)
- execute(*++argv);
-
- /* exit(nsucc == 2 ? 2 : nsucc == 0); */
- return((nsucc == 2 || nsucc == 0) ? FAIL : SUCCESS);
-}
-
-static void
-execute(file)
-char *file;
-{
- char *lbuf;
- int i, fromfile;
- char *getastr(); /* rjk */
-
- fromfile = 0;
- if (file != NULL) { /* rjk */
- if ( (temp = fopen(file, "r")) == NULL) {
- if (!sflag)
- errmsg("fmlgrep: can't open %s\n", file);
- nsucc = 2;
- return;
- }
- fromfile++;
- }
-
- lnum = 0;
- tln = 0;
-
-
- /* rjk (from a file OR from Instr) */
- while(fromfile ? ((nchars = fgetl(prntbuf, BUFSIZ, temp)) != 0) :
- (getastr(prntbuf, BUFSIZ, Instr) && (nchars = strlen(prntbuf)) != 0)) {
- if(nchars == BUFSIZ - 1 && prntbuf[nchars-1] != '\n')
- continue;
-
- if(prntbuf[nchars-1] == '\n') {
- nlflag = 1;
- prntbuf[nchars-1] = '\0';
- } else
- nlflag = 0;
-
- lnum++;
-
- if (iflag) {
- for(i=0, lbuf=linebuf; i < nchars; i++, lbuf++)
- *lbuf = (char)tolower((int)(unsigned char)prntbuf[i]);
- *lbuf = '\0';
- lbuf = linebuf;
- } else
- lbuf = prntbuf;
-
- if((step(lbuf, expbuf) ^ vflag) && succeed(file) == 1)
- break; /* lflag only once */
- }
- if (fromfile) /* rjk */
- fclose(temp);
-
- if (cflag) {
- if (nfile>1)
- PRINTF("%s:", file);
- PRINTF("%ld\n", tln);
- }
- return;
-}
-
-static int
-succeed(f)
-char *f;
-{
- nsucc = (nsucc == 2) ? 2 : 1;
- if (cflag) {
- tln++;
- return(0);
- }
- if (lflag) {
- PRINTF("%s\n", f);
- return(1);
- }
-
- if (nfile > 1) /* print filename */
- PRINTF("%s:", f);
-
- if (bflag) /* print block number */
- PRINTF("%ld:", (ftell(temp)-1)/BLKSIZE);
-
- if (nflag) /* print line number */
- PRINTF("%ld:", lnum);
-
- if (nlflag)
- prntbuf[nchars-1] = '\n';
-
- /* fwrite(prntbuf, 1, nchars, stdout); old */
- PRINTF(prntbuf, NULL); /* rjk */
- return(0);
-}
-
-void
-regerr(err)
-int err;
-{
- errmsg("fmlgrep: RE error %d: ", err);
- switch(err) {
- case 11:
- err = 0;
- break;
- case 16:
- err = 1;
- break;
- case 25:
- err = 2;
- break;
- case 36:
- err = 3;
- break;
- case 41:
- err = 4;
- break;
- case 42:
- err = 5;
- break;
- case 43:
- err = 6;
- break;
- case 44:
- err = 7;
- break;
- case 45:
- err = 8;
- break;
- case 46:
- err = 9;
- break;
- case 49:
- err = 10;
- break;
- case 50:
- err = 11;
- break;
- default:
- err = 12;
- break;
- }
-
- errmsg("%s\n", errstr[err]);
- /* exit(2); */
-}
-
-/*
- * The following code is a modified version of the fgets() stdio
- * routine. The reason why it is used instead of fgets() is that
- * we need to know how many characters we read into the buffer.
- * Thus that value is returned here instead of the value of s1.
- */
-#define MIN(x, y) (x < y ? x : y)
-#define _BUFSYNC(iop) if ((long) _bufendtab[fileno(iop)] - (long) iop->_ptr < \
- ( iop->_cnt < 0 ? 0 : iop->_cnt ) ) \
- _bufsync(iop)
-
-extern int _filbuf();
-extern char *memccpy();
-
-static int
-fgetl(ptr, size, iop)
-char *ptr;
-int size;
-FILE *iop;
-{
- char *p, *ptr0 = ptr;
- int n;
-
- for (size--; size > 0; size -= n) {
- if (iop->_cnt <= 0) { /* empty buffer */
- if (_filbuf(iop) == EOF) {
- if (ptr0 == ptr)
- return (NULL);
- break; /* no more data */
- }
- iop->_ptr--;
- iop->_cnt++;
- }
- n = MIN(size, iop->_cnt);
- if ((p = memccpy(ptr, (char *) iop->_ptr, '\n', n)) != NULL)
- n = p - ptr;
- ptr += n;
- iop->_cnt -= n;
- iop->_ptr += n;
- _BUFSYNC(iop);
- if (p != NULL)
- break; /* found '\n' in buffer */
- }
- *ptr = '\0';
- return (ptr-ptr0);
-}
diff --git a/usr/src/cmd/fmli/sys/io.c b/usr/src/cmd/fmli/sys/io.c
deleted file mode 100644
index e093db6ba2..0000000000
--- a/usr/src/cmd/fmli/sys/io.c
+++ /dev/null
@@ -1,388 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/*
- * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-#include <stdio.h>
-#include <ctype.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include "wish.h"
-#include "eval.h"
-#include "terror.h"
-#include "moremacros.h"
-
-#define INCREMENT 1024
-
-
-/* only called once in evstr.c */
-int
-io_size(iop, size)
-IOSTRUCT *iop;
-int size;
-{
- /* ehr3 (not necessary given only call is in evstr.c)
- if (iop->mu.str.val)
- free(iop->mu.str.val);
- */
- if ((iop->mu.str.val = malloc(size)) == NULL)
- fatal(NOMEM, ""); /* abs k17 */
- return (0);
-}
-
-IOSTRUCT *
-io_open(flags, ptr, next)
-int flags;
-char *ptr;
-{
- register IOSTRUCT *iop;
-
- iop = (IOSTRUCT *)new(IOSTRUCT);
- iop->flags = flags;
- iop->next = NULL;
- iop->mu.str.val = NULL; /* ehr3 */
-
- if (flags & EV_USE_FP)
- iop->mu.fp = (FILE *) ptr;
- else {
- iop->mu.str.pos = 0;
-
- if (ptr && *ptr) {
- iop->mu.str.count = strlen(ptr);
-
- if (flags & EV_READONLY)
- iop->mu.str.val = ptr;
- else
- iop->mu.str.val = strnsave(ptr, iop->mu.str.count + INCREMENT - 1 & ~(INCREMENT - 1));
- }
- else {
- iop->mu.str.val = NULL;
- iop->mu.str.count = 0;
- }
- }
- return iop;
-}
-
-int
-io_clear(iop)
-IOSTRUCT *iop;
-{
- if (!(iop->flags & EV_USE_STRING))
- return FAIL;
- iop->mu.str.pos = iop->mu.str.count = 0;
- return SUCCESS;
-}
-
-int
-io_seek(iop, pos)
-IOSTRUCT *iop;
-unsigned pos;
-{
- if (iop->flags & EV_USE_STRING)
- if (pos <= iop->mu.str.count)
- iop->mu.str.pos = pos;
- else
- return FAIL;
- else
- return fseek(iop->mu.fp, (long) pos, 0);
- return SUCCESS;
-}
-
-/*
- * CAVEAT: This routine is DESTRUCTIVE for fp's, but NOT for strings!
- */
-char *
-io_string(iop)
-IOSTRUCT *iop;
-{
- if (iop->flags & EV_USE_STRING) {
- if (iop->mu.str.val)
- return(strnsave(iop->mu.str.val, iop->mu.str.pos));
- else
- return(strsave(nil));
- }
- else {
- register char *buf;
- register int fd;
- register int size;
- struct stat sbuf;
- long lseek();
-
- fd = fileno(iop->mu.fp);
-
- if (fstat(fd, &sbuf) == 0) {
- size = (int) (sbuf.st_size - lseek(fd, 0L, 1));
-
- if (buf = malloc(size + 1)) {
- buf[read(fileno(iop->mu.fp), buf, size)] = '\0';
- return buf;
- }
- }
-
- return NULL;
- }
-}
-
-/*
- * be careful not to modify this string!
- * (unless, of course, you are going to io_seek to 0 right afterward)
- */
-char *
-io_ret_string(iop)
-IOSTRUCT *iop;
-{
- if (iop->flags & EV_USE_STRING) {
- putac('\0', iop);
- iop->mu.str.count--;
- iop->mu.str.pos--;
- return iop->mu.str.val;
- }
- else
- /* not supported until we need it */
- return nil;
-}
-
-int
-io_close(iop)
-IOSTRUCT *iop;
-{
- if (iop->flags & EV_USE_FP)
- fclose(iop->mu.fp);
- else {
- if (!(iop->flags & EV_READONLY) && iop->mu.str.val) {
- free(iop->mu.str.val);
- iop->mu.str.val = NULL; /* ehr3 */
- }
- }
- free(iop);
- return SUCCESS;
-}
-
-int
-getac(iop)
-IOSTRUCT *iop;
-{
- IOSTRUCT *io_pop();
-
- if (iop->flags & EV_USE_STRING) {
- if (iop->mu.str.pos < iop->mu.str.count)
- return iop->mu.str.val[iop->mu.str.pos++];
- }
- else {
- register int c;
-
- if ((c = getc(iop->mu.fp)) != EOF)
- return c;
- }
- if (io_pop(iop))
- return getac(iop);
- return '\0';
-}
-
-int
-ungetac(c, iop)
-int c;
-IOSTRUCT *iop;
-{
- if (iop->flags & EV_USE_STRING) {
- if (--iop->mu.str.pos < 0)
- ++iop->mu.str.pos;
- }
- else
- ungetc(c, iop->mu.fp);
- return c;
-}
-
-int
-putac(c, iop)
-int c;
-IOSTRUCT *iop;
-{
- if (iop->flags & EV_USE_STRING)
- {
- if ( !iop->mu.str.val )
- {
- if ((iop->mu.str.val = malloc(INCREMENT)) == NULL)
- fatal(NOMEM, ""); /* abs k17 */
- }
- else /* changed else clause to match putastr. abs k17 */
- {
- int oldinc, newinc;
-
- oldinc = iop->mu.str.pos / INCREMENT;
- newinc = (iop->mu.str.pos + 1) / INCREMENT;
- if (newinc > oldinc)
- {
- /*
- * reallocate (needed blocks * BLOCKSIZE)
- */
- if ((iop->mu.str.val = realloc(iop->mu.str.val,
- (++newinc) * INCREMENT)) == NULL)
- fatal(NOMEM, "");
- }
- }
-/* if (!(iop->mu.str.pos & INCREMENT - 1) && iop->mu.str.pos)
-** iop->mu.str.val =
-** realloc(iop->mu.str.val, iop->mu.str.pos + INCREMENT);
-** abs k17
-*/
- iop->mu.str.val[iop->mu.str.pos++] = c;
- iop->mu.str.count = iop->mu.str.pos;
- }
- else
- putc(c, iop->mu.fp);
- return c;
-}
-
-int
-unputac(iop)
-IOSTRUCT *iop;
-{
- register int c;
-
- if (!(iop->flags & EV_USE_STRING) || iop->mu.str.pos == 0)
- return 0;
- if (iop->mu.str.pos == iop->mu.str.count)
- --iop->mu.str.count;
- return iop->mu.str.val[--iop->mu.str.pos];
-}
-
-IOSTRUCT *
-io_push(stack, iop)
-IOSTRUCT *stack;
-IOSTRUCT *iop;
-{
- IOSTRUCT tmp;
-
- tmp = *iop;
- *iop = *stack;
- *stack = tmp;
- stack->next = iop;
- return stack;
-}
-
-IOSTRUCT *
-io_pop(stack)
-IOSTRUCT *stack;
-{
- IOSTRUCT *ptr;
- IOSTRUCT tmp;
-
- if ((ptr = stack->next) == NULL)
- return NULL;
-
- tmp = *ptr;
- *ptr = *stack;
- *stack = tmp;
- io_close(ptr);
- return stack;
-}
-
-int
-io_flags(iop, flags)
-IOSTRUCT *iop;
-int flags;
-{
- int tmp;
-
- tmp = iop->flags;
- iop->flags = flags;
- return tmp;
-}
-
-char *
-getastr(s, n, iop)
-char *s;
-int n;
-IOSTRUCT *iop;
-{
- register char *p;
- register int c;
-
- for (p = s; n > 1; p++) {
- if (c = getac(iop)) {
- *s++ = c;
- if (c == '\n')
- break;
- }
- else
- break;
- }
- if (n > 0)
- *s = '\0';
- return (p == s) ? NULL : s;
-}
-
-int
-putastr(s, iop)
-char *s;
-IOSTRUCT *iop;
-{
- if (iop->flags & EV_USE_STRING)
- {
- register int len, c;
- register int newinc, oldinc;
- int strlen();
- char *strcpy();
-
- len = strlen(s);
- if (!iop->mu.str.val)
- {
- c = (len / INCREMENT) + 1;
- if ((iop->mu.str.val = malloc(INCREMENT * c)) == NULL)
- fatal(NOMEM, ""); /* abs k17 */
- iop->mu.str.pos = 0;
- }
- else
- {
- oldinc = iop->mu.str.pos / INCREMENT;
- newinc = (iop->mu.str.pos + len) / INCREMENT;
- if (newinc > oldinc)
- {
- /*
- * reallocate (needed blocks * BLOCKSIZE)
- */
- if ((iop->mu.str.val = realloc(iop->mu.str.val,
- (++newinc) * INCREMENT)) == NULL)
- fatal(NOMEM, "");
- }
- }
- strcpy(iop->mu.str.val + iop->mu.str.pos, s);
- iop->mu.str.count = iop->mu.str.pos += len;
- }
- else
- fputs(s, iop->mu.fp);
-
- /*
- * original body of putastr
- * while (*s)
- * putac(*s++, iop);
- */
- return (0);
-}
diff --git a/usr/src/cmd/fmli/sys/itoa.c b/usr/src/cmd/fmli/sys/itoa.c
deleted file mode 100644
index 5adabe09e1..0000000000
--- a/usr/src/cmd/fmli/sys/itoa.c
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/*
- * Copyright 1992 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-char *
-itoa(n, base)
-long n; /* abs k16 */
-int base;
-{
- register char *p;
- register int minus;
- static char buf[36];
-
- p = &buf[36];
- *--p = '\0';
- if (n < 0) {
- minus = 1;
- n = -n;
- }
- else
- minus = 0;
- if (n == 0)
- *--p = '0';
- else
- while (n > 0) {
- *--p = "0123456789abcdef"[n % base];
- n /= base;
- }
- if (minus)
- *--p = '-';
- return p;
-}
diff --git a/usr/src/cmd/fmli/sys/memshift.c b/usr/src/cmd/fmli/sys/memshift.c
deleted file mode 100644
index 1beaec7838..0000000000
--- a/usr/src/cmd/fmli/sys/memshift.c
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-/*
- * Copyright (c) 1986 AT&T
- * All Rights Reserved
- */
-#ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.1 */
-
-#include <stdio.h>
-#include "wish.h"
-
-char *
-memshift(dst, src, len)
-char *dst;
-char *src;
-int len;
-{
- register char *d;
- register char *s;
- register int n;
- extern char *memcpy();
-
- if (dst < src)
- if (dst + len <= src)
- memcpy(dst, src, len);
- else
- for (s = src, d = dst, n = len; n > 0; n--)
- *d++ = *s++;
- else
- if (src + len <= dst)
- return memcpy(dst, src, len);
- else
- for (n = len, s = src + n, d = dst + n; n > 0; n--)
- *--d = *--s;
- return dst;
-}
diff --git a/usr/src/cmd/fmli/sys/mencmds.c b/usr/src/cmd/fmli/sys/mencmds.c
deleted file mode 100644
index fc13443917..0000000000
--- a/usr/src/cmd/fmli/sys/mencmds.c
+++ /dev/null
@@ -1,787 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-
-/*
- * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-/* Copyright (c) 1984, 1985, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-#include <stdio.h>
-#include <ctype.h>
-#include <string.h>
-#include <sys/types.h> /* EFT abs k16 */
-#include "typetab.h"
-#include "wish.h"
-#include "terror.h"
-#include "procdefs.h"
-#include "eval.h"
-#include "ctl.h"
-#include "moremacros.h"
-#include "message.h"
-#include "sizes.h"
-
-
-/*
- * Globals used in eval() ...
- */
-extern int EV_retcode;
-extern int EV_backquotes;
-extern int Lasttok;
-extern int Vflag;
-
-int
-cmd_setodi(argc, argv, instr, outstr, errstr)
-int argc;
-char *argv[];
-IOSTRUCT *instr;
-IOSTRUCT *outstr;
-IOSTRUCT *errstr;
-{
- char *path;
- char *key;
- char *value;
- struct ott_entry *ott;
- struct ott_entry *path_to_ott();
-
- switch (argc) {
- case 1:
- case 2:
- mess_temp("setodi: not enough arguments");
- return(FAIL);
- case 3:
- path = argv[1];
- key = argv[2];
- value = io_string(instr);
- break;
- default:
- mess_temp("setodi: extra args ignored");
- case 4:
- path = argv[1];
- key = argv[2];
- value = strsave(argv[3]);
- break;
- }
-
- if ((ott = path_to_ott(path)) != NULL) {
- ott_lock_dsk(path);
- odi_putkey(ott, key, value);
- ott_dirty();
- ott_synch(FALSE);
- }
- if (value)
- free(value);
- return(SUCCESS);
-}
-
-int
-cmd_getodi(argc, argv, instr, outstr, errstr)
-int argc;
-char *argv[];
-IOSTRUCT *instr;
-IOSTRUCT *outstr;
-IOSTRUCT *errstr;
-{
- char *path;
- char *key;
- char *value;
- struct ott_entry *ott;
- struct ott_entry *path_to_ott();
- char *odi_getkey();
-
- switch (argc) {
- case 1:
- case 2:
- mess_temp("putodi: not enough args");
- return(FAIL);
- default:
- mess_temp("putodi: extra args ignored");
- case 3:
- path = argv[1];
- key = argv[2];
- break;
- }
-
- if ((ott = path_to_ott(path)) == NULL)
- return(FAIL);
- if (value = odi_getkey(ott, key)) {
- putastr(value, outstr);
- return(SUCCESS);
- } else
- return(FAIL);
-}
-
-int
-cmd_run(argc, argv, instr, outstr, errstr)
-int argc;
-char *argv[];
-IOSTRUCT *instr;
-IOSTRUCT *outstr;
-IOSTRUCT *errstr;
-{
- register int i;
- int procflags = 0;
- char *title = NULL;
- bool silent = FALSE;
-
- for (i = 1; argv[i][0] == '-'; i++) {
- switch (argv[i][1]) {
- case 's':
- silent = TRUE;
- break;
- case 'n':
- procflags = PR_NOPROMPT;
- break;
- case 'e':
- procflags = PR_ERRPROMPT;
- break;
- case 't':
- title = &argv[i][2];
- break;
- default:
- break;
- }
- }
-
- if (silent)
- return waitspawn(spawnv(argv[i], argv + i));
- else
- return proc_openv(procflags, title, NULL, argv+i);
-}
-
-int
-cmd_unset(argc, argv, instr, outstr, errstr)
-int argc;
-char *argv[];
-IOSTRUCT *instr;
-IOSTRUCT *outstr;
-IOSTRUCT *errstr;
-{
- register int i;
- char *var = NULL;
- char *file = NULL;
- char path[PATHSIZ];
- char whichenv;
- extern char *Home;
- char *strchr();
- char *io_string();
-
- whichenv = '\0';
- for (i = 1; argv[i]; i++) {
- if (argv[i][0] == '-') {
- switch (argv[i][1]) {
- case 'l':
- whichenv = argv[i][1];
- break;
- case 'f':
- file = argv[i] + 2;
- break;
- }
- }
- else {
- var = argv[i];
- if (whichenv == 'l')
- delAltenv(var);
- else {
- if (!file) {
- strcpy(path, Home);
- strcat(path, "/pref/.environ");
- file = path;
- }
- chgenv(file, var, NULL);
- }
- file = NULL;
- whichenv = '\0';
- }
- }
- return SUCCESS;
-}
-
-int
-cmd_set(argc, argv, instr, outstr, errstr)
-int argc;
-char *argv[];
-IOSTRUCT *instr;
-IOSTRUCT *outstr;
-IOSTRUCT *errstr;
-{
- register int i;
- char *val = NULL;
- char *var = NULL;
- char *file = NULL;
- char path[PATHSIZ];
- char buf[BUFSIZ];
- char whichenv;
- char *envbuf;
- extern char *Home;
- char *strchr();
- char *io_string();
- int dofree, amt, maxamt;
-
- whichenv = '\0';
- for (i = 1; argv[i]; i++) {
- if (argv[i][0] == '-') {
- switch (argv[i][1]) {
- case 'l':
- case 'e':
- whichenv = argv[i][1];
- break;
- case 'f':
- file = argv[i] + 2;
- break;
- }
- }
- else {
- dofree = 0;
- if (!(var = strchr(argv[i], '='))) {
- maxamt = BUFSIZ - strlen(argv[i]) - 2;
- val = io_string(instr);
- if ((amt = strlen(val)) > maxamt) {
- /*
- * Value is greater than 1K so malloc
- * enough space to hold it.
- */
- maxamt = amt + strlen(argv[i]) + 2;
- if ((envbuf = (char *) malloc(maxamt)) == NULL)
- fatal(NOMEM, nil);
- dofree++;
- }
- else {
- /*
- * ... otherwise, use static 1K buffer
- */
- envbuf = buf;
- }
- strcpy(envbuf, argv[i]);
- strcat(envbuf, "=");
- strncat(envbuf, val, maxamt);
- var = envbuf;
- free(val);
- val = &var[strlen(var) - 1];
- if (*val == '\n')
- *val = '\0';
- }
- else
- var = argv[i];
- if (whichenv == 'l')
- putAltenv(var);
- else if (whichenv == 'e')
- putenv(strsave(var));
- else {
- if (!file) {
- strcpy(path, Home);
- strcat(path, "/pref/.environ");
- file = path;
- }
- val = strchr(var, '=');
- *val++ = '\0';
- chgenv(file, var, val);
- }
- if (dofree) {
- free(envbuf);
- envbuf = NULL;
- }
- file = NULL;
- whichenv = '\0';
- }
- }
- return SUCCESS;
-}
-
-/* types of messages (temporary, permanent, frame permanent) */
-#define MTEMP 0x1
-#define MPERM 0x2
-#define MFRAME 0x4
-
-int
-cmd_message(argc, argv, instr, outstr, errstr)
-int argc;
-char *argv[];
-IOSTRUCT *instr;
-IOSTRUCT *outstr;
-IOSTRUCT *errstr;
-{
- char msg[MESSIZ];
- register char *amessage;
- register int i;
- register int messtype;
- bool output = FALSE;
- bool work = FALSE;
- bool bell = FALSE;
- bool dofree;
- int num;
- char *ptr;
- char *io_string();
-
- messtype = 0;
- amessage = NULL;
- msg[0] = msg[MESSIZ - 1] = '\0';
- for (i = 1; argv[i]; i++) {
- if (argv[i][0] == '-') {
- switch (argv[i][1]) {
- case 'p':
- messtype = MPERM;
- break;
- case 't':
- messtype = MTEMP;
- break;
- case 'f':
- messtype = MFRAME;
- break;
- case 'o':
- output = TRUE;
- break;
- case 'w':
- work = TRUE;
- break;
- case 'b':
- bell = TRUE;
- if((ptr=strpbrk(argv[i],"0123456789")) || (ptr=strpbrk(argv[i + 1],"0123456789"))) {
- num = atoi(ptr);
- i++;
- }
- else
- num=1;
- break;
- default:
- break;
- }
- } else {
- amessage = msg;
- strncat(msg, argv[i], MESSIZ - 1 - strlen(msg));
- strncat(msg, " ", MESSIZ - 1 - strlen(msg));
- }
- }
-
-
- if (amessage == NULL) {
- amessage = io_string(instr);
- dofree = TRUE;
- } else
- dofree = FALSE;
-
- if (messtype & MPERM) {
- mess_perm(amessage);
- mess_flash(amessage);
- }
- else if (messtype & MFRAME) {
- mess_frame(amessage);
- mess_flash(amessage);
- ar_ctl(ar_get_current(), CTSETMSG, TRUE, NULL, NULL, NULL, NULL, NULL);
- }
- else { /* temporary message assumed */
- mess_temp(amessage);
- mess_flash(amessage);
- }
- if (output)
- putastr(amessage, outstr);
- if (dofree)
- free(amessage);
- if (work)
- working(TRUE);
-/* les */
- else
- doupdate();
-
- if (bell) {
- for(i = num; i > 0; i--)
- beep();
- }
-/*
- flush_output();
-*/
- return SUCCESS;
-}
-
-int
-cmd_indicator(argc, argv, instr, outstr, errstr)
-int argc;
-char *argv[];
-IOSTRUCT *instr;
-IOSTRUCT *outstr;
-IOSTRUCT *errstr;
-{
- char msg[MESSIZ];
- register char *amessage;
- register int i, mescol, meslength;
- bool output = FALSE;
- bool work = FALSE;
- bool bell = FALSE;
- bool dofree;
- int num;
- char *ptr;
- char *io_string();
-
- mescol = 0;
- meslength = MESSIZ;
- amessage = NULL;
- msg[0] = msg[MESSIZ - 1] = '\0';
- for (i = 1; argv[i]; i++) {
- if (argv[i][0] == '-') {
- switch (argv[i][1]) {
- case 'c':
- mescol = atoi(argv[i + 1]);
- i++;
- break;
- case 'l':
- meslength = atoi(argv[i + 1]);
- i++;
- break;
- case 'o':
- output = TRUE;
- break;
- case 'w':
- work = TRUE;
- break;
- case 'b':
- bell = TRUE;
- if((ptr=strpbrk(argv[i],"0123456789")) || (ptr=strpbrk(argv[i + 1],"0123456789"))) {
- num = atoi(ptr);
- i++;
- }
- else
- num=1;
- break;
- default:
- break;
- }
- } else {
- amessage = msg;
- strncat(msg, argv[i], meslength - 1 - strlen(msg));
- strncat(msg, " ", meslength - 1 - strlen(msg));
- }
- }
-
-
- if (amessage == NULL) {
- amessage = io_string(instr);
- dofree = TRUE;
- } else
- dofree = FALSE;
-
- indicator(amessage, mescol);
-
- if (output)
- putastr(amessage, outstr);
- if (dofree)
- free(amessage);
- if (work)
- working(TRUE);
- else
- doupdate();
-
- if (bell) {
- for(i = num; i > 0; i--)
- beep();
- }
- return SUCCESS;
-}
-
-#define MAX_PATTERNS 32
-
-/*
- * Usage: regex [-v string] [-e] pattern [template] [pattern [template] ...]
- *
- * The first form takes a string and matches it against patterns until
- * there is a match. Patterns are regular expression as described in
- * regcmp(3X). When a match is found, the corresponding template is
- * returned in the output stream. Templates may be arbitrary strings,
- * but if the string $m0, $m1, ..., $m9 appear in the string, then they
- * will be expanded to the corresponding pattern that matched within
- * (...)$0 through (...)$9 parts of the pattern.
- * For example:
- * regex "0123456789" '.{2}(.{3})$0' 'hi $m0'
- * would return the string: 'hi 234'.
- * The default template is '$m0$m1$m2$m3$m4$m5$m6$m7$m8$m9'.
- *
- * The -v option causes string to be parsed instead of stdin
- *
- * The -e option causes the resulting template to be evaluated
- */
-int
-cmd_regex(argc, argv, instr, outstr, errstr)
-int argc;
-char *argv[];
-IOSTRUCT *instr;
-IOSTRUCT *outstr;
-IOSTRUCT *errstr;
-{
- IOSTRUCT *myoutstr, *tmpoutstr;
- register char *p;
- char *ptr, *value;
- char buf[BUFSIZ];
- char ret[10][BUFSIZ];
- char *pattern[MAX_PATTERNS];
- char *template[MAX_PATTERNS];
- static char deftemplate[] = "$m0$m1$m2$m3$m4$m5$m6$m7$m8$m9";
- register int i;
- register int j;
- register int numpatterns, execflag;
- register bool matches;
- char *regex();
- char *regcmp();
- char *getastr();
- int savecode, savetok, savequotes;
-
- value = NULL;
- execflag = FALSE;
- for (i = 1; argv[i][0] == '-'; i++) {
- switch (argv[i][1]) {
- case 'e': /* evaluate the matched template */
- execflag = TRUE;
- break;
- case 'v': /* from a variable */
- if (argv[1][2])
- value = &argv[1][2];
- else
- value = argv[++i];
- break;
- default:
- break;
- }
- }
- if (execflag) { /* generate an intermediate IO chanel */
- tmpoutstr = io_open(EV_USE_STRING, NULL);
- myoutstr = tmpoutstr;
- }
- else
- myoutstr = outstr; /* use the requested IO channel */
-
- numpatterns = 0;
- for ( ; i < argc; i += 2) {
- if ((pattern[numpatterns] = regcmp(argv[i], NULL)) == NULL)
- warn(MUNGED, "regex pattern");
- if (argv[i + 1])
- template[numpatterns++] = argv[i + 1];
- else
- template[numpatterns++] = deftemplate;
- }
- matches = FALSE;
- for ( ; ; ) {
- if (value)
- ptr = value;
- else if (getastr(buf, BUFSIZ, instr)) {
- ptr = buf;
- if (buf[i = strlen(buf) - 1] == '\n')
- buf[i] = '\0';
- }
- else
- break;
- for (i = 0; i < numpatterns; i++) {
- if (pattern[i] == NULL)
- continue;
- for (j = 0; j < 10; j++)
- ret[j][0] = '\0';
- if (regex(pattern[i], ptr, ret[0], ret[1], ret[2],
- ret[3], ret[4], ret[5], ret[6],
- ret[7], ret[8], ret[9])) {
- matches = TRUE;
- for (p = template[i]; *p; p++) {
- if (*p == '$' && p[1] == 'm' && isdigit(p[2])) {
- putastr(ret[p[2] - '0'], myoutstr);
- p += 2;
- }
- else
- putac(*p, myoutstr);
- }
- if (strcmp(template[i], deftemplate) != 0)
- putac('\n', myoutstr);
- break;
- }
- }
- if (value)
- break;
- }
- if (execflag == TRUE) { /* evaluate the matched template */
- /*
- * Save/restore globals used in eval() before/after
- * making a recursive call to eval() ... this SHOULD
- * change in the future and should not be necessary
- */
- savecode = EV_retcode;
- savequotes = EV_backquotes;
- savetok = Lasttok;
-
- io_seek(myoutstr, 0);
- while (eval(myoutstr, outstr, EV_TOKEN | EV_USE_STRING))
- putac(' ', outstr);
- io_close(myoutstr);
-
- EV_retcode = savecode;
- EV_backquotes = savequotes;
- Lasttok = savetok;
- }
- for (i = 0; i < numpatterns; i++)
- if (pattern[i])
- free(pattern[i]);
- return matches ? SUCCESS : FAIL;
-}
-
-
-int
-cmd_getlist(argc, argv, instr, outstr, errstr)
-int argc;
-char *argv[];
-IOSTRUCT *instr, *outstr, *errstr;
-{
- register int i, numitems, pending;
- struct actrec *cur_ar;
- register char *delimiter;
- char *itemptr;
-
- if (argc == 1)
- delimiter = "\n";
- else
- delimiter = argv[1];
-
- cur_ar = (struct actrec *) ar_get_current();
- if ((numitems = ar_ctl(cur_ar, CTGETSIZ, NULL, NULL, NULL, NULL, NULL, NULL)) == FAIL) {
- putac('\0', outstr);
- return(FAIL);
- }
- for (i = 0, pending = 0; i < numitems; i++) {
- ar_ctl(cur_ar, CTGETLIST, i, &itemptr, NULL, NULL, NULL, NULL);
- if (itemptr != NULL) {
- if (pending++)
- putastr(delimiter, outstr);
- putastr(itemptr, outstr);
- }
- }
- putac('\0', outstr);
- return(SUCCESS);
-}
-
-int
-cmd_pathconv(argc, argv, instr, outstr, errstr)
-int argc;
-char *argv[];
-IOSTRUCT *instr, *outstr, *errstr;
-{
- register char *p;
- register char *pre;
- register char *input;
- register int i;
- register int n;
- register int width;
- bool fullpath;
- bool show_max;
- bool freeit;
- char *io_string();
- char *path_to_full();
- char *path_to_title();
-
- fullpath = TRUE;
- freeit = FALSE;
- show_max = FALSE;
- pre = input = NULL;
- width = MAX_TITLE;
-
- for (i = 1; i < argc; i++) {
- if (argv[i][0] == '-') {
- switch (argv[i][1]) {
- case 'v':
- if (argv[i][2])
- input = argv[i] + 2;
- else if ((input = argv[++i]) == NULL) {
- error(MISSING, "arg to pathconv");
- i--;
- }
- break;
- case 'l':
- show_max = TRUE;
- break;
- case 'f':
- fullpath = TRUE;
- break;
- case 't':
- fullpath = FALSE;
- break;
- case 'n':
- if (argv[i][2])
- width = atoi(argv[i] + 2);
- else if ((width = atoi(argv[++i])) <= 0) {
- error(MISSING, "arg to pathconv");
- i--;
- width = MAX_TITLE;
- }
- break;
- default:
- error(MUNGED, "bad -arg to pathconv");
- break;
- }
- }
- else
- pre = argv[i];
- }
- if (!input) {
-
- /* io_string was returning the input with tabs and newlines
- and therefore input to path_to_full was not expanding the
- alias. The following two lines will truncate the white space
- and newlines from input. -- added 7/89 by njp. */
-
- n = strcspn( input = io_string(instr), " \t\n");
- input[n]= '\0';
- freeit = TRUE;
- }
- if (input && *input && *input != ' ')
- if (fullpath) {
- putastr(p = path_to_full(input), outstr);
- free(p);
- }
- else {
- if ( show_max )
- putastr(bsd_path_to_title(input, Vflag?42:width), outstr);
- else
- putastr(path_to_title(input, pre, Vflag?42:width), outstr);
- }
- if (freeit)
- free(input);
- return SUCCESS;
-}
-
-
-
-int
-cmd_setcolor(argc, argv, instr, outstr, errstr)
-int argc;
-char *argv[];
-IOSTRUCT *instr;
-IOSTRUCT *outstr;
-IOSTRUCT *errstr;
-{
- if (argc != 5)
- return(FAIL);
- if (setcolor(argv[1], atoi(argv[2]), atoi(argv[3]), atoi(argv[4]))) {
- putastr(argv[1], outstr);
- return(SUCCESS);
- }
- else {
- putastr("", outstr);
- return(FAIL);
- }
-}
diff --git a/usr/src/cmd/fmli/sys/nstrcat.c b/usr/src/cmd/fmli/sys/nstrcat.c
deleted file mode 100644
index f2fbb88deb..0000000000
--- a/usr/src/cmd/fmli/sys/nstrcat.c
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-/*
- * Copyright (c) 1986 AT&T
- * All Rights Reserved
- */
-
-/*
- * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-#include <stdarg.h>
-#include "sizes.h"
-
-/*
- * useful for creating strings for error messages
- */
-char *
-nstrcat(char *first, ...)
-{
- register char *p, *q;
- static char buf[MAX_WIDTH];
- va_list ap;
-
- q = buf;
- strncpy(q, first, sizeof(buf) - 1);
- q += strlen(q);
-
- va_start(ap, first);
- for (; q < &buf[sizeof(buf) - 1] && (p = va_arg(ap, char *)); q += strlen(q))
- strncpy(q, p, &buf[sizeof(buf) - 1] - q);
- va_end(ap);
- return buf;
-}
diff --git a/usr/src/cmd/fmli/sys/onexit.c b/usr/src/cmd/fmli/sys/onexit.c
deleted file mode 100644
index e7a98cc12a..0000000000
--- a/usr/src/cmd/fmli/sys/onexit.c
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-/*
- * Copyright (c) 1986 AT&T
- * All Rights Reserved
- */
-#ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.1 */
-
-#include <stdio.h>
-#include "wish.h"
-#include "var_arrays.h"
-
-extern int (**Onexit)();
-
-void
-onexit(func)
-int (*func)();
-{
- Onexit = (int (**)()) array_check_append(sizeof(int (*)()), (struct v_array *) Onexit, &func);
-}
diff --git a/usr/src/cmd/fmli/sys/parent.c b/usr/src/cmd/fmli/sys/parent.c
deleted file mode 100644
index 525ab2b7e1..0000000000
--- a/usr/src/cmd/fmli/sys/parent.c
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-/*
- * Copyright (c) 1985 AT&T
- * All Rights Reserved
- */
-#ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.2 */
-
-#include <stdio.h>
-#include "wish.h"
-#include "sizes.h"
-
-char *
-parent(path)
-register char *path;
-{
- register char *dst;
- register char *place;
- register bool slash;
- static char dirname[PATHSIZ];
-
- /* first, put a "well-behaved" path into dirname */
- place = NULL;
- slash = FALSE;
- for (dst = dirname; *path; path++)
- if (*path == '/')
- slash = TRUE;
- else {
- if (slash) {
- place = dst;
- *dst++ = '/';
- slash = FALSE;
- }
- *dst++ = *path;
- }
- if (dst == dirname) {
- place = dst;
- *dst++ = '/';
- }
- if (place == NULL) {
- dirname[0] = '.';
- dirname[1] = '\0';
- }
- else if (place == dirname)
- dirname[1] = '\0';
- else
- *place = '\0';
- return dirname;
-}
diff --git a/usr/src/cmd/fmli/sys/putaltenv.c b/usr/src/cmd/fmli/sys/putaltenv.c
deleted file mode 100644
index d26bf37cbb..0000000000
--- a/usr/src/cmd/fmli/sys/putaltenv.c
+++ /dev/null
@@ -1,137 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-/*
- * Copyright (c) 1985 AT&T
- * All Rights Reserved
- */
-#ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.5 */
-
-#include <stdio.h>
-#include <string.h>
-#include "wish.h"
-#include "var_arrays.h"
-#include "moremacros.h"
-
-void
-copyaltenv(an_env, another)
-char **an_env;
-register char ***another;
-{
- register int i;
- int lcv;
-
- lcv = array_len(an_env);
- for (i = 0; i < lcv; i++)
- putaltenv(another, an_env[i]);
-}
-
-/* LES: never called
-void
-dumpenv(fp, the_env)
-FILE *fp;
-register char **the_env;
-{
- int i;
- int lcv;
-
- lcv = array_len(the_env);
- for (i = 0; i < lcv; i++) {
- fputs(the_env[i], fp);
- putc('\n', fp);
- }
-}
-*/
-
-int
-delaltenv(the_env, name)
-register char ***the_env;
-char *name;
-{
- register int i;
-
- if ((i = findaltenv(*the_env, name)) != FAIL) {
- free((*the_env)[i]);
- *the_env = (char **) array_delete(*the_env, i);
- return SUCCESS;
- }
- return FAIL;
-}
-
-int
-putaltenv(the_env, str)
-register char ***the_env;
-char *str;
-{
- register int i;
- register char *p;
- char *hold;
-
- hold = strsave(str);
- if ((p = strchr(hold, '=')) == NULL) {
- if (hold) /* ehr3 */
- free(hold);
- return(FAIL);
- }
- *p = '\0';
- delaltenv(the_env, hold);
- if ((i = findaltenv(*the_env, hold)) != FAIL) {
- *p = '=';
- if ((*the_env)[i]) /* ehr3 */
- free((*the_env)[i]);
- (*the_env)[i] = hold;
- }
- else {
- *p = '=';
- var_append(char *, *the_env, &hold);
- }
- return SUCCESS;
-}
-
-/* versions to work on Altenv */
-
-extern char **Altenv;
-
-/* LES: replace with MACROS
-copyAltenv(an_env)
-char **an_env;
-{
- copyaltenv(an_env, &Altenv);
-}
-
-int
-delAltenv(name)
-char *name;
-{
- return(delaltenv(&Altenv, name));
-}
-
-int
-putAltenv(str)
-char *str;
-{
- return(putaltenv(&Altenv, str));
-}
-*/
diff --git a/usr/src/cmd/fmli/sys/readfile.c b/usr/src/cmd/fmli/sys/readfile.c
deleted file mode 100644
index 186ece3b08..0000000000
--- a/usr/src/cmd/fmli/sys/readfile.c
+++ /dev/null
@@ -1,97 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-/*
- * Copyright (c) 1985 AT&T
- * All Rights Reserved
- */
-#ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.2 */
-
-#include <stdio.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include "wish.h"
-#include "terror.h"
-
-#define PADNUM 20
-
-/*
- * read in the file
- */
-char *
-readfile(file, trans_nl)
-char *file;
-int trans_nl;
-{
- FILE *fp;
- register int retval, padding, ch;
- register char *tptr;
- char *text;
- unsigned int bufsize;
- struct stat statbuf;
-
- if (access(file, 0) < 0)
- return(NULL);
- if ((fp = fopen(file, "r")) == NULL || fstat(fileno(fp), &statbuf) < 0) {
- error(NOPEN, file);
- return(NULL);
- }
-
- if ((text = malloc(bufsize = statbuf.st_size + PADNUM + 1)) == NULL)
- fatal(NOMEM, NULL);
-
- padding = PADNUM;
- for (tptr = text; (ch = getc(fp)) != EOF; tptr++) {
- if ((*tptr = ch) == '\n' && trans_nl == TRUE) {
- *tptr = ' ';
- if (tptr == text)
- continue;
- switch(*(tptr - 1)) { /* check char before newline */
- case '.':
- case '?':
- case ':':
- case '!':
- /* add an extra blank */
- if (padding-- <= 0) {
- /* just in case */
- unsigned offset;
-
- offset = tptr - text;
- if ((text = realloc(text, bufsize += PADNUM)) == NULL)
- fatal(NOMEM, NULL);
- padding = PADNUM;
- tptr = text + offset;
- }
- *(++tptr) = ' ';
- break;
- default:
- ;
- }
- }
- }
- *tptr = '\0';
- fclose(fp);
- return(text);
-}
diff --git a/usr/src/cmd/fmli/sys/scrclean.c b/usr/src/cmd/fmli/sys/scrclean.c
deleted file mode 100644
index f1fd58ed14..0000000000
--- a/usr/src/cmd/fmli/sys/scrclean.c
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-
-/*
- * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-/* Copyright (c) 1984, 1985, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-#include <stdio.h>
-
-int
-screen_clean(void)
-{
- slk_clear();
- vt_close_all();
- copyright();
- vt_flush();
- endwin();
- putchar('\n');
- return (0);
-}
diff --git a/usr/src/cmd/fmli/sys/spawn.c b/usr/src/cmd/fmli/sys/spawn.c
deleted file mode 100644
index 743b6ccfd3..0000000000
--- a/usr/src/cmd/fmli/sys/spawn.c
+++ /dev/null
@@ -1,203 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-
-/*
- * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-/* Copyright (c) 1984, 1985, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-#include <stdio.h>
-#include <signal.h>
-#include <sys/types.h> /* abs k18 */
-#include <errno.h>
-#include <stdarg.h>
-#include "wish.h"
-#include "moremacros.h"
-#include "sizes.h"
-
-#define RETVALSIZE 50
-#define EXECERROR 1000
-
-static char *Retpath = NULL;
-extern pid_t Fmli_pid; /* EFT abs k16 */
-
-int set_ret_val();
-int error_exec();
-
-int
-spawnv(file, arglist)
-char *file;
-char *arglist[];
-{
- register pid_t pid; /* EFT abs k16 */
- register int fd;
-
- alarm(0);
- switch (pid = fork()) {
- case -1:
- fprintf(stderr, "Can't create another process\r\n");
- break;
- case 0:
- sigignore(SIGHUP); /* changed from signals .. */
- sigignore(SIGINT);
- sigignore(SIGQUIT); /* to sigignores and.. */
- sigignore(SIGUSR1);
- sigset(SIGTERM, SIG_DFL); /* sigset. abs */
- for (fd = 0; fd < _NFILE; fd++)
- close(fd);
- dup(dup(open("/dev/null", 2)));
- execvp(file, arglist);
- (void) error_exec(errno);
- _exit(127);
- default:
- break;
- }
- return pid;
-}
-
-int
-spawn(char *file, ...)
-{
- char *arglist[20];
- register char **p;
- va_list ap;
-
- va_start(ap, file);
- for (p = arglist; p < arglist + sizeof(arglist)/sizeof(*arglist); p++)
- if ((*p = va_arg(ap, char *)) == NULL)
- break;
- va_end(ap);
- return spawnv(file, arglist);
-}
-
-int
-sysspawn(s)
-char *s;
-{
- char *arglist[4];
-
- arglist[0] = "sh";
- arglist[1] = "-c";
- arglist[2] = s;
- arglist[3] = NULL;
- return spawnv("/bin/sh", arglist);
-}
-
-int
-waitspawn(pid) /* see also waitspn below! for comments */
-register pid_t pid; /* EFT abs k16 */
-{
- register pid_t waitcode; /* EFT abs k16 */
- int status;
-
- while ((waitcode = wait(&status)) != pid)
- if (waitcode == -1 && errno != EINTR)
- break;
- /* examine child status more carefully */
- waitcode = ((waitcode == -1) ? waitcode : status);
- return(set_ret_val(waitcode));
-}
-
-/*
- * SET_RET_VAL will return the exit value of the child
- * process given "status" (result of a "wait" system call).
- * It will also set the environment variable "RET" to
- * this exit value OR an "errno" string if an error is
- * encountered during exec).
- */
-int
-set_ret_val(status)
-int status;
-{
- char retval_str[RETVALSIZE];
- int retval;
-
- if (!Retpath) {
- char path[PATHSIZ];
-
- sprintf(path, "/tmp/fmlexec.%ld", Fmli_pid);
- Retpath = strsave(path);
- }
- if (access(Retpath, 0) == 0) {
- FILE *fp, *fopen();
-
- strcpy(retval_str, "RET=");
- if ((fp = fopen(Retpath, "r")) == NULL) {
- unlink(Retpath);
- strcat(retval_str, "1000"); /* "EXECERROR" */
- retval = EXECERROR; /* abs k13 */
- } else {
- (void) fgets(&retval_str[4], RETVALSIZE-5, fp);
- fclose(fp);
- unlink(Retpath);
- retval = atoi(&retval_str[4]); /* abs k13 */
- }
- } else {
- /*
- * if Retpath is not accessable and status is
- * non zero, query status to discover what
- * went wrong.
- */
- if ((status & 0377) != 0) {
- fprintf(stderr,
- "child terminated with signal %d",(status & 0177));
- if (status & 0200) {
- fprintf(stderr," and produced a corefile.\n");
- } else
- fprintf(stderr,"\n");
- }
- retval = ((status >> 8) &0377);
- sprintf(retval_str, "RET=%d", retval);
- }
- putAltenv(retval_str);
- return(retval);
-}
-
-/*
- * ERROR_EXEC will store "str" in a temporary file, typically
- * this string will correspond to the "errno" of a failed
- * exec attempt
- */
-int
-error_exec(val)
-int val;
-{
- FILE *fp, *fopen();
-
- if (!Retpath) {
- char path[PATHSIZ];
-
- sprintf(path, "/tmp/fmlexec.%ld", Fmli_pid);
- Retpath = strsave(path);
- }
- if ((fp = fopen(Retpath, "w")) == NULL)
- return(FAIL);
- fprintf(fp, "%d", EXECERROR + val);
- fclose(fp);
- return(SUCCESS);
-}
diff --git a/usr/src/cmd/fmli/sys/strCcmp.c b/usr/src/cmd/fmli/sys/strCcmp.c
deleted file mode 100644
index a951fd9af8..0000000000
--- a/usr/src/cmd/fmli/sys/strCcmp.c
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-/*
- * Copyright (c) 1985 AT&T
- * All Rights Reserved
- */
-#ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.1 */
-
-#include <stdio.h>
-#include <ctype.h>
-
-int
-strCcmp(s1, s2)
-char *s1;
-char *s2;
-{
- register int c1;
- register int c2;
-
- while ((c1 = *s1++) != 0 & (c2 = *s2++) != 0) {
- if (isupper(c1))
- c1 = tolower(c1);
- if (isupper(c2))
- c2 = tolower(c2);
- if (c1 != c2)
- break;
- }
- return c1 - c2;
-}
-
-int
-strnCcmp(s1, s2, n)
-char *s1;
-char *s2;
-int n;
-{
- register int c1 = '\0';
- register int c2 = '\0';
-
- while (n-- > 0 && (c1 = *s1++) != 0 & (c2 = *s2++) != 0) {
- if (isupper(c1))
- c1 = tolower(c1);
- if (isupper(c2))
- c2 = tolower(c2);
- if (c1 != c2)
- break;
- }
- return c1 - c2;
-}
diff --git a/usr/src/cmd/fmli/sys/strappend.c b/usr/src/cmd/fmli/sys/strappend.c
deleted file mode 100644
index 6bc7f96c76..0000000000
--- a/usr/src/cmd/fmli/sys/strappend.c
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-/*
- * Copyright (c) 1986 AT&T
- * All Rights Reserved
- */
-#ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.1 */
-
-#include <stdio.h>
-#include "wish.h"
-#include "var_arrays.h"
-
-/*
- * add string to the end of a var_array string
- */
-struct v_array *
-array_strappend(array, string)
-struct v_array array[];
-char *string;
-{
- register struct v_array *ptr;
-
- ptr = v_header(array_grow(array, strlen(string)));
- if (string != NULL)
- strcat(v_body(ptr), string);
- return v_body(ptr);
-}
-
-/*
- * do the same with a character
- */
-struct v_array *
-array_chappend(array, ch)
-struct v_array array[];
-char ch;
-{
- register char *cp;
- register struct v_array *ptr;
-
- ptr = v_header(array_grow(array, 1));
- cp = ((char *) v_body(ptr)) + strlen(v_body(ptr));
- *cp++ = ch;
- *cp = '\0';
- return v_body(ptr);
-}
diff --git a/usr/src/cmd/fmli/sys/stream.c b/usr/src/cmd/fmli/sys/stream.c
deleted file mode 100644
index dfa8156847..0000000000
--- a/usr/src/cmd/fmli/sys/stream.c
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-/*
- * Copyright (c) 1985 AT&T
- * All Rights Reserved
- */
-#ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.1 */
-
-#include <stdio.h>
-#include "wish.h"
-#include "token.h"
-
-token
-stream(t, s)
-register token t;
-register token (*s[])();
-{
- register int i;
-
- for (i = 0; s[i]; i++)
- if ((t = (*(s[i]))(t)) == TOK_NOP)
- break;
- return t;
-}
diff --git a/usr/src/cmd/fmli/sys/strsave.c b/usr/src/cmd/fmli/sys/strsave.c
deleted file mode 100644
index eac7bd0e47..0000000000
--- a/usr/src/cmd/fmli/sys/strsave.c
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-/*
- * Copyright (c) 1986 AT&T
- * All Rights Reserved
- */
-#ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.3 */
-
-#include <stdio.h>
-#include <string.h>
-#include "wish.h"
-
-/* les: changing to MACRO
-char *
-strsave(s)
-char s[];
-{
- char *strnsave();
-
- return s ? strnsave(s, strlen(s)) : NULL;
-}
-*/
-
-char *
-strnsave(s, len)
-char s[];
-unsigned int len;
-{
- register char *p;
-
- if ((p = malloc(len + 1)) == NULL)
- return NULL;
- strncpy(p, s, len);
- p[len] = '\0';
- return p;
-}
diff --git a/usr/src/cmd/fmli/sys/tempfiles.c b/usr/src/cmd/fmli/sys/tempfiles.c
deleted file mode 100644
index 2c7e1709e6..0000000000
--- a/usr/src/cmd/fmli/sys/tempfiles.c
+++ /dev/null
@@ -1,291 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-
-/*
- * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-/* Copyright (c) 1984, 1985, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <signal.h>
-#include <fcntl.h>
-#include <errno.h>
-#include <sys/types.h> /* abs k16 */
-#include "wish.h"
-#include "retcodes.h"
-#include "var_arrays.h"
-#include "terror.h"
-#include "moremacros.h"
-
-#define LCKPREFIX ".L"
-
-/*
- * globals used throughout the Telesystem
- */
-extern char **Remove;
-
-static void putdec(pid_t n, int fd);
-static int getdec(int fd);
-
-/*
- * make an entry in the Remove table and return its index
- */
-static int
-makentry(path)
-char path[];
-{
-
- if (path == NULL)
- return (-1);
- if (Remove == NULL)
- Remove = (char **)array_create(sizeof (char *), 10);
- Remove = (char **)array_append(Remove, &path);
- return (array_len(Remove) - 1);
-}
-
-/*
- * Remove an entry from the Remove table (presumably because
- * the file could not be created)
- */
-static void
-rmentry(ent)
-int ent;
-{
- register char *ptr;
-
- ptr = Remove[ent];
- Remove = (char **)array_delete(Remove, ent);
- free(ptr);
-}
-
-/*
- * create a lockfile and return success
- */
-bool
-lockfile(path)
-char path[];
-{
- register char *save;
- register int ent;
- register int fd;
- register bool success;
- char *prefix();
-
- if ((save = prefix(path, LCKPREFIX)) == NULL)
- fatal(NOMEM, path);
- if ((ent = makentry(save)) < 0) {
- free(save);
- return (FALSE);
- }
- /* assume we will be successful */
- success = TRUE;
- if ((fd = open(save, O_RDONLY)) >= 0) {
- register pid_t pid; /* EFT abs k16 */
-
- if ((pid = getdec(fd)) < 0 || (kill(pid, 0) && errno == ESRCH))
- unlink(save);
- else
- /*
- * if there's another process active, we won't be
- * (unless it's us)
- */
- if (pid == getpid()) {
- close(fd);
- return (TRUE);
- }
- else
- success = FALSE;
- close(fd);
- }
- errno = 0;
- /* if we still think we'll be successful, try it for real */
- if (success)
- success = ((fd = open(save, O_EXCL | O_CREAT | O_WRONLY,
- 0444)) >= 0);
- if (success) {
- chmod(save, 0444);
- putdec(getpid(), fd);
- close(fd);
- }
- else
- rmentry(ent);
- errno = 0; /* reset */
- return (success);
-}
-
-static void
-putdec(pid_t n, int fd)
-{
- char buf[16];
-
- sprintf(buf, "%d\n", n);
- write(fd, buf, strlen(buf));
-}
-
-static int
-getdec(int fd)
-{
- char buf[16];
- register int n;
- register pid_t pid; /* EFT abs k16 */
-
- n = read(fd, buf, sizeof (buf));
- if (n > 1 && buf[n - 1] == '\n' &&
- (pid = (pid_t)strtol(buf, (char **)NULL, 0)) > 1) /* EFT abs k16 */
- return (pid);
- else
- return (-1);
-}
-
-/*
- * Remove lockfile created by "lockfile()"
- */
-void
-unlock(path)
-char *path;
-{
- register char *save;
- register int n;
- char *prefix();
- int lcv;
-
- if ((save = prefix(path, LCKPREFIX)) == NULL)
- return;
- unlink(save);
- lcv = array_len(Remove);
- for (n = 0; n < lcv; n++)
- if (strcmp(save, Remove[n]) == 0) {
- rmentry(n);
- break;
- }
- free(save);
-}
-
-/*
- * eopen performs an fopen/fdopen with some good things added for temp files
- * If the mode starts with "t" the file will be unlinked immediately
- * after creation. If the mode starts with "T", the file will be
- * removed when the program exits - normally or from the receipt
- * of signal 1, 2, 3, or 15.
- * SIDE EFFECT: for temp files, calls "mkstemp(3)" on "path"
- */
-FILE *
-eopen(path, mode)
-char path[];
-char mode[];
-{
- register int ent;
- register FILE *fp;
- int tmpfd = -1;
-
- switch (mode[0]) {
- case 'T':
- case 't':
- if ((tmpfd = mkstemp(path)) == -1)
- return (NULL);
- (void) close(tmpfd);
- if ((ent = makentry(strsave(path))) < 0)
- return (NULL);
- fp = fopen(path, mode + 1);
- if (mode[0] == 't' && unlink(path) == 0)
- rmentry(ent);
- break;
- default:
- fp = fopen(path, mode);
- break;
- }
- return (fp);
-}
-
-/*
- * for compatibility's sake
- */
-void
-eclose(fp)
-FILE *fp;
-{
- fclose(fp);
-}
-
-/*
- * make a tempfile using "eopen()"
- * if the path is null, one is provided
- * if the mode starts with neither "t" nor "T"
- * it defaults to "t"
- */
-FILE *
-tempfile(path, mode)
-char path[];
-char mode[];
-{
- char newmode[8];
- char save[20]; /* based on length of string below */
-
- if (path == NULL) {
- path = save;
- strcpy(path, "/tmp/wishXXXXXX");
- }
- if (mode[0] != 't' && mode[0] != 'T') {
- newmode[0] = 't';
- strncpy(newmode + 1, mode, sizeof (mode) - 2);
- newmode[sizeof (mode) - 1] = '\0';
- mode = newmode;
- }
- return (eopen(path, mode));
-}
-
-char *
-prefx(path, prfx)
-char *path;
-char *prfx;
-{
- register int len;
- char *filename();
- register char *p, *q;
-
- p = filename(path);
- len = strlen(prfx);
- for (q = path + strlen(path) + len; q >= p; q--)
- *q = *(q - len);
- strncpy(p, prfx, len);
- return (path);
-}
-char *
-prefix(path, prfx)
-char *path;
-char *prfx;
-{
- register char *ret;
-
- if ((ret = malloc(strlen(path) + strlen(prfx) + 1)) != NULL) {
- strcpy(ret, path);
- return (prefx(ret, prfx));
- }
- return (ret);
-}
diff --git a/usr/src/cmd/fmli/sys/terrmess.c b/usr/src/cmd/fmli/sys/terrmess.c
deleted file mode 100644
index 1c4d503449..0000000000
--- a/usr/src/cmd/fmli/sys/terrmess.c
+++ /dev/null
@@ -1,117 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-/*
- * Copyright (c) 1986 AT&T
- * All Rights Reserved
- */
-#ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.2 */
-
-#include <stdio.h>
-#include "wish.h"
-#include "terror.h"
-
-/*
- * NOTE: these error messages depend upon the order of error numbers in
- * errno. When that changes, so must this array and the list of defines
- * in terror.h
- */
-char *Errlist[] = {
- nil,
- "Permissions are wrong",
- "File does not exist",
- nil,
- nil,
- "Hardware error",
- nil,
- "Arguments are too long",
- "File has been corrupted",
- "Software error",
- nil,
- "Can't create another process",
- "Out of memory",
- "Permissions are wrong",
- nil,
- nil,
- nil,
- "File already exists",
- nil,
- nil,
- "Improper name",
- "It is a directory",
- nil,
- "Too many files in use on system",
- "Too many files in use by program",
- nil,
- nil,
- nil,
- "System out of disk space",
- nil,
- nil,
- nil,
- nil,
- nil,
- nil,
- nil,
- nil,
-};
-
-/*
- * NOTE: this array depends on the numbering scheme in terror.h
- * If you add an element to this array, add it at the end and change
- * terror.h to define the new value. Also, don't forget to change
- * TS_NERRS and add a line to Use_errno.
- */
-char *What[TS_NERRS] = {
- nil,
- "Can't open file",
- "Invalid arguments",
- "Data has been corrupted",
- "Some necessary information is missing",
- "Software failure error",
- "Can't execute the program",
- "Can't create or remove file",
- "Input is not valid",
- "Frame not updated: definition file missing or not readable",
- "Can't open frame: definition file missing or not readable"
-};
-
-/*
- * This array indicates whether or not errno may be considered
- * valid when this type of error occurs
- */
-bool Use_errno[TS_NERRS] = {
- FALSE,
- TRUE,
- FALSE,
- FALSE,
- FALSE,
- TRUE,
- TRUE,
- TRUE,
- FALSE,
- FALSE,
- FALSE
-};
diff --git a/usr/src/cmd/fmli/sys/terror.c b/usr/src/cmd/fmli/sys/terror.c
deleted file mode 100644
index 4eabc28523..0000000000
--- a/usr/src/cmd/fmli/sys/terror.c
+++ /dev/null
@@ -1,170 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-
-/*
- * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-/*
- * Copyright (c) 1986 AT&T
- * All Rights Reserved
- */
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <errno.h>
-#include <sys/types.h>
-#include "wish.h"
-#include "message.h"
-#include "vtdefs.h"
-#include "terror.h"
-#include "retcodes.h"
-#include "sizes.h"
-
-extern char *Errlist[];
-extern char *What[];
-extern int Vflag;
-extern void exit(); /* fmli's exit not the C lib call */
-static void log();
-static void notify();
-
-void
-_terror(sev, what, name, file, line, child)
-int sev; /* flags to see if we should log or exit */
-int what; /* What we were trying to do */
-char *name; /* What we were trying to do it to */
-char *file; /* __FILE__ */
-int line; /* __LINE__ */
-bool child; /* TRUE if called by a child of fmli. abs k15 */
-{
- if (errno == ENOTTY)
- errno = 0;
- notify(what, child); /* abs k15 */
- if (Vflag && (sev & TERR_LOG))
- log(sev, what, name, file, line);
- if (sev & TERR_EXIT)
- exit(R_ERR); /* fmli's exit not the C lib call */
- errno = 0;
-}
-
-static void
-notify(what, child)
-int what;
-bool child; /* TRUE if called by a child of fmli. abs k15 */
-{
- register char *mymess;
- register int length;
- char messbuf[PATHSIZ];
- extern bool Use_errno[];
- char *push_win();
-
- if ((mymess = What[what]) == nil &&
- (Use_errno[what] == FALSE || Errlist[errno] == nil))
- return;
- if (mymess == nil)
- mymess = "error";
-
- strncpy(messbuf, mymess, PATHSIZ - 1);
- length = strlen(messbuf);
- if (Use_errno[what] && Errlist[errno] != nil) {
- strncat(messbuf, ": ", PATHSIZ - 1 - length);
- length += 2;
- strncat(messbuf, Errlist[errno], PATHSIZ - 1 - length);
- }
- /* to ensure '\0' termination of string */
- messbuf[PATHSIZ -1] = '\0';
-
- /* if message generated by a child of fmli, print it on line
- * following cursor. if generated by fmli then use message line
- */
- if (child == TRUE) /* abs k15 */
- {
- printf("\r\n%s\r\n", messbuf); /* abs k15 */
- fflush(stdout); /* abs k15 */
- }
- else
- {
- mess_temp(messbuf);
- mess_flash(messbuf); /* abs f15 */
- doupdate(); /* abs f15 */
- }
-}
-
-#define LOGFILE 0
-#define TERMINAL 1
-#define MAILADM 2
-
-/*
- * FACE application ONLY .... log problems in the TERRLOG file
- * and/or send mail
- */
-static void
-log(sev, what, name, file, line)
-int sev;
-int what;
-char *name;
-char *file;
-int line;
-{
- char path[PATHSIZ];
- register int method;
- time_t t; /* EFT abs k16 */
- register FILE *fp;
- extern char *Oasys;
- extern char *Progname;
-
- /*
- * construct path of error log file
- */
- method = LOGFILE;
- if (name == NULL)
- name = nil;
- strcat(strcpy(path, Oasys), TERRLOG);
- if ((fp = fopen(path, "a")) == NULL && errno == EMFILE) {
- close(4);
- fp = fopen(path, "a");
- }
- if (fp == NULL)
- if ((fp = popen("mail $LOGNAME", "w")) == NULL) {
- method = TERMINAL;
- fp = stderr;
- }
- else
- method = MAILADM;
- (void) time(&t);
- setbuf(fp, NULL);
- fprintf(fp, "%16.16s %-8s %-14s %-14s %3d %s%-*s %-24s %s\n", ctime(&t),
- getenv("LOGNAME"), Progname, file, line,
- (sev & TERR_EXIT) ? "(FATAL)" : nil,
- (sev & TERR_EXIT) ? 17 : 24,
- What[what], strerror(errno), name);
- if (method == LOGFILE)
- fclose(fp);
- else if (method == MAILADM)
- pclose(fp);
-}
diff --git a/usr/src/cmd/fmli/sys/test.c b/usr/src/cmd/fmli/sys/test.c
deleted file mode 100644
index 1cc1801d74..0000000000
--- a/usr/src/cmd/fmli/sys/test.c
+++ /dev/null
@@ -1,304 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-
-/*
- * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-#include <sys/types.h> /* EFT abs k16 */
-#include "test.h"
-#undef BUFSIZ
-#include <stdio.h>
-#include "wish.h"
-#include <sys/stat.h>
-
-#define prs(a) putastr(a, out)
-
-#define failed(a, b) mess_temp(b)
-
-typedef struct io_struct {
- int flags;
- union {
- FILE *fp;
- struct {
- char *val;
- int count;
- int pos;
- } str;
- } mu;
- struct io_struct *next;
-} IOSTRUCT;
-
-int ap, ac;
-char **av;
-
-int
-cmd_test(argn, com, in, out, err)
-char *com[];
-int argn;
-IOSTRUCT *in;
-IOSTRUCT *out;
-IOSTRUCT *err;
-{
- ac = argn;
- av = com;
- ap = 1;
-
- if (eq(com[0],"["))
- {
- if (!eq(com[--ac], "]"))
- failed("test", "] missing");
- }
-
- com[ac] = 0;
-
- if (ac <= 1)
- return(FAIL);
-
- return(exp() ? SUCCESS : FAIL);
-}
-
-/*
- * CF is a "strcmp" function referenced in test.h ....
- */
-int
-cf(s1, s2)
-register char *s1, *s2;
-{
- while (*s1++ == *s2)
- if (*s2++ == 0)
- return(0);
- return(*--s1 - *s2);
-}
-char *
-nxtarg(mt)
-{
- if (ap >= ac)
- {
- if (mt)
- {
- ap++;
- return(0);
- }
- failed("test", "argument expected");
- }
- return(av[ap++]);
-}
-
-int
-exp(void)
-{
- int p1;
- char *p2;
-
- p1 = e1();
- p2 = nxtarg(1);
- if (p2 != 0)
- {
- if (eq(p2, "-o"))
- return(p1 | exp());
-
- if (eq(p2, "]") && !eq(p2, ")"))
- failed("test", "test syntax error");
- }
- ap--;
- return(p1);
-}
-
-int
-e1(void)
-{
- int p1;
- char *p2;
-
- p1 = e2();
- p2 = nxtarg(1);
-
- if ((p2 != 0) && eq(p2, "-a"))
- return(p1 & e1());
- ap--;
- return(p1);
-}
-
-int
-e2(void)
-{
- if (eq(nxtarg(0), "!"))
- return(!e3());
- ap--;
- return(e3());
-}
-
-int
-e3(void)
-{
- int p1;
- register char *a;
- char *p2;
- long atol();
- long int1, int2;
-
- a = nxtarg(0);
- if (eq(a, "("))
- {
- p1 = exp();
- if (!eq(nxtarg(0), ")"))
- failed("test",") expected");
- return(p1);
- }
- p2 = nxtarg(1);
- ap--;
- if ((p2 == 0) || (!eq(p2, "=") && !eq(p2, "!=")))
- {
- if (eq(a, "-r"))
- return(tio(nxtarg(0), 4));
- if (eq(a, "-w"))
- return(tio(nxtarg(0), 2));
- if (eq(a, "-x"))
- return(tio(nxtarg(0), 1));
- if (eq(a, "-d"))
- return(filtyp(nxtarg(0), S_IFDIR));
- if (eq(a, "-c"))
- return(filtyp(nxtarg(0), S_IFCHR));
- if (eq(a, "-b"))
- return(filtyp(nxtarg(0), S_IFBLK));
- if (eq(a, "-f"))
- return(filtyp(nxtarg(0), S_IFREG));
- if (eq(a, "-u"))
- return(ftype(nxtarg(0), S_ISUID));
- if (eq(a, "-g"))
- return(ftype(nxtarg(0), S_ISGID));
- if (eq(a, "-k"))
- return(ftype(nxtarg(0), S_ISVTX));
- if (eq(a, "-p"))
- return(filtyp(nxtarg(0),S_IFIFO));
- if (eq(a, "-s"))
- return(fsizep(nxtarg(0)));
- if (eq(a, "-t"))
- {
- if (ap >= ac) /* no args */
- return(isatty(1));
- else if (eq((a = nxtarg(0)), "-a") || eq(a, "-o"))
- {
- ap--;
- return(isatty(1));
- }
- else
- return(isatty(atoi(a)));
- }
- if (eq(a, "-n"))
- return(!eq(nxtarg(0), ""));
- if (eq(a, "-z"))
- return(eq(nxtarg(0), ""));
- }
-
- p2 = nxtarg(1);
- if (p2 == 0)
- return(!eq(a, ""));
- if (eq(p2, "-a") || eq(p2, "-o"))
- {
- ap--;
- return(!eq(a, ""));
- }
- if (eq(p2, "="))
- return(eq(nxtarg(0), a));
- if (eq(p2, "!="))
- return(!eq(nxtarg(0), a));
- int1 = atol(a);
- int2 = atol(nxtarg(0));
- if (eq(p2, "-eq"))
- return(int1 == int2);
- if (eq(p2, "-ne"))
- return(int1 != int2);
- if (eq(p2, "-gt"))
- return(int1 > int2);
- if (eq(p2, "-lt"))
- return(int1 < int2);
- if (eq(p2, "-ge"))
- return(int1 >= int2);
- if (eq(p2, "-le"))
- return(int1 <= int2);
-
- failed("test", "test - unknown operator");
-/* NOTREACHED */
- return (0);
-}
-
-int
-tio(a, f)
-char *a;
-int f;
-{
- if (access(a, f) == 0)
- return(1);
- else
- return(0);
-}
-
-int
-ftype(f, field)
-char *f;
-int field;
-{
- struct stat statb;
-
- if (stat(f, &statb) < 0)
- return(0);
- if ((statb.st_mode & field) == field)
- return(1);
- return(0);
-}
-
-int
-filtyp(f,field)
-char *f;
-int field;
-{
- struct stat statb;
-
- if (stat(f, &statb) < 0)
- return(0);
- if ((statb.st_mode & S_IFMT) == field)
- return(1);
- else
- return(0);
-}
-
-
-
-int
-fsizep(f)
-char *f;
-{
- struct stat statb;
-
- if (stat(f, &statb) < 0)
- return(0);
- return(statb.st_size > 0);
-}
-
diff --git a/usr/src/cmd/fmli/sys/test.h b/usr/src/cmd/fmli/sys/test.h
deleted file mode 100644
index 95872bdde0..0000000000
--- a/usr/src/cmd/fmli/sys/test.h
+++ /dev/null
@@ -1,736 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-/*
- * Copyright (c) 1985 AT&T
- * All Rights Reserved
- *
- * Include file for test.c
- */
-
-#ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.4 */
-
-/* error exits from various parts of shell */
-#define ERROR 1
-#define SYNBAD 2
-#define SIGFAIL 2000
-#define SIGFLG 0200
-
-/* command tree */
-#define FPRS 0x0100
-#define FINT 0x0200
-#define FAMP 0x0400
-#define FPIN 0x0800
-#define FPOU 0x1000
-#define FPCL 0x2000
-#define FCMD 0x4000
-#define COMMSK 0x00F0
-#define CNTMSK 0x000F
-
-#define TCOM 0x0000
-#define TPAR 0x0010
-#define TFIL 0x0020
-#define TLST 0x0030
-#define TIF 0x0040
-#define TWH 0x0050
-#define TUN 0x0060
-#define TSW 0x0070
-#define TAND 0x0080
-#define TORF 0x0090
-#define TFORK 0x00A0
-#define TFOR 0x00B0
-#define TFND 0x00C0
-
-/* execute table */
-#define SYSSET 1
-#define SYSCD 2
-#define SYSEXEC 3
-
-#ifdef RES /* include login code */
-#define SYSLOGIN 4
-#else
-#define SYSNEWGRP 4
-#endif
-
-#define SYSTRAP 5
-#define SYSEXIT 6
-#define SYSSHFT 7
-#define SYSWAIT 8
-#define SYSCONT 9
-#define SYSBREAK 10
-#define SYSEVAL 11
-#define SYSDOT 12
-#define SYSRDONLY 13
-#define SYSTIMES 14
-#define SYSXPORT 15
-#define SYSNULL 16
-#define SYSREAD 17
-#define SYSTST 18
-
-#ifndef RES /* exclude umask code */
-#define SYSUMASK 20
-#define SYSULIMIT 21
-#endif
-
-#define SYSECHO 22
-#define SYSHASH 23
-#define SYSPWD 24
-#define SYSRETURN 25
-#define SYSUNS 26
-#define SYSMEM 27
-#define SYSTYPE 28
-
-/* used for input and output of shell */
-#define INIO 19
-
-/*io nodes*/
-#define USERIO 10
-#define IOUFD 15
-#define IODOC 16
-#define IOPUT 32
-#define IOAPP 64
-#define IOMOV 128
-#define IORDW 256
-#define IOSTRIP 512
-#define INPIPE 0
-#define OTPIPE 1
-
-/* arg list terminator */
-#define ENDARGS 0
-
-/*
- * begin: mac.h
- */
-#define TRUE (-1)
-#define FALSE 0
-#define LOBYTE 0377
-#define STRIP 0177
-#define QUOTE 0200
-
-#define EOF 0
-#define NL '\n'
-#define SP ' '
-#define LQ '`'
-#define RQ '\''
-#define MINUS '-'
-#define COLON ':'
-#define TAB '\t'
-
-
-#define MAX(a,b) ((a)>(b)?(a):(b))
-
-#define blank() prc(SP)
-#define tab() prc(TAB)
-#define newline() prc(NL)
-
-/*
- * end: mac.h
- */
-
-/*
- * begin: mode.h
- */
-
-#ifdef pdp11
-typedef char BOOL;
-#else
-typedef short BOOL;
-#endif
-
-#define BYTESPERWORD (sizeof (char *))
-#define NIL ((char*)0)
-
-
-/* the following nonsense is required
- * because casts turn an Lvalue
- * into an Rvalue so two cheats
- * are necessary, one for each context.
- NOT USED -- generates warnings -- REMOVED abs 9/22/88
-union { int _cheat;};
-#define Lcheat(a) ((a)._cheat)
-#define Rcheat(a) ((int)(a))
-*/
-
-/* address puns for storage allocation */
-typedef union
-{
- struct forknod *_forkptr;
- struct comnod *_comptr;
- struct fndnod *_fndptr;
- struct parnod *_parptr;
- struct ifnod *_ifptr;
- struct whnod *_whptr;
- struct fornod *_forptr;
- struct lstnod *_lstptr;
- struct blk *_blkptr;
- struct namnod *_namptr;
- char *_bytptr;
-} address;
-
-
-/* heap storage */
-struct blk
-{
- struct blk *word;
-};
-
-#define BUFSIZ 1024
-struct fileblk
-{
- int fdes;
- unsigned flin;
- BOOL feof;
- unsigned char fsiz;
- char *fnxt;
- char *fend;
- char **feval;
- struct fileblk *fstak;
- char fbuf[BUFSIZ];
-};
-
-struct tempblk
-{
- int fdes;
- struct tempblk *fstak;
-};
-
-
-/* for files not used with file descriptors */
-struct filehdr
-{
- int fdes;
- unsigned flin;
- BOOL feof;
- unsigned char fsiz;
- char *fnxt;
- char *fend;
- char **feval;
- struct fileblk *fstak;
- char _fbuf[1];
-};
-
-struct sysnod
-{
- char *sysnam;
- int sysval;
-};
-
-/* this node is a proforma for those that follow */
-struct trenod
-{
- int tretyp;
- struct ionod *treio;
-};
-
-/* dummy for access only */
-struct argnod
-{
- struct argnod *argnxt;
- char argval[1];
-};
-
-struct dolnod
-{
- struct dolnod *dolnxt;
- int doluse;
- char *dolarg[1];
-};
-
-struct forknod
-{
- int forktyp;
- struct ionod *forkio;
- struct trenod *forktre;
-};
-
-struct comnod
-{
- int comtyp;
- struct ionod *comio;
- struct argnod *comarg;
- struct argnod *comset;
-};
-
-struct fndnod
-{
- int fndtyp;
- char *fndnam;
- struct trenod *fndval;
-};
-
-struct ifnod
-{
- int iftyp;
- struct trenod *iftre;
- struct trenod *thtre;
- struct trenod *eltre;
-};
-
-struct whnod
-{
- int whtyp;
- struct trenod *whtre;
- struct trenod *dotre;
-};
-
-struct fornod
-{
- int fortyp;
- struct trenod *fortre;
- char *fornam;
- struct comnod *forlst;
-};
-
-struct swnod
-{
- int swtyp;
- char *swarg;
- struct regnod *swlst;
-};
-
-struct regnod
-{
- struct argnod *regptr;
- struct trenod *regcom;
- struct regnod *regnxt;
-};
-
-struct parnod
-{
- int partyp;
- struct trenod *partre;
-};
-
-struct lstnod
-{
- int lsttyp;
- struct trenod *lstlef;
- struct trenod *lstrit;
-};
-
-struct ionod
-{
- int iofile;
- char *ioname;
- char *iolink;
- struct ionod *ionxt;
- struct ionod *iolst;
-};
-
-struct fdsave
-{
- int org_fd;
- int dup_fd;
-};
-
-
-#define fndptr(x) ((struct fndnod *)x)
-#define comptr(x) ((struct comnod *)x)
-#define forkptr(x) ((struct forknod *)x)
-#define parptr(x) ((struct parnod *)x)
-#define lstptr(x) ((struct lstnod *)x)
-#define forptr(x) ((struct fornod *)x)
-#define whptr(x) ((struct whnod *)x)
-#define ifptr(x) ((struct ifnod *)x)
-#define swptr(x) ((struct swnod *)x)
-
-/*
- * end: mode.h
- */
-
-/*
- * begin: name.h
- */
-
-#define N_ENVCHG 0020
-#define N_RDONLY 0010
-#define N_EXPORT 0004
-#define N_ENVNAM 0002
-#define N_FUNCTN 0001
-
-#define N_DEFAULT 0
-
-struct namnod
-{
- struct namnod *namlft;
- struct namnod *namrgt;
- char *namid;
- char *namval;
- char *namenv;
- int namflg;
-};
-
-/*
- * end: name.h
- */
-
-#include <signal.h>
-
-/* error catching */
-/* extern int errno; EFT abs k16 */
-
-/* result type declarations */
-
-#define alloc malloc
-
-/* wish.h includes malloc.h extern char *alloc();*/
-extern char *make();
-extern char *movstr();
-extern char *movstrn();
-extern struct trenod *cmd();
-extern struct trenod *makefork();
-extern struct namnod *lookup();
-extern struct namnod *findnam();
-extern struct dolnod *useargs();
-extern float expr();
-extern char *catpath();
-extern char *getpath();
-extern char *nextpath();
-extern char **scan();
-extern char *mactrim();
-extern char *macro();
-extern char *execs();
-extern char *copyto();
-extern int exname();
-extern char *staknam();
-extern int printnam();
-extern int printro();
-extern int printexp();
-extern char **setenv();
-extern time_t time(); /* EFT abs k16 */
-
-#define attrib(n,f) (n->namflg |= f)
-#define round(a,b) (((int)(((char *)(a)+b)-1))&~((b)-1))
-#define closepipe(x) (close(x[INPIPE]), close(x[OTPIPE]))
-#define eq(a,b) (cf(a,b)==0)
-#define assert(x) ;
-
-/* temp files and io */
-extern int output;
-extern int ioset;
-extern struct ionod *iotemp; /* files to be deleted sometime */
-extern struct ionod *fiotemp; /* function files to be deleted sometime */
-extern struct ionod *iopend; /* documents waiting to be read at NL */
-extern struct fdsave fdmap[];
-
-
-/* substitution */
-extern int dolc;
-extern char **dolv;
-extern struct dolnod *argfor;
-extern struct argnod *gchain;
-
-/*
- * begin: stak.h
- */
-
-/* To use stack as temporary workspace across
- * possible storage allocation (eg name lookup)
- * a) get ptr from `relstak'
- * b) can now use `pushstak'
- * c) then reset with `setstak'
- * d) `absstak' gives real address if needed
- */
-#define relstak() (staktop-stakbot)
-/* NOT USED--Rcheat commented out above. abs 9/22/88
-#define absstak(x) (stakbot+Rcheat(x))
-#define setstak(x) (staktop=absstak(x))
-*/
-#define pushstak(c) (*staktop++=(c))
-#define zerostak() (*staktop=0)
-
-/* Used to address an item left on the top of
- * the stack (very temporary)
- */
-#define curstak() (staktop)
-
-/* `usestak' before `pushstak' then `fixstak'
- * These routines are safe against heap
- * being allocated.
- */
-#define usestak() {locstak();}
-
-/* for local use only since it hands
- * out a real address for the stack top
- */
-extern char *locstak();
-
-/* Will allocate the item being used and return its
- * address (safe now).
- */
-#define fixstak() endstak(staktop)
-
-/* For use after `locstak' to hand back
- * new stack top and then allocate item
- */
-extern char *endstak();
-
-/* Copy a string onto the stack and
- * allocate the space.
- */
-extern char *cpystak();
-
-/* Allocate given ammount of stack space */
-extern char *getstak();
-
-/* A chain of ptrs of stack blocks that
- * have become covered by heap allocation.
- * `tdystak' will return them to the heap.
- */
-extern struct blk *stakbsy;
-
-/* Base of the entire stack */
-extern char *stakbas;
-
-/* Top of entire stack */
-extern char *brkend;
-
-/* Base of current item */
-extern char *stakbot;
-
-/* Top of current item */
-extern char *staktop;
-
-/* Used with tdystak */
-extern char *savstak();
-
-/*
- * end: stak.h
- */
-
-/* string constants */
-extern char atline[];
-extern char readmsg[];
-extern char colon[];
-extern char minus[];
-extern char nullstr[];
-extern char sptbnl[];
-extern char unexpected[];
-extern char endoffile[];
-
-/* name tree and words */
-extern struct sysnod reserved[];
-extern int no_reserved;
-extern struct sysnod commands[];
-extern int no_commands;
-
-extern int wdval;
-extern int wdnum;
-extern int fndef;
-extern int nohash;
-extern struct argnod *wdarg;
-extern int wdset;
-extern BOOL reserv;
-
-/* prompting */
-extern char stdprompt[];
-extern char supprompt[];
-extern char profile[];
-extern char sysprofile[];
-
-/* built in names */
-extern struct namnod fngnod;
-extern struct namnod cdpnod;
-extern struct namnod ifsnod;
-extern struct namnod homenod;
-extern struct namnod mailnod;
-extern struct namnod pathnod;
-extern struct namnod ps1nod;
-extern struct namnod ps2nod;
-extern struct namnod mchknod;
-extern struct namnod acctnod;
-extern struct namnod mailpnod;
-
-/* special names */
-extern char flagadr[];
-extern char *pcsadr;
-extern char *pidadr;
-extern char *cmdadr;
-
-extern char defpath[];
-
-/* names always present */
-extern char mailname[];
-extern char homename[];
-extern char pathname[];
-extern char cdpname[];
-extern char ifsname[];
-extern char ps1name[];
-extern char ps2name[];
-extern char mchkname[];
-extern char acctname[];
-extern char mailpname[];
-
-/* transput */
-extern char tmpout[];
-extern int serial;
-
-#define TMPNAM 7
-
-extern struct fileblk *standin;
-
-#define input (standin->fdes)
-#define eof (standin->feof)
-
-extern int peekc;
-extern int peekn;
-extern char *comdiv;
-extern char devnull[];
-
-/* flags */
-#define noexec 01
-#define sysflg 01
-#define intflg 02
-#define prompt 04
-#define setflg 010
-#define errflg 020
-#define ttyflg 040
-#define forked 0100
-#define oneflg 0200
-#define rshflg 0400
-#define waiting 01000
-#define stdflg 02000
-#define STDFLG 's'
-#define execpr 04000
-#define readpr 010000
-#define keyflg 020000
-#define hashflg 040000
-#define nofngflg 0200000
-#define exportflg 0400000
-
-extern long flags;
-extern int rwait; /* flags read waiting */
-
-/* error exits from various parts of shell */
-#include <setjmp.h>
-extern jmp_buf subshell;
-extern jmp_buf errshell;
-
-/* fault handling */
-
-/*
- * begin: brkincr.h
- */
-
-#define BRKINCR 01000
-#define BRKMAX 04000
-
-/*
- * end: brkincr.h
- */
-
-extern unsigned brkincr;
-#define MINTRAP 0
-#define MAXTRAP 20
-
-#define TRAPSET 2
-#define SIGSET 4
-#define SIGMOD 8
-#define SIGCAUGHT 16
-
-extern int fault();
-extern BOOL trapnote;
-extern char *trapcom[];
-extern BOOL trapflg[];
-
-/* name tree and words */
-extern char **environ;
-extern char numbuf[];
-extern char export[];
-extern char duperr[];
-extern char readonly[];
-
-/* execflgs */
-extern int exitval;
-extern int retval;
-extern BOOL execbrk;
-extern int loopcnt;
-extern int breakcnt;
-extern int funcnt;
-
-/* messages */
-extern char mailmsg[];
-extern char coredump[];
-extern char badopt[];
-extern char badparam[];
-extern char unset[];
-extern char badsub[];
-extern char nospace[];
-extern char nostack[];
-extern char notfound[];
-extern char badtrap[];
-extern char baddir[];
-extern char badshift[];
-extern char restricted[];
-extern char execpmsg[];
-extern char notid[];
-extern char badulimit[];
-extern char wtfailed[];
-extern char badcreate[];
-extern char nofork[];
-extern char noswap[];
-extern char piperr[];
-extern char badopen[];
-extern char badnum[];
-extern char arglist[];
-extern char txtbsy[];
-extern char toobig[];
-extern char badexec[];
-extern char badfile[];
-extern char badreturn[];
-extern char badexport[];
-extern char badunset[];
-extern char nohome[];
-extern char badperm[];
-
-/* 'builtin' error messages */
-
-extern char btest[];
-extern char badop[];
-
-/* fork constant */
-
-#define FORKLIM 32
-
-extern address end[];
-
-#include "ctype.h"
-
-extern int wasintr; /* used to tell if break or delete is hit
- * while executing a wait
- */
-extern int eflag;
-
-
-/*
- * Find out if it is time to go away.
- * `trapnote' is set to SIGSET when fault is seen and
- * no trap has been set.
- */
-
-#define sigchk() if (trapnote & SIGSET) \
- exitsh(exitval ? exitval : SIGFAIL)
-
-#define exitset() retval = exitval
diff --git a/usr/src/cmd/fmli/sys/varappend.c b/usr/src/cmd/fmli/sys/varappend.c
deleted file mode 100644
index 5afc07ba0f..0000000000
--- a/usr/src/cmd/fmli/sys/varappend.c
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-/*
- * Copyright (c) 1986 AT&T
- * All Rights Reserved
- */
-#ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.1 */
-
-#include <stdio.h>
-#include "wish.h"
-#include "var_arrays.h"
-
-/*
- * add another element onto the end of a v_array
- */
-struct v_array *
-array_append(array, element)
-struct v_array array[];
-char *element;
-{
- register struct v_array *ptr;
-
- ptr = v_header(array_grow(array, 1));
- if (element != NULL)
- memcpy(ptr_to_ele(ptr, ptr->tot_used - 1), element, ptr->ele_size);
- return v_body(ptr);
-}
diff --git a/usr/src/cmd/fmli/sys/varchkapnd.c b/usr/src/cmd/fmli/sys/varchkapnd.c
deleted file mode 100644
index 0f3a543259..0000000000
--- a/usr/src/cmd/fmli/sys/varchkapnd.c
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-/*
- * Copyright (c) 1986 AT&T
- * All Rights Reserved
- */
-#ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.1 */
-
-#include <stdio.h>
-#include "wish.h"
-#include "var_arrays.h"
-
-/*
- * like array_append, but creates array if NULL
- */
-struct v_array *
-array_check_append(size, array, element)
-unsigned size;
-struct v_array array[];
-char *element;
-{
- if (array == NULL)
- array = array_create(size, 8);
- return array_append(array, element);
-}
diff --git a/usr/src/cmd/fmli/sys/varcreate.c b/usr/src/cmd/fmli/sys/varcreate.c
deleted file mode 100644
index e8716486cc..0000000000
--- a/usr/src/cmd/fmli/sys/varcreate.c
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-/*
- * Copyright (c) 1986 AT&T
- * All Rights Reserved
- */
-#ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.2 */
-
-#include <stdio.h>
-#include "wish.h"
-#include "var_arrays.h"
-
-
-/*
- * create a new v_array with space in it for "num" elements of size "size"
- * (but the array is empty - must use array_grow or array append to fill it)
- */
-struct v_array *
-array_create(size, num)
-unsigned size;
-unsigned num;
-{
- register unsigned realsize;
- register unsigned initstep;
- register struct v_array *ptr;
-
- realsize = size * num + sizeof(struct v_array);
- initstep = num / 10;
- if (initstep < 2)
- initstep = 2;
- if ((ptr = (struct v_array *)malloc(realsize)) == NULL)
- return NULL;
- ptr->tot_used = 0;
- ptr->tot_left = num;
- ptr->ele_size = size;
- ptr->step_size = initstep;
- return v_body(ptr);
-}
diff --git a/usr/src/cmd/fmli/sys/vardelete.c b/usr/src/cmd/fmli/sys/vardelete.c
deleted file mode 100644
index 9f4150c6fb..0000000000
--- a/usr/src/cmd/fmli/sys/vardelete.c
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-/*
- * Copyright (c) 1986 AT&T
- * All Rights Reserved
- */
-#ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.1 */
-
-#include <stdio.h>
-#include "wish.h"
-#include "var_arrays.h"
-
-/*
- * delete an element from a v_array
- * this does not reduce the size of the v_array in-core
- * array_shrink does that
- */
-struct v_array *
-array_delete(array, position)
-struct v_array array[];
-unsigned position;
-{
- register struct v_array *ptr;
-
- ptr = v_header(array);
- if (position >= ptr->tot_used)
- return array;
- ptr->tot_used--;
- ptr->tot_left++;
- if (position < ptr->tot_used)
- memshift(ptr_to_ele(ptr, position), ptr_to_ele(ptr, position + 1), ptr->ele_size * (ptr->tot_used - position));
- return v_body(ptr);
-}
diff --git a/usr/src/cmd/fmli/sys/vargrow.c b/usr/src/cmd/fmli/sys/vargrow.c
deleted file mode 100644
index 8720cd8854..0000000000
--- a/usr/src/cmd/fmli/sys/vargrow.c
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-/*
- * Copyright (c) 1986 AT&T
- * All Rights Reserved
- */
-#ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.2 */
-
-#include <stdio.h>
-#include "wish.h"
-#include "var_arrays.h"
-
-
-/*
- * make the v_array bigger by one element, mallocing as needed
- */
-struct v_array *
-array_grow(array, step)
-struct v_array array[];
-unsigned step;
-{
- register struct v_array *ptr;
- register unsigned delta;
-
- ptr = v_header(array);
- if (step > ptr->tot_left) {
- delta = ptr->step_size;
- if (delta < step)
- delta = step;
- if ((ptr = (struct v_array *)realloc(ptr, sizeof(struct v_array) + (ptr->tot_used + ptr->tot_left + delta) * ptr->ele_size)) == NULL)
- return NULL;
- ptr->tot_left += delta;
- }
- ptr->tot_used += step;
- ptr->tot_left -= step;
- return v_body(ptr);
-}
diff --git a/usr/src/cmd/fmli/sys/varinsert.c b/usr/src/cmd/fmli/sys/varinsert.c
deleted file mode 100644
index 3da3138425..0000000000
--- a/usr/src/cmd/fmli/sys/varinsert.c
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-/*
- * Copyright (c) 1986 AT&T
- * All Rights Reserved
- */
-#ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.1 */
-
-#include <stdio.h>
-#include "wish.h"
-#include "var_arrays.h"
-
-/*
- * insert an element at position "position" in a v_array
- */
-struct v_array *
-array_insert(array, element, position)
-struct v_array array[];
-char *element;
-unsigned position;
-{
- register struct v_array *ptr;
-
- ptr = v_header(array);
- if (position > ptr->tot_used)
- return array;
- ptr = v_header(array_grow(array, 1));
- if (position < ptr->tot_used - 1)
- memshift(ptr_to_ele(ptr, position + 1), ptr_to_ele(ptr, position), ptr->ele_size * (ptr->tot_used - position - 1));
- if (element != NULL)
- memcpy(ptr_to_ele(ptr, position), element, ptr->ele_size);
- return v_body(ptr);
-}
diff --git a/usr/src/cmd/fmli/sys/varshrink.c b/usr/src/cmd/fmli/sys/varshrink.c
deleted file mode 100644
index 2b18932b95..0000000000
--- a/usr/src/cmd/fmli/sys/varshrink.c
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-/*
- * Copyright (c) 1986 AT&T
- * All Rights Reserved
- */
-#ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.3 */
-
-#include <stdio.h>
-#include "wish.h"
-#include "var_arrays.h"
-
-/*
- * shrink the actual space used by a v_array as much as possible
- * note that this requires the process to allocate more space
- * before giving some back, so it may actually INCREASE the data
- * segment size of the process. If used, array_shrink should be
- * called before adding things to other v_arrays, since perhaps
- * one of them can take advantage of the freed space.
- */
-struct v_array *
-array_shrink(array)
-struct v_array array[];
-{
- register struct v_array *ptr;
- register struct v_array *newptr;
-
- ptr = v_header(array);
- if ((newptr = (struct v_array *)realloc(ptr, sizeof(struct v_array) + ptr->tot_used * ptr->ele_size)) == NULL)
- return NULL;
- return v_body(newptr); /* chged ptr to newptr. abs k14.2 */
-}
diff --git a/usr/src/cmd/fmli/sys/watch.c b/usr/src/cmd/fmli/sys/watch.c
deleted file mode 100644
index 74d3b572c9..0000000000
--- a/usr/src/cmd/fmli/sys/watch.c
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-/*
- * Copyright (c) 1986 AT&T
- * All Rights Reserved
- */
-#ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.3 */
-
-#include <stdio.h>
-#include <sys/types.h>
-#include <sys/times.h>
-#include "wish.h"
-
-clock_t times(); /* EFT abs k16 */
-
-/*
- * call stopwatch with "0" to "reset", and with a non-zero value
- * to print elapsed times on the stderr
- */
-void
-stopwatch(flag)
-int flag;
-{
- static clock_t start; /* EFT abs k16 */
- static struct tms tbuf;
-
- if (flag == 0)
- start = times(&tbuf);
- else {
- clock_t stop; /* EFT abs k16 */
- struct tms stoptim;
-
- stop = times(&stoptim);
-#ifdef _DEBUG0
- _debug0(stderr, "Real %d.%02d, User %d.%02d, System %d.%02d\n",
- (stop - start) / 100, (stop - start) % 100,
- (stoptim.tms_utime - tbuf.tms_utime) / 100,
- (stoptim.tms_utime - tbuf.tms_utime) % 100,
- (stoptim.tms_stime - tbuf.tms_stime) / 100,
- (stoptim.tms_stime - tbuf.tms_stime) % 100);
-#endif
- }
-}
diff --git a/usr/src/cmd/fmli/vt/Makefile b/usr/src/cmd/fmli/vt/Makefile
deleted file mode 100644
index e96dea3f0b..0000000000
--- a/usr/src/cmd/fmli/vt/Makefile
+++ /dev/null
@@ -1,60 +0,0 @@
-#
-# CDDL HEADER START
-#
-# The contents of this file are subject to the terms of the
-# Common Development and Distribution License, Version 1.0 only
-# (the "License"). You may not use this file except in compliance
-# with the License.
-#
-# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
-# or http://www.opensolaris.org/os/licensing.
-# See the License for the specific language governing permissions
-# and limitations under the License.
-#
-# When distributing Covered Code, include this CDDL HEADER in each
-# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
-# If applicable, add the following below this CDDL HEADER, with the
-# fields enclosed by brackets "[]" replaced with your own identifying
-# information: Portions Copyright [yyyy] [name of copyright owner]
-#
-# CDDL HEADER END
-#
-#
-# Copyright 2004 Sun Microsystems, Inc. All rights reserved.
-# Use is subject to license terms.
-#
-# ident "%Z%%M% %I% %E% SMI"
-#
-# cmd/fmli/vt/Makefile
-#
-LIBRARY = libvt.a
-
-OBJECTS = fits.o hide.o highlight.o indicator.o lp.o makebox.o \
- message.o move.o offscreen.o physical.o redraw.o system.o \
- vclose.o vcolor.o vcreate.o vctl.o vcurrent.o vdebug.o \
- vflush.o vfork.o vinit.o vmark.o vreshape.o wclrwin.o \
- wdelchar.o wgetchar.o wgo.o winschar.o winprintf.o wputchar.o \
- winputs.o wreadchar.o wscrollwin.o showmail.o showdate.o \
- working.o
-
-# include library definitions
-include ../../../lib/Makefile.lib
-
-C99MODE= $(C99_DISABLE)
-
-# Specifically request the construction of a static library.
-# This library is not installed in the proto area.
-LIBS = $(LIBRARY)
-
-# inc must be first.
-CPPFLAGS = -I../inc $(CPPFLAGS.master)
-
-.KEEP_STATE:
-
-all: $(LIBS)
-
-install: all
- @echo "$(LIBRARY) is not installed."
-
-# include library targets
-include ../../../lib/Makefile.targ
diff --git a/usr/src/cmd/fmli/vt/fits.c b/usr/src/cmd/fmli/vt/fits.c
deleted file mode 100644
index f08daf4fe9..0000000000
--- a/usr/src/cmd/fmli/vt/fits.c
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-/*
- * Copyright (c) 1986 AT&T
- * All Rights Reserved
- */
-#ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.1 */
-
-#include <curses.h>
-#include <term.h>
-#include "wish.h"
-#include "vtdefs.h"
-
-unsigned VT_firstline;
-unsigned VT_lastline;
-
-/*
- * determines whether or not a window this big will fit with a border
- * around it
- */
-bool
-fits(flags, rows, cols)
-unsigned flags;
-unsigned rows;
-unsigned cols;
-{
- if (!(flags & VT_NOBORDER)) {
- rows += 2;
- cols += 2;
- }
- return rows <= VT_lastline - VT_firstline && cols <= columns;
-}
diff --git a/usr/src/cmd/fmli/vt/hide.c b/usr/src/cmd/fmli/vt/hide.c
deleted file mode 100644
index 200ecf2a5a..0000000000
--- a/usr/src/cmd/fmli/vt/hide.c
+++ /dev/null
@@ -1,149 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-/*
- * Copyright (c) 1986 AT&T
- * All Rights Reserved
- */
-#ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.9 */
-
-#include <curses.h>
-#include "wish.h"
-#include "vt.h"
-#include "vtdefs.h"
-#include "color_pair.h"
-
-/*
- * hide a window until it is made current again
- */
-void
-_vt_hide(vid, destructive)
-vt_id vid;
-bool destructive;
-{
- register vt_id n;
- register struct vt *v;
- register struct vt *vp;
- register WINDOW *w;
-
-/* debug stuff
-
- fprintf( stderr, "\t\t\t\t\tInto _vt_hide( %d )\n", vid );
-
- fprintf( stderr, "VT_front = %d\n", VT_front );
- fprintf( stderr, "VT_back = %d\n", VT_back );
- fprintf( stderr, "VT_curid = %d\n\n", VT_curid );
-
- for ( n = VT_front; n != VT_UNDEFINED; n = v->next )
- {
- v = &VT_array[ n ];
-
- fprintf( stderr, "prev = %d\n", v->prev );
- fprintf( stderr, "VT_array index = %d\n", n );
- fprintf( stderr, "next = %d\n\n", v->next );
- }
-*/
-
- v = &VT_array[vid];
- if (vid < 0 || !(v->flags & VT_USED))
- return;
- /* mark windows we are covering */
- _vt_mark_overlap(v);
- /* physically remove from screen */
- if (destructive)
- w = v->win;
- else {
- int row, col, rows, cols;
-
- getbegyx(v->win, row, col);
- getmaxyx(v->win, rows, cols);
- w = newwin(rows, cols, row, col);
- }
- wbkgd(w, COL_ATTR(A_NORMAL, WINDOW_PAIR));
- werase(w);
- wnoutrefresh(w);
- if (destructive && v->subwin)
- delwin(v->subwin);
- delwin(w);
- /* remove from window list */
- if (VT_front == vid)
- {
- VT_front = v->next;
-
- if ( VT_front != VT_UNDEFINED )
- VT_array[ VT_front ].prev = VT_UNDEFINED;
- }
- if (VT_curid == vid)
- {
- VT_curid = VT_front;
- vp = &VT_array[ VT_curid ];
- vp->flags |= VT_TDIRTY;
- /*
- * Since active/inactive border colors can be specified
- * for color terminals, border should also be marked dirty.
- */
- if ((!(vp->flags & VT_NOBORDER)) &&
- Color_terminal == TRUE && Border_colors_differ)
- vp->flags |= VT_BDIRTY;
- }
-
- for (n = VT_front; n != VT_UNDEFINED; n = vp->next) {
- vp = &VT_array[n];
- if (vp->next == vid)
- {
- vp->next = VT_array[vid].next;
-
- if ( VT_back == vid )
- VT_back = VT_array[ VT_back ].prev;
- else
- {
- vp = &VT_array[ vid ];
- VT_array[ v->next ].prev = n;
- }
-
- break;
- }
- }
-/* NEEDED ??? */
- v->prev = v->next = VT_UNDEFINED;
-
-/* debug stuff
-
- fprintf( stderr, "\t\t\tAfter change\n" );
-
- fprintf( stderr, "VT_front = %d\n", VT_front );
- fprintf( stderr, "VT_back = %d\n", VT_back );
- fprintf( stderr, "VT_curid = %d\n\n", VT_curid );
-
- for ( n = VT_front; n != VT_UNDEFINED; n = v->next )
- {
- v = &VT_array[ n ];
-
- fprintf( stderr, "prev = %d\n", v->prev );
- fprintf( stderr, "VT_array index = %d\n", n );
- fprintf( stderr, "next = %d\n\n", v->next );
- }
-*/
-}
diff --git a/usr/src/cmd/fmli/vt/highlight.c b/usr/src/cmd/fmli/vt/highlight.c
deleted file mode 100644
index 9bb74c5b40..0000000000
--- a/usr/src/cmd/fmli/vt/highlight.c
+++ /dev/null
@@ -1,111 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-
-/*
- * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-#include <curses.h>
-#include <term.h>
-#include "color_pair.h"
-
-/*
- * the UNDERLINE flag is the second bit of the "ncv" (no_color_video)
- * terminfo variable (see set_underline_attrs() below)
- */
-#define UNDERLINE (0x02)
-
-chtype Attr_normal; /* normal video */
-chtype Attr_hide; /* border of non-current window */
-chtype Attr_highlight; /* border of current window */
-chtype Attr_select; /* attribute of "selector bar" */
-chtype Attr_show; /* something visible (errors, etc) */
-chtype Attr_visible; /* the most annoying thing terminal can do */
-chtype Attr_underline; /* attribute of underline */
-chtype Attr_mark; /* attribute of "marked" items */
-
-
-
-int
-setvt_attrs(void)
-{
- static chtype modes;
-
- /*
- * Determine modes
- */
- if (enter_blink_mode)
- modes |= A_BLINK;
- if (enter_bold_mode)
- modes |= A_BOLD;
- if (enter_dim_mode)
- modes |= A_DIM;
- if (enter_reverse_mode)
- modes |= A_REVERSE;
- if (enter_standout_mode)
- modes |= A_STANDOUT;
- if (enter_underline_mode)
- modes |= A_UNDERLINE;
-
- /*
- * Set up Attribute array
- */
- Attr_normal = A_NORMAL;
- Attr_underline = A_UNDERLINE; /* let curses decide */
- Attr_highlight = modes & A_STANDOUT;
- if (modes & A_REVERSE)
- Attr_highlight = A_REVERSE;
- Attr_visible = Attr_show = Attr_select = Attr_hide = Attr_highlight;
- if (modes & A_DIM)
- Attr_select = Attr_hide = modes & (A_REVERSE | A_DIM);
- else if (modes & A_BOLD) {
- Attr_highlight |= A_BOLD;
- Attr_select = A_BOLD;
- }
- if (modes & A_BLINK)
- Attr_visible |= A_BLINK;
- Attr_mark = Attr_select;
- if (modes & A_UNDERLINE)
- Attr_mark = A_UNDERLINE;
- return (0);
-}
-
-/*
- * SET_UNDERLINE_COLOR will change the underline attribute to be
- * "colpair" IF the terminal supports color BUT the terminal CAN NOT
- * support color attributes with underlining.
- */
-int
-set_underline_attr(colpair)
-int colpair;
-{
- if (Color_terminal == TRUE && no_color_video >= 0 &&
- (no_color_video & UNDERLINE))
- Attr_underline = COL_ATTR(A_REVERSE, colpair);
- return (0);
-}
diff --git a/usr/src/cmd/fmli/vt/indicator.c b/usr/src/cmd/fmli/vt/indicator.c
deleted file mode 100644
index 3515dad28b..0000000000
--- a/usr/src/cmd/fmli/vt/indicator.c
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/*
- * Copyright 1997 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-#include <curses.h>
-#include "wish.h"
-#include "vt.h"
-#include "vtdefs.h"
-
-void
-indicator(message, col)
-char *message;
-int col;
-{
- WINDOW *win;
-
- win = VT_array[ STATUS_WIN ].win;
- /* error check */
-/* abs: change output routine to one that handles escape sequences
- mvwaddstr(win, 0, col, message);
-*/
- wmove(win, 0, col);
- winputs(message, win);
-/*****/
- wnoutrefresh( win );
- doupdate();
-}
diff --git a/usr/src/cmd/fmli/vt/lp.c b/usr/src/cmd/fmli/vt/lp.c
deleted file mode 100644
index 6483a3e264..0000000000
--- a/usr/src/cmd/fmli/vt/lp.c
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-/*
- * Copyright (c) 1985 AT&T
- * All Rights Reserved
- */
-#ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.1 */
-
-#include <curses.h>
-#include <term.h>
-
-char *
-lpon()
-{
- return((char *)prtr_on);
-}
-
-char *
-lpoff()
-{
- return((char *)prtr_off);
-}
diff --git a/usr/src/cmd/fmli/vt/makebox.c b/usr/src/cmd/fmli/vt/makebox.c
deleted file mode 100644
index d82edb263c..0000000000
--- a/usr/src/cmd/fmli/vt/makebox.c
+++ /dev/null
@@ -1,116 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-
-/*
- * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-/*
- * Copyright (c) 1986 AT&T
- * All Rights Reserved
- */
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-#include <curses.h>
-#include "wish.h"
-#include "vt.h"
-#include "vtdefs.h"
-#include "attrs.h"
-
-#define TL 0
-#define BL 1
-#define BR 2
-#define TR 3
-
-static vt_id side[4] = { -1, -1, -1, -1 };
-static bool corner(int which, int row, int col, chtype ch, int flag);
-static void remove_box(void);
-
-bool
-make_box(flag, srow, scol, rows, cols)
-bool flag;
-register int srow;
-register int scol;
-register int rows;
-register int cols;
-{
- if (srow < 0 || scol < 0 || cols < 1 || rows < 1) {
- remove_box();
- return FALSE;
- }
- if (side[TL] >= 0)
- remove_box();
- rows--;
- cols--;
- if (!corner(TL, srow, scol, ACS_ULCORNER, flag))
- return FALSE;
- if (!corner(BL, srow + rows, scol, ACS_LLCORNER, TRUE))
- return FALSE;
- if (!corner(BR, srow + rows, scol + cols, ACS_LRCORNER, !flag))
- return FALSE;
- if (!corner(TR, srow, scol + cols, ACS_URCORNER, TRUE))
- return FALSE;
- if (flag)
- vt_current(side[BR]);
- else
- vt_current(side[TL]);
-/* vt_current(side[flag ? BR : TL]); amdahl compatibility */
- return TRUE;
-}
-
-static bool
-corner(int which, int row, int col, chtype ch, int flag)
-{
- register vt_id vid;
- register struct vt *v;
-
- if ((vid = side[which] = vt_create(NULL, VT_NONUMBER | VT_NOBORDER, row, col, 1, 1)) < 0) {
- remove_box();
- return FALSE;
- }
- vt_current(vid);
- v = &VT_array[vid];
- scrollok(v->win, FALSE);
- if (flag)
- waddch(v->win, ch | Attr_visible);
- else
- waddch(v->win, ch);
- v->flags |= VT_DIRTY;
- return TRUE;
-}
-
-static void
-remove_box(void)
-{
- register int i;
-
- for (i = 0; i < 4; i++) {
- if (side[i] >= 0)
- vt_close(side[i]);
- side[i] = -1;
- }
-}
diff --git a/usr/src/cmd/fmli/vt/message.c b/usr/src/cmd/fmli/vt/message.c
deleted file mode 100644
index f5ee183207..0000000000
--- a/usr/src/cmd/fmli/vt/message.c
+++ /dev/null
@@ -1,183 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/*
- * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-#include <stdio.h>
-#include <curses.h>
-#include "wish.h"
-#include "vt.h"
-#include "message.h"
-#include "vtdefs.h"
-
-
-static char MESS_perm[MESSIZ] = "";
-static char SAVE_perm[MESSIZ] = "";
-static char MESS_frame[MESSIZ] = "";
-static char MESS_curr[MESSIZ] = "";
-static char MESS_temp[MESSIZ] = "";
-
-/*
- * Mess_lock is used to avoid simultaneous writes to the message line
- * (i.e., subsequent calls to mess_temp() will be locked out until the
- * "locked" temporary message is output to the message line ...
- * see message.h)
- */
-int Mess_lock = 0;
-
-/*
- * Print the message "s" on the FMLI message line
- */
-void
-mess_flash(s)
-register char *s;
-{
- WINDOW *win;
-
- if (!s)
- s = nil;
- strncpy(MESS_curr, s, sizeof(MESS_curr) - 1);
- win = VT_array[ MESS_WIN ].win;
-/*abs: change output routine to allow esc seq processing
- mvwaddstr( win, 0, 0, s );
-*/
- wmove(win, 0, 0);
- winputs(s, win);
-/****/
- wclrtobot( win );
- wnoutrefresh( win );
-}
-
-/*
- * Store the "temporary" message to be printed on the FMLI message line
- */
-void
-mess_temp(s)
-register char *s;
-{
- if (!s)
- s = nil;
- if (!Mess_lock)
- strncpy(MESS_temp, s, sizeof(MESS_temp) - 1);
-}
-
-/*
- * Store the "temporary" message to be printed on the FMLI message line
- */
-void
-mess_frame(s)
-register char *s;
-{
- if (!s)
- s = nil;
- strncpy(MESS_frame, s, sizeof(MESS_frame) - 1);
-}
-
-char *
-get_mess_frame()
-{
- return(MESS_frame);
-}
-
-
-
-/*
- * Store the "permanent" message to be printed on the FMLI message line
- */
-char *
-mess_perm(s)
-register char *s;
-{
- char *sptr, *strcpy();
-
- if (!s)
- s = nil;
- sptr = strcpy(SAVE_perm, MESS_perm);
- strncpy(MESS_perm, s, sizeof(MESS_perm) - 1);
- return(sptr); /* return previous perm message */
-}
-
-/*
- * Flush either the temporary or the permanent message
- */
-int
-mess_flush(permanent)
-bool permanent;
-{
- int retval = FALSE;
- char *messstr;
-
- if (MESS_frame[0] != '\0')
- messstr = MESS_frame;
- else
- messstr = MESS_perm;
- if (permanent && strcmp(MESS_curr, messstr) != 0) {
- mess_flash(messstr);
- mess_temp(""); /* clear temp message string */
- retval = TRUE;
- }
- else if (!permanent) { /* a temporary message */
- if (MESS_temp[0] == '\0') {
- /*
- * If no temporary message, use permanent message
- */
- if (strcmp(MESS_curr, messstr) != 0) {
- mess_flash(messstr);
- retval = TRUE;
- }
- }
- else if (strcmp(MESS_temp, MESS_curr) != 0) {
- /*
- * If current message differs from temp message
- */
- if (strcmp(MESS_curr, MESS_temp) != 0) {
- mess_flash(MESS_temp);
- retval = TRUE;
- }
- }
- }
- return(retval);
-}
-
-
-/*
- * clear out the temp and frame messages that may be left as side-effects
- * of operations. designed to be used at startup after all initial frames
- * have been opened but before the 1st frame is made current. Since
- * this frame is made current without any user input, messages generated
- * by the other initial frames may be present and would not otherwise be removed
- * --abs k18
-*/
-
-void
-mess_init()
-{
- MESS_temp[0] = MESS_frame[0] = '\0';
- mess_flash(nil);
-}
diff --git a/usr/src/cmd/fmli/vt/move.c b/usr/src/cmd/fmli/vt/move.c
deleted file mode 100644
index ba3022c661..0000000000
--- a/usr/src/cmd/fmli/vt/move.c
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-
-/*
- * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-#include <curses.h>
-#include "wish.h"
-#include "vt.h"
-#include "vtdefs.h"
-
-/*
- * moves a vt to row, col
- */
-int
-vt_move(newrow, newcol)
-unsigned newrow;
-unsigned newcol;
-{
- register struct vt *v;
- int n;
- int row;
- int col;
- extern unsigned VT_firstline;
-
- n = VT_curid;
- v = &VT_array[n];
- getmaxyx(v->win, row, col);
- if (off_screen(newrow, newcol, row, col))
- return FAIL;
- _vt_hide(n, FALSE);
- mvwin(v->win, newrow + VT_firstline, newcol);
- vt_current(n);
- return TRUE;
-}
diff --git a/usr/src/cmd/fmli/vt/offscreen.c b/usr/src/cmd/fmli/vt/offscreen.c
deleted file mode 100644
index b368eb78ab..0000000000
--- a/usr/src/cmd/fmli/vt/offscreen.c
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-
-/*
- * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-#include <curses.h>
-#include <term.h>
-#include "wish.h"
-
-unsigned VT_firstline;
-unsigned VT_lastline;
-
-int
-off_screen(srow, scol, rows, cols)
-unsigned srow;
-unsigned scol;
-unsigned rows;
-unsigned cols;
-{
- return srow >= VT_lastline || scol >= columns || srow + rows > VT_lastline - VT_firstline || scol + cols > columns;
-}
diff --git a/usr/src/cmd/fmli/vt/physical.c b/usr/src/cmd/fmli/vt/physical.c
deleted file mode 100644
index 21b2a677be..0000000000
--- a/usr/src/cmd/fmli/vt/physical.c
+++ /dev/null
@@ -1,453 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-
-/*
- * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-#include <curses.h>
-#include <fcntl.h>
-#include "wish.h"
-#include "token.h"
-#include "message.h"
-#include "vt.h"
-#include "var_arrays.h"
-#include "actrec.h"
-#include "moremacros.h"
-#include "vtdefs.h"
-
-#ifdef TIME_IT
-
-#include <sys/types.h>
-#include <sys/times.h>
-
-#endif /* TIME_IT */
-
-extern time_t Cur_time; /* abs k15, EFT k16*/
-extern char Semaphore[];
-extern int Coproc_active;
-extern int Vflag;
-extern time_t time(); /* EFT abs k16 */
-
-
-/* #ifdef i386 abs k18 */
-
-/*
- * redefine curses mouse position macros
- */
-#define SCR_ROW MOUSE_Y_POS
-#define SCR_COL MOUSE_X_POS
-
-/*
- * Given a screen offset (r, c), PTS_to() will determine whether r,c
- * points to a given frame (excluding the frame border).
- * (br, bc is the beginning offset of the frame on the screen and
- * mr, mc is the maximum rows and columns of the frame)
- */
-#define PTS_to(r, c, br, bc, mr, mc) \
- ((r > br) && (r < (br + mr - 1)) && \
- (c > bc) && (c < (bc + mc - 1)))
-/*
- * ON_border() will evaluate to true if the mouse points to the
- * frame border
- */
-#define ON_border(r, c, br, bc, mr, mc) \
- (((r == br || (r == (br + mr - 1))) && \
- (c >= bc && (c <= (bc + mc - 1)))) || \
- ((c == bc || (c == (bc + mc - 1))) && \
- (r >= br && (r <= (br + mr - 1)))))
-
-/*
- * Determine the mouse offset within the frame (0,0 based)
- * (excluding the frame border).
- */
-#define FRAME_ROW(r1, r2) (r1 - (r2 + 1))
-#define FRAME_COL(c1, c2) (c1 - (c2 + 1))
-
-static token page_tok();
-static token do_mouse(), do_open_mouse();
-static int on_top();
-/* #endif abs k18 */
-
-int Mouse_row;
-int Mouse_col;
-int Open_mouse_mode = FALSE;
-
-extern long Mail_check;
-extern long Interupt_pending;
-
-token
-physical_stream(t)
-register token t;
-{
- token wgetchar();
- int fd;
-
-#ifdef PHYSICAL /* i dont know what this does but since
- * it was un-compilable until k17
- * it must never have been used. abs */
-
- struct tms tms1, tms2;
- clock_t real1; /* EFT abs k16 */
- int lcv1 = 10000;
-
- real1 = times( &tms1 ); /* ; added. abs k17 */
-
- while ( lcv1-- )
- {
-#endif /* PHYSICAL */
-
- Cur_time = time((time_t)0);
-
- ar_checkworld(FALSE);
- working(FALSE);
- if (Vflag)
- showmail( FALSE );
-
- (void) mess_flush(FALSE);
-
-/* new les */
- vt_flush();
-
- alarm((int) Mail_check);
- if (Coproc_active)
- {
- /*
- * The call to open is to protect "vsig" from
- * sending a signal to FACE when the screen
- * is being painted ...
- * Vsig will block on the semaphore until FACE
- * is able to receive signals ..
- * This code may be changed if a better solution
- * is found ...
- * Interupt_pending is definined in main.c and
- * set in the interupt handler for a SIGUSR2
- * once a signal is encountered ...
- */
- fd = open(Semaphore, O_RDONLY|O_NDELAY);
- if (Interupt_pending)
- {
- Interupt_pending = 0;
- ar_checkworld(TRUE);
- vt_flush(); /* abs k18.2 */
- }
- t = wgetchar();
- close(fd);
- }
- else
- t = wgetchar();
- mess_unlock(); /* allow calls to mess_temp and mess_perm */
-
- if (t < 0)
- t = TOK_NOP;
- else if (t >= TOK_F(1) && t <= TOK_F(8))
- t = t - TOK_F(1) + TOK_SLK1;
-/* #ifdef i386 abs k18*/
- else if (t == KEY_MOUSE)
- {
- if (Open_mouse_mode)
- t = do_open_mouse();
- else
- t = do_mouse();
- }
-/* #endif abs k18 */
- (void) mess_flush(TRUE);
-
- return t;
-
-#ifdef PHYSICAL /* abs k17 */
- } /* abs k17 */
-#endif /* PHYSICAL */ /* abs k17 */
-
-}
-
-/* #ifdef i386 abs k18 */
-
-static token
-do_mouse()
-{
- register int brow, bcol, mrow, mcol;
- struct vt *v, *savev, *curvt;
- int num, onborder;
- token t;
- struct actrec *wdw_to_ar();
-
- if (BUTTON_CHANGED(2) || BUTTON_CHANGED(3))
- return(TOK_NOP); /* only concerned about button 1 events */
- if (BUTTON_CHANGED(1) && (BUTTON_STATUS(1) == BUTTON_PRESSED ||
- BUTTON_STATUS(1) == BUTTON_CLICKED)) {
- /*
- * First check to see which frame (if any) the
- * the mouse points to ...
- */
- t = TOK_NOP;
- savev = curvt = &VT_array[VT_curid];
- getbegyx(curvt->win, brow, bcol);
- getmaxyx(curvt->win, mrow, mcol);
- if (ON_border(SCR_ROW, SCR_COL, brow, bcol, mrow, mcol)) {
- /*
- * Mouse points to the current frame border
- */
- onborder = TRUE;
- t = TOK_BPRESSED;
- }
- else if (PTS_to(SCR_ROW, SCR_COL, brow, bcol, mrow, mcol)) {
- /*
- * Mouse points to the current frame
- */
- onborder = FALSE;
- t = TOK_BPRESSED;
- }
- else {
- /*
- * Scan the list of VT's to find one that the
- * mouse points to ...
- */
- v = VT_array;
- savev = NULL;
- for (num = array_len(VT_array); num > 0; v++, num--) {
- if (v == curvt || !(v->flags & VT_USED) ||
- (v->flags & VT_NOBORDER))
- continue; /* don't bother */
- getbegyx(v->win, brow, bcol);
- getmaxyx(v->win, mrow, mcol);
- if (ON_border(SCR_ROW, SCR_COL, brow, bcol, mrow, mcol)) {
- if (on_top(v, savev)) {
- savev = v;
- onborder = TRUE;
- }
- t = TOK_BPRESSED;
- }
- else if (PTS_to(SCR_ROW, SCR_COL, brow, bcol, mrow, mcol)) {
- if (on_top(v, savev)) {
- savev = v;
- onborder = FALSE;
- }
- t = TOK_BPRESSED;
- }
- }
- }
- /*
- * If the mouse doesn't point to a frame (t != TOK_BPRESSED)
- * then return TOK_NOP
- */
- if (t != TOK_BPRESSED)
- return(TOK_NOP);
-
- v = savev;
- if (v != curvt) {
- /*
- * frame is not current so make it current
- */
- ar_current(wdw_to_ar(v->number), TRUE); /* abs k15 */
- vt_flush();
- curvt = &VT_array[VT_curid];
- getbegyx(curvt->win, brow, bcol);
- getmaxyx(curvt->win, mrow, mcol);
- }
- if (onborder == FALSE) {
- /*
- * If not on the frame border then
- * do object specific action for
- * BUTTON PRESS
- */
- Mouse_row = FRAME_ROW(SCR_ROW, brow);
- Mouse_col = FRAME_COL(SCR_COL, bcol);
- (void) arf_odsh(ar_get_current(), TOK_BPRESSED);
- wrefresh(curvt->win);
- }
- if (mess_flush(FALSE)) /* update message line */
- wrefresh(VT_array[MESS_WIN].win);
-
- if (BUTTON_STATUS(1) == BUTTON_PRESSED) {
- /*
- * Perform mouse tracking while the button is
- * depressed ... (if the mouse was "clicked" there
- * is no need to track)
- *
- * NOTE: Do not map button release events to SLKS while
- * tracking.
- */
- map_button(0);
- for (; ;) {
- /*
- * No longer track on BUTTON_RELEASE
- */
- if (BUTTON_STATUS(1) == BUTTON_RELEASED) {
- Mouse_row = FRAME_ROW(SCR_ROW, brow);
- Mouse_col = FRAME_COL(SCR_COL, bcol);
- break;
- }
- if (request_mouse_pos() == ERR)
- break;
- if (MOUSE_MOVED && PTS_to(SCR_ROW, SCR_COL, brow, bcol, mrow, mcol)) {
- Mouse_row = FRAME_ROW(SCR_ROW, brow);
- Mouse_col = FRAME_COL(SCR_COL, bcol);
- (void) arf_odsh(ar_get_current(), TOK_BPRESSED);
- wrefresh(curvt->win);
- if (mess_flush(FALSE))
- wrefresh(VT_array[MESS_WIN].win);
- }
- }
- map_button(BUTTON1_RELEASED);
- }
- }
- if (BUTTON_CHANGED(1) && (BUTTON_STATUS(1) == BUTTON_RELEASED ||
- BUTTON_STATUS(1) == BUTTON_CLICKED)) {
- /*
- * If XY points to the current frame return (TOK_BRELEASED)
- * otherwise ignore the mouse event (TOK_NOP)
- */
- flushinp();
- curvt = &VT_array[VT_curid];
- getbegyx(curvt->win, brow, bcol);
- getmaxyx(curvt->win, mrow, mcol);
- if ((SCR_COL - bcol + 1) == mcol) {
- /*
- * The mouse points to the right frame border ...
- * check to see if it is inside the scroll box
- */
- t = page_tok(SCR_ROW, brow, mrow);
- }
- else if (PTS_to(SCR_ROW, SCR_COL, brow, bcol, mrow, mcol)) {
- /*
- * The mouse points to the current frame ...
- * Determine the frame offset
- */
- Mouse_row = FRAME_ROW(SCR_ROW, brow);
- Mouse_col = FRAME_COL(SCR_COL, bcol);
- t = TOK_BRELEASED;
- }
- else
- t = TOK_NOP;
- }
- return(t);
-}
-
-/*
- * DO_OPEN_MOUSE is similar to DO_MOUSE except the mouse doesn't have
- * to point inside a frame (e.g., frame management routines move and
- * reshape)
- */
-static token
-do_open_mouse()
-{
- token t;
-
- if (BUTTON_CHANGED(2) || BUTTON_CHANGED(3))
- return(TOK_NOP); /* only concerned about button 1 events */
- t = TOK_NOP;
- if (BUTTON_CHANGED(1) && BUTTON_STATUS(1) == BUTTON_PRESSED) {
- /*
- * Perform mouse tracking while button is depressed
- */
- map_button(0);
- for (; ;) {
- t = TOK_NOP;
- /*
- * No longer track on BUTTON_RELEASE
- */
- if (BUTTON_STATUS(1) == BUTTON_RELEASED) {
- Mouse_row = SCR_ROW;
- Mouse_row = SCR_ROW;
- t = TOK_BRELEASED;
- break;
- }
- if (request_mouse_pos() == ERR)
- break;
- if (MOUSE_MOVED) {
- Mouse_row = SCR_ROW;
- Mouse_col = SCR_COL;
- (void) arf_odsh(ar_get_current(), TOK_BPRESSED);
- vt_flush();
- }
- }
- map_button(BUTTON1_RELEASED);
- }
- else if (BUTTON_CHANGED(1) && BUTTON_STATUS(1) == BUTTON_CLICKED) {
- /*
- * Button was clicked so don't track ... interpret as
- * Button press immediately followed by button release.
- */
- Mouse_row = SCR_ROW;
- Mouse_col = SCR_COL;
- (void) arf_odsh(ar_get_current(), TOK_BPRESSED);
- vt_flush();
- t = TOK_BRELEASED;
- }
- return(t);
-}
-
-/*
- * Given that the mouse points to the right frame border,
- * PAGE_TOK() returns a page token if the mouse points to
- * the up/down arrow in the scroll box
- */
-static token
-page_tok(mouserow, brow, mrow)
-int mouserow, brow, mrow;
-{
- int uparrow, dnarrow, framerow;
- token rettok;
-
- uparrow = (mrow / 2) - 1; /* location of up arrow */
- dnarrow = uparrow + 2; /* location of down arrow */
- framerow = mouserow - brow; /* location of the mouse */
-
- if (framerow == uparrow)
- rettok = TOK_PPAGE;
- else if (framerow == dnarrow)
- rettok = TOK_NPAGE;
- else
- rettok = TOK_NOP;
- return(rettok);
-}
-
-/*
- * Given 2 frames ON_TOP will return TRUE if frame 1 (arg1) is
- * "on top of" frame 2 (arg2)
- */
-static int
-on_top(f1, f2)
-struct vt *f1, *f2;
-{
- struct actrec *wdw_to_ar();
- struct actrec *ar1, *ar2;
-
- if (f2 == (struct vt *)NULL)
- return(TRUE);
- ar1 = wdw_to_ar(f1->number);
- ar2 = wdw_to_ar(f2->number);
-
- if (ar_isfirst(ar1, ar2))
- return(TRUE);
- else
- return(FALSE);
-}
-
-/* #endif abs k18 */
diff --git a/usr/src/cmd/fmli/vt/redraw.c b/usr/src/cmd/fmli/vt/redraw.c
deleted file mode 100644
index e6c9005097..0000000000
--- a/usr/src/cmd/fmli/vt/redraw.c
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-
-/*
- * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-#include <curses.h>
-#include "wish.h"
-#include "vt.h"
-#include "vtdefs.h"
-
-int
-vt_redraw(void)
-{
- wrefresh(curscr);
- return (0);
-}
diff --git a/usr/src/cmd/fmli/vt/showdate.c b/usr/src/cmd/fmli/vt/showdate.c
deleted file mode 100644
index f46d00a815..0000000000
--- a/usr/src/cmd/fmli/vt/showdate.c
+++ /dev/null
@@ -1,92 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-/*
- * Copyright (c) 1986 AT&T
- * All Rights Reserved
- */
-#ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.6 */
-
-#include <time.h>
-#include <curses.h>
-#include "wish.h"
-#include "vtdefs.h"
-/* #include "status.h" empty include file abs 9/14/88 */
-#include "vt.h"
-#include "ctl.h"
-
-void
-showdate()
-{
- register struct tm *t;
- char *ctime();
- static int oldday;
- static char *day[] = {
- "Sunday",
- "Monday",
- "Tuesday",
- "Wednesday",
- "Thursday",
- "Friday",
- "Saturday",
- };
- static char *month[] = {
- "January",
- "February",
- "March",
- "April",
- "May",
- "June",
- "July",
- "August",
- "September",
- "October",
- "November",
- "December",
- };
- extern time_t Cur_time; /* EFT abs k16 */
-
- Cur_time = time( (time_t)0L );
-
- t = localtime(&Cur_time);
- if (oldday != t->tm_mday) {
- char datebuf[DATE_LEN];
- register int n, s;
- register vt_id oldvid;
- int r, c;
- int datecol;
-
- vt_ctl(STATUS_WIN, CTGETSIZ, &r, &c);
- datecol = (c - DATE_LEN) / 2;
- oldday = t->tm_mday;
- oldvid = vt_current(STATUS_WIN);
- wgo(0, datecol);
- sprintf(datebuf, "AT&T FACE - %s %s %d, %4d", day[t->tm_wday], month[t->tm_mon], t->tm_mday, t->tm_year + 1900);
- s = strlen(datebuf);
- n = (DATE_LEN - s) / 2;
- winprintf("%*s%s%*s", n, "", datebuf, DATE_LEN - n - s, "");
- vt_current(oldvid);
- }
-}
diff --git a/usr/src/cmd/fmli/vt/showmail.c b/usr/src/cmd/fmli/vt/showmail.c
deleted file mode 100644
index b0a36d5a0d..0000000000
--- a/usr/src/cmd/fmli/vt/showmail.c
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-/*
- * Copyright (c) 1986 AT&T
- * All Rights Reserved
- */
-#ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.6 */
-
-#include <fcntl.h>
-#include <curses.h>
-#include "wish.h"
-#include "vt.h"
-#include "vtdefs.h"
-
-void
-showmail(force)
-bool force;
-{
- register bool status;
- static char mail[] = "MAIL";
- static char blanks[] = " ";
- static bool last_status;
- static long last_check;
- extern time_t Cur_time; /* EFT abs k16 */
- extern int Mail_col;
- extern long Mail_check;
- extern char *Mail_file;
-
- if (force || Cur_time - last_check >= Mail_check) {
- register int fd;
- char buf[8];
-
-/* Is there an easier way ??? */
- status = ((fd = open(Mail_file, O_RDONLY)) >= 0 && read(fd, buf, sizeof(buf)) == sizeof(buf) && strncmp(buf, "Forward ", sizeof(buf)));
- if (fd >= 0)
- close(fd);
-/* ??? */
- if (status == last_status)
- return;
- last_status = status;
-/* new */
- {
- WINDOW *win;
-
- win = VT_array[ STATUS_WIN ].win;
- mvwaddstr( win, 0, Mail_col, status ? mail : blanks );
- if ( status )
- beep();
- }
- }
- last_check = Cur_time;
-}
diff --git a/usr/src/cmd/fmli/vt/system.c b/usr/src/cmd/fmli/vt/system.c
deleted file mode 100644
index 7141b0fe9a..0000000000
--- a/usr/src/cmd/fmli/vt/system.c
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-/*
- * Copyright (c) 1986 AT&T
- * All Rights Reserved
- */
-#ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.2 */
-
-#include <curses.h>
-#include "wish.h"
-
-int
-vt_system(string)
-register char *string;
-{
- register int retval;
- char buf;
-
- (void) vt_before_fork();
- putchar('\n');
- fflush(stdout);
- retval = system(string);
- printf("Please hit ENTER to continue: ");
- fflush(stdout);
- read(0, &buf, 1);
- (void) vt_after_fork();
- return retval;
-}
diff --git a/usr/src/cmd/fmli/vt/vclose.c b/usr/src/cmd/fmli/vt/vclose.c
deleted file mode 100644
index 308772eb71..0000000000
--- a/usr/src/cmd/fmli/vt/vclose.c
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-/*
- * Copyright (c) 1986 AT&T
- * All Rights Reserved
- */
-#ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.1 */
-
-#include <curses.h>
-#include "wish.h"
-#include "vt.h"
-#include "vtdefs.h"
-#include "var_arrays.h"
-
-void
-vt_close(vid)
-vt_id vid;
-{
- register struct vt *v;
-
- v = &VT_array[vid];
- if (vid < 0 || !(v->flags & VT_USED))
- return;
- _vt_hide(vid, TRUE);
- v->number = 0;
- v->flags = 0;
- if (v->title)
- free(v->title);
-}
-
-void
-vt_close_all()
-{
- while (VT_curid != VT_UNDEFINED)
- vt_close(VT_curid);
-}
diff --git a/usr/src/cmd/fmli/vt/vcolor.c b/usr/src/cmd/fmli/vt/vcolor.c
deleted file mode 100644
index f4a0113c47..0000000000
--- a/usr/src/cmd/fmli/vt/vcolor.c
+++ /dev/null
@@ -1,223 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-
-/*
- * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-#include <curses.h>
-#include <term.h>
-#include "wish.h"
-#include "color_pair.h"
-#include "moremacros.h"
-#include "vtdefs.h"
-#include "vt.h"
-
-static int Numcolors = NUMDEFCOLORS;
-int Pair_set[MAXCOLPAIRS];
-static int add_color(char *colorstr);
-static int lookup_color(char *colorstr);
-
-/*
- * Table of known colors
- */
-struct ctab {
- char *colorstr;
- int id;
-} Color_tab[MAXCOLORS] = {
- { "black", COLOR_BLACK },
- { "blue", COLOR_BLUE },
- { "green", COLOR_GREEN },
- { "cyan", COLOR_CYAN },
- { "red", COLOR_RED },
- { "magenta", COLOR_MAGENTA },
- { "yellow", COLOR_YELLOW },
- { "white", COLOR_WHITE },
- { NULL, 0 }
-};
-
-/*
- * SET_SCR_COLOR sets the screen background color and refreshes
- * the screen
- */
-int
-set_scr_color(colpair, dorefresh)
-int colpair;
-int dorefresh;
-{
- if (Pair_set[colpair]) {
- wbkgd(stdscr, COL_ATTR(A_NORMAL, colpair));
- /*
- * Set color attributes for the banner, message and
- * command lines
- */
- wbkgd(VT_array[STATUS_WIN].win, COL_ATTR(A_NORMAL, colpair));
- wattrset(VT_array[STATUS_WIN].win, COL_ATTR(A_NORMAL, colpair));
- wbkgd(VT_array[MESS_WIN].win, COL_ATTR(A_NORMAL, colpair));
- wattrset(VT_array[MESS_WIN].win, COL_ATTR(A_NORMAL, colpair));
- wbkgd(VT_array[CMD_WIN].win, COL_ATTR(A_NORMAL, colpair));
- wattrset(VT_array[CMD_WIN].win, COL_ATTR(A_NORMAL, colpair));
- }
- if (dorefresh) {
- refresh();
- /*
- * The following lines are necessary since curses
- * has problems with reverse video screens (e.g., xterm
- * by default comes up with a white background)
- */
- if (orig_colors)
- putp(orig_colors);
- if (orig_pair)
- putp(orig_pair);
- }
- return (0);
-}
-
-/*
- * SET_SLK_COLOR simply sets the slk color pair
- */
-int
-set_slk_color(colpair)
-{
- slk_attrset(COL_ATTR(A_REVERSE | A_DIM, colpair));
- return (0);
-}
-
-/*
- * SETPAIR creates new color pair combinations
- */
-int
-setpair(pairnum, foreground, background)
-int pairnum, foreground, background;
-{
- if (foreground < 0 || background < 0)
- Pair_set[pairnum] = FALSE;
- else if (init_pair(pairnum, foreground, background) != ERR)
- Pair_set[pairnum] = TRUE;
- else
- Pair_set[pairnum] = FALSE;
- return(Pair_set[pairnum]);
-}
-
-/*
- * SETCOLOR creates new color specifications or "tweeks" old ones.
- * (returns 1 on success and 0 on failure)
- */
-int
-setcolor(colorstr, r, g, b)
-char *colorstr;
-int r, g, b;
-{
- register int cindex, id;
- short oldr, oldg, oldb;
- int cant_init;
-
- if (!can_change_color())
- return(-1);
- cant_init = 0;
- if ((cindex = lookup_color(colorstr)) >= 0) {
- /*
- * The color has been previously defined ...
- * If you can't change the color specification then
- * restore the old specification.
- */
- color_content(cindex, &oldr, &oldg, &oldb);
- if (init_color(cindex, r, g, b) == ERR) {
- cant_init++;
- if (init_color(cindex, oldr, oldg, oldb) == ERR)
- id = -1; /* just in case */
- else
- id = cindex;
- }
- else
- id = cindex;
- Color_tab[cindex].id = id;
- }
- else if ((cindex = add_color(colorstr)) >= 0) {
- /*
- * The color is NEW ...
- */
- if (init_color(cindex, r, g, b) == ERR)
- id = -1;
- else
- id = cindex;
- Color_tab[cindex].id = id;
- }
- else
- id = -1;
- return(cant_init ? 0 : (id >= 0));
-}
-
-/*
- * GETCOLOR_ID returns the color identifier of the passed color string
- */
-int
-getcolor_id(colorstr)
-char *colorstr;
-{
- int index;
-
- index = lookup_color(colorstr);
- if (index >= 0)
- return(Color_tab[index].id);
- else
- return(-1);
-}
-
-/*
- * LOOKUP_COLOR returns the index of the passed color string from the
- * color table (or "-1" if the color is not in the table).
- */
-static int
-lookup_color(char *colorstr)
-{
- register int i;
-
- /* put it in the color table */
- for (i = 0; i < Numcolors; i++) {
- if (strcmp(colorstr, Color_tab[i].colorstr) == 0)
- return(i);
- }
- return(-1);
-}
-
-/*
- * ADD_COLOR adds a new color to the color table if the number of colors
- * is less than COLORS (curses define for the number of colors the terminal
- * can support) and less than MAXCOLORS (color table size)
- */
-static int
-add_color(char *colorstr)
-{
- if (Numcolors < COLORS && Numcolors < MAXCOLORS) {
- Color_tab[Numcolors].colorstr = strsave(colorstr);
- return(Numcolors++);
- }
- else
- return(-1);
-}
diff --git a/usr/src/cmd/fmli/vt/vcreate.c b/usr/src/cmd/fmli/vt/vcreate.c
deleted file mode 100644
index 9a60d5c74c..0000000000
--- a/usr/src/cmd/fmli/vt/vcreate.c
+++ /dev/null
@@ -1,396 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-
-/*
- * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-#include <curses.h>
-#include <term.h>
-#include <values.h>
-#include "wish.h"
-#include "vt.h"
-#include "vtdefs.h"
-#include "var_arrays.h"
-#include "moremacros.h"
-#include "color_pair.h"
-
-#define area(sr1, sc1, r1, c1, sr2, sc2, r2, c2) (_vt_overlap(sr1, r1, sr2, r2) * _vt_overlap(sc1, c1, sc2, c2))
-
-extern int VT_firstline;
-extern int VT_lastline;
-static int Nextrow;
-static int Nextcol;
-
-extern int Color_terminal;
-static int best_place(int flags, int *startrow, int *startcol,
- unsigned int rows, unsigned int cols);
-static int bestcol(int sofar, int *sr, int *sc, unsigned int r,
- unsigned int c);
-static int cover(unsigned int sr, unsigned int sc, unsigned int r,
- unsigned int c);
-
-/*
- * only way to create a VT
- */
-vt_id
-vt_create(title, flags, srow, scol, rows, cols)
-char *title;
-int flags;
-int srow;
-int scol;
-unsigned rows;
-unsigned cols;
-{
- register int num;
- register int wnum;
- register struct vt *v;
- extern int VT_firstline;
-
- if (!(flags & VT_NOBORDER)) {
- srow--;
- scol--;
- rows += 2;
- cols += 2;
- }
- if (best_place(flags, &srow, &scol, rows, cols) == FAIL) {
-#ifdef _DEBUG3
- _debug3(stderr, "bestplace failed\n");
-#endif
- return FAIL;
- }
- if (off_screen(srow, scol, rows, cols)) {
-#ifdef _DEBUG3
- _debug3(stderr, "off_screen FAILED!!! This should never happen here!!!\n");
-#endif
- return FAIL;
- }
- srow += VT_firstline;
- /* pick a window number (if appropriate) */
- wnum = 0;
- if (!(flags & VT_NONUMBER)) {
- for (wnum = 1; ; wnum++) {
- for (v = VT_array, num = array_len(VT_array); num > 0; v++, num--)
- if (v->flags & VT_USED && v->number == wnum)
- break;
- if (num <= 0)
- break;
- }
- }
- /* find a free vt structure */
- for (v = VT_array, num = array_len(VT_array); num > 0; v++, num--)
- if (!(v->flags & VT_USED))
- break;
- if (num <= 0) {
- var_append(struct vt, VT_array, NULL);
- v = &VT_array[array_len(VT_array) - 1];
- }
- /* set up v */
- v->flags = VT_USED | (flags & (VT_NONUMBER | VT_NOBORDER));
- v->number = wnum;
- v->title = strsave(title);
- if ((v->win = newwin(rows, cols, srow, scol)) == NULL) {
-#ifdef _DEBUG3
- _debug3(stderr, "newwin\n");
-#endif
- return FAIL;
- }
- notimeout(v->win, TRUE); /* no time limit for Fkey sequences */
-
- /*
- * set up a subwindow for bordered windows only ....
- */
- if (!(flags & VT_NOBORDER)) {
- if ((v->subwin = subwin(v->win, rows-2, cols-2, srow+1, scol+1)) == NULL) {
-#ifdef _DEBUG3
- _debug3(stderr, "subwin\n");
-#endif
- return FAIL;
- }
- notimeout(v->subwin, TRUE);
- }
- else
- v->subwin = NULL;
-
- /* syncok (sunwin, TRUE); */
- if (Color_terminal == TRUE && !(flags & VT_NOBORDER) && Pair_set[WINDOW_PAIR]) {
- wbkgd(v->win, COL_ATTR(A_NORMAL, WINDOW_PAIR));
- wattrset(v->win, COL_ATTR(A_NORMAL, WINDOW_PAIR));
- if (v->subwin) { /* set attribute for sub window */
- wbkgd(v->subwin, COL_ATTR(A_NORMAL, WINDOW_PAIR));
- wattrset(v->subwin, COL_ATTR(A_NORMAL, WINDOW_PAIR));
- }
- }
- keypad(v->win, TRUE);
- if (flags & VT_NOBORDER)
- wmove(v->win, 0, 0);
- else
- wmove(v->win, 1, 1);
- v->flags |= VT_ANYDIRTY;
- return v - VT_array;
-}
-
-/*
- * find row with least overlap for any column (determined by bestcol)
- */
-static int
-nooverlap(sr, sc, r, c)
-register int *sr;
-register int *sc;
-unsigned r;
-unsigned c;
-{
- register int best;
-
- best = MAXINT;
- if (*sr >= 0)
- best = bestcol(best, sr, sc, r, c);
- else {
- register int sofar;
- int row;
- int col;
- register int savedcol;
-
- savedcol = *sc;
- for (row = 0; !off_screen(row, 0, r, c); row = Nextrow) {
- col = savedcol;
- if ((sofar = bestcol(best, &row, &col, r, c)) < best) {
- *sr = row;
- *sc = col;
- if ((best = sofar) == 0)
- break;
- }
- }
- if (best) {
- row = VT_lastline - VT_firstline - r;
- col = savedcol;
- if ((sofar = bestcol(best, &row, &col, r, c)) < best) {
- *sr = row;
- *sc = col;
- best = sofar;
- }
- }
- }
-#ifdef _DEBUG3
- _debug3(stderr, "best is %d,%d: %d\n", *sr, *sc, best);
-#endif
- return (best < MAXINT) ? SUCCESS : FAIL;
-}
-
-/*
- * find column with lowest cost, given row
- * do nothing if all columns have a cost higher than sofar
- */
-static int
-bestcol(int sofar, int *sr, int *sc, unsigned int r, unsigned int c)
-{
- register int best;
- int col;
-
- best = sofar;
- Nextrow = VT_lastline;
- if (*sc >= 0)
- best = min(best, cover(*sr, *sc, r, c));
- else {
- Nextcol = 0;
- for (col = 0; !off_screen(*sr, col, r, c); col = Nextcol) {
-#ifdef _DEBUG3
- _debug3(stderr, "%d,%d\n", *sr, col);
-#endif
- if ((sofar = cover(*sr, col, r, c)) < best) {
- *sc = col;
- if ((best = sofar) == 0)
- break;
- }
- }
- if (best) {
-#ifdef _DEBUG3
- _debug3(stderr, "%d,%d\n", *sr, columns - c);
-#endif
- if ((sofar = cover(*sr, col = columns - c, r, c)) < best) {
- *sc = col;
- best = sofar;
- }
- }
- }
- return best;
-}
-
-/*
- * compute sum of overlapping areas of given window with all other windows
- */
-static int
-cover(unsigned int sr, unsigned int sc, unsigned int r, unsigned int c)
-{
- register int n;
- register int sofar;
- register int vtarea;
- register struct vt *v;
- int vsr, vsc, vr, vc;
-
- sofar = 0;
- Nextcol = columns;
- for (n = VT_front; n != VT_UNDEFINED; n = v->next) {
- v = &VT_array[n];
- getbegyx(v->win, vsr, vsc);
- vsr -= VT_firstline;
- getmaxyx(v->win, vr, vc);
- if ((vtarea = area(sr, sc, r, c, vsr, vsc, vr, vc)) > 0) {
- /* if there is an overlap with this VT */
- sofar += vtarea;
- Nextcol = min(Nextcol, vsc + vc);
- Nextrow = min(Nextrow, vsr + vr);
- }
- }
- return sofar;
-}
-
-/*
- * center the window
- */
-static int
-center(sr, sc, r, c)
-int *sr;
-int *sc;
-unsigned r;
-unsigned c;
-{
- if (*sr < 0)
- *sr = (VT_lastline - VT_firstline - r) / 2;
- if (*sc < 0)
- *sc = (columns - c) / 2;
- return SUCCESS;
-}
-
-/*
- * make window as far as possible away from current window
- */
-static int
-nocovercur(sr, sc, r, c)
-register int *sr;
-register int *sc;
-unsigned r;
-unsigned c;
-{
- register int best, sofar;
- register struct vt *v;
- int crow, ccol;
- int crows, ccols;
-
- v = &VT_array[VT_curid];
- getbegyx(v->win, crow, ccol);
- crow -= VT_firstline;
- getmaxyx(v->win, crows, ccols);
- best = sofar = area(*sr = 0, *sc = 0, r, c, crow, ccol, crows, ccols);
- if ((sofar = area(0, columns - c - 1, r, c, crow, ccol, crows, ccols)) < best) {
- best = sofar;
- *sc = columns - c - 1;
- }
- if ((sofar = area(VT_lastline - VT_firstline - r, columns - c - 1, r, c, crow, ccol, crows, ccols)) < best) {
- best = sofar;
- *sr = VT_lastline - VT_firstline - r;
- *sc = columns - c - 1;
- }
- if ((sofar = area(VT_lastline - VT_firstline - r, 0, r, c, crow, ccol, crows, ccols)) < best) {
- best = sofar;
- *sr = VT_lastline - VT_firstline - r;
- *sc = 0;
- }
- return SUCCESS;
-}
-
-/*
- * try to put window in the same place as current window
- */
-static int
-covercur(sr, sc, r, c)
-register int *sr;
-register int *sc;
-unsigned r;
-unsigned c;
-{
- register struct vt *v;
- int y, x;
-
- v = &VT_array[VT_curid];
- getbegyx(v->win, y, x);
- y -= VT_firstline;
- *sr = min(VT_lastline - VT_firstline - r, y);
- *sc = min(columns - c, x);
- if (!off_screen(*sr, *sc, r, c))
- return SUCCESS;
- return FAIL;
-}
-
-/*
- * find best place to put window
- */
-static int
-best_place(int flags, int *startrow, int *startcol,
- unsigned int rows, unsigned int cols)
-{
- int (*cfunc)(); /* cost function to use */
- unsigned cost;
- static int (*cost_table[NUMCOSTS])() = {
- nooverlap,
- center,
- covercur,
- nocovercur,
- };
-
- /* we have already bumped the numbers to take care of the border.. */
- if (!fits(VT_NOBORDER, rows, cols))
- return FAIL;
- /* row and column are set */
- if (*startrow >= 0 && *startcol >= 0)
- return SUCCESS;
- /* get cost function */
- cost = (flags & VT_COSTS);
- cfunc = (cost > NUMCOSTS) ? nooverlap : cost_table[cost];
- return (*cfunc)(startrow, startcol, rows, cols);
-}
-
-/*
- * compute linear overlap between line starting at s1 and going for n1 units
- * and line starting at s2 and going for n2 units
- */
-int
-_vt_overlap(s1, n1, s2, n2)
-int s1;
-int n1;
-int s2;
-int n2;
-{
- if (s2 < s1)
- return _vt_overlap(s2, n2, s1, n1);
- if (s1 + n1 < s2)
- return 0;
- if (s1 + n1 > s2 + n2)
- return n2;
- return s1 + n1 - s2;
-}
diff --git a/usr/src/cmd/fmli/vt/vctl.c b/usr/src/cmd/fmli/vt/vctl.c
deleted file mode 100644
index d67b9edf56..0000000000
--- a/usr/src/cmd/fmli/vt/vctl.c
+++ /dev/null
@@ -1,184 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-
-/*
- * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-#include <curses.h>
-#include <stdio.h>
-#include <stdarg.h>
-#include "wish.h"
-#include "ctl.h"
-#include "vt.h"
-#include "vtdefs.h"
-#include "attrs.h"
-#include "color_pair.h"
-
-int
-vt_ctl(vt_id vid, unsigned cmd, ...)
-{
- register struct vt *v;
- register int retval;
- va_list args;
- int colpair, attr;
-
-#ifdef _DEBUG
-
- if (vid < 0) {
- if ((vid = VT_curid) < 0)
- _debug(stderr, "NO CURRENT VT!\n");
- }
-#else
-
- if (vid < 0)
- vid = VT_curid;
-#endif
-
- v = &VT_array[vid];
- retval = SUCCESS;
- va_start(args, cmd);
- switch (cmd) {
- case CTSETATTR:
- attr = va_arg(args, int);
- colpair = va_arg(args, int);
- wattrset(v->win, COL_ATTR(attr, colpair));
- break;
- case CTSETLIM:
- {
- extern int VT_firstline;
- extern int VT_lastline;
-
- VT_firstline = va_arg(args, int);
- VT_lastline = va_arg(args, int);
- }
- break;
- case CTGETCUR:
- retval = VT_curid;
- break;
- case CTGETITLE:
- *(va_arg(args, char **)) = v->title;
- break;
- case CTGETWDW:
- retval = v->number;
- break;
- case CTSETWDW:
- v->number = va_arg(args, int);
- v->flags |= VT_TDIRTY;
- break;
- case CTSETITLE:
- v->title = va_arg(args, char*);
- v->flags |= VT_TDIRTY;
- break;
- case CTSETPARROWS:
- v->flags &= ~(VT_UPPARROW | VT_DNPARROW);
- v->flags |= va_arg(args, int) & (VT_UPPARROW | VT_DNPARROW);
- v->flags |= VT_PADIRTY; /* page arrows */
- break;
- case CTSETSARROWS:
- v->flags &= ~(VT_UPSARROW | VT_DNSARROW);
- v->flags |= va_arg(args, int) & (VT_UPSARROW | VT_DNSARROW);
- v->flags |= VT_SADIRTY; /* scroll arrows */
- break;
- case CTGETVT:
- retval = vid;
- break;
- case CTGETSIZ:
- {
- int *rows;
- int *cols;
- int r;
- int c;
-
- rows = va_arg(args, int *);
- cols = va_arg(args, int *);
- getmaxyx(v->win, r, c);
- if (!(v->flags & VT_NOBORDER)) {
- r -= 2;
- c -= 2;
- }
- *rows = r;
- *cols = c;
- }
- break;
- case CTGETSTRT:
- {
- int r;
- int c;
- extern int VT_firstline;
-
- getbegyx(v->win, r, c);
- if (!(v->flags & VT_NOBORDER)) {
- r++;
- c++;
- }
- r -= VT_firstline;
- *(va_arg(args, int *)) = r;
- *(va_arg(args, int *)) = c;
- }
- break;
- case CTGETPOS:
- {
- int r;
- int c;
-
- getyx(v->win, r, c);
- if (!(v->flags & VT_NOBORDER)) {
- r--;
- c--;
- }
- *(va_arg(args, int *)) = r;
- *(va_arg(args, int *)) = c;
- }
- break;
- case CTHIDE:
- {
- register vt_id i;
- register struct vt *v;
-
- wnoutrefresh(stdscr);
- for (i = VT_front; i != VT_UNDEFINED; i = v->next) {
- v = &VT_array[i];
- v->flags |= VT_DIRTY;
- }
- }
- break;
- case CTCLEARWIN:
- wgo(0, 0);
- wclrwin(TRUE);
- break;
- default:
-#ifdef _DEBUG
- _debug(stderr, "vt_ctl(%d, %d, ...) unknown command\n", vid, cmd);
-#endif
- retval = FAIL;
- break;
- }
- va_end(args);
- return retval;
-}
diff --git a/usr/src/cmd/fmli/vt/vcurrent.c b/usr/src/cmd/fmli/vt/vcurrent.c
deleted file mode 100644
index 4ec1d09651..0000000000
--- a/usr/src/cmd/fmli/vt/vcurrent.c
+++ /dev/null
@@ -1,192 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-/*
- * Copyright (c) 1986 AT&T
- * All Rights Reserved
- */
-#ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.7 */
-
-#include <curses.h>
-#include "wish.h"
-#include "vt.h"
-#include "vtdefs.h"
-#include "color_pair.h"
-
-/* vt which is in "front" of others (and head of linked list) */
-vt_id VT_front;
-/* tail of linked list */
-vt_id VT_back;
-/* vt which is "current" (ie operations default to this one) */
-vt_id VT_curid;
-struct vt *VT_array;
-
-/*
- * makes the given vt current and in front of all others (also makes
- * old vt noncurrent if there is a current one
- */
-vt_id
-vt_current(vid)
-vt_id vid;
-{
- register vt_id n;
- register vt_id oldvid;
- register struct vt *v;
- struct vt *curvt;
-
-/* debug stuff
-
- fprintf( stderr, "\t\t\t\t\tInto vt_current( %d )\n", vid );
-
- fprintf( stderr, "VT_front = %d\n", VT_front );
- fprintf( stderr, "VT_back = %d\n", VT_back );
- fprintf( stderr, "VT_curid = %d\n\n", VT_curid );
-
- for ( n = VT_front; n != VT_UNDEFINED; n = v->next )
- {
- v = &VT_array[ n ];
-
- fprintf( stderr, "prev = %d\n", v->prev );
- fprintf( stderr, "VT_array index = %d\n", n );
- fprintf( stderr, "next = %d\n\n", v->next );
- }
-*/
-
- if ( VT_curid == vid && VT_front == vid )
- return VT_curid;
-
-/*
- * makes current vt noncurrent
- */
- if (VT_curid >= 0) {
- curvt = &VT_array[VT_curid];
- curvt->flags |= VT_TDIRTY;
- /*
- * Since active/inactive border colors can be specified
- * for color terminals, border should also be marked dirty
- * on NON-currency.
- */
- if ((!(curvt->flags & VT_NOBORDER)) &&
- Color_terminal == TRUE && Border_colors_differ)
- curvt->flags |= VT_BDIRTY;
- }
-
-/*
- * moves vt to front (without making it current)
- */
-
- if (VT_front != vid)
- {
- for (n = VT_front; n != VT_UNDEFINED; n = v->next)
- {
- v = &VT_array[n];
-
- if (v->next == vid)
- {
- v->next = VT_array[vid].next;
-
- if ( VT_back == vid )
- VT_back = VT_array[ VT_back ].prev;
- else
- {
- v = &VT_array[ vid ];
- VT_array[ v->next ].prev = n;
- }
-
- break;
- }
- }
-
- v = &VT_array[vid];
- v->flags |= VT_BDIRTY;
- VT_array[vid].next = VT_front;
- VT_array[ vid ].prev = VT_UNDEFINED;
-
- if ( VT_front != VT_UNDEFINED )
- VT_array[ VT_front ].prev = vid;
-
- VT_front = vid;
- }
-
-/*
- * makes vt current without moving it to front
- */
- oldvid = VT_curid;
- v = &VT_array[VT_curid = vid];
- v->flags |= VT_TDIRTY;
- /*
- * Since active/inactive border colors can be specified
- * for color terminals, border should also be marked dirty
- * on NON-currency.
- */
- if ((!(v->flags & VT_NOBORDER)) &&
- Color_terminal == TRUE && Border_colors_differ)
- v->flags |= VT_BDIRTY;
-
-/* debug stuff
-
- fprintf( stderr, "\t\t\tAfter change\n" );
- fprintf( stderr, "VT_front = %d\n", VT_front );
- fprintf( stderr, "VT_back = %d\n", VT_back );
- fprintf( stderr, "VT_curid = %d\n\n", VT_curid );
-
- for ( n = VT_front; n != VT_UNDEFINED; n = v->next )
- {
- v = &VT_array[ n ];
-
- fprintf( stderr, "prev = %d\n", v->prev );
- fprintf( stderr, "VT_array index = %d\n", n );
- fprintf( stderr, "next = %d\n\n", v->next );
- }
-*/
- return oldvid;
-}
-
-/* used for debugging (LES)
-
-pr_VT_array()
-{
- FILE *fp, *fopen();
- struct vt *v;
- int n;
-
- fp = fopen( "VT_ARRAY", "a" );
-
- fprintf( fp, "\nVT_front = %d\n", VT_front );
- fprintf( fp, "VT_back = %d\n", VT_back );
- fprintf( fp, "VT_curid = %d\n\n", VT_curid );
-
- for ( n = VT_front; n != VT_UNDEFINED; n = v->next )
- {
- v = &VT_array[ n ];
-
- fprintf( fp, "VT_array index = %d\n", n );
- fprintf( fp, "next = %d\n", v->next );
- fprintf( fp, "prev = %d\n\n", v->prev );
- }
-
- fclose( fp );
-}
-*/
diff --git a/usr/src/cmd/fmli/vt/vdebug.c b/usr/src/cmd/fmli/vt/vdebug.c
deleted file mode 100644
index d621955782..0000000000
--- a/usr/src/cmd/fmli/vt/vdebug.c
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-/*
- * Copyright (c) 1986 AT&T
- * All Rights Reserved
- */
-#ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.1 */
-
-#include <curses.h>
-#include "wish.h"
-#include "vt.h"
-#include "vtdefs.h"
-#include "var_arrays.h"
-
-void
-vt_debug()
-{
- register struct vt *v;
- register vt_id n;
-
- _debug(stderr, "current = %d, front = %d\n", VT_curid, VT_front);
- for (n = VT_front; n != VT_UNDEFINED; n = v->next) {
- v = &VT_array[n];
- _debug(stderr, "VT # %2d(%2d): next = %2d, flags = 0x%x, win = 0x%x, title = '%s'\n", n, v->number, v->next, v->flags, v->win, v->title);
- }
-}
diff --git a/usr/src/cmd/fmli/vt/vflush.c b/usr/src/cmd/fmli/vt/vflush.c
deleted file mode 100644
index 9a75b1b976..0000000000
--- a/usr/src/cmd/fmli/vt/vflush.c
+++ /dev/null
@@ -1,255 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-
-/*
- * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-#include <curses.h>
-#include "wish.h"
-#include "vt.h"
-#include "vtdefs.h"
-#include "attrs.h"
-#include "color_pair.h"
-
-extern int Refresh_slks;
-
-extern int Color_terminal;
-static void vt_title();
-static void vt_scroll_arrow();
-static void vt_page_arrow();
-static void vt_display(void);
-
-void
-vt_flush()
-{
-/*
- _debug3(stderr, "\t--==[ FLUSHING ]==--\n");
-*/
- vt_display();
- if (Refresh_slks) {
- Refresh_slks = 0;
- slk_restore();
- }
- if (VT_front >= 0)
- wnoutrefresh(VT_array[VT_front].win);
- doupdate();
-/*
- _debug3(stderr, "\t--==[ FINISHED ]==--\n");
-*/
-}
-
-static void
-vt_display(void)
-{
- register struct vt *v;
- int colattr;
- vt_id vid;
-
- for ( vid = VT_back; vid != VT_UNDEFINED; vid = v->prev )
- {
- v = &VT_array[vid];
-
- if ( !(v->flags & VT_ANYDIRTY))
- continue;
-
- if (!(v->flags & VT_NOBORDER)) {
- int row, col;
-
- if (v->flags & VT_BDIRTY) /* border dirty */
- {
- getyx(v->win, row, col);
- if (vid == VT_curid)
- colattr = ACTIVE_BORD_PAIR;
- else
- colattr = INACTIVE_BORD_PAIR;
- wattrset(v->win, COL_ATTR(A_NORMAL, colattr));
- box(v->win, 0, 0);
- wattrset(v->win, COL_ATTR(A_NORMAL, WINDOW_PAIR));
- v->flags |= VT_TDIRTY | VT_PADIRTY | VT_SADIRTY;
- wmove(v->win, row, col);
- }
-
- if (v->flags & VT_TDIRTY) /* title dirty */
- {
- getyx(v->win, row, col);
- if (vid == VT_curid)
- vt_title(v, TRUE);
- else
- vt_title(v, FALSE);
- wmove(v->win, row, col);
- }
-
- if (v->flags & VT_PADIRTY) /* page arrow dirty */
- {
- getyx(v->win, row, col);
- if (vid == VT_curid)
- vt_page_arrow(v, TRUE);
- else
- vt_page_arrow(v, FALSE);
- wmove(v->win, row, col);
- }
- if (v->flags & VT_SADIRTY) /* scroll arrow dirty */
- {
- getyx(v->win, row, col);
- if (vid == VT_curid)
- vt_scroll_arrow(v, TRUE);
- else
- vt_scroll_arrow(v, FALSE);
- wmove(v->win, row, col);
- }
- }
- {
- int sr1, sc1, r1, c1;
- int sr2, sc2, r2, c2;
- register vt_id ov;
- register struct vt *vp;
-/*
- _debug3(stderr, "flushing %d(#%d) flags = 0x%x\n", vid, v->number, v->flags);
-*/
- wnoutrefresh(v->win);
- getbegyx(v->win, sr1, sc1);
- getmaxyx(v->win, r1, c1);
- for (ov = VT_front; ov != vid; ov = vp->next) {
- vp = &VT_array[ov];
- getbegyx(vp->win, sr2, sc2);
- getmaxyx(vp->win, r2, c2);
- if (_vt_overlap(sr1, r1, sr2, r2) && _vt_overlap(sc1, c1, sc2, c2))
- vp->flags |= VT_BDIRTY;
- }
- v->flags &= ~VT_ANYDIRTY;
- }
- }
-}
-
-static void
-vt_scroll_arrow(v, active_flag)
-register struct vt *v;
-int active_flag;
-{
- int r;
- int c;
- int colattr;
-
- getmaxyx(v->win, r, c);
- wmove(v->win, r - 1, c - 4);
- if (active_flag == TRUE)
- colattr = ACTIVE_BORD_PAIR;
- else
- colattr = INACTIVE_BORD_PAIR;
- wattrset(v->win, COL_ATTR(A_NORMAL, colattr));
- if (v->flags & VT_UPSARROW)
- waddch(v->win, ACS_UARROW);
- else
- waddch(v->win, ACS_HLINE);
- if (v->flags & VT_DNSARROW)
- waddch(v->win, ACS_DARROW);
- else
- waddch(v->win, ACS_HLINE);
- wattrset(v->win, COL_ATTR(A_NORMAL, WINDOW_PAIR));
-}
-
-static void
-vt_page_arrow(v, active_flag)
-register struct vt *v;
-int active_flag;
-{
- int row, col;
- int colattr;
-
- getmaxyx(v->win, row, col);
- if (row < 5)
- return; /* frame too small */
- if (active_flag) {
- if (!Pair_set[ACTIVE_SCROLL_PAIR] && Pair_set[ACTIVE_TITLE_PAIR])
- colattr = ACTIVE_TITLE_PAIR;
- else
- colattr = ACTIVE_SCROLL_PAIR;
- wattrset(v->win, COL_ATTR(Attr_highlight, colattr));
- }
- else {
- if (!Pair_set[INACTIVE_SCROLL_PAIR] && Pair_set[INACTIVE_TITLE_PAIR])
- colattr = INACTIVE_TITLE_PAIR;
- else
- colattr = INACTIVE_SCROLL_PAIR;
- wattrset(v->win, COL_ATTR(Attr_hide, colattr));
- }
- wmove(v->win, (row /= 2) - 1, col - 1);
- if (v->flags & VT_UPPARROW)
- waddch(v->win, ACS_UARROW);
- else
- waddch(v->win, ' ');
- wmove(v->win, row, col - 1);
- waddch(v->win, ' ');
- wmove(v->win, row + 1, col - 1);
- if (v->flags & VT_DNPARROW)
- waddch(v->win, ACS_DARROW);
- else
- waddch(v->win, ' ');
- wattrset(v->win, COL_ATTR(A_NORMAL, WINDOW_PAIR));
-}
-
-static void
-vt_title(v, active_flag)
-register struct vt *v;
-int active_flag;
-{
- register char *s;
- int c;
- int dummy;
- int bl;
- int const_cols;
-
- if ((s = v->title) == NULL)
- s = nil;
- getmaxyx(v->win, dummy, c);
-
- /*
- * const_cols is # of columns taken up by corners and by number
- * displayed on title line
- */
- if (v->number > 0)
- const_cols = 5;
- else
- const_cols = 2;
- bl = (c - const_cols) / 2 - (strlen(v->title) + 1) / 2;
- if (bl < 0)
- bl = 0;
- c -= bl + const_cols;
- if (active_flag)
- wattrset(v->win, COL_ATTR(Attr_highlight, ACTIVE_TITLE_PAIR));
- else
- wattrset(v->win, COL_ATTR(Attr_hide, INACTIVE_TITLE_PAIR));
- wmove(v->win, 0, 1);
- if (v->number > 0)
-/* abs: changed wprintw to wprintf in following 2 calls */
- wprintw(v->win, "%2d %*s%-*.*s", v->number, bl, "", c, c, s);
- else
- wprintw(v->win, "%*s%-*.*s", bl, "", c, c, s);
- wattrset(v->win, COL_ATTR(A_NORMAL, WINDOW_PAIR));
-}
diff --git a/usr/src/cmd/fmli/vt/vfork.c b/usr/src/cmd/fmli/vt/vfork.c
deleted file mode 100644
index 88eca2719c..0000000000
--- a/usr/src/cmd/fmli/vt/vfork.c
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-/*
- * Copyright (c) 1985 AT&T
- * All Rights Reserved
- */
-#ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.5 */
-
-#include <curses.h>
-#include <term.h>
-#include "wish.h"
-
-/* Functions for use before and after forking processes */
-
-void
-vt_before_fork()
-{
- endwin();
-}
-
-void
-vt_after_fork()
-{
- /*
- * Reset color pairs upon return from UNIX ....
- * If this isn't a color terminal then set_def_colors()
- * returns without doing anything
- *
- * Also re-set mouse information (vinit.c)
- */
- /*
- * Reset PFK for terminals like DMD and 5620
- */
- init_sfk(FALSE);
- set_def_colors();
- set_mouse_info();
-}
-
-void
-fork_clrscr()
-{
- putp(tparm(clear_screen));
- fflush(stdout);
-}
diff --git a/usr/src/cmd/fmli/vt/vinit.c b/usr/src/cmd/fmli/vt/vinit.c
deleted file mode 100644
index 2fd54abac6..0000000000
--- a/usr/src/cmd/fmli/vt/vinit.c
+++ /dev/null
@@ -1,177 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-
-/*
- * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-#include <curses.h>
-#include <signal.h>
-#include <term.h>
-#include "wish.h"
-#include "vt.h"
-#include "vtdefs.h"
-#include "ctl.h"
-#include "attrs.h"
-#include "var_arrays.h"
-#include "token.h"
-
-int Color_terminal = FALSE;
-int curses_initialized = FALSE;
-
-void
-vt_init(labfmt)
-int labfmt; /* format for the SLKS (3-2-3 or 4-4) */
-{
- static char virt[] = "abdehijklnoprtuvwxyz";
- static char virt_f[] = "12345678cdbemruy";
- static token tok_virt[] = {
- /* single key virtualizations */
- TOK_IC, TOK_BEG, TOK_DOWN, TOK_END,
- TOK_BACKSPACE, TOK_TAB, TOK_COMMAND, TOK_DL,
- TOK_LEFT, TOK_NEXT, TOK_IL, TOK_PREVIOUS,
- TOK_RIGHT, TOK_BTAB, TOK_UP, TOK_PPAGE,
- TOK_NPAGE, TOK_DC, TOK_EOL, TOK_COMMAND,
- /* virtualizations starting with control-F */
- TOK_SLK1, TOK_SLK2, TOK_SLK3, TOK_SLK4,
- TOK_SLK5, TOK_SLK6, TOK_SLK7, TOK_SLK8,
- TOK_COMMAND, TOK_SF, TOK_HOME, TOK_SHOME,
- TOK_MARK, TOK_RESET, TOK_SR, TOK_SEOL,
- };
- token *setvirt();
-
- slk_init(labfmt);
- initscr();
- curses_initialized = TRUE;
- if (start_color() == OK)
- Color_terminal = TRUE;
- set_mouse_info();
- nonl();
- noecho();
- set_term_ioctl();
- /* set up key virtualizations */
- setvt_attrs(); /* set up video attribute array */
- (void) setvirt('f', virt_f, setvirt('\0', virt, tok_virt));
- VT_array = NULL;
- VT_front = VT_UNDEFINED;
- VT_curid = VT_UNDEFINED;
- vt_ctl(VT_UNDEFINED, CTSETLIM, 0, LINES);
-
- /*
- * banner line
- */
- vt_current(vt_create(NULL, VT_NOBORDER | VT_NONUMBER, 0, 0, 1, columns));
- VT_back = VT_curid;
-
- /*
- * command line
- */
- vt_current(vt_create(NULL, VT_NOBORDER | VT_NONUMBER, LINES - 1, 0, 1, columns));
-
- /*
- * message line
- */
- vt_current(vt_create(NULL, VT_NOBORDER | VT_NONUMBER, LINES - 2, 0, 1, columns));
- vt_ctl(VT_UNDEFINED, CTSETLIM, 1, LINES - 2);
-}
-
-#define control(X) ((X) & ' ' - 1)
-
-int
-set_mouse_info()
-{
-/* #ifdef i386 abs k18 */
- mouse_set(BUTTON1_PRESSED | BUTTON1_RELEASED |
- BUTTON2_PRESSED | BUTTON2_RELEASED |
- BUTTON3_PRESSED | BUTTON3_RELEASED);
- map_button(BUTTON1_RELEASED);
-/*
- *
-#else
- return;
-#endif
- * abs k18
- */
- return (0);
-}
-
-token *
-setvirt(first, string, toks)
-char first;
-char *string;
-token *toks;
-{
- char keybuf[4];
-
- keybuf[1] = keybuf[2] = '\0';
- keybuf[0] = control(first);
- while (*string) {
- if (first)
- keybuf[1] = *string++;
- else
- keybuf[0] = control(*string++);
- newkey(keybuf, (int) (*toks++), TRUE);
- }
- return toks;
-}
-
-int
-set_term_ioctl()
-{
- register int fd;
- struct termio tbuf;
-
- fd = -1;
- tbuf.c_iflag = (unsigned short) 0;
- tbuf.c_lflag = (unsigned short) 0;
- tbuf.c_oflag = (unsigned short) 0;
- if (ioctl(0, TCGETA, &tbuf) == 0)
- fd = 0;
- else if (ioctl(1, TCGETA, &tbuf) == 0)
- fd = 1;
- else if (ioctl(2, TCGETA, &tbuf) == 0)
- fd = 2;
- if (fd >= 0) {
-/* tbuf.c_cc[VINTR] = 0xff; ignore instead... abs */
- sigignore(SIGINT); /* ... abs */
- tbuf.c_cc[VQUIT] = 0xff;
- tbuf.c_cc[VMIN] = 1;
- tbuf.c_cc[VTIME] = 1;
- tbuf.c_iflag &= ~(ICRNL | INLCR);
- tbuf.c_iflag |= IGNBRK;
- tbuf.c_lflag &= ~(ICANON | ECHO | ECHOE | ECHOK | ECHONL);
-#ifdef TOSTOP /* for job control - to prevent running in background.. */
- /* ..we want to suspend on pending output */
- tbuf.c_lflag |= TOSTOP;
-#endif
- tbuf.c_oflag &= ~(OPOST);
- ioctl(fd, TCSETAW, &tbuf);
- def_prog_mode();
- }
- return (0);
-}
diff --git a/usr/src/cmd/fmli/vt/vmark.c b/usr/src/cmd/fmli/vt/vmark.c
deleted file mode 100644
index 3a356058bd..0000000000
--- a/usr/src/cmd/fmli/vt/vmark.c
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-/*
- * Copyright (c) 1986 AT&T
- * All Rights Reserved
- */
-#ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.2 */
-
-#include <curses.h>
-#include "wish.h"
-#include "vt.h"
-#include "vtdefs.h"
-
-void
-_vt_mark_overlap(v)
-register struct vt *v;
-{
- register int n;
- int sr1, r1, sc1, c1;
- int sr2, r2, sc2, c2;
- register struct vt *vp;
-
- getbegyx(v->win, sr1, sc1);
- getmaxyx(v->win, r1, c1);
-#ifdef _DEBUG
- _debug3(stderr, "vmark: window %d(#%d) - %d,%d %d,%d\n", v - VT_array, v->number, sr1, sc1, r1, c1);
-#endif
- for (n = VT_front; n != VT_UNDEFINED; n = vp->next) {
- vp = &VT_array[n];
- getbegyx(vp->win, sr2, sc2);
- getmaxyx(vp->win, r2, c2);
- if (_vt_overlap(sr1, r1, sr2, r2) && _vt_overlap(sc1, c1, sc2, c2)) {
-#ifdef _DEBUG
- _debug3(stderr, "\t\tmarking %d(#%d) dirty\n", n, vp->number);
-#endif
- vp->flags |= VT_BDIRTY;
- }
- }
-}
diff --git a/usr/src/cmd/fmli/vt/vreshape.c b/usr/src/cmd/fmli/vt/vreshape.c
deleted file mode 100644
index a94741e084..0000000000
--- a/usr/src/cmd/fmli/vt/vreshape.c
+++ /dev/null
@@ -1,93 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-
-/*
- * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-#include <curses.h>
-#include <term.h>
-#include "wish.h"
-#include "vt.h"
-#include "vtdefs.h"
-#include "color_pair.h"
-
-/*
- * reshape a VT
- */
-int
-vt_reshape(vid, srow, scol, rows, cols)
-vt_id vid;
-int srow;
-int scol;
-unsigned rows;
-unsigned cols;
-{
- register struct vt *v;
- extern int VT_firstline;
-
- if (off_screen(srow, scol, rows, cols)) {
-#ifdef _DEBUG
- _debug(stderr, "off_screen FAILED!!! This should never happen here!!!\n");
-#endif
- return FAIL;
- }
- srow += VT_firstline;
- /* pick a window number (if appropriate) */
- v = &VT_array[vid];
- /* set up v */
- _vt_hide(vid, TRUE);
- if ((v->win = newwin(rows, cols, srow, scol)) == NULL) {
-#ifdef _DEBUG
- _debug(stderr, "newwin\n");
-#endif
- return FAIL;
- }
- notimeout(v->win, TRUE);
- if (v->subwin) {
- if ((v->subwin = subwin(v->win, rows-2, cols-2, srow+1, scol+1)) == NULL) {
-#ifdef _DEBUG3
- _debug3(stderr, "subwin\n");
-#endif
- return FAIL;
- }
- notimeout(v->subwin, TRUE);
- }
- if (Color_terminal == TRUE) {
- wbkgd(v->win, COL_ATTR(0, WINDOW_PAIR));
- wattrset(v->win, COL_ATTR(0, WINDOW_PAIR));
- }
- keypad(v->win, TRUE);
- if (v->flags & VT_NOBORDER)
- wmove(v->win, 0, 0);
- else
- wmove(v->win, 1, 1);
- v->flags |= VT_ANYDIRTY;
- vt_current(vid);
- return SUCCESS;
-}
diff --git a/usr/src/cmd/fmli/vt/wclrwin.c b/usr/src/cmd/fmli/vt/wclrwin.c
deleted file mode 100644
index 0b059651ab..0000000000
--- a/usr/src/cmd/fmli/vt/wclrwin.c
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-/*
- * Copyright (c) 1986 AT&T
- * All Rights Reserved
- */
-#ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.1 */
-
-#include <curses.h>
-#include "wish.h"
-#include "vtdefs.h"
-#include "vt.h"
-#include "attrs.h"
-
-void
-wclrwin()
-{
- register struct vt *v;
-
- v = &VT_array[VT_curid];
- wclrtobot(v->win);
- v->flags |= VT_BDIRTY;
-}
diff --git a/usr/src/cmd/fmli/vt/wdelchar.c b/usr/src/cmd/fmli/vt/wdelchar.c
deleted file mode 100644
index 286749f9a2..0000000000
--- a/usr/src/cmd/fmli/vt/wdelchar.c
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-/*
- * Copyright (c) 1986 AT&T
- * All Rights Reserved
- */
-#ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.1 */
-
-#include <curses.h>
-#include "wish.h"
-#include "vtdefs.h"
-#include "vt.h"
-
-void
-wdelchar()
-{
- register struct vt *v;
-
- v = &VT_array[VT_curid];
- v->flags |= VT_DIRTY;
- if (!(v->flags & VT_NOBORDER)) {
- /*
- * insert character before border
- * (not necessary yet, handled in fields)
- */
- ;
- }
- wdelch(v->win);
-}
diff --git a/usr/src/cmd/fmli/vt/wgetchar.c b/usr/src/cmd/fmli/vt/wgetchar.c
deleted file mode 100644
index 3feaae1b58..0000000000
--- a/usr/src/cmd/fmli/vt/wgetchar.c
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-/*
- * Copyright (c) 1986 AT&T
- * All Rights Reserved
- */
-#ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.1 */
-
-#include <curses.h>
-#include "wish.h"
-#include "vtdefs.h"
-#include "vt.h"
-#include "token.h"
-
-token
-wgetchar()
-{
- register struct vt *v;
-
- v = &VT_array[VT_curid];
- return (token) wgetch(v->win);
-}
diff --git a/usr/src/cmd/fmli/vt/wgo.c b/usr/src/cmd/fmli/vt/wgo.c
deleted file mode 100644
index 5dffe3f88e..0000000000
--- a/usr/src/cmd/fmli/vt/wgo.c
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-/*
- * Copyright (c) 1986 AT&T
- * All Rights Reserved
- */
-#ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.1 */
-
-#include <curses.h>
-#include "wish.h"
-#include "vtdefs.h"
-#include "vt.h"
-
-void
-wgo(r, c)
-unsigned r;
-unsigned c;
-{
- register struct vt *v;
- int mr, mc;
-
- v = &VT_array[VT_curid];
- getmaxyx(v->win, mr, mc);
- if (!(v->flags & VT_NOBORDER)) {
- r++;
- c++;
- mr--;
- mc--;
- }
- if (r > mr || c > mc)
- return;
- wmove(v->win, r, c);
- v->flags |= VT_DIRTY;
-}
diff --git a/usr/src/cmd/fmli/vt/winprintf.c b/usr/src/cmd/fmli/vt/winprintf.c
deleted file mode 100644
index 33ad813592..0000000000
--- a/usr/src/cmd/fmli/vt/winprintf.c
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-/*
- * Copyright (c) 1986 AT&T
- * All Rights Reserved
- */
-
-/*
- * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-#include <curses.h>
-#include <stdarg.h>
-#include "wish.h"
-#include "vt.h"
-
-void
-winprintf(char *fmt, ...)
-{
- va_list ap;
- char buf[BUFSIZ];
-
- va_start(ap, fmt);
- vsprintf(buf, fmt, ap);
- va_end(ap);
- winputs(buf, NULL);
-}
diff --git a/usr/src/cmd/fmli/vt/winputs.c b/usr/src/cmd/fmli/vt/winputs.c
deleted file mode 100644
index fed5922bd6..0000000000
--- a/usr/src/cmd/fmli/vt/winputs.c
+++ /dev/null
@@ -1,262 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-/*
- * Copyright (c) 1986 AT&T
- * All Rights Reserved
- */
-#ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.5 */
-
-#include <curses.h>
-#include "wish.h"
-#include "vt.h"
-#include "attrs.h"
-
-char *attr_off();
-char *attr_on();
-
-/*
- ----------------------------------------------------------------------------
- winputs
- output the string `s' to window `w' after processing escape sequences.
- Calls wputchar to output characters. If `w' is NULL wputchar will
- write to the current window. Escape processing involves replacing
- \b \n \r \t with backspace, newline, carrage return or tab characters
- respectively, or setting/clearing video attributes when \+ or \-
- sequences are found. Video attributes remain in effect for the
- rest of the string s (only).
- ----------------------------------------------------------------------------
-*/
-
-void
-winputs(s, win)
-char *s;
-WINDOW *win;
-{
- register char *p;
- chtype attrs = Attr_normal;
-
- for (p = s; *p; p++) {
- if (*p == '\\') {
- switch(*(++p)) {
- case 'b':
- *p = '\b';
- break;
- case '-': /* turn off output attribute */
- p = attr_off(p, &attrs, win );
- continue; /* don't need to wputchar */
- case 'n':
- *p = '\n';
- break;
- case '+': /* turn on output attribute */
- p = attr_on(p, &attrs, win);
- continue; /* don't need to wputchar */
- case 'r':
- *p = '\r';
- break;
- case 't':
- *p = '\t';
- break;
- case '\0':
- return;
- }
- }
- wputchar(*p, attrs, win);
- }
-}
-
-
-/* -----------------------------------------------------------------------------
- attr_on
- Finish parsing an escape sequence of the form `\+at' where `at'
- is a 2 character code for the video attribute to turn on. The
- `\+' have already been parsed before calling this routine.
- ACTION: outputs a `\' if the attribute requested is unknown.
- SIDE EFFECTS: set bits in `attrs' corresponding to the attribute to
- be turned on.
- RETURN VALUE: if successful, pointer to the last character in the
- escape sequence; else pointer to the character before
- the 1st one parsed (ie. to the `+')
-
- ----------------------------------------------------------------------------- */
-char *
-attr_on(p, attrs, win)
-char *p;
-chtype *attrs;
-WINDOW *win;
-{
- p++;
- switch(*(p++))
- {
- case 'a':
- if (*p == 'c')
- {
- *attrs |= A_ALTCHARSET;
- return(p);
- }
- break;
- case 'b':
- if (*p == 'd')
- {
- *attrs |= A_BOLD;
- return(p);
- }
- else if (*p == 'k')
- {
- *attrs |= A_BLINK;
- return(p);
- }
- break;
- case 'd':
- if (*p == 'm')
- {
- *attrs |= A_DIM;
- return(p);
- }
- break;
- case 'n':
- if (*p == 'm')
- {
- *attrs = A_NORMAL;
- return(p);
- }
- break;
- case 'r':
- if (*p == 'v')
- {
- *attrs |= A_REVERSE;
- return(p);
- }
- break;
- case 's':
- if (*p == 'o')
- {
- *attrs |= A_STANDOUT;
- return(p);
- }
- break;
- case 'u':
- if (*p == 'l')
- {
- *attrs |= A_UNDERLINE;
- return(p);
- }
- break;
- default:
- break;
- }
- wputchar ('\\', *attrs, win);
- p -= 3;
-
- return (p);
-}
-
-/* -----------------------------------------------------------------------------
- attr_off
- Finish parsing an escape sequence of the form `\-at' where `at'
- is a 2 character code for the video attribute to turn off. The
- `\-' have already been parsed before calling this routine.
- ACTION: outputs a `\' if the attribute requested is unknown.
- SIDE EFFECTS: clears the bits in `attrs' corresponding to the
- attribute to be turned on.
- RETURN VALUE: if successful, pointer to the last character in the
- escape sequence; else pointer to the character before
- the 1st one parsed (ie. to the `-')
-
- ----------------------------------------------------------------------------- */
-
-
-char *
-attr_off(p, attrs, win)
-char *p;
-chtype *attrs;
-WINDOW *win;
-{
-
- p++;
- switch(*(p++))
- {
- case 'a':
- if (*p == 'c')
- {
- *attrs &= ~A_ALTCHARSET;
- return(p);
- }
- break;
- case 'b':
- if (*p == 'd')
- {
- *attrs &= ~A_BOLD;
- return(p);
- }
- else if (*p == 'k')
- {
- *attrs &= ~A_BLINK;
- return(p);
- }
- break;
- case 'd':
- if (*p == 'm')
- {
- *attrs &= ~A_DIM;
- return(p);
- }
- break;
- case 'n':
- if (*p == 'm')
- {
- /* not meaningful -- ignore. */
- return(p);
- }
- break;
- case 'r':
- if (*p == 'v')
- {
- *attrs &= ~A_REVERSE;
- return(p);
- }
- break;
- case 's':
- if (*p == 'o')
- {
- *attrs &= ~A_STANDOUT;
- return(p);
- }
- break;
- case 'u':
- if (*p == 'l')
- {
- *attrs &= ~A_UNDERLINE;
- return(p);
- }
- break;
- default:
- break;
- }
- wputchar ('\\', *attrs, win);
- p -= 3;
-
- return (p);
-}
diff --git a/usr/src/cmd/fmli/vt/winschar.c b/usr/src/cmd/fmli/vt/winschar.c
deleted file mode 100644
index 77399e8c96..0000000000
--- a/usr/src/cmd/fmli/vt/winschar.c
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-/*
- * Copyright (c) 1986 AT&T
- * All Rights Reserved
- */
-#ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.3 */
-
-#include <curses.h>
-#include "wish.h"
-#include "vtdefs.h"
-#include "vt.h"
-
-void
-winschar(ch, attr)
-char ch;
-unsigned attr;
-{
- register struct vt *v;
-
- v = &VT_array[VT_curid];
- v->flags |= VT_DIRTY;
- if (!(v->flags & VT_NOBORDER)) {
- /*
- * delete character before border
- * (not necessary yet, handled in fields)
- */
- ;
- }
- winsch(v->win, ch | attr);
-}
diff --git a/usr/src/cmd/fmli/vt/working.c b/usr/src/cmd/fmli/vt/working.c
deleted file mode 100644
index 06b28d6266..0000000000
--- a/usr/src/cmd/fmli/vt/working.c
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-/*
- * Copyright (c) 1986 AT&T
- * All Rights Reserved
- */
-#ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.4 */
-
-#include <curses.h>
-#include "wish.h"
-#include "vt.h"
-#include "vtdefs.h"
-
-/* set in if_init.c */
-extern int Work_col;
-extern char *Work_msg;
-
-/*
- * puts up or removes "Working" message on status line at "Work_col"
- */
-
-void
-working(flag)
-bool flag;
-{
-/* new */
- WINDOW *win;
-
- win = VT_array[ STATUS_WIN ].win;
- if (flag)
- mvwaddstr(win, 0, Work_col, Work_msg);
- else {
- wmove(win, 0, Work_col);
- wclrtoeol(win); /* assumes right-most! */
- }
- wnoutrefresh( win );
- if ( flag )
- doupdate();
-}
diff --git a/usr/src/cmd/fmli/vt/wputchar.c b/usr/src/cmd/fmli/vt/wputchar.c
deleted file mode 100644
index b7d0e87039..0000000000
--- a/usr/src/cmd/fmli/vt/wputchar.c
+++ /dev/null
@@ -1,217 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-/*
- * Copyright (c) 1986 AT&T
- * All Rights Reserved
- */
-#ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.5 */
-
-#include <curses.h>
-#include "wish.h"
-#include "vtdefs.h"
-#include "vt.h"
-/*
- --------------------------------------------------------------------------------
- wputchar
- Output character `ch' to window `w' with video attributes `attr'.
- If w is NULL, output goes to window associated with the current frame
- (VT_curid).
- --------------------------------------------------------------------------------
-*/
-void
-wputchar(ch, attr, w)
-char ch;
-chtype attr;
-WINDOW *w;
-{
- register chtype c;
- register WINDOW *win;
- register struct vt *v;
- int row, col;
-
- c = ch;
-
- if ((win=w) == NULL)
- {
- v = &VT_array[VT_curid];
- v->flags |= VT_DIRTY;
- win = v->win;
- }
-
- if ( ch > 037 && ch < 0177 )
- {
- if (attr & A_ALTCHARSET) /* map input into graphics chars */
- { /* as defined in FMLI manual */
- switch (ch) /* 1 */
- { /* d--------a */
- case 'a': /* | | | */
- c = ACS_URCORNER; /* 4|----+---|2 */
- break; /* | | | */
- case 'b': /* c--------b */
- c = ACS_LRCORNER; /* 3 */
- break;
- case 'c':
- c = ACS_LLCORNER;
- break;
- case 'd':
- c = ACS_ULCORNER;
- break;
- case '1':
- c = ACS_TTEE;
- break;
- case '2':
- c = ACS_RTEE;
- break;
- case '3':
- c = ACS_BTEE;
- break;
- case '4':
- c = ACS_LTEE;
- break;
- case '-':
- c = ACS_HLINE;
- break;
- case '|':
- c = ACS_VLINE;
- break;
- case '+':
- c = ACS_PLUS;
- break;
- case '<':
- c = ACS_LARROW;
- break;
- case '>':
- c = ACS_RARROW;
- break;
- case 'v':
- c = ACS_DARROW;
- attr &= ~A_ALTCHARSET; /* kluge to avoid curses bug */
- break;
- case '^':
- c = ACS_UARROW;
- break;
- /* the following characters are not found in the fmli */
- /* documentation but except for # conform to the vt100 */
- /* alternate charset. see terminfo(4) */
- case '0':
- c = ACS_BLOCK;
- break;
- case 'I':
- c = ACS_LANTERN;
- break;
- case '\'':
- c = ACS_DIAMOND;
- break;
- case '#':
- c = ACS_CKBOARD;
- break;
- case 'f':
- c = ACS_DEGREE;
- break;
- case 'g':
- c = ACS_PLMINUS;
- break;
- case 'h':
- c = ACS_BOARD;
- break;
- case 'o':
- c = ACS_S1;
- break;
- case 's':
- c = ACS_S9;
- break;
- case '~':
- c = ACS_BULLET;
- break;
- default: /* turn off alt char set for unrecognized chars */
- attr &= ~A_ALTCHARSET;
- break;
- }
- }
- waddch(win, c | attr);
- return;
- }
-
- getyx(win, row, col);
-
- switch (c) {
- case MENU_MARKER:
- c = ACS_RARROW;
-/* les */
- waddch(win, c | attr);
-/***/
- return;
- case '\n':
- wmove(win, row + 1, 1);
- return;
- case '\b':
- wmove(win, row, col - 1);
- return;
- case '\t':
- wmove(win, row, (col + 8) & ~7);
- return;
- case '\r':
- wmove(win, row, 1);
- return;
- default:
- if (c < ' ')
- return;
- break;
- }
-}
-/* EVERYTHING BELOW here is COMMENTED OUT */
-/* abs: removed dependency on VT_NOBORDER and moved \n\b\t\r code into above case stmt
-
- if (!(v->flags & VT_NOBORDER)) {
- int row, col;
- int mr, mc;
-
- getyx(win, row, col);
-*/
-/* les: not used
- getmaxyx(win, mr, mc);
-*/
-/* abs: same as above
- switch (c) {
- case '\n':
- wmove(win, row + 1, 1);
- return;
- case '\b':
- wmove(win, row, col - 1);
- return;
- case '\t':
- wmove(win, row, (col + 8) & ~7);
- return;
- case '\r':
- wmove(win, row, 1);
- return;
- }
- }
-*/
-/* les: move to top
- waddch(v->win, c | highlights(attr));
-}
-*/
diff --git a/usr/src/cmd/fmli/vt/wreadchar.c b/usr/src/cmd/fmli/vt/wreadchar.c
deleted file mode 100644
index d6e2549d5d..0000000000
--- a/usr/src/cmd/fmli/vt/wreadchar.c
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-
-/*
- * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-#include <curses.h>
-#include "wish.h"
-#include "vtdefs.h"
-#include "vt.h"
-
-char
-wreadchar(row, col)
-unsigned row;
-unsigned col;
-{
- register struct vt *v;
- int savey, savex;
- register char ch;
-
- v = &VT_array[VT_curid];
- getyx(v->win, savey, savex);
- if (!(v->flags & VT_NOBORDER)) {
- row++;
- col++;
- }
- ch = (char)(mvwinch(v->win, row, col) & A_CHARTEXT);
- wmove(v->win, savey, savex); /* return cursor */
- return(ch);
-}
diff --git a/usr/src/cmd/fmli/vt/wscrollwin.c b/usr/src/cmd/fmli/vt/wscrollwin.c
deleted file mode 100644
index 68ff46fdd1..0000000000
--- a/usr/src/cmd/fmli/vt/wscrollwin.c
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-/*
- * Copyright (c) 1986 AT&T
- * All Rights Reserved
- */
-#ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.1 */
-
-#include <curses.h>
-#include "wish.h"
-#include "vtdefs.h"
-#include "vt.h"
-#include "attrs.h"
-
-void
-wscrollwin(n)
-int n;
-{
- register struct vt *v;
- int r;
- int c;
- register int top;
-
- v = &VT_array[VT_curid];
- getmaxyx(v->win, r, c);
- r--;
- top = 0;
- if (!(v->flags & VT_NOBORDER)) {
- top++;
- r--;
- }
- while (n < 0) {
- wmove(v->win, r, 0);
- wdeleteln(v->win);
- wmove(v->win, top, 0);
- winsertln(v->win);
- n++;
- }
- while (n > 0) {
- wmove(v->win, top, 0);
- wdeleteln(v->win);
- wmove(v->win, r, 0);
- winsertln(v->win);
- n--;
- }
- v->flags |= VT_BDIRTY;
- wmove(v->win, r, c);
-}
diff --git a/usr/src/cmd/fmli/wish/Makefile b/usr/src/cmd/fmli/wish/Makefile
deleted file mode 100644
index c649146f35..0000000000
--- a/usr/src/cmd/fmli/wish/Makefile
+++ /dev/null
@@ -1,56 +0,0 @@
-#
-# CDDL HEADER START
-#
-# The contents of this file are subject to the terms of the
-# Common Development and Distribution License, Version 1.0 only
-# (the "License"). You may not use this file except in compliance
-# with the License.
-#
-# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
-# or http://www.opensolaris.org/os/licensing.
-# See the License for the specific language governing permissions
-# and limitations under the License.
-#
-# When distributing Covered Code, include this CDDL HEADER in each
-# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
-# If applicable, add the following below this CDDL HEADER, with the
-# fields enclosed by brackets "[]" replaced with your own identifying
-# information: Portions Copyright [yyyy] [name of copyright owner]
-#
-# CDDL HEADER END
-#
-#
-# Copyright 2004 Sun Microsystems, Inc. All rights reserved.
-# Use is subject to license terms.
-#
-# ident "%Z%%M% %I% %E% SMI"
-#
-# cmd/fmli/wish/Makefile
-#
-LIBRARY = libwish.a
-
-OBJECTS = browse.o display.o error.o flush.o getstring.o global.o \
- mudge.o objop.o stubs.o virtual.o wdwcreate.o wdwlist.o \
- wdwmgmt.o
-
-# include library definitions
-include ../../../lib/Makefile.lib
-
-C99MODE= $(C99_DISABLE)
-
-# Specifically request the construction of a static library.
-# This library is not installed in the proto area.
-LIBS = $(LIBRARY)
-
-# inc must be first.
-CPPFLAGS = -I../inc $(CPPFLAGS.master)
-
-.KEEP_STATE:
-
-all: $(LIBS)
-
-install: all
- @echo "$(LIBRARY) is not installed."
-
-# include library targets
-include ../../../lib/Makefile.targ
diff --git a/usr/src/cmd/fmli/wish/browse.c b/usr/src/cmd/fmli/wish/browse.c
deleted file mode 100644
index 4d040e69c8..0000000000
--- a/usr/src/cmd/fmli/wish/browse.c
+++ /dev/null
@@ -1,210 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/*
- * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-/* Copyright (c) 1984, 1985, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-#include <stdio.h>
-#include "wish.h"
-#include "token.h"
-#include "slk.h"
-#include "actrec.h"
-#include "terror.h"
-#include "ctl.h"
-#include "moremacros.h"
-
-#define BROWSE 1
-#define PROMPT 2
-
-/*
- * Caution: MAX_ARGS is defined in other files and should ultimately reside
- * in wish.h
- */
-#define MAX_ARGS 25
-
-extern int Arg_count;
-extern char *Args[];
-extern char *tok_to_cmd(); /* abs k16 */
-char *Pending_op, *Pending_objtype, *Pending_argv[MAX_ARGS+2];
-struct slk *Pending_slks;
-int Pending_type;
-static void save_browse();
-static token namevalid(char *s, token t);
-static char name_string[] = "Enter the new object name: ";
-static char desc_string[] = "Enter the new description: ";
-
-int Browse_mode = 0;
-
-int
-enter_browse(op, objtype, argv)
-char *op, *objtype, *argv[];
-{
- extern struct slk Browslk[], Defslk[];
-
- Browse_mode++;
- save_browse(op, objtype, argv);
- setslks(NULL, 0);
- mess_temp("Open or navigate to the destination folder and press SELECT");
- Pending_type = BROWSE;
- return (0);
-}
-
-int
-enter_getname(op, objtype, argv)
-char *op, *objtype, *argv[];
-{
- save_browse(op, objtype, argv);
- Pending_type = PROMPT;
- get_string(namevalid, strCcmp(Pending_op, "redescribe") ? name_string : desc_string, "", 0, FALSE, Pending_op, Pending_op);
- return (0);
-}
-
-static token
-namevalid(char *s, token t)
-{
- register int i;
- char *errstr;
-
- if (t == TOK_CANCEL) {
- if ( Browse_mode )
- glob_browse_cancel();
- else
- Pending_op = NULL;
- return TOK_NOP;
- }
-
- if (strCcmp(Pending_op, "create") == 0) {
- if (namecheck(Pending_argv[0], s, NULL, &errstr, TRUE) == FALSE) {
- get_string(namevalid, name_string, "", 0, FALSE, Pending_op, Pending_op);
- mess_temp(errstr);
- return TOK_NOP;
- }
- } else if (strCcmp(Pending_op, "redescribe") != 0) {
- if (namecheck(Pending_argv[1], s, Pending_objtype, &errstr, TRUE)==FALSE) {
- get_string(namevalid, name_string, "", 0, FALSE, Pending_op, Pending_op);
- mess_temp(errstr);
- return TOK_NOP;
- }
- }
-/*
- * Notice that redescribe falls thru the above if block without ever
- * calling namecheck!
- */
-
- for (i = 0; Pending_argv[i]; i++)
- ;
- Pending_argv[i] = strsave(s);
- Pending_argv[i+1] = NULL;
- glob_select();
- return(TOK_NOP);
-}
-
-int
-glob_select(void)
-{
- register int i, prevtype = Pending_type;
- bool canselect;
-
- if (Pending_type == BROWSE) {
- if (ar_ctl(ar_get_current(), CTISDEST, &canselect, NULL, NULL, NULL, NULL, NULL) == FAIL || !canselect) {
- mess_temp("This frame can not be used as a destination");
- return (0);
- }
- for (i = 0; Pending_argv[i]; i++)
- ;
-
- Pending_argv[i] = strsave(ar_get_current()->path);
- Pending_argv[i+1] = NULL;
- }
-
- if (strcmp(Pending_op, "redescribe") == 0) {
- working(TRUE);
- redescribe(&Pending_argv[0]);
- } else if (strcmp(Pending_op, "create") == 0) {
- working(TRUE);
- Create_create(&Pending_argv[0]);
- } else {
- mess_perm(NULL);
- working(TRUE);
- (void) objopv(Pending_op, Pending_objtype, Pending_argv);
- }
-
- if (Pending_type == prevtype)
- glob_browse_cancel();
- ar_checkworld(TRUE);
- return (0);
-}
-
-int
-glob_browse_cancel()
-{
- Browse_mode = 0;
- ar_setslks(ar_get_current()->slks, 0);
- if (Pending_op) {
- register int i;
-
- free(Pending_op);
- Pending_op = NULL;
- if (Pending_objtype) {
- free(Pending_objtype);
- Pending_objtype = NULL;
- }
- for (i = 0; Pending_argv[i]; i++) {
- free(Pending_argv[i]);
- Pending_argv[i] = NULL;
- }
- }
- return (0);
-}
-
-token
-glob_mess_nosrc(t)
-token t;
-{
- char *cmd_name = tok_to_cmd(t); /* abs k16 */
-
- if (cmd_name) /* abs k16 */
- mess_temp(nstrcat("Can't ", cmd_name, " from this frame", NULL));
- else
- beep(); /* abs k16 */
- return(t);
-}
-
-static void
-save_browse(op, objtype, argv)
-char *op, *objtype, *argv[];
-{
- register int i;
-
- Pending_op = strsave(op);
- Pending_objtype = strsave(objtype);
- Pending_slks = ar_get_current()->slks;
- for (i = 0; argv[i]; i++)
- Pending_argv[i] = strsave(argv[i]);
- Pending_argv[i] = NULL;
-}
diff --git a/usr/src/cmd/fmli/wish/display.c b/usr/src/cmd/fmli/wish/display.c
deleted file mode 100644
index bd0bde4df1..0000000000
--- a/usr/src/cmd/fmli/wish/display.c
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-/*
- * Copyright (c) 1985 AT&T
- * All Rights Reserved
- */
-#ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.6 */
-
-#include <stdio.h>
-#include <sys/types.h> /* EFT abs k16 */
-#include "wish.h"
-#include "typetab.h"
-#include "sizes.h"
-
-int
-glob_display (path)
-char *path;
-{
- char *vpath;
- char title[PATHSIZ];
- struct ott_entry *path_to_ott();
- char *path_to_vpath();
- char *bsd_path_to_title();
- struct ott_entry *ott, *path_to_ott();
-
- if ((vpath = path_to_vpath(path)) == NULL) {
- if ( access(path,00) )
- mess_temp(nstrcat(bsd_path_to_title(path,MESS_COLS - 16)," does not exist.",NULL));
- else
- mess_temp(nstrcat(bsd_path_to_title(path,MESS_COLS - 20)," is not displayable.",NULL));
- return(FAIL);
- }
- ott = path_to_ott(path);
- sprintf(title, "%s/%s", parent(path), ott->dname);
- return(objop("OPEN", "TEXT", "$VMSYS/OBJECTS/Text.disp", vpath,
- bsd_path_to_title(title,MAX_TITLE - 3 - strlen(ott->display)),
- ott->display, NULL));
-}
diff --git a/usr/src/cmd/fmli/wish/error.c b/usr/src/cmd/fmli/wish/error.c
deleted file mode 100644
index 9edfd7565b..0000000000
--- a/usr/src/cmd/fmli/wish/error.c
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-/*
- * Copyright (c) 1985 AT&T
- * All Rights Reserved
- */
-#ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.2 */
-
-#include <stdio.h>
-#include "wish.h"
-#include "token.h"
-
-token
-error_stream(t)
-register token t;
-{
- if (t == TOK_LOGOUT || t == TOK_NOP)
- return t;
- flushinp();
- switch (t) {
- case TOK_BADCHAR:
- default:
-#ifdef _DEBUG
- _debug(stderr, "error: token = %d\n", t);
-#endif
- beep();
- break;
- }
- return TOK_NOP;
-}
diff --git a/usr/src/cmd/fmli/wish/flush.c b/usr/src/cmd/fmli/wish/flush.c
deleted file mode 100644
index 0ecbe58a69..0000000000
--- a/usr/src/cmd/fmli/wish/flush.c
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-/*
- * Copyright (c) 1986 AT&T
- * All Rights Reserved
- */
-#ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.1 */
-
-#include <stdio.h>
-#include "wish.h"
-
-void
-flush_output()
-{
- vt_flush();
-}
diff --git a/usr/src/cmd/fmli/wish/getstring.c b/usr/src/cmd/fmli/wish/getstring.c
deleted file mode 100644
index 86854921cd..0000000000
--- a/usr/src/cmd/fmli/wish/getstring.c
+++ /dev/null
@@ -1,197 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/*
- * Copyright 1997 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-#include <stdio.h>
-#include <ctype.h>
-#include <curses.h>
-#include "wish.h"
-#include "vtdefs.h"
-#include "token.h"
-#include "actrec.h"
-#include "slk.h"
-#include "winp.h"
-#include "moremacros.h"
-
-struct prompt {
- token (*myfunc)();
- struct actrec *rec;
- char *prompt;
- char *init;
- bool helpismenu;
- char *helpfile;
- char *helptitle;
- int flags;
-};
-
-static struct prompt p = { NULL, NULL, NULL, NULL, 0};
-static struct actrec *prompt_actrec;
-
-extern int Vflag;
-
-static int
-prompt_noncur(a, all)
-struct actrec *a;
-bool all;
-
-{
-#ifdef _DEBUG
- _debug(stderr, "clearing PROMPT MODE\n");
-#endif
- wgo(0, 0);
- wclrwin();
- return SUCCESS;
-}
-
-static int
-prompt_ctl(rec, cmd, a1, a2, a3, a4, a5, a6)
-struct actrec *rec;
-int cmd;
-int a1, a2, a3, a4, a5, a6;
-{
-#ifdef _DEBUG
- _debug(stderr, "prompt_ctl(0x%x, %d, %d, %d)\n", rec, cmd, a1, a2);
-#endif
- return vt_ctl(rec->id, cmd, a1, a2, a3, a4, a5, a6);
-}
-
-static token
-prompt_stream(rec, t)
-struct actrec *rec;
-register token t;
-{
- register char *s;
- char *fldval, *getfield();
-
- switch (t = field_stream(t)) {
- case TOK_SAVE:
- fldval = getfield(NULL, NULL);
- s = strsave(fldval);
- break;
- case TOK_CANCEL:
- s = NULL;
- break;
- case TOK_NOP:
- case TOK_HELP:
- return t;
- default:
- return t | TOK_ERROR;
- }
- ar_backup();
- /*
- * MUST clear the message line before doing the token operation
- * because (temporary) messages may be generated via ar_backup()
- * which calls ar_current() (yuk!!);
- */
- mess_temp("");
- t = (*p.rec->fcntbl[AR_ODSH])(p.rec, (*p.myfunc)(s, t));
- if (s)
- free(s);
- return t;
-}
-
-static int
-prompt_current(rec)
-register struct actrec *rec;
-{
- ifield *fld, *deffield();
-
- p.rec = rec->backup;
- vt_current(rec->id);
- wgo(0, 0);
- wclrwin();
- if (p.prompt)
- winputs(p.prompt, NULL);
- fld = deffield();
- setfieldflags(fld, p.flags);
- gotofield(fld, 0, 0);
- if (p.init) {
- putfield(fld, p.init);
- gotofield(fld, 0, min(fld->cols - 1, strlen(p.init)));
- }
- return SUCCESS;
-}
-
-static int
-prompt_help()
-{
- if (Vflag) {
- if (p.helpismenu)
- return objop("OPEN", "MENU", p.helpfile, p.helptitle, NULL);
- else
- return objop("OPEN", "TEXT", "$VMSYS/OBJECTS/Text.help", p.helpfile, p.helptitle, NULL);
- }
- else
- return(SUCCESS);
-}
-
-void
-get_string(func, s1, s2, flags, helpismenu, helpfile, helptitle)
-token (*func)();
-char *s1;
-char *s2;
-int flags;
-int helpismenu;
-char *helpfile;
-char *helptitle;
-{
- p.myfunc = func;
- p.prompt = s1;
- if (s2)
- p.init = s2;
- else
- p.init = strnsave("", 0); /* abs */
- p.flags = flags | I_SCROLL; /* abs. added srcoll flag */
- p.helpismenu = helpismenu;
- p.helpfile = helpfile;
- p.helptitle = helptitle;
- if (prompt_actrec == NULL) {
- struct actrec a;
- struct actrec *ar_create();
- extern struct slk Echslk[];
-
- a.id = CMD_WIN;
- a.flags = AR_SKIP;
- a.odptr = a.path = NULL;
- a.fcntbl[AR_CLOSE] = AR_NOP;
- a.fcntbl[AR_REINIT] = AR_NOP;
- a.fcntbl[AR_REREAD] = AR_NOP; /* abs k18 */
- a.fcntbl[AR_HELP] = prompt_help;
- a.fcntbl[AR_NONCUR] = prompt_noncur;
- a.fcntbl[AR_CURRENT] = prompt_current;
- a.fcntbl[AR_TEMP_CUR] = prompt_current;
- a.fcntbl[AR_CTL] = prompt_ctl;
- a.fcntbl[AR_ODSH] = (int (*)())prompt_stream; /* added cast. abs */
- a.lifetime = AR_PERMANENT;
- a.slks = Echslk;
- prompt_actrec = ar_create(&a);
- }
- ar_current(prompt_actrec, FALSE); /* abs k15 */
-}
diff --git a/usr/src/cmd/fmli/wish/global.c b/usr/src/cmd/fmli/wish/global.c
deleted file mode 100644
index 4ba5dededf..0000000000
--- a/usr/src/cmd/fmli/wish/global.c
+++ /dev/null
@@ -1,627 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/*
- * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-/* Copyright (c) 1984, 1985, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-#include <stdio.h>
-#include <ctype.h>
-#include <time.h> /* for glob_time() */
-#include "wish.h"
-#include "token.h"
-#include "slk.h"
-#include "actrec.h"
-#include "ctl.h"
-#include "terror.h"
-#include "moremacros.h"
-#include "message.h"
-
-#define MAX_OBJNAME 15
-
-/*
- * Caution: MAX_ARGS is defined in other files and should ultimately reside
- * in wish.h
- */
-#define MAX_ARGS 25
-
-static char Objtype[MAX_OBJNAME];
-char Release[] = "FMLI Release 4.0 (id=K18.2)";
-
-/* The global stream handler. Handles most tokens */
-
-int Arg_count;
-char *Args[MAX_ARGS];
-
-/* some strings that are used several times in this source file */
-
-static char Open[] = "OPEN";
-static char Menu[] = "MENU";
-static char Form[] = "FORM";
-static char Text[] = "TEXT";
-static char Any[] = "Any";
-static char Extra_args[] = "Extra arguments ignored";
-
-char *path_to_full();
-struct actrec *window_arg(), *wdw_to_ar();
-extern time_t time(); /* EFT abs k16 */
-extern struct tm *localtime(); /* abs k16 */
-
-static char *cur_path(void);
-static token gotoarg(char *s, token t);
-static void glob_time(void);
-static char *path_arg(void);
-static int objop_args(token t);
-
-token
-global_stream(t)
-token t;
-{
- register int i;
- char *path, *name, *p;
- struct actrec *a;
- extern char *Filesys;
- char *tok_to_cmd();
- char *bsd_path_to_title();
- struct actrec *path_to_ar();
- char *expand();
-
-#ifdef _DEBUG5
- _debug5(stderr, "global_stream(%o)\n", t);
-#endif
- /*
- * no more flashing token message (yuk!)
- *
- * if (p = tok_to_cmd(t))
- * {
- * mess_flash(p);
- * doupdate();
- * }
- */
- switch (t) {
- /* commands which process objects */
- case TOK_HELP:
- working(TRUE);
- if (Arg_count <= 1) {
- extern char *Pending_op;
-
- if (Pending_op)
- objop(Open, Text, "$VMSYS/OBJECTS/Text.help",
- Pending_op, Pending_op, NULL);
- else
- t = (token) ar_help(ar_get_current());
- }
- else
- t = cmd_help(Args[1]);
- if (t == TOK_OPEN)
- goto openit;
- return TOK_NOP;
- case TOK_SHOW_PATH: /* checkprint */
- working(TRUE);
-
- if (Arg_count > 1)
- (void) mess_temp(Extra_args);
- if (ar_ctl(ar_get_current(), CTGETARG, &p, NULL, NULL, NULL, NULL, NULL) != FAIL && p && *p)
- (void) objop(Open, Text, "$VMSYS/OBJECTS/Text.show", p, NULL);
- else
- (void) mess_temp("The current frame must be a non-empty folder to use this command.");
-
- return TOK_NOP;
- case TOK_SECURITY: /* security */
- working(TRUE);
- if (path = path_arg()) {
- if ( access(path,00) == FAIL )
- mess_temp("object does not exist");
- else
- objop(Open, Form, "$VMSYS/OBJECTS/Form.sec",
- path, bsd_path_to_title(path, 0), NULL);
- return TOK_NOP;
- }
- break;
- case TOK_ORGANIZE: /* organize */
- working(TRUE);
- if (a = window_arg(Arg_count - 1, Args + 1, 1)) {
- bool b;
-
- if (ar_ctl(a, CTISDEST, &b, NULL, NULL, NULL, NULL, NULL) == FAIL || b == FALSE)
- mess_temp("You may only organize File folders");
- else if (access(a->path,02) == FAIL)
- mess_temp("You do not have write permission to organize this folder");
- else {
- objop(Open, Form, "$VMSYS/OBJECTS/Form.org", a->path,
- bsd_path_to_title(a->path, 0), NULL);
- return TOK_NOP;
- }
- } else
- mess_temp("You must open the File folder to organize");
- break;
- case TOK_FIND: /* find */
- working(TRUE);
- if (parse_n_in_fold(&name, &path) == SUCCESS) {
- if (name == NULL)
- objop(Open, Form, "$VMSYS/OBJECTS/Form.find", path, NULL);
- else
- objop(Open, Menu, "$VMSYS/OBJECTS/Menu.find", path,
- name, Any, Any, Any, NULL);
- return TOK_NOP;
- }
- break;
-
- /* commands which are activation record functions */
-
- case TOK_CLEANUP: /* cleanup */
- working(TRUE);
- (void) ar_cleanup(AR_LONGTERM);
- return TOK_NOP;
- case TOK_GOTO: /* goto */
- if (Arg_count <= 1)
- get_string(gotoarg, "Enter a frame number or path: ",
- nil, 0, FALSE, "goto", "goto");
- else
- gotoarg(NULL, t);
- return TOK_NOP;
-/* case TOK_TAB: tab Removed this mapping abs k16 */
- case TOK_NEXT_WDW: /* next_wdw */
- ar_cur_next();
- return TOK_NOP;
-/* case TOK_BTAB: backtab Removed this mapping abs k16 */
- case TOK_PREV_WDW: /* prev_wdw */
- ar_cur_prev();
- return TOK_NOP;
- case TOK_LOGOUT: /* logout */
- working(TRUE);
- arf_noncur(AR_cur, AR_cur); /* clean up $ARGs */
- ar_cleanup(AR_INITIAL);
- break;
- case TOK_DEBUG:
- /* les
- mdump();
- */
- return TOK_NOP;
- case TOK_REREAD:
- working(TRUE);
- if (Arg_count <= 1)
- ar_reread(ar_get_current());
- else {
- struct actrec *destar, *savear;
- int save_life;
-
- savear = ar_get_current();
- if (destar = window_arg(Arg_count - 1, Args + 1, 2)) {
- if (destar == savear)
- ar_reread(savear);
- else {
- bool restore_ar = FALSE;
-
- if ((Arg_count < 3) || strCcmp(Args[2], "true")) /* abs k15 */
- {
- restore_ar = TRUE;
- /* don't let lifetime re-evaluate or frame close if
- shortterm when destar is made current. abs k15*/
- save_life = savear->lifetime;
- savear->lifetime = AR_INITIAL;
- }
- /*
- * - make the destination AR current
- * (to update the window immediately)
- * - if there is no third argument then
- * make the save AR current
- */
- ar_current(destar, FALSE); /* abs k15 */
- ar_reread(destar);
- if (restore_ar == TRUE)
- {
- ar_current(savear, FALSE); /* abs k15 */
- savear->lifetime = save_life;
- }
- }
- }
- }
- return TOK_NOP;
- case TOK_CLOSE:
- {
- struct actrec *a;
- register int i;
- char buf[BUFSIZ];
-
- working(TRUE);
- if (Arg_count <= 1) {
- a = ar_get_current();
- if (!a)
- mess_temp("Can't find any frames\n");
-
- /* commented out by njp for F15 - this code was
- moved to actrec.c in ar_close.
-
- else if (a->lifetime == AR_IMMORTAL ||
- a->lifetime == AR_INITIAL)
- mess_temp("Can't close this frame\n", Args + i);
- */
-
- else {
- ar_close(a, FALSE);
- init_modes();
- ar_checkworld(TRUE);
- }
- return(TOK_NOP);
- }
- for (i = 1; i < Arg_count; i++) {
- a = window_arg(1, Args + i, 1);
- if (!a) {
- sprintf(buf, "Can't find frame \"%s\"\n", Args[i]);
- mess_temp(buf);
- }
-/** test is now in ar_close. abs k17
- else if (a->lifetime == AR_IMMORTAL ||
- a->lifetime == AR_INITIAL) {
- sprintf(buf, "Can't close frame \"%s\"\n", Args[i]);
- mess_temp(buf);
- }
-**/
- else {
- ar_close(a, FALSE);
- init_modes();
- ar_checkworld(TRUE);
- }
- }
- return TOK_NOP;
- }
- break;
- case TOK_CHECKWORLD: /* force the world to be checked */
- ar_checkworld(TRUE);
- return TOK_NOP;
- case TOK_UNK_CMD: /* unknown command, if number, goto, else like open */
- if ((i = atoi(Args[0])) && wdw_to_ar(i) &&
- strspn(Args[0], "0123456789") == strlen(Args[0]))
- {
- ar_current(wdw_to_ar(i), TRUE); /* abs k15 */
- return(TOK_NOP);
- } else {
- if (Args[MAX_ARGS-1])
- free(Args[MAX_ARGS-1]); /* les */
-
- for (i = MAX_ARGS-1; i > 0; i--)
- Args[i] = Args[i-1];
-
- Args[0] = strsave(Open);
-
- Arg_count++;
- t = TOK_OPEN;
- /* fall through to open - no break!! */
- }
-
- /* object operations */
-
- openit:
- case TOK_OPEN: /* open */
- case TOK_ENTER:
- case TOK_COPY: /* copy */
- case TOK_MOVE: /* move */
- case TOK_REPLACE: /* rename */
- case TOK_SCRAMBLE: /* scramble */
- case TOK_UNSCRAMBLE: /* unscramble */
- case TOK_PRINT: /* print */
- case TOK_DELETE: /* delete */
- case TOK_UNDELETE: /* undelete */
- case TOK_OBJOP: /* any other object operation */
- working(TRUE);
-#ifdef _DEBUG
- _debug(stderr, "In global handling object operation\n");
-#endif
- if (objop_args(t) != FAIL)
- if (objopv(tok_to_cmd(t), Objtype, &Args[1]) == FAIL)
- ar_current(AR_cur, FALSE); /* undo damage done. abs k14,k15 */
- ar_checkworld(TRUE);
- return TOK_NOP;
- case TOK_SREPLACE: /* redescribe */
- working(TRUE);
- if (objop_args(t) != FAIL) {
- if (Arg_count <= 2)
- enter_getname("redescribe", NULL, &Args[1]);
- else {
- redescribe(&Args[1]);
- ar_checkworld(TRUE);
- }
- }
- return TOK_NOP;
- case TOK_DISPLAY: /* display */
- working(TRUE);
- if (objop_args(t) != FAIL)
- (void) glob_display(Args[1]);
- return TOK_NOP;
- case TOK_RUN:
- working(TRUE);
- if (objop_args(t) != FAIL) {
- objopv(Open, "EXECUTABLE", &Args[1]);
- ar_checkworld(TRUE);
- return(TOK_NOP);
- }
- break;
- case TOK_CREATE: /* create */
- working(TRUE);
- return glob_create();
-
- /* system functions */
-
- case TOK_SELECT: /* select */
- glob_select();
- return TOK_NOP;
- case TOK_CANCEL: /* cancel out of a browse */
- mess_perm(NULL);
- glob_browse_cancel();
- return TOK_NOP;
- case TOK_REFRESH: /* refresh the screen */
- vt_redraw();
- return TOK_NOP;
- case TOK_TIME: /* time */
- glob_time();
- return TOK_NOP;
- case TOK_UNIX: /* unix */
- working(TRUE);
- (void) proc_open(0, "UNIX_System", NULL, "sh", "-c",
- "echo \"To return, type 'exit' or control-d\nYou are in `pwd`\"; exec ${SHELL:-/bin/sh}", NULL);
- ar_checkworld(TRUE); /* always check after a unix escape! */
- return TOK_NOP;
- case TOK_WDWMGMT: /* wdw_mgmt */
- working(TRUE);
- if (Arg_count <= 1)
- mgmt_create(NULL);
- else
- mgmt_create(Args[1]);
- return TOK_NOP;
- case TOK_CMD:
- working(TRUE);
- cmd_create();
- return TOK_NOP;
- case TOK_SET:
- working(TRUE);
- if (Arg_count < 3) {
- mess_temp("Not enough arguments");
- break;
- } else {
- char buf[MESSIZ];
-
- strcpy(buf, Args[2]);
- for (i = 3; Args[i]; i++) {
- strcat(buf, " ");
- strcat(buf, Args[i]);
- }
- chgepenv(Args[1], buf);
- mess_temp(nstrcat(Args[1], " ==> ", buf, NULL));
- return TOK_NOP;
- }
- case TOK_TOGSLK:
- slk_toggle();
- return TOK_NOP;
- case TOK_RELEASE:
- working(TRUE);
- mess_temp(Release);
- return TOK_NOP;
- case TOK_NOP:
- default:
- break;
- }
- return t;
-}
-
-
-/*
- * This function looks at its arglist, and parses its argument into an
- * activation record. The argument could be either a window number or a path
- */
-struct actrec *
-window_arg(argc, argv, maxargs)
-int argc;
-char *argv[];
-int maxargs;
-{
- char *p;
- int n;
- struct actrec *ret;
- struct actrec *path_to_ar();
- struct actrec *wdw_to_ar();
-
- if (argc <= 0) {
- ret = ar_get_current();
- return(ret);
- }
- else {
- if (argc > maxargs)
- mess_temp(Extra_args);
- if ((n = atoi(argv[0])) &&
- (strspn(argv[0], "0123456789") == strlen(argv[0])) &&
- (ret = wdw_to_ar(n)))
- return(ret);
- else {
- p = path_to_full(argv[0]);
- ret = path_to_ar(p);
- free(p);
- return ret;
- }
- }
-}
-
-/*
- * this is used for those functions that require an argument that is
- * a path inside a window by default, or a full path.
- */
-static char *
-path_arg(void)
-{
- char *p;
- extern char *Filecabinet;
-
- if (Arg_count > 2)
- mess_temp(Extra_args);
- if (Arg_count >= 2)
- return path_to_full(Args[1]);
- else if (ar_ctl(ar_get_current(), CTGETARG, &p, NULL, NULL, NULL, NULL, NULL) != FAIL && p && *p)
- return path_to_full(p);
- return Filecabinet;
-}
-
-/*
- * These should really go in separate source files when they are
- * finally finished.
- */
-static void
-glob_time(void)
-{
- char buf[12];
- time_t t; /* EFT abs k16 */
- register struct tm *tp;
-
- t = time((time_t)0L); /* EFT abs k16 */
- tp = localtime(&t);
- sprintf(buf, "%d:%02.2d:%02.2d %cM",
- tp->tm_hour % 12 ? tp->tm_hour % 12 : 12,
- tp->tm_min, tp->tm_sec, tp->tm_hour >= 12 ? 'P' : 'A');
- mess_temp(buf);
-}
-
-/* prepare the argument array for an impending object operation */
-
-static int
-objop_args(token t)
-{
- char *p;
- register int i;
-
- strcpy(Objtype, "OBJECT");
- if (Arg_count <= 1) { /* current object is the arg */
- if (ar_ctl(ar_get_current(), CTGETARG, &Args[1], NULL, NULL, NULL, NULL, NULL) == FAIL) {
- glob_mess_nosrc(t);
- return(FAIL);
- }
-
- Args[1] = strsave(Args[1]);
- if ( Args[2] )
- free( Args[ 2 ] ); /* les */
- Args[2] = NULL;
- Arg_count = 2;
- return(SUCCESS);
- }
- if (Arg_count > 2 &&
- (is_objtype(Args[1]) || strCcmp("OBJECT", Args[1]) == 0)) {
- strncpy(Objtype, Args[1], MAX_OBJNAME);
- for (p = &Objtype[0]; *p; p++)
- if (islower(*p))
- *p = toupper(*p);
- free(Args[1]);
- for (i = 1; Args[i] = Args[i+1]; i++)
- ;
- Arg_count--;
- }
- if (Arg_count >= 3 && strCcmp(Args[1], "to") == 0) {
- free(Args[1]);
- if (ar_ctl(ar_get_current(), CTGETARG, &Args[1], NULL, NULL, NULL, NULL, NULL) == FAIL) {
- glob_mess_nosrc(t);
- return(FAIL);
- }
- }
-
- p = Args[1];
- Args[1] = path_to_full(Args[1]);
- if (p)
- free(p);
- return SUCCESS;
-}
-
-static token
-gotoarg(char *s, token t)
-{
- struct actrec *a;
-
- if (t == TOK_CANCEL)
- return t;
- if (s) {
- if (Args[1] && Arg_count > 1)
- free(Args[1]);
- Args[1] = strsave(s);
- if (Arg_count < 2)
- Arg_count = 2;
- }
- if ((a = window_arg(Arg_count - 1, Args + 1, 1)) == NULL) {
- mess_temp("Unable to find a frame with that name");
- return t;
- }
- else
- ar_current(a, TRUE); /* abs k15 */
- return TOK_NOP;
-}
-
-/* parse for arguments of the form: command [name] [in folder] */
-
-int
-parse_n_in_fold(name, folder)
-char **name, **folder;
-{
- switch (Arg_count) {
- case 0:
- case 1:
- *name = NULL;
- *folder = cur_path();
- break;
- case 2:
- *name = Args[1];
- *folder = cur_path();
- break;
- default:
- mess_temp(Extra_args);
- sleep(2);
- case 4:
- if (strCcmp(Args[2], "in") != 0) {
- mess_temp(Extra_args);
- return(FAIL);
- }
- *folder = path_to_full(Args[3]);
- *name = Args[1];
- break;
- case 3:
- *folder = path_to_full(Args[2]);
- if (strCcmp(Args[1], "in") == 0)
- *name = NULL;
- else
- *name = Args[1];
- break;
- }
- return SUCCESS;
-}
-
-static char *
-cur_path(void)
-{
- bool arg;
- char *path;
- extern char *Filecabinet;
-
- if (ar_ctl(ar_get_current(), CTISDEST, &arg, NULL, NULL, NULL, NULL, NULL) == FAIL || arg == FALSE)
- path = Filecabinet;
- else
- path = ar_get_current()->path;
- return(path);
-}
diff --git a/usr/src/cmd/fmli/wish/mudge.c b/usr/src/cmd/fmli/wish/mudge.c
deleted file mode 100644
index 0e3c9cd617..0000000000
--- a/usr/src/cmd/fmli/wish/mudge.c
+++ /dev/null
@@ -1,250 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/*
- * Copyright 1993 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-#include <stdio.h>
-#include <ctype.h>
-#include "wish.h"
-#include "token.h"
-#include "vtdefs.h"
-#include "actrec.h"
-#include "slk.h"
-#include "ctl.h"
-#include "moremacros.h"
-
-/* modes */
-#define MODE_MOVE 1
-#define MODE_RESHAPE 2
-
-static int mode;
-static int srow;
-static int scol;
-static int rows;
-static int cols;
-static char position1[] = "Position ";
-static char position2[] = " corner and press ENTER";
-static char *Savemsg = NULL;
-
-/* mouse position */
-extern int Mouse_row;
-extern int Mouse_col;
-extern int Open_mouse_mode;
-
-char *mess_perm();
-
-static int
-wdw_close(rec)
-struct actrec *rec;
-{
- (void) mess_perm(Savemsg);
- make_box(0, 0, 0, 0, 0);
- Open_mouse_mode = FALSE;
- return SUCCESS;
-}
-
-/*ARGSUSED*/
-static int
-wdw_ctl(rec, wdw, a1, a2, a3, a4, a5, a6)
-struct actrec *rec;
-int wdw;
-int a1, a2, a3, a4, a5, a6;
-{
- return FAIL;
-}
-
-/*ARGSUSED*/
-static token
-wdw_stream(rec, t)
-struct actrec *rec;
-register token t;
-{
- register int newsrow;
- register int newscol;
- register int newrows;
- register int newcols;
- register bool moving;
- char *nstrcat();
-
- moving = FALSE;
- newsrow = srow;
- newscol = scol;
- newrows = rows;
- newcols = cols;
- switch (t) {
- case TOK_UP:
- moving = TRUE;
- if (mode & MODE_MOVE)
- newsrow--;
- else
- newrows--;
- break;
- case TOK_DOWN:
- moving = TRUE;
- if (mode & MODE_MOVE)
- newsrow++;
- else
- newrows++;
- break;
- case TOK_LEFT:
- moving = TRUE;
- if (mode & MODE_MOVE)
- newscol--;
- else
- newcols--;
- break;
- case TOK_RIGHT:
- moving = TRUE;
- if (mode & MODE_MOVE)
- newscol++;
- else
- newcols++;
- break;
- case TOK_BTAB:
- moving = TRUE;
- if (mode & MODE_MOVE)
- newscol = (newscol - 1 & ~7);
- else
- newcols = (newcols - 1 & ~7);
- break;
- case TOK_TAB:
- moving = TRUE;
- if (mode & MODE_MOVE)
- newscol = (newscol + 8 & ~7);
- else
- newcols = (newcols + 8 & ~7);
- break;
- case TOK_BPRESSED:
- moving = TRUE;
- if (mode & MODE_MOVE) {
- newsrow = Mouse_row - 1;
- newscol = Mouse_col;
- }
- else {
- newrows = Mouse_row - srow;
- newcols = Mouse_col - scol + 1;
- }
- break;
- case TOK_BRELEASED:
- case TOK_RETURN:
- case TOK_ENTER:
-#ifdef _DEBUG
- _debug(stderr, "mode=%d\n", mode);
-#endif
- if (mode & MODE_RESHAPE && mode & MODE_MOVE) {
- mode = MODE_RESHAPE;
- make_box(1, srow, scol, rows, cols);
- (void) mess_perm(nstrcat(position1, "bottom-right", position2, NULL));
- } else {
- if (mode & MODE_RESHAPE)
- ar_ctl(rec->odptr, CTSETSHAPE, srow, scol, rows, cols, NULL, NULL);
- else {
- vt_id vid;
-
- vid = vt_current(ar_ctl(rec->odptr, CTGETVT, NULL, NULL, NULL, NULL, NULL, NULL));
- vt_move(srow, scol);
- vt_current(vid);
- }
- ar_backup();
- }
- t = TOK_NOP;
- break;
- case TOK_CANCEL:
- ar_backup();
- t = TOK_NOP;
- break;
- }
- if (moving) {
- if (make_box(!(mode & MODE_MOVE), newsrow, newscol, newrows, newcols)) {
- t = TOK_NOP;
- srow = newsrow;
- scol = newscol;
- rows = newrows;
- cols = newcols;
- }
- else {
- t |= TOK_ERROR;
- make_box(!(mode & MODE_MOVE), srow, scol, rows, cols);
- }
- }
- return t;
-}
-
-static int
-wdw_current(rec)
-register struct actrec *rec;
-{
- vt_id vt;
-
- vt = ar_ctl(rec->odptr, CTGETVT, NULL, NULL, NULL, NULL, NULL, NULL);
-
- vt_ctl(vt, CTGETSTRT, &srow, &scol);
- vt_ctl(vt, CTGETSIZ, &rows, &cols);
- /* allow extra space for borders */
- make_box(0, --srow, --scol, rows += 2, cols += 2);
- return SUCCESS;
-}
-
-void
-enter_wdw_mode(rec, reshape)
-struct actrec *rec;
-bool reshape;
-{
- struct actrec a;
- char *tmpstr, *nstrcat();
- struct actrec *ar_create();
- extern struct slk Echslk[];
-
- mode = (reshape ? (MODE_RESHAPE | MODE_MOVE) : MODE_MOVE);
- a.id = 0;
- a.flags = AR_SKIP;
- a.path = NULL;
- a.odptr = (char *) (rec ? rec : ar_get_current());
- a.fcntbl[AR_CLOSE] = wdw_close;
- a.fcntbl[AR_REINIT] = AR_NOP;
- a.fcntbl[AR_HELP] = AR_NOHELP;
- a.fcntbl[AR_NONCUR] = AR_NOP;
- a.fcntbl[AR_CURRENT] = wdw_current;
- a.fcntbl[AR_TEMP_CUR] = wdw_current; /* abs k15. should be optimized. */
- a.fcntbl[AR_CTL] = wdw_ctl;
- a.fcntbl[AR_ODSH] = (int (*)())wdw_stream; /* added cast abs 9/12/88 */
- a.lifetime = AR_SHORTERM;
- a.slks = Echslk;
-
- ar_current(ar_create(&a), FALSE); /* abs k15 */
- /*
- * put up a permanent message, saving the old one
- */
- tmpstr = mess_perm(nstrcat(position1, "top-left", position2, NULL));
- if (Savemsg) /* ehr3 */
- free(Savemsg); /* ehr3 */
-
- Savemsg = strsave(tmpstr);
- Open_mouse_mode = TRUE;
-}
diff --git a/usr/src/cmd/fmli/wish/objop.c b/usr/src/cmd/fmli/wish/objop.c
deleted file mode 100644
index 099ef479f3..0000000000
--- a/usr/src/cmd/fmli/wish/objop.c
+++ /dev/null
@@ -1,296 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-/*
- * Copyright (c) 1985 AT&T
- * All Rights Reserved
- */
-
-/*
- * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-#include <stdio.h>
-#include <stdarg.h>
-#include <sys/types.h> /* EFT abs k16 */
-#include "wish.h"
-#include "typetab.h"
-#include "optabdefs.h"
-#include "terror.h"
-#include "procdefs.h"
-#include "moremacros.h"
-#include "message.h"
-#include "sizes.h"
-
-#define NUM_REQ_OPS (4)
-
-/*
- * Caution: MAX_ARGS is defined in other files and should ultimately reside
- * in wish.h
- */
-#define MAX_ARGS (25)
-
-extern int (*Function[])();
-bool isfolder();
-
-
-int
-objop(char *op, char *objtype, ...)
-{
- register int argc;
- char *argv[MAX_ARGS];
- va_list a;
-
- /* decode the args into the argv structure */
-
- va_start(a, objtype);
- for (argc = 0; argc < MAX_ARGS-1 && (argv[argc] = va_arg(a,char *)); argc++)
-#ifdef _DEBUG
- _debug(stderr, "%s ", argv[argc]);
-#else
- ;
-#endif
- argv[MAX_ARGS-1] = NULL;
- va_end(a);
-
- return(objopv(op, objtype, argv));
-}
-
-int
-objopv(op, objtype, argv)
-char *op, *objtype;
-char *argv[];
-{
- register int ret, i, argc, opindex;
- register bool found = FALSE;
- char *object;
- char *argvhold[MAX_ARGS];
- struct operation **oot;
- struct ott_entry *ott = NULL, *path_to_ott();
- char *bsd_path_to_title();
-
- struct operation **obj_to_oot();
- char *path_to_full();
-
- object = path_to_full(argv[0]);
-
- /*
- * Test to see if the object is "/" ... if it is
- * then specify its objtype (DIRECTORY) since there is
- * no "parent" ott in which to determine its type
- */
- if (object && strcmp(object, "/") == 0) {
- if (!objtype || strCcmp(objtype, "OBJECT") == 0)
- objtype = "DIRECTORY";
- }
- argvhold[0] = object;
- for (argc = 0; argv[argc]; argc++)
- ;
-
- /* if no object type given, find it by getting ott */
-
- if (!objtype || strCcmp(objtype, "OBJECT") == 0) {
- if ((ott = path_to_ott(object)) == NULL)
- return(FAIL);
- objtype = ott->objtype;
- }
-
- if ((oot = obj_to_oot(objtype)) == NULL) {
- mess_temp("I do not recognize that kind of object.");
- return(FAIL);
- }
-
- for (opindex = NUM_REQ_OPS; oot[opindex]; opindex++) {
- if (strCcmp(op, oot[opindex]->opername) == 0) {
- found = TRUE;
- break;
- }
- }
- if (!found) {
- char msg[MESSIZ];
-
- sprintf(msg, "No %s operation defined for this object.", op);
- mess_temp(msg);
- return(FAIL);
- }
- if (oot[opindex]->none_mask & M_EN && strcmp(object, "-i") != 0) { /* not allowed on encrypted */
- if (ott == NULL && (ott = path_to_ott(object)) == NULL)
- return(FAIL);
- if (ott->objmask & M_EN) {
- char msg[MESSIZ];
-
- sprintf(msg, "Cannot %s a scrambled object. Unscramble it first.", op);
- mess_temp(msg);
- return(FAIL);
- }
- }
-
- /* gather up the arguments */
-
- switch (oot[opindex]->op_type & (OP_CUR|OP_NEW|OP_SNG|OP_DIR)) {
- case OP_SNG: /* Single, no other args needed than the first */
- for (i = 1; argv[i]; i++)
- argvhold[i] = strsave(argv[i]);
- argvhold[i] = NULL;
- break;
- case OP_NEW|OP_DIR: /* copy-like */
- case OP_NEW|OP_CUR: /* copy-like */
- case OP_DIR: /* move-like */
- case OP_CUR:
- if (argc <= 1) {
- enter_browse(op, objtype, argv);
- return(SUCCESS);
- } else {
- if (strCcmp(argv[1], "to") == 0) {
- for (i = 1; argvhold[i] = argv[i+1]; i++)
- ;
- argc--;
- } else
- for (i = 1; argvhold[i] = argv[i]; i++)
- ;
- }
- /* first two args are paths, third arg is alternate name */
- for (i = 1; argvhold[i]; i++) {
- if (i < 2)
- argvhold[i] = path_to_full(argvhold[i]);
- else
- argvhold[i] = strsave(argvhold[i]);
- }
-
- if (argc == 2) {
- char *errstr;
- char oldname[ONAMESIZ];
-
- if (isfolder(argvhold[1]) == FALSE)
- return(FAIL);
- if (ott == NULL && (ott = path_to_ott(object)) == NULL)
- return(FAIL);
- strcpy(oldname, ott->name);
- if (namecheck(argvhold[1], oldname,
- objtype, &errstr, TRUE) == FALSE) {
- mess_temp(errstr);
- enter_getname(op, objtype, argvhold);
- return(SUCCESS);
- }
- }
- break;
- case OP_NEW: /* rename-like */
- if (argc <= 1) {
- enter_getname(op, objtype, argv);
- return(SUCCESS);
- } else {
- if (strcmp(argv[1], "as") == 0 || strcmp(argv[1], "to") == 0) {
- for (i = 1; argv[i+1]; i++)
- argvhold[i] = strsave(argv[i+1]);
- } else
- for (i = 1; argv[i]; i++)
- argvhold[i] = strsave(argv[i]);
- argvhold[i] = NULL;
- }
- break;
- default:
- for (i = 1; argv[i]; i++)
- argvhold[i] = strsave(argv[i]);
- argvhold[i] = NULL;
-#ifdef _DEBUG
- _debug(stderr, "Unimplemented object operation type");
-#endif
- break;
- }
-
-#ifdef _DEBUG
- _debug(stderr, "OBJOP about to execute %s %s ", op, objtype);
- for (i = 0; argvhold[i]; i++)
- _debug(stderr, "%s ", argvhold[i]);
- _debug(stderr, "\n");
-#endif
-
- /* execute the function */
-
- switch (oot[opindex]->func_type) {
- case F_NOP:
- ret = SUCCESS;
- break;
- case F_ILL:
- ret = FAIL;
- break;
- case F_INT:
- ret = (*(Function[oot[opindex]->intern_func]))(argvhold);
- break;
- case F_EXEC:
- case F_SHELL:
- {
- char command[BUFSIZ];
- char title[BUFSIZ];
- int length;
-
- sprintf(title, "Suspended %s", bsd_path_to_title(argvhold[0], COLS-14));
- length = sprintf(command, "%s ", oot[opindex]->extern_func);
- for (i = 0; argv[i]; i++)
- length += sprintf(command + length, "%s ", argvhold[i]);
- proc_opensys(PR_ERRPROMPT, title, NULL, command);
- if (ott == NULL && (ott = path_to_ott(object)) == NULL)
- ret = FAIL;
- else {
- ott_mtime(ott); /* update internal mod time */
- ret = SUCCESS;
- }
- }
- break;
- default:
-#ifdef _DEBUG
- _debug(stderr, "Unimplemented object operation type");
-#endif
- ret = FAIL;
- break;
- }
-
- for (i = 0; argvhold[i]; i++)
- free(argvhold[i]);
-
- return(ret);
-}
-
-bool
-isfolder(path)
-char *path;
-{
- struct ott_entry *ott;
- struct ott_entry *path_to_ott();
- char *bsd_path_to_title();
-
- if ((ott = path_to_ott(path)) == NULL) {
- return(FALSE);
- } else if ((ott->objmask & CL_DIR) == 0) {
- mess_temp(nstrcat("Object ",
- bsd_path_to_title(ott_to_path(ott), MESS_COLS-23),
- " is not a folder", NULL));
- return(FALSE);
- }
- return(TRUE);
-}
diff --git a/usr/src/cmd/fmli/wish/stubs.c b/usr/src/cmd/fmli/wish/stubs.c
deleted file mode 100644
index 39c2293158..0000000000
--- a/usr/src/cmd/fmli/wish/stubs.c
+++ /dev/null
@@ -1,99 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-
-/*
- * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-/* Copyright (c) 1984, 1985, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-#include <stdio.h>
-#include "wish.h"
-#include "token.h"
-
-int
-stubs(void)
-{
- return (0);
-}
-
-int
-(*ignoresigs())()
-{
- return (NULL);
-}
-
-int
-restoresigs()
-{
- return (0);
-}
-
-int
-osystem(void)
-{
-#ifdef _DEBUG
- _debug(stderr, "SYSTEM NOT IMPLEMENTED\n");
-#endif
- return (0);
-}
-
-int
-prompt(void)
-{
-#ifdef _DEBUG
- _debug(stderr, "PROMPT NOT WORKING\n");
-#endif
- return (0);
-}
-
-int
-suspend(void)
-{
-#ifdef _DEBUG
- _debug(stderr, "SUSPEND NOT IMPLEMENTED\n");
-#endif
- return (0);
-}
-
-int
-change_owns(void)
-{
-#ifdef _DEBUG
- _debug(stderr, "CHANGE_OWNS STUBBED OUT\n");
-#endif
- return (0);
-}
-
-int
-edit(void)
-{
-#ifdef _DEBUG
- _debug(stderr, "EDIT STUBBED OUT\n");
-#endif
- return (0);
-}
diff --git a/usr/src/cmd/fmli/wish/virtual.c b/usr/src/cmd/fmli/wish/virtual.c
deleted file mode 100644
index 8b079381d6..0000000000
--- a/usr/src/cmd/fmli/wish/virtual.c
+++ /dev/null
@@ -1,228 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-
-/*
- * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-#include <stdio.h>
-#include <ctype.h>
-#include "wish.h"
-#include "token.h"
-#include "vtdefs.h"
-#include "actrec.h"
-#include "slk.h"
-#include "moremacros.h"
-#include "message.h"
-
-/*
- * Caution: MAX_ARGS is defined in several files and should ultimately reside
- * in wish.h
- */
-#define MAX_ARGS 25
-extern char *Args[MAX_ARGS];
-extern int Arg_count;
-extern bool Nobang;
-
-static bool Command_mode = FALSE; /* abs k17 */
-static token done_cmd(char *s, token t);
-
-token
-virtual_stream(t)
-register token t;
-{
- char *s;
- char *tok_to_cmd();
-
- if ( t > 037 && t < 0177 )
- return t;
-
- Arg_count = 0;
- if (s = tok_to_cmd(t))
- t = cmd_to_tok(s);
- if (t == TOK_COMMAND)
- {
- /* single equals sign is correct, here */
- if (Command_mode = !Command_mode)
- {
- char *cur_cmd();
-
- get_string(done_cmd, "--> ", cur_cmd(), 0, TRUE,
- "$VMSYS/OBJECTS/Menu.h6.list", NULL);
- t = TOK_NOP;
- }
- else
- t = TOK_CANCEL;
- }
- else
- {
- if (t >= TOK_SLK1 && t <= TOK_SLK8)
- t = slk_token(t);
- }
- return t;
-}
-
-static token
-done_cmd(char *s, token t)
-{
- char *strchr();
-
- if (t == TOK_CANCEL)
- t = TOK_NOP;
- else
- {
- int i;
-
- /* Remove all blanks in the beginning of the command line */
-
- while(*s && isspace(*s))
- s++;
- if (s[0] == '!') /* execute shell cmd from cmd line */
- if (Nobang) /* feature disabled by application developer */
- {
- mess_temp("Command ignored: the ! prefix is disabled in this application");
- mess_lock();
- t = TOK_NOP;
- }
- else
- {
- char *tok_to_cmd();
-
- t = TOK_OPEN;
- for (i=0; i < 5; i++)
- if (Args[i])
- free(Args[i]); /* les */
-
- Args[0] = strsave("OPEN");
- Args[1] = strsave("EXECUTABLE");
- Args[2] = strsave("${SHELL:-/bin/sh}");
- Args[3] = strsave("-c");
- Args[4] = strsave(&s[1]);
- Arg_count = 5;
- }
- else
- {
- set_Args(s);
-
- /* changed if's to switch and added security clauses. abs k17 */
-
- t = cmd_to_tok(Args[0]);
- switch(t)
- {
- case TOK_NOP:
- {
- /* change to unknown_command which becomes a goto or
- ** open (see global_stream() ) unless command was
- ** entered from command line while Nobang is set;
- ** in this case only change to unknown_command if
- ** it will turn into a goto. abs k17
- */
- if (!Nobang || (i = atoi(Args[0])) && wdw_to_ar(i) &&
- strspn(Args[0], "0123456789") == strlen(Args[0]))
- t = TOK_UNK_CMD;
- else
- {
- mess_temp("Command ignored: open is disabled in this application");
- mess_lock();
- }
- break;
- }
- case TOK_NUNIQUE:
- {
- char msg[MESSIZ];
-
- sprintf(msg, "Command '%s' not unique. Type more of its name.", Args[0]);
- mess_temp(msg);
- t = TOK_NOP;
- break;
- }
- case TOK_RUN: /* added clause. abs k17 */
- {
- if (Nobang)
- {
- mess_temp("Command ignored: run is disabled in this application");
- mess_lock();
- t = TOK_NOP;
- }
- break;
- }
- case TOK_OPEN: /* added clause. abs k17 */
- {
- if (Nobang)
- {
- mess_temp("Command ignored: open is disabled in this application");
- mess_lock();
- t = TOK_NOP;
- }
- break;
- }
- default:
- {
- if (t < 0)
- t = do_app_cmd(); /* Application defined command */
- break;
- }
- }
- }
- }
- Command_mode = FALSE;
- return t;
-}
-
-int
-set_Args(s)
-char *s;
-{
-
- for (Arg_count = 0; Arg_count < (MAX_ARGS - 1); Arg_count++) {
- while (*s && isspace(*s))
- s++;
- if (*s == '\0')
- break;
-
- if (Args[Arg_count] != NULL)
- free(Args[Arg_count]); /* les */
-
- Args[Arg_count] = s;
-
- while (*s && !isspace(*s))
- s++;
- if (*s != '\0')
- *s++ = '\0';
- Args[Arg_count] = strsave(Args[Arg_count]);
-#ifdef _DEBUG
- _debug(stderr, "Args[%d] = '%s'\n", Arg_count, Args[Arg_count]);
-#endif
- }
-
- if (Args[Arg_count] != NULL)
- free(Args[Arg_count]); /* les */
-
- Args[Arg_count] = NULL;
- return (0);
-}
diff --git a/usr/src/cmd/fmli/wish/wdwcreate.c b/usr/src/cmd/fmli/wish/wdwcreate.c
deleted file mode 100644
index a676dd9e6c..0000000000
--- a/usr/src/cmd/fmli/wish/wdwcreate.c
+++ /dev/null
@@ -1,109 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-
-/*
- * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-/* Copyright (c) 1984, 1985, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-#include <stdio.h>
-#include "wish.h"
-#include "token.h"
-#include "slk.h"
-#include "actrec.h"
-#include "terror.h"
-#include "ctl.h"
-#include "menudefs.h"
-#include "vtdefs.h"
-#include "sizes.h"
-
-extern char *Args[];
-extern int Arg_count;
-static int eqwaste(char *str);
-
-int
-glob_create()
-{
- char *errstr;
- static char *argv[3];
- extern char *Filecabinet;
- char *path_to_full(), *bsd_path_to_title(), *cur_path();
-
- argv[0] = argv[1] = argv[2] = NULL;
- if (parse_n_in_fold(&argv[1], &argv[0]) == FAIL)
- return(TOK_CREATE);
- if (eqwaste(argv[0]))
- return(FAIL);
- if (isfolder(argv[0]) == FALSE) {
- mess_temp("You can only create new objects inside File folders");
- return(FAIL);
- }
- if (access(argv[0], 02) < 0) {
- mess_temp(nstrcat("You don't have permission to create objects in ",
- bsd_path_to_title(argv[0], MESS_COLS-47), NULL));
- return(FAIL);
- }
- if (argv[1] == NULL) {
- enter_getname("create", "", argv);
- return(TOK_NOP);
- }
- if (namecheck(argv[0], argv[1], NULL, &errstr, TRUE) == FALSE) {
- mess_temp(errstr);
- argv[1] = NULL;
- enter_getname("create", "", argv);
- return(TOK_NOP);
- }
- Create_create(argv);
- return(TOK_NOP);
-}
-
-int
-Create_create(argv)
-char *argv[];
-{
- char *bsd_path_to_title();
- char *path;
-
- working(TRUE);
- path = bsd_path_to_title(argv[1], (COLS-30)/2);
- return(objop("OPEN", "MENU", "$VMSYS/OBJECTS/Menu.create",
- argv[0], argv[1], path,
- bsd_path_to_title(argv[0], COLS - strlen(path)), NULL));
-}
-
-static int
-eqwaste(char *str)
-{
- extern char *Wastebasket;
-
- if (strncmp(str, Wastebasket, strlen(Wastebasket)) == 0) {
- mess_temp("You cannot create objects in your WASTEBASKET");
- return(1);
- }
- return(0);
-}
diff --git a/usr/src/cmd/fmli/wish/wdwlist.c b/usr/src/cmd/fmli/wish/wdwlist.c
deleted file mode 100644
index 53ec1e76ba..0000000000
--- a/usr/src/cmd/fmli/wish/wdwlist.c
+++ /dev/null
@@ -1,110 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-/*
- * Copyright (c) 1985 AT&T
- * All Rights Reserved
- */
-#ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.8 */
-
-#include <stdio.h>
-#include "wish.h"
-#include "token.h"
-#include "slk.h"
-#include "actrec.h"
-#include "terror.h"
-#include "ctl.h"
-#include "menudefs.h"
-#include "vtdefs.h"
-#include "moremacros.h"
-
-extern menu_id menu_make();
-
-static int
-list_ctl(a, cmd, arg1, arg2, arg3, arg4, arg5, arg6)
-struct actrec *a;
-int cmd, arg1, arg2, arg3, arg4, arg5, arg6;
-{
- struct actrec *menline_to_ar();
-
- if (cmd == CTGETARG) {
- int line;
- struct actrec *rec, *menline_to_ar();
-
- (void) menu_ctl(a->id, CTGETPOS, &line);
- rec = menline_to_ar(line);
- **((char ***)(&arg1)) = strsave(rec->path);
- return(SUCCESS);
- } else
- return(menu_ctl(a->id, cmd, arg1, arg2, arg3, arg4, arg5, arg6));
-}
-
-static token
-list_odsh(a, t)
-struct actrec *a;
-token t;
-{
- int line;
- struct actrec *menline_to_ar();
- extern int Arg_count;
-
- t = menu_stream(t);
-
- if ((t == TOK_OPEN || t == TOK_ENTER) && Arg_count <= 1) {
- (void) menu_ctl(a->id, CTGETPOS, &line);
- ar_current(menline_to_ar(line), TRUE); /* abs k15 */
- t = TOK_NOP;
- } else if (t == TOK_CANCEL) {
- ar_backup();
- t = TOK_NOP;
- } else if (t == TOK_NEXT)
- t = TOK_NOP; /* returned when new item is navigated to */
- return(t);
-}
-
-
-static int
-list_help(a)
-struct actrec *a;
-{
- return(objop("OPEN", "TEXT", "$VMSYS/OBJECTS/Text.mfhelp", "T.m.frmlist", "Frame List", NULL));
-}
-
-int
-list_create()
-{
- struct actrec a;
- struct menu_line ar_menudisp();
-
- a.id = (int) menu_make(-1, "Open Frames", VT_NONUMBER | VT_CENTER,
- VT_UNDEFINED, VT_UNDEFINED, 0, 0, ar_menudisp, NULL);
- ar_menu_init(&a);
- a.fcntbl[AR_CTL] = list_ctl;
- a.fcntbl[AR_HELP] = list_help;
- a.fcntbl[AR_ODSH] = (int (*)())list_odsh; /* added cast abs 9/9/88 */
- a.flags = 0;
-
- return(ar_current(ar_create(&a), FALSE)); /* abs k15 */
-}
diff --git a/usr/src/cmd/fmli/wish/wdwmgmt.c b/usr/src/cmd/fmli/wish/wdwmgmt.c
deleted file mode 100644
index 9236ff64ba..0000000000
--- a/usr/src/cmd/fmli/wish/wdwmgmt.c
+++ /dev/null
@@ -1,229 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-/*
- * Copyright (c) 1985 AT&T
- * All Rights Reserved
- */
-#ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.13 */
-
-#include <stdio.h>
-#include "wish.h"
-#include "token.h"
-#include "slk.h"
-#include "actrec.h"
-#include "terror.h"
-#include "ctl.h"
-#include "menudefs.h"
-#include "vtdefs.h"
-#include "moremacros.h"
-
-extern menu_id menu_make();
-
-#define NMUDGES 4
-
-static struct menu_line Mgmt_lines[NMUDGES] = {
- { "list", "list all frames", 0 },
- { "move", "move a frame", 0 },
- { "reshape", "reshape a frame", 0 },
- { NULL, NULL, 0 }
-};
-
-static struct menu_line
-mgmt_disp(n, ptr)
-int n;
-char *ptr;
-{
- if (n >= NMUDGES)
- n = NMUDGES - 1;
- return Mgmt_lines[n];
-}
-
-static int
-mgmt_odsh(a, t)
-struct actrec *a;
-token t;
-{
- int line;
- token menu_stream();
- struct actrec *curar;
-
- t = menu_stream(t);
- if (t == TOK_ENTER || t == TOK_OPEN) {
- (void) menu_ctl(a->id, CTGETPOS, &line);
- curar = (struct actrec *)(a->odptr);
- switch (line) {
- case 0: /* list */
- list_create();
- break;
- case 1: /* move */
- enter_wdw_mode(curar, FALSE);
- break;
- case 2: /* reshape */
- if (curar && (curar->flags & AR_NORESHAPE)) {
- mess_temp("Forms cannot be reshaped");
- t = TOK_NOP;
- }
- else
- enter_wdw_mode(curar, TRUE);
- break;
- }
- t = TOK_NOP;
- } else if (t == TOK_CANCEL) {
- ar_backup();
- t = TOK_NOP;
- } else if (t == TOK_NEXT)
- t = TOK_NOP; /* filter out, see menu_stream */
- return t;
-}
-
-static int
-mgmt_help(a)
-struct actrec *a;
-{
- return(objop("OPEN", "TEXT", "$VMSYS/OBJECTS/Text.mfhelp", "frm-mgmt", "Frame Management", NULL));
-}
-
-int
-mgmt_create()
-{
- char *cmd;
- int len;
- struct actrec a, *ar, *ar_create(), *window_arg();
- extern int Arg_count;
- extern char *Args[];
-
- switch (Arg_count) {
- case 0:
- case 1:
- /*
- * no arguments to frm-mgmt
- *
- * assume the current frame and prompt the user for
- * the command
- */
- cmd = NULL;
- ar = ar_get_current();
- break;
- case 2:
- /*
- * One argument to frm-mgmt
- *
- * This case is ambiguous, since the argument could be
- * either one of the three commands "move" "reshape" or "list"
- * or it could be a window path or number. So, assume it
- * is a window if it isn't a command. (Hope nobody tries this
- * on a window named "list")
- */
- len = strlen(Args[1]);
- if (strnCcmp(Args[1], "move", len) == 0 ||
- strnCcmp(Args[1], "reshape", len) == 0 ||
- strnCcmp(Args[1], "list", len) == 0) {
- cmd = Args[1];
- ar = ar_get_current();
- }
- else {
- cmd = NULL;
- if ((ar = window_arg(1, Args + 1, 1)) == NULL) {
- mess_temp(nstrcat("Unknown command or frame \"",
- Args[1], "\" ignored", NULL));
- return(FAIL);
- }
- }
- break;
- default:
- /*
- * Two arguments to frm-mgmt
- *
- * first arg is the command, the second is the frame
- */
- len = strlen(Args[1]);
- if (strnCcmp(Args[1], "move", len) == 0 ||
- strnCcmp(Args[1], "reshape", len) == 0) {
- cmd = Args[1];
- if ((ar = window_arg(1, Args + 2, 1)) == NULL) {
- mess_temp(nstrcat("Can't find frame \"",
- Args[2], "\"", NULL));
- return(FAIL);
- }
- }
- else if (strnCcmp(Args[1], "list", len) == 0) {
- cmd = Args[1];
- mess_temp("Arguments to \"list\" ignored");
- }
- else {
- mess_temp(nstrcat("Unknown command \"", Args[1],
- "\" ignored", NULL));
- return(FAIL);
- }
- }
-
- if (cmd == NULL) {
- /*
- * if the command (list, reshape, move ...) is not specified
- * then display a menu of available (frame management) commands
- */
- a.id = (int) menu_make(-1, "Frame Management",
- VT_NONUMBER | VT_CENTER, VT_UNDEFINED, VT_UNDEFINED,
- 0, 0, mgmt_disp, NULL);
- if (a.id == FAIL)
- return(FAIL);
- ar_menu_init(&a);
- a.fcntbl[AR_ODSH] = mgmt_odsh;
- a.fcntbl[AR_HELP] = mgmt_help;
- a.odptr = (char *) ar;
- a.flags = 0;
- return(ar_current(ar_create(&a), FALSE) == /* abs k15 */
- NULL? FAIL : SUCCESS);
- }
- else if (strncmp(cmd, "list", strlen(cmd)) == 0) {
- /*
- * if the command is "list" then generate a menu that
- * will list all active frames
- */
- list_create();
- }
- else if (strncmp(cmd, "move", strlen(cmd)) == 0) {
- /*
- * if the command is "move" then enter "move" mode ...
- */
- enter_wdw_mode(ar, FALSE);
- }
- else if (strncmp(cmd, "reshape", strlen(cmd)) == 0) {
- /*
- * if the command is "reshape" then make sure the
- * frame can be reshaped before performing the operation
- */
- if (ar && (ar->flags & AR_NORESHAPE))
- mess_temp("Forms cannot be reshaped");
- else
- enter_wdw_mode(ar, TRUE); /* reshape it */
- }
- else {
- mess_temp("Bad argument to frmmgmt: try list, move or reshape");
- return(FAIL);
- }
- return(SUCCESS);
-}
diff --git a/usr/src/cmd/fmli/xx/Makefile b/usr/src/cmd/fmli/xx/Makefile
deleted file mode 100644
index b621ebbad1..0000000000
--- a/usr/src/cmd/fmli/xx/Makefile
+++ /dev/null
@@ -1,65 +0,0 @@
-#
-# CDDL HEADER START
-#
-# The contents of this file are subject to the terms of the
-# Common Development and Distribution License (the "License").
-# You may not use this file except in compliance with the License.
-#
-# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
-# or http://www.opensolaris.org/os/licensing.
-# See the License for the specific language governing permissions
-# and limitations under the License.
-#
-# When distributing Covered Code, include this CDDL HEADER in each
-# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
-# If applicable, add the following below this CDDL HEADER, with the
-# fields enclosed by brackets "[]" replaced with your own identifying
-# information: Portions Copyright [yyyy] [name of copyright owner]
-#
-# CDDL HEADER END
-#
-
-#
-# Copyright 2007 Sun Microsystems, Inc. All rights reserved.
-# Use is subject to license terms.
-#
-# ident "%Z%%M% %I% %E% SMI"
-#
-
-include ../../Makefile.cmd
-
-PROG = fmli vsig
-SRCS = vsig.c main.c
-FILEMODE = 0755
-
-# fmli local libraries
-LOCAL = wish oh wish oeu form qued menu proc sys vt
-LDLIBS.local = $(LOCAL:%=../%/lib%.a)
-
-fmli := LDLIBS += $(LDLIBS.local) -lcurses
-fmli := MAPFILES = $(MAPFILE.INT) $(MAPFILE.NGB)
-fmli := LDFLAGS += $(MAPFILES:%=-M%)
-
-CPPFLAGS = -I../inc $(CPPFLAGS.master)
-
-.KEEP_STATE:
-
-all: $(PROG)
-
-fmli: main.c $$(MAPFILES)
- $(LINK.c) -o $@ main.c $(LDLIBS)
- $(POST_PROCESS)
-
-# check if local libraries are up to date.
-$(LDLIBS.local):
- @cd $(@D); pwd; $(MAKE) $(MFLAGS) all
-
-install: all $(ROOTPROG)
-
-clean:
-
-lint: $(SRCS)
- $(LINT.c) main.c
- $(LINT.c) vsig.c
-
-include ../../Makefile.targ
diff --git a/usr/src/cmd/fmli/xx/main.c b/usr/src/cmd/fmli/xx/main.c
deleted file mode 100644
index 0f1b58eca6..0000000000
--- a/usr/src/cmd/fmli/xx/main.c
+++ /dev/null
@@ -1,590 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-
-/*
- * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-/* Copyright (c) 1984, 1985, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-#include <stdio.h>
-#include <signal.h>
-#include <curses.h>
-#include <term.h>
-#include <unistd.h>
-#include "wish.h"
-#include "token.h"
-#include "actrec.h"
-#include "terror.h"
-#include "ctl.h"
-#include "vtdefs.h"
-/* #include "status.h" empty include file abs 9/14/88 */
-#include "moremacros.h"
-#include "sizes.h"
-
-
-/*
- * External Globals
- */
-int Vflag = 0; /* Set if running FACE User Interface */
-pid_t Fmli_pid; /* Process id of this FMLI. EFT abs k16 */
-char Semaphore[PATHSIZ] = "/tmp/FMLIsem."; /* for asynch coprocs */
-bool Suspend_interupt;
-char *Suspend_window;
-char *Aliasfile; /* File of path aliases */
-extern char *Home;
-extern char *tigetstr(); /* curses routine */
-extern long strtol(); /* abs k16 */
-extern pid_t getpid(); /* EFT abs k18 */
-extern void mess_init(); /* abs k18 */
-extern char *Filesys;
-extern char *Oasys;
-
-/*
- * Defines for SLK layout (4-4 or 3-2-3 layout can be specified in curses)
- */
-#define FOURFOUR "4-4"
-#define LAYOUT_DESC "slk_layout"
-
-/*
- * Default FMLI Stream handler
- */
-token physical_stream();
-token virtual_stream();
-token actrec_stream();
-token global_stream();
-token menu_stream();
-token error_stream();
-
-token (*Defstream[])() = {
- physical_stream,
- virtual_stream,
- actrec_stream,
- global_stream,
- error_stream,
- NULL
-};
-
-extern char *Progname;
-extern int curses_initialized;
-
-/* Status line variables */
-long Mail_check;
-char *Mail_file;
-time_t Cur_time; /* EFT abs k16 */
-
-/*
- * Static globals
- */
-static char Vpid[12] = "VPID=";
-static char Fcolor[17] = "HAS_COLORS=";
-static char Display_H[16] = "DISPLAYH=";
-static char Display_W[16] = "DISPLAYW=";
-
-static void vm_initobjects();
-static void vm_setup();
-static void on_suspend();
-static void sig_catch();
-/* static int sig_catch(); abs */
-static void vinterupt(int sig);
-static void susp_res(int sig);
-
-int
-main(int argc, char *argv[])
-{
- register int i, c;
- static char mail_template[256] = "/usr/mail/";
- token t;
- extern char *optarg;
- extern int optind;
- char *initfile, *commfile, *p, *pidstr;
- int labfmt, errflg;
- vt_id vid, copyright();
- char *itoa(), *estrtok(), *path_to_full();
- char *filename(), *getenv(), *strnsave();
- void susp_res(), vinterupt(), screen_clean();
- time_t time(); /* EFT abs k16 */
- extern int vt_redraw();
- extern void exit(); /* abs 9/12/88, also removed decl below */
- struct actrec *firstar, *wdw_to_ar();
-
-/* LES: optimize malloc(3X) */
-
- if (p = getenv("VMFMLI")) {
- Vflag++;
- putenv("VMFMLI=false");
- }
- /* Home assignment moved here from the if-block above,
- * because Home not set if VMFMLI is not set and Home
- * needed in read_inits()'s in some occasions - jukka.
- */
- if ((Home = getenv("HOME")) == NULL)
- fatal(MUNGED, "HOME!");
- errflg = 0;
- Progname = filename(argv[0]);
- Aliasfile = initfile = commfile = (char *) NULL;
- while ((c = getopt(argc, argv, "i:c:a:")) != EOF) {
- switch(c) {
- case 'i':
- initfile = optarg;
- break;
- case 'c':
- commfile = optarg;
- break;
- case 'a':
- Aliasfile = strsave(optarg);
- break;
- case '?':
- errflg++;
- break;
- }
- }
-
- /*
- * Check arguments
- */
- if (errflg) {
- fprintf(stderr, "usage: %s [-i initfile] [-c commandfile] [-a aliasfile] object ...\n", Progname);
- exit(-1); /* this is fmli's exit not the C library call */
- }
- if (optind == argc) {
- fprintf(stderr, "Initial object must be specified\n");
- exit(-1); /* this is fmli's exit not the C library call */
- }
-
- /*
- * check that all objects exist AND that they are readable
- */
- if (initfile && access(initfile, 4) < 0) {
- errflg++;
- fprintf(stderr, "Can't open initialization file \"%s\"\n", initfile);
- }
- if (commfile && access(commfile, 4) < 0) {
- errflg++;
- fprintf(stderr, "Can't open commands file \"%s\"\n", commfile);
- }
- if (Aliasfile && access(Aliasfile, 4) < 0) {
- errflg++;
- fprintf(stderr, "Can't open alias file \"%s\"\n", Aliasfile);
- }
- for (i = optind; i < argc; i++) {
- if (access(argv[i], 4) < 0) {
- errflg++;
- fprintf(stderr, "Can't open object \"%s\"\n", argv[i]);
- }
- }
- if (errflg)
- exit(-1); /* this is fmli's exit not the C library call */
-
- if (!isatty(fileno(stdin))) {
- (void) fprintf(stderr, "Error: stdin is not a terminal\n");
- exit(-1);
- }
-
- /*
- * handle signals
- */
- if (p = getenv("DEBUG"))
- _Debug = (int) strtol(p, 0, 0);
- /* changed signal()'s to sigset()'s.. abs */
- if (sigset(SIGINT, SIG_IGN) != SIG_IGN)
- sigset(SIGINT, exit); /* fmli's exit not the C library call */
- if (sigset(SIGHUP, SIG_IGN) != SIG_IGN)
- sigset(SIGHUP, exit); /* fmli's exit not the C library call */
- if (sigset(SIGTERM, SIG_IGN) != SIG_IGN)
- sigset(SIGTERM, exit); /* fmli's exit not the C library call */
- (void) sigset(SIGALRM, sig_catch);
- /* for job control: want to reset tty before suspending and.. */
-#ifdef SIGTSTP /* .. cleanup after. */
- (void) signal(SIGTSTP, on_suspend); /* must be signal not sigset */
-#endif
-
- /*
- * initialize terminal/screen
- */
- labfmt = 0;
- if (initfile) {
- /*
- * Set up SLK layout as 4-4 or 3-2-3 ... This needs
- * to be determined BEFORE curses is initialized
- * in vt_init.
- */
- char *slk_layout, *get_desc_val();
-
- slk_layout = get_desc_val(initfile, LAYOUT_DESC);
- if (strcmp(slk_layout, FOURFOUR) == 0)
- labfmt = 1;
-
- }
- vt_init(labfmt);
- onexit(screen_clean);
-
- /*
- * indicate in the environment if the terminal we just
- * initialized has color capability or not --dmd
- * ..also indicate the size of the display area. --abs
- */
- if ( has_colors() )
- strcat(Fcolor, "true");
- else
- strcat(Fcolor, "false");
- putenv(Fcolor);
- strcat(Display_W, itoa((long)COLS, 10)); /* abs k16 */
- strcat(Display_H, itoa((long)LINES - RESERVED_LINES, 10)); /* abs k16 */
- putenv(Display_W);
- putenv(Display_H);
-
- /*
- * Read defaults from initialization file
- */
- setup_slk_array();
- read_inits(initfile);
-
- /*
- * set up default banner and working indicator strings ...
- * and set color attributes if terminal supports color
- */
- /* Changed the order of next two calls.
- * First set colors and after it the baner line. mek k17
- */
- set_def_colors();
- set_def_status();
-
- /*
- * Define screen function keys for terminals that do not have
- * them defined like att630. mek k17
- * Must be After sigset(SIGALRM...). abs k18
- */
- init_sfk(TRUE);
-
- /*
- * Put up an Introductory Object and the working indicator
- */
- vid = copyright();
- working(TRUE);
- if (vid)
- vt_close(vid);
-
-/* remove this ifdef and sigset when i386 sleep(2C) is fixed to reset the
- * SIGALRM signal handler. abs k18
- */
-#ifdef i386
- (void) sigset(SIGALRM, sig_catch); /* copied from above. abs k18 */
-#endif
- /*
- * Initialize command table...
- * Read commands from commands file
- */
- cmd_table_init();
- if (commfile)
- read_cmds(commfile);
-
- /*
- * Set up FACE globals
- */
- if (Vflag)
- vm_setup();
- else {
- /* cannot dereference null ptrs */
- Home = nil;
- Oasys = nil;
- Filesys = nil;
- }
-
- /*
- * Set mailcheck (use mail_file variable as temp
- * variable for MAILCHECK)
- */
- Mail_check = 0L;
- if (Mail_file = getenv("MAILCHECK"))
- Mail_check = (long) atoi(Mail_file);
- if (Mail_check == 0L)
- Mail_check = 300L;
- else
- Mail_check = max(Mail_check, 120L);
- if ((Mail_file = getenv("MAIL")) == NULL) {
- Mail_file = mail_template;
- strcat(Mail_file, getenv("LOGNAME"));
- }
- Cur_time = time((time_t)0L); /* EFT abs k16 */
-
- /*
- * Initialize object architecture (SORTMODE)
- */
- oh_init();
-
- /*
- * set VPID env variable to pid for suspend/resume (SIGUSR1)
- * and asynchronous activity (SIGUSR2)
- */
- Fmli_pid = getpid();
- pidstr = itoa((long)Fmli_pid, 10);
- strcat(Vpid, pidstr);
- putenv(Vpid);
- strcat(Semaphore, pidstr); /* for enhanced asynch coprocs */
- /* changed from signal()... abs */
- sigset(SIGUSR1, susp_res); /* set sigs for suspend/resume */
- sigset(SIGUSR2, vinterupt); /* set sigs for interactive windows */
-
- /*
- * Setup windows to be opened upon login
- */
- for (i = optind; i < argc; i++) {
- objop("OPEN", NULL, p = path_to_full(argv[i]), NULL);
- free(p);
- ar_ctl(ar_get_current(), CTSETLIFE, AR_INITIAL, NULL, NULL, NULL, NULL, NULL);
- }
-
- /*
- * make the first window current
- */
-
- if ((argc - optind) >= 1) {
- if (firstar = wdw_to_ar(1))
- {
- /*
- * clean-up messages left over by opening initial objects
- */
-
- mess_init(); /* abs k18 */
- ar_current(firstar, FALSE); /* abs k15 */
- } else {
- mess_flush(FALSE);
- vt_flush();
- sleep(3);
- exit(-1); /* fmli's exit not the C library call */
- }
- }
-
- /*
- * Check wastebasket
- */
- if (Vflag) {
- vm_initobjects();
- showmail(TRUE);
- }
-
- while ((t = stream(TOK_NOP, Defstream)) != TOK_LOGOUT)
- ;
- return (0);
-}
-
-static bool Suspend_allowed = TRUE;
-
-bool
-suspset(b)
-bool b;
-{
- bool old = Suspend_allowed;
-
- Suspend_allowed = b;
- return(old);
-}
-
-long Interupt_pending = 0;
-
-static void
-vinterupt(int sig)
-{
- (void) sigset(sig, vinterupt); /* changed from signal() abs */
- Interupt_pending++;
- return;
-}
-
-static void
-susp_res(int sig)
-{
- char buf[BUFSIZ];
- pid_t respid; /* EFT abs k16 */
-
- FILE *fp;
-
- char *getepenv();
-
- (void) sigset(sig, susp_res); /* changed from signal abs */
-
- sprintf(buf, "/tmp/suspend%ld", getpid());
- if ((fp = fopen(buf, "r")) == NULL) { /* resume failed */
- _debug(stderr, "Unable to open resume file\n");
- return;
- }
-
- (void) unlink(buf);
- if (fgets(buf, BUFSIZ, fp) == NULL) {
- _debug(stderr, "could not read resume file");
- } else {
- respid = strtol(buf, (char **)NULL, 0); /* EFT abs k16 */
- if (!Suspend_allowed) {
- fflush(stdout);
- fflush(stderr);
- printf("\r\n\nYou are not allowed to suspend at this time.\r\n");
- printf("You are in the process of logging out of FACE.\r\n");
- printf("Please take steps to end the application program you are\n\r");
- printf("currently using.\n\r");
- fflush(stdout);
- sleep(4);
- if (kill(respid, SIGUSR1) == FAIL)
- Suspend_interupt = TRUE;
- fclose(fp);
- return;
- }
-
- if (fgets(buf, BUFSIZ, fp) != NULL) {
- buf[strlen(buf) - 1] = '\0';
- if (buf[0])
- Suspend_window = strsave(buf);
- else
- Suspend_window = NULL;
- } else
- Suspend_window = NULL;
- _debug(stderr, "Resume pid is %d\n", respid);
- ar_ctl(ar_get_current(), CTSETPID, respid, NULL, NULL, NULL, NULL, NULL);
- }
- fclose(fp);
-
- Suspend_interupt = TRUE; /* let wait loop in proc_current know */
- return;
-}
-
-/* static int changed to void abs 9/12/88 */
-static void
-sig_catch(n)
-int n;
-{
-/* signal(n, sig_catch);
-abs */
- sigset(n, sig_catch);
-}
-
-
-static void
-pull() /* force various library routines to get pulled in */
-{
- menu_stream();
- actrec_stream();
- error_stream();
- virtual_stream();
- stubs();
- indicator();
-}
-
-char Opwd[PATHSIZ+5];
-extern char *Filecabinet;
-extern char *Wastebasket;
-
-static void
-vm_setup()
-{
- static char filecabinet[] = "";
- static char wastebasket[] = "/WASTEBASKET";
- char *p, *getenv(), *getepenv();
-
- /*
- * get/set globals
- */
- /* Home not initialized soon enough. Moved up into main(). -bhl */
- /*if ((Home = getenv("HOME")) == NULL)
- fatal(MUNGED, "HOME!");*/
- if ((Filesys = getenv("VMSYS")) == NULL)
- fatal(MUNGED, "VMSYS");
- if ((Oasys = getenv("OASYS")) == NULL)
- fatal(MUNGED, "OASYS");
- Filecabinet = strnsave(Home, strlen(Home) + sizeof(filecabinet) - 1);
- strcat(Filecabinet, filecabinet);
- Wastebasket = strnsave(Home, strlen(Home) + sizeof(wastebasket) - 1);
- strcat(Wastebasket, wastebasket);
-
- sprintf(Opwd, "OPWD=%s", Filecabinet);
- putenv(Opwd);
- if (p = getepenv("UMASK")) /* set file masking */
- umask((mode_t) strtol(p, NULL, 8)); /* EFT abs k16 */
-}
-
-#define MAX_WCUST (9)
-static char Loginwins[] = "LOGINWIN "; /* leave space for a digit */
-
-static void
-vm_initobjects()
-{
- char *p;
- register int i;
- char *path_to_full(), *getepenv();
- struct actrec *prev, *firstobj;
-
- prev = NULL;
- firstobj = ar_get_current();
- for (i = 1; i <= MAX_WCUST; i++) {
- Loginwins[sizeof(Loginwins) - 2] = '0' + i;
-
- if ((p = getepenv(Loginwins)) != NULL && *p) {
- p = path_to_full(p);
- if (prev) /* aids ordering */
- ar_current(prev, FALSE); /* abs k15 */
- objop("OPEN", NULL, p, NULL);
- if (firstobj != (prev = ar_get_current()))
- ar_ctl(prev, CTSETLIFE, AR_PERMANENT, NULL, NULL, NULL, NULL, NULL);
- free(p);
- ar_current(firstobj, FALSE); /* aids ordering *//*abs k15*/
- }
- }
-
- /* clean out WASTEBASKET, if needed */
- if (p = getepenv("WASTEPROMPT")) {
- objop("OPEN", "MENU", strCcmp(p, "yes") ?
- "$VMSYS/OBJECTS/Menu.remove" :
- "$VMSYS/OBJECTS/Menu.waste", NULL);
- free(p);
- }
- else
- objop("OPEN", "MENU", "$VMSYS/OBJECTS/Menu.remove", NULL);
-}
-
-
-/*
- * Signal handler for SIGTSTP, the user job control suspend signal.
- * Clear the screen and then do the default action for the signal.
- * On return, redraw the screen.
- */
-#ifdef SIGTSTP
-static void
-on_suspend(signum)
-int signum;
-{
- if (curses_initialized)
- endwin(); /* reset tty to normal */
- kill(getpid(), signum);
-
- /* start back here when resumed after job control suspend */
-
- signal(signum, on_suspend); /* reset the signal */
-
- (void) putchar('\0'); /* output something innocent so we will.. */
- /* ..suspend on o/p if running in background */
- if (curses_initialized)
- vt_redraw(); /* refresh the screen */
-}
-#endif
diff --git a/usr/src/cmd/fmli/xx/mapfile-intf b/usr/src/cmd/fmli/xx/mapfile-intf
deleted file mode 100644
index 1a59617158..0000000000
--- a/usr/src/cmd/fmli/xx/mapfile-intf
+++ /dev/null
@@ -1,46 +0,0 @@
-#
-# CDDL HEADER START
-#
-# The contents of this file are subject to the terms of the
-# Common Development and Distribution License (the "License").
-# You may not use this file except in compliance with the License.
-#
-# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
-# or http://www.opensolaris.org/os/licensing.
-# See the License for the specific language governing permissions
-# and limitations under the License.
-#
-# When distributing Covered Code, include this CDDL HEADER in each
-# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
-# If applicable, add the following below this CDDL HEADER, with the
-# fields enclosed by brackets "[]" replaced with your own identifying
-# information: Portions Copyright [yyyy] [name of copyright owner]
-#
-# CDDL HEADER END
-#
-
-#
-# Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
-#
-
-#
-# MAPFILE HEADER START
-#
-# WARNING: STOP NOW. DO NOT MODIFY THIS FILE.
-# Object versioning must comply with the rules detailed in
-#
-# usr/src/lib/README.mapfiles
-#
-# You should not be making modifications here until you've read the most current
-# copy of that file. If you need help, contact a gatekeeper for guidance.
-#
-# MAPFILE HEADER END
-#
-
-$mapfile_version 2
-
-# fmli interposes on exit() so identify this as an interposer.
-SYMBOL_SCOPE {
- global:
- exit { FLAGS = INTERPOSE };
-};
diff --git a/usr/src/cmd/fmli/xx/vsig.c b/usr/src/cmd/fmli/xx/vsig.c
deleted file mode 100644
index fadeea031b..0000000000
--- a/usr/src/cmd/fmli/xx/vsig.c
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-
-/*
- * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-/* Copyright (c) 1984, 1985, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-/*
- * This short program is called by a co-process if it wishes to
- * communicate asynchronously with the controlling FMLI process during
- * the course of its execution. It blocks til FMLI is ready for a
- * signal then sends a SIGUSR2.
- */
-
-#include <stdio.h>
-#include <signal.h>
-#include <fcntl.h>
-#include "sizes.h"
-
-
-char Semaphore[PATHSIZ] = "/tmp/FMLIsem.";
-
-int
-main(int argc, char *argv[])
-{
- char *vpid;
- char *getenv();
-
- if ((vpid = getenv("VPID")) == NULL)
- exit(1);
- strcat(Semaphore, vpid);
- fflush(stdout);
- fflush(stderr);
- /*
- * The reason for the close(open) is to
- * block until FACE says its is OK
- * to send a signal ... A signal when
- * FACE is updating the screen
- * can create garbage .....
- */
- close(open(Semaphore, O_WRONLY));
- kill(strtol(vpid, (char **)NULL, 0), SIGUSR2); /* EFT abs k16 */
- return (0);
-}
diff --git a/usr/src/cmd/man/src/man.c b/usr/src/cmd/man/src/man.c
index 417d5549e9..a73129e751 100644
--- a/usr/src/cmd/man/src/man.c
+++ b/usr/src/cmd/man/src/man.c
@@ -19,8 +19,7 @@
* CDDL HEADER END
*/
/*
- * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
+ * Copyright (c) 1990, 2010, Oracle and/or its affiliates. All rights reserved.
*/
/* Copyright (c) 1983, 1984, 1985, 1986, 1987, 1988, 1989 AT&T. */
@@ -217,7 +216,7 @@ static struct pathmap {
* Restrict to section 1 so that whatis /usr/{,xpg4,xpg6}/bin/ls
* does not confuse users with section 1 and 1b
*/
- {"/usr/bin", "/usr/share/man,1,1m,1s,1t,1c,1f", 0, 0},
+ {"/usr/bin", "/usr/share/man,1,1m,1s,1t,1c", 0, 0},
{"/usr/xpg4/bin", "/usr/share/man,1", 0, 0},
{"/usr/xpg6/bin", "/usr/share/man,1", 0, 0},
{NULL, NULL, 0, 0}
@@ -768,7 +767,7 @@ getsect(struct man_node *manp, char **pv)
manp->defsrch = 1;
/*
* TRANSLATION_NOTE - message for man -d or catman -p
- * ex. /usr/share/man: from man.cf, MANSECTS=1,1m,1c,1f
+ * ex. /usr/share/man: from man.cf, MANSECTS=1,1m,1c
*/
if (debug)
(void) fprintf(stdout, gettext(
diff --git a/usr/src/pkg/manifests/SUNWcs.mf b/usr/src/pkg/manifests/SUNWcs.mf
index cf62dc6b84..3f864de738 100644
--- a/usr/src/pkg/manifests/SUNWcs.mf
+++ b/usr/src/pkg/manifests/SUNWcs.mf
@@ -775,7 +775,6 @@ file path=usr/bin/fdformat mode=4555
file path=usr/bin/fgrep mode=0555
file path=usr/bin/file mode=0555
file path=usr/bin/find mode=0555
-file path=usr/bin/fmli mode=0755
file path=usr/bin/fmt mode=0555
file path=usr/bin/fmtmsg mode=0555
file path=usr/bin/fold mode=0555
diff --git a/usr/src/pkg/manifests/system-extended-system-utilities.mf b/usr/src/pkg/manifests/system-extended-system-utilities.mf
index f93ca65d31..d852d3ba12 100644
--- a/usr/src/pkg/manifests/system-extended-system-utilities.mf
+++ b/usr/src/pkg/manifests/system-extended-system-utilities.mf
@@ -127,7 +127,6 @@ file path=usr/bin/unix2dos mode=0555
file path=usr/bin/unpack mode=0555
file path=usr/bin/uudecode group=uucp mode=0555
file path=usr/bin/uuencode group=uucp mode=0555
-file path=usr/bin/vsig mode=0755
file path=usr/bin/yes mode=0555
file path=usr/lib/$(ARCH64)/madv.so.1
file path=usr/lib/$(ARCH64)/mpss.so.1