parse.c (10482) | parse.c (26926) |
---|---|
1/*- 2 * Copyright (c) 1992, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * This code is derived from software contributed to Berkeley by 6 * Christos Zoulas of Cornell University. 7 * 8 * Redistribution and use in source and binary forms, with or without --- 33 unchanged lines hidden (view full) --- 42 * parse.c: parse an editline extended command 43 * 44 * commands are: 45 * 46 * bind 47 * echotc 48 * settc 49 * gettc | 1/*- 2 * Copyright (c) 1992, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * This code is derived from software contributed to Berkeley by 6 * Christos Zoulas of Cornell University. 7 * 8 * Redistribution and use in source and binary forms, with or without --- 33 unchanged lines hidden (view full) --- 42 * parse.c: parse an editline extended command 43 * 44 * commands are: 45 * 46 * bind 47 * echotc 48 * settc 49 * gettc |
50 * history 51 * settc 52 * setty |
|
50 */ 51#include "sys.h" 52#include "el.h" 53#include "tokenizer.h" 54 55private struct { 56 char *name; 57 int (*func) __P((EditLine *, int, char **)); --- 35 unchanged lines hidden (view full) --- 93 EditLine *el; 94 int argc; 95 char *argv[]; 96{ 97 char *ptr; 98 int i; 99 100 if (argc < 1) | 53 */ 54#include "sys.h" 55#include "el.h" 56#include "tokenizer.h" 57 58private struct { 59 char *name; 60 int (*func) __P((EditLine *, int, char **)); --- 35 unchanged lines hidden (view full) --- 96 EditLine *el; 97 int argc; 98 char *argv[]; 99{ 100 char *ptr; 101 int i; 102 103 if (argc < 1) |
101 return 0; 102 103 for (ptr = argv[0]; *ptr && *ptr != ':'; ptr++) 104 continue; 105 106 if (*ptr == ':') { 107 *ptr = '\0'; 108 if (el_match(el->el_prog, ptr)) | 104 return -1; 105 ptr = strchr(argv[0], ':'); 106 if (ptr != NULL) { 107 *ptr++ = '\0'; 108 if (! el_match(el->el_prog, argv[0])) |
109 return 0; 110 } 111 else 112 ptr = argv[0]; 113 114 for (i = 0; cmds[i].name != NULL; i++) 115 if (strcmp(cmds[i].name, ptr) == 0) { 116 i = (*cmds[i].func)(el, argc, argv); --- 71 unchanged lines hidden (view full) --- 188 --p; 189 } 190 break; 191 default: 192 c = *p; 193 break; 194 } 195 } | 109 return 0; 110 } 111 else 112 ptr = argv[0]; 113 114 for (i = 0; cmds[i].name != NULL; i++) 115 if (strcmp(cmds[i].name, ptr) == 0) { 116 i = (*cmds[i].func)(el, argc, argv); --- 71 unchanged lines hidden (view full) --- 188 --p; 189 } 190 break; 191 default: 192 c = *p; 193 break; 194 } 195 } |
196 else if (*p == '^' && isalpha((unsigned char) *p)) { | 196 else if (*p == '^' && isalpha((unsigned char) p[1])) { |
197 p++; 198 c = (*p == '?') ? '\177' : (*p & 0237); 199 } 200 else 201 c = *p; 202 *ptr = ++p; 203 return c; 204} --- 46 unchanged lines hidden --- | 197 p++; 198 c = (*p == '?') ? '\177' : (*p & 0237); 199 } 200 else 201 c = *p; 202 *ptr = ++p; 203 return c; 204} --- 46 unchanged lines hidden --- |