1 /* Copyright (C) 1990 Transarc Corporation - All rights reserved */
3 * (C) COPYRIGHT IBM CORPORATION 1987, 1998
4 * LICENSED MATERIALS - PROPERTY OF IBM
17 #include <sys/socket.h>
18 #include <netinet/in.h>
24 #include <rx/rx_globals.h>
26 #include <afs/bubasics.h>
28 #include <afs/afsutil.h>
30 #include <afs/cellconfig.h>
35 #include <afs/volser.h> /*VLDB_MAXSERVERS*/
36 #include <afs/com_err.h>
40 #include "bc.h" /*Backup Coordinator structs and defs*/
43 int localauth, interact;
46 extern int BC_ExecuteRequest();
47 extern int bc_AddDumpCmd();
48 extern int bc_AddHostCmd();
49 extern int bc_AddVolEntryCmd();
50 extern int bc_AddVolSetCmd();
51 /* extern int bc_CheckDumpStatCmd(); */
52 extern int bc_DeleteDumpCmd();
53 extern int bc_DeleteHostCmd();
54 extern int bc_DeleteVolEntryCmd();
55 extern int bc_DeleteVolSetCmd();
56 extern int bc_DiskRestoreCmd();
57 extern int bc_VolsetRestoreCmd();
58 extern int bc_DumpCmd();
59 extern int bc_GetTapeStatusCmd();
60 extern int bc_JobsCmd();
61 extern int bc_KillCmd();
62 extern int bc_LabelTapeCmd();
63 extern int bc_ListDumpScheduleCmd();
64 extern int bc_ListHostsCmd();
65 extern int bc_ListVolSetCmd();
66 extern int bc_QuitCmd();
67 extern int bc_ReadLabelCmd();
68 extern int bc_ScanDumpsCmd();
69 extern int bc_SetExpCmd();
70 extern int bc_VolRestoreCmd();
71 extern int bc_dblookupCmd();
72 extern int bc_dbVerifyCmd();
73 extern int bc_deleteDumpCmd();
74 extern int bc_dumpInfoCmd();
75 extern int bc_restoreDbCmd();
76 extern int bc_saveDbCmd();
81 * Global configuration information for the Backup Coordinator.
83 struct bc_config *bc_globalConfig; /*Ptr to global BC configuration info*/
85 extern struct rx_securityClass *rxnull_NewServerSecurityObject();
87 struct ubik_client *cstruct; /* Ptr to Ubik client structure*/
88 struct ktc_token ttoken; /* The token */
90 static const char *DefaultConfDir; /*Default backup config directory*/
91 static int bcInit = 0; /* backupInit called yet ? */
92 char *whoami = "backup";
94 /* dummy routine for the audit work. It should do nothing since audits */
95 /* occur at the server level and bos is not a server. */
96 osi_audit() {return 0;}
99 * Initialize all the error tables that may be used by com_err
104 initialize_acfg_error_table();
105 initialize_ka_error_table();
106 initialize_rxk_error_table();
107 initialize_cmd_error_table();
108 initialize_vl_error_table();
109 initialize_butm_error_table();
110 initialize_vols_error_table();
111 initialize_butc_error_table();
112 initialize_butx_error_table();
113 initialize_budb_error_table();
114 initialize_bucd_error_table();
115 initialize_ktc_error_table();
119 * got to account for the errors which are volume related but
120 * not dealt with by standard errno and com_err stuff.
122 void bc_HandleMisc(code)
125 if(((code <= VMOVED) && (code >= VSALVAGE)) || (code < 0)){
127 case -1 : fprintf(STDERR,"Possible communication failure\n");
129 case VSALVAGE: fprintf(STDERR,"Volume needs salvage\n");
131 case VNOVNODE: fprintf(STDERR,"Bad vnode number quoted\n");
133 case VNOVOL: fprintf(STDERR,"Volume not attached, does not exist, or not on line\n");
135 case VVOLEXISTS:fprintf(STDERR,"Volume already exists\n");
137 case VNOSERVICE:fprintf(STDERR,"Volume is not in service\n");
139 case VOFFLINE: fprintf(STDERR,"Volume is off line\n");
141 case VONLINE: fprintf(STDERR,"Volume is already on line\n");
143 case VDISKFULL: fprintf(STDERR,"Partition is full\n");
145 case VOVERQUOTA:fprintf(STDERR,"Volume max quota exceeded\n");
147 case VBUSY: fprintf(STDERR,"Volume temporarily unavailable\n");
149 case VMOVED:fprintf(STDERR,"Volume has moved to another server\n");
158 /* Return true if line is all whitespace */
159 static LineIsBlank(aline)
160 register char *aline;
164 while (tc = *aline++)
165 if ( (tc != ' ') && (tc != '\t') && (tc != '\n') ) return(0);
172 * initialize configuration information that is stored as text blocks
178 udbClientTextP ctPtr;
182 extern struct bc_config *bc_globalConfig;
184 mkdir(DefaultConfDir, 777); /* temporary */
186 /* initialize the client text structures */
187 ctPtr = &bc_globalConfig->configText[0];
189 for ( i = 0; i < TB_NUM; i++ )
191 bzero(ctPtr, sizeof(*ctPtr));
193 ctPtr->textVersion = -1;
200 /*----------------------------------------------------------------------------
204 * Routine that is called when the backup coordinator is invoked, responsible for
205 * basic initialization and some command line parsing.
208 * Zero (but may exit the entire program on error!)
211 * Nothing interesting.
214 * Initializes this program.
215 *----------------------------------------------------------------------------
218 static int backupInit()
220 register afs_int32 code;
221 static int initd = 0; /* ever called? */
223 PROCESS pid; /* LWP process ID*/
225 extern statusWatcher();
228 initialize_cmd_error_table();
230 /* don't run more than once */
233 com_err(whoami,0,"Backup already initialized.");
238 code = bc_InitConfig(DefaultConfDir);
241 com_err(whoami, code, "Can't initialize from config files in directory '%s'",
249 code = LWP_InitializeProcessSupport(LWP_NORMAL_PRIORITY, &pid);
252 com_err(whoami, code,"; Can't initialize LWP");
256 code = rx_Init(htons(0));
259 com_err(whoami, code, "; Can't initialize Rx");
263 rx_SetRxDeadTime(60);
265 /* VLDB initialization */
266 vldbClientInit(0, localauth, tcell, &cstruct, &ttoken);
267 if (code) return(code);
269 /* Backup database initialization */
270 code = udbClientInit(0, localauth, tcell);
271 if (code) return(code);
273 /* setup status monitoring thread */
275 code = LWP_CreateProcess(statusWatcher, 20480, LWP_NORMAL_PRIORITY, 2,
276 "statusWatcher", &watcherPid);
279 com_err(whoami, code, "; Can't create status monitor task");
286 /*----------------------------------------------------------------------------
290 * Make sure we mark down when we need to exit the Backup Coordinator.
291 * Specifically, we don't want to continue when our help and apropos
292 * routines are called from the command line.
295 * as : Ptr to the command syntax descriptor.
301 * This routine is called right before each of the Backup Coordinator
302 * opcode routines are invoked.
304 *----------------------------------------------------------------------------
307 static int MyBeforeProc(as)
308 register struct cmd_syndesc *as;
313 /* Handling the command line opcode */
316 localauth = ((as && as->parms[14].items) ? 1 : 0);
317 if (as && as->parms[15].items) strcpy(tcell, as->parms[15].items->data);
318 else tcell[0] = '\0';
323 com_err(whoami,code,"; Can't initialize backup");
327 /* Get initial information from the database */
328 code = bc_InitTextConfig();
331 com_err(whoami, code, "; Can't obtain configuration text from backup database");
343 #include "AFS_component_version_number.c"
345 #define MAXRECURSION 20
346 extern int dontExecute; /* declared in commands.c */
347 extern char *loadFile; /* declared in commands.c */
348 char lineBuffer[1024]; /* Line typed in by user or read from load file */
351 * This will dispatch a command. It holds a recursive loop for the
352 * "dump -file" option. This option reads backup commands from a file.
354 * Cannot put this code on other side of cmd_Dispatch call (in
355 * commands.c) because when make a dispatch call when in a dispatch
356 * call, environment is mucked up.
358 * To avoid multiple processes stepping on each other in the dispatch code,
359 * put a lock around it so only 1 process gets in at a time.
362 struct Lock dispatchLock; /* lock on the Dispatch call */
363 #define lock_Dispatch() ObtainWriteLock(&dispatchLock)
364 #define unlock_Dispatch() ReleaseWriteLock(&dispatchLock)
366 afs_int32 doDispatch(targc, targv, dispatchCount)
369 afs_int32 dispatchCount; /* to prevent infinite recursion */
377 int noExecute; /* local capy of global variable */
378 char *internalLoadFile;
382 loadFile = (char *) 0;
383 code = cmd_Dispatch(targc, targv);
384 internalLoadFile = loadFile;
388 if (internalLoadFile) /* Load a file in */
390 if (dispatchCount > MAXRECURSION) /* Beware recursive loops. */
392 com_err(whoami,0,"Potential recursion: will not load file %s", internalLoadFile);
397 fd = fopen(internalLoadFile, "r"); /* Open the load file */
400 com_err(whoami,errno,"; Cannot open file %s", internalLoadFile);
405 noExecute = dontExecute;
407 printf("Would have executed the following commands:\n");
410 while ( fgets(lineBuffer, sizeof(lineBuffer)-1, fd) ) /* Get commands from file */
414 i = strlen(lineBuffer) - 1;
415 if (lineBuffer[i] == '\n') /* Drop return at end of line */
416 lineBuffer[i] = '\0';
419 printf(" %s\n", lineBuffer); /* echo */
421 printf("------> %s\n", lineBuffer); /* echo */
423 if ( !LineIsBlank(lineBuffer) && /* Skip if blank line */
424 (lineBuffer[0] != '#') && /* or comment */
425 (!noExecute) ) /* or no execute */
427 c = cmd_ParseLine(lineBuffer, sargv, &sargc, MAXV);
430 com_err(whoami, c, "; Can't parse line");
434 doDispatch(sargc, sargv, dispatchCount+1); /* Recursive - ignore error */
435 cmd_FreeArgv(sargv); /* Free up arguments */
444 if (internalLoadFile) free(internalLoadFile);
448 int bc_interactCmd(as, arock)
449 struct cmd_syndesc *as;
455 static void add_std_args(ts)
456 register struct cmd_syndesc *ts;
459 cmd_AddParm(ts, "-localauth", CMD_FLAG, CMD_OPTIONAL, "local authentication");
460 cmd_AddParm(ts, "-cell", CMD_SINGLE, CMD_OPTIONAL, "cell name");
468 char **targv[MAXV]; /*Ptr to parsed argv stuff*/
469 afs_int32 targc; /*Num parsed arguments*/
470 afs_int32 code; /*Return code*/
471 char *tp; /*Result of gets()*/
472 register struct cmd_syndesc *ts; /*Ptr to parsed command line*/
478 * The following signal action for AIX is necessary so that in case of a
479 * crash (i.e. core is generated) we can include the user's data section
480 * in the core dump. Unfortunately, by default, only a partial core is
481 * generated which, in many cases, isn't too useful.
483 struct sigaction nsa;
485 sigemptyset(&nsa.sa_mask);
486 nsa.sa_handler = SIG_DFL;
487 nsa.sa_flags = SA_FULLDUMP;
488 sigaction(SIGSEGV, &nsa, NULL);
490 Lock_Init(&dispatchLock);
491 InitErrTabs(); /* init all the error tables which may be used */
493 /* setup the default backup dir */
494 DefaultConfDir = AFSDIR_SERVER_BACKUP_DIRPATH;
495 /* Get early warning if the command is interacive mode or not */
496 interact = ( ((argc < 2) || (argv[1][0] == '-')) ? 1 : 0 );
498 cmd_SetBeforeProc(MyBeforeProc, (char *)0);
500 ts = cmd_CreateSyntax("dump", bc_DumpCmd, 0, "start dump");
501 cmd_AddParm(ts, "-volumeset", CMD_SINGLE, CMD_OPTIONAL, "volume set name");
502 cmd_AddParm(ts, "-dump", CMD_SINGLE, CMD_OPTIONAL, "dump level name");
503 cmd_AddParm(ts, "-portoffset", CMD_SINGLE, CMD_OPTIONAL, "TC port offset");
504 cmd_AddParm(ts, "-at", CMD_LIST, CMD_OPTIONAL, "Date/time to start dump");
505 cmd_AddParm(ts, "-append", CMD_FLAG, CMD_OPTIONAL, "append to existing dump set");
506 cmd_AddParm(ts, "-n", CMD_FLAG, CMD_OPTIONAL, "don't really execute it");
507 cmd_AddParm(ts, "-file", CMD_SINGLE, CMD_OPTIONAL, "load file");
508 if (!interact) add_std_args(ts);
510 ts = cmd_CreateSyntax("volrestore", bc_VolRestoreCmd, 0, "restore volume");
511 cmd_AddParm(ts, "-server", CMD_SINGLE, CMD_REQUIRED, "destination machine");
512 cmd_AddParm(ts, "-partition", CMD_SINGLE, CMD_REQUIRED, "destination partition");
513 cmd_AddParm(ts, "-volume", CMD_LIST, CMD_REQUIRED, "volume(s) to restore");
514 cmd_AddParm(ts, "-extension", CMD_SINGLE, CMD_OPTIONAL, "new volume name extension");
515 cmd_AddParm(ts, "-date", CMD_LIST, CMD_OPTIONAL, "date from which to restore");
516 cmd_AddParm(ts, "-portoffset", CMD_LIST, CMD_OPTIONAL, "TC port offsets");
517 cmd_AddParm(ts, "-n", CMD_FLAG, CMD_OPTIONAL, "don't really execute it");
518 if (!interact) add_std_args(ts);
520 ts = cmd_CreateSyntax("diskrestore", bc_DiskRestoreCmd, 0, "restore partition");
521 cmd_AddParm(ts, "-server", CMD_SINGLE, CMD_REQUIRED, "machine to restore");
522 cmd_AddParm(ts, "-partition", CMD_SINGLE, CMD_REQUIRED, "partition to restore");
523 cmd_AddParm(ts, "-portoffset", CMD_LIST, CMD_OPTIONAL, "TC port offset");
525 cmd_AddParm(ts, "-newserver", CMD_SINGLE, CMD_OPTIONAL, "destination machine");
526 cmd_AddParm(ts, "-newpartition", CMD_SINGLE, CMD_OPTIONAL, "destination partition");
527 cmd_AddParm(ts, "-extension", CMD_SINGLE, CMD_OPTIONAL, "new volume name extension");
528 cmd_AddParm(ts, "-n", CMD_FLAG, CMD_OPTIONAL, "don't really execute it");
529 if (!interact) add_std_args(ts);
531 ts = cmd_CreateSyntax("quit", bc_QuitCmd, 0, "leave the program");
533 ts = cmd_CreateSyntax("volsetrestore", bc_VolsetRestoreCmd, 0, "restore a set of volumes");
534 cmd_AddParm(ts, "-name", CMD_SINGLE, CMD_OPTIONAL, "volume set name");
535 cmd_AddParm(ts, "-file", CMD_SINGLE, CMD_OPTIONAL, "file name");
536 cmd_AddParm(ts, "-portoffset", CMD_LIST, CMD_OPTIONAL, "TC port offset");
537 cmd_AddParm(ts, "-extension", CMD_SINGLE, CMD_OPTIONAL, "new volume name extension");
538 cmd_AddParm(ts, "-n", CMD_FLAG, CMD_OPTIONAL, "don't really execute it");
539 if (!interact) add_std_args(ts);
541 ts = cmd_CreateSyntax("addhost", bc_AddHostCmd, 0, "add host to config");
542 cmd_AddParm(ts, "-tapehost", CMD_SINGLE, CMD_REQUIRED, "tape machine name");
543 cmd_AddParm(ts, "-portoffset", CMD_SINGLE, CMD_OPTIONAL, "TC port offset");
544 if (!interact) add_std_args(ts);
546 ts = cmd_CreateSyntax("delhost", bc_DeleteHostCmd, 0, "delete host to config");
547 cmd_AddParm(ts, "-tapehost", CMD_SINGLE, CMD_REQUIRED, "tape machine name");
548 cmd_AddParm(ts, "-portoffset", CMD_SINGLE, CMD_OPTIONAL, "TC port offset");
549 if (!interact) add_std_args(ts);
551 ts = cmd_CreateSyntax("listhosts", bc_ListHostsCmd, 0, "list config hosts");
552 if (!interact) add_std_args(ts);
554 ts = cmd_CreateSyntax("jobs", bc_JobsCmd, 0, "list running jobs");
556 ts = cmd_CreateSyntax("kill", bc_KillCmd, 0, "kill running job");
557 cmd_AddParm(ts, "-id", CMD_SINGLE, CMD_REQUIRED, "job ID or dump set name");
559 ts = cmd_CreateSyntax("listvolsets", bc_ListVolSetCmd, 0, "list volume sets");
560 cmd_AddParm(ts, "-name", CMD_SINGLE, CMD_OPTIONAL, "volume set name");
561 if (!interact) add_std_args(ts);
563 ts = cmd_CreateSyntax("listdumps", bc_ListDumpScheduleCmd, 0, "list dump schedules");
564 if (!interact) add_std_args(ts);
566 ts = cmd_CreateSyntax("addvolset", bc_AddVolSetCmd, 0, "create a new volume set");
567 cmd_AddParm(ts, "-name", CMD_SINGLE, CMD_REQUIRED, "volume set name");
568 cmd_AddParm(ts, "-temporary", CMD_FLAG, CMD_OPTIONAL, "temporary volume set");
569 if (!interact) add_std_args(ts);
571 ts = cmd_CreateSyntax("status", bc_GetTapeStatusCmd, 0,
572 "get tape coordinator status");
573 cmd_AddParm(ts, "-portoffset", CMD_SINGLE, CMD_OPTIONAL, "TC port offset");
574 if (!interact) add_std_args(ts);
576 ts = cmd_CreateSyntax("delvolset", bc_DeleteVolSetCmd, 0, "delete a volume set");
577 cmd_AddParm(ts, "-name", CMD_LIST, CMD_REQUIRED, "volume set name");
578 if (!interact) add_std_args(ts);
580 ts = cmd_CreateSyntax("addvolentry", bc_AddVolEntryCmd, 0, "add a new volume entry");
581 cmd_AddParm(ts, "-name", CMD_SINGLE, CMD_REQUIRED, "volume set name");
582 cmd_AddParm(ts, "-server", CMD_SINGLE, CMD_REQUIRED, "machine name");
583 cmd_AddParm(ts, "-partition", CMD_SINGLE, CMD_REQUIRED, "partition name");
584 cmd_AddParm(ts, "-volumes", CMD_SINGLE, CMD_REQUIRED, "volume name (regular expression)");
585 if (!interact) add_std_args(ts);
587 ts = cmd_CreateSyntax("delvolentry", bc_DeleteVolEntryCmd, 0, "delete a volume set sub-entry");
588 cmd_AddParm(ts, "-name", CMD_SINGLE, CMD_REQUIRED, "volume set name");
589 cmd_AddParm(ts, "-entry", CMD_SINGLE, CMD_REQUIRED, "volume set index");
590 if (!interact) add_std_args(ts);
592 ts = cmd_CreateSyntax("adddump", bc_AddDumpCmd, 0, "add dump schedule");
593 cmd_AddParm(ts, "-dump", CMD_LIST, CMD_REQUIRED, "dump level name");
594 cmd_AddParm(ts, "-expires", CMD_LIST, CMD_OPTIONAL, "expiration date");
595 if (!interact) add_std_args(ts);
597 ts = cmd_CreateSyntax("deldump", bc_DeleteDumpCmd, 0, "delete dump schedule");
598 cmd_AddParm(ts, "-dump", CMD_SINGLE, CMD_REQUIRED, "dump level name");
599 if (!interact) add_std_args(ts);
601 ts = cmd_CreateSyntax("labeltape", bc_LabelTapeCmd, 0, "label a tape");
602 cmd_AddParm(ts, "-name", CMD_SINGLE, CMD_OPTIONAL, "AFS tape name, defaults to NULL");
603 cmd_AddParm(ts, "-size", CMD_SINGLE, CMD_OPTIONAL,
604 "tape size in Kbytes, defaults to size in tapeconfig");
605 cmd_AddParm(ts, "-portoffset", CMD_SINGLE, CMD_OPTIONAL, "TC port offset");
606 cmd_AddParm(ts, "-pname", CMD_SINGLE, CMD_OPTIONAL, "permanent tape name");
607 if (!interact) add_std_args(ts);
609 ts = cmd_CreateSyntax("readlabel", bc_ReadLabelCmd, 0, "read the label on tape");
610 cmd_AddParm(ts, "-portoffset", CMD_SINGLE, CMD_OPTIONAL, "TC port offset");
611 if (!interact) add_std_args(ts);
613 ts = cmd_CreateSyntax("scantape", bc_ScanDumpsCmd, 0, "dump information recovery from tape");
614 cmd_AddParm(ts, "-dbadd", CMD_FLAG, CMD_OPTIONAL, "add information to the database");
615 cmd_AddParm(ts, "-portoffset", CMD_SINGLE, CMD_OPTIONAL, "TC port offset");
616 if (!interact) add_std_args(ts);
618 ts = cmd_CreateSyntax("volinfo", bc_dblookupCmd, 0, "query the backup database");
619 cmd_AddParm(ts, "-volume", CMD_SINGLE, CMD_REQUIRED, "volume name");
620 if (!interact) add_std_args(ts);
622 ts = cmd_CreateSyntax("setexp", bc_SetExpCmd, 0, "set/clear dump expiration dates");
623 cmd_AddParm(ts, "-dump", CMD_LIST, CMD_REQUIRED, "dump level name");
624 cmd_AddParm(ts, "-expires", CMD_LIST, CMD_OPTIONAL, "expiration date");
625 if (!interact) add_std_args(ts);
627 ts = cmd_CreateSyntax("savedb", bc_saveDbCmd, 0, "save backup database");
628 cmd_AddParm(ts, "-portoffset", CMD_SINGLE, CMD_OPTIONAL, "TC port offset");
629 cmd_AddParm(ts, "-archive", CMD_LIST, CMD_OPTIONAL, "date time");
630 if (!interact) add_std_args(ts);
632 ts = cmd_CreateSyntax("restoredb", bc_restoreDbCmd, 0, "restore backup database");
633 cmd_AddParm(ts, "-portoffset", CMD_SINGLE, CMD_OPTIONAL, "TC port offset");
634 if (!interact) add_std_args(ts);
636 ts = cmd_CreateSyntax("dumpinfo", bc_dumpInfoCmd, 0,
637 "provide information about a dump in the database");
638 cmd_AddParm(ts, "-ndumps", CMD_SINGLE, CMD_OPTIONAL, "no. of dumps");
639 cmd_AddParm(ts, "-id", CMD_SINGLE, CMD_OPTIONAL, "dump id");
640 cmd_AddParm(ts, "-verbose", CMD_FLAG, CMD_OPTIONAL, "detailed description");
641 if (!interact) add_std_args(ts);
643 ts = cmd_CreateSyntax("dbverify", bc_dbVerifyCmd, 0, "check ubik database integrity");
644 cmd_AddParm(ts, "-detail", CMD_FLAG, CMD_OPTIONAL, "additional details");
645 if (!interact) add_std_args(ts);
647 ts = cmd_CreateSyntax("deletedump", bc_deleteDumpCmd, 0, "delete dumps from the database");
648 cmd_AddParm(ts, "-dumpid", CMD_LIST, CMD_OPTIONAL, "dump id");
649 cmd_AddParm(ts, "-from", CMD_LIST, CMD_OPTIONAL, "date time");
650 cmd_AddParm(ts, "-to", CMD_LIST, CMD_OPTIONAL, "date time");
651 cmd_AddParm(ts, "-port", CMD_SINGLE, CMD_OPTIONAL, "TC port offset");
652 cmd_AddParm(ts, "-groupid", CMD_SINGLE, CMD_OPTIONAL, "group ID");
653 cmd_AddParm(ts, "-dbonly", CMD_FLAG, CMD_OPTIONAL,
654 "delete the dump from the backup database only");
655 cmd_AddParm(ts, "-force", CMD_FLAG, CMD_OPTIONAL,
656 "always delete from backup database");
657 cmd_AddParm(ts, "-noexecute", CMD_FLAG, CMD_OPTIONAL, "Just list the dumps");
659 if (!interact) add_std_args(ts);
661 ts = cmd_CreateSyntax("interactive", bc_interactCmd, 0, "enter interactive mode");
665 * Now execute the command.
668 targc = 0; targv[targc++] = argv[0];
669 if (interact) targv[targc++] = "interactive";
670 for (i=1; i<argc; i++) targv[targc++] = argv[i];
672 code = doDispatch(targc, targv, 1);
674 if (!interact || !bcInit) /* Non-interactive mode */
677 if (bcInit) code = bc_WaitForNoJobs(); /* wait for any jobs to finish */
678 exit(code); /* and exit */
681 /* Iterate on command lines, interpreting user commands (interactive mode) */
688 while (LWP_GetLine(lineBuffer, sizeof(lineBuffer)) == 0)
689 printf("%s: Command line too long\n", whoami); /* line too long */
691 if ( !LineIsBlank(lineBuffer) )
693 code = cmd_ParseLine(lineBuffer, targv, &targc, MAXV);
695 com_err(whoami,code,"; Can't parse line: '%s'",
696 error_message(code));
699 doDispatch(targc, targv, 1);