Changeset View
Changeset View
Standalone View
Standalone View
contrib/nvi/common/exf.c
/*- | /*- | ||||
* Copyright (c) 1992, 1993, 1994 | * Copyright (c) 1992, 1993, 1994 | ||||
* The Regents of the University of California. All rights reserved. | * The Regents of the University of California. All rights reserved. | ||||
* Copyright (c) 1992, 1993, 1994, 1995, 1996 | * Copyright (c) 1992, 1993, 1994, 1995, 1996 | ||||
* Keith Bostic. All rights reserved. | * Keith Bostic. All rights reserved. | ||||
* | * | ||||
* See the LICENSE file for redistribution information. | * See the LICENSE file for redistribution information. | ||||
*/ | */ | ||||
#include "config.h" | #include "config.h" | ||||
#ifndef lint | #ifndef lint | ||||
static const char sccsid[] = "$Id: exf.c,v 10.64 2015/04/05 15:21:55 zy Exp $"; | static const char sccsid[] = "$Id: exf.c,v 10.64 2015/04/05 15:21:55 zy Exp $"; | ||||
lichray_gmail.com: If you must commit this, please bump the revision (to 10.65), update the date, and put "yuripv"… | |||||
yuripvAuthorUnsubmitted Done Inline ActionsWill do. Interesting, the only idents I see currently are: $ ident /usr/bin/vi /usr/bin/vi: $FreeBSD: head/lib/csu/amd64/crtn.S 217105 2011-01-07 16:07:51Z kib $ $FreeBSD: head/lib/csu/common/ignore_init.c 340702 2018-11-20 21:04:20Z emaste $ $FreeBSD: head/lib/csu/common/crtend.c 354541 2019-11-08 14:28:39Z kevans $ $FreeBSD: head/lib/csu/amd64/reloc.c 340702 2018-11-20 21:04:20Z emaste $ $FreeBSD: head/lib/csu/common/crtbegin.c 340395 2018-11-13 15:28:27Z andrew $ $FreeBSD: head/lib/csu/amd64/crti.S 217105 2011-01-07 16:07:51Z kib $ $FreeBSD: head/lib/csu/common/crtbrand.c 340701 2018-11-20 20:59:49Z emaste $ $FreeBSD: head/lib/csu/amd64/crt1.c 339351 2018-10-13 23:52:55Z kib $ However running ident directly on source shows: $ ident /usr/src/contrib/nvi/common/exf.c /usr/src/contrib/nvi/common/exf.c: $Id: exf.c,v 10.64 2015/04/05 15:21:55 zy Exp $ yuripv: Will do.
Interesting, the only idents I see currently are:
```
$ ident /usr/bin/vi
/usr/bin/vi… | |||||
lichray_gmail.comUnsubmitted Not Done Inline ActionsMerged to upstream. lichray_gmail.com: Merged to upstream.
Thanks, the rcsids may worth a fix in a way similar to https://github. | |||||
yuripvAuthorUnsubmitted Done Inline ActionsOK, if you don't mind, I'll commit this without updating the ID not to confuse readers and as it won't be reflected in the binary anyway, and we (you? :) ) can decide what to do with IDs separately. And when we import next release, we'll get what's in upstream. yuripv: OK, if you don't mind, I'll commit this without updating the ID not to confuse readers and as… | |||||
#endif /* not lint */ | #endif /* not lint */ | ||||
#include <sys/types.h> | #include <sys/types.h> | ||||
#include <sys/queue.h> | #include <sys/queue.h> | ||||
#include <sys/stat.h> | #include <sys/stat.h> | ||||
#include <sys/time.h> | #include <sys/time.h> | ||||
/* | /* | ||||
▲ Show 20 Lines • Show All 1,210 Lines • ▼ Show 20 Lines | while (!db_rget(sp, ln++, &p, &len)) { | ||||
blen += len; | blen += len; | ||||
if (blen == sizeof(buf)) | if (blen == sizeof(buf)) | ||||
break; | break; | ||||
else | else | ||||
buf[blen++] = '\n'; | buf[blen++] = '\n'; | ||||
} | } | ||||
/* | /* | ||||
* Detect UTF-8 and fallback to the locale/preset encoding. | * 1. Check for valid UTF-8. | ||||
* 2. Check if fallback fileencoding is set and is NOT UTF-8. | |||||
* 3. Check if user locale's encoding is NOT UTF-8. | |||||
* 4. Use ISO8859-1 as last resort. | |||||
* | * | ||||
* XXX | * XXX | ||||
* A manually set O_FILEENCODING indicates the "fallback | * A manually set O_FILEENCODING indicates the "fallback | ||||
* encoding", but UTF-8, which can be safely detected, is not | * encoding", but UTF-8, which can be safely detected, is not | ||||
* inherited from the old screen. | * inherited from the old screen. | ||||
*/ | */ | ||||
if (looks_utf8(buf, blen) > 1) | if (looks_utf8(buf, blen) > 1) | ||||
o_set(sp, O_FILEENCODING, OS_STRDUP, "utf-8", 0); | o_set(sp, O_FILEENCODING, OS_STRDUP, "utf-8", 0); | ||||
else if (!O_ISSET(sp, O_FILEENCODING) || | else if (O_ISSET(sp, O_FILEENCODING) && | ||||
!strcasecmp(O_STR(sp, O_FILEENCODING), "utf-8")) | strcasecmp(O_STR(sp, O_FILEENCODING), "utf-8") != 0) | ||||
/* Use fileencoding as is */ ; | |||||
else if (strcasecmp(codeset(), "utf-8") != 0) | |||||
o_set(sp, O_FILEENCODING, OS_STRDUP, codeset(), 0); | o_set(sp, O_FILEENCODING, OS_STRDUP, codeset(), 0); | ||||
else | |||||
o_set(sp, O_FILEENCODING, OS_STRDUP, "iso8859-1", 0); | |||||
conv_enc(sp, O_FILEENCODING, 0); | conv_enc(sp, O_FILEENCODING, 0); | ||||
#endif | #endif | ||||
} | } | ||||
/* | /* | ||||
* file_comment -- | * file_comment -- | ||||
* Skip the first comment. | * Skip the first comment. | ||||
▲ Show 20 Lines • Show All 265 Lines • Show Last 20 Lines |
If you must commit this, please bump the revision (to 10.65), update the date, and put "yuripv" in place of "zy" so that ident(1) can tell users what behavior they should expect from their binary.