Check-in [e699791909]

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Switch from str* to strl* functions
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:e69979190950503100ec06d60c0464563efbdcc6
User & Date: darrenbane 2014-02-21 20:44:53
Context
2014-02-23
17:49
Makefile tweaks for FBSD again. There must be a better way to do this. check-in: 38b964f154 user: dbane tags: trunk
2014-02-21
20:44
Switch from str* to strl* functions check-in: e699791909 user: darrenbane tags: trunk
2014-02-13
00:16
Fix a trivial mdoc problem check-in: 5f39eb9c8a user: dbane tags: trunk
Changes

Changes to src/Makefile.

1
2
3
4
5
6
7
8
9
10
11
12


13

14
15
16
17
18
19
.POSIX:

BINOWN= dbane
BINGRP= dbane
SHAREOWN= dbane
SHAREGRP= dbane
.include <bsd.own.mk>

PREFIX?= /home/dbane
BINDIR= $(PREFIX)/bin
MANDIR= $(PREFIX)/man/man
PROG= lbl


CFLAGS+= -I../hdr -Wall -std=c11 -D_XOPEN_SOURCE=600

MAN= ../doc/lbl.1
SRCS= lbl.c actions.c build.c externs.c find.c keyword.c list.c \
      printl.c rescan.c scan.c signals.c
LIBC= /lib/libc.so.7

.include <bsd.prog.mk>


|
|
|
|






>
>
|
>



|


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
.POSIX:

BINOWN= darrenbane
BINGRP= 501
SHAREOWN= darrenbane
SHAREGRP= 501
.include <bsd.own.mk>

PREFIX?= /home/dbane
BINDIR= $(PREFIX)/bin
MANDIR= $(PREFIX)/man/man
PROG= lbl

# Need _DARWIN_C_SOURCE for strlcpy/strlcat
CFLAGS+= -I../hdr -Wall -std=c11 -D_XOPEN_SOURCE=600 -D_DARWIN_C_SOURCE

MAN= ../doc/lbl.1
SRCS= lbl.c actions.c build.c externs.c find.c keyword.c list.c \
      printl.c rescan.c scan.c signals.c
LIBC= /usr/lib/libSystem.dylib

.include <bsd.prog.mk>

Changes to src/build.c.

34
35
36
37
38
39
40

41
42
43
44
45
46
47
48

char   *
copy(str)
	char *str;
{
	char *s = alloc(strlen(str) + 1);


	return strcpy(s, str);
}

void
addlbl(lbltype, lbllevel, lblname)
	char *lbltype;
	char *lbllevel;
	char *lblname;







>
|







34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49

char   *
copy(str)
	char *str;
{
	char *s = alloc(strlen(str) + 1);

        strlcpy(s, str, strlen(str) + 1);
        return s;
}

void
addlbl(lbltype, lbllevel, lblname)
	char *lbltype;
	char *lbllevel;
	char *lblname;

Changes to src/lbl.c.

29
30
31
32
33
34
35



36
37
38
39
40
41
42
...
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
#include        <assert.h>
#include        "lbl.h"
#include        "signals.h"
#include        "scan.h"
#include        "rescan.h"
#include	"list.h"




extern int lflag;
extern int sflag;
extern char delimiter;
extern char macroname[];
extern char tempname[];
extern char *progname;
extern FILE *tempfile;
................................................................................
				errx(EX_USAGE, "%sdelimiter must be 1 character", maybe_loc());
		        delimiter = optarg[0];
		        break;
		case 'm':
		        if (strlen(optarg) != 2)
				errx(
				    EX_USAGE, "%smacro name must be 2 characters", maybe_loc());
		        strcpy(macroname, optarg);
		        break;
		case 'l':
		        lflag = 1;
		        break;
		case 's':
		        lflag = sflag = 1;
		        break;







>
>
>







 







|







29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
...
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
#include        <assert.h>
#include        "lbl.h"
#include        "signals.h"
#include        "scan.h"
#include        "rescan.h"
#include	"list.h"

/** Size of macroname[] */
const int MACRONAME_MAX = 3;

extern int lflag;
extern int sflag;
extern char delimiter;
extern char macroname[];
extern char tempname[];
extern char *progname;
extern FILE *tempfile;
................................................................................
				errx(EX_USAGE, "%sdelimiter must be 1 character", maybe_loc());
		        delimiter = optarg[0];
		        break;
		case 'm':
		        if (strlen(optarg) != 2)
				errx(
				    EX_USAGE, "%smacro name must be 2 characters", maybe_loc());
		        strlcpy(macroname, optarg, MACRONAME_MAX);
		        break;
		case 'l':
		        lflag = 1;
		        break;
		case 's':
		        lflag = sflag = 1;
		        break;

Changes to src/scan.c.

101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
	char *line;
	char *argvec[];
{
	us int nargs = 0;
	static char copybuf[BUFSIZ];
	char *ln = copybuf;

	strcpy(ln, line);
	while (*ln) {
		while (isspace(*ln))
			ln++;
		if (*ln) {
			if (nargs > 2 + NLEVELS) {
				warnx("%ssurplus arguments to .%s ignored",
				    maybe_loc(), macroname);







|







101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
	char *line;
	char *argvec[];
{
	us int nargs = 0;
	static char copybuf[BUFSIZ];
	char *ln = copybuf;

        strlcpy(ln, line, BUFSIZ);
	while (*ln) {
		while (isspace(*ln))
			ln++;
		if (*ln) {
			if (nargs > 2 + NLEVELS) {
				warnx("%ssurplus arguments to .%s ignored",
				    maybe_loc(), macroname);