File: put%28c%29

package info (click to toggle)
sdcc 3.8.0%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 99,212 kB
  • sloc: ansic: 918,594; cpp: 69,526; makefile: 56,790; sh: 29,616; asm: 12,364; perl: 12,136; yacc: 7,179; lisp: 1,672; python: 812; lex: 773; awk: 495; sed: 89
file content (83 lines) | stat: -rwxr-xr-x 1,163 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
#!/bin/sh

# Functions

debug()
{
  if [ "$DEBUG" = "yes" ]; then
    echo $*
  fi
}


# Parsing options

DEBUG=no
STARTYEAR=`date +%Y`
YEAR=`date +%y`
FILES=""

while [ "$1" != "" ]; do
case $1 in
  "-s")
    shift
    STARTYEAR=$1
    ;;
  "-V")
    DEBUG=yes
    ;;
  *)
    if [ "$FILES" = "" ]; then
      FILES=$1
    else
      FILES="${FILES} ${1}"
    fi
    ;;
esac
shift
done

debug "STARTYEAR= ${STARTYEAR}"
debug "FILES= ${FILES}"
debug "YEAR= ${YEAR}"


# Doing the job

putit()
{
    debug "F= ${1}"
  sed -n '/^\/\*@1@\*\//,$p' $1 >${1}.tmp
  if [ -f '(c).1' ]; then
    (sed 's|@@F@@|'${1}'|g
          s|@@S@@|'${STARTYEAR}'|g
          s|@@Y@@|'${YEAR}'|g' '(c).1'
     cat ${1}.tmp) >$1
  else
    (cat <<EOF
/*
 * Simulator of MCS51 ${1}
 *
 * Copyright (c) Drotos Daniel, Talker Bt.  ${STARTYEAR},${YEAR}
 *
 */
EOF
     cat ${1}.tmp) >$1
  fi
  rm -f ${1}.tmp
}

for FILE in ${FILES}; do
  debug "Checking ${FILE}..."
  if grep '^/\*@1@\*/' $FILE >/dev/null; then
    # can do
    debug "/*@1@*/ marker found in ${FILE}"
    putit $FILE
  else
    # can not
    debug "/*@1@*/ marker not found in ${FILE}"
  fi
done


# End of putcopyright