diff --git a/CHANGELOG.md b/CHANGELOG.md index 1df40d5f..c8626141 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -85,6 +85,7 @@ Developers may need to change their code ### Corrected Bugs +* Fixed ["aux" folder issue with Windows. #198](https://github.com/clicon/clixon/issues/198) * Fixed [changing interface name not support with openconfig module #195](https://github.com/clicon/clixon/issues/195) * Fixed [making cli_show_options's output more human readable #199](https://github.com/clicon/clixon/issues/199) * Fixed Yang parsing of comments in (extension) unknown statements, to allow multiple white space diff --git a/apps/cli/cli_show.c b/apps/cli/cli_show.c index 0f68fc35..e323d8b3 100644 --- a/apps/cli/cli_show.c +++ b/apps/cli/cli_show.c @@ -359,125 +359,6 @@ expand_dbvar(void *h, return retval; } -/*! List files in a directory - */ -int -expand_dir(char *dir, - int *nr, - char ***commands, - mode_t flags, - int detail) -{ - DIR *dirp; - struct dirent *dp; - struct stat st; - char *str; - char *cmd; - int len; - int retval = -1; - struct passwd *pw; - char filename[MAXPATHLEN]; - - if ((dirp = opendir(dir)) == 0){ - fprintf(stderr, "expand_dir: opendir(%s) %s\n", - dir, strerror(errno)); - return -1; - } - *nr = 0; - while ((dp = readdir(dirp)) != NULL) { - if ( -#if 0 - strcmp(dp->d_name, ".") != 0 && - strcmp(dp->d_name, "..") != 0 -#else - dp->d_name[0] != '.' -#endif - ) { - snprintf(filename, MAXPATHLEN-1, "%s/%s", dir, dp->d_name); - if (lstat(filename, &st) == 0){ - if ((st.st_mode & flags) == 0) - continue; - -#if EXPAND_RECURSIVE - if (S_ISDIR(st.st_mode)) { - int nrsav = *nr; - if(expand_dir(filename, nr, commands, detail) < 0) - goto quit; - while(nrsav < *nr) { - len = strlen(dp->d_name) + strlen((*commands)[nrsav]) + 2; - if((str = malloc(len)) == NULL) { - fprintf(stderr, "expand_dir: malloc: %s\n", - strerror(errno)); - goto quit; - } - snprintf(str, len-1, "%s/%s", - dp->d_name, (*commands)[nrsav]); - free((*commands)[nrsav]); - (*commands)[nrsav] = str; - - nrsav++; - } - continue; - } -#endif - if ((cmd = strdup(dp->d_name)) == NULL) { - fprintf(stderr, "expand_dir: strdup: %s\n", - strerror(errno)); - goto quit; - } -#ifndef __APPLE__ - if (0 &&detail){ - if ((pw = getpwuid(st.st_uid)) == NULL){ - fprintf(stderr, "expand_dir: getpwuid(%d): %s\n", - st.st_uid, strerror(errno)); - goto quit; - } - len = strlen(cmd) + - strlen(pw->pw_name) + -#ifdef __FreeBSD__ - strlen(ctime(&st.st_mtimespec.tv_sec)) + -#else - strlen(ctime(&st.st_mtim.tv_sec)) + -#endif - - strlen("{ by }") + 1 /* \0 */; - if ((str=realloc(cmd, strlen(cmd)+len)) == NULL) { - fprintf(stderr, "expand_dir: malloc: %s\n", - strerror(errno)); - goto quit; - } - snprintf(str + strlen(dp->d_name), - len - strlen(dp->d_name), - "{%s by %s}", -#ifdef __FreeBSD__ - ctime(&st.st_mtimespec.tv_sec), -#else - ctime(&st.st_mtim.tv_sec), -#endif - - pw->pw_name - ); - cmd = str; - } -#endif /* __APPLE__ */ - if (((*commands) = - realloc(*commands, ((*nr)+1)*sizeof(char**))) == NULL){ - perror("expand_dir: realloc"); - goto quit; - } - (*commands)[(*nr)] = cmd; - (*nr)++; - if (*nr >= 128) /* Limit number of options */ - break; - } - } - } - retval = 0; - quit: - closedir(dirp); - return retval; -} - /*! CLI callback show yang spec. If arg given matches yang argument string */ int show_yang(clicon_handle h, @@ -974,7 +855,7 @@ cli_show_options(clicon_handle h, while ((x = xml_child_each(clicon_conf_xml(h), x, CX_ELMNT)) != NULL) { if (strcmp(xml_name(x), "CLICON_YANG_DIR") != 0) continue; - fprintf(stdout, "%s: \"%s\"", xml_name(x), xml_body(x)); + fprintf(stdout, "%s: \"%s\"\n", xml_name(x), xml_body(x)); } x = NULL; while ((x = xml_child_each(clicon_conf_xml(h), x, CX_ELMNT)) != NULL) { diff --git a/apps/cli/clixon_cli_api.h b/apps/cli/clixon_cli_api.h index e92658c7..2a5d4a60 100644 --- a/apps/cli/clixon_cli_api.h +++ b/apps/cli/clixon_cli_api.h @@ -114,7 +114,6 @@ int cli_copy_config(clicon_handle h, cvec *cvv, cvec *argv); int cli_help(clicon_handle h, cvec *vars, cvec *argv); /* In cli_show.c */ -int expand_dir(char *dir, int *nr, char ***commands, mode_t flags, int detail); int expand_dbvar(void *h, char *name, cvec *cvv, cvec *argv, cvec *commands, cvec *helptexts); diff --git a/aux/config.guess b/config-aux/config.guess similarity index 99% rename from aux/config.guess rename to config-aux/config.guess index f7727026..1972fda8 100644 --- a/aux/config.guess +++ b/config-aux/config.guess @@ -2,7 +2,7 @@ # Attempt to guess a canonical system name. # Copyright 1992-2021 Free Software Foundation, Inc. -timestamp='2021-01-01' +timestamp='2021-01-25' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by @@ -188,10 +188,9 @@ case "$UNAME_MACHINE:$UNAME_SYSTEM:$UNAME_RELEASE:$UNAME_VERSION" in # # Note: NetBSD doesn't particularly care about the vendor # portion of the name. We always set it to "unknown". - sysctl="sysctl -n hw.machine_arch" UNAME_MACHINE_ARCH=$( (uname -p 2>/dev/null || \ - "/sbin/$sysctl" 2>/dev/null || \ - "/usr/sbin/$sysctl" 2>/dev/null || \ + /sbin/sysctl -n hw.machine_arch 2>/dev/null || \ + /usr/sbin/sysctl -n hw.machine_arch 2>/dev/null || \ echo unknown)) case "$UNAME_MACHINE_ARCH" in aarch64eb) machine=aarch64_be-unknown ;; @@ -1483,8 +1482,8 @@ EOF i*86:rdos:*:*) echo "$UNAME_MACHINE"-pc-rdos exit ;; - i*86:AROS:*:*) - echo "$UNAME_MACHINE"-pc-aros + *:AROS:*:*) + echo "$UNAME_MACHINE"-unknown-aros exit ;; x86_64:VMkernel:*:*) echo "$UNAME_MACHINE"-unknown-esx diff --git a/aux/config.sub b/config-aux/config.sub similarity index 99% rename from aux/config.sub rename to config-aux/config.sub index b0f84923..7f7d0b05 100644 --- a/aux/config.sub +++ b/config-aux/config.sub @@ -2,7 +2,7 @@ # Configuration validation subroutine script. # Copyright 1992-2021 Free Software Foundation, Inc. -timestamp='2021-01-07' +timestamp='2021-03-10' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by @@ -1683,12 +1683,15 @@ fi # Now, validate our (potentially fixed-up) OS. case $os in - # Sometimes we do "kernel-abi", so those need to count as OSes. + # Sometimes we do "kernel-libc", so those need to count as OSes. musl* | newlib* | uclibc*) ;; - # Likewise for "kernel-libc" + # Likewise for "kernel-abi" eabi* | gnueabi*) ;; + # VxWorks passes extra cpu info in the 4th filed. + simlinux | simwindows | spe) + ;; # Now accept the basic system types. # The portable systems comes first. # Each alternative MUST end in a * to match a version number. @@ -1709,7 +1712,7 @@ case $os in | bosx* | nextstep* | cxux* | aout* | elf* | oabi* \ | ptx* | coff* | ecoff* | winnt* | domain* | vsta* \ | udi* | lites* | ieee* | go32* | aux* | hcos* \ - | chorusrdb* | cegcc* | glidix* \ + | chorusrdb* | cegcc* | glidix* | serenity* \ | cygwin* | msys* | pe* | moss* | proelf* | rtems* \ | midipix* | mingw32* | mingw64* | mint* \ | uxpv* | beos* | mpeix* | udk* | moxiebox* \ @@ -1751,6 +1754,8 @@ case $kernel-$os in ;; kfreebsd*-gnu* | kopensolaris*-gnu*) ;; + vxworks-simlinux | vxworks-simwindows | vxworks-spe) + ;; nto-qnx*) ;; os2-emx) diff --git a/aux/install-sh b/config-aux/install-sh similarity index 100% rename from aux/install-sh rename to config-aux/install-sh diff --git a/configure b/configure index 28479cda..4ce6cf53 100755 --- a/configure +++ b/configure @@ -2229,7 +2229,7 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu # where autotool scripts are: install-sh, config.sub, config.guess ac_aux_dir= -for ac_dir in aux "$srcdir"/aux; do +for ac_dir in config-aux "$srcdir"/config-aux; do if test -f "$ac_dir/install-sh"; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/install-sh -c" @@ -2245,7 +2245,7 @@ for ac_dir in aux "$srcdir"/aux; do fi done if test -z "$ac_aux_dir"; then - as_fn_error $? "cannot find install-sh, install.sh, or shtool in aux \"$srcdir\"/aux" "$LINENO" 5 + as_fn_error $? "cannot find install-sh, install.sh, or shtool in config-aux \"$srcdir\"/config-aux" "$LINENO" 5 fi # These three variables are undocumented and unsupported, diff --git a/configure.ac b/configure.ac index 4ec7245f..f8013356 100644 --- a/configure.ac +++ b/configure.ac @@ -46,7 +46,7 @@ AC_INIT(lib/clixon/clixon.h.in) : ${LINKAGE=dynamic} # where autotool scripts are: install-sh, config.sub, config.guess -AC_CONFIG_AUX_DIR(aux) +AC_CONFIG_AUX_DIR(config-aux) CLIXON_VERSION_MAJOR="5" CLIXON_VERSION_MINOR="1"