home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / sources / unix / volume8 / jove / part08 / vars.c < prev    next >
Encoding:
C/C++ Source or Header  |  1987-02-03  |  3.3 KB  |  90 lines

  1. /************************************************************************
  2.  * This program is Copyright (C) 1986 by Jonathan Payne.  JOVE is       *
  3.  * provided to you without charge, and with no warranty.  You may give  *
  4.  * away copies of JOVE, including sources, provided that this notice is *
  5.  * included in all the files.                                           *
  6.  ************************************************************************/
  7.  
  8. #include "jove.h"
  9.  
  10. struct variable    variables[] = {
  11.     VARIABLE, "allow-^S-and-^Q", &OKXonXoff, V_BOOL|V_TTY_RESET,
  12.     VARIABLE, "allow-bad-filenames", &OkayBadChars, V_BOOL,
  13. #ifdef ABBREV
  14.     VARIABLE, "auto-case-abbrev", &AutoCaseAbbrev, V_BOOL,
  15. #endif
  16. #ifdef F_COMPLETION
  17.     VARIABLE, "bad-filename-extensions", (int *) BadExtensions, V_STRING,
  18. #endif
  19.     VARIABLE, "c-indentation-increment", &CIndIncrmt, V_BASE10,
  20.     VARIABLE, "case-ignore-search", &CaseIgnore, V_BOOL,
  21. #ifdef CMT_FMT
  22.      VARIABLE, "comment-format", (int *) CmtFmt, V_STRING,
  23. #endif
  24. #ifdef BIFF
  25.     VARIABLE, "disable-biff", &BiffChk, V_BOOL,
  26. #endif
  27.     VARIABLE, "error-window-size", &EWSize, V_BASE10,
  28.     VARIABLE, "file-creation-mode", &CreatMode, V_BASE8,
  29.     VARIABLE, "files-should-end-with-newline", &EndWNewline, V_BOOL,
  30.     VARIABLE, "internal-tabstop", &tabstop, V_BASE10|V_CLRSCREEN,
  31.     VARIABLE, "left-margin", &LMargin, V_BASE10,
  32.     VARIABLE, "mailbox", (int *) Mailbox, V_FILENAME,
  33.     VARIABLE, "mail-check-frequency", (int *) &MailInt, V_BASE10,
  34. #ifdef BACKUPFILES
  35.     VARIABLE, "make-backup-files", &BkupOnWrite, V_BOOL,
  36. #endif
  37.     VARIABLE, "mark-threshold", &MarkThresh, V_BASE10,
  38.     VARIABLE, "marks-should-float", &MarksShouldFloat, V_BOOL,
  39.     VARIABLE, "match-regular-expressions", &UseRE, V_BOOL,
  40.     VARIABLE, "meta-key", &MetaKey, V_BOOL|V_TTY_RESET,
  41.     VARIABLE, "mode-line", (int *) ModeFmt, V_STRING|V_MODELINE,
  42.     VARIABLE, "mode-line-should-standout", &BriteMode, V_BOOL|V_MODELINE,
  43.     VARIABLE, "paren-flash-delay", &PDelay, V_BASE10,
  44.     VARIABLE, "physical-tabstop", &phystab, V_BASE10|V_CLRSCREEN,
  45. #ifdef IPROCS
  46.     VARIABLE, "process-prompt", (int *) proc_prompt, V_STRING,
  47. #endif
  48.     VARIABLE, "interrupt-character", &IntChar, V_CHAR|V_TTY_RESET,
  49.     VARIABLE, "right-margin", &RMargin, V_BASE10,
  50.     VARIABLE, "scroll-step", &ScrollStep, V_BASE10,
  51.     VARIABLE, "search-exit-char", &SExitChar, V_CHAR,
  52.     VARIABLE, "send-typeout-to-buffer", &UseBuffers, V_BOOL,
  53.     VARIABLE, "shell", (int *) Shell, V_STRING,
  54.     VARIABLE, "shell-flags", (int *) ShFlags, V_STRING,
  55.     VARIABLE, "sync-frequency", &SyncFreq, V_BASE10,
  56.     VARIABLE, "tag-file", (int *) TagFile, V_FILENAME,
  57.     VARIABLE, "tmp-file-pathname", (int *) TmpFilePath, V_FILENAME,
  58.     VARIABLE, "update-time-frequency", &UpdFreq, V_BASE10,
  59. #ifdef ID_CHAR
  60.     VARIABLE, "use-i/d-char", &UseIC, V_BOOL,
  61. #endif
  62.     VARIABLE, "visible-bell", &VisBell, V_BOOL,
  63.     VARIABLE, "wrap-search", &WrapScan, V_BOOL,
  64.     VARIABLE, "write-files-on-make", &WtOnMk, V_BOOL,
  65.     VARIABLE, 0, 0, 0
  66. };
  67.  
  68. data_obj *
  69. findvar(prompt)
  70. char    *prompt;
  71. {
  72.     static char    *strings[(sizeof variables) / sizeof (struct variable)];
  73.     static int    beenhere = 0;
  74.     register int    com;
  75.  
  76.     if (beenhere == 0) {
  77.         register char    **strs = strings;
  78.         register struct variable    *v = variables;
  79.  
  80.         beenhere = 1;
  81.         for (; v->Name; v++)
  82.             *strs++ = v->Name;
  83.         *strs = 0;
  84.     }
  85.  
  86.     if ((com = complete(strings, prompt, NOTHING)) < 0)
  87.         return 0;
  88.     return (data_obj *) &variables[com];
  89. }
  90.