Changeset View
Changeset View
Standalone View
Standalone View
vis.c
/* $NetBSD: vis.c,v 1.22 2013/02/20 17:04:45 christos Exp $ */ | /* $NetBSD: vis.c,v 1.25 2015/05/24 19:42:39 christos Exp $ */ | ||||
/*- | /*- | ||||
* Copyright (c) 1989, 1993 | * Copyright (c) 1989, 1993 | ||||
* The Regents of the University of California. All rights reserved. | * The Regents of the University of California. All rights reserved. | ||||
* | * | ||||
* Redistribution and use in source and binary forms, with or without | * Redistribution and use in source and binary forms, with or without | ||||
* modification, are permitted provided that the following conditions | * modification, are permitted provided that the following conditions | ||||
* are met: | * are met: | ||||
Show All 24 Lines | |||||
__COPYRIGHT("@(#) Copyright (c) 1989, 1993\ | __COPYRIGHT("@(#) Copyright (c) 1989, 1993\ | ||||
The Regents of the University of California. All rights reserved."); | The Regents of the University of California. All rights reserved."); | ||||
#endif /* not lint */ | #endif /* not lint */ | ||||
#ifndef lint | #ifndef lint | ||||
#if 0 | #if 0 | ||||
static char sccsid[] = "@(#)vis.c 8.1 (Berkeley) 6/6/93"; | static char sccsid[] = "@(#)vis.c 8.1 (Berkeley) 6/6/93"; | ||||
#endif | #endif | ||||
__RCSID("$NetBSD: vis.c,v 1.22 2013/02/20 17:04:45 christos Exp $"); | __RCSID("$NetBSD: vis.c,v 1.25 2015/05/24 19:42:39 christos Exp $"); | ||||
#endif /* not lint */ | #endif /* not lint */ | ||||
#include <stdio.h> | #include <stdio.h> | ||||
#include <string.h> | #include <string.h> | ||||
#include <stdlib.h> | #include <stdlib.h> | ||||
#include <string.h> | #include <string.h> | ||||
#include <errno.h> | #include <errno.h> | ||||
#include <wchar.h> | #include <wchar.h> | ||||
Show All 14 Lines | |||||
int | int | ||||
main(int argc, char *argv[]) | main(int argc, char *argv[]) | ||||
{ | { | ||||
FILE *fp; | FILE *fp; | ||||
int ch; | int ch; | ||||
int rval; | int rval; | ||||
while ((ch = getopt(argc, argv, "bcde:F:fhlmnostw")) != -1) | while ((ch = getopt(argc, argv, "bcde:F:fhlMmNnoSstw")) != -1) | ||||
switch((char)ch) { | switch((char)ch) { | ||||
case 'b': | case 'b': | ||||
eflags |= VIS_NOSLASH; | eflags |= VIS_NOSLASH; | ||||
break; | break; | ||||
case 'c': | case 'c': | ||||
eflags |= VIS_CSTYLE; | eflags |= VIS_CSTYLE; | ||||
break; | break; | ||||
#ifdef DEBUG | #ifdef DEBUG | ||||
Show All 15 Lines | case 'f': | ||||
fold++; /* fold output lines to 80 cols */ | fold++; /* fold output lines to 80 cols */ | ||||
break; /* using hidden newline */ | break; /* using hidden newline */ | ||||
case 'h': | case 'h': | ||||
eflags |= VIS_HTTPSTYLE; | eflags |= VIS_HTTPSTYLE; | ||||
break; | break; | ||||
case 'l': | case 'l': | ||||
markeol++; /* mark end of line with \$ */ | markeol++; /* mark end of line with \$ */ | ||||
break; | break; | ||||
case 'M': | |||||
eflags |= VIS_META; | |||||
break; | |||||
case 'm': | case 'm': | ||||
eflags |= VIS_MIMESTYLE; | eflags |= VIS_MIMESTYLE; | ||||
if (foldwidth == 80) | if (foldwidth == 80) | ||||
foldwidth = 76; | foldwidth = 76; | ||||
break; | break; | ||||
case 'N': | |||||
eflags |= VIS_NOLOCALE; | |||||
break; | |||||
case 'n': | case 'n': | ||||
none++; | none++; | ||||
break; | break; | ||||
case 'o': | case 'o': | ||||
eflags |= VIS_OCTAL; | eflags |= VIS_OCTAL; | ||||
break; | break; | ||||
case 'S': | |||||
eflags |= VIS_SHELL; | |||||
break; | |||||
case 's': | case 's': | ||||
eflags |= VIS_SAFE; | eflags |= VIS_SAFE; | ||||
break; | break; | ||||
case 't': | case 't': | ||||
eflags |= VIS_TAB; | eflags |= VIS_TAB; | ||||
break; | break; | ||||
case 'w': | case 'w': | ||||
eflags |= VIS_WHITE; | eflags |= VIS_WHITE; | ||||
break; | break; | ||||
case '?': | case '?': | ||||
default: | default: | ||||
(void)fprintf(stderr, | (void)fprintf(stderr, | ||||
"Usage: %s [-bcfhlmnostw] [-e extra]" | "Usage: %s [-bcfhlMmNnoSstw] [-e extra]" | ||||
" [-F foldwidth] [file ...]\n", getprogname()); | " [-F foldwidth] [file ...]\n", getprogname()); | ||||
return 1; | return 1; | ||||
} | } | ||||
if ((eflags & (VIS_HTTPSTYLE|VIS_MIMESTYLE)) == | if ((eflags & (VIS_HTTPSTYLE|VIS_MIMESTYLE)) == | ||||
(VIS_HTTPSTYLE|VIS_MIMESTYLE)) | (VIS_HTTPSTYLE|VIS_MIMESTYLE)) | ||||
errx(1, "Can't specify -m and -h at the same time"); | errx(1, "Can't specify -m and -h at the same time"); | ||||
▲ Show 20 Lines • Show All 140 Lines • Show Last 20 Lines |