home *** CD-ROM | disk | FTP | other *** search
- head 1.5;
- access;
- symbols
- sercli_v1_10:1.5
- sercli_v1_9:1.4
- sercli_v1_8:1.4
- sercli_v1_7:1.3
- sercli_v1_6:1.2
- sercli_v1_5:1.1;
- locks
- rkr:1.5;
- comment @** @;
-
-
- 1.5
- date 93.06.16.23.27.57; author rkr; state Exp;
- branches;
- next 1.4;
-
- 1.4
- date 91.12.20.09.43.36; author rkr; state Exp;
- branches;
- next 1.3;
-
- 1.3
- date 91.12.10.02.48.02; author rkr; state Exp;
- branches;
- next 1.2;
-
- 1.2
- date 91.12.02.10.51.20; author rkr; state Exp;
- branches;
- next 1.1;
-
- 1.1
- date 91.11.28.08.25.11; author rkr; state Exp;
- branches;
- next ;
-
-
- desc
- @sercli is a program to permit shell-like interface to the serial port,
- while also permitting easy config- and run-time-control over the way the
- serial port (or even _which_ serial port) is used.
-
- @
-
-
- 1.5
- log
- @Commented on do_nothing()'s existance (be still my beating heart!).
- @
- text
- @/*
- ** $Source: WB_2.1:ho/rcs/misc.c,v $
- ** $Author: rkr $
- ** $Revision: 1.4 $
- ** $Locker: $
- ** $State: Exp $
- ** $Date: 1991/12/20 09:43:36 $
- **
- */
-
- #include <exec/io.h>
- #include <clib/exec_protos.h>
-
- #include <ctype.h>
- #include <stdio.h>
- #include <stdlib.h>
-
- #include "defs.h"
- #include "ser_supp.h"
- #include "misc.h"
-
-
-
- /*
- ** Borrowed from Mike Oliphant's usenet posting...(and renamed)
- **
- ** This will safely abort IO requests pending...
- **
- ** Unlike the regular AbortIO(), and the NiceAbort() from Mike,
- ** SafeAbortIO() can even 'abort' an IO request that hasn't been sent
- ** yet...this makes it convenient for general cleanup.
- **
- */
- void SafeAbortIO (IO_Request *ior)
- {
- Forbid ();
- {
- if (!CheckIO (ior) )
- {
- AbortIO (ior);
- WaitIO (ior);
- }
- }
- Permit ();
- }
-
-
-
- /*
- ** A bit like fgets(), EXCEPT:
- ** does not preserve the end-of-line
- ** malloc()s the line (and free()s the previous line, if need be).
- **
- */
- char *get_line (FILE *file)
- {
- static char *line = 0;
- int c;
- int count;
- long start_pos;
-
- if (line)
- {
- free (line);
- line = 0;
- }
-
- start_pos = ftell (file);
- count = 0;
- do
- {
- ++count;
- c = fgetc (file);
- }
- while ( (c != '\n') && (c != EOF) );
-
- if ( (c != EOF) || (count != 1) )
- {
- line = malloc (count);
- fseek (file, start_pos, SEEK_SET);
- fread (line, 1, count, file);
- line [count - 1] = 0;
- }
- return (line);
- }
-
-
- /*
- ** Stub function for some function call-backs. E.g.,
- ** onbreak (do_nothing);
- **
- */
- int do_nothing (void)
- {
- return (0);
- }
-
-
-
- /*
- ** I _think_ this came from the remcli.c that came with fifo:.
- **
- ** I don't know if it's generally legal to use {.ln_Type} as a flag. I
- ** need to check out remcli.c, as this may've been a peculiarity of the
- ** fifo handling of messages, rather than something profound. It
- ** certainly looks odd.
- **
- ** (Could just test the effects of ReplyMsg() in general...)
- **
- */
- void WaitMsg (Message *msg)
- {
- while (msg->mn_Node.ln_Type == NT_MESSAGE)
- Wait (1 << msg->mn_ReplyPort->mp_SigBit);
-
- Forbid ();
- {
- Remove (&msg->mn_Node);
- }
- Permit ();
- }
-
- @
-
-
- 1.4
- log
- @*** empty log message ***
- @
- text
- @d2 1
- a2 1
- ** $Source: Workbench:personal/rkr/prog/sercli/src/rcs/misc.c,v $
- d4 2
- a5 2
- ** $Revision: 1.3 $
- ** $Locker: rkr $
- d7 1
- a7 1
- ** $Date: 91/12/10 02:48:02 $
- a50 1
- **
- a51 1
- **
- d88 5
- a92 1
-
- @
-
-
- 1.3
- log
- @*** empty log message ***
- @
- text
- @d4 1
- a4 1
- ** $Revision: 1.2 $
- d7 1
- a7 1
- ** $Date: 91/12/02 10:51:20 $
- @
-
-
- 1.2
- log
- @*** empty log message ***
- @
- text
- @d7 1
- a7 1
- ** $Date: 91/12/02 10:41:57 $
- @
-
-
- 1.1
- log
- @Initial revision
- @
- text
- @d2 6
- a7 6
- ** $Source$
- ** $Author$
- ** $Revision$
- ** $Locker$
- ** $State$
- ** $Date$
- @
-