1#!/usr/bin/env perl 2# $Id: token.pl,v 1.88 2016/06/07 12:45:20 marc Exp marc $ 3 4use strict; 5 6my @enum = ("S_unknown = 0"); 7my @array = ("\"<unknown>\""); 8 9my ($k, $t); 10my %K; 11 12while (<DATA>){ 13 /^([^\s]+)\s+([^\s]+)/ or next; 14 $K{$2} = $1; 15} 16 17my $i = 1; 18for my $w (sort { $K{$a} cmp $K{$b} } keys %K){ 19 push @enum, $w; 20 push @array, '"' . $K{$w} . '"'; 21 $i++; 22} 23 24open F, "> token.h" or die; 25print F "extern char *codestring[];\n"; 26print F "enum token {\n\t" . join(",\n\t", @enum), ",\n\tS_null\n};\n"; 27close F; 28 29open F, "> token.c" or die; 30print F "#include <stdio.h>\nchar *codestring[] = {\n\t" . join(",\n\t", @array), ",\n\tNULL\n};\n"; 31close F; 32 33 34__DATA__ 357 S_7 36<end-of-file> S_eof 37<pcre-regex> S_slash 38<string> S_string 39= S_equal 40ACCT S_ACCT 41ACL S_ACL 42ALL S_ALL 43AUTHEN S_AUTHEN 44AUTHOR S_AUTHOR 45AV S_AV 46BUFFER S_BUFFER 47CMD S_CMD 48CONFIG S_CONFIG 49CONTROL S_CONTROL 50FORK S_FORK 51HEX S_HEX 52INDEX S_INDEX 53LOCK S_LOCK 54MAVIS S_MAVIS 55NET S_NET 56NONE S_NONE 57PACKET S_PACKET 58PARSE S_PARSE 59PATH S_PATH 60PROC S_PROC 61REGEX S_REGEX 62LWRES S_LWRES 63accept S_accept 64reject S_reject 65access S_access 66accounting S_accounting 67acl S_acl 68address S_address 69address-mismatch S_addressmismatch 70alias S_alias 71all S_all 72allow-dotfiles S_allowdotfiles 73anon S_anon 74anonymous-enable S_anonenable 75augmented-enable S_augmented_enable 76any S_any 77arap S_arap 78arg S_arg 79ascii-size-limit S_asciisizelimit 80attribute S_attr 81aaa S_aaa 82auth S_auth 83authenticated S_authenticated 84authentication S_authentication 85authentication-failures S_authenticationfailures 86authmode S_authmode 87authorization S_authorization 88auto-conversion S_autoconversion 89backend S_backend 90background S_background 91backlog S_backlog 92banner S_banner 93banner-action S_banneraction 94binary-only S_binaryonly 95blacklist S_blacklist 96blowfish S_blowfish 97buffer S_buffer 98bye S_bye 99ca-file S_cafile 100ca-path S_capath 101cache S_cache 102caseless S_caseless 103cert S_cert 104certfile S_certfile 105chalresp S_chalresp 106chap S_chap 107check S_check 108check-gid S_checkgid 109check-perm S_checkperm 110check-uid S_checkuid 111checksum S_checksum 112childs S_childs 113chmod-mask S_chmodmask 114chpass S_chpass 115chroot S_chroot 116ciphers S_ciphers 117clear S_clear 118client S_client 119client-only S_clientonly 120cmd S_cmd 121command S_command 122config S_config 123connection S_connection 124content S_content 125coredump S_coredump 126count S_count 127crypt S_crypt 128debug S_debug 129trace S_trace 130default S_default 131deflate S_deflate 132deflate-level S_deflatelevel 133delimiter S_delimiter 134deny S_deny 135depth S_depth 136des S_des 137directory S_directory 138dst S_dst 139enable S_enable 140event S_event 141exec S_exec 142expire S_expire 143expires S_expires 144facility S_facility 145fake-group S_fakegroup 146fake-owner S_fakeowner 147file S_file 148files-only S_filesonly 149follow S_follow 150from S_from 151ftpusers S_ftpusers 152goodbye S_goodbye 153greeting S_greeting 154group S_group 155groupid S_groupid 156gzip S_gzip 157hide-version S_hideversion 158home S_home 159host S_host 160hostname S_hostname 161id S_id 162ident S_ident 163idle S_idle 164in S_in 165include S_include 166inherit S_inherit 167instances S_instances 168key S_key 169keyfile S_keyfile 170level S_level 171limit S_limit 172listen S_listen 173local S_local 174log S_log 175logformat S_logformat 176login S_login 177logout S_logout 178maintainer S_maintainer 179mask S_mask 180mavis S_mavis 181max S_max 182max-attempts S_maxattempts 183member S_member 184message S_message 185mimetypes S_mimetypes 186min S_min 187mmap-size S_mmapsize 188mode S_mode 189module S_module 190ms-chap S_mschap 191nac S_nac 192nac-name S_nacname 193name S_name 194nas S_nas 195nas-name S_nasname 196nlst S_nlst 197no S_no 198noauthcache S_noauthcache 199noecho S_noecho 200none S_none 201not S_not 202old-draft S_olddraft 203opap S_opap 204optional S_optional 205orphan S_orphan 206out S_out 207pap S_pap 208passive S_passive 209passphrase S_passphrase 210passwd S_passwd 211password S_password 212path S_path 213period S_period 214permit S_permit 215pidfile S_pidfile 216pid-file S_pid_file 217port S_port 218proctitle S_proctitle 219profile S_profile 220prohibit S_prohibit 221prompt S_prompt 222protected S_protected 223protocol S_protocol 224purge S_purge 225readme S_readme 226readme-notify S_readmenotify 227readme-once S_readmeonce 228real S_real 229rebalance S_rebalance 230redirect S_redirect 231regex S_regex 232remote S_remote 233required S_required 234resolve-ids S_resolveids 235retire S_retire 236rewrite S_rewrite 237root S_root 238same S_same 239secure S_secure 240separation S_separation 241server S_server 242service S_service 243set S_set 244setenv S_setenv 245shape-bandwidth S_shapebandwidth 246shell S_shell 247shells S_shells 248site S_site 249size S_size 250spawn S_spawn 251src S_src 252ssl S_ssl 253sslusers S_sslusers 254stat S_stat 255state S_state 256subject S_subject 257substitute S_substitute 258sufficient S_sufficient 259symlinks S_symlinks 260syslog S_syslog 261tag S_tag 262template S_template 263clone S_clone 264time S_time 265timeout S_timeout 266timespec S_timespec 267tls S_tls 268transfer S_transfer 269transmission-mode S_transmissionmode 270transmit S_transmit 271tries S_tries 272type S_type 273type7-key S_type7key 274umask S_umask 275until S_until 276upload S_upload 277use-mmap S_usemmap 278use-sendfile S_usesendfile 279user S_user 280userid S_userid 281users S_users 282valid S_valid 283warn S_warn 284warning S_warning 285weight S_weight 286welcome S_welcome 287welcome-action S_welcomeaction 288working S_working 289yes S_yes 290z S_z 291zone S_zone 292{ S_openbra 293} S_closebra 294! S_exclmark 295( S_leftbra 296) S_rightbra 297~ S_tilde 298, S_comma 299&& S_and 300|| S_or 301if S_if 302skip S_skip 303return S_return 304else S_else 305unset S_unset 306eval S_eval 307script S_script 308continue S_continue 309reset S_reset 310toupper S_toupper 311tolower S_tolower 312backoff S_backoff 313realm S_realm 314dns S_dns 315reverse-lookup S_reverselookup 316cleanup S_cleanup 317context S_context 318defined S_defined 319undef S_undef 320local S_local 321single-connection S_singleconnection 322may-close S_mayclose 323session S_session 324gcore S_gcore 325overload S_overload 326close S_close 327queue S_queue 328date S_date 329format S_format 330separator S_separator 331fallback S_fallback 332fallback-only S_fallback_only 333ipc S_ipc 334filter S_filter 335prefetch S_prefetch 336sticky S_sticky 337motd S_motd 338hushlogin S_hushlogin 339preload S_preload 340TCP S_TCP 341SCTP S_SCTP 342STREAM S_STREAM 343SEQPACKET S_SEQPACKET 344failed S_failed 345restriction S_restriction 346router S_router 347resolve S_resolve 348gid S_gid 349gids S_gids 350missing S_missing 351conflicting S_conflicting 352groups S_groups 353retry S_retry 354delay S_delay 355bind S_bind 356debug-cmd S_debug_cmd 357single S_single 358process S_process 359aaa-realm S_aaarealm 360nac-realm S_nacrealm 361nas-realm S_nasrealm 362double-quote-values S_double_quote_values 363mapping S_mapping 364tcp S_tcp 365keepalive S_keepalive 366interval S_interval 367regex-match-case S_regex_match_case 368usage S_usage 369compliance S_compliance 370destination S_destination 371RFC3164 S_RFC3164 372RFC5424 S_RFC5424 373group-membership S_groupmembership 374bufsize S_bufsize 375 376