Mercurial > hg > Members > kono > nitros9-code
view 3rdparty/packages/ed/getnum.c @ 2868:cfa46960b6bd
makefiles: Rename DW3 to DW all over
Rename dw3*.sb to dwio*.sb
This is part of getting default and lwtools-port branches
together, trying to avoid things falling through the
cracks.
author | Tormod Volden <debian.tormod@gmail.com> |
---|---|
date | Sun, 24 Nov 2013 11:13:40 +0100 |
parents | bef1844de0dc |
children |
line wrap: on
line source
/* getnum.c */ #include <stdio.h> #include "tools.h" #include "ed.h" int mark['z' - 'a' + 1]; int getnum(first) int first; { TOKEN *srchpat; int num; char c; while (*inptr == SP || *inptr == HT) inptr++; if (*inptr >= '0' && *inptr <= '9') { /* line number */ for (num = 0; *inptr >= '0' && *inptr <= '9';) { num = (num * 10) + *inptr - '0'; inptr++; } return num; } switch (c = *inptr) { case '.': inptr++; return(curln); case '$': inptr++; return(lastln); case '/': case '?': srchpat = optpat(); if (*inptr == c) inptr++; return(find(srchpat, c == '/' ? 1 : 0)); case '-': case '+': return(first ? curln : 1); case '\'': inptr++; if (*inptr < 'a' || *inptr > 'z') return(EOF); return mark[*inptr++ - 'a']; default: return(first ? EOF : 1);/* unknown address */ } }