1/* main.c: This file contains the main control and user-interface routines 2 for the ed line editor. */ 3/*- 4 * Copyright (c) 1993 Andrew Moore, Talke Studio. 5 * All rights reserved. 6 * 7 * Redistribution and use in source and binary forms, with or without 8 * modification, are permitted provided that the following conditions --- 21 unchanged lines hidden (view full) --- 30#if 0 31static const char copyright[] = 32"@(#) Copyright (c) 1993 Andrew Moore, Talke Studio. \n\ 33 All rights reserved.\n"; 34#endif 35#endif /* not lint */ 36 37#include <sys/cdefs.h> |
38__FBSDID("$FreeBSD: head/bin/ed/main.c 204711 2010-03-04 16:08:01Z uqs $"); |
39 40/* 41 * CREDITS 42 * 43 * This program is based on the editor algorithm described in 44 * Brian W. Kernighan and P. J. Plauger's book "Software Tools 45 * in Pascal," Addison-Wesley, 1981. 46 * --- 51 unchanged lines hidden (view full) --- 98int lineno; /* script line number */ 99const char *prompt; /* command-line prompt */ 100const char *dps = "*"; /* default command-line prompt */ 101 102const char usage[] = "usage: %s [-] [-sx] [-p string] [file]\n"; 103 104/* ed: line editor */ 105int |
106main(volatile int argc, char ** volatile argv) |
107{ 108 int c, n; 109 long status = 0; |
110 111 (void)setlocale(LC_ALL, ""); 112 113 red = (n = strlen(argv[0])) > 2 && argv[0][n - 3] == 'r'; 114top: 115 while ((c = getopt(argc, argv, "p:sx")) != -1) 116 switch(c) { 117 case 'p': /* set prompt */ --- 1299 unchanged lines hidden --- |