🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: comp.sources.apple2
1 messages
1 total messages Started by Jonathan A. Chandross Thu, 02 May 1991 21:09
v001SRC043: more -- More For Orca (GS)
#43
Author: Jonathan A. Chandross
Date: Thu, 02 May 1991 21:09
238 lines
7500 bytes
Submitted-by: Jawaid Bazyar (bazyar@cs.uiuc.edu)
Posting-number: Volume 1, Source:43
Archive-name: util/gs/shell/orca/more
Architecture: ONLY_2gs
Version-number: 1.2


View a file one page at a time.

Requires ORCA shell.

Enjoy.

###################################

=more.doc
-============
-    MORE
-============
-
-Version 1.2
-
-The first tool I wanted was a text file pager.  TYPE worked ok, but
-having to hit the space bar at just the right time got on my nerves.
-So I first created PAGE (RIP), then MORE.  As it exists, MORE looks like
-Unix 'more'.  It doesn't support searching with regular expressions
-and silliness like that (that's what uEmacs is for).  But it's a good
-pager.
-
-MORE is invoked with the following format:
-
-   MORE <filespec>...
-
-When the - <filename> (xx%) - prompt appears at the bottom of the screen,
-pressing Q will quit the current file and MORE the next one (if present).
-Hitting ESC at this prompt will stop the program completely (whether more
-files were specified or not).  Pressing SPACE will scroll through another page
-of the file.  RETURN will move forward in the file one line.
-
-MORE supports redirection and pipes.  If the output is redirected away
-from the console, more won't pause for each page.  In this way it can be
-used as a simple text file converter.
-
-The most useful aspect of MORE is it's versatility- it can read regular Apple
-(CR-delimited) TXT and SRC files, Unix text files (LF-delimited), and IBM CRLF
-text files.  All automatically.
-By redirecting output to a file, MORE can convert from Unix or IBM to Apple
-text format.  Neat, eh? (But using MORE is slower than using CONV- see below).
-
-MORE has no option switches- it's too simple.
-
-Change Log:
-
-v1.1 - MORE can now abort either an individual file or all files. Also,
-       changed return from 'advance page' to 'advance line', like the
-       Unix version.
-
-Note:
-
-A filespec is a method of identifying files on a disk.  In the ORCA
-shell, a filespec can contain the = and ? wildcards, in addition to
-plain filenames.  MORE supports multiple filespecs, e.g.
-	more a.c b.c c.c d=.c
-etc.  Any combination of wildcarded and/or vanilla filespecs is allowed.
-This functionality, however, comes at a price.  MORE works only under
-the ORCA shell or a compatible.  At this time, there are no shells truly
-compatible with ORCA.
-
------
-
-Jawaid Bazyar
-Derek Taubert
-
-Copyright 1990 by Procyon Software
-Freeware - distribute but don't sell!
-
-This utility is FreeWare.  Distribute them as much as you like, just
-don't sell them or distribute modified versions.  Send me your comments -
-I'm eager to hear from you for suggestions and improvements.
-
-Also, if you make any modifications to the code please do not redistribute
-them. Instead, send me the changed source along with an explanation and
-I will consider including your change in the next version.
-
-	Jawaid Bazyar
-	1120 Maple Street
-	Mt. Vernon, IL 62864
-
-	Internet/ARPAnet     bazyar@cs.uiuc.edu
-	GEnie                J.BAZYAR
-
=more.c
-#pragma optimize -1
-
-#pragma keep "6/more"
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <shell.h>
-#include <gsos.h>
-#include <string.h>
-#include <orca.h>
-
-#pragma lint -1
-
-#define MAX_LINE 24
-#define MAX_COL 80
-
-int main(int argc,char *argv[])
-{
-FILE *file;
-int line,col;
-int i;
-int c,quit,abort;
-int pipeFlag; /* 1 means input is piped in or redirected */
-int standardOut;
-DirectionPB checkIO;
-EOFRecGS eofs;
-char expanded[65];
-char *truncated;
-Init_WildcardPB iwpb;
-Next_WildcardPB nwpb;
-
-    checkIO.device = 1;
-    DIRECTION(&checkIO);
-    standardOut = (checkIO.direct != 0) ? 0 : 1;
-
-    pipeFlag = (argc == 1) ? 1 : 0;
-    if (argc == 1) argc = 2;
-    quit = 0;
-    abort = 0;
-
-    for (i = 1; (i < argc && !abort); i++)
-    {
-      if (!pipeFlag) {
-          strcpy(expanded+1,argv[i]);
-          expanded[0] = strlen(argv[i]);
-          iwpb.w_file = expanded;
-          iwpb.flags = 0x8000;
-          INIT_WILDCARD(&iwpb);
-          nwpb.nextfile = expanded;
-          NEXT_WILDCARD(&nwpb);
-          expanded[expanded[0]+1] = 0;
-      }
-      while ((strlen(expanded) != 0) || (pipeFlag && !quit)) {
-          quit = 0;
-
-          if (pipeFlag) {
-              file = stdin;
-           /*   rewind(file);   */
-          }
-          else {
-              truncated = strrchr(expanded+1,'/');
-              if (truncated == NULL) truncated = expanded+1;
-                  else truncated++;
-              file = fopen(expanded+1,"rb");
-              eofs.pCount = 2;
-              eofs.refNum = file->_file;
-              GetEOFGS(&eofs);
-              if (toolerror()) {
-                  printf("GS/OS Error %d\n",toolerror());
-                  exit(-1);
-              }
-          }
-          line = 1; col = 1;
-
-          c = getc(file);
-          if ((c == EOF) || (c == 0x04)) quit = 1;
-
-          while (!quit && !abort)
-
-          {
-          int k;
-
-              if (c == '\r') {
-                  if ((k = getc(file)) == '\n') /*  IBM silly CR & LF EOL */
-                      putchar('\n');
-                  else { ungetc(k,file); putchar('\n'); }
-                  col = 1; line++;
-              }
-              else
-              if (c == '\n')
-              {
-                  putchar('\n');
-                  col = 1; line++;
-              }
-              else
-              {
-                  putchar(c);
-                  col++;
-                  if (col > MAX_COL)
-                  {
-                      col = 1; line++;
-                  }
-              }
-              if ((line == MAX_LINE) && standardOut)
-              {  long percent;
-                  putchar(15);
-                  if (!pipeFlag)
-                  {
-                      percent = (ftell(file) * 100) / eofs.eof;
-                      printf(" - %s (%2ld%%) -",truncated,percent);
-                  }
-                  else
-                      printf(" - (pipe) -");
-                  putchar(14);
-                  asm {
-                  again: lda 0xE0C000
-                         bpl again
-                         sta c
-                         lda 0xE0C010
-                  }
-                  c = c & 0x7f;
-
-                  if (c == 'q') quit = 1;
-                  if (c == 27) abort = 1;
-                  if (c == 13) line--;
-                  else line = 1;
-                  for (c = 0; c < (11 + (pipeFlag ? 0 : strlen(truncated))); c++)
-                  {
-                      putchar(8);
-                      putchar(' ');
-                      putchar(8);
-                  }
-              }
-              c = getc(file);
-              if ((c == EOF) || (c == 0x04)) quit = 1;
-          }
-        /*  if (!pipeFlag)*/ fclose(file);
-       if (!pipeFlag)
-       {   NEXT_WILDCARD(&nwpb);
-          expanded[expanded[0]+1] = 0; }
-       }
-    }
-}
-
+ END OF ARCHIVE
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads